/* =========================================================================
   Student Information System — "Slate and Chalk"

   The world this borrows from: slate boards, chalk dust, manila folders with
   coloured tabs, the bell schedule pinned by the office door.

   One idea carries the whole interface: the folder tab. Every record opens
   with an oversized identifier set in a notched tab, and the tab's colour
   says what kind of record you are looking at — teal for a student, marigold
   for an application, slate for a section, plum for an account. Somebody
   glancing at a colleague's screen from across the office knows what they
   have open before reading a word.
   ========================================================================= */

:root {
  /* Surfaces */
  --slate-900: #0E2029;
  --slate-800: #143039;
  --slate-700: #1D414C;
  --slate-600: #2C5866;
  --paper:     #F1F4F3;
  --surface:   #FFFFFF;
  --surface-2: #F7F9F9;

  /* Ink */
  --ink:        #13252C;
  --ink-soft:   #4A6069;
  --ink-faint:  #7C9199;

  /* Lines */
  --rule:        #DDE4E3;
  --rule-strong: #BCC8C7;

  /* Accents — marigold highlights, teal acts, coral warns */
  --marigold:      #C88A1C;
  --marigold-soft: #FBF1DC;
  --teal:          #0E6E62;
  --teal-soft:     #E1F0ED;
  --teal-deep:     #0A554C;
  --plum:          #6B4A7A;
  --plum-soft:     #F0EAF3;
  --coral:         #B14434;
  --coral-soft:    #FBEAE7;

  /* Record tab colours, keyed to record type */
  --tab-student:     var(--teal);
  --tab-application: var(--marigold);
  --tab-section:     var(--slate-600);
  --tab-account:     var(--plum);

  --display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --sans:    "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --rail: 248px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(19, 37, 44, .06), 0 4px 16px -6px rgba(19, 37, 44, .10);
  --shadow-lift: 0 2px 4px rgba(19, 37, 44, .07), 0 12px 28px -10px rgba(19, 37, 44, .18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:     #0D1A1F;
    --surface:   #142329;
    --surface-2: #182B32;
    --ink:       #E4ECEB;
    --ink-soft:  #9DB2B8;
    --ink-faint: #74898F;
    --rule:        #243A41;
    --rule-strong: #33505A;
    --marigold-soft: #33280F;
    --teal-soft:     #10322E;
    --plum-soft:     #2A2033;
    --coral-soft:    #341915;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px -6px rgba(0,0,0,.5);
    --shadow-lift: 0 2px 4px rgba(0,0,0,.45), 0 12px 28px -10px rgba(0,0,0,.6);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--teal); text-underline-offset: 2px; }
a:hover { color: var(--teal-deep); }

:focus-visible {
  outline: 2px solid var(--marigold);
  outline-offset: 2px;
  border-radius: 3px;
}

h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -.015em; }

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

/* =========================================================================
   Shell — fixed rail, scrolling field
   ========================================================================= */

.shell { display: flex; min-height: 100vh; }

.rail {
  width: var(--rail);
  flex: 0 0 var(--rail);
  background: var(--slate-900);
  color: #CBD9DC;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.rail-head {
  padding: 1.35rem 1.25rem 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.rail-mark {
  display: flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
  color: #fff;
}

/* The crest: a folder tab rendered small, so the motif is introduced before
   the first record is ever opened. */
.crest {
  width: 30px; height: 30px;
  flex: 0 0 30px;
  border-radius: 5px 5px 3px 3px;
  background: var(--marigold);
  position: relative;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 600;
  color: var(--slate-900);
}
.crest::before {
  content: "";
  position: absolute; top: -3px; left: 5px;
  width: 13px; height: 4px;
  border-radius: 2px 2px 0 0;
  background: var(--marigold);
}

.rail-mark > span:last-child { min-width: 0; }
.rail-name {
  display: block;
  font-family: var(--display); font-weight: 600; font-size: 1rem; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rail-sub {
  display: block;
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: #7E9AA1;
  margin-top: .1rem;
}

.rail-nav { padding: .85rem .7rem 1.5rem; flex: 1; }

.rail-group + .rail-group { margin-top: 1.15rem; }

.rail-label {
  font-family: var(--mono);
  font-size: .6rem;
  letter-spacing: .19em;
  text-transform: uppercase;
  color: #64838B;
  padding: 0 .55rem .4rem;
}

.rail-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .55rem;
  border-radius: var(--radius-sm);
  color: #C3D3D7;
  text-decoration: none;
  font-size: .92rem;
  font-weight: 450;
  border-left: 2px solid transparent;
  transition: background .12s ease, color .12s ease;
}
.rail-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.rail-link[aria-current="page"] {
  background: rgba(200,138,28,.14);
  color: #fff;
  border-left-color: var(--marigold);
  font-weight: 600;
}

.rail-glyph {
  width: 18px; flex: 0 0 18px;
  font-family: var(--mono);
  font-size: .72rem;
  color: #7E9AA1;
  text-align: center;
}
.rail-link[aria-current="page"] .rail-glyph { color: var(--marigold); }

.rail-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: .68rem;
  background: rgba(255,255,255,.1);
  color: #D6E3E6;
  padding: .05rem .38rem;
  border-radius: 20px;
}
.rail-count.is-warm { background: var(--marigold); color: var(--slate-900); font-weight: 600; }

