:root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --ink: #1f2733;
    --muted: #6b7686;
    --line: #e2e7f0;
    --brand: #1f4e8c;
    --brand-dark: #163a69;
    --good: #2e7d32;
    --warn: #b26a00;
    --bad: #b3261e;
    --excellent: #2e7d32;
    --satisfactory: #b26a00;
    --weak: #b3261e;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

a { color: var(--brand); }

nav.topbar {
    background: var(--brand);
    color: #fff;
    display: flex;
    align-items: center;
    gap: .25rem;
    padding: 0 1rem;
    flex-wrap: wrap;
}
nav.topbar .brand {
    font-weight: 700;
    font-size: .95rem;
    padding: .9rem 1rem .9rem 0;
    margin-right: .5rem;
}
nav.topbar a {
    color: #dfe8f5;
    text-decoration: none;
    padding: .9rem .85rem;
    font-size: .92rem;
}
nav.topbar a:hover { background: var(--brand-dark); color: #fff; }
nav.topbar a.active { background: var(--brand-dark); color: #fff; }
nav.topbar .spacer { flex: 1; }

main {
    max-width: 1040px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

h1 { font-size: 1.4rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.1rem; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 2px rgba(20, 40, 80, .04);
}

.muted { color: var(--muted); }
.small { font-size: .85rem; }

.flash, .error {
    border-radius: 8px;
    padding: .7rem 1rem;
    margin-bottom: 1rem;
    font-size: .92rem;
}
.flash { background: #e7f5e9; color: var(--good); border: 1px solid #bfe3c5; }
.error { background: #fdeceb; color: var(--bad); border: 1px solid #f5c6c2; }

.warning-box {
    background: #fff8e6; border: 1px solid #f0d68a; color: #6b5300;
    border-radius: 8px; padding: .9rem 1rem; margin-bottom: 1.25rem;
    font-size: .9rem; line-height: 1.45; max-width: 600px;
}

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; background: #fafbfe; }
tr:hover td { background: #fafbff; }
td.num, th.num { text-align: center; }

.btn {
    display: inline-block;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: .55rem 1rem;
    font-size: .92rem;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: #eaeef6; color: var(--ink); }
.btn.secondary:hover { background: #dde4f0; }
.btn.small { padding: .35rem .7rem; font-size: .82rem; }

input[type=text], input[type=password], input[type=file] {
    padding: .5rem .6rem;
    border: 1px solid var(--line);
    border-radius: 7px;
    width: 100%;
    font-size: .95rem;
}
label { display: block; margin: .8rem 0 .3rem; font-size: .9rem; font-weight: 600; }

.pill { padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.pill.done { background: #e7f5e9; color: var(--good); }
.pill.todo { background: #f1f3f7; color: var(--muted); }

/* Login */
.login-wrap { max-width: 360px; margin: 6vh auto; }
.login-wrap .card { padding: 1.6rem; }

/* Steps on dashboard */
.steps { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.step { border: 1px solid var(--line); border-radius: 10px; padding: 1rem; background: #fff; }
.step .n { font-size: .8rem; color: var(--muted); font-weight: 700; }
.step .v { font-size: 1.5rem; font-weight: 700; margin: .3rem 0; }

/* Evaluation sliders */
.criterion { border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; margin-bottom: 1rem; }
.criterion .head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.criterion .title { font-weight: 700; }
.criterion .score { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.1rem; }
.criterion input[type=range] { width: 100%; margin: .9rem 0 .4rem; accent-color: var(--brand); }
.levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-top: .5rem; }
.level {
    border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem;
    font-size: .8rem; opacity: .55; transition: all .12s ease;
}
.level .ln { font-weight: 700; display: block; margin-bottom: .2rem; }
.level .lr { color: var(--muted); font-size: .75rem; }
.level.active { opacity: 1; border-width: 2px; box-shadow: 0 1px 4px rgba(20,40,80,.08); }
.level.active[data-level="Excellent"] { border-color: var(--excellent); }
.level.active[data-level="Good"] { border-color: var(--brand); }
.level.active[data-level="Satisfactory"] { border-color: var(--satisfactory); }
.level.active[data-level="Weak"] { border-color: var(--weak); }

.totalbar {
    position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line);
    padding: 1rem; display: flex; align-items: center; gap: 1rem; justify-content: flex-end;
    border-radius: 0 0 10px 10px;
}
.totalbar .grand { margin-right: auto; font-size: 1.05rem; }
.totalbar .grand b { font-size: 1.3rem; }

.charts { display: grid; gap: 1.25rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .charts { grid-template-columns: 1fr; } }

/* Marking hub: progress, search, filter chips */
.progress-wrap { margin: .4rem 0 1rem; }
.progress-track { background: #eef1f7; border-radius: 999px; height: 10px; overflow: hidden; }
.progress-fill { background: var(--good); height: 100%; width: 0; transition: width .3s ease; }
.progress-label { margin-top: .35rem; }

.hub-toolbar { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.search-input { flex: 1; min-width: 220px; }

.chips { display: flex; gap: .4rem; }
.chip {
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    border-radius: 999px; padding: .4rem .85rem; font-size: .85rem; cursor: pointer;
}
.chip:hover { background: #f3f6fb; }
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip-n {
    display: inline-block; min-width: 1.4em; text-align: center;
    background: rgba(0,0,0,.08); border-radius: 999px; padding: 0 .3em;
    margin-left: .25rem; font-size: .78rem;
}
.chip.active .chip-n { background: rgba(255,255,255,.25); }

tr.just-saved td { background: #fff7e0 !important; transition: background 1s ease; }

/* Jump-to-student selector on the evaluate page */
.jump-bar { display: flex; gap: .6rem; align-items: center; margin: .2rem 0 1rem; flex-wrap: wrap; }
.jump-bar select { padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 7px; min-width: 280px; font-size: .9rem; }
