/* Bell — base, shell and components. Tokens live in tokens.css; the queue's
   own list styles in queue.css. Class names are the component index in
   docs/design/style-guide.md: use one of these before inventing another. */

/* ---- Base ---------------------------------------------------------------- */
* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--ground); color: var(--ink);
  font: var(--text-body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--action-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1 { font: var(--text-display); letter-spacing: -0.01em; }
h2 { font: var(--text-title); letter-spacing: -0.005em; }
h3 { font: var(--text-heading); }
code, pre { font-family: var(--font-mono); }
:not(pre) > code { font-size: 0.9em; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.05em 0.35em; }
pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
strong { font-weight: 600; }
/* Prose never strands one word on its last line (Swatch's layout check,
   2026-12-04). text-wrap inherits, so spans inside these follow. */
p, li, dd, label, summary, figcaption, pre, .note { text-wrap: pretty; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font: var(--text-small); }
/* The hidden attribute wins over any display a class sets. */
[hidden] { display: none !important; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) {
  a, button, .row, .nav-item { transition: background-color 120ms ease, color 120ms ease, box-shadow 120ms ease; }
}

/* ---- Shell: rail + page ---------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--rail-width) minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; align-self: start; height: 100vh;
  display: flex; flex-direction: column; gap: var(--space-5);
  padding: var(--space-4) var(--space-3) var(--space-4) var(--space-4);
}
.brand { display: flex; align-items: center; gap: 10px; padding: var(--space-1) var(--space-2); color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand .mark { width: 28px; height: 28px; color: var(--brand); flex: none; }
.brand .mark svg { width: 28px; height: 28px; fill: currentColor; }
.brand .name { font: 700 20px/24px var(--font-sans); letter-spacing: -0.02em; }
.nav { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nav-title { font: var(--text-label); color: var(--faint); padding: var(--space-4) var(--space-2) var(--space-1); }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 var(--space-2) 0 10px;
  border-radius: var(--radius-md); color: var(--muted); font-weight: 500;
}
.nav-item svg { width: 18px; height: 18px; fill: currentColor; flex: none; opacity: 0.85; }
.nav-item:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.nav-item .count {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px; border-radius: var(--radius-pill);
  background: var(--action); color: var(--on-action); font: 600 12px/20px var(--font-sans); text-align: center;
  font-variant-numeric: tabular-nums;
}
.nav-item[aria-current="page"] .count { background: var(--action); }
.rail .who { margin-top: auto; padding: var(--space-2); border-top: 1px solid var(--line); display: grid; gap: 2px; }
.rail .who .me { font: var(--text-small); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail .who a { font: var(--text-small); color: var(--faint); display: inline-flex; align-items: center; gap: 6px; }
.rail .who a svg { width: 14px; height: 14px; fill: currentColor; }
.menu-toggle { display: none; }

/* The rail folds to a strip: the mark, the toggle, and each item's icon (its
   name in a tooltip). The page takes the width back. */
.rail .rail-toggle { display: none; }
.rail-toggle .if-closed, .rail-closed .rail-toggle .if-open { display: none; }
.rail-closed .rail-toggle .if-closed { display: block; }
@media (min-width: 861px) {
  .shell { transition: grid-template-columns 160ms ease; }
  .rail { position: relative; }
  .rail .rail-toggle { display: inline-grid; position: absolute; top: calc(var(--space-4) + 2px); right: var(--space-2); }
  .rail-closed { grid-template-columns: var(--rail-closed-width) minmax(0, 1fr); }
  .rail-closed .rail { padding-inline: var(--space-2); align-items: center; overflow: hidden; }
  .rail-closed .rail .nav-title,
  .rail-closed .rail .who .me { display: none; }
  .rail-closed .rail-toggle { position: static; order: -1; }
  .rail-closed .nav-item { width: 40px; padding: 0; justify-content: center; font-size: 0; gap: 0; position: relative; }
  .rail-closed .nav-item .count {
    position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; line-height: 16px;
  }
  .rail-closed .rail .who { border-top: 0; padding: 0; justify-items: center; }
  .rail-closed .rail .who a { font-size: 0; gap: 0; width: 40px; height: 36px; justify-content: center; }
  .rail-closed .rail .who a svg { width: 18px; height: 18px; }
}
@media (prefers-reduced-motion: reduce) { .shell { transition: none; } }

/* The title bar (shared/_app_switcher, the bar every app shares): Bell's icon and name above
   the shell, in Bell's own colors and type, lined up with the rail's icons. It stays put, so
   the rail below it starts under it. */
:root { --title-bar: 60px; }
body > .appsw-bar {
  position: sticky; top: 0; z-index: 30; height: var(--title-bar);
  --appsw-bar-pad: calc(var(--space-4) + 8px); /* the switcher icon over the rail's item icons */
  background: var(--panel); color: var(--ink); border-bottom: 1px solid var(--line);
}
body > .appsw-bar .appsw > summary:hover { background: var(--hover); }
.rail { height: calc(100vh - var(--title-bar)); }
@media (min-width: 861px) {
  /* With no name beside it, the fold button sits at the top of the rail, at its edge. */
  .rail .rail-toggle { position: static; align-self: flex-end; margin-bottom: calc(-1 * var(--space-3)); }
  .rail-closed .rail .rail-toggle { align-self: center; margin-bottom: 0; }
}

.page { padding: var(--space-5) var(--space-6) var(--space-8); max-width: var(--page-wide); width: 100%; }
.page-narrow .page { max-width: var(--page-narrow); }
.page-full .page { max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-4); }
.page-head .titles { display: grid; gap: var(--space-1); min-width: 0; }
.page-head .actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.crumb { display: inline-flex; align-items: center; gap: 4px; font: var(--text-small); color: var(--faint); margin-bottom: var(--space-2); }
.crumb svg { width: 14px; height: 14px; fill: currentColor; }
.crumb a { color: var(--faint); }
.crumb .sep { margin: 0 var(--space-1); }
.facts .progress { font-variant-numeric: tabular-nums; }
.lede { font: var(--text-reading); color: var(--muted); max-width: 60ch; }
.facts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); font: var(--text-small); color: var(--muted); margin-top: var(--space-2); }
.facts > * { display: inline-flex; align-items: center; gap: 6px; }
/* A fact that is a phrase ("recorded in … as “…”") wraps as one sentence,
   not as two columns, when the line runs out. */
