/* Classline design tokens — foundation layer.
 *
 * Palette: "Slate" (see docs/superpowers/specs/2026-08-16-classline-design-
 * system.md). Three theme states, per that spec:
 *
 *   1. Bare :root                          -> the complete LIGHT palette.
 *   2. @media (prefers-color-scheme: dark),
 *      guarded :root:not([data-theme="light"]) -> redefines the tokens for
 *      a visitor who has never chosen (or has chosen "system") and whose OS
 *      is in dark mode.
 *   3. :root[data-theme="dark"]            -> redefines the same tokens
 *      again so an explicit choice wins over the OS setting in both
 *      directions (an explicit "light" choice on a dark OS is covered by
 *      :not([data-theme="light"]) above never matching).
 *
 * Every component rule below reads a var(--color-*) token — never a literal
 * colour inside a @media or [data-theme] block — so nothing can render one
 * theme's ink on the other theme's ground.
 */

:root {
  /* ---- Slate: light ----
   *
   * Softened on 2026-08-17. The first cut ran canvas #eef0f2 / card #f7f8f9 /
   * raised #ffffff — a near-white page with pure white surfaces on top of it,
   * which is genuinely uncomfortable to look at for any length of time. This
   * is a tool a teacher stares at all day, often on a bright projector, so
   * glare is a usability problem and not a matter of taste.
   *
   * The whole ramp is stepped down and pure white is gone entirely: the
   * lightest surface in the product is now #f1f3f5. Relative order is
   * unchanged (canvas < card < raised), so every component keeps the same
   * figure/ground relationship it was designed with.
   *
   * The accents are darker than they look like they need to be, for contrast
   * rather than taste. Against the new card, the original #147ca3 measured
   * 3.99:1 and #b8552f measured 4.04:1 — both under the 4.5:1 WCAG AA floor
   * for normal text, and these are used on 11-13px mono numerals. The values
   * below measure 5.0:1 and 5.2:1. (They were already marginal at 4.45:1 and
   * 4.42:1 on the old lighter card; dropping the background made a
   * pre-existing problem visible, it did not create it.)
   *
   * Contrast against --color-card, for anyone changing these: ink 11.9:1,
   * muted 5.6:1, positive 5.0:1, negative 5.2:1.
   *
   * The dark palette is deliberately untouched — it was never the problem,
   * and its blocks below redefine every one of these tokens. */
  --color-canvas: #dfe3e7;
  --color-card: #e9ecef;
  --color-raised: #f1f3f5;
  --color-hairline: rgba(24, 30, 37, .15);
  --color-hairline-soft: rgba(24, 30, 37, .08);
  --color-ink: #1e242b;
  --color-muted: #565e67;
  --color-positive: #0f6b8f;
  --color-positive-bg: rgba(15, 107, 143, .10);
  --color-negative: #a04722;
  --color-negative-bg: rgba(160, 71, 34, .10);
  --color-focus-ring: rgba(15, 107, 143, .20);
  color-scheme: light;

  /* ---- Type ---- */
  --font-serif: "Newsreader", ui-serif, Georgia, "Times New Roman", serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;

  --text-xs: 0.6875rem;   /* 11px — mono micro-labels */
  --text-sm: 0.8125rem;   /* 13px */
  --text-base: 0.9375rem; /* 15px — body */
  --text-lg: 1.0625rem;   /* 17px */
  --text-xl: 1.375rem;    /* 22px — section titles */
  --text-2xl: 1.75rem;    /* 28px — page titles */
  --text-3xl: 2.25rem;    /* 36px — wordmark scale */

  /* ---- Layout ---- */
  --content-max-width: 880px;
  --radius-card: 12px;
  --radius-pill: 999px;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-canvas: #14181d;
    --color-card: #1b2027;
    --color-raised: #212832;
    --color-hairline: rgba(255, 255, 255, .10);
    --color-hairline-soft: rgba(255, 255, 255, .06);
    --color-ink: #e8eaed;
    --color-muted: #8b929c;
    --color-positive: #4db2d9;
    --color-positive-bg: rgba(77, 178, 217, .10);
    --color-negative: #e08a6b;
    --color-negative-bg: rgba(224, 138, 107, .10);
    --color-focus-ring: rgba(77, 178, 217, .22);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --color-canvas: #14181d;
  --color-card: #1b2027;
  --color-raised: #212832;
  --color-hairline: rgba(255, 255, 255, .10);
  --color-hairline-soft: rgba(255, 255, 255, .06);
  --color-ink: #e8eaed;
  --color-muted: #8b929c;
  --color-positive: #4db2d9;
  --color-positive-bg: rgba(77, 178, 217, .10);
  --color-negative: #e08a6b;
  --color-negative-bg: rgba(224, 138, 107, .10);
  --color-focus-ring: rgba(77, 178, 217, .22);
  color-scheme: dark;
}

