/* ==========================================================================
   Ascendra design system
   --------------------------------------------------------------------------
   Every value here is lifted from the source design. Nothing is approximated,
   and nothing is invented at the call site: components below own their look so
   templates stay semantic. No build step — this file ships as written.
   ========================================================================== */

:root {
  /* Surfaces */
  --bg:            #F4F6FA;
  --bg-sunk:       #EEF1F6;
  --surface:       #ffffff;

  /* Ink */
  --ink:           #0B1120;
  --ink-2:         #1C2740;
  --muted:         #5A6480;
  --muted-2:       #98a1b6;
  --faint:         #b3bacb;

  /* Lines */
  --line:          #D4DAE6;
  --hairline:      #EDEFF4;
  --hairline-2:    #F0F2F6;
  --hairline-3:    #F2F4F8;

  /* Brand — indigo */
  --brand:         #4B3F9B;
  --brand-deep:    #3a3078;
  --brand-mid:     #7d72c4;
  --brand-light:   #b3aae8;
  --brand-soft:    #EDEAF8;

  /* Semantic */
  --green:         #0B7A6E;
  --green-soft:    #E4F2F0;
  --green-light:   #7fd8cb;
  --amber:         #B26B00;
  --amber-soft:    #FCF2E3;
  --amber-light:   #e8c07a;
  --red:           #B32B3E;
  --red-soft:      #FBEAEC;
  --slate-soft:    #EAEDF3;

  /* Dark band surfaces */
  --dark:          #0B1120;
  --dark-2:        #151d33;
  --dark-3:        #0a0f1c;
  --dark-4:        #111a30;
  --dark-line:     #1C2740;
  --dark-line-2:   #2a3450;
  --dark-line-3:   #22304f;
  --dark-violet:   #241f4a;
  --on-dark:       #b8bfd0;
  --on-dark-mute:  #8b93ad;
  --on-dark-faint: #c7cddb;

  /* Type */
  --font-display: 'Archivo', system-ui, sans-serif;
  --font-body:    'Public Sans', system-ui, -apple-system, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, monospace;

  /* Geometry */
  --r-xs: 2px;
  --r-sm: 3px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 16px;

  --shell-max: 1240px;
  --sidebar-w: 240px;
  --topbar-h: 46px;
}

/* --------------------------------------------------------------- reset */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

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

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-deep); }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  padding: 0;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-stretch: 125%; margin: 0; }
p { margin: 0; }
img { max-width: 100%; }

::-webkit-scrollbar { height: 9px; width: 9px; }
::-webkit-scrollbar-thumb { background: #c4ccda; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* Screen-reader-only, but focusable (skip links). */
.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;
}
.skip-link:focus {
  position: fixed; top: 8px; left: 8px; z-index: 999;
  width: auto; height: auto; clip: auto;
  background: var(--brand); color: #fff;
  padding: 10px 16px; border-radius: var(--r-sm); font-weight: 600;
}

/* --------------------------------------------------------------- motion */

@keyframes breathe   { 0%,100% { transform: scale(1); } 50% { transform: scale(1.14); } }
@keyframes ringpulse { 0% { transform: scale(1); opacity: .4; } 70% { transform: scale(2); opacity: 0; } 100% { opacity: 0; } }
@keyframes shimmer   { 0% { background-position: -300px 0; } 100% { background-position: 300px 0; } }
@keyframes stampin   { 0% { transform: scale(2.2) rotate(var(--rot,0deg)); opacity: 0; filter: blur(4px); }
                       70% { transform: scale(.9) rotate(var(--rot,0deg)); opacity: 1; filter: blur(0); }
                       100% { transform: scale(1) rotate(var(--rot,0deg)); opacity: 1; } }