.facts > span:not(.chip) { display: inline; }
/* Text-Em-All's opt-out line, said once above a page of texts. */
.note.added-by-carrier { margin-block: var(--space-3); }
.facts strong { color: var(--ink); font-weight: 600; }

/* Signed-out: no rail, one card in the middle. */
.gate-page { min-height: 100vh; display: grid; place-items: center; padding: var(--space-5); }
.gate { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-6) var(--space-6) var(--space-5); display: grid; gap: var(--space-4); justify-items: start; }
.gate .brand { padding: 0; }
.gate .brand .mark, .gate .brand .mark svg { width: 36px; height: 36px; }
.gate .brand .name { font-size: 26px; line-height: 30px; }
.gate h1 { font: var(--text-title); }
.gate p { color: var(--muted); font: var(--text-reading); }
.gate .flash { margin: 0; width: 100%; }

/* ---- Flash ----------------------------------------------------------------- */
.flash { border-radius: var(--radius-md); padding: 10px 14px; margin-bottom: var(--space-4); font: var(--text-body); border: 1px solid transparent; }
.flash-alert { background: var(--danger-wash); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.flash-notice { background: var(--action-wash); color: var(--action-ink); border-color: color-mix(in srgb, var(--action) 25%, transparent); }
.flash-undo-form { display: inline; margin-left: var(--space-2); }
.flash-undo { font-weight: 600; text-decoration: underline; }
.flash-warn { background: var(--brand-wash); color: var(--brand-ink); border-color: color-mix(in srgb, var(--brand) 35%, transparent); }
.panel .flash, .card .flash { margin: var(--space-2) 0 0; }
/* Viewing as a coach (MasqueradesController): a warn Flash that stays at the top
   of every page while it lasts, with Stop at its end. */
.viewing-as { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: var(--space-2); padding-block: var(--space-2); }
.viewing-as > svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.viewing-as p { margin: 0; flex: 1 1 0; min-width: 0; color: var(--ink); }
.viewing-as .note { overflow-wrap: anywhere; }
.viewing-as form { margin-left: auto; }

/* ---- Panel and card ---------------------------------------------------------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.panel + .panel, .panel + .card, .card + .panel, .card + .card, .panel + h2, .card + h2 { margin-top: var(--space-4); }
h2 + .panel, h2 + .card, h2 + .table { margin-top: var(--space-3); }
.section { display: flex; align-items: baseline; gap: var(--space-2); padding: var(--space-3) var(--space-4) var(--space-2); font: var(--text-heading); }
.section .count { font: var(--text-body); color: var(--faint); font-variant-numeric: tabular-nums; }
.section .aside { margin-left: auto; font: var(--text-small); color: var(--faint); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); display: grid; gap: var(--space-3); }
.card > h3 { margin-bottom: -4px; }
.empty { padding: var(--space-4); color: var(--faint); font: var(--text-reading); }
.panel .empty { padding: var(--space-3) var(--space-4) var(--space-4); }
.note { font: var(--text-small); color: var(--muted); }
/* Where replies land: pretty finds no good break around the phone number,
   so balance the lines instead. */
.note.leaves-from { text-wrap: balance; }
/* A panel's own explainer under its heading, and its form below the rows. */
.panel-note { padding: 0 var(--space-4) var(--space-3); font: var(--text-small); color: var(--muted); max-width: 70ch; }
.panel-foot { display: grid; gap: var(--space-2); padding: var(--space-4); border-top: 1px solid var(--line); background: var(--panel-2); }
.panel-foot .form-row { margin-bottom: var(--space-1); }
.panel-foot .form-grid + .form-actions { margin-top: var(--space-3); }
/* A wide table inside a panel scrolls sideways on a phone rather than clipping. */
.table-scroll { overflow-x: auto; border-top: 1px solid var(--line); }
.form-row .field.narrow { flex: 0 1 140px; }

/* ---- Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 var(--space-4);
  border: 1px solid transparent; border-radius: var(--radius-md); cursor: pointer; white-space: nowrap;
  background: var(--action); color: var(--on-action); font: 600 14px/20px var(--font-sans);
}
.btn:hover { background: var(--action-ink); color: var(--on-action); text-decoration: none; }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn-go { background: var(--go); color: var(--on-go); }
.btn-go:hover { background: var(--go-ink); color: var(--on-go); }
.btn-quiet { background: var(--panel); color: var(--ink); border-color: var(--line-strong); font-weight: 500; }
.btn-quiet:hover { background: var(--panel-2); color: var(--ink); }
.btn-danger { background: var(--panel); color: var(--danger); border-color: var(--line-strong); font-weight: 500; }
.btn-danger:hover { background: var(--danger-wash); color: var(--danger); }
.btn-sm { height: 30px; padding: 0 var(--space-3); font-size: 13px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: default; }
.link-button { background: none; border: 0; padding: 0; color: var(--action-ink); font: inherit; cursor: pointer; }
.link-button:hover { text-decoration: underline; }
.link-button.danger { color: var(--danger); }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.icon-btn.failed { color: var(--danger); }
form.button_to { display: inline; }
.toolbar { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }

/* ---- Forms ----------------------------------------------------------------- */
.field { display: grid; gap: 6px; }
.field > label, .field-label { font: var(--text-label); color: var(--muted); }
.input, .select, .textarea {
  height: 36px; padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-md);
  background: var(--panel); color: var(--ink); font: var(--text-body); min-width: 0; width: 100%;
}
.textarea { height: auto; padding: var(--space-2) var(--space-3); resize: vertical; font: var(--text-reading); }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.select { cursor: pointer; }
.select-inline { width: auto; justify-self: start; }
.form-row { display: flex; gap: var(--space-3); align-items: end; flex-wrap: wrap; }
.form-row .field { flex: 1 1 200px; }
.form-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: end; }
.form-actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.check { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; }
/* The box sits beside the label's first line, even when the words wrap. */
.check input { width: 16px; height: 16px; margin: calc((1lh - 16px) / 2) 0 0; flex: none; accent-color: var(--action); }
/* Settings: one card, its parts split by hairlines, one Save at the foot (working_hours/show). */
.settings { gap: 0; padding-top: 0; padding-bottom: 0; }
.settings > section { display: grid; gap: var(--space-3); padding: var(--space-4) 0; }
.settings > section + section, .settings > .settings-save { border-top: 1px solid var(--line); }
.settings > .settings-save { padding: var(--space-4) 0; }
/* Week hours: one row a day, a tick and a from-to span (working_hours/show). */
.hours { border: 0; padding: 0; margin: 0; display: grid; gap: var(--space-2); min-width: 0; }
.hours > legend { padding: 0; margin-bottom: var(--space-2); }
.hours-day { display: grid; grid-template-columns: calc(var(--space-8) * 2) auto auto auto; gap: var(--space-2); align-items: center; justify-content: start; }
.hours-day .select { width: auto; }
.hours-day:has(input[type=checkbox]:not(:checked)) .select { opacity: .55; }
@media (max-width: 480px) {
  .hours-day { grid-template-columns: 1fr auto 1fr; }
  .hours-day > .check { grid-column: 1 / -1; }
}

