/*
 * SRGrad — the dark Scholastic Partner Portal.
 *
 * The palette lives in TOKENS on :root, and those token names are the exact
 * ones src/brands.js overrides at runtime. SR is therefore a no-op — the page
 * looks right before a byte of brand JSON arrives — and POMP is ten values set
 * on the document element. The test suite checks the two files still agree, so
 * they cannot quietly drift.
 *
 * STATUS COLOUR IS SEMANTIC AND FIXED ACROSS BRANDS. The blueprint's red pen
 * asked for at-risk items in yellow or red, so `.attn-red` and `.attn-yellow`
 * are their own tokens rather than shades of the accent: a POMP school's
 * at-risk item must be as red as an SR school's, because red means late, not
 * "brand colour three".
 *
 * BUILT FOR REMOTE USE, per the blueprint's own subtitle. Everything is fluid
 * down to a phone: the left navigation becomes a horizontal scroller, the
 * timeline scrolls sideways, and every table becomes cards below 720px rather
 * than a horizontal scrollbar nobody finds.
 */

:root {
  --bg: #080b1a;
  --bg-deep: #05070f;
  --panel: #101632;
  --panel-2: #161d3f;
  --panel-edge: rgba(124, 108, 240, 0.22);
  --ink: #f2f4ff;
  --ink-soft: #b7bde0;
  --ink-faint: #7b82ab;
  --accent: #7c6cf0;
  --accent-2: #4ad6c0;
  --accent-ink: #a99bff;
  --rule: rgba(160, 168, 220, 0.14);

  /* Semantic, never brand. */
  --good: #4ad6c0;
  --good-bg: rgba(74, 214, 192, 0.14);
  --warn: #e9b949;
  --warn-bg: rgba(233, 185, 73, 0.14);
  --bad: #ff6b7d;
  --bad-bg: rgba(255, 107, 125, 0.14);
  --idle: #8b93bb;
  --idle-bg: rgba(139, 147, 187, 0.12);

  --radius: 14px;
  --radius-sm: 9px;
  --gap: 18px;
  --shell: 1560px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(124, 108, 240, 0.16), transparent 60%),
    radial-gradient(900px 500px at 95% 0%, rgba(74, 214, 192, 0.08), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }

::selection { background: var(--accent); color: #fff; }

:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------------------------ shell */

.shell { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--gap); max-width: var(--shell); margin: 0 auto; padding: var(--gap); align-items: start; }
.shell--wide { grid-template-columns: minmax(0, 1fr); }

@media (max-width: 1020px) { .shell { grid-template-columns: minmax(0, 1fr); } }

/* -------------------------------------------------------------- sidebar */

.side { position: sticky; top: var(--gap); display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 1020px) { .side { position: static; } }