@keyframes wipe      { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes inkbleed  { 0% { transform: scale(.5); opacity: .45; } 100% { transform: scale(2.3); opacity: 0; } }
@keyframes floatup   { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes floatup8  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes stamppress{ 0% { transform: scale(1.9) rotate(-14deg); opacity: 0; filter: blur(3px); }
                       60% { transform: scale(.92) rotate(-14deg); opacity: .95; filter: blur(0); }
                       100% { transform: scale(1) rotate(-14deg); opacity: .92; } }
@keyframes flipin    { 0% { transform: rotateX(90deg); opacity: 0; } 55% { transform: rotateX(-12deg); opacity: 1; } 100% { transform: rotateX(0); opacity: 1; } }
@keyframes spinslow  { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------- type */

.display   { font-family: var(--font-display); font-stretch: 125%; font-weight: 700; letter-spacing: -0.02em; line-height: 0.98; }
.display-1 { font-size: 60px; }
.display-2 { font-size: 42px; line-height: 1.02; }
.display-3 { font-size: 40px; line-height: 1.1; }
.h-lg      { font-family: var(--font-display); font-stretch: 125%; font-weight: 600; font-size: 30px; letter-spacing: -0.01em; }
.h-md      { font-family: var(--font-display); font-stretch: 125%; font-weight: 600; font-size: 24px; letter-spacing: -0.01em; }
.h-sm      { font-family: var(--font-display); font-stretch: 125%; font-weight: 600; font-size: 16px; }
.h-xs      { font-family: var(--font-display); font-stretch: 125%; font-weight: 600; font-size: 15px; }

.mono      { font-family: var(--font-mono); }
.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
.eyebrow-tight { letter-spacing: .06em; }
.lede { font-size: 18px; line-height: 1.55; color: var(--ink-2); }
.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.tiny { font-size: 11px; }

.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* --------------------------------------------------------------- layout */

.shell { max-width: var(--shell-max); margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.shell-narrow { max-width: 900px; margin: 0 auto; padding: 0 24px; }

.band { background: var(--dark); color: #fff; }
.band-sunk { background: var(--bg-sunk); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.row-end { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; min-width: 0; }
.spacer { margin-left: auto; }
.wrap { flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }

.stack-4  > * + * { margin-top: 4px; }
.stack-8  > * + * { margin-top: 8px; }
.stack-12 > * + * { margin-top: 12px; }
.stack-16 > * + * { margin-top: 16px; }
.stack-24 > * + * { margin-top: 24px; }

/* --------------------------------------------------------------- brand mark */

.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo-mark {
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md); background: var(--ink); color: #fff;
  font-family: var(--font-display); font-stretch: 125%; font-weight: 700;
  width: 30px; height: 30px; font-size: 18px; flex-shrink: 0;
}
.logo-mark.is-brand { background: var(--brand); }
.logo-mark.is-sm { width: 26px; height: 26px; font-size: 15px; }
.logo-mark.is-xs { width: 20px; height: 20px; font-size: 13px; border-radius: 4px; }
.logo-word {
  font-family: var(--font-display); font-stretch: 125%; font-weight: 700;
  font-size: 20px; letter-spacing: -0.01em; color: inherit;
}
.logo-word.is-sm { font-size: 17px; }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; font-weight: 600; padding: 11px 18px;
  border-radius: var(--r-sm); border: 1px solid transparent;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-deep); color: #fff; }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: #1a2338; color: #fff; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-quiet { color: var(--muted); font-weight: 500; padding: 8px 10px; }
.btn-quiet:hover { color: var(--ink); background: var(--hairline); }
.btn-danger { background: var(--red); color: #fff; }
.btn-lg { font-size: 15px; padding: 14px 22px; }
.btn-sm { font-size: 13px; padding: 9px 14px; }
.btn-xs { font-size: 12px; padding: 6px 11px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* --------------------------------------------------------------- chips */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--r-sm); padding: 3px 9px;
  font-size: 11px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; white-space: nowrap;
  border: 1px solid transparent;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

.chip.tone-brand { background: var(--brand-soft); color: var(--brand); border-color: rgba(75,63,155,.19); }
.chip.tone-green { background: var(--green-soft); color: var(--green); border-color: rgba(11,122,110,.19); }
.chip.tone-amber { background: var(--amber-soft); color: var(--amber); border-color: rgba(178,107,0,.19); }
.chip.tone-red   { background: var(--red-soft);   color: var(--red);   border-color: rgba(179,43,62,.19); }
.chip.tone-slate { background: var(--slate-soft); color: var(--muted); border-color: rgba(90,100,128,.19); }
.chip.tone-ink   { background: var(--ink); color: #fff; border-color: var(--ink); }

.chip-plain { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 12px; }
.chip-filter {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand-soft); color: var(--brand);
  border: 1px solid rgba(75,63,155,.19); border-radius: var(--r-sm);
  padding: 6px 10px; font-size: 12px; font-weight: 500;
}
.chip-filter button { color: #8a80c4; font-weight: 600; line-height: 1; }
.chip-filter button:hover { color: var(--brand); }

.dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.dot-lg { width: 8px; height: 8px; }

/* --------------------------------------------------------------- avatars */

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  font-size: 11px; font-weight: 600; flex-shrink: 0;
  width: 28px; height: 28px; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.is-xs { width: 24px; height: 24px; font-size: 9px; }
.avatar.is-sm { width: 26px; height: 26px; font-size: 10px; }
.avatar.is-md { width: 32px; height: 32px; font-size: 12px; }
.avatar.is-lg { width: 52px; height: 52px; font-size: 18px; }
.avatar.on-dark { background: var(--dark-violet); color: var(--brand-light); }

/* --------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.card-pad { padding: 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--hairline);
}
.card-body { padding: 18px 20px; }
.card-clip { overflow: hidden; }

.stat-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-family: var(--font-mono); font-size: 34px; font-weight: 500; margin: 10px 0 4px; line-height: 1; }
.stat-value.is-sm { font-size: 30px; }
.stat-value.is-xs { font-size: 26px; }
.stat-foot { font-size: 12px; color: var(--muted); }

/* --------------------------------------------------------------- forms */

.field { display: block; margin-bottom: 16px; }
.field > label, .field-label {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 7px;
}
.input, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="datetime-local"],
input[type="tel"], input[type="url"], input[type="search"], select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--surface);
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.input:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(75,63,155,.12);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
select { appearance: none; background-image: none; padding-right: 30px; }
.field-help { font-size: 12px; color: var(--muted-2); margin-top: 6px; }
.field-error { font-size: 12px; color: var(--red); margin-top: 6px; font-weight: 500; }
.input.has-error { border-color: var(--red); }

.check-row { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.check-row input[type="checkbox"], .check-row input[type="radio"] { width: auto; accent-color: var(--brand); }

.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 8px 11px;
}
.search-box input { border: none; padding: 0; font-size: 13px; background: transparent; }
.search-box input:focus { box-shadow: none; }
.search-glyph { width: 12px; height: 12px; border: 1.5px solid var(--muted-2); border-radius: 50%; flex-shrink: 0; }

/* --------------------------------------------------------------- journey strip */
/* The boarding-pass checkpoint rail: cleared / current / pending discs. */

.strip { display: flex; align-items: flex-start; padding: 0 4px; }
.strip-node { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }

.strip-line {
  position: absolute; top: 14px; left: -50%; width: 100%; height: 2px;
  z-index: 0; background: var(--line); transform-origin: left;
}
.strip-node.is-cleared .strip-line,
.strip-node.is-current .strip-line { background: var(--brand); }
.strip-node:first-child .strip-line { display: none; }

.strip-disc {
  position: relative; z-index: 1;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 2px solid var(--line);
}
.strip-node.is-cleared .strip-disc {
  border: none;
  background: radial-gradient(circle at 35% 30%, var(--brand-mid), var(--brand) 70%);
  box-shadow: 0 1px 3px rgba(75,63,155,.45), inset 0 0 6px rgba(255,255,255,.15);
  transform: rotate(var(--rot, 0deg));
}
.strip-node.is-cleared .strip-tick { color: #fff; font-size: 15px; font-weight: 700; text-shadow: 0 0 1px rgba(0,0,0,.2); }
.strip-node.is-current .strip-disc { border-color: var(--brand); animation: breathe 2.4s ease-in-out infinite; }
.strip-node.is-current .strip-tick { color: var(--brand); font-size: 9px; }
.strip-pulse {
  position: absolute; inset: -2px; border-radius: 50%;
  border: 2px solid var(--brand); animation: ringpulse 2.4s ease-out infinite;
}
.strip-label {
  margin-top: 10px; font-family: var(--font-mono); font-size: 9px;
  letter-spacing: .02em; color: var(--muted-2); text-align: center;
}
.strip-node.is-cleared .strip-label { color: var(--ink-2); }
.strip-node.is-current .strip-label { color: var(--brand); font-weight: 600; }

/* Animated entrance — used on the hero only, staggered inline per node. */
.strip.is-animated .strip-node.is-cleared .strip-disc { animation: stampin .42s cubic-bezier(.34,1.56,.64,1) both; }
.strip.is-animated .strip-line { animation: wipe .26s ease-out both; }
.strip.is-animated .strip-node.is-cleared .strip-pulse { animation: inkbleed .5s ease-out both; }

/* Compact variant for the student record header. */
.strip.is-compact .strip-disc { width: 24px; height: 24px; }
.strip.is-compact .strip-line { top: 11px; }
.strip.is-compact .strip-node.is-cleared .strip-tick { font-size: 12px; }
.strip.is-compact .strip-label { font-size: 8px; margin-top: 8px; }

/* --------------------------------------------------------------- progress segments */

.segments { display: flex; gap: 2px; align-items: center; }
.segment { height: 4px; border-radius: 1px; flex: 1; background: var(--line); }
.segment.is-done { background: var(--brand); }
.segment.is-current { background: var(--brand-mid); }

.meter { height: 4px; background: var(--hairline); border-radius: 2px; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 2px; background: var(--brand); }
.meter-fill.tone-green { background: var(--green); }
.meter-fill.tone-amber { background: var(--amber); }
.meter-fill.tone-red { background: var(--red); }

/* --------------------------------------------------------------- boarding pass */

.pass {
  position: relative; display: flex;
  filter: drop-shadow(0 18px 34px rgba(11,17,32,0.12));
}
.pass-main {
  flex: 1; min-width: 0; position: relative;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg) 0 0 var(--r-lg);
  padding: 26px 30px; overflow: hidden;
  background-image:
    repeating-linear-gradient(45deg, rgba(75,63,155,.022) 0 1.5px, transparent 1.5px 10px),
    radial-gradient(circle at 98% 4%, rgba(75,63,155,.05), transparent 42%);
}
.pass-stub {
  width: 116px; flex-shrink: 0; position: relative;
  background: var(--dark); color: #fff;
  border-radius: 0 var(--r-lg) var(--r-lg) 0;
  padding: 22px 0; display: flex; flex-direction: column; align-items: center;
  border-left: 2px dashed rgba(255,255,255,.28);
}
.pass-notch {
  position: absolute; left: calc(100% - 116px);
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--bg); transform: translateX(-50%); z-index: 3;
}
.pass-notch.is-top { top: -9px; }
.pass-notch.is-bottom { bottom: -9px; }
.pass-code {
  font-family: var(--font-display); font-stretch: 125%; font-weight: 700;
  font-size: 24px; line-height: 1;
}
.pass-code-sub { font-family: var(--font-mono); font-size: 9px; color: var(--muted-2); margin-top: 3px; }
.pass-dashes {
  width: 36px; height: 1px;
  background: repeating-linear-gradient(90deg, var(--brand) 0 4px, transparent 4px 8px);
}
.pass-barcode {
  height: 34px; width: 70px; margin-top: 16px;
  background: repeating-linear-gradient(90deg, #fff 0 1px, transparent 1px 3px, #fff 3px 5px,
              transparent 5px 6px, #fff 6px 8px, transparent 8px 11px);
}
.pass-mrz {
  margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--hairline);
  font-family: var(--font-mono); font-size: 11px; color: var(--faint);
  letter-spacing: .12em; line-height: 1.5; overflow: hidden; white-space: nowrap;
}
.wet-stamp {
  position: absolute; right: 132px; bottom: 16px; z-index: 5;
  width: 96px; height: 96px; border-radius: 50%;
  border: 2.5px solid rgba(11,122,110,.7); color: rgba(11,122,110,.85);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transform: rotate(-14deg); mix-blend-mode: multiply;
  box-shadow: inset 0 0 0 4px rgba(11,122,110,.12);
  animation: stamppress .5s cubic-bezier(.34,1.56,.64,1) both; animation-delay: 2.5s;
}

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

.topbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--ink); color: #fff;
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px; height: var(--topbar-h);
  border-bottom: 1px solid var(--dark-line);
}

.portal {
  display: grid; grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh; background: var(--bg);
}
.sidebar {
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  text-align: left; padding: 9px 10px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500; color: var(--ink-2);
  margin-bottom: 2px; transition: background .1s ease;
}
.nav-item:hover { background: var(--hairline); color: var(--ink-2); }
.nav-item.is-active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-item.is-locked { color: var(--muted-2); cursor: not-allowed; }
.nav-item.is-locked:hover { background: transparent; }
.nav-glyph {
  width: 14px; height: 14px; border-radius: var(--r-sm);
  border: 1.5px solid var(--muted-2); flex-shrink: 0;
}
.nav-item.is-active .nav-glyph { border-color: var(--brand); }
.nav-badge {
  margin-left: auto; font-family: var(--font-mono); font-size: 10px;
  color: var(--muted); background: var(--bg);
  border-radius: var(--r-sm); padding: 1px 6px;
}
.sidebar-foot {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 10px 8px; border-top: 1px solid var(--hairline);
}

.content { padding: 26px 32px; overflow: auto; min-width: 0; }
.content-flush { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

/* --------------------------------------------------------------- data table */

.table-wrap {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: auto;
}
.trow {
  display: grid; gap: 10px; padding: 0 16px;
  align-items: center; border-bottom: 1px solid var(--hairline-2);
  background: var(--surface); transition: background .09s ease;
  min-height: 40px; color: inherit;
}
.trow:hover { background: #F7F8FB; color: inherit; }
.trow.is-head {
  background: var(--bg); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 2; height: 38px; min-height: 38px;
}
.trow.is-head span {
  font-size: 11px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
}
.trow.is-comfortable { min-height: 52px; }
.trow:last-child { border-bottom: none; }

/* The students table's eleven columns, exactly as designed. */
.cols-students { grid-template-columns: 44px 1.7fr 1.15fr 1.5fr .75fr .7fr .75fr .85fr 1.1fr 1fr 1.7fr; }
.cols-teaser   { grid-template-columns: 2fr 1.3fr 1fr .9fr 1fr 1.1fr; padding: 11px 20px; }
.cols-board    { grid-template-columns: 1.1fr 1.6fr .7fr .9fr 1.3fr 1fr; }

.checkbox-glyph {
  width: 14px; height: 14px; border: 1.5px solid #cbd2de;
  border-radius: var(--r-sm); flex-shrink: 0;
}

.view-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.view-tab {
  font-size: 13px; font-weight: 500; padding: 8px 12px;
  border-radius: var(--r-sm) var(--r-sm) 0 0; color: var(--muted);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.view-tab:hover { color: var(--ink); }
.view-tab.is-active { color: var(--ink); font-weight: 600; border-bottom-color: var(--brand); }

.toggle {
  width: 34px; height: 18px; border-radius: 9px;
  background: var(--line); position: relative; transition: background .15s ease;
  flex-shrink: 0; display: inline-block;
}
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%; background: #fff;
  transition: transform .15s ease;
}
.toggle.is-on { background: var(--brand); }
.toggle.is-on::after { transform: translateX(16px); }

/* --------------------------------------------------------------- departure board */

.board { border: 1px solid var(--dark-line); border-radius: var(--r-lg); overflow: hidden; background: var(--dark-3); }
.board-head {
  display: grid; gap: 16px; padding: 12px 26px;
  background: var(--dark-4); border-bottom: 1px solid var(--dark-line-3);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--on-dark-mute);
}
.board-row {
  display: grid; gap: 16px; align-items: center; padding: 15px 26px;
  border-bottom: 1px solid var(--dark-line);
  animation: flipin .5s ease both; transform-origin: top;
}
.board-row:last-child { border-bottom: none; }
.board-tag {
  justify-self: start; font-family: var(--font-mono); font-size: 11px;
  font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  border-radius: var(--r-xs); padding: 3px 9px; border: 1px solid;
}
.board-tag.tone-green { color: var(--green); background: rgba(11,122,110,.12); border-color: rgba(11,122,110,.33); }
.board-tag.tone-brand { color: var(--brand); background: rgba(75,63,155,.12); border-color: rgba(75,63,155,.33); }
.board-tag.tone-amber { color: var(--amber); background: rgba(178,107,0,.12); border-color: rgba(178,107,0,.33); }
.board-tag.tone-red   { color: var(--red);   background: rgba(179,43,62,.12);  border-color: rgba(179,43,62,.33); }

.board-tag.tone-slate { color: var(--on-dark-mute); background: rgba(139,147,173,.12); border-color: rgba(139,147,173,.33); }

/* Legible tag text on the dark board — the ink versions are too dark, and a
   tone with no rule at all inherits white, which reads as the loudest state
   on the board rather than the quietest. */
.board-tag.tone-green { color: var(--green-light); }
.board-tag.tone-brand { color: var(--brand-light); }
.board-tag.tone-amber { color: var(--amber-light); }
.board-tag.tone-red   { color: #e79aa5; }

/* Destination code takes the row's tone, the way a real departure board does. */
.board-dest.tone-green { color: var(--green-light); }
.board-dest.tone-brand { color: var(--brand-light); }
.board-dest.tone-amber { color: var(--amber-light); }
.board-dest.tone-red   { color: #e79aa5; }
.board-dest.tone-slate { color: var(--on-dark-mute); }

/* --------------------------------------------------------------- module rail */

.rail { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; }
.module-card {
  min-width: 230px; flex-shrink: 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 22px; display: flex; flex-direction: column; min-height: 200px;
}
.module-card.is-locked { background: var(--bg); }
.module-card.is-locked .module-name { color: var(--muted-2); }
.module-card.is-locked .module-job { color: var(--muted-2); }
.module-name { font-family: var(--font-display); font-stretch: 125%; font-weight: 600; font-size: 17px; }
.module-job { font-size: 13px; line-height: 1.45; margin: 14px 0 0; color: var(--muted); }
.module-foot { margin-top: auto; padding-top: 16px; }
.module-lock { font-size: 12px; filter: grayscale(1); opacity: .6; }

/* --------------------------------------------------------------- attention queue */

.queue-row {
  display: flex; align-items: stretch; gap: 14px;
  padding: 14px 20px; border-bottom: 1px solid var(--hairline-3);
  color: inherit; transition: background .1s ease;
}
.queue-row:hover { background: #F7F8FB; color: inherit; }
.queue-row:last-child { border-bottom: none; }
.queue-bar { width: 3px; align-self: stretch; border-radius: 2px; background: var(--muted-2); }
.queue-bar.tone-red { background: var(--red); }
.queue-bar.tone-amber { background: var(--amber); }
.queue-bar.tone-brand { background: var(--brand); }
.queue-bar.tone-green { background: var(--green); }

/* --------------------------------------------------------------- funnel */

.funnel { display: flex; align-items: flex-end; gap: 6px; height: 100px; }
.funnel-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.funnel-n { font-family: var(--font-mono); font-size: 11px; color: var(--ink); }
.funnel-bar { width: 100%; border-radius: var(--r-sm) var(--r-sm) 0 0; background: var(--brand); }
.funnel-bar.is-last { background: var(--green); }
.funnel-labels { display: flex; justify-content: space-between; margin-top: 8px; font-size: 9px; color: var(--muted-2); font-family: var(--font-mono); }
.funnel-labels span { flex: 1; text-align: center; overflow: hidden; }

.split-bar { display: flex; height: 22px; border-radius: var(--r-sm); overflow: hidden; }
.split-seg { height: 100%; }

/* --------------------------------------------------------------- record page */

.record-head {
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 18px 28px; position: sticky; top: 0; z-index: 3;
}
.record-body { display: grid; grid-template-columns: 190px 1fr 300px; flex: 1; min-height: 0; }
.tab-rail { border-right: 1px solid var(--line); padding: 16px 12px; background: var(--surface); }
.tab-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; padding: 9px 12px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 1px;
}
.tab-link:hover { background: var(--hairline); color: var(--ink-2); }
.tab-link.is-active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.tab-link.is-locked { color: var(--muted-2); cursor: not-allowed; }
.tab-link.is-locked:hover { background: transparent; }
.tab-lock { font-size: 10px; opacity: .6; }

.activity-col { border-left: 1px solid var(--line); background: var(--surface); padding: 18px; overflow: auto; }
.activity-item { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--hairline-2); }
.activity-item:first-of-type { border-top: none; }

.trail-row { display: flex; gap: 14px; padding: 12px 0; border-top: 1px solid var(--hairline-2); }
.trail-month { font-family: var(--font-mono); font-size: 11px; color: var(--muted-2); width: 28px; flex-shrink: 0; padding-top: 2px; }
.trail-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; background: var(--green); }
.trail-dot.is-flagged { background: var(--red); }
.trail-amount { font-family: var(--font-mono); font-size: 13px; font-weight: 500; }
.trail-note { font-size: 12px; color: var(--muted); }
.trail-row.is-flagged .trail-note { color: var(--red); font-weight: 500; }
.trail-row.is-flagged .trail-amount { color: var(--red); }

.next-action {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--brand-soft); border-radius: 4px;
}

/* --------------------------------------------------------------- student app */

.phone {
  width: 100%; max-width: 400px; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden;
  box-shadow: 0 8px 24px -6px rgba(11,17,32,0.18);
}
.phone-head { background: var(--dark); color: #fff; padding: 22px 22px 26px; }
.phone-callout {
  margin-top: 16px; background: var(--dark-2); border: 1px solid var(--dark-line-2);
  border-radius: var(--r-lg); padding: 14px;
}
.vstrip-item { position: relative; display: flex; gap: 14px; padding-bottom: 18px; }
.vstrip-line { position: absolute; left: 14px; top: 30px; bottom: -14px; width: 2px; background: var(--line); }
.vstrip-item.is-done .vstrip-line { background: var(--brand); }
.vstrip-disc {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 2px solid var(--line);
}
.vstrip-item.is-done .vstrip-disc { background: var(--brand); border-color: var(--brand); color: #fff; }
.vstrip-item.is-current .vstrip-disc { border-color: var(--brand); }
.vstrip-label { font-size: 15px; font-weight: 600; color: var(--muted-2); }
.vstrip-item.is-done .vstrip-label, .vstrip-item.is-current .vstrip-label { color: var(--ink); }
.vstrip-sub { font-size: 13px; color: var(--muted); margin-top: 1px; }
.vstrip-item.is-current .vstrip-sub { color: var(--brand); }

.doc-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--hairline-2);
}
.doc-row:last-child { border-bottom: none; }

/* --------------------------------------------------------------- misc */

.locked-panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 40px; text-align: center; color: var(--muted);
}
.empty {
  padding: 48px 24px; text-align: center; color: var(--muted); font-size: 14px;
}
.empty-title { font-family: var(--font-display); font-stretch: 125%; font-weight: 600; font-size: 18px; color: var(--ink); margin-bottom: 8px; }