.rail-foot {
  padding: .9rem 1rem 1.1rem;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: .65rem;
}

.avatar {
  width: 32px; height: 32px; flex: 0 0 32px;
  border-radius: 50%;
  background: var(--slate-600);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 600;
}

.rail-who { min-width: 0; }
.rail-who strong { display: block; font-size: .84rem; color: #fff; font-weight: 550;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-who span {
  font-family: var(--mono); font-size: .6rem; letter-spacing: .13em;
  text-transform: uppercase; color: #7E9AA1;
}

.rail-out {
  margin-left: auto;
  background: none; border: 0; padding: .3rem;
  color: #7E9AA1; cursor: pointer; font: inherit; font-size: .8rem;
  border-radius: var(--radius-sm);
}
.rail-out:hover { color: #fff; background: rgba(255,255,255,.08); }

/* Off-canvas on small screens, driven by a checkbox so it needs no script. */
.rail-toggle { display: none; }
.rail-scrim { display: none; }

.field { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
  padding: .85rem 2rem;
  display: flex; align-items: center; gap: 1rem;
}

.burger {
  display: none;
  background: var(--surface); border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm); padding: .35rem .55rem;
  cursor: pointer; color: var(--ink); font-size: 1rem; line-height: 1;
}

.crumb {
  font-family: var(--mono);
  font-size: .66rem; letter-spacing: .17em; text-transform: uppercase;
  color: var(--ink-faint);
}

.topbar-actions { margin-left: auto; display: flex; gap: .5rem; align-items: center; }

main { padding: 1.75rem 2rem 4rem; max-width: 1180px; width: 100%; }

/* =========================================================================
   Page furniture
   ========================================================================= */

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.35rem;
}

h1 { font-size: 1.65rem; margin: 0; line-height: 1.2; }

.eyebrow {
  font-family: var(--mono);
  font-size: .64rem; letter-spacing: .19em; text-transform: uppercase;
  color: var(--marigold); margin: 0 0 .3rem; font-weight: 500;
}

.stack { display: grid; gap: 1.25rem; }

.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.section-title {
  font-family: var(--mono);
  font-size: .66rem; letter-spacing: .17em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 500;
  padding: .8rem 1.15rem;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
  margin: 0;
}

/* =========================================================================
   Signature: the folder tab
   ========================================================================= */

.record-head {
  display: flex; align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  margin-bottom: 1.5rem;
  overflow: hidden;
  position: relative;
}

/* The coloured edge is the record type. Default is a student record. */
.record-head::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--tab-student);
}
.record-head.is-application::before { background: var(--tab-application); }
.record-head.is-section::before     { background: var(--tab-section); }
.record-head.is-account::before     { background: var(--tab-account); }

.record-tab {
  padding: 1.3rem 1.5rem;
  border-right: 1px solid var(--rule);
  background: var(--surface-2);
  display: flex; flex-direction: column; justify-content: center;
  min-width: 0;
}

.record-tab .label {
  font-family: var(--mono);
  font-size: .6rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-faint);
}