/* An explicit "light" choice always wins, including on a dark OS — the
 * bare :root block above already is the light palette, this just pins
 * color-scheme so native form controls/scrollbars agree. */
:root[data-theme="light"] {
  color-scheme: light;
}

/* ---------------------------------------------------------------------- */
/* Vendored serif — see web/static/fonts/README.md for provenance/licence. */
/* Two Google-provided script subsets per weight (latin, latin-ext) so a    */
/* name like "Tomás" always resolves to a Newsreader glyph, not a fallback. */

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/newsreader-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/newsreader-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/newsreader-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/newsreader-600-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------------------------------------------------------------------- */
/* Base */

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

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

body {
  margin: 0;
  background: var(--color-canvas);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 0.5em;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

p { margin: 0 0 1em; }

a {
  color: inherit;
}

button, input {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--color-positive);
  outline-offset: 2px;
}

.hairline {
  border: none;
  border-top: 1px solid var(--color-hairline);
}

/* Monospace micro-labels: back links, counts, keyboard hints, status text —
 * see the design spec's typography section. Not used by anything in this
 * step; the class exists here so later steps have it available. */
.mono-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* ---------------------------------------------------------------------- */
/* Page shell: top bar + max-width content column, per the foundation step. */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  background: var(--color-card);
  border-bottom: 1px solid var(--color-hairline);
}

.wordmark {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: var(--text-xl);
  letter-spacing: -0.01em;
  color: var(--color-ink);
  text-decoration: none;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.shell {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-12);
}

/* ---------------------------------------------------------------------- */
/* Theme switcher: three states, rendered as a single form of three submit
 * buttons (see web/templates/chrome.html) so it works with zero JavaScript.
 * Fully-rounded pill group, selected state inverts — per the spec's
 * component language, used here a step early since the switcher is chrome. */

.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-pill);
  background: var(--color-raised);
}

.theme-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  cursor: pointer;
  line-height: 1.6;
}

.theme-btn:hover {
  color: var(--color-ink);
}

.theme-btn.is-active {
  background: var(--color-ink);
  color: var(--color-canvas);
}

@media (prefers-reduced-motion: no-preference) {
  .theme-btn {
    transition: background-color .15s ease, color .15s ease;
  }
}

/* ---------------------------------------------------------------------- */
/* Card: the one surface primitive, ported from assets/design/
 * security-brief.html's .layer and palette-study.html's .spec — hairline
 * border, ~12px radius, generous padding, background one step off canvas.
 * Everything below (the auth card, the callout) builds on this. */

.card {
  background: var(--color-card);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-card);
  padding: var(--space-6);
}

/* Callout: ported from security-brief.html's .callout — a card with a
 * 3px accent rule on the left. Positive by default, .callout--negative for
 * a warning/error (the login failure page uses this one). */

.callout {
  border-left: 3px solid var(--color-positive);
  border-radius: 9px;
  padding: var(--space-4);
}