/* ---- Chips and tags ---------------------------------------------------------- */
.chip {
  display: inline-block; min-width: 80px; padding: 0 10px; text-align: center; font: 500 12px/22px var(--font-sans);
  border-radius: var(--radius-sm); background: var(--panel-2); color: var(--muted); white-space: nowrap;
}
.chip-sent, .chip-complete { background: var(--go-wash); color: var(--go-ink); }
.chip-failed, .chip-suppressed { background: var(--danger-wash); color: var(--danger); }
.chip-pending, .chip-active, .chip-sending, .chip-approved, .chip-scheduled { background: var(--action-wash); color: var(--action-ink); }
.chip-cancelled, .chip-removed, .chip-held_out, .chip-revoked, .chip-paused, .chip-ended { background: transparent; color: var(--faint); box-shadow: inset 0 0 0 1px var(--line); }
.chip-edited { background: var(--brand-wash); color: var(--brand-ink); }
.chip-auto { min-width: 0; }
.tag { display: inline-block; font: 500 12px/18px var(--font-sans); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 6px; color: var(--muted); white-space: nowrap; }
.flag { color: var(--brand-ink); font-weight: 600; }

/* ---- Tables ---------------------------------------------------------------- */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font: var(--text-body); }
table.table th { text-align: left; color: var(--faint); font: var(--text-label); padding: 10px var(--space-4); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.table td { padding: 10px var(--space-4); border-top: 1px solid var(--line); vertical-align: top; }
table.table tr:first-child td { border-top: 0; }
table.table tbody tr:hover td { background: var(--hover); }
table.table td.right, table.table th.right { text-align: right; }
table.table td.actions { text-align: right; white-space: nowrap; }
table.table td.actions form.button_to + form.button_to { margin-left: var(--space-2); }
/* Stacked tables of one kind share a column grid so their columns line up. */
table.table.grid { table-layout: fixed; border-top: 1px solid var(--line); }
table.table.grid td { vertical-align: middle; }
table.table.grid col.who { width: 42%; }
table.table.grid col.act { width: 38%; }
table.table.grid td:first-child { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  table.table.grid, table.table.grid tbody { display: block; }
  table.table.grid thead, table.table.grid colgroup { display: none; }
  table.table.grid tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: var(--space-3); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); }
  table.table.grid tbody tr:first-child { border-top: 0; }
  table.table.grid td { padding: 0; border: 0; }
  table.table.grid td:first-child { grid-column: 1 / -1; margin-bottom: var(--space-1); }
  table.table.grid td.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); }
  table.table.grid td.actions form.button_to + form.button_to { margin-left: 0; }
}

