/* ============================================================================
   MorphMind Education — redesigned UI stylesheet
   Drop-in replacement for the inline <style> block in webapp_router.py (_PAGE).
   Everything the mockups use is here. No other colours, radii or sizes exist.
   Fonts: add to <head> before this file:
     <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
     <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap">
   ========================================================================== */

/* ── 1. Tokens ───────────────────────────────────────────────────────────── */
:root {
  /* surfaces */
  --bg:            #ECE9E0;   /* page */
  --rail:          #F3F1EA;   /* left rail, inset panels */
  --card:          #FBFAF7;   /* cards, rows, tables */
  --input:         #FFFEFB;   /* form fields */
  --accent-tint:   #E7EFEA;   /* accent-tinted panels, icon tiles */
  --row-hover:     #F5F2E9;
  --map-bg:        #0C1210;   /* the only dark surface */
  --map-panel:     #111917;

  /* ink — all tinted warm, never pure black/grey */
  --ink:           #1C1A15;   /* 14.8:1 on --bg */
  --body:          #46443B;   /*  8.4:1 */
  --muted:         #5F5C50;   /*  5.8:1 — smallest text allowed */
  --faint:         #86827A;   /* mono meta only, never body copy */

  /* accent — one green, everywhere */
  --accent:        #065F46;   /* 7.6:1 on --bg, 8.0:1 on --card */
  --accent-press:  #054C39;

  /* borders */
  --line:          #D8D3C7;   /* default 1px border */
  --line-soft:     #EFEBE0;   /* divider inside a card */
  --line-rail:     #E2DED2;
  --line-strong:   #DFDACE;   /* section rule on settings */

  /* mastery — always paired with its word, never colour alone */
  --mastered:      #059669;
  --getting:       #B45309;
  --stuck:         #B3261E;
  --notyet:        #8A8C86;
  --stuck-bg:      #FBEDEC;

  /* type */
  --sans: "Noto Sans", system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* radii */
  --r-input: 8px;
  --r-row:   10px;
  --r-card:  12px;
  --r-frame: 14px;
  --r-modal: 16px;
  --r-pill:  999px;

  /* elevation */
  --shadow-card:    0 1px 3px rgba(28, 26, 21, 0.05);
  --shadow-hover:   0 2px 8px rgba(28, 26, 21, 0.07);
  --shadow-overlay: 0 10px 25px -5px rgba(15, 23, 42, 0.22), 0 8px 10px -6px rgba(15, 23, 42, 0.14);
  --focus-ring:     0 0 0 3px rgba(6, 95, 70, 0.16);

  /* motion */
  --dur-micro: 150ms;
  --dur-comp:  300ms;
  --ease:      cubic-bezier(0.4, 0, 0.2, 1);
}

/* spacing scale, for reference — use these numbers only:
   4 · 8 · 10 · 12 · 14 · 16 · 18 · 20 · 22 · 24 · 26 · 28 · 32 · 40 · 48 · 56 */