.record-tab .value {
  font-family: var(--mono);
  font-size: 1.7rem; font-weight: 600;
  letter-spacing: -.025em; line-height: 1.1;
  color: var(--ink);
  word-break: break-word;
}

.record-body {
  padding: 1.25rem 1.5rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; flex: 1;
}
.record-body h1 { font-size: 1.5rem; }
.record-legal { font-size: .88rem; color: var(--ink-faint); margin: .2rem 0 0; }
.record-actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }

/* =========================================================================
   Buttons
   ========================================================================= */

.btn {
  font: inherit; font-weight: 550; font-size: .9rem;
  padding: .55rem 1.05rem;
  border: 1px solid var(--teal);
  border-radius: var(--radius-sm);
  background: var(--teal);
  color: #fff;
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: .4rem;
  transition: background .12s ease, transform .06s ease, box-shadow .12s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--teal-deep); border-color: var(--teal-deep); color: #fff; box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }

.btn-quiet {
  background: var(--surface); color: var(--ink); border-color: var(--rule-strong);
}
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); border-color: var(--ink-faint); }

.btn-danger { background: var(--coral); border-color: var(--coral); }
.btn-danger:hover { background: #96382A; border-color: #96382A; }

/* =========================================================================
   Search
   ========================================================================= */

.search { display: flex; margin-bottom: 1.1rem; max-width: 560px; }

.search input, .search select {
  font: inherit;
  padding: .55rem .75rem;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink);
}
.search input {
  flex: 1; min-width: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  border-right: 0;
}
.search select { border-radius: 0; border-left: 1px solid var(--rule); border-right: 0; }
.search input::placeholder { color: var(--ink-faint); }
.search .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* =========================================================================
   Ledger table
   ========================================================================= */

table.ledger {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.panel table.ledger { border: 0; border-radius: 0; box-shadow: none; }

table.ledger th {
  text-align: left;
  font-family: var(--mono);
  font-size: .63rem; letter-spacing: .15em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 500;
  padding: .65rem .95rem;
  border-bottom: 1px solid var(--rule-strong);
  background: var(--surface-2);
  white-space: nowrap;
}

table.ledger td {
  padding: .68rem .95rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: baseline;
}

table.ledger tbody tr { transition: background .1s ease; }
table.ledger tbody tr:hover { background: var(--teal-soft); }
table.ledger tbody tr:last-child td { border-bottom: 0; }

.idnum { font-family: var(--mono); font-size: .85rem; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.name-cell a { font-weight: 550; text-decoration: none; color: var(--ink); }
.name-cell a:hover { color: var(--teal); text-decoration: underline; }
.muted { color: var(--ink-faint); }

/* =========================================================================
   Status pills
   ========================================================================= */

.status {
  font-family: var(--mono);
  font-size: .64rem; letter-spacing: .1em; text-transform: uppercase;
  font-weight: 500;
  padding: .18rem .5rem;
  border-radius: 20px;
  white-space: nowrap;
  display: inline-block;
}
.status-enrolled { color: var(--teal-deep); background: var(--teal-soft); }
.status-inactive { color: var(--coral); background: var(--coral-soft); }
.status-pending  { color: #8A5F12; background: var(--marigold-soft); }

/* =========================================================================
   Definition grid
   ========================================================================= */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  margin: 0;
}
.facts > div {
  padding: .85rem 1.15rem;
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
}
.facts dt {
  font-family: var(--mono);
  font-size: .62rem; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: .22rem;
}
.facts dd { margin: 0; }

/* =========================================================================
   Tiles — the dashboard's at-a-glance row
   ========================================================================= */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.05rem 1.15rem;
  text-decoration: none;
  color: inherit;
  display: block;
  border-top: 3px solid var(--rule-strong);
  transition: box-shadow .14s ease, transform .14s ease;
}
a.tile:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); color: inherit; }

.tile.is-student     { border-top-color: var(--tab-student); }
.tile.is-application { border-top-color: var(--tab-application); }
.tile.is-section     { border-top-color: var(--tab-section); }
.tile.is-account     { border-top-color: var(--tab-account); }