.brandmark { display: flex; gap: 12px; align-items: flex-start; padding: 4px 2px 2px; }
.brandmark .mono {
  width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; letter-spacing: 0.02em; color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
}
.brandmark img.mono { object-fit: contain; background: #fff; padding: 5px; }
.brandmark h1 { font-size: 13px; font-weight: 800; letter-spacing: 0.055em; text-transform: uppercase; }
.brandmark p { margin: 5px 0 0; font-size: 12px; color: var(--ink-faint); line-height: 1.4; }

.schoolcard { background: linear-gradient(160deg, var(--panel-2), var(--panel)); border: 1px solid var(--panel-edge); border-radius: var(--radius); padding: 16px; }
.schoolcard .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.schoolcard h2 { font-size: 16px; font-weight: 750; }
.schoolcard .when { margin: 6px 0 14px; font-size: 12px; color: var(--ink-soft); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.tile { background: rgba(5, 7, 15, 0.5); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 10px 11px; min-width: 0; }
.tile .k { font-size: 9.5px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-faint); }
.tile .v { margin-top: 5px; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.tile .n { margin-top: 3px; font-size: 10.5px; color: var(--ink-faint); }
.tile.attn-red { border-color: rgba(255, 107, 125, 0.5); background: var(--bad-bg); }
.tile.attn-red .v, .tile.attn-red .k { color: var(--bad); }
.tile.attn-yellow { border-color: rgba(233, 185, 73, 0.45); background: var(--warn-bg); }
.tile.attn-yellow .v, .tile.attn-yellow .k { color: var(--warn); }

/* The blueprint's ACTIVE SEASON pill. */
.pill-season { flex: none; padding: 5px 11px; border-radius: 999px; font-size: 9.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #04121a; background: linear-gradient(100deg, var(--accent-2), #7ce0a8); }
.pill-season.off { background: var(--idle-bg); color: var(--ink-faint); }

nav.nav { display: flex; flex-direction: column; gap: 7px; }
nav.nav button {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 11px 13px; color: var(--ink); font: inherit;
}
nav.nav button:hover { border-color: var(--panel-edge); background: var(--panel-2); }
nav.nav button[aria-current="true"] { background: linear-gradient(120deg, rgba(124, 108, 240, 0.3), rgba(124, 108, 240, 0.12)); border-color: var(--accent); }
nav.nav .ico { width: 30px; height: 30px; flex: none; border-radius: 8px; display: grid; place-items: center; font-size: 14px; background: rgba(124, 108, 240, 0.16); }
nav.nav .lbl { min-width: 0; }
nav.nav .lbl b { display: block; font-size: 11.5px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
nav.nav .lbl span { display: block; font-size: 11px; color: var(--ink-faint); }
nav.nav .badge { margin-left: auto; flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; background: var(--bad-bg); color: var(--bad); }
nav.nav .badge.yellow { background: var(--warn-bg); color: var(--warn); }

@media (max-width: 1020px) {
  nav.nav { flex-direction: row; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
  nav.nav button { width: auto; flex: none; }
  nav.nav .lbl span { display: none; }
}

/* ---------------------------------------------------------------- panels */

.main { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }

.card { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.card > header { padding: 16px 18px 14px; background: linear-gradient(150deg, rgba(124, 108, 240, 0.14), transparent 70%); border-bottom: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.card > header h2 { font-size: 12.5px; font-weight: 850; letter-spacing: 0.075em; text-transform: uppercase; }
.card > header p { margin: 5px 0 0; font-size: 12px; color: var(--ink-soft); max-width: 78ch; }
.card > .body { padding: 16px 18px 18px; }
.card > .body.flush { padding: 0; }

.page-head h1 { font-size: 21px; font-weight: 850; letter-spacing: 0.03em; text-transform: uppercase; }

/* ------------------------------------------------------------- controls */

.btn { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; border-radius: 9px; border: 1px solid var(--panel-edge); background: var(--panel-2); color: var(--ink); font: inherit; font-size: 12.5px; font-weight: 700; padding: 8px 14px; }
.btn:hover { border-color: var(--accent); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(110deg, var(--accent), #6455e6); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--bad-bg); border-color: rgba(255, 107, 125, 0.45); color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 11.5px; }
.btn.link { background: none; border: none; padding: 0; color: var(--accent-ink); font-size: 11.5px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.btn.link:hover { text-decoration: underline; }

input, select, textarea {
  width: 100%; background: rgba(5, 7, 15, 0.55); border: 1px solid var(--rule); border-radius: 9px;
  padding: 9px 11px; color: var(--ink); font: inherit; font-size: 13.5px;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
textarea { min-height: 100px; resize: vertical; font-family: inherit; }
label.f { display: block; }
label.f > span { display: block; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 5px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.search { position: relative; min-width: 240px; flex: 1 1 240px; max-width: 420px; }
.search input { padding-left: 34px; }
.search::before { content: "⌕"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); font-size: 15px; }

/* --------------------------------------------------------------- status */

.status { display: inline-flex; align-items: center; white-space: nowrap; padding: 4px 11px; border-radius: 999px; font-size: 9.5px; font-weight: 850; letter-spacing: 0.07em; text-transform: uppercase; border: 1px solid transparent; }
.status.good { background: var(--good-bg); color: var(--good); border-color: rgba(74, 214, 192, 0.35); }
.status.active { background: rgba(124, 108, 240, 0.16); color: var(--accent-ink); border-color: rgba(124, 108, 240, 0.4); }
.status.warn { background: var(--warn-bg); color: var(--warn); border-color: rgba(233, 185, 73, 0.4); }
.status.bad { background: var(--bad-bg); color: var(--bad); border-color: rgba(255, 107, 125, 0.4); }
.status.idle { background: var(--idle-bg); color: var(--ink-faint); border-color: var(--rule); }

.attn-red { color: var(--bad); }
.attn-yellow { color: var(--warn); }

/* ------------------------------------------------------------- timeline */

.timeline { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: thin; }
.stage { flex: 0 0 236px; background: var(--panel-2); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 13px; display: flex; flex-direction: column; gap: 9px; }
.stage.attn-red { border-color: rgba(255, 107, 125, 0.45); }
.stage.attn-yellow { border-color: rgba(233, 185, 73, 0.4); }
.stage .hd { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.stage h3 { font-size: 11.5px; font-weight: 800; letter-spacing: 0.045em; text-transform: uppercase; }
.stage .due { font-size: 11.5px; color: var(--ink-soft); }
.bar { height: 4px; border-radius: 999px; background: rgba(5, 7, 15, 0.7); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.stage footer { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--ink-faint); margin-top: auto; }

/* ---------------------------------------------------------------- gauge */

.gauge { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 20px; align-items: center; }
@media (max-width: 620px) { .gauge { grid-template-columns: minmax(0, 1fr); } }
.dial { position: relative; width: 168px; height: 168px; }
.dial svg { transform: rotate(-90deg); }
.dial .mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.dial .mid b { display: block; font-size: 30px; font-weight: 850; letter-spacing: -0.02em; }
.dial .mid span { display: block; font-size: 10px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-faint); }
.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 11px; }
.legend div { background: rgba(5, 7, 15, 0.42); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 10px 12px; }
.legend b { display: block; font-size: 21px; font-weight: 800; }
.legend span { font-size: 10px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-faint); }

input[type="range"] { -webkit-appearance: none; appearance: none; background: transparent; padding: 0; border: none; height: 22px; }
input[type="range"]::-webkit-slider-runnable-track { height: 5px; border-radius: 999px; background: rgba(5, 7, 15, 0.75); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 17px; height: 17px; margin-top: -6px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; cursor: pointer; }
input[type="range"]::-moz-range-track { height: 5px; border-radius: 999px; background: rgba(5, 7, 15, 0.75); }
input[type="range"]::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; cursor: pointer; }

/* --------------------------------------------------------------- tables */

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; padding: 10px 18px; font-size: 9.5px; font-weight: 850; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-faint); border-bottom: 1px solid var(--rule); }
table.t td { padding: 13px 18px; border-bottom: 1px solid var(--rule); font-size: 13px; vertical-align: middle; }
table.t tr:last-child td { border-bottom: none; }
table.t tbody tr:hover { background: rgba(124, 108, 240, 0.05); }
table.t td.name { font-weight: 700; }

@media (max-width: 720px) {
  table.t, table.t tbody, table.t tr, table.t td { display: block; width: 100%; }
  table.t thead { display: none; }
  table.t tr { border-bottom: 1px solid var(--rule); padding: 6px 0; }
  table.t td { border: none; padding: 5px 18px; display: flex; justify-content: space-between; gap: 14px; }
  table.t td::before { content: attr(data-label); font-size: 9.5px; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); flex: none; }
}

/* ---------------------------------------------------------------- lists */

.stack { display: flex; flex-direction: column; gap: 11px; }
.item { background: var(--panel-2); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 13px 15px; }
.item.attn-red { border-color: rgba(255, 107, 125, 0.4); }
.item.attn-yellow { border-color: rgba(233, 185, 73, 0.4); }
.item h4 { font-size: 13px; font-weight: 750; }
.item p { margin: 5px 0 0; font-size: 12px; color: var(--ink-soft); }
.item .meta { margin-top: 8px; font-size: 11px; color: var(--ink-faint); }

.proof { background: rgba(5, 7, 15, 0.4); border: 1px dashed var(--rule); border-radius: var(--radius-sm); min-height: 130px; display: grid; place-items: center; text-align: center; padding: 18px; color: var(--ink-faint); font-size: 12px; }
.proof img { max-width: 100%; border-radius: 8px; }

.note { border-left: 3px solid var(--accent); background: rgba(124, 108, 240, 0.08); border-radius: 0 9px 9px 0; padding: 11px 14px; font-size: 12.5px; color: var(--ink-soft); }
.note.warn { border-color: var(--warn); background: var(--warn-bg); }
.note.bad { border-color: var(--bad); background: var(--bad-bg); }
.note.good { border-color: var(--good); background: var(--good-bg); }

.empty { text-align: center; padding: 36px 18px; color: var(--ink-faint); font-size: 13px; }

.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip { padding: 4px 10px; border-radius: 999px; background: rgba(5, 7, 15, 0.5); border: 1px solid var(--rule); font-size: 11px; color: var(--ink-soft); }

/* --------------------------------------------------------------- toasts */

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 9px; max-width: min(400px, calc(100vw - 32px)); }
.toast { background: var(--panel-2); border: 1px solid var(--panel-edge); border-left-width: 3px; border-radius: 9px; padding: 11px 14px; font-size: 12.5px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); }
.toast.good { border-left-color: var(--good); }
.toast.bad { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }

/* --------------------------------------------------------------- dialog */

dialog { border: 1px solid var(--panel-edge); border-radius: var(--radius); background: var(--panel); color: var(--ink); padding: 0; max-width: min(680px, calc(100vw - 32px)); width: 100%; }
dialog::backdrop { background: rgba(4, 6, 14, 0.76); backdrop-filter: blur(3px); }
dialog header { padding: 16px 18px; border-bottom: 1px solid var(--rule); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
dialog header h3 { font-size: 12.5px; font-weight: 850; letter-spacing: 0.07em; text-transform: uppercase; }
dialog .body { padding: 18px; display: flex; flex-direction: column; gap: 13px; max-height: 68vh; overflow: auto; }
dialog footer { padding: 14px 18px; border-top: 1px solid var(--rule); display: flex; justify-content: flex-end; gap: 9px; }

/* ---------------------------------------------------------------- login */

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate form { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--panel-edge); border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; gap: 15px; }
.gate .brandmark { padding: 0 0 4px; }

/* ------------------------------------------------------------ directory */

.dirgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 15px; }
.school { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; text-align: left; cursor: pointer; color: inherit; font: inherit; padding: 0; }
.school:hover { border-color: var(--accent); }
.school .shot { aspect-ratio: 16 / 10; background: linear-gradient(140deg, var(--panel-2), var(--bg-deep)); display: grid; place-items: center; overflow: hidden; }
.school .shot img { width: 100%; height: 100%; object-fit: cover; }
.school .shot span { font-size: 30px; font-weight: 850; color: var(--ink-faint); letter-spacing: 0.05em; }
.school .meta { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.school h3 { font-size: 13.5px; font-weight: 750; }
.school .sub { font-size: 11.5px; color: var(--ink-faint); }
.school .foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 4px; }
.price { font-size: 14px; font-weight: 800; }
.brandtag { font-size: 9px; font-weight: 850; letter-spacing: 0.09em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--rule); color: var(--ink-faint); }
.brandtag.pomp { color: #e8bf72; border-color: rgba(214, 162, 74, 0.4); }
.brandtag.sr { color: var(--accent-ink); border-color: rgba(124, 108, 240, 0.4); }

.hero { max-width: var(--shell); margin: 0 auto; padding: 44px var(--gap) 10px; }
.hero h1 { font-size: clamp(26px, 4.4vw, 42px); font-weight: 850; letter-spacing: -0.02em; }
.hero p { margin: 12px 0 0; max-width: 62ch; color: var(--ink-soft); font-size: 15px; }
.hero .row { margin-top: 22px; }

.skel { background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 37%, var(--panel) 63%); background-size: 400% 100%; animation: sh 1.3s ease-in-out infinite; border-radius: var(--radius); }
@keyframes sh { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }

.footer { max-width: var(--shell); margin: 0 auto; padding: 30px var(--gap) 44px; color: var(--ink-faint); font-size: 11.5px; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