/* Clearances: peer panels a section apart. */
.clearances { display: grid; gap: var(--space-6); }
.clearances .panel + .panel, .clearances .card + .panel { margin-top: 0; }
table.table tr.sub td { background: var(--panel-2); color: var(--muted); font: var(--text-small); padding-top: 6px; padding-bottom: 6px; }
table.table svg.inline { display: inline-block; vertical-align: -3px; width: 14px; height: 14px; fill: var(--faint); }

/* ---- The message ---------------------------------------------------------------
   What a coach reviews. A reading-size block that keeps the sender's line
   breaks; a reply from the learner is indented and tinted so the thread
   reads at a glance. */
.message { display: grid; gap: var(--space-2); }
.message .head { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; font: var(--text-small); color: var(--muted); }
.message .head .who { color: var(--ink); font-weight: 600; font-size: 14px; }
.message .head .when { margin-left: auto; color: var(--faint); font-variant-numeric: tabular-nums; }
.message .text { background: var(--panel-2); border-radius: var(--radius-lg); border-top-left-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); font: var(--text-reading); }
.message .subject { font-weight: 600; }
.message .text pre, .reply pre.text { font: var(--text-reading); }
/* Sequence steps: one panel, each text split from the next by a hairline,
   so the approve card below is the only raised box on the page. */