.callout--negative {
  border-left-color: var(--color-negative);
  background: var(--color-negative-bg);
}

.callout p {
  margin: 0;
}

/* ---------------------------------------------------------------------- */
/* Pill button: the same inverted-fill idiom as the theme switcher's
 * selected state, applied to a primary call to action — dark fill on the
 * light ground, light fill on the dark ground. */

.btn-pill {
  display: block;
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--color-ink);
  color: var(--color-canvas);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--text-base);
  text-align: center;
  text-decoration: none;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
}

.btn-pill:hover {
  opacity: .92;
}

.btn-pill:active {
  opacity: .85;
}

@media (prefers-reduced-motion: no-preference) {
  .btn-pill {
    transition: opacity .15s ease;
  }
}

/* ---------------------------------------------------------------------- */
/* Form fields: modern input accents, matched to the reference's "Filter…"
 * treatment (assets/screenshots) — generous radius, comfortable height,
 * mono placeholder, an accent focus ring rather than the browser default. */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.field input {
  appearance: none;
  width: 100%;
  height: 46px;
  padding: 0 var(--space-4);
  border-radius: 10px;
  border: 1px solid var(--color-hairline);
  background: var(--color-raised);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
}

.field input::placeholder {
  font-family: var(--font-mono);
  color: var(--color-muted);
  opacity: 1;
}

.field input:hover {
  border-color: var(--color-muted);
}

.field input:focus-visible {
  outline: none;
  border-color: var(--color-positive);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

@media (prefers-reduced-motion: no-preference) {
  .field input {
    transition: border-color .15s ease, box-shadow .15s ease;
  }
}

/* Chrome/Safari repaint an autofilled field with a hard, opaque background
 * that ignores every token above — on a dark theme this shows up as a
 * jarring pale-yellow rectangle. The long transition-delay is the standard
 * workaround: it stops the native colour from ever visibly painting before
 * this override applies. */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--color-ink);
  -webkit-box-shadow: 0 0 0 1000px var(--color-raised) inset;
  box-shadow: 0 0 0 1000px var(--color-raised) inset;
  caret-color: var(--color-ink);
  transition: background-color 5000s ease-in-out 0s;
}

/* ---------------------------------------------------------------------- */
/* Auth card: the login form's own shell, positioned in the upper third
 * rather than dead-centre (a dead-centred card reads as a marketing splash,
 * not a tool) — nested inside the shared .shell content column. */

.auth-shell {
  display: flex;
  justify-content: center;
  padding-top: 6vh;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-8) var(--space-6);
}

.auth-card h1 {
  margin: 0;
  text-align: center;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.parent-children {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
}

.parent-child-card {
  padding: var(--space-6);
  display: block;
  text-decoration: none;
  color: inherit;
}

.parent-child-card h2,
.parent-child-card p {
  margin-top: 0;
}

a.parent-child-card:hover {
  border-color: var(--color-positive);
}

a.parent-child-card:focus-visible {
  outline: 2px solid var(--color-positive);
  outline-offset: 2px;
}

/* Totals are tabular-nums everywhere they appear so a column of them stays
 * aligned as the digits change — same rule as .student-total. */
.parent-child-total {
  margin-bottom: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--color-muted);
}

.parent-child-total[data-sign="positive"] { color: var(--color-positive); }
.parent-child-total[data-sign="negative"] { color: var(--color-negative); }

.parent-child-total-unit {
  font-size: var(--text-xs);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* --- one child's page: the running total, then the history behind it --- */
.child-summary {
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  text-align: center;
}

.child-summary-label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.child-summary-total {
  margin: var(--space-2) 0 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-2xl);
  color: var(--color-muted);
}

.child-summary-total[data-sign="positive"] { color: var(--color-positive); }
.child-summary-total[data-sign="negative"] { color: var(--color-negative); }

.feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* The 3px left rule is the same accent device .callout uses, so a negative
 * award reads as "needs work" at a glance without colour being the only
 * signal — the label and the sign carry it too. */