/* ── 2. Reset & base ─────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: 28px; }
h2 { font-size: 24px; }
h3 { font-size: 19px; }
h4 { font-size: 17px; }
p  { margin: 0; }
a  { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-press); text-decoration: underline; }
::selection { background: var(--accent-tint); }

/* mono chrome label — nav sections, field labels, kickers, meta */
.label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.label--tight { font-size: 10px; letter-spacing: 0.14em; }
.meta  { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.hint  { font-size: 13px; color: var(--muted); line-height: 1.55; }
.body  { font-size: 15px; color: var(--body); line-height: 1.6; }

/* ── 3. App shell ────────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

.rail {
  background: var(--rail);
  border-right: 1px solid var(--line-rail);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.rail__brand { display: flex; align-items: center; gap: 9px; padding: 0 6px; font-size: 15px; font-weight: 600; }
.rail__brand img { width: 20px; height: 20px; display: block; }
.rail__tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-tint); border-radius: 4px; padding: 3px 5px;
}
.rail__group { display: grid; gap: 2px; }
.rail__head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 8px; }
.rail__section { border-top: 1px solid var(--line-rail); padding-top: 18px; }
.rail__foot { margin-top: auto; border-top: 1px solid var(--line-rail); padding-top: 16px; }

.navitem {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r-input);
  color: var(--body); font-size: 14px; font-weight: 500;
  background: none; border: none; font-family: inherit; text-align: left; width: 100%;
  cursor: pointer; transition: background var(--dur-micro) var(--ease);
}
.navitem:hover { background: #E9E5DA; color: var(--ink); text-decoration: none; }
.navitem.on { background: var(--accent-tint); color: var(--accent); font-weight: 600; }
.navitem svg { width: 17px; height: 17px; flex: none; }
.navitem .dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; }

.childchip { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-row); color: var(--ink); }
.childchip:hover { background: #E9E5DA; text-decoration: none; }
.avatar {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-tint); color: var(--accent);
  font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center;
}

/* content pane */
.pane__top {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 32px; border-bottom: 1px solid var(--line-rail);
  background: rgba(251, 250, 247, 0.7);
  position: sticky; top: 0; z-index: 5;
  backdrop-filter: blur(8px);
}
.pane__body { padding: 32px; display: grid; gap: 28px; max-width: 940px; }

/* ── 4. Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--card); border: none;
  border-radius: var(--r-pill); padding: 11px 20px;
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background var(--dur-micro) var(--ease);
}
.btn:hover  { background: var(--accent-press); }
.btn:active { background: var(--accent-press); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

.btn--secondary { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn--secondary:hover { background: #EFEBE0; }
.btn--ghost { background: transparent; color: var(--accent); font-weight: 600; padding: 11px 14px; }
.btn--ghost:hover { background: var(--accent-tint); }
.btn--quiet { background: transparent; color: var(--muted); font-weight: 500; padding: 11px 14px; }
.btn--quiet:hover { background: #EFEBE0; color: var(--ink); }
.btn--danger { background: var(--card); color: var(--stuck); border: 1px solid var(--line); }
.btn--danger:hover { background: var(--stuck-bg); border-color: var(--stuck); }
.btn--sm  { padding: 7px 13px; font-size: 12px; }
.btn--lg  { padding: 13px 22px; font-size: 15px; }
.btn--block { width: 100%; }
.btn--icon { width: 32px; height: 32px; padding: 0; }   /* needs aria-label */

/* ── 5. Forms ────────────────────────────────────────────────────────────── */
.field { display: block; }
.field > .label { display: block; margin-bottom: 7px; }
.field .label .opt { text-transform: none; letter-spacing: 0; color: var(--faint); }
input[type="text"], input[type="email"], input[type="password"], input:not([type]), select, textarea {
  width: 100%; background: var(--input); border: 1px solid var(--line);
  border-radius: var(--r-input); padding: 11px 13px;
  font-family: inherit; font-size: 15px; color: var(--ink);
  transition: border-color var(--dur-micro) var(--ease), box-shadow var(--dur-micro) var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--focus-ring);
}
input::placeholder { color: var(--faint); }
/* roomier input — the custom-topic entry is the hero of its row */
.input--lg { padding: 14px 16px; font-size: 16px; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

/* checkbox row (onboarding starter subjects) */
.check { display: flex; gap: 11px; align-items: flex-start; background: var(--input);
  border: 1px solid var(--line); border-radius: var(--r-row); padding: 13px 14px; cursor: pointer; }
.check:hover { border-color: var(--accent); }
.check:has(input:checked) { border-color: var(--accent); }

/* ── 6. Cards, rows, tables ──────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 24px; box-shadow: var(--shadow-card);
}
.card--tint { background: var(--accent-tint); border-color: rgba(6, 95, 70, 0.18); box-shadow: none; }
.card--inset { background: var(--rail); border-color: var(--line-rail); box-shadow: none; }
.card--flush { padding: 0; overflow: hidden; }   /* wrapper for row lists / tables */

/* subject card (home) */
.subject {
  display: grid; grid-template-columns: 44px 1fr 200px 20px; gap: 18px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 20px 22px; color: var(--ink); box-shadow: var(--shadow-card);
  transition: border-color var(--dur-micro) var(--ease), box-shadow var(--dur-micro) var(--ease);
}
.subject:hover { border-color: var(--accent); box-shadow: var(--shadow-hover); text-decoration: none; }
.subject__icon {
  width: 44px; height: 44px; border-radius: var(--r-row);
  background: var(--accent-tint); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.subject__name { font-size: 17px; font-weight: 600; }
.subject__desc { font-size: 14px; color: var(--muted); line-height: 1.5; margin-top: 3px; }
.subject__meta { font-family: var(--mono); font-size: 11px; color: var(--faint); margin-top: 8px; }

/* mastery bar */
.bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: #E5E1D6; }
.bar span { display: block; height: 100%; }
.bar .is-mastered { background: var(--mastered); }
.bar .is-getting  { background: var(--getting); }
.bar .is-stuck    { background: var(--stuck); }

/* curriculum / worksheet / attention rows — one bordered block, hairline between rows */
.rows { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.row {
  display: grid; grid-template-columns: 1fr 128px 18px; gap: 16px; align-items: center;
  padding: 15px 20px; border-bottom: 1px solid var(--line-soft); color: var(--ink);
  transition: background var(--dur-micro) var(--ease);
}
.row:last-child { border-bottom: none; }
.row:hover { background: var(--row-hover); text-decoration: none; }
.row.is-next { background: #F7F4EC; }
.row__name { font-size: 15px; font-weight: 600; }
.row__desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.row--ws   { grid-template-columns: 1fr 150px 300px; }
.rows__head {
  display: grid; grid-template-columns: 1fr 150px 300px; gap: 16px;
  padding: 11px 20px; background: var(--row-hover); border-bottom: 1px solid #E5E1D6;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
}
.rowacts { display: flex; gap: 6px; justify-content: flex-end; }

/* topic accordion */
.row--topic { cursor: pointer; }
.row.is-open { border-bottom: none; background: var(--row-hover); }
.row__expand { padding: 2px 20px 18px; border-bottom: 1px solid var(--line-soft); background: var(--row-hover); }
.row__expand:last-child { border-bottom: none; }
.chev { display: flex; transition: transform var(--dur-micro) var(--ease); }
.chev--open { transform: rotate(90deg); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 0 0 10px; }
.legend .status { font-size: 12px; color: var(--muted); }
.generr { font-size: 13px; }
.err { color: var(--stuck); }

/* status = dot + word, always both */
.status { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--body); }
.status .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot--mastered { background: var(--mastered); }
.dot--getting  { background: var(--getting); }
.dot--stuck    { background: var(--stuck); }
.dot--notyet   { background: var(--notyet); }

/* pills / badges */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 4px 10px;
}
.pill--next { color: var(--stuck); border-color: rgba(179, 38, 30, 0.3); }
.chip {
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--r-pill); padding: 8px 15px; font-family: inherit; font-size: 13px;
  font-weight: 500; cursor: pointer; transition: background var(--dur-micro) var(--ease);
}
.chip:hover { background: var(--accent-tint); border-color: var(--accent); }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px; }
.stat__n { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin-top: 8px; }