.tile-figure {
  font-family: var(--mono);
  font-size: 2.1rem; font-weight: 600;
  letter-spacing: -.04em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.tile-label {
  font-family: var(--mono);
  font-size: .63rem; letter-spacing: .15em; text-transform: uppercase;
  color: var(--ink-faint); margin-top: .4rem;
}
.tile-note { font-size: .82rem; color: var(--ink-soft); margin-top: .5rem; }

/* =========================================================================
   Forms
   ========================================================================= */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(228px, 1fr));
  gap: 1rem 1.25rem;
  padding: 1.25rem;
}

.form-row label {
  display: block;
  font-family: var(--mono);
  font-size: .62rem; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: .32rem;
}

.field-input, .field-select {
  width: 100%;
  font: inherit;
  padding: .5rem .65rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.field-input:focus, .field-select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
  outline: none;
}
textarea.field-input { min-height: 5rem; resize: vertical; }

.form-row .help { font-size: .78rem; color: var(--ink-faint); margin-top: .28rem; }
.form-row .error { font-size: .8rem; color: var(--coral); margin-top: .28rem; font-weight: 500; }
.form-row.has-error .field-input,
.form-row.has-error .field-select { border-color: var(--coral); }

.form-actions {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--rule);
  background: var(--surface-2);
  display: flex; gap: .6rem; align-items: center; flex-wrap: wrap;
}

/* =========================================================================
   Messages, empties
   ========================================================================= */

.flash {
  padding: .75rem 1rem;
  margin-bottom: 1.25rem;
  border-left: 3px solid var(--teal);
  background: var(--teal-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink);
}
.flash.error { border-left-color: var(--coral); background: var(--coral-soft); }
.flash.warning { border-left-color: var(--marigold); background: var(--marigold-soft); }

.empty {
  padding: 3rem 1.5rem;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius);
}
.panel .empty { border: 0; background: transparent; }
.empty p { margin: 0 0 1rem; color: var(--ink-soft); }

.count-note {
  font-family: var(--mono);
  font-size: .68rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-faint); margin: .9rem 0 0;
}

/* =========================================================================
   Sign-in and other single-card pages
   ========================================================================= */

.signin-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.5rem;
  background:
    radial-gradient(1100px 520px at 50% -12%, rgba(200,138,28,.10), transparent 62%),
    var(--paper);
}

.signin {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
  border-top: 3px solid var(--marigold);
}
.signin-head { padding: 1.6rem 1.6rem .2rem; }
.signin-head h1 { font-size: 1.35rem; }
.signin .form-grid { grid-template-columns: 1fr; }
.notice { font-size: .82rem; color: var(--ink-faint); padding: 0 1.6rem 1.5rem; margin: 0; }

.brandline {
  display: flex; align-items: center; gap: .6rem;
  margin-bottom: 1.1rem;
}
.brandline .crest { background: var(--marigold); }
.brandline strong { font-family: var(--display); font-size: 1rem; }

/* =========================================================================
   Public pages — no rail, centred, a touch warmer
   ========================================================================= */