.feed-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-card);
  border-left: 3px solid var(--color-positive);
  border-radius: var(--radius-sm, 4px);
}

.feed-item--negative {
  border-left-color: var(--color-negative);
}

.feed-label {
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.feed-date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-muted);
  white-space: nowrap;
}

.feed-points {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-sm);
  min-width: 3ch;
  text-align: right;
}

.feed-points[data-sign="positive"] { color: var(--color-positive); }
.feed-points[data-sign="negative"] { color: var(--color-negative); }

.feed-empty {
  padding: var(--space-6) var(--space-4);
  color: var(--color-muted);
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.guardian-directory {
  margin-top: var(--space-6);
}

.guardian-directory-links,
.guardian-layout {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.guardian-layout {
  align-items: flex-start;
}

.guardian-panel {
  flex: 1 1 320px;
  padding: var(--space-6);
}

.guardian-panel form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.guardian-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-hairline);
}

.guardian-code code {
  font-size: 1.4rem;
  letter-spacing: 0.12em;
}

/* ============================================================
 * Class view — console idiom.
 *
 * Reads like a terminal: monospace throughout the data surface,
 * a bordered panel with a header band, and column labels rather
 * than decoration. The serif is reserved for identity (wordmark,
 * the selected student's name) so it lands hard when it appears.
 * ============================================================ */

/* --- The console window.
 *
 * The roster panel IS the window: the macOS title bar is its chrome, not
 * the page's. Border, radius and overflow live on .console so the title
 * bar, band and rows all sit inside one frame. --- */
.console {
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-card);
  background: var(--color-card);
  overflow: hidden;
}

.titlebar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-raised);
  border-bottom: 1px solid var(--color-hairline);
}

.titlebar-lights { display: flex; gap: 7px; align-items: center; }
.titlebar-lock-form { display: contents; }

.titlebar-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: block;
  padding: 0;
  border: 0;
}

.titlebar-dot--amber { background: #e0b25c; }
.titlebar-dot--green { background: #63c168; }

/* The RED dot is the lock control — a real button. A projected classroom
   display left unattended is showing children's records. */
.lock-dot {
  background: #e0665c;
  cursor: pointer;
}

.lock-dot:hover { background: #ef7a70; }

.lock-dot:focus-visible {
  outline: 2px solid var(--color-positive);
  outline-offset: 2px;
}

.titlebar-title {
  margin-inline: auto;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.titlebar-hint {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: .1em;
  color: var(--color-muted);
  opacity: .7;
}

/* --- mono chips --- */
.chip {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: .1em;
  color: var(--color-muted);
  background: transparent;
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
}

.chip:hover { color: var(--color-ink); border-color: var(--color-muted); }

.back-link {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--color-muted);
  text-decoration: none;
  margin-bottom: var(--space-4);
}

.back-link:hover { color: var(--color-ink); }

/* --- page heading above the panel: quiet, so the band carries the
 *     attention when a student is selected --- */
.class-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.class-heading h1 {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin: 0;
}

.class-heading .meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

/* --- the roster panel --- */
.roster { background: var(--color-card); }

/* --- header band: column labels when idle, the selected student
 *     and their behaviour pills when active --- */
.roster-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  min-height: 60px;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-hairline);
  background: var(--color-raised);
}

.roster-band--idle {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--color-muted);
  min-height: 40px;
}

.band-name {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.375rem, 3vw, 1.875rem);
  line-height: 1.1;
  letter-spacing: -.01em;
  margin: 0;
}

.band-meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.band-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* --- behaviour pills --- */
.behaviour-pill {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: .04em;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-hairline);
  background: transparent;
  color: var(--color-ink);
  white-space: nowrap;
  cursor: pointer;
}

.behaviour-pill--positive { border-color: var(--color-positive); color: var(--color-positive); }
.behaviour-pill--negative { border-color: var(--color-negative); color: var(--color-negative); }
.behaviour-pill:hover { background: var(--color-card); }