.steps .step + .step { border-top: 1px solid var(--line); padding-top: var(--space-4); }
.steps .step.gone .text { color: var(--muted); }
.thread + .card, .thread + details.card, .card + details.card, details.card + .card { margin-top: var(--space-4); }
.reply { margin-left: var(--space-6); display: grid; gap: 4px; }
.reply .head { font: var(--text-small); color: var(--muted); display: flex; align-items: center; gap: 6px; }
.reply .head svg { width: 14px; height: 14px; fill: var(--faint); }
.reply .text { background: var(--action-wash); color: var(--ink); border-radius: var(--radius-lg); border-top-right-radius: var(--radius-sm); padding: var(--space-2) var(--space-4); font: var(--text-reading); }
.thread { display: grid; gap: var(--space-3); }
/* Recording after the fact (bell#117): the run's one button, and a card's own. */
.record-all, .record-one { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.record-all { margin-bottom: var(--space-3); }
/* The way on to the next run after Approve (bell#111), and the queue's "review together" line (bell#112). */
.next-run { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-3); }
.review-all { font: var(--text-small); color: var(--muted); margin: 0 0 var(--space-3); }
/* A team lead's read-only view (bell#118): one panel per coach, chase rows in the brand wash. */
.team { display: grid; gap: var(--space-4); }
.team .section .count { font: var(--text-small); }
.team .follow-up { margin: 0 var(--space-4) var(--space-3); }
.team tr.chase td { background: var(--brand-wash); }
.team .na { color: var(--faint); }
.team table.table td { white-space: nowrap; }
.notices table.table td { white-space: nowrap; }
.notice-text pre { font: var(--text-body); }
.team-legend, .legend { max-width: 70ch; margin: calc(-1 * var(--space-2)) 0 var(--space-3); }
.views a[aria-current="page"] { font-weight: 600; }
.review .card + .card { margin-top: var(--space-3); }
.review .card .pick { display: flex; gap: var(--space-2); align-items: baseline; flex-wrap: wrap; }
.review .card .pick h3 { margin: 0; }
.review .card .pick input { width: 18px; height: 18px; accent-color: var(--action); align-self: center; }
.review .messages { display: grid; gap: var(--space-2); margin-top: var(--space-3); padding-top: var(--space-2); border-top: 1px solid var(--line); }
.review .messages .who { font: var(--text-small); color: var(--muted); }
.review .messages pre { margin: 2px 0 0; white-space: pre-wrap; font: var(--text-body); }
.record-one { margin-top: var(--space-2); }

/* ---- Disclosure ----------------------------------------------------------------- */
details.more > summary { cursor: pointer; color: var(--muted); font: var(--text-body); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: ""; width: 0; height: 0; border: 5px solid transparent; border-left-color: var(--faint); margin-left: 2px; }
details.more[open] > summary::before { transform: rotate(90deg) translate(-2px, -2px); }
details.more > summary:hover { color: var(--ink); }
details.more > .body { margin-top: var(--space-3); display: grid; gap: var(--space-3); }
/* A disclosure that is a button: same look as a summary, a real button role. */
.disclose { background: none; border: 0; padding: 0; cursor: pointer; color: var(--muted); font: var(--text-body); display: inline-flex; align-items: center; gap: 6px; justify-self: start; }
.disclose::before { content: ""; width: 0; height: 0; border: 5px solid transparent; border-left-color: var(--faint); margin-left: 2px; transition: transform 120ms; }
.disclose[aria-expanded="true"]::before { transform: rotate(90deg) translate(-2px, -2px); }
.disclose:hover { color: var(--ink); }
.disclose:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
.edit-panel { display: grid; gap: var(--space-3); }
.exchange { display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); }
/* Compose: the box beside what the learner's phone will show. */
.compose { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: var(--space-3); align-items: start; }
.preview { display: grid; gap: var(--space-1); justify-items: start; }
.preview .bubble { background: var(--panel-2); color: var(--ink); border-radius: var(--radius-lg); border-bottom-left-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); font: var(--text-body); white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }
.preview .count { font: var(--text-small); color: var(--faint); }
.form-actions .saved { font: var(--text-small); color: var(--go-ink); }
.proposed { display: flex; gap: var(--space-3); align-items: baseline; flex-wrap: wrap; }
.proposed .note { min-width: 0; }
.proposed form { display: inline; }
@media (max-width: 820px) { .compose { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .disclose::before { transition: none; } }

/* ---- Destination and MMA marks (shared by queue rows and detail pages) ---- */
.dest { display: inline-grid; place-items: center; width: 18px; height: 20px; flex: none; }
.dest svg { width: 18px; height: 18px; fill: currentColor; }
.dest .learner { color: var(--go); }
.dest .sandbox, .flag .dest { color: var(--brand); }
.account { display: inline-block; font: 500 12px/18px var(--font-sans); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 6px; color: var(--muted); }

/* ---- Switcher (Mine / Everyone / one coach) ------------------------------------- */
.views { display: flex; align-items: center; gap: var(--space-1); flex-wrap: wrap; margin-bottom: var(--space-3); }
.views a, .views select {
  height: 32px; padding: 0 var(--space-3); border-radius: var(--radius-md); color: var(--muted); display: inline-flex; align-items: center;
  border: 0; background: transparent; font: 500 14px/20px var(--font-sans);
}
.views a:hover { background: var(--hover); text-decoration: none; color: var(--ink); }
.views .on { background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.views select { cursor: pointer; padding-right: var(--space-2); }
.readonly-note { padding: 0 var(--space-4) var(--space-2); color: var(--faint); font: var(--text-small); }

/* ---- Style guide page -------------------------------------------------------- */
.guide { display: grid; gap: var(--space-6); }
.guide section { display: grid; gap: var(--space-3); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-3); }
.swatch { border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; background: var(--panel); }
.swatch .fill { height: 56px; }
.swatch .meta { padding: var(--space-2) var(--space-3); font: var(--text-small); display: grid; gap: 2px; }
.swatch .meta code { font-size: 11px; }
.specimen { display: grid; gap: var(--space-2); }
.specimen .line { display: grid; grid-template-columns: 110px 1fr; gap: var(--space-4); align-items: baseline; }
.specimen .line .name { font: var(--text-label); color: var(--faint); }
.demo { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4); display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }
.demo-stack { display: grid; gap: var(--space-3); }