/* Bottom-right, not top-right: the portal header carries primary actions and
   a toast that lands on the "Add student" button is a toast that gets clicked. */
.messages { position: fixed; bottom: 20px; right: 20px; z-index: 400; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: var(--r-sm); padding: 12px 16px; font-size: 13px;
  box-shadow: 0 8px 24px -8px rgba(11,17,32,.24); max-width: 380px;
  animation: floatup8 .2s ease both;
}
.toast.success { border-left-color: var(--green); }
.toast.warning { border-left-color: var(--amber); }
.toast.error { border-left-color: var(--red); }

.divider { height: 1px; background: var(--hairline); border: none; margin: 0; }
.dotted-left { border-left: 2px dotted #c4ccda; padding-left: 16px; }

.gate-list { display: flex; flex-direction: column; gap: 8px; }
.gate {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px; padding: 10px 12px; border-radius: 4px;
  background: var(--amber-soft); color: var(--ink);
}
.gate.is-blocking { background: var(--red-soft); }

/* HTMX: dim content mid-swap so the table never looks stale-but-live. */
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-indicator { opacity: 0; transition: opacity .15s ease; }
.htmx-swapping { opacity: .55; transition: opacity .1s ease; }

/* --------------------------------------------------------------- dark helpers */

.on-dark { color: var(--on-dark); }
.on-dark-mute { color: var(--on-dark-mute); }
.band .card { background: var(--dark-2); border-color: var(--dark-line-2); color: #fff; }
.band a { color: var(--brand-light); }

/* --------------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .record-body { grid-template-columns: 170px 1fr; }
  .activity-col { display: none; }
}

@media (max-width: 1024px) {
  .portal { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: var(--topbar-h); bottom: 0; width: 260px;
    z-index: 200; transform: translateX(-100%); transition: transform .2s ease;
    height: auto;
  }
  .sidebar.is-open { transform: translateX(0); box-shadow: 0 0 40px rgba(11,17,32,.2); }
  .grid-2, .grid-3, .grid-4, .grid-2-1 { grid-template-columns: 1fr; }
  .display-1 { font-size: 42px; }
  .display-2, .display-3 { font-size: 30px; }
  .h-lg { font-size: 24px; }
  .content { padding: 20px 16px; }
  .record-body { grid-template-columns: 1fr; }
  .tab-rail { border-right: none; border-bottom: 1px solid var(--line); display: flex; gap: 4px; overflow-x: auto; }
  .tab-link { width: auto; white-space: nowrap; }
}

@media (max-width: 860px) {
  /* Dense tables scroll inside their own box; the page never scrolls sideways. */
  .table-wrap { overflow-x: auto; }
  .trow, .board-head, .board-row { min-width: 900px; }
  .pass { flex-direction: column; }
  .pass-main { border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .pass-stub { width: 100%; border-radius: 0 0 var(--r-lg) var(--r-lg); border-left: none; border-top: 2px dashed rgba(255,255,255,.28); flex-direction: row; justify-content: space-around; align-items: center; padding: 16px; }
  .pass-notch, .wet-stamp { display: none; }
  .strip { overflow-x: auto; }
  .strip-node { min-width: 46px; }
}

@media (max-width: 640px) {
  .shell { padding-left: 16px; padding-right: 16px; }
  .display-1 { font-size: 34px; }
  .topbar { gap: 10px; padding: 0 12px; }
}

@media print {
  .topbar, .sidebar, .tab-rail, .activity-col, .btn { display: none !important; }
  body { background: #fff; }
  .card { break-inside: avoid; }
}