.behaviour-pill:focus-visible {
  outline: 2px solid var(--color-positive);
  outline-offset: 2px;
}

.behaviour-pill .key-hint {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  opacity: .5;
  margin-left: 8px;
}

@media (prefers-reduced-motion: no-preference) {
  .behaviour-pill { transition: background-color .15s ease, border-color .15s ease; }
  .lock-dot { transition: background-color .15s ease; }
}

/* --- rows: monospace data surface --- */
.student-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-hairline-soft);
  width: 100%;
  background: transparent;
  border-left: 0; border-right: 0; border-top: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.student-row:last-child { border-bottom: 0; }
.student-row:hover { background: var(--color-raised); }

.student-row:focus-visible {
  outline: 2px solid var(--color-positive);
  outline-offset: -2px;
}

.student-row[aria-current="true"] {
  background: var(--color-positive-bg);
  box-shadow: inset 3px 0 0 var(--color-positive);
}

.student-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  flex: none;
  background: var(--color-muted);
}

.student-name {
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--text-base);
  letter-spacing: .01em;
}

.student-total {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--color-muted);
  min-width: 3ch;
  text-align: right;
}

.student-total[data-sign="positive"] { color: var(--color-positive); }
.student-total[data-sign="negative"] { color: var(--color-negative); }

/* A decrypt fault is a fault, never a deletion — see the Task 6 ruling. */
.student-row--fault .student-name {
  color: var(--color-negative);
  font-style: italic;
}

.roster-empty {
  padding: var(--space-6) var(--space-4);
  color: var(--color-muted);
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* --- class list rows (the landing page after login).
 *
 * Same metrics as .student-row so the two console surfaces read as one
 * system, but an <a> rather than a <button>: this is navigation, not an
 * action, and it should middle-click and open-in-new-tab like a link.
 * The trailing "Open →" is aria-hidden — the link text already names the
 * destination, so announcing it again is noise to a screen reader. --- */
.class-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-hairline-soft);
  text-decoration: none;
  color: inherit;
}

.class-row:last-child { border-bottom: 0; }
.class-row:hover { background: var(--color-raised); }

.class-row:focus-visible {
  outline: 2px solid var(--color-positive);
  outline-offset: -2px;
}

.class-row-name {
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--text-base);
  letter-spacing: .01em;
}

/* Reveals on row hover/focus rather than sitting there on every row —
 * thirty permanent "Open →" labels would be visual noise on a list whose
 * rows are already obviously clickable. */
.class-row-go {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--color-muted);
  opacity: 0;
}

.class-row:hover .class-row-go,
.class-row:focus-visible .class-row-go { opacity: 1; }

@media (prefers-reduced-motion: no-preference) {
  .class-row { transition: background-color .15s ease; }
  .class-row-go { transition: opacity .15s ease; }
}

/* --- create rows: the last row of a console panel is a form.
 *
 * Adding a class, a student or a behaviour happens while looking at the ones
 * that already exist — usually to fill a gap just noticed — so the form is
 * the panel's final row rather than a separate page. Metrics match
 * .student-row and .class-row so it reads as part of the same list, with a
 * slightly raised ground to mark it as input rather than data. --- */
.create-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-hairline);
  background: var(--color-raised);
  margin: 0;
}

.create-row-input,
.create-row-points {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-ink);
  background: var(--color-card);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-3);
}

.create-row-input { flex: 1; min-width: 0; }

/* Wide enough for "-100" plus the number spinner, no wider — the points
 * field sits next to a free-text label and should not compete with it. */
.create-row-points { width: 7ch; text-align: center; }

.create-row-input::placeholder,
.create-row-points::placeholder { color: var(--color-muted); }

.create-row-input:focus-visible,
.create-row-points:focus-visible {
  outline: 2px solid var(--color-positive);
  outline-offset: 1px;
  border-color: var(--color-positive);
}

