:root {
  color-scheme: dark;
  --ground: #07141a;
  --panel: #0b2028;
  --panel-deep: #081920;
  --line: #24414a;
  --ink: #edf8f7;
  --muted: #91a8ad;
  --cyan: #54d7df;
  --gold: #f2bd58;
  --green: #63d7a0;
  --amber: #f1a954;
  --red: #ff7474;
  --paper: #dbe9e8;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; overflow-x: hidden; }

body {
  background: var(--ground);
  color: var(--ink);
}

button, input { font: inherit; }
button { min-height: 44px; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
}

.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 11px; font-weight: 720; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--cyan); color: var(--cyan); border-radius: 50%; }
.brand small { display: block; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.account { max-width: 180px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 13px; }
.quiet { border: 1px solid var(--line); border-radius: 99px; color: var(--ink); background: transparent; padding: 0 15px; cursor: pointer; }

.workspace {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 46px 24px 60px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(340px, 430px) minmax(180px, 1fr);
  gap: clamp(24px, 5vw, 72px);
  align-items: start;
}

.brief, .note { padding-top: 72px; color: var(--muted); line-height: 1.65; }
.folio { color: var(--cyan); font-size: 13px; margin: 0 0 22px; }
.brief h1 { color: var(--ink); font-size: clamp(31px, 4vw, 54px); line-height: .98; letter-spacing: -.045em; margin: 0 0 28px; }
.brief p, .note p { max-width: 30ch; }
.brief-rule { width: 46px; height: 2px; background: var(--gold); margin: 30px 0; }
.privacy-note { padding-left: 14px; border-left: 2px solid var(--cyan); color: var(--paper); }

.console {
  min-height: 720px;
  border: 1px solid #33545d;
  border-radius: 30px;
  background: var(--panel-deep);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .42);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.console-head { min-height: 58px; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); font-size: 13px; }
.screen { flex: 1; padding: 24px 20px 28px; }
.screen-head { margin-bottom: 22px; }
.screen-head p { margin: 8px 0 0; color: var(--muted); line-height: 1.5; }
h2 { font-size: 31px; letter-spacing: -.035em; margin: 0; }
h3 { margin: 0; font-size: 17px; }
.error { color: #ffd2d2 !important; }

.count-rail { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); border: 1px solid var(--line); margin-bottom: 18px; }
.count { min-width: 0; padding: 17px 13px; border-left: 1px solid var(--line); }
.count:first-child { border-left: 0; }
.count strong { display: block; color: var(--cyan); font-size: 32px; font-variant-numeric: tabular-nums; }
.count.needs strong { color: var(--gold); }
.count span { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; line-height: 1.25; }

