/* ClassManager — ZPPSU maroon and gold, styled after a teacher's class record: ruled ledger and highlighter. */
:root {
  --brand: #7b1b28;         /* ZPPSU maroon */
  --brand-2: #962536;       /* hover */
  --brand-deep: #5c111c;    /* sidebar */
  --brand-soft: #f6e8ea;
  --brand-line: #e3c3c8;
  --gold: #d9a21b;          /* ZPPSU gold */
  --paper: #ffffff;
  --grid: #f5f3f2;          /* page background, warm grey */
  --rule: #e2dcda;          /* ruled lines */
  --rule-strong: #c9bfbc;
  --ink: #231b1c;
  --ink-2: #554849;
  --ink-3: #85777a;
  --marker: #f3c84b;        /* highlighter */
  --marker-soft: #fbf0c6;
  --fail: #c4320a;          /* failing grades / absent: orange-red, distinct from maroon */
  --fail-soft: #fdeee6;
  --ok: #2f6b4f;            /* present */
  --ok-soft: #e4f0e9;
  --radius: 6px;
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Bitter", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--grid);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
}
a { color: var(--brand-2); }
a:hover { color: var(--brand); }
:focus-visible { outline: 3px solid var(--marker); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.2; margin: 0 0 .5rem; color: var(--ink); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; }
small, .muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 1.5rem 0; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.rail {
  background: var(--brand-deep);
  color: #f3e3e5;
  border-right: 4px solid var(--gold);
  padding: 1.25rem .9rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { font-family: var(--font-head); font-size: 1.25rem; color: #fff; text-decoration: none; display: flex; align-items: center; gap: .55rem; padding: 0 .5rem .35rem; }
.brand:hover { color: #fff; }
.brand-seal { width: 32px; height: 32px; flex: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.brand-sub { font-size: .78rem; line-height: 1.35; color: #e9c97a; padding: 0 .5rem 1.25rem; }
.rail nav a {
  display: block; color: #eed7da; text-decoration: none;
  padding: .5rem .6rem; border-radius: var(--radius); margin-bottom: 2px;
}
.rail nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.rail nav a.on { background: #fff; color: var(--brand); font-weight: 700; box-shadow: inset 4px 0 0 var(--gold); }
.rail .group { font-size: .78rem; color: #d3a9af; margin: 1.1rem .6rem .35rem; }
.rail .who { border-top: 1px solid rgba(255,255,255,.15); margin-top: 1.5rem; padding: 1rem .6rem 0; font-size: .9rem; }
.rail .who a { color: #fff; }

.main { padding: 1.75rem 2rem 4rem; min-width: 0; }
.wrap { max-width: 1180px; }
.topbar { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head p { margin: .2rem 0 0; color: var(--ink-2); }
.crumbs { font-size: .9rem; margin-bottom: .35rem; color: var(--ink-3); }
.crumbs a { color: var(--ink-2); }

/* ---------------------------------------------------------------- surfaces */
.sheet { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.sheet > h2:first-child, .sheet > h3:first-child { margin-top: 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.sheet-head h2, .sheet-head h3 { margin: 0; }
.cols { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.cols-2 { display: grid; gap: 1.25rem; grid-template-columns: 2fr 1fr; }

/* class list on dashboard: a ruled list rather than cards */
.roll { list-style: none; margin: 0; padding: 0; }
.roll li { border-bottom: 1px solid var(--rule); }
.roll li:last-child { border-bottom: 0; }
.roll a.row { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; padding: .85rem .25rem; text-decoration: none; color: inherit; }
.roll a.row:hover { background: var(--grid); }
.roll .code { font-family: var(--font-head); font-weight: 600; }
.roll .sub { color: var(--ink-2); font-size: .92rem; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.ledger { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.ledger th, table.ledger td { padding: .55rem .6rem; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: middle; }
table.ledger th { font-weight: 700; color: var(--ink-2); font-size: .85rem; background: var(--grid); border-bottom: 2px solid var(--rule-strong); }
table.ledger tbody tr:hover { background: #fcf9f8; }
table.ledger td.num, table.ledger th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.ledger tfoot td { font-weight: 700; border-top: 2px solid var(--rule-strong); }
table.ledger .sticky { position: sticky; left: 0; background: var(--paper); z-index: 1; }
table.ledger th.sticky { background: var(--grid); }

/* gradebook score grid */
table.grid-entry input { width: 4.5rem; text-align: right; }
table.grid-entry td { padding: .3rem .5rem; }

/* ---------------------------------------------------------------- forms */
label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: .3rem; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; font: inherit; color: var(--ink);
  padding: .55rem .65rem; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--marker-soft); }
textarea { min-height: 7rem; resize: vertical; }
.field { margin-bottom: 1rem; }
.field .hint { font-size: .85rem; color: var(--ink-3); margin-top: .25rem; }
.form-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.inline { display: inline; }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; color: var(--ink); }
.check input { width: auto; }

.btn {
  display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
  font: inherit; font-weight: 700; line-height: 1.2;
  padding: .55rem 1rem; border-radius: var(--radius);
  border: 1px solid var(--brand); background: var(--brand); color: #fff;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--brand-2); color: #fff; }
.btn.ghost { background: #fff; color: var(--brand); border-color: var(--rule-strong); }
.btn.ghost:hover { border-color: var(--brand); background: var(--brand-soft); }
.btn.danger { background: #fff; color: var(--fail); border-color: #f0c2ad; }
.btn.danger:hover { background: var(--fail-soft); }
.btn.sm { padding: .3rem .6rem; font-size: .88rem; }
.btn.block { width: 100%; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #3a0a11; }
.btn.gold:hover { background: #ecb52c; border-color: #ecb52c; color: #3a0a11; }

/* Teacher dashboard greeting: maroon band with the seal turning slowly at its edge */
.welcome { position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  background: var(--brand); color: #fff; border-radius: var(--radius); border-bottom: 4px solid var(--gold); padding: 1.6rem 1.5rem; margin-bottom: 1.25rem; min-height: 132px; }
.welcome h1 { color: #fff; margin: 0 0 .25rem; }
.welcome p { margin: 0; color: #f0d9dc; }
.welcome > * { position: relative; z-index: 1; }
.welcome-actions { margin-right: 170px; }
@media (max-width: 900px) { .welcome-actions { margin-right: 0; } }
.welcome::before { content: ""; position: absolute; z-index: 0; width: 300px; height: 300px; right: -40px; top: 50%; margin-top: -150px;
  background: url("img/seal-512.webp") center / contain no-repeat; opacity: .16; animation: gear-turn 240s linear infinite; pointer-events: none; }
@keyframes gear-turn { to { transform: rotate(360deg); } }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- feedback */
.flash { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: var(--ok-soft); border-color: #b7d3c4; color: var(--ok); }
.flash.err { background: var(--fail-soft); border-color: #f0c2ad; color: #8a2406; }
.flash.warn { background: var(--marker-soft); border-color: #ecd68a; color: #5f4b05; }
.flash ul { margin: .25rem 0 0; padding-left: 1.2rem; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--ink-2); }
.empty p { margin-bottom: .75rem; }

.tag { display: inline-block; font-size: .8rem; padding: .1rem .5rem; border-radius: 999px; background: var(--grid); border: 1px solid var(--rule); color: var(--ink-2); }
.tag.on { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.tag.mark { background: var(--marker-soft); border-color: #ecd68a; color: #5f4b05; }

/* equivalent grade badge */
.eq { display: inline-block; min-width: 3.4rem; text-align: center; font-family: var(--font-head); font-weight: 700; padding: .1rem .45rem; border-radius: var(--radius); font-variant-numeric: tabular-nums; }
.eq-high { background: var(--brand); color: #fff; }
.eq-pass { background: var(--marker-soft); color: #5c4304; box-shadow: inset 0 0 0 1px #ecd68a; }
.eq-fail { background: #fff; color: var(--fail); box-shadow: inset 0 0 0 2px var(--fail); }
.eq-none { background: var(--grid); color: var(--ink-3); }

/* period tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--rule-strong); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .55rem .9rem; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -2px; font-weight: 700; }
.tabs a.on { color: var(--brand); border-color: var(--brand); }
.tabs a:hover { color: var(--brand); }

/* attendance */
.att { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 4px; font-weight: 700; font-size: .85rem; }
.att-P { background: var(--ok-soft); color: var(--ok); }
.att-L { background: var(--marker-soft); color: #6b5306; }
.att-A { background: var(--fail-soft); color: var(--fail); }
.att-E { background: #e8ecf3; color: #3d4b66; }
.att-pick { display: flex; gap: .25rem; }
.att-pick input { position: absolute; opacity: 0; pointer-events: none; }
.att-pick label { margin: 0; cursor: pointer; width: 2.3rem; height: 2.1rem; display: grid; place-items: center; border: 1px solid var(--rule-strong); border-radius: 4px; color: var(--ink-3); font-size: .9rem; }
.att-pick input:checked + label.P { background: var(--ok); color: #fff; border-color: var(--ok); }
.att-pick input:checked + label.L { background: var(--marker); color: #3d2f02; border-color: #d3ab25; }
.att-pick input:checked + label.A { background: var(--fail); color: #fff; border-color: var(--fail); }
.att-pick input:checked + label.E { background: #3d4b66; color: #fff; border-color: #3d4b66; }
.att-pick input:focus-visible + label { outline: 3px solid var(--marker); outline-offset: 1px; }

/* weekly schedule */
.week { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.day { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); min-height: 6rem; }
.day h3 { font-size: .95rem; padding: .55rem .75rem; margin: 0; border-bottom: 1px solid var(--rule); background: var(--grid); border-radius: var(--radius) var(--radius) 0 0; }
.day.today h3 { background: var(--marker-soft); }
.slot { padding: .55rem .75rem; border-bottom: 1px dashed var(--rule); font-size: .9rem; }
.slot:last-child { border-bottom: 0; }
.slot .t { font-weight: 700; font-variant-numeric: tabular-nums; }
.slot .r { color: var(--ink-3); }

/* announcements */
.note { border-left: 4px solid var(--marker); padding: .25rem 0 .25rem 1rem; margin-bottom: 1.25rem; }
.note h3 { margin-bottom: .2rem; }
.note .meta { font-size: .85rem; color: var(--ink-3); margin-bottom: .4rem; }
.note .body { white-space: pre-line; }

/* ---------------------------------------------------------------- the grade slip (student breakdown) */
.slip { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 1.25rem; overflow: hidden; }
.slip-top { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; padding: 1.25rem 1.25rem 1rem; border-bottom: 3px solid var(--brand); position: relative; isolation: isolate; overflow: hidden; }
/* A faint stamped seal behind the final grade, like an official record. */
.slip-top::after { content: ""; position: absolute; z-index: -1; right: -18px; top: 50%; width: 170px; height: 170px; transform: translateY(-50%) rotate(-12deg);
  background: url("img/seal-256.webp") center / contain no-repeat; opacity: .11; filter: grayscale(.3); pointer-events: none; }
.slip-top h1 { margin: 0; }
.slip-top .sub { color: var(--ink-2); }
.final { text-align: right; }
.final .big { font-family: var(--font-head); font-size: 3.4rem; line-height: 1; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.final .big.fail { color: var(--fail); }
.final .lbl { font-size: .9rem; color: var(--ink-2); }
.periods { display: grid; grid-template-columns: repeat(3, 1fr); }
.periods > div { padding: .85rem 1.25rem; border-right: 1px solid var(--rule); }
.periods > div:last-child { border-right: 0; }
.periods .p-name { font-size: .88rem; color: var(--ink-2); }
.periods .p-val { font-family: var(--font-head); font-size: 1.45rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* worked computation, written like solving on ruled paper */
.work { padding: 1rem 1.25rem 1.25rem; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(2rem - 1px), #f3e9ea calc(2rem - 1px), #f3e9ea 2rem); }
.work h2 { font-size: 1.15rem; margin: .5rem 0 .25rem; }
.comp { margin: .75rem 0 1rem; }
.comp-head { display: flex; justify-content: space-between; gap: 1rem; font-weight: 700; line-height: 2rem; }
.comp-head .w { color: var(--ink-3); font-weight: 400; }
.acts { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--rule); }
.acts li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; line-height: 2rem; font-variant-numeric: tabular-nums; }
.acts li > span:last-child { white-space: nowrap; }
.acts li small { color: var(--ink-3); white-space: nowrap; }
.acts li .pending { color: var(--ink-3); font-style: italic; }
.eqn { font-variant-numeric: tabular-nums; line-height: 2rem; color: var(--ink-2); padding-left: 1rem; }
.eqn .step { white-space: nowrap; }
.eqn b { color: var(--ink); }
.eqn .res { background: var(--marker-soft); padding: .05rem .35rem; border-radius: 3px; color: var(--ink); font-weight: 700; }
.total-line { border-top: 2px solid var(--ink); margin-top: .5rem; padding-top: .25rem; font-variant-numeric: tabular-nums; line-height: 2rem; }
.total-line .step { white-space: nowrap; }
.locked { padding: 1.25rem; color: var(--ink-2); }

/* ---------------------------------------------------------------- auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: var(--brand-deep); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, rgba(255,255,255,.05) 31px, rgba(255,255,255,.05) 32px); }
.auth-card { width: 100%; max-width: 400px; background: var(--paper); border-radius: 8px; padding: 0 1.75rem 2rem; border-top: 6px solid var(--gold); margin-top: 64px; }
/* The seal sits on the card's top edge and turns into place once, like a gear settling. */
.auth-seal { display: block; width: 128px; height: 128px; margin: -70px auto .5rem; }
.auth-seal img { display: block; width: 100%; height: 100%; filter: drop-shadow(0 6px 14px rgba(40, 0, 6, .45)); animation: seal-settle 1.1s cubic-bezier(.2, .9, .25, 1.15) both; }
@keyframes seal-settle { from { transform: rotate(-60deg) scale(.82); opacity: 0; } to { transform: none; opacity: 1; } }
.auth-school { text-align: center; font-family: var(--font-head); font-weight: 600; font-size: .9rem; line-height: 1.3; color: var(--brand); margin: 0 auto 1.5rem; max-width: 18rem; }
.auth-card h1 { font-size: 1.6rem; }
.auth-card .lead { color: var(--ink-2); margin-bottom: 1.5rem; }
.auth-switch { text-align: center; margin-top: 1.25rem; font-size: .92rem; }
.pin-input { letter-spacing: .4em; font-size: 1.3rem !important; text-align: center; }

/* modal-ish inline editor */
details.editor { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); margin-bottom: 1rem; }
details.editor > summary { cursor: pointer; padding: .7rem 1rem; font-weight: 700; color: var(--brand); list-style: none; }
details.editor > summary::-webkit-details-marker { display: none; }
details.editor > summary::before { content: "+ "; }
details.editor[open] > summary::before { content: "− "; }
details.editor > .inner { padding: 0 1rem 1rem; }

/* ---------------------------------------------------------------- student shell (phone first) */
.s-top { background: var(--brand); color: #fff; border-bottom: 4px solid var(--gold); }
.s-top .in { max-width: 860px; margin: 0 auto; padding: .8rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.s-top .brand { padding: 0; font-size: 1.15rem; }
.s-top .brand-seal { width: 34px; height: 34px; }
.s-top .who { font-size: .88rem; color: #f0d9dc; text-align: right; }
.s-top .who a { color: #fff; }
.s-nav { background: #fff; border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 5; }
.s-nav .in { max-width: 860px; margin: 0 auto; display: flex; overflow-x: auto; }
.s-nav a { padding: .75rem 1rem; text-decoration: none; color: var(--ink-2); font-weight: 700; border-bottom: 3px solid transparent; white-space: nowrap; }
.s-nav a.on { color: var(--brand); border-color: var(--brand); }
.s-main { max-width: 860px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; display: none; }
  .rail.open { display: block; }
  .topbar { display: flex; justify-content: space-between; align-items: center; background: var(--brand-deep); border-bottom: 3px solid var(--gold); padding: .75rem 1rem; }
  .topbar .brand { padding: 0; }
  .welcome::before { right: -90px; width: 240px; height: 240px; margin-top: -120px; }
  .topbar button { background: none; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: var(--radius); padding: .35rem .7rem; font: inherit; }
  .main { padding: 1.25rem 1rem 3rem; }
  .cols-2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .eqn .step, .total-line .step { white-space: normal; }
  .slip-top { grid-template-columns: 1fr; }
  .slip-top::after { opacity: .06; right: -50px; width: 150px; height: 150px; }
  .final { text-align: left; }
  .periods { grid-template-columns: 1fr; }
  .periods > div { border-right: 0; border-bottom: 1px solid var(--rule); display: flex; justify-content: space-between; align-items: center; }
  .periods > div:last-child { border-bottom: 0; }
  h1 { font-size: 1.45rem; }
}
@media print {
  .rail, .topbar, .s-nav, .s-top, .no-print { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .work { background: none; }
  .slip-top::after { opacity: .14; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

/* ---------------------------------------------------------------- self-service sign-up */
.auth-alt { border-top: 1px solid var(--rule); margin-top: 1.25rem; padding-top: 1rem; text-align: center; }
.auth-alt p { margin: 0 0 .5rem; color: var(--ink-2); font-size: .92rem; }
.steps { padding-left: 1.2rem; margin: 0 0 1rem; }
.steps li { margin-bottom: .5rem; }

/* Class code panel: big enough to read from the back of a classroom when projected */
.codebox { display: grid; grid-template-columns: auto 1fr; gap: 1rem 1.5rem; align-items: center; }
.codebox .code { font-family: var(--font-head); font-weight: 700; font-size: 2rem; letter-spacing: .08em; color: var(--brand);
  background: var(--marker-soft); border: 2px dashed #e2c35c; border-radius: var(--radius); padding: .35rem .9rem; white-space: nowrap; user-select: all; }
.codebox .code.off { color: var(--ink-3); background: var(--grid); border-color: var(--rule-strong); text-decoration: line-through; }
.codebox .how { color: var(--ink-2); font-size: .95rem; }
.meter { height: 8px; background: var(--grid); border-radius: 999px; overflow: hidden; margin: .35rem 0 .2rem; }
.meter > span { display: block; height: 100%; background: var(--ok); }
.dropzone { border: 2px dashed var(--brand-line); background: var(--brand-soft); border-radius: var(--radius); padding: 1.25rem; }
.dropzone h2 { margin-bottom: .25rem; }
@media (max-width: 560px) { .codebox { grid-template-columns: 1fr; } .codebox .code { font-size: 1.6rem; text-align: center; } }
@media print { .codebox .code { font-size: 3rem; } }
@media print {
  body.print-code .wrap > *:not(#code) { display: none !important; }
  body.print-code #code { border: 0; text-align: center; }
  body.print-code .codebox { grid-template-columns: 1fr; justify-items: center; }
  body.print-code .meter, body.print-code #code small { display: none; }
}

/* ---------------------------------------------------------------- live clock + today's agenda */
.clock { text-align: right; line-height: 1.1; }
.clock .time { font-family: var(--font-head); font-weight: 700; font-size: 2.1rem; font-variant-numeric: tabular-nums; color: #fff; white-space: nowrap; }
.clock .zone { font-size: .8rem; color: #e9c97a; }
.welcome .clock { margin-left: auto; }
.welcome-actions { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.ag-list { list-style: none; margin: 0; padding: 0; }
.ag { position: relative; padding: .7rem .8rem; border: 1px solid var(--rule); border-left: 4px solid var(--rule-strong); border-radius: var(--radius); margin-bottom: .6rem; background: var(--paper); }
.ag-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.ag-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.ag-main { margin-top: .15rem; }
.ag-main .r { color: var(--ink-3); margin-left: .35rem; white-space: nowrap; }
.ag-count { font-size: .88rem; color: var(--ink-2); font-variant-numeric: tabular-nums; margin-top: .2rem; }
.ag-action { margin-top: .5rem; }
.ag-badge { font-size: .75rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: var(--grid); color: var(--ink-2); }
.ag-now { border-left-color: var(--gold); background: var(--marker-soft); border-color: #ecd68a; }
.ag-now .ag-badge { background: var(--brand); color: #fff; }
.ag-now .ag-count { color: var(--brand); font-weight: 700; }
.ag-next { border-left-color: var(--brand); }
.ag-next .ag-badge { background: var(--brand-soft); color: var(--brand); }
.ag-done { opacity: .55; }
.ag-done .ag-action { display: none; }
.ag-upcoming { border-left-color: var(--rule-strong); }
.ag-after { font-size: .95rem; margin: 1rem 0 .5rem; color: var(--ink-2); }
.ag-progress { height: 4px; background: rgba(123, 27, 40, .12); border-radius: 999px; margin-top: .5rem; overflow: hidden; }
.ag-progress > span { display: block; height: 100%; background: var(--brand); }
.card-clock { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: .9rem; }
@media (max-width: 560px) { .welcome .clock { margin-left: 0; text-align: left; } .clock .time { font-size: 1.7rem; } }

/* ---------------------------------------------------------------- schedule editing */
.sched-class { border-bottom: 1px solid var(--rule); padding: .7rem 0; }
.sched-class:last-of-type { border-bottom: 0; }
.sched-class-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.sched-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .35rem 0 .35rem .9rem; border-left: 2px solid var(--rule); margin: .35rem 0 0 .2rem; }
.popover-form { position: absolute; right: 0; z-index: 5; background: #fff; border: 1px solid var(--rule-strong); border-radius: 6px; padding: 1rem; width: 300px; max-width: calc(100vw - 2rem); box-shadow: 0 8px 24px rgba(40, 0, 6, .12); }
.conflict-box { background: var(--fail-soft); border: 1px solid #f0c2ad; border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1rem; }
.conflict-box ul { margin: .35rem 0 .6rem; padding-left: 1.2rem; }

.steps-plain { margin: 0 0 1rem; padding-left: 1.2rem; }
.steps-plain li { margin-bottom: .35rem; }

/* ---------------------------------------------------------------- icons */
.ic { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.rail nav a { display: flex; align-items: center; gap: .65rem; }
.rail nav a .ic { width: 1.25rem; height: 1.25rem; opacity: .85; }
.rail nav a.on .ic { opacity: 1; color: var(--brand); }
.rail .who-links { display: flex; gap: 1rem; margin-top: .3rem; }
.rail .who-links a { display: inline-flex; align-items: center; gap: .35rem; }
.tabs a { display: inline-flex; align-items: center; gap: .45rem; }
.tabs a .ic { opacity: .75; }
.tabs a.on .ic { opacity: 1; }
.s-nav a { display: inline-flex; align-items: center; gap: .45rem; }
.btn .ic { width: 1.1em; height: 1.1em; vertical-align: 0; }
.btn.sm .ic { width: 1em; height: 1em; }
@media (max-width: 420px) { .s-nav a { padding: .75rem .7rem; } }

/* INC / DRP / UD */
.eq-rem { background: #eef0f5; color: #3d4b66; box-shadow: inset 0 0 0 1px #c9cfdd; }
.final .big.rem { color: #3d4b66; }
.remark-select { width: auto; padding: .25rem .4rem; font-size: .88rem; }

/* absence limit */
.tag.abs-near { background: var(--marker-soft); border-color: #ecd68a; color: #5f4b05; }
.tag.abs-over { background: var(--fail-soft); border-color: #f0c2ad; color: var(--fail); }
.abs-num { font-weight: 700; padding: 0 .3rem; border-radius: 3px; }
.abs-num.abs-near { background: var(--marker-soft); color: #5f4b05; }
.abs-num.abs-over { background: var(--fail); color: #fff; }
.abs-line { margin: .5rem 0 0; padding: .4rem .6rem; border-radius: var(--radius); background: var(--grid); }
.abs-line.abs-near { background: var(--marker-soft); color: #5f4b05; }
.abs-line.abs-over { background: var(--fail-soft); color: var(--fail); }

/* QR check-in */
.qr-start { padding: .9rem 1.25rem; }
.qr-start .ic, .checkin-box h2 .ic { margin-right: .35rem; }
.checkin-box { border-left: 4px solid var(--gold); }
.checkin-box h2 { font-size: 1.1rem; margin: 0; display: flex; align-items: center; }
.code-input { width: 9rem; font-size: 1.4rem; letter-spacing: .2em; text-align: center; font-variant-numeric: tabular-nums; }
.checkin-result { text-align: center; max-width: 28rem; margin: 2rem auto; padding: 2rem 1.5rem; }
.checkin-result .mark { width: 4.5rem; height: 4.5rem; border-radius: 50%; margin: 0 auto 1rem; display: grid; place-items: center; font: 700 2.4rem/1 var(--font-head); color: #fff; background: var(--ok); }
.checkin-result .mark .ic { width: 2.4rem; height: 2.4rem; stroke-width: 2.6; }
.checkin-result.late .mark { background: var(--gold); }
.checkin-result.bad .mark { background: var(--fail); }
.checkin-result h1 { margin: 0 0 .4rem; }

/* score questions */
.question { padding: .7rem 0; border-bottom: 1px solid var(--grid); }
.question:last-child { border-bottom: 0; }
.question .q-msg { margin: .3rem 0; font-style: italic; }
.question .q-form { display: flex; gap: .5rem; align-items: center; }
.question .q-form input { flex: 1; }
.question .q-reply { margin: .3rem 0 0; color: var(--ok); }
.question .q-reply .ic { width: 1em; height: 1em; margin-right: .25rem; vertical-align: -.12em; }
.q-link { font-size: .78rem; color: var(--ink-3); margin-left: .5rem; white-space: nowrap; text-decoration: none; }
.q-link .ic { width: .95em; height: .95em; vertical-align: -.12em; margin-right: .15rem; }
.q-link:hover { color: var(--brand); }
.q-link.open { color: #8a6a00; }
.q-link.done { color: var(--ok); }
h2 .ic, h1 .ic { width: .9em; height: .9em; vertical-align: -.08em; margin-right: .35rem; }
.acts li > span:first-child { flex: 1; }
.acts li .q-link { margin-left: -.5rem; min-width: 4.6rem; }
@media (max-width: 520px) { .acts li .q-link span { display: none; } .acts li .q-link { min-width: 0; } }

/* department */
.print-only { display: none; }
@media print { .print-only { display: block; font-size: 14pt; } .load-teacher { page-break-inside: avoid; } }

/* syllabus + subject description */
.subject-desc { margin: .45rem 0 0; max-width: 70ch; color: var(--ink-2, #4a3d40); font-size: .95rem; line-height: 1.5; }
.subject-desc summary { list-style: none; cursor: pointer; }
.subject-desc summary::-webkit-details-marker { display: none; }
.subject-desc[open] summary { display: none; }
.subject-desc:not([open]) > div { display: none; }
.subject-desc .more { color: var(--brand); font-weight: 600; white-space: nowrap; }
.files { list-style: none; margin: 0; padding: 0; }
.files li { display: flex; gap: .85rem; align-items: flex-start; padding: .7rem 0; border-bottom: 1px solid var(--grid); }
.files li:last-child { border-bottom: 0; }
.files li.hidden-file { opacity: .6; }
.files .thumb { flex: 0 0 64px; height: 80px; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; display: grid; place-items: center; background: #fff; text-decoration: none; }
.files .thumb img { width: 100%; height: 100%; object-fit: cover; }
.files .thumb span { font: 700 .8rem/1 var(--font-head); letter-spacing: .05em; color: #fff; padding: .35rem .45rem; border-radius: 4px; }
.files .kind-pdf span { background: #b3261e; }
.files .kind-word span { background: #2b579a; }
.files .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.files .meta > a { word-break: break-word; }
.file-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; align-items: center; }
.file-actions input { flex: 1 1 10rem; min-width: 8rem; padding: .3rem .5rem; font-size: .88rem; }
.slip-top .subject-desc { font-size: .9rem; }