/* segmented toggle (Map | List) */
.segment { display: flex; background: #EFEBE0; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px; }
.segment button {
  background: transparent; border: none; color: var(--muted); border-radius: var(--r-pill);
  padding: 7px 16px; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.segment button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(28, 26, 21, 0.08); }
/* compact segment — matches .btn--sm height (30px) in the topic gen row */
.segment--sm { padding: 2px; }
.segment--sm button { padding: 4px 12px; font-size: 12px; line-height: 16px; }

/* ── 7. Grade a photo ────────────────────────────────────────────────────── */
.drop {
  border: 1.5px dashed #C6CFC8; border-radius: var(--r-card); background: #F7F9F7;
  padding: 40px 28px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
  transition: border-color var(--dur-micro) var(--ease), background var(--dur-micro) var(--ease);
}
.drop.is-over { border-color: var(--accent); background: var(--accent-tint); }
.drop__icon {
  width: 46px; height: 46px; border-radius: var(--r-card);
  background: var(--accent-tint); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.score {
  flex: none; width: 78px; height: 78px; border-radius: 50%; border: 3px solid var(--getting);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score.is-good { border-color: var(--mastered); }
.score.is-bad  { border-color: var(--stuck); }
.score b { font-size: 22px; font-weight: 600; line-height: 1; }

/* ── 8. Knowledge map ────────────────────────────────────────────────────── */
.map {
  border-radius: var(--r-card); overflow: hidden; border: 1px solid #C9C3B5;
  display: grid; grid-template-columns: 1fr 300px; background: var(--map-bg);
}
.map__canvas { position: relative; height: 520px; background: radial-gradient(60% 60% at 50% 45%, #16211D 0%, var(--map-bg) 70%); }
.map__legend { position: absolute; left: 16px; top: 16px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 6; }
.legpill {
  display: flex; align-items: center; gap: 7px;
  background: rgba(12, 18, 16, 0.72); backdrop-filter: blur(4px);
  border: 1px solid rgba(232, 239, 234, 0.22); color: #E8EFEA;
  border-radius: var(--r-pill); padding: 6px 13px; font-family: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
}
.legpill:hover { background: rgba(232, 239, 234, 0.18); }
.legpill.on { background: #E8EFEA; border-color: #E8EFEA; color: var(--map-bg); font-weight: 600; }
.legpill i { width: 9px; height: 9px; border-radius: 50%; }
.legpill .c { font-family: var(--mono); opacity: 0.65; }
/* Whatever the map says instead of drawing (loading, WebGL off, load failure).
   z-index 7 so it covers the legend (6): both live in the top-left corner, and a
   message painted under the pills is a message nobody reads. */
.map__msg {
  position: absolute; inset: 0; z-index: 7; background: var(--map-bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; padding: 32px;
}
.map__msg h4 { color: #F2F6F3; font-size: 16px; }
.map__msg p { color: rgba(232, 239, 234, 0.72); font-size: 14px; line-height: 1.6; max-width: 46ch; }
.map__msg ol {
  color: rgba(232, 239, 234, 0.72); font-size: 14px; line-height: 1.7; text-align: left;
  max-width: 46ch; padding-left: 20px; display: flex; flex-direction: column; gap: 4px;
}
.map__msg ol b { color: #E8EFEA; font-weight: 600; }
.map__msg .map__msg-foot { color: rgba(232, 239, 234, 0.5); font-size: 12px; }
.map__hint { position: absolute; left: 16px; bottom: 14px; font-family: var(--mono); font-size: 11px; color: rgba(232, 239, 234, 0.55); z-index: 6; }
.map__zoom { position: absolute; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; z-index: 6; }
.map__zoom button {
  width: 36px; height: 36px; border-radius: 9px; background: rgba(232, 239, 234, 0.92);
  border: none; color: var(--map-bg); font-family: inherit; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.map__zoom button:hover { background: #fff; }
.map__panel {
  background: var(--map-panel); border-left: 1px solid rgba(232, 239, 234, 0.12);
  padding: 24px; display: flex; flex-direction: column; gap: 20px;
}
.map__panel h4 { color: #F2F6F3; font-size: 19px; }
.map__panel .label { color: rgba(232, 239, 234, 0.55); }
.map__panel p { color: rgba(232, 239, 234, 0.75); font-size: 14px; line-height: 1.6; }
.map__panel .sect { border-top: 1px solid rgba(232, 239, 234, 0.12); padding-top: 16px; }
.map__panel .btn { background: #E8EFEA; color: var(--map-bg); width: 100%; margin-top: auto; }
.map__panel .btn:hover { background: #fff; }

/* ── 9. Settings sections (flat, label column) ───────────────────────────── */
.setrow { display: grid; grid-template-columns: 220px 1fr; gap: 32px; padding: 30px 0; border-bottom: 1px solid var(--line-strong); }
.setrow:first-child { padding-top: 0; }
.setrow:last-child  { border-bottom: none; padding-bottom: 0; }
.setrow__title { font-size: 16px; font-weight: 600; }

/* ── 10. States ──────────────────────────────────────────────────────────── */
.empty { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 40px 28px; text-align: center; }
.empty__icon { display: inline-flex; width: 44px; height: 44px; border-radius: 11px; background: var(--accent-tint); color: var(--accent); align-items: center; justify-content: center; }

.skel { display: block; border-radius: 4px; background: #E8E4D8; }
.skel--line { height: 11px; background: var(--line-soft); }
/* build skeletons at the REAL row height so nothing shifts on arrival */

.alert {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--stuck-bg); border: 1px solid rgba(179, 38, 30, 0.28);
  border-radius: var(--r-row); padding: 14px 16px;
}
.alert__title { font-size: 14px; font-weight: 600; color: #7A1B15; }
.alert svg { flex: none; margin-top: 1px; color: var(--stuck); }

.spinner { animation: mm-spin 1s linear infinite; }
@keyframes mm-spin { to { transform: rotate(360deg); } }
.progressbar { height: 4px; border-radius: 2px; background: #E0DCCF; overflow: hidden; }
.progressbar span { display: block; height: 100%; background: var(--accent); transition: width var(--dur-comp) var(--ease); }

/* ── 11. Overlay / modal ─────────────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; background: rgba(28, 26, 21, 0.5); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 32px; }
.modal { width: 100%; max-width: 470px; background: var(--card); border-radius: var(--r-modal);
  padding: 30px; box-shadow: var(--shadow-overlay); }
/* worksheet print preview — centered, tall, paper inside */
.modal--preview { max-width: 860px; height: min(88vh, 1100px); display: flex; flex-direction: column; padding: 22px; }
.previewframe { width: 100%; flex: 1; border: 1px solid var(--line); border-radius: var(--r-input); background: #fff; }
.step { display: flex; gap: 13px; align-items: flex-start; }
.step__n {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: #EFEBE0; color: var(--muted);
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.step--key .step__n { background: var(--accent-tint); color: var(--accent); }

/* ── 12. Auth ────────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth__form { display: flex; align-items: center; justify-content: center; padding: 48px; }
.auth__form > div { width: 100%; max-width: 380px; }
.auth__aside { background: var(--rail); border-left: 1px solid var(--line-rail); padding: 48px;
  display: flex; flex-direction: column; justify-content: center; gap: 22px; }

/* ── 13. Print (worksheet + answer key) ──────────────────────────────────── */
.sheet { background: #fff; color: #111; padding: 52px 56px; max-width: 720px; margin: 0 auto; font-family: var(--sans); }
.sheet__head { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 1px solid var(--ink); padding-bottom: 12px; }
.sheet__title { font-size: 20px; font-weight: 600; }
.sheet__sub { font-size: 13px; color: #555; margin-top: 4px; }
.sheet__q { font-size: 16px; line-height: 1.5; }
.sheet__q .n { font-family: var(--mono); font-weight: 600; margin-right: 10px; }
.sheet__rule { border-bottom: 1px solid #bbb; height: 30px; max-width: 300px; margin-top: 10px; }
.sheet__a { font-size: 14px; color: var(--accent); margin-top: 6px; padding-left: 30px; }
.sheet__foot { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: #888; margin-top: 48px; border-top: 1px solid #E5E5E5; padding-top: 12px; }
@media print {
  .sheet { padding: 24px 0; max-width: none; }
  .sheet__q { break-inside: avoid; }
}

/* ── 14. Operator console (slate, deliberately not cream) ────────────────── */
.admin { --bg: #F8FAFC; --card: #FFFFFF; --ink: #0F172A; --body: #1E293B; --muted: #475569;
  --faint: #94A3B8; --line: #CBD5E1; --line-soft: #F1F5F9; --rail: #F1F5F9;
  background: var(--bg); color: var(--ink); }
.admin .mono { font-family: var(--mono); }
.admin__top { display: flex; align-items: center; gap: 14px; padding: 14px 24px; background: #fff; border-bottom: 1px solid #E2E8F0; }
.admin__tabs { display: flex; gap: 2px; flex-wrap: wrap; padding: 10px 20px 0; }
.admin__tab {
  background: transparent; border: 1px solid transparent; color: #64748B;
  border-radius: 8px 8px 0 0; padding: 8px 14px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer;
}
.admin__tab.on { background: #F1F5F9; border-color: #E2E8F0; border-bottom-color: #F1F5F9; color: #0F172A; font-weight: 600; }
.admin__editor {
  background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 0 8px 8px 8px; padding: 18px;
  font-family: var(--mono); font-size: 13px; line-height: 1.7; color: #1E293B; min-height: 300px; width: 100%;
}

/* ── 15. Responsive: rail becomes a bottom tab bar ───────────────────────── */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    flex-direction: row; gap: 0; padding: 8px 6px 14px;
    background: rgba(251, 250, 247, 0.94); backdrop-filter: blur(8px);
    border-right: none; border-top: 1px solid var(--line-rail);
  }
  .rail__brand, .rail__head, .rail__foot, .rail__section { display: none; }
  .rail__group { grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
  .navitem { flex-direction: column; gap: 4px; min-height: 48px; font-size: 11px; justify-content: center; }
  .navitem.on { background: transparent; }
  .pane__body { padding: 18px; padding-bottom: 96px; gap: 18px; }
  .pane__top { padding: 16px 18px; }
  .subject { grid-template-columns: 38px 1fr 17px; }
  .subject > .bar, .subject__meta { display: none; }
  .row, .row--ws, .rows__head { grid-template-columns: 1fr auto; }
  .rows__head { display: none; }
  .rowacts { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; }
  .map { grid-template-columns: 1fr; }
  .map__canvas { height: 380px; }
  .setrow, .auth { grid-template-columns: 1fr; }
  .auth__aside { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  /* every tap target ≥ 44px on phone */
  .btn, input, select, .chip { min-height: 46px; }
  .btn--sm { min-height: 40px; }
  .segment--sm { min-height: 40px; }
}