/* --- behaviour rows on the management page.
 *
 * Deliberately NOT .behaviour-pill: a pill is a control that awards a point,
 * and these are records being listed. Giving them the same shape would
 * invite a teacher to tap one expecting something to happen. --- */
.behaviour-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-hairline-soft);
}

.behaviour-row-label {
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--text-base);
}

.behaviour-row-points {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  min-width: 4ch;
  text-align: right;
}

.behaviour-row-points[data-sign="positive"] { color: var(--color-positive); }
.behaviour-row-points[data-sign="negative"] { color: var(--color-negative); }

.page-note {
  color: var(--color-muted);
  font-size: var(--text-sm);
  max-width: 60ch;
  margin: 0 0 var(--space-4);
}

/* Visible to screen readers, not to sighted users. The create rows use
 * placeholders as their visible affordance, but a placeholder is not a
 * label — it vanishes on the first keystroke and is not reliably announced. */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- lock screen --- */
.auth-card-body { padding: var(--space-6); }

.auth-card-body h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.625rem;
  margin: 0 0 var(--space-2);
  letter-spacing: -.01em;
}

.lock-note {
  color: var(--color-muted);
  font-size: var(--text-sm);
  margin: 0 0 var(--space-4);
}

.lock-error {
  color: var(--color-negative);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: .08em;
  margin: 0 0 var(--space-4);
}

.lock-signout {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-hairline-soft);
  text-align: center;
}

/* On the lock screen the red dot is an indicator, not a control. */
.auth-card .lock-dot { cursor: default; }

/* --- messaging (spec §7) --------------------------------------------------
 * Reuses the feed/card language rather than inventing a chat idiom: this is
 * correspondence with a school, not an instant messenger, and it should not
 * look like one. */

.topbar-link {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--color-muted);
  text-decoration: none;
}

.topbar-link:hover { color: var(--color-ink); }

.unread-badge {
  display: inline-block;
  min-width: 1.5em;
  padding: 0 .4em;
  border-radius: var(--radius-pill);
  background: var(--color-positive);
  color: var(--color-canvas);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.thread-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.thread-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-4);
  text-decoration: none;
  color: inherit;
}

.thread-row:hover { border-color: var(--color-positive); }

.thread-row:focus-visible {
  outline: 2px solid var(--color-positive);
  outline-offset: 2px;
}

.thread-row--unread .thread-name { color: var(--color-ink); }

.thread-name {
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--text-base);
}

/* Which guardian the thread is with — the distinguishing half of the row,
 * kept visually quiet so the child stays the subject of the conversation. */
.thread-guardian {
  font-size: var(--text-xs);
  color: var(--color-muted);
}

.thread-class {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-muted);
}

.compose {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}

.compose textarea {
  width: 100%;
  resize: vertical;
  font: inherit;
  padding: var(--space-3);
  color: var(--color-ink);
  background: var(--color-raised);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-sm, 4px);
}

.compose textarea:focus-visible {
  outline: 2px solid var(--color-positive);
  outline-offset: 1px;
}

.compose .btn-pill { align-self: flex-start; }

.message-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* The accent rail marks your own messages, so the two sides are separable
 * without relying on alignment tricks that break at narrow widths. */
.message {
  padding: var(--space-4);
  background: var(--color-card);
  border-left: 3px solid var(--color-hairline);
  border-radius: var(--radius-sm, 4px);
}

.message--mine { border-left-color: var(--color-positive); }

.message-who {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.message-body {
  margin: var(--space-2) 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-body--fault {
  color: var(--color-negative);
  font-style: italic;
}

.message-time,
.message-receipt {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-muted);
}

.message-receipt { margin-left: var(--space-3); }

/* A second back-link on the same row as the first. Inline styles are blocked
 * by style-src 'self' — see TestTemplatesRemainCompatibleWithStrictContentSecurityPolicy. */
.back-link--inline { margin-left: var(--space-4); }