.ledger { border-top: 1px solid var(--line); }
.entry { padding: 17px 0 17px 14px; border-bottom: 1px solid var(--line); position: relative; }
.entry::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px; background: var(--cyan); }
.entry.gold::before { background: var(--gold); }
.entry.red::before { background: var(--red); }
.entry.green::before { background: var(--green); }
.entry-top, .fact { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; }
.entry p { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.state { flex: none; color: var(--muted); font-size: 12px; }
.action { width: 100%; margin-top: 13px; border: 1px solid var(--gold); border-radius: 12px; color: #1c1607; background: var(--gold); font-weight: 750; cursor: pointer; }
.action[disabled] { opacity: .55; cursor: wait; }
.secondary { border-color: var(--line); background: transparent; color: var(--ink); }
.notice { padding: 18px; border: 1px dashed var(--line); color: var(--muted); line-height: 1.5; }
.notice strong { color: var(--ink); }
.attention-card { display: contents; }
.attention-actions { display: grid; gap: 8px; }
.attention-actions .action { display: grid; min-height: 44px; place-items: center; text-decoration: none; }
.data-unavailable { margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.rules-list { margin: 0; padding: 0; list-style: none; counter-reset: rules; }
.rules-list li { counter-increment: rules; padding: 16px 0 16px 44px; border-bottom: 1px solid var(--line); position: relative; line-height: 1.45; }
.rules-list li::before { content: counter(rules); position: absolute; left: 0; top: 14px; width: 28px; color: var(--cyan); font-variant-numeric: tabular-nums; }
.rule-status { display: inline-block; margin-left: 8px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; }
.read-only { display: inline-block; margin-top: 18px; color: var(--green); font-size: 13px; }
.login label { display: block; margin: 16px 0 7px; color: var(--muted); font-size: 13px; }
.login input { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 10px; padding: 0 13px; color: var(--ink); background: var(--panel); }

.tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs[hidden] { display: none !important; }
.tabs button { min-width: 0; padding-inline: 2px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.tabs button:last-child { border-right: 0; }
.tabs button.active { color: var(--ink); box-shadow: inset 0 3px var(--cyan); }

.student-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.ranking-law { margin: 0; color: var(--cyan); font-weight: 700; }
.compact-action { width: auto; min-width: 132px; margin: 0; padding: 0 16px; }
.student-roster { border-top: 1px solid var(--line); }
.student-row { border-bottom: 1px solid var(--line); position: relative; }
.student-row::before { content: ""; position: absolute; inset: 14px auto 14px 0; width: 3px; background: var(--green); }
.student-row.needs-attention::before { background: var(--gold); }
.student-open { width: 100%; min-width: 0; padding: 16px 8px 16px 16px; border: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.student-open:hover { background: rgba(84, 215, 223, .045); }
.student-row-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.student-row-head strong { font-size: 17px; overflow-wrap: anywhere; }
.signal-badge { display: inline-flex; width: fit-content; max-width: 100%; padding: 4px 8px; border: 1px solid var(--gold); border-radius: 999px; color: var(--gold); font-size: 11px; line-height: 1.3; overflow-wrap: anywhere; }
.student-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.student-metrics span { color: var(--muted); font-size: 12px; line-height: 1.35; }
.student-metrics b { display: block; color: var(--ink); font-size: 22px; font-variant-numeric: tabular-nums; }
.student-facts { display: grid; gap: 5px; margin-top: 13px; color: var(--muted); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 10px 12px; border: 1px solid var(--gold); color: var(--gold); font-size: 12px; }
.filter-bar button, .back-link { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); color: var(--ink); background: transparent; cursor: pointer; }
.back-link { margin-bottom: 18px; }
.student-detail-grid { display: grid; gap: 12px; }
.detail-panel, .programme-record { min-width: 0; padding: 16px; border: 1px solid var(--line); }
.detail-panel h3, .programme-record h3 { color: var(--cyan); }
.detail-panel p { margin: 10px 0 0; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.detail-metrics { margin-bottom: 10px; }
.signal-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.programme-record { margin-top: 12px; }
.programme-columns { display: grid; gap: 16px; }
.programme-columns h4 { margin: 14px 0 8px; color: var(--ink); }
.programme-columns ul { margin: 0; padding: 0; list-style: none; }
.programme-columns li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.programme-columns li strong { color: var(--ink); }
.programme-columns li span { text-align: right; }
.conversation-wall { margin: 14px 0 0; padding: 16px; border-left: 3px solid var(--cyan); background: var(--panel); color: var(--paper); }
.class-unavailable { min-height: 120px; display: grid; align-items: center; }

@media (max-width: 820px) {
  .topbar { display: none; }
  .workspace { display: block; padding: 0; }
  .brief, .note { display: none; }
  .console { width: 100%; min-height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }

/* Screen 11: compact school subscription ledger, no invented expiry/payment states. */
.subscriptions-view .screen-head { margin-bottom: 12px; }
.subscription-total { margin: 0 0 14px; color: var(--cyan); font-size: 20px; }
.subscription-unknown { margin: 0; font-size: 12px; }
.subscription-unknown > div { display: flex; justify-content: space-between; gap: 12px; margin: 8px 0; }
.subscription-unknown dt { color: var(--ink); }
.subscription-unknown dd { margin: 0; color: var(--muted); text-align: right; }
.subscription-note { font-size: 12px; color: var(--muted); margin: 12px 0; }
.subscription-entry { display: flex; align-items: baseline; gap: 10px; padding-top: 12px; padding-bottom: 12px; }
.subscription-entry h3 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.subscription-count { color: var(--cyan); font-size: 22px; font-variant-numeric: tabular-nums; }
/* Phone widths (sol-r3--20261010T162024Z--001, found on the 390 px screen with the real English prices): one flex row squeezed the
   programme name to one letter per line ("H/A/D/I/A") with the count drawn over it. Below 640 px the row wraps: name + count on the
   first line, then the price, "For: ..." and the sample tag each on a full line. Nothing is hidden; desktop keeps the one-row ledger.
   Evidence: revan ops/2026-10-10-a3-screens-dev1/school-recap-1920/ (before) and the successor screens named in the dev1 row. */
@media (max-width: 640px) {
  .subscription-entry { flex-wrap: wrap; row-gap: 4px; }
  .subscription-entry h3 { flex: 1 1 auto; overflow-wrap: break-word; }
  .subscription-entry > p, .subscription-entry > .state { flex-basis: 100%; margin: 0; }
}

@media (min-width: 1024px) {
  body { background: var(--ground); }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 3;
    width: 100%;
    background: var(--ground);
  }

  .workspace {
    width: min(1100px, calc(100% - 64px));
    padding: 36px 0 60px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "console console"
      "brief note";
    gap: 32px;
  }

  .brief { grid-area: brief; }
  .note { grid-area: note; }
  .brief, .note {
    padding: 24px 0 0;
    border-top: 1px solid var(--line);
  }
  .brief h1 {
    max-width: 18ch;
    font-size: 31px;
    line-height: 1.08;
    letter-spacing: -.035em;
    margin-bottom: 18px;
  }
  .brief p, .note p { max-width: 58ch; }
  .folio { margin-bottom: 12px; }
  .brief-rule { margin: 20px 0; }

  .console {
    grid-area: console;
    min-height: 0;
    border-color: var(--line);
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }
  .console-head { display: none; }
  .screen { padding: 36px 40px 48px; }
  .screen-head { max-width: 70ch; }

  .tabs {
    order: -1;
    position: sticky;
    top: 71px;
    z-index: 2;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    border-top: 0;
    border-bottom: 1px solid var(--line);
    padding: 0;
    background: var(--panel-deep);
  }
  .tabs button { min-height: 56px; font-size: 13px; }
  .tabs button.active { box-shadow: inset 0 -3px var(--cyan); }

  .count-rail { margin-bottom: 24px; }
  .count { padding: 22px 20px; }
  .count strong { font-size: 38px; }
  .count span { font-size: 13px; }

  .attention-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
    align-items: center;
    gap: 28px;
    padding: 22px 24px;
    border: 1px solid var(--line);
  }
  .attention-card .notice { margin: 0; padding: 0; border: 0; }
  .attention-card .action { margin-top: 0; }

  .student-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .programme-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .ledger { border: 1px solid var(--line); border-bottom: 0; }
  .entry { padding: 20px 24px 20px 28px; }
  .entry::before { left: 11px; top: 20px; bottom: 20px; }
  .entry .action { width: auto; min-width: 220px; padding: 0 24px; }

  .rules-list {
    max-height: min(68vh, 660px);
    overflow-y: auto;
    padding-right: 20px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 820px) {
  /* Keep the existing language/sign-out controls reachable on the phone. */
  .topbar { display: flex; min-height: 52px; padding: 6px 16px; }
  .topbar .brand, .topbar .account { display: none; }
  .top-actions { margin-left: auto; }
  .console { min-height: calc(100dvh - 52px); padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
  .tabs {
    position: fixed;
    z-index: 4;
    right: 0;
    bottom: 0;
    left: 0;
    min-height: calc(56px + env(safe-area-inset-bottom));
    background: var(--panel-deep);
  }
  .tabs button { min-height: 56px; padding-inline: 1px; font-size: 10px; line-height: 1.1; white-space: nowrap; }
  .screen { padding-inline: 16px; }
  .student-row-head, .filter-bar { align-items: stretch; flex-direction: column; }
  .filter-bar button { width: 100%; }
}

/* P3 — courses + counselor from the school's 29 Sep export (ops3--20260930T062433Z--001) */
.school-record { margin-top: 12px; }
.detail-panel h3 small { color: var(--muted); font-weight: 400; font-size: 0.8em; }
.course-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.course-list li { display: grid; gap: 2px; padding-left: 10px; border-left: 3px solid var(--line); }
.course-list li span { color: var(--muted); font-size: 0.9em; overflow-wrap: anywhere; }
.course-list li.course-late { border-left-color: var(--amber); }
/* Example data must never look like real data: dashed frame + a flag line. */
.detail-panel.is-example { border-style: dashed; opacity: 0.85; }
.example-flag { font-weight: 600; color: var(--amber) !important; }

.data-freshness { margin-top: 26px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.5; }
.data-freshness p { margin: 0; }