.public-top {
  background: var(--slate-900);
  border-bottom: 3px solid var(--marigold);
}
.public-inner {
  max-width: 940px; margin: 0 auto;
  padding: .9rem 1.5rem;
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.public-inner .rail-mark { color: #fff; }
.public-nav { margin-left: auto; display: flex; gap: 1.1rem; font-size: .9rem; }
.public-nav a { color: #C3D3D7; text-decoration: none; }
.public-nav a:hover { color: #fff; }

.public-main { max-width: 940px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

/* =========================================================================
   Responsive
   ========================================================================= */

@media (max-width: 900px) {
  .burger { display: inline-flex; }
  .rail {
    position: fixed; z-index: 30; left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-lift);
  }
  .rail-toggle:checked ~ .shell .rail { transform: translateX(0); }
  .rail-toggle:checked ~ .shell .rail-scrim {
    display: block; position: fixed; inset: 0; z-index: 20;
    background: rgba(14,32,41,.5);
  }
  main { padding: 1.25rem 1.1rem 3rem; }
  .topbar { padding: .7rem 1.1rem; }
  .record-head { flex-direction: column; }
  .record-tab { border-right: 0; border-bottom: 1px solid var(--rule); }
  .record-actions { margin-left: 0; width: 100%; }
  .facts > div { border-right: 0; }
}

@media (max-width: 620px) {
  table.ledger th:nth-child(n+5), table.ledger td:nth-child(n+5) { display: none; }
  .tile-figure { font-size: 1.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
  .rail, .topbar, .record-actions, .form-actions { display: none !important; }
  body { background: #fff; }
  .panel, table.ledger { box-shadow: none; border-color: #999; }
}

/* --- Collapsible rail groups ------------------------------------------------
   Built on <details>, so no JavaScript and no state to desynchronise. The
   group holding the current page is rendered open by the template. */

details.rail-group > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .4rem;
  user-select: none;
  border-radius: var(--radius-sm);
  transition: color .12s ease;
}
details.rail-group > summary::-webkit-details-marker { display: none; }

details.rail-group > summary::after {
  content: "";
  width: .3rem;
  height: .3rem;
  margin-left: auto;
  margin-right: .15rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg) translate(-1px, -1px);
  opacity: .5;
  transition: transform .15s ease, opacity .15s ease;
}
details.rail-group[open] > summary::after {
  transform: rotate(45deg) translate(-2px, -2px);
  opacity: .85;
}
details.rail-group > summary:hover { color: var(--rail-ink); }
details.rail-group > summary:hover::after { opacity: 1; }
details.rail-group > summary:focus-visible {
  outline: 2px solid var(--marigold);
  outline-offset: 2px;
}

/* A collapsed group still has to show that something inside needs attention,
   or a badge is only visible to somebody already looking in the right place. */
details.rail-group:not([open]) > summary .rail-count { display: inline-flex; }


/* --- CSS-only tabs -----------------------------------------------------------
   Radio inputs drive which panel shows. The nth-of-type pairing below is
   generated, because eight near-identical blocks written by hand is eight
   chances to transpose a number. Panels are <section>, so nth-of-type counts
   them correctly even though the radios and the strip are siblings too. */

.tabs { position: relative; }
.tab-radio { position: absolute; opacity: 0; pointer-events: none; }

.tab-strip {
  display: flex;
  gap: .15rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1.25rem;
}

.tab-label {
  padding: .55rem .95rem;
  cursor: pointer;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color .12s ease, background .12s ease;
}
.tab-label:hover { color: var(--ink); background: var(--surface-2); }
.tab-label:focus-visible { outline: 2px solid var(--marigold); outline-offset: -2px; }

.tab-panel { display: none; }
.tab-blurb { margin: 0 0 1rem; color: var(--ink-soft); font-size: .92rem; }

.tab-radio:nth-of-type(1):checked ~ .tab-strip .tab-label:nth-of-type(1) {
  color: var(--ink);
  border-bottom-color: var(--teal);
  background: var(--surface);
}
.tab-radio:nth-of-type(1):checked ~ .tab-panel:nth-of-type(1) { display: block; }
.tab-radio:nth-of-type(2):checked ~ .tab-strip .tab-label:nth-of-type(2) {
  color: var(--ink);
  border-bottom-color: var(--teal);
  background: var(--surface);
}
.tab-radio:nth-of-type(2):checked ~ .tab-panel:nth-of-type(2) { display: block; }
.tab-radio:nth-of-type(3):checked ~ .tab-strip .tab-label:nth-of-type(3) {
  color: var(--ink);
  border-bottom-color: var(--teal);
  background: var(--surface);
}
.tab-radio:nth-of-type(3):checked ~ .tab-panel:nth-of-type(3) { display: block; }
.tab-radio:nth-of-type(4):checked ~ .tab-strip .tab-label:nth-of-type(4) {
  color: var(--ink);
  border-bottom-color: var(--teal);
  background: var(--surface);
}
.tab-radio:nth-of-type(4):checked ~ .tab-panel:nth-of-type(4) { display: block; }
.tab-radio:nth-of-type(5):checked ~ .tab-strip .tab-label:nth-of-type(5) {
  color: var(--ink);
  border-bottom-color: var(--teal);
  background: var(--surface);
}
.tab-radio:nth-of-type(5):checked ~ .tab-panel:nth-of-type(5) { display: block; }
.tab-radio:nth-of-type(6):checked ~ .tab-strip .tab-label:nth-of-type(6) {
  color: var(--ink);
  border-bottom-color: var(--teal);
  background: var(--surface);
}
.tab-radio:nth-of-type(6):checked ~ .tab-panel:nth-of-type(6) { display: block; }
.tab-radio:nth-of-type(7):checked ~ .tab-strip .tab-label:nth-of-type(7) {
  color: var(--ink);
  border-bottom-color: var(--teal);
  background: var(--surface);
}
.tab-radio:nth-of-type(7):checked ~ .tab-panel:nth-of-type(7) { display: block; }
.tab-radio:nth-of-type(8):checked ~ .tab-strip .tab-label:nth-of-type(8) {
  color: var(--ink);
  border-bottom-color: var(--teal);
  background: var(--surface);
}
.tab-radio:nth-of-type(8):checked ~ .tab-panel:nth-of-type(8) { display: block; }

/* --- Setup cards -------------------------------------------------------------
   A description per link, because a list of model names only helps somebody
   who already knows the schema. */

.setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: .75rem;
}

.setup-card {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: .9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--teal);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, border-left-color .12s ease;
}
.setup-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--lift);
  border-left-color: var(--marigold);
}
.setup-card:focus-visible { outline: 2px solid var(--marigold); outline-offset: 2px; }

.setup-card-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: .98rem;
  color: var(--ink);
}
.setup-card-note {
  font-size: .84rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

@media (max-width: 700px) {
  .tab-strip { gap: 0; }
  .tab-label { padding: .5rem .7rem; font-size: .66rem; }
}

/* --- The morning briefing ------------------------------------------------------
   The first thing anybody sees. It leads with a sentence rather than a figure,
   because the question on arrival is "do I need to worry", not "how many
   students are there". */

.briefing {
  padding: 1.4rem 0 1.6rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1.5rem;
}
.briefing-date {
  margin: 0 0 .35rem;
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.briefing-headline {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  line-height: 1.25;
  letter-spacing: -.01em;
  color: var(--ink);
  max-width: 46ch;
}
/* A hairline of colour when something is genuinely pressing. Restrained on
   purpose: if the page shouts every morning, nobody hears it on the morning
   that matters. */
.briefing.is-pressing { border-bottom-color: var(--coral); }

.briefing-list, .deadline-list { list-style: none; margin: 0; padding: 0; }

.briefing-item + .briefing-item,
.deadline + .deadline { border-top: 1px solid var(--rule); }

.briefing-item > a {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .95rem 1.15rem;
  text-decoration: none;
  color: inherit;
  transition: background .12s ease;
}
.briefing-item > a:hover { background: var(--surface-2); }
.briefing-item > a:focus-visible { outline: 2px solid var(--marigold); outline-offset: -2px; }

.briefing-count {
  flex: 0 0 auto;
  min-width: 2.6rem;
  text-align: center;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
}
.briefing-text { display: flex; flex-direction: column; gap: .12rem; min-width: 0; }
.briefing-label { font-size: .98rem; color: var(--ink); }
.briefing-note { font-size: .84rem; color: var(--ink-soft); line-height: 1.4; }

.briefing-go {
  margin-left: auto;
  color: var(--ink-faint);
  transition: transform .12s ease, color .12s ease;
}
.briefing-item > a:hover .briefing-go { transform: translateX(3px); color: var(--teal); }

/* Tone is carried by a bar on the left edge rather than by colouring the text,
   which keeps the wording readable for anyone who cannot separate the hues. */
.briefing-item.tone-urgent > a { box-shadow: inset 3px 0 0 var(--coral); }
.briefing-item.tone-urgent .briefing-count { color: var(--coral); }
.briefing-item.tone-soon > a { box-shadow: inset 3px 0 0 var(--marigold); }
.briefing-item.tone-calm > a { box-shadow: inset 3px 0 0 var(--rule-strong); }

.deadline > a {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: .8rem 1.15rem;
  text-decoration: none;
  color: inherit;
}
.deadline > a:hover { background: var(--surface-2); }
.deadline > a:focus-visible { outline: 2px solid var(--marigold); outline-offset: -2px; }

.deadline-when {
  flex: 0 0 5.5rem;
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.deadline.tone-urgent .deadline-when { color: var(--coral); font-weight: 600; }
.deadline.tone-soon .deadline-when { color: var(--marigold-ink, var(--ink)); }
.deadline-what { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.deadline-date {
  margin-left: auto;
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--ink-faint);
  white-space: nowrap;
}

@media (max-width: 620px) {
  .briefing-count { font-size: 1.2rem; min-width: 2rem; }
  .briefing-go { display: none; }
  .deadline > a { flex-wrap: wrap; }
  .deadline-date { margin-left: 0; }
}

/* ============================================================================
   INSTRUMENT
   ----------------------------------------------------------------------------
   An evolution of slate and chalk, not a replacement. The palette, the folder
   tabs and the type pairing all stay; what changes is that the rail now reads
   as a powered console rather than a dark sidebar.

   The brief asked for futuristic. Neon-on-black would be unreadable across an
   eight-hour shift and wrong for a system parents and the state see, so the
   reading taken here is *precision instrument*: deep housing, exact type,
   generous space, and one luminous signal colour that means "live".

   THE ONE RISK: --signal, a luminous aqua, used only for the active item and
   live indicators. Never decorative, never on a surface a person reads text
   from. One colour, one meaning; the moment it decorates, it stops informing.
   ========================================================================= */

:root {
  /* Deeper housing for the rail. The old --slate-900 becomes a mid tone. */
  --abyss:      #04141A;
  --abyss-lift: #0A2029;

  /* The signal. Only ever: you are here, this is live, this just happened. */
  --signal:       #47E0C4;
  --signal-dim:   #2BA890;
  --signal-glow:  rgba(71, 224, 196, 0.22);

  /* Hairline highlight along the top of raised surfaces. Depth without
     resorting to frosted glass, which every dashboard has. */
  --edge-light: rgba(255, 255, 255, 0.7);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --quick: 140ms var(--ease);
}

/* --- Icons ---------------------------------------------------------------- */

.icon {
  /* Size, fill and stroke are set as attributes on the sprite and at each use
     site, so an icon is correct before this file arrives. What is here refines
     it: rem sizing so icons track the type scale, and the transitions.

     Colour is driven through `color`, not `stroke`. The symbols paint with
     `stroke="currentColor"`, and an attribute on the shadow content beats a
     stroke inherited from the outer element - so setting `stroke` here would
     silently do nothing. */
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
  vertical-align: -0.18em;
  transition: color var(--quick), transform var(--quick);
}
.icon-lg { width: 1.5rem; height: 1.5rem; }
.icon-sm { width: 0.95rem; height: 0.95rem; stroke-width: 1.75; }

/* --- The rail as housing --------------------------------------------------- */

.rail {
  background:
    linear-gradient(180deg, var(--abyss-lift) 0%, var(--abyss) 42%, #030F14 100%);
  border-right: 1px solid rgba(71, 224, 196, 0.09);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.rail-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: .6rem;
  transition: color var(--quick), background var(--quick);
}

/* The signature: the current item is edge-lit, like an illuminated key on a
   console. A light bar, a faint wash, and the icon carrying the signal. */
.rail-link[aria-current="page"] {
  color: #EAF7F4;
  background: linear-gradient(
    90deg, rgba(71, 224, 196, 0.14) 0%, rgba(71, 224, 196, 0.02) 70%, transparent 100%
  );
}
.rail-link[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12%;
  bottom: 12%;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--signal);
  box-shadow: 0 0 10px 1px var(--signal-glow);
}
.rail-link[aria-current="page"] .icon {
  color: var(--signal);
}
.rail-link:hover .icon { transform: translateX(1px); }
.rail-link:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: -2px;
}

/* The crest reads as a powered indicator rather than a logo square. */
.crest {
  position: relative;
  background: linear-gradient(145deg, var(--marigold) 0%, #A96F10 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* --- Raised surfaces ------------------------------------------------------- */

.panel, .tile, .setup-card, .record-head {
  position: relative;
}
.panel::before, .record-head::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: var(--edge-light);
  border-radius: var(--radius) var(--radius) 0 0;
  pointer-events: none;
}

/* --- Figures read as instrument output ------------------------------------- */

.tile-figure, .briefing-count, .idnum, .deadline-when {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
}
.tile-figure {
  letter-spacing: -0.02em;
}

/* A tile is a readout: it lights along its top edge on hover, the way a
   console panel acknowledges a touch. */
.tile {
  transition: transform var(--quick), box-shadow var(--quick), border-color var(--quick);
}
a.tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(4, 20, 26, 0.10);
}

/* --- The briefing headline, on load ---------------------------------------- */

.briefing-headline {
  animation: rise 420ms var(--ease) both;
}
.briefing-date {
  animation: rise 420ms var(--ease) 60ms both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* A live pulse next to the date: the system is awake and this is today's
   reading. Stops entirely for anyone who asked for less motion. */
.live-dot {
  display: inline-block;
  width: .42rem;
  height: .42rem;
  border-radius: 50%;
  background: var(--signal-dim);
  margin-right: .5rem;
  vertical-align: .06em;
  box-shadow: 0 0 0 0 var(--signal-glow);
  animation: pulse 2.8s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--signal-glow); opacity: .85; }
  50%      { box-shadow: 0 0 0 5px rgba(71, 224, 196, 0); opacity: 1; }
}

/* --- Quality floor --------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .live-dot { animation: none; }
  a.tile:hover { transform: none; }
}

@media (prefers-color-scheme: dark) {
  .panel::before, .record-head::before {
    background: rgba(255, 255, 255, 0.06);
  }
}

@media print {
  .live-dot, .rail { display: none; }
}

/* A collapsed group has to say what it holds. Without an icon the rail reads
   as five blank labels, which is worse than the long flat list it replaced. */
details.rail-group > summary .icon {
  opacity: .55;
  transition: opacity var(--quick), color var(--quick);
}
details.rail-group[open] > summary .icon,
details.rail-group > summary:hover .icon {
  opacity: 1;
}
details.rail-group > summary > span { flex: 1; }

/* The rail foot was wrapping "School administrator" onto two lines and pushing
   the sign-out button out of alignment. */
.rail-who { min-width: 0; }
.rail-who strong,
.rail-who span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail-out .icon { width: 1.05rem; height: 1.05rem; }

/* --- Atmosphere ------------------------------------------------------------
   The working area was a flat grey. A very slight wash, brighter where the
   content starts, gives the page somewhere to sit without adding an ornament
   anybody has to look at. */

.field {
  background:
    radial-gradient(120% 80% at 0% 0%, #FFFFFF 0%, rgba(255,255,255,0) 55%),
    var(--paper);
}

/* --- A briefing row is a control ------------------------------------------- */

.briefing-item a {
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: background var(--quick);
}
.briefing-item a:hover { background: var(--surface-2); }
.briefing-go {
  transition: transform var(--quick), color var(--quick);
  color: var(--ink-faint);
}
.briefing-item a:hover .briefing-go {
  transform: translateX(3px);
  color: var(--teal);
}
.briefing-item.tone-urgent a:hover .briefing-go { color: var(--coral); }

/* --- Section titles carry a small register mark -----------------------------
   Two characters wide, the same aqua as the rail's live state, so the console
   language runs through the content without shouting. */

.section-title::before {
  content: "";
  display: inline-block;
  width: .3rem;
  height: .3rem;
  margin-right: .5rem;
  vertical-align: .08em;
  background: var(--signal-dim);
  border-radius: 1px;
  opacity: .8;
}

/* --- Dark mode: the signal has to stay legible there too -------------------- */

@media (prefers-color-scheme: dark) {
  .field {
    background:
      radial-gradient(120% 80% at 0% 0%, rgba(255,255,255,.03) 0%, rgba(255,255,255,0) 55%),
      var(--paper);
  }
  .briefing-item a:hover { background: rgba(255, 255, 255, 0.04); }
}

/* --- Setup: settings versus records -----------------------------------------
   A record table is reached through its own screen in normal use, so editing
   one here is a repair. They are hidden by default and marked when shown, to
   keep the difference obvious rather than leaving fifty identical cards. */

.setup-card.is-record { border-left-color: var(--ink-faint); }
.setup-card.is-record:hover { border-left-color: var(--slate-500, var(--ink-soft)); }

.setup-card-tag {
  display: inline-block;
  margin-left: .4rem;
  padding: .05rem .35rem;
  border-radius: 2px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: .6rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  vertical-align: .12em;
}