/* ---- Small screens: the rail becomes a bar ------------------------------------- */
@media (max-width: 860px) {
  /* Bar on top, page below; the page takes the rest, so a short page never opens a gap under the bar. */
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  /* The rail's menu button sits in the title bar's row, at its right, rather than in a second
     bar of its own; the menu opens below the title bar. */
  .rail { position: sticky; top: 0; z-index: 31; height: auto; margin-top: calc(-1 * var(--title-bar)); min-height: var(--title-bar);
          flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3);
          padding: var(--space-3) var(--space-4); pointer-events: none; }
  .rail .menu-toggle, .rail .menu { pointer-events: auto; }
  .rail .menu-check:checked ~ .menu { background: var(--ground); }
  body > .appsw-bar { --appsw-bar-pad: calc(var(--space-4) - 2px); } /* the icon over the page's left edge */
  .menu-toggle { display: inline-grid; place-items: center; margin-left: auto; width: 36px; height: 36px; border-radius: var(--radius-md); color: var(--muted); cursor: pointer; }
  .menu-toggle svg { width: 22px; height: 22px; fill: currentColor; }
  .menu-toggle:hover { background: var(--hover); }
  .rail .menu { display: none; }
  .rail .menu-check:checked ~ .menu { display: grid; width: 100%; gap: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--line); }
  .menu-check:focus-visible ~ .menu-toggle { outline: 2px solid var(--focus); }
  .rail .nav-title { padding-top: var(--space-2); }
  .rail .who { margin-top: 0; border-top: 0; padding: 0 var(--space-2) var(--space-2); }
  .page { padding: var(--space-4) var(--space-4) var(--space-7); }
  .page-head { align-items: flex-start; flex-direction: column; }
}
@media (min-width: 861px) {
  .rail .menu { display: contents; }
}

/* ---- Touch: a coach's phone ---------------------------------------------------
   Keyed to the pointer, not the width: a narrow desktop window keeps its dense
   rows, and a phone gets fingertip targets wherever it lands. Fields never go
   under 16px, so iOS does not zoom the page when one takes focus. */
@media (pointer: coarse) {
  /* A floor, not a style: it must win over every field's own size, hence !important. */
  input:not([type="checkbox"], [type="radio"], [type="hidden"]), textarea, select { font-size: max(var(--text-input-touch), 1em) !important; }
  input:is([type="checkbox"], [type="radio"]):not(.vh, .edit-toggle) { width: 20px; height: 20px; }
  .icon-btn, .menu-toggle { width: var(--tap); height: var(--tap); }
  .btn, .btn-sm { min-height: var(--tap); }
  .disclose { min-height: var(--tap); }
  /* A crumb is one short word: its link grows to a fingertip without moving the text. */
  .crumb a { display: inline-flex; align-items: center; min-height: var(--tap); }
  .crumb { margin-block: calc((var(--tap) - 18px) / -2) var(--space-1); }
}
