/* AUTO-SYNCED by design/tokens/build_tokens.py — DO NOT EDIT THIS COPY.
   Canonical source: design/components/components.css. Edit there, then
   re-run the generator (asset() in the templates re-versions the link). */

/* ═══════════════════════════════════════════════════════════════════════════
   eduNotes — CANONICAL COMPONENT LIBRARY (Stage 2)
   ───────────────────────────────────────────────────────────────────────────
   Built entirely from the design tokens in static/css/tokens.css (generated
   from design/tokens/tokens.yaml). NO raw colour/spacing/radius literals here —
   everything resolves through var(--token). This file is the source of truth
   for web component styling; Stage 4 swaps it in to replace styles.css per page.

   Codifies docs/design/components.md (§1–13) + DESIGN.md, with the parity-audit fixes
   baked in (§4 modal chrome, page-header accent bar, shared empty state,
   sentence-case modal titles, "·" separators).

   Light + dark both supported via html[data-theme="dark"] (from tokens.css).
   Conventions: classes are .c-<component>; state via .is-<state> or :hover etc.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Reset / base for component contexts ──────────────────────────────────── */
.c-scope, .c-scope *, .c-scope *::before, .c-scope *::after { box-sizing: border-box; }
.c-scope {
	font-family: var(--font-ui);
	color: var(--text-body);
	-webkit-font-smoothing: antialiased;

	/* Control heights — every interactive control snaps to one of these so
	   buttons/inputs sitting next to each other are always the same height. */
	--ctl-h: 36px;        /* standard button + input */
	--ctl-h-sm: 30px;     /* small / toolbar density */
	--ctl-h-lg: 44px;     /* modal footer (tap target) */
}

/* Keyboard focus — one visible ring for every interactive control. Uses
   :focus-visible so it only shows for keyboard users, not mouse clicks.
   Text fields are left out: browsers treat a clicked text field as
   :focus-visible, so they drew the ring for mouse users too, on top of the
   field's own focus border. Each field shows only its own focus style.
   :where() keeps the specificity at 0,2,0, so later `outline: none` rules on
   buttons still win exactly as before. */
.c-scope :focus-visible:where(:not(
	input:not([type="button"], [type="submit"], [type="reset"], [type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="image"]),
	textarea,
	[contenteditable]:not([contenteditable="false"])
)) {
	outline: 2px solid var(--secondary);
	outline-offset: 2px;
	border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   §1 · CARD & PANEL  (three surface levels — level set by nesting, not content)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Top-level card: sits on the page surface → 12px + shadow, never a border. */
.c-card {
	background: var(--surface-card);
	border-radius: var(--radius-lg);          /* 12px */
	box-shadow: var(--shadow-card);
	padding: var(--space-lg) var(--space-xl);  /* 16px 20px */
}

/* Nested card: sits inside another card → 10px + border, never a shadow. */
.c-card-nested {
	background: var(--surface-card);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);          /* 10px */
	padding: var(--space-md) var(--space-lg);
}

/* Row / list item: divider only. Last row drops the border. */
.c-row {
	display: flex;
	align-items: center;
	gap: var(--space-md);
	padding: var(--space-md) var(--space-lg);
	border-bottom: 1px solid var(--border-subtle);
}
.c-row:last-child { border-bottom: 0; }
.c-row:hover { background: var(--surface-hover); }

/* To-do row: checkbox + title + right-aligned meta (due date + subject tag).
   Used on the Dashboard To-Do card and the /todos page. The active/overdue
   states + the subject tag colour are data, set inline. .is-done strikes the
   title. .c-todo-row--clickable adds a hover affordance (the /todos rows open
   the edit modal). */
.c-todo-list { display: flex; flex-direction: column; }
.c-todo-row {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	padding: 7px 0;
	border-bottom: 1px solid var(--border-subtle);
}
.c-todo-row:last-child { border-bottom: 0; }
.c-todo-row--clickable { cursor: pointer; border-radius: 6px; }
.c-todo-row--clickable:hover { background: var(--surface-active); }
/* Title + meta share a flex block between the checkbox and the caret. Wide = one
   row (title grows, meta sits right). The .c-todo-row--stacked modifier (narrow
   frames + the Dashboard panel) makes it a two-row column: title (left) over meta
   (right) — so a long title is never crowded by the due date + subject tag. */
.c-todo-row__main { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-sm); }
.c-todo-row--stacked .c-todo-row__main { flex-direction: column; align-items: stretch; gap: 3px; }
.c-todo-row--stacked .c-todo-row__title { flex: 0 0 auto; }
.c-todo-row--stacked .c-todo-row__meta { align-self: flex-end; }
.c-todo-row__check {
	width: 18px;
	height: 18px;
	flex: 0 0 18px;
	padding: 0;
	border-radius: 50%;
	border: 1.5px solid var(--pale);
	background: transparent;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.12s, border-color 0.12s;
}
.c-todo-row__check.is-checked { background: var(--primary); border-color: var(--primary); }
.c-todo-row__check .c-icon { width: 11px; height: 11px; color: #fff; }
.c-todo-row__title {
	flex: 1;
	min-width: 0;
	font-size: 13px;
	color: var(--text-body);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.c-todo-row.is-done .c-todo-row__title { text-decoration: line-through; color: var(--text-muted); }
.c-todo-row__meta { display: flex; align-items: center; gap: var(--space-sm); flex-shrink: 0; }
/* "has notes" hint + disclosure caret. The selectors are doubled
   (.c-todo-row …) to out-specify the generic `.c-icon { width:1em }` rule that
   sits later in this file — otherwise the SVGs fall back to 1em and the carets
   stop sharing a vertical line. */
.c-todo-row .c-todo-row__notehint { width: 12px; height: 12px; color: var(--text-muted); }
.c-todo-row__due { font-size: 10px; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.c-todo-row__due.is-overdue { color: #EF4444; font-weight: 600; }
/* Disclosure caret — present only when the row is expandable (the /todos page).
   Rotation is owned by the expandable wrapper (.td-todo.is-expanded). */
.c-todo-row .c-todo-row__caret { width: 14px; height: 14px; flex: 0 0 14px; color: var(--text-muted); transition: transform var(--motion-chevron); }
.c-todo-row__tag {
	font-size: 10px;
	font-weight: 600;
	padding: 2px 7px;
	border-radius: var(--radius-pill);
	white-space: nowrap;
}
html[data-theme="dark"] .c-todo-row__due.is-overdue { color: #F87171; }

/* ═══════════════════════════════════════════════════════════════════════════
   §11 · PAGE HEADER  (accent bar + title/subtitle + trailing actions)
   ═══════════════════════════════════════════════════════════════════════════ */
.c-page-header {
	display: flex;
	align-items: flex-start;
	gap: var(--space-md);
	margin-bottom: var(--space-xl);
}
.c-page-header__accent {
	flex: 0 0 auto;
	width: 4px;
	align-self: stretch;
	min-height: 38px;
	border-radius: 2px;
	background: var(--primary);               /* override inline with subject colour */
}
.c-page-header__text { flex: 1 1 auto; min-width: 0; }
.c-page-header__title {
	font-size: 24px;
	font-weight: 700;
	color: var(--text-body);
	letter-spacing: -0.02em;
	line-height: 1.15;
}
.c-page-header__subtitle {
	font-size: var(--fs-small);               /* 14px */
	color: var(--text-muted);
	margin-top: 2px;
}
.c-page-header__actions { display: flex; align-items: center; gap: var(--space-sm); }

/* ── Backlink (item 9, option A) ───────────────────────────────────────────────
   A muted "‹ Parent" link on its own line ABOVE a page header, on any screen
   reached by drilling down. It names where back goes, which the platform back
   chrome cannot do on macOS / iPad / web-desktop — none of which has a system
   back bar, and where the native shell has no navigation history at all.
   Deliberately outside .c-page-header so it never competes with the accent bar
   and survives the ≤720px layouts where the header actions wrap to their own
   row. On phones the platform's own back chrome takes over instead (option C),
   so this is hidden there. */
.c-backlink {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 13px;
	font-weight: 600;
	color: var(--text-muted);
	background: none;
	border: 0;
	padding: 0;
	margin-bottom: 10px;
	cursor: pointer;
	text-decoration: none;
}
.c-backlink:hover { color: var(--primary); text-decoration: none; }
.c-backlink svg { width: 14px; height: 14px; fill: currentColor; }
/* Web-mobile: the .app-topbar carries a back arrow instead (option C).
   …and the divider that separated it from the rest goes with it. Hiding an item
   without its divider leaves a stray 1px rule floating at the left edge of the
   bar with nothing on either side of it, which is what "the UI is everywhere"
   looked like on the whiteboard viewer (Daniel, 2026-09-07). Fixed here rather
   than per page, because every toolbar that opens with a backlink had it — the
   note read page included.

   This hide exists ONLY because the .app-topbar is there to carry the back arrow
   instead, so it fires on exactly the topbar's own two conditions (base.html owns
   that CSS and explains it): TIER — a consumption-tier device at any width — OR
   WIDTH ≤720px, which is what puts a narrow desktop window into the compact shell.
   Both copies must stay in sync with the shell block in base.html. */
html[data-tier="consumption"] .c-backlink { display: none; }
html[data-tier="consumption"] .c-toolbar .c-backlink + .c-tb-divider { display: none; }
@media (max-width: 720px) {
	.c-backlink { display: none; }
	.c-toolbar .c-backlink + .c-tb-divider { display: none; }
}
/* Inside a toolbar the link is one item on a fixed-height row, not a block above a header,
   so the stacking margin has to go — it pushes the link off the toolbar's centre line. The
   SwiftUI CBackLink hit exactly this and solved it the same way (see its comment). */
.c-toolbar .c-backlink { margin-bottom: 0; }

/* Generic h1/h2 (analytical, blue) — reserve --text-heading for true headings. */
.c-h1 { font-size: var(--fs-h1); font-weight: 600; color: var(--text-heading); letter-spacing: -0.02em; }
.c-h2 { font-size: var(--fs-h2); font-weight: 600; color: var(--text-heading); letter-spacing: -0.01em; }

/* ═══════════════════════════════════════════════════════════════════════════
   §3 · BUTTONS  (primary / ghost / danger / small)
   ═══════════════════════════════════════════════════════════════════════════ */
.c-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	height: var(--ctl-h);                     /* fixed height → uniform with peers */
	padding: 0 1rem;
	font-family: var(--font-ui);
	font-size: var(--fs-small);               /* 14px */
	font-weight: 500;
	line-height: 1;
	border-radius: var(--radius-sm);          /* 8px */
	border: 1.5px solid transparent;          /* keeps bordered + fill variants the same box */
	cursor: pointer;
	transition: background var(--motion-fast), color var(--motion-fast), opacity var(--motion-fast);
	white-space: nowrap;
}
.c-btn-sm { height: var(--ctl-h-sm); padding: 0 0.85rem; font-size: 0.8rem; }

/* Primary — filled. Fill STAYS --primary in dark mode (key indicator). */
.c-btn-primary { background: var(--primary); color: #fff; }
.c-btn-primary:hover { background: var(--secondary); }

/* Ghost — outline that fills on hover. Border+text swap to secondary in dark. */
.c-btn-ghost { background: transparent; color: var(--dusty); border-color: transparent; }
.c-btn-ghost:hover { background: var(--surface-hover); color: var(--primary); }

/* Study-action ghost (History / Flashcards / Written Recall) — peer actions,
   identical styling, primary border. Swaps to secondary in dark (accent swap). */
.c-btn-study {
	background: transparent;
	color: var(--primary);
	border: 1.5px solid var(--primary);
	border-radius: var(--radius-sm);
	padding: 0 14px;                          /* height comes from .c-btn → matches primary */
	font-size: 12.5px;
	font-weight: 600;
}
.c-btn-study:hover { background: var(--primary); color: #fff; }

/* Danger — filled. */
.c-btn-danger { background: var(--plum); color: #fff; }
.c-btn-danger:hover { opacity: 0.85; }

/* Danger ghost — a transparent destructive ROW action (Delete in a list) that fills
   on hover, the danger sibling of .c-btn-ghost. The filled .c-btn-danger is reserved
   for the CONFIRM step; the row action only signals danger, it doesn't commit it. */
.c-btn-danger-ghost { background: transparent; color: var(--plum); border-color: transparent; }
.c-btn-danger-ghost:hover { background: rgba(148,40,90,0.10); color: var(--plum); }

.c-btn:disabled, .c-btn.is-disabled { opacity: 0.4; cursor: default; pointer-events: none; }

/* Working — a long action is running (whiteboard export, 2026-10-07). The
   notes-print ring (mockups/notes-print `.np-dot`) before the label, in
   currentColor so it follows the button's text in both themes. The button
   KEEPS its fill (grey reads as frozen) but ignores clicks. Markup:
   <button class="c-btn c-btn-primary is-working"><span class="c-btn__spinner"
   aria-hidden="true"></span>Exporting…</button>. In a .c-tb-btn the ring
   replaces the icon at the icon's size. Reduced motion → it pulses instead. */
.c-btn.is-working { gap: 8px; cursor: default; pointer-events: none; }
.c-btn__spinner {
	flex: 0 0 auto; box-sizing: border-box; width: 12px; height: 12px; border-radius: 50%;
	border: 2px solid color-mix(in srgb, currentColor 45%, transparent); border-top-color: currentColor;
	animation: c-spin 0.8s linear infinite;
}
.c-tb-btn.is-working, .c-tb-btn.is-working:disabled { opacity: 1; cursor: default; pointer-events: none; }
.c-tb-btn.is-working > svg { display: none; }
.c-tb-btn > .c-btn__spinner { width: 1em; height: 1em; }
@keyframes c-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
	.c-btn__spinner { animation: c-pulse 1.5s ease-in-out infinite; }
}

html[data-theme="dark"] .c-btn-ghost { color: #5B8FC4; }
html[data-theme="dark"] .c-btn-ghost:hover { background: rgba(255,255,255,0.08); color: var(--dusty); }
html[data-theme="dark"] .c-btn-danger-ghost { color: #E06A94; }
html[data-theme="dark"] .c-btn-danger-ghost:hover { background: rgba(224,106,148,0.16); color: #E06A94; }
html[data-theme="dark"] .c-btn-study { color: var(--secondary); border-color: var(--secondary); }
html[data-theme="dark"] .c-btn-study:hover { background: var(--secondary); color: var(--text-body); }

/* ═══════════════════════════════════════════════════════════════════════════
   INPUTS & FIELDS  (general form controls; modal-specific variants in §4)
   ═══════════════════════════════════════════════════════════════════════════ */
.c-field { display: flex; flex-direction: column; gap: 6px; }
.c-label { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.c-input, .c-select, .c-textarea {
	font-family: var(--font-ui);
	font-size: var(--fs-small);
	color: var(--text-body);
	background: var(--surface-card);
	border: 1px solid var(--border-normal);
	border-radius: var(--radius-sm);
	padding: 0.5rem 0.7rem;
	width: 100%;
}
.c-input, .c-select { height: var(--ctl-h); padding: 0 0.7rem; }   /* align with buttons */
.c-textarea { resize: vertical; min-height: 80px; }
.c-input:focus, .c-select:focus, .c-textarea:focus {
	outline: none;
	border-color: var(--secondary);
	box-shadow: 0 0 0 2px rgba(0,71,171,0.1);
}
.c-input::placeholder, .c-textarea::placeholder { color: var(--text-muted); }
html[data-theme="dark"] .c-input, html[data-theme="dark"] .c-select, html[data-theme="dark"] .c-textarea {
	background: var(--surface-page);
}

/* Password field — a .c-input with an inline show/hide eye toggle. Promoted from
   the live auth pages (wave 12): a reusable widget, not an auth-only concern (any
   future password/secret field reuses it). The input reserves right padding for the
   button; the toggle swaps the #i-eye / #i-eye-off sprite icon (set class="c-icon"
   on the <use>'s <svg> so the fill applies — the recurring sprite gotcha). */
.c-pw-field { position: relative; }
.c-pw-field .c-input { padding-right: 2.4rem; }
.c-pw-field__toggle {
	position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
	display: flex; align-items: center; justify-content: center;
	width: 28px; height: 28px;
	background: none; border: 0; cursor: pointer;
	color: var(--text-muted); border-radius: var(--radius-sm);
	transition: color 0.1s, background 0.1s;
}
.c-pw-field__toggle:hover { color: var(--primary); background: var(--surface-hover); }
.c-pw-field__toggle svg { width: 16px; height: 16px; }
html[data-theme="dark"] .c-pw-field__toggle:hover { color: var(--text-body); background: rgba(255,255,255,0.08); }

/* Search field (sidebar / toolbar) */
.c-search {
	display: flex; align-items: center; gap: 8px;
	height: 36px; padding: 0 10px;
	background: var(--surface-card);
	border: 1px solid var(--border-normal);
	border-radius: 10px;
}
.c-search input { border: 0; background: transparent; outline: none; font-size: 13px; color: var(--text-body); flex: 1; }
.c-search svg, .c-search .c-search__icon { color: var(--text-muted); width: 14px; height: 14px; }
html[data-theme="dark"] .c-search { background: var(--surface-page); border-color: var(--border-subtle); }
/* Focus shows on the box, not the bare input inside it */
.c-search:focus-within, html[data-theme="dark"] .c-search:focus-within { border-color: var(--secondary); }

/* Custom select — replaces the native <select> everywhere (matches the app's
   custom-select: a styled trigger + a cs-panel-style options list). */
.c-dropdown { position: relative; display: inline-block; }
.c-dropdown__trigger {
	display: inline-flex; align-items: center; justify-content: space-between; gap: 8px;
	height: var(--ctl-h); padding: 0 0.7rem; min-width: 150px; width: 100%;
	background: var(--surface-card); border: 1px solid var(--border-normal);
	border-radius: var(--radius-sm); font-size: var(--fs-small); color: var(--text-body); cursor: pointer;
}
.c-dropdown__trigger:focus, .c-dropdown.is-open .c-dropdown__trigger {
	outline: none; border-color: var(--secondary); box-shadow: 0 0 0 2px rgba(0,71,171,0.1);
}
.c-dropdown__chevron { color: var(--text-muted); font-size: 10px; }
.c-dropdown__panel {
	position: absolute; top: calc(100% + 4px); left: 0; min-width: 100%;
	background: var(--surface-card); border: 1px solid var(--border-normal); border-radius: 6px;
	box-shadow: 0 4px 14px rgba(0,0,0,0.12); padding: 0.25rem 0; max-height: 280px; overflow-y: auto; z-index: 50;
}
.c-dropdown__item { padding: 0.3rem 0.75rem; font-size: 0.85rem; cursor: pointer; color: var(--text-body); }
.c-dropdown__item:hover, .c-dropdown__item.is-active { background: var(--ice); color: var(--primary); }
html[data-theme="dark"] .c-dropdown__trigger { background: var(--surface-page); }
html[data-theme="dark"] .c-dropdown__panel { background: var(--surface-card); border-color: var(--border-subtle); }
html[data-theme="dark"] .c-dropdown__item:hover, html[data-theme="dark"] .c-dropdown__item.is-active { background: var(--surface-active); color: var(--secondary); }

/* Shared icon sizing (inline SVG via <use>) */
.c-icon { width: 1em; height: 1em; display: inline-block; fill: currentColor; flex: 0 0 auto; vertical-align: -0.125em; }

/* ═══════════════════════════════════════════════════════════════════════════
   §4 · MODAL  (the one custom modal — same design on web + all native platforms)
   ═══════════════════════════════════════════════════════════════════════════ */
.c-modal-overlay {
	position: fixed; inset: 0; z-index: 1000;   /* covers the viewport in-app; gallery demos override to absolute */
	background: rgba(0,0,0,0.35);
	display: flex; align-items: center; justify-content: center;
	padding: var(--space-xl);
}
.c-modal {
	background: var(--surface-card);
	border-radius: var(--radius-modal);       /* 20px */
	box-shadow: 0 8px 40px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
	width: 520px; max-width: 100%;
	max-height: 100%;                         /* 100% of the overlay's content box = viewport - 2 x --space-xl */
	display: flex; flex-direction: column;
	overflow: hidden;
}
.c-modal--simple { width: 360px; }
.c-modal--medium { width: 520px; }
.c-modal--wide   { width: 680px; }

.c-modal__header {
	display: flex; align-items: center;
	flex: 0 0 auto;                           /* pinned: never squashed by a tall body */
	padding: var(--space-lg) var(--space-xl) var(--space-md);
}
.c-modal__header-spacer { width: 28px; flex: 0 0 28px; }
.c-modal__title { flex: 1; text-align: center; font-size: 17px; font-weight: 600; color: var(--text-body); }
.c-modal__close {
	width: 28px; height: 28px; flex: 0 0 28px;
	border: 0; border-radius: 50%;
	background: var(--fill-input); color: var(--text-muted);
	cursor: pointer; display: flex; align-items: center; justify-content: center;
	font-size: 15px;
}
.c-modal__close:hover { color: var(--text-body); }
html[data-theme="dark"] .c-modal__close { background: var(--border-subtle); }

/* The body is the only part that scrolls. min-height:0 is the load-bearing line:
   a flex child's default min-height:auto refuses to shrink below its content, so
   overflow-y alone never reaches a scroll threshold. */
.c-modal__body {
	flex: 1 1 auto; min-height: 0;
	padding: var(--space-lg) var(--space-xl) var(--space-xs); overflow-y: auto;
}
.c-modal__footer {
	display: flex; flex-direction: column; gap: var(--space-sm);
	flex: 0 0 auto;                           /* pinned: the primary action is always reachable */
	padding: var(--space-sm) var(--space-xl) var(--space-xl);
}
/* Set by modal.js only while the body actually overflows, so "there is more below"
   is visible rather than inferred. */
.c-modal--scrolling .c-modal__header { border-bottom: 1px solid var(--border-subtle); }
.c-modal--scrolling .c-modal__footer { border-top: 1px solid var(--border-subtle); }
.c-modal__footer .c-btn { width: 100%; }
/* Footer primary uses 12px radius + 15px per §4 */
.c-modal__footer .c-btn-primary,
.c-modal__footer .c-btn-danger,
.c-modal__footer .c-btn-cancel { height: var(--ctl-h-lg); padding: 0 1rem; border-radius: var(--radius-lg); font-size: 15px; font-weight: 600; }
/* A SECONDARY footer action (notes print: Save PDF… / Share PDF beside Print) –
   the bordered study button, at its footer peers' size. */
.c-modal__footer .c-btn-study { height: var(--ctl-h-lg); padding: 0 1rem; border-radius: var(--radius-lg); font-size: 15px; font-weight: 600; }
/* One muted line under a picker saying what the choice will do (notes print's
   range summary; the whiteboard page picker's note does the same job). */
.c-picker-note { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-top: 10px; }
.c-picker-note strong { color: var(--text-body); font-weight: 600; }
.c-btn-cancel { background: var(--fill-input); color: var(--text-body); border: 0; cursor: pointer; }
.c-btn-cancel:hover { filter: brightness(0.97); }
html[data-theme="dark"] .c-btn-cancel { background: var(--border-subtle); }

/* Modal field (label above, filled rounded input) */
.c-modal-field { margin-bottom: var(--space-lg); }
.c-modal-field__label { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.c-modal-field__input {
	width: 100%; font-size: 15px; font-family: var(--font-ui);
	background: var(--fill-input); border: 0; border-radius: var(--radius-md);
	padding: 0.55rem 0.7rem; color: var(--text-body);
}
.c-modal-field__input:focus { outline: none; box-shadow: 0 0 0 2px rgba(0,71,171,0.15); }
html[data-theme="dark"] .c-modal-field__input { background: var(--surface-page); }

/* ── Confirm-delete (type-the-target-to-confirm danger block) ───────────────
   Shared: the Admin user-detail modal (inline, button inside) + the Account
   delete modal (in a .c-modal body, button in the footer). Just a prompt line +
   a .c-input; the danger confirm button is placed by the consumer. */
.c-confirm-delete { display: flex; flex-direction: column; gap: 8px; }
.c-confirm-delete__prompt { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.c-confirm-delete__prompt strong { color: var(--text-body); }
.c-confirm-delete .c-btn { align-self: flex-start; }   /* inline-button consumers (admin) */

/* Inline mutation-failure line (item 4, F5/F6).
   ~25 native CRUD calls and every web fetch(...).ok branch used to swallow their error, so a
   failed Save / Rename / Delete looked exactly like a successful one. This is the line that
   reports it, in the modal that caused it.
   Same treatment as account.html's .ac-status--err: plum in BOTH themes (the web gives that
   one no dark override either), so it needs no dark.css counterpart. Mirrors CInlineError
   in the SwiftUI library. */
.c-inline-error {
	font-size: 13px; font-weight: 500;
	color: var(--plum);
	line-height: 1.5;
	width: 100%;
}

/* Step indicator (multi-step modals) */
.c-steps { display: flex; align-items: center; justify-content: center; gap: 0; margin-bottom: var(--space-lg); }
.c-step { display: flex; align-items: center; gap: 8px; }
.c-step__dot {
	width: 24px; height: 24px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	font-size: 12px; font-weight: 600;
	background: var(--border-subtle); color: var(--text-muted);
}
.c-step.is-active .c-step__dot { background: var(--primary); color: #fff; }
.c-step.is-done .c-step__dot { background: var(--primary); color: #fff; }
.c-step__label { font-size: 12px; color: var(--text-muted); }
.c-step.is-active .c-step__label { color: var(--text-body); font-weight: 600; }
.c-step__line { width: 36px; height: 1.5px; background: var(--border-subtle); margin: 0 8px; }

/* Segmented pill control (event-type selector) */
.c-segment { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.c-segment__btn {
	font-size: 13px; font-weight: 500;
	padding: 6px 14px; border-radius: var(--radius-pill);
	background: transparent; color: var(--text-muted);
	border: 1.5px solid var(--border-normal); cursor: pointer;
}
.c-segment__btn.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }
/* Notes print (2026-09-27): a choice that cannot apply here (a heading range for
   a note with no headings) stays visible but inert, with a line saying why. */
.c-segment__btn:disabled { opacity: 0.4; cursor: default; }

/* ═══════════════════════════════════════════════════════════════════════════
   §2 · TWO-LEVEL ACCORDION  (subject → folder/series → rows)
   ═══════════════════════════════════════════════════════════════════════════ */
.c-accordion { background: var(--surface-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: hidden; }
.c-accordion__head {
	display: flex; align-items: center; gap: var(--space-md);
	padding: 14px 16px; cursor: pointer;
}
.c-accordion__dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 12px; background: var(--primary); }
.c-accordion__name { font-weight: 700; font-size: var(--fs-small); flex: 1; }
.c-accordion__meta { font-size: var(--fs-meta); color: var(--text-muted); }
.c-accordion__chevron { color: var(--text-muted); transition: transform var(--motion-chevron); }
/* The OWN head's chevron only — a descendant match rotated every nested row's
   chevron too, so nested chevrons never moved (exam-prep S1 QA, 2026-09-12). */
.c-accordion.is-open > .c-accordion__head > .c-accordion__chevron { transform: rotate(90deg); }
.c-accordion__nested.is-open > .c-accordion__nested-head > .c-accordion__chevron { transform: rotate(90deg); }

.c-accordion__nested {
	margin: 0 16px 14px;
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);
	overflow: hidden;
}
.c-accordion__nested-head {
	display: flex; align-items: center; gap: 10px;
	padding: 12px 14px; cursor: pointer;
}
.c-accordion__nested-head .c-accordion__dot { width: 10px; height: 10px; flex-basis: 10px; }
.c-accordion__items { border-top: 1px solid var(--border-subtle); }
.c-accordion__item { display: flex; align-items: center; gap: var(--space-md); padding: 0 16px; height: 50px; border-bottom: 1px solid var(--border-subtle); }
.c-accordion__item:last-child { border-bottom: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   §12 · PAGE CONTENT CARD  (one non-collapsible grouping surface + toolbar)
   ═══════════════════════════════════════════════════════════════════════════ */
.c-content-card { background: var(--surface-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: hidden; }
.c-content-card__toolbar {
	display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
	padding: 10px 12px;
	border-bottom: 1px solid var(--border-subtle);
}
.c-content-card__body { padding: 10px 12px 12px; }

/* ═══════════════════════════════════════════════════════════════════════════
   §13 · STAT STRIP  (dashboard — 4 equal cards)
   ═══════════════════════════════════════════════════════════════════════════ */
.c-stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-md); }
/* Compact override — driven explicitly by narrow mockup frames (iOS / web-mobile),
   where CSS media queries can't see the simulated device width. Real app still
   gets the @720px media-query collapse below. */
.c-stat-strip--2col { grid-template-columns: repeat(2, 1fr); }
.c-stat-card {
	display: flex; align-items: center; gap: var(--space-md);
	background: var(--surface-card); border-radius: var(--radius-lg);
	box-shadow: var(--shadow-card); padding: 14px 16px;
}
.c-stat-card__icon {
	width: 36px; height: 36px; flex: 0 0 36px;
	border-radius: var(--radius-sm);
	display: flex; align-items: center; justify-content: center;
	color: var(--secondary);
	background: var(--ice);                    /* flat grey #383838 in dark — below */
}
.c-stat-card__value { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; color: var(--text-body); line-height: 1; }
.c-stat-card__label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-top: 3px; }
/* Plain variant — no icon, compact value-over-label (Account stats strip; any
   place wanting a bare label/value stat). --sm value for text values (dates). */
.c-stat-card--plain { padding: 14px 16px; }
.c-stat-card__value--sm { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
html[data-theme="dark"] .c-stat-card__icon { background: #383838; }     /* not a darkened ice */
@media (max-width: 720px) { .c-stat-strip { grid-template-columns: repeat(2, 1fr); } }

/* ═══════════════════════════════════════════════════════════════════════════
   §7 · SECTION LABEL
   ═══════════════════════════════════════════════════════════════════════════ */
.c-section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: var(--space-sm); }
.c-section-label--muted { color: var(--text-muted); }     /* grouping: UNFILED, PAPERS */
.c-section-label--blue  { color: var(--primary); }       /* analytical: TOPIC BREAKDOWN — primary for AA at small size */
html[data-theme="dark"] .c-section-label--blue { color: var(--secondary); }   /* --primary is 1.7:1 on a dark card; the usual primary→secondary swap */

/* ═══════════════════════════════════════════════════════════════════════════
   §5 · PROXIMITY BAR
   ═══════════════════════════════════════════════════════════════════════════ */
.c-proximity { position: relative; width: 100%; height: 6px; border-radius: 3px; background: var(--border-subtle); overflow: hidden; }
.c-proximity__fill { height: 100%; border-radius: 3px; background: var(--secondary); }  /* grade colour set inline for scores */
/* Grade-boundary ticks: thin verticals at boundary %, positioned inline via left. */
.c-proximity__tick { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(0,0,0,0.22); }
html[data-theme="dark"] .c-proximity__tick { background: rgba(255,255,255,0.28); }

/* ═══════════════════════════════════════════════════════════════════════════
   §8 · GRADE CHIP  + §9 COUNT BADGE  + subject dots
   Grade colours mirror tokens.yaml `grades` / GradeHelpers.swift. Dark mode:
   bar colour as text on bar-at-22%. We expose per-grade vars to keep it tokenised.
   ═══════════════════════════════════════════════════════════════════════════ */
.c-grade {
	--g-bg: #E5E7EB; --g-text: #374151; --g-bar: #9CA3AF;   /* U/Fail default */
	display: inline-flex; align-items: center; justify-content: center;
	font-weight: 700; background: var(--g-bg); color: var(--g-text);
}
.c-grade--square { width: 30px; height: 30px; border-radius: var(--radius-sm); font-size: 13px; }
.c-grade--pill { border-radius: var(--radius-pill); padding: 3px 10px; font-size: 12px; }

/* Grade palette lives on the bare .g-* classes (not compound .c-grade.g-*) so
   other grade-coloured viz — topic-breakdown bar fills, score-trend dots — can
   reuse the same --g-bar token by adding a g-* class. Chips carry BOTH .c-grade
   and .g-X, so this is transparent to them. Single source for grade colour. */
.g-9  { --g-bg:#BBF7D0; --g-text:#14532D; --g-bar:#10B981; }
.g-8  { --g-bg:#D9F99D; --g-text:#365314; --g-bar:#84CC16; }
.g-7  { --g-bg:#ECFCCB; --g-text:#3F6212; --g-bar:#A3E635; }
.g-b  { --g-bg:#FEF08A; --g-text:#854D0E; --g-bar:#EAB308; }
.g-6  { --g-bg:#FED7AA; --g-text:#7C2D12; --g-bar:#F97316; }
.g-5  { --g-bg:#FDBA74; --g-text:#92400E; --g-bar:#FB923C; }
.g-4  { --g-bg:#FCA5A5; --g-text:#991B1B; --g-bar:#EF4444; }
.g-low{ --g-bg:#FECACA; --g-text:#991B1B; --g-bar:#F87171; }
.g-u  { --g-bg:#E5E7EB; --g-text:#374151; --g-bar:#9CA3AF; }
/* Dark: use the bar colour as text on bar@22% (set per chip via color-mix). */
html[data-theme="dark"] .c-grade {
	background: color-mix(in srgb, var(--g-bar) 22%, transparent);
	color: var(--g-bar);
}

.c-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-md); }
.c-badge--fc { background: var(--ice); color: var(--primary); }
.c-badge--rq { background: #f3e8ff; color: #6b21a8; }
/* Optional leading icon (CF5; native CBadge(symbol:)): a 12px .c-icon before
   the text, 5px apart. Only a badge that carries one becomes a flex row, so
   every text-only badge is untouched. First use: the editor's exam-plan badge. */
.c-badge:has(> .c-icon) { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.c-badge .c-icon { width: 12px; height: 12px; }
.c-count { font-size: var(--fs-meta); color: var(--text-muted); }

.c-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
/* .c-subject-mark — .c-dot's sibling (item 11): the same "this is which subject"
   slot, filled with the subject's ICON instead of its dot. Takes the subject
   colour inline via `color`, exactly as .c-dot takes it via `background`:
       <span class="c-subject-mark" style="color: #94285A"><svg class="c-icon">…
   Interchangeable with .c-dot by design — a subject with no icon renders the dot
   and the row is otherwise identical, which is what let the icon column ship
   empty with no backfill. Callers set the glyph size (15px tree, 16px rail). */
.c-subject-mark { display: inline-flex; align-items: center; flex: 0 0 auto; }
.c-subject-mark .c-icon { width: 15px; height: 15px; fill: currentColor; }
/* subject palette: set background inline; reference list in the gallery */

/* ═══════════════════════════════════════════════════════════════════════════
   §6 · EMPTY STATE
   ═══════════════════════════════════════════════════════════════════════════ */
.c-empty { text-align: center; padding: 40px 20px; max-width: 320px; margin: 0 auto; }
.c-empty__icon { font-size: 40px; color: var(--pale); line-height: 1; }
.c-empty__title { font-size: 15px; font-weight: 600; color: var(--text-body); margin-top: var(--space-md); }
.c-empty__subtitle { font-size: 13px; color: var(--text-muted); max-width: 260px; margin: 6px auto 0; line-height: 1.5; }
.c-empty .c-btn { margin-top: var(--space-md); }
html[data-theme="dark"] .c-empty__icon { color: #48484A; }       /* pale has no dark variant */
html[data-theme="dark"] .c-empty__title { color: #D1D1D6; }
html[data-theme="dark"] .c-empty__subtitle { color: #636366; }

/* ═══════════════════════════════════════════════════════════════════════════
   §10 · CONTEXT MENU (kebab)
   ═══════════════════════════════════════════════════════════════════════════ */
.c-kebab {
	width: 28px; height: 28px; border: 0; border-radius: 50%;
	background: transparent; color: var(--text-muted); cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center;
}
.c-kebab:hover { background: var(--surface-hover); }
.c-menu {
	background: var(--surface-card);
	border: 1px solid var(--border-subtle);
	border-radius: 6px;
	box-shadow: var(--shadow-elevated);
	padding: 4px 0; min-width: 160px;
}
.c-menu__item { font-size: 13px; padding: 7px 14px; cursor: pointer; color: var(--text-body); }
.c-menu__item:hover { background: var(--surface-hover); }
.c-menu__item--danger { color: var(--plum); }
.c-menu__item--danger:hover { background: #fff0f4; }
html[data-theme="dark"] .c-menu__item--danger:hover { background: rgba(148,40,90,0.18); }

/* ═══════════════════════════════════════════════════════════════════════════
   §14 · SUBJECT TILE  (the /subjects grid item — colour-accented card)
   A top-level card that carries one subject's identity. The subject colour is a
   4px LEFT RULE (echoes .c-page-header__accent on single-subject pages, so the
   same cue means the same thing everywhere). Set it inline:
       style="--tile-accent: #94285A"
   Layout (the grid + per-frame density) lives in the page's page.css.
   ═══════════════════════════════════════════════════════════════════════════ */
.c-subject-tile {
	position: relative;
	display: flex; flex-direction: column;
	min-height: 124px;
	background: var(--surface-card);
	border-radius: var(--radius-lg);                       /* 12px */
	border-left: 4px solid var(--tile-accent, var(--primary));
	box-shadow: var(--shadow-card);
	padding: var(--space-lg) var(--space-xl) var(--space-md);
	cursor: pointer; text-decoration: none; color: inherit;
	transition: box-shadow var(--motion-fast);
}
.c-subject-tile:hover { box-shadow: var(--shadow-elevated); }
/* Optional subject icon (item 11), above the name and in the SAME accent colour
   as the left rule — a second identity channel, not a second colour. Set the
   hue inline alongside --tile-accent:
       <div class="c-subject-tile__icon" style="color: #94285A">
   The icon is optional, so a subject without one renders a .c-dot in this slot
   instead; the fixed height is what keeps a mixed grid from going ragged. */
.c-subject-tile__icon {
	display: flex; align-items: center;
	height: 22px; margin-bottom: 6px;
}
.c-subject-tile__icon .c-icon { fill: currentColor; }
.c-subject-tile__name {
	font-size: 16px; font-weight: 600; color: var(--text-body);
	line-height: 1.3; padding-right: 26px;                 /* clear the kebab */
}
.c-subject-tile__meta { font-size: var(--fs-meta); color: var(--text-muted); margin-top: 3px; }
.c-subject-tile__actions {
	display: flex; gap: var(--space-sm);
	margin-top: auto; padding-top: var(--space-md);        /* min-height floors the tile so this pins to the bottom */
	border-top: 1px solid var(--border-subtle);
}
.c-subject-tile__actions .c-btn { flex: 1; }
/* Kebab — hover-revealed on pointer platforms; pinned top-right. Touch
   platforms (iPad) reveal it via a .win-ipad override in the page's page.css. */
.c-subject-tile__kebab {
	position: absolute; top: 8px; right: 8px;
	opacity: 0; transition: opacity var(--motion-fast);
}
.c-subject-tile:hover .c-subject-tile__kebab,
.c-subject-tile__kebab.is-open { opacity: 1; }
/* Kebab dropdown floats from the kebab (the tile is the positioned ancestor). */
.c-subject-tile__menu { position: absolute; top: 38px; right: 8px; z-index: 20; }

/* ═══════════════════════════════════════════════════════════════════════════
   §15 · SWATCH PICKER  (colour chooser — subject modal; reusable)
   A row of colour circles + a "custom" affordance. The selected swatch gets a
   ring in --text-body (dark-mode-safe). Used in the New/Rename Subject modal;
   reusable for any colour-tagged entity (e.g. dashboard subject/exam colours).
   ═══════════════════════════════════════════════════════════════════════════ */
.c-swatch-picker { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; }
.c-swatch-picker__swatch {
	width: 28px; height: 28px; border-radius: 50%;
	border: 3px solid transparent; padding: 0; cursor: pointer; flex: 0 0 auto;
	transition: transform var(--motion-fast), border-color var(--motion-fast);
}
.c-swatch-picker__swatch:hover { transform: scale(1.12); }
.c-swatch-picker__swatch.is-selected { border-color: var(--text-body); transform: scale(1.08); }
/* Custom-colour affordance (live: <input type="color">; mockup: a dashed circle). */
.c-swatch-picker__custom {
	width: 28px; height: 28px; border-radius: 50%;
	border: 2px dashed var(--border-normal); background: transparent;
	padding: 0; cursor: pointer; flex: 0 0 auto;
	display: flex; align-items: center; justify-content: center;
	color: var(--text-muted); font-size: 16px; line-height: 1;
}
.c-swatch-picker__custom:hover { border-color: var(--secondary); color: var(--primary); }

/* ═══════════════════════════════════════════════════════════════════════════
   §15b · ICON PICKER  (subject-icon chooser — subject modal)
   A near-clone of .c-swatch-picker on purpose: same flex row, same
   var(--space-sm) gap, same is-selected ring in --text-body. You already have an
   idiom for "pick one of these" and a second one would be noise. Two deliberate
   departures: a SQUARE tile, because a glyph does not read inside a circle, and
   a leading "None" tile, which the swatch picker has no equivalent of because
   colour is required and the icon is not.

   COLOUR IS SET INLINE, from the swatch chosen above, so every tile previews in
   the subject's actual hue:
       <button class="c-icon-picker__tile" style="color: #94285A">
   That inline `color` BEATS any rule here, so selection is carried by the BORDER
   alone — do not add a `color` to .is-selected expecting it to win.
   ═══════════════════════════════════════════════════════════════════════════ */
.c-icon-picker { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; }
.c-icon-picker__tile {
	width: 32px; height: 32px; border-radius: var(--radius-sm);
	border: 2px solid var(--border-subtle);
	background: var(--surface-card);
	padding: 0; cursor: pointer; flex: 0 0 auto;
	display: flex; align-items: center; justify-content: center;
	color: var(--text-muted);              /* fallback only — inline colour wins */
	transition: transform var(--motion-fast), border-color var(--motion-fast);
}
.c-icon-picker__tile .c-icon { fill: currentColor; }
.c-icon-picker__tile:hover { transform: scale(1.08); border-color: var(--secondary); }
/* Selection reads as a ring, not a colour change — the glyph already carries the
   subject hue, so tinting it further would have nothing left to say. */
.c-icon-picker__tile.is-selected { border-color: var(--text-body); transform: scale(1.04); }
/* "No icon" previews the fallback it actually produces (the colour dot), so the
   choice is literal rather than an abstract "none" marker. */
.c-icon-picker__tile--none { border-style: dashed; }
/* Overflow affordance: the set is 13 and a 360px modal holds six comfortably. */
.c-icon-picker__more {
	height: 32px; padding: 0 10px; border-radius: var(--radius-sm);
	border: 2px dashed var(--border-normal); background: transparent;
	color: var(--text-muted); font-size: 12px; font-weight: 600; cursor: pointer;
	flex: 0 0 auto;
}
.c-icon-picker__more:hover { border-color: var(--secondary); color: var(--primary); }

/* ═══════════════════════════════════════════════════════════════════════════
   TABLE
   ═══════════════════════════════════════════════════════════════════════════ */
.c-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.c-table th {
	text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase;
	letter-spacing: 0.04em; color: var(--text-muted);
	padding: 8px 12px; border-bottom: 1px solid var(--border-subtle);
}
.c-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); color: var(--text-body); }
.c-table tr:last-child td { border-bottom: 0; }
.c-table tbody tr:hover { background: var(--surface-hover); }

/* ═══════════════════════════════════════════════════════════════════════════
   STUDY-SESSION CARDS  + RATING / SELF-MARK BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */
.c-study-card {
	background: var(--surface-card); border-radius: var(--radius-lg);
	box-shadow: var(--shadow-card); padding: var(--space-xxl);
	max-width: 620px; margin: 0 auto; text-align: left;   /* matches the left-aligned card faces in the session mockups */
}
.c-study-card__label { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--primary); }
.c-study-card__label--back { color: #30B060; }
.c-study-card__term { font-family: var(--font-serif); font-size: 1.4rem; font-weight: 700; color: var(--text-body); margin-top: var(--space-md); }
.c-study-card__body { font-family: var(--font-serif); font-size: 1rem; color: var(--text-body); margin-top: var(--space-md); }
html[data-theme="dark"] .c-study-card__label--back { color: #4ADE80; }

.c-rating { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); max-width: 620px; margin: var(--space-lg) auto 0; }
.c-rating__btn { border: 0; border-radius: var(--radius-md); font-size: 0.9rem; font-weight: 600; padding: 0.6rem 0; cursor: pointer; transition: opacity var(--motion-fast); }
.c-rating__btn:hover { opacity: 0.88; }
.c-rating__btn:active { transform: scale(0.97); }
.c-rating__btn--wrong   { background: #FEE2E2; color: #B91C1C; }
.c-rating__btn--partial { background: #FEF9C3; color: #854D0E; }
.c-rating__btn--correct { background: #DCFCE7; color: #166634; }

/* ═══════════════════════════════════════════════════════════════════════════
   PROGRESS TOP-BAR  (study-session header — back · progress · % · Finish)
   ───────────────────────────────────────────────────────────────────────────
   Shared by the flashcard + written-recall sessions. This is CHROME — it
   follows the theme. Stays ONE compact nowrap row on narrow widths: only the
   track flexes; the back link, %, and Finish never wrap or shrink. The flashcard
   session drops the optional __label ("Card x of y") — redundant with the x/y
   nav above the card — but the class is retained for sessions that want it.
   ═══════════════════════════════════════════════════════════════════════════ */
.c-progress-bar {
	flex-shrink: 0;
	display: flex; align-items: center; gap: 14px;
	padding: 9px 20px;
	background: var(--surface-nav);
	border-bottom: 1px solid var(--border-subtle);
	font-size: 0.82rem; color: var(--text-muted);
}
.c-progress-bar__back {
	flex: 0 0 auto; white-space: nowrap;
	font-size: 0.8rem; color: var(--secondary); text-decoration: none;
}
.c-progress-bar__back:hover { color: var(--primary); }
.c-progress-bar__label { flex: 0 0 auto; white-space: nowrap; font-size: 0.78rem; color: var(--text-muted); }
.c-progress-bar__track {
	flex: 1; min-width: 40px; height: 6px;
	background: var(--powder); border-radius: var(--radius-pill); overflow: hidden;
}
.c-progress-bar__fill {
	display: block; height: 100%; width: 0;
	background: var(--primary); border-radius: var(--radius-pill);
	transition: width var(--motion-base);
}
.c-progress-bar__pct { flex: 0 0 auto; white-space: nowrap; font-size: 0.78rem; }
.c-progress-bar__finish {
	flex: 0 0 auto; white-space: nowrap;
	font-size: 0.8rem; font-weight: 600; line-height: 1;
	padding: 6px 14px; border-radius: var(--radius-md);
	border: 1.5px solid var(--border-normal); background: var(--surface-card);
	color: var(--text-muted); cursor: pointer; font-family: inherit;
	transition: border-color var(--motion-fast), color var(--motion-fast);
}
/* Exam-track session (exam prep, E-j): a .c-badge after the back link + the
   plan name/countdown in __label. Nothing else in the bar changes. */
.c-progress-bar__badge { flex: 0 0 auto; margin-left: 4px; }
.c-progress-bar__finish:hover { border-color: var(--secondary); color: var(--primary); }

/* ═══════════════════════════════════════════════════════════════════════════
   ROUGH NOTES  (study-session scratch pad — collapsible, with $…$ KaTeX preview)
   ───────────────────────────────────────────────────────────────────────────
   Shared by the flashcard + written-recall sessions. The panel is an editable
   field, NOT rendered note content — so (Daniel, 2026-05-31) it stays a WHITE
   surface with dark text in BOTH themes, with only a subtle themed border. The
   live page does a debounced $…$ KaTeX preview into __preview (build-time wires
   it; the mockup just shows the markup + a sample rendered preview).
   ═══════════════════════════════════════════════════════════════════════════ */
.c-rough-notes {
	width: 100%;
	background: #fff;
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-card);
	overflow: hidden;
}
html[data-theme="dark"] .c-rough-notes { background: #fff; border-color: #3A3A3C; box-shadow: none; }
.c-rough-notes__head {
	display: flex; align-items: center; justify-content: space-between;
	padding: 8px 10px 8px 14px;
	border-bottom: 1px solid var(--border-subtle);
}
html[data-theme="dark"] .c-rough-notes__head { border-bottom-color: #d0d0d5; }
.c-rough-notes__label {
	font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
	letter-spacing: 0.06em; color: #6B6B70;
}
.c-rough-notes__textarea {
	display: block; width: 100%; box-sizing: border-box;
	min-height: 104px; padding: 12px 14px;
	border: 0; outline: none; resize: vertical;
	font-family: inherit; font-size: 0.9rem; line-height: 1.5;
	color: #000; background: #fff;
}
.c-rough-notes__textarea::placeholder { color: #9A9AA0; }
/* The textarea sits flush inside a bordered card; the browser default focus
   ring / box-shadow breaks that seam. Kill any focus highlight (shared with
   written-recall, which reuses this component). */
.c-rough-notes__textarea:focus { outline: none; box-shadow: none; border-color: transparent; }
.c-rough-notes__preview { border-top: 1px solid var(--border-subtle); }
.c-rough-notes__preview-label {
	font-size: 0.65rem; font-weight: 600; text-transform: uppercase;
	letter-spacing: 0.06em; color: #6B6B70; padding: 8px 14px 2px;
}
.c-rough-notes__preview-body {
	font-family: var(--font-serif); font-size: 0.88rem; line-height: 1.6;
	color: #000; padding: 0 14px 10px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ANSWER INPUT  (written-recall — the primary typed-answer surface)
   ───────────────────────────────────────────────────────────────────────────
   The core new surface of the written-recall session: a "YOUR ANSWER" label, a
   textarea, a char count, a live $…$ KaTeX preview, a Submit button and a key
   hint. It is an EDITABLE surface, not rendered note content — so (the
   .c-rough-notes rule, NOT the white-paper exception) it stays a WHITE card with
   dark text in BOTH themes, with only a subtle themed border. Distinct from
   .c-rough-notes: this is the primary working surface and carries submit + hint,
   not a scratch pad. The $…$ preview is wired at build time; the mockup shows the
   markup + a sample rendered preview.
   ═══════════════════════════════════════════════════════════════════════════ */
.c-answer-input {
	width: 100%; box-sizing: border-box;
	background: #fff; border: 1px solid var(--border-subtle);
	border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
	padding: 18px 20px;
}
html[data-theme="dark"] .c-answer-input { background: #fff; border-color: #3A3A3C; box-shadow: none; }
.c-answer-input__label {
	font-size: 9.5px; font-weight: 700; text-transform: uppercase;
	letter-spacing: 0.08em; color: #6B6B70; margin-bottom: 10px;
}
.c-answer-input__textarea {
	display: block; width: 100%; box-sizing: border-box;
	min-height: 168px; padding: 12px 14px;
	border: 1.5px solid #D6DEEC; border-radius: var(--radius-md);
	outline: none; resize: vertical;
	font-family: inherit; font-size: 0.95rem; line-height: 1.65;
	color: #000; background: #fff;
	transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.c-answer-input__textarea::placeholder { color: #9A9AA0; }
.c-answer-input__textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,71,171,0.10); }
.c-answer-input__count { text-align: right; font-size: 0.72rem; color: #9A9AA0; margin-top: 6px; }
.c-answer-input__preview { border-top: 1px solid #E2E5EC; margin-top: 10px; padding-top: 10px; }
.c-answer-input__preview-label {
	font-size: 0.65rem; font-weight: 600; text-transform: uppercase;
	letter-spacing: 0.06em; color: #6B6B70; margin-bottom: 4px;
}
.c-answer-input__preview-body { font-family: var(--font-serif); font-size: 0.92rem; line-height: 1.6; color: #000; }
.c-answer-input__submit {
	display: block; width: 100%; margin-top: 12px;
	padding: 12px; border: none; border-radius: var(--radius-md);
	background: var(--primary); color: #fff;
	font-family: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer;
	transition: background var(--motion-fast);
}
.c-answer-input__submit:hover { background: #0055d4; }
.c-answer-input__submit:disabled { opacity: 0.4; cursor: default; }
.c-answer-input__hint { text-align: center; font-size: 0.68rem; color: #9A9AA0; margin-top: 8px; }

/* Keyboard-shortcut hints are meaningless without a keyboard. A coarse pointer
   with no hover is the closest CSS gets to "touch device" — it is a proxy, not
   real keyboard detection, so an iPad with a Magic Keyboard may hide them too.
   Native uses GameController for the real answer (KeyboardPresence.swift). */
@media (hover: none) and (pointer: coarse) {
	.c-answer-input__hint { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESULT BANNER  (written-recall — the correct / partial / wrong score banner)
   ───────────────────────────────────────────────────────────────────────────
   The full-width score banner at the top of the AI-graded result. NB: named
   `-banner`, NOT `-chip` — `.c-result-chip` already exists as the small inline
   summary/history pill (see the .c-sum-* family below); reusing that name made the
   pill's `radius-pill` + tiny padding override this. Pastel semantic surface (same
   palette as .c-rating); colours read on either theme, so no dark override.
   ═══════════════════════════════════════════════════════════════════════════ */
.c-result-banner {
	display: flex; align-items: center; gap: 14px;
	border-radius: var(--radius-lg);   /* same radius as the other session cards */
	padding: 17px 18px;                /* extra top/bottom breathing room around the text */
}
.c-result-banner__symbol { font-size: 1.4rem; line-height: 1; flex-shrink: 0; }
.c-result-banner__labels { display: flex; flex-direction: column; }
.c-result-banner__type { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; }
.c-result-banner__word { font-size: 1.05rem; font-weight: 700; }
.c-result-banner--correct { background: #DCFCE7; border: 1.5px solid #86EFAC; }
.c-result-banner--partial { background: #FEF9C3; border: 1.5px solid #FDE047; }
.c-result-banner--wrong   { background: #FEE2E2; border: 1.5px solid #FECACA; }
.c-result-banner--correct .c-result-banner__symbol,
.c-result-banner--correct .c-result-banner__type,
.c-result-banner--correct .c-result-banner__word { color: #166534; }
.c-result-banner--partial .c-result-banner__symbol,
.c-result-banner--partial .c-result-banner__type,
.c-result-banner--partial .c-result-banner__word { color: #854D0E; }
.c-result-banner--wrong .c-result-banner__symbol,
.c-result-banner--wrong .c-result-banner__type,
.c-result-banner--wrong .c-result-banner__word { color: #B91C1C; }

/* ═══════════════════════════════════════════════════════════════════════════
   COLLAPSE CARD  (written-recall — collapsible YOUR ANSWER / AI FEEDBACK)
   ───────────────────────────────────────────────────────────────────────────
   An OUTPUT surface (your submitted answer / the AI's prose) → WHITE with dark
   text in BOTH themes, same rule as .c-answer-input. Header toggles .is-open
   (chevron rotates, divider appears). Build-time wires the collapse.
   ═══════════════════════════════════════════════════════════════════════════ */
.c-collapse-card {
	width: 100%; box-sizing: border-box;
	background: #fff; border: 1px solid var(--border-subtle);
	border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: hidden;
}
html[data-theme="dark"] .c-collapse-card { background: #fff; border-color: #3A3A3C; box-shadow: none; }
.c-collapse-card__head {
	display: flex; align-items: center; justify-content: space-between;
	padding: 11px 16px; cursor: pointer; user-select: none;
	border-bottom: 1px solid transparent;
}
.c-collapse-card__head.is-open { border-bottom-color: #E2E5EC; }
.c-collapse-card__title { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #6B6B70; }
.c-collapse-card__chevron { font-size: 0.7rem; color: #9A9AA0; transition: transform var(--motion-chevron); }
.c-collapse-card__head.is-open .c-collapse-card__chevron { transform: rotate(180deg); }
.c-collapse-card__body { padding: 12px 16px; font-family: var(--font-serif); font-size: 0.9rem; line-height: 1.65; color: #000; }

/* ═══════════════════════════════════════════════════════════════════════════
   MARK SCHEME  (written-recall — the model mark points with hit / miss marks)
   ───────────────────────────────────────────────────────────────────────────
   The point bodies are RENDERED NOTE CONTENT (serif + KaTeX) → the card stays
   WHITE paper in BOTH themes (light-in-dark rule). Each point is hit (green),
   miss (red), or neutral (grey — used in the no-AI self-mark path, where hit/miss
   isn't known). Tinted header is chrome-on-white, fixed for both themes.
   ═══════════════════════════════════════════════════════════════════════════ */
.c-mark-scheme {
	width: 100%; box-sizing: border-box;
	background: #fff; border: 1px solid var(--border-subtle);
	border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: hidden;
}
html[data-theme="dark"] .c-mark-scheme { background: #fff; border-color: #3A3A3C; box-shadow: none; }
/* --themed drops the light-in-dark "paper" exception above. The recall SESSION shows
   its mark scheme against white card faces, so the block stays white in both themes
   there; the study-history modal's faces follow the theme, where a white block would
   read as a hole. Same layout, theme-aware surface. */
.c-mark-scheme--themed { background: var(--surface-page); }
html[data-theme="dark"] .c-mark-scheme--themed { background: var(--surface-page); border-color: var(--border-subtle); }
html[data-theme="dark"] .c-mark-scheme--themed .c-mark-scheme__point { color: var(--text-body); }
html[data-theme="dark"] .c-mark-scheme--themed .c-mark-scheme__point--neutral .c-mark-scheme__icon { background: #3A3A3C; color: #B0B0B5; }
.c-mark-scheme__head {
	display: flex; align-items: center; justify-content: space-between;
	padding: 10px 16px; background: #F3F6FC; border-bottom: 1px solid #E2E5EC;
}
.c-mark-scheme__title { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--primary); }
.c-mark-scheme__count { font-size: 0.72rem; color: #6B6B70; }
.c-mark-scheme__body { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.c-mark-scheme__point {
	display: flex; align-items: flex-start; gap: 10px;
	font-family: var(--font-serif); font-size: 0.9rem; line-height: 1.5; color: #000;
}
.c-mark-scheme__point--hit  { color: #166534; }
.c-mark-scheme__point--miss { color: #B91C1C; }
.c-mark-scheme__icon {
	flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	font-size: 0.7rem; font-weight: 700; margin-top: 1px;
}
.c-mark-scheme__point--hit  .c-mark-scheme__icon { background: #DCFCE7; color: #166534; }
.c-mark-scheme__point--miss .c-mark-scheme__icon { background: #FEE2E2; color: #B91C1C; }
.c-mark-scheme__point--neutral .c-mark-scheme__icon { background: #EFEFEF; color: #8E8E93; }

/* ═══════════════════════════════════════════════════════════════════════════
   SKELETON LOADERS
   ═══════════════════════════════════════════════════════════════════════════ */
@keyframes c-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.c-skeleton {
	background: linear-gradient(90deg, #ebebeb 25%, #d8d8d8 37%, #ebebeb 63%);
	background-size: 400% 100%;
	animation: c-shimmer 1.6s ease-in-out infinite;
	border-radius: 4px; height: 12px;
}
.c-skeleton--card { height: 80px; border-radius: var(--radius-md); }
html[data-theme="dark"] .c-skeleton { background: linear-gradient(90deg, #3a3a3c 25%, #48484a 37%, #3a3a3c 63%); background-size: 400% 100%; }

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR + NAV  (248px app shell)
   ═══════════════════════════════════════════════════════════════════════════ */
/* ── Sidebar ────────────────────────────────────────────────────────────────
   Systematised 2026-09-14 (sidebar redesign, Stage 3 locked — see
   design/mockups/sidebar/README.md for the ladder + A1–A15). ONE column ladder
   for the tree — 14 = icons + subject marks · 40 = nav labels, subject names,
   folder names, unfiled notes · 62 = in-folder rows — and ONE hit-target rule:
   every row is one target, --sb-row (36px) for nav / subject / folder rows,
   --sb-row-leaf (32px) for notes / whiteboards / Overview; .c-sidebar--touch
   raises both to 44px (iPad, the ≤720px drawer). The whole subject / folder /
   group row toggles; .c-sidebar__chevron is a state indicator, not a button.
   Type: nav 13/500 → subject 13/600 → folder 13/500 → note 12.5/400. */
.c-sidebar {
	--sb-x1: 14px;
	--sb-x2: 40px;
	--sb-x3: 62px;
	--sb-row: var(--ctl-h, 36px);    /* the sidebar sits OUTSIDE .c-scope in base.html, hence the fallback */
	--sb-row-leaf: 32px;
	--sb-rule: 3px;                  /* the active row's left rule */
	--sb-active: var(--surface-active-card);   /* the active row's fill: --surface-active (#EEF4FF) is 1.0:1 on --surface-nav – invisible (bug wave 2026-10) */
	width: 248px; background: var(--surface-nav);
	border-right: 1px solid #EBEBEB;
	display: flex; flex-direction: column;
	height: 100%; overflow: hidden;
}
.c-sidebar--touch { --sb-row: 44px; --sb-row-leaf: 44px; }

/* Brand row */
.c-sidebar__brand { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 10px; }
.c-sidebar__brand-name { display: flex; align-items: baseline; gap: 0.30em; flex: 1; text-decoration: none;
	font-size: 16px; font-weight: 400; color: var(--primary); letter-spacing: 0; }

/* Brand mark sizing. Ratios come straight from the signed-off lockup: the mark's
   box is 1.143x the wordmark's font-size tall and 0.836x that box wide (its own
   aspect). It inherits `color`, so light and dark need no separate asset. */
.c-brandmark { width: 0.956em; height: 1.143em; display: inline-block; flex: 0 0 auto; }
.c-sidebar__iconbtn { position: relative; width: 26px; height: 26px; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; border-radius: 6px;
	display: inline-flex; align-items: center; justify-content: center; }
.c-sidebar__iconbtn:hover { background: var(--surface-hover); }
.c-sidebar__iconbtn .c-icon { width: 15px; height: 15px; }
.c-sidebar__search { padding: 0 12px 12px; }

/* Nav links — the four destinations in a block of their own; Admin (user-gated)
   reuses .c-nav-link with __admin, pinned above the footer. */
.c-sidebar__nav { display: flex; flex-direction: column; padding: 2px 0 4px; }
.c-nav-link { display: flex; align-items: center; gap: 10px; min-height: var(--sb-row); padding: 0 var(--sb-x1); font-size: 13px; font-weight: 500; color: var(--text-body); cursor: pointer; text-decoration: none; }
.c-nav-link .c-icon { width: 16px; height: 16px; }
.c-nav-link__label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-nav-link:hover { background: var(--surface-hover); }
.c-nav-link.is-active { color: var(--primary); font-weight: 600; background: var(--sb-active, var(--surface-active)); border-left: var(--sb-rule) solid var(--primary); padding-left: calc(var(--sb-x1) - var(--sb-rule)); }
.c-sidebar__admin { margin-top: auto; border-top: 1px solid var(--border-subtle); }

/* Tree */
.c-sidebar__section { padding: 2px 0; overflow-y: auto; flex: 1 1 auto; border-top: 1px solid var(--border-subtle); }
.c-sidebar__subject { display: flex; align-items: center; gap: 10px; min-height: var(--sb-row); padding: 0 10px 0 var(--sb-x1); font-size: 13px; font-weight: 600; color: var(--text-body); cursor: pointer; user-select: none; }
.c-sidebar__subject:hover { background: var(--surface-hover); }
.c-sidebar__subject .c-subject-mark { width: 16px; justify-content: center; }
.c-sidebar__subject .c-subject-mark .c-icon { width: 15px; height: 15px; }
.c-sidebar__subject-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The open note/whiteboard's subject (bug wave 2026-10): the .c-nav-link.is-active
   look, so the parent subject reads as "where you are" in both sidebar states. */
.c-sidebar__subject.is-active { color: var(--primary); background: var(--sb-active, var(--surface-active)); border-left: var(--sb-rule) solid var(--primary); padding-left: calc(var(--sb-x1) - var(--sb-rule)); }
/* Chevron (subject + folder rows): i-chevron-right, points right when collapsed,
   rotates to point down under .is-expanded. */
.c-sidebar__chevron { width: 16px; height: 16px; flex: 0 0 auto; color: var(--text-muted); transform: rotate(0deg); transition: transform 0.18s ease; }
.is-expanded > .c-sidebar__chevron { transform: rotate(90deg); }
/* Folder row (promoted from base.html's .sidebar-folder-row). --group is the
   unfiled-Whiteboards group: the same row, no folder semantics. */
.c-sidebar__folder { display: flex; align-items: center; gap: 8px; min-height: var(--sb-row); padding: 0 10px 0 var(--sb-x2); font-size: 13px; font-weight: 500; color: var(--text-body); cursor: pointer; user-select: none; }
.c-sidebar__folder:hover { background: var(--surface-hover); }
.c-sidebar__folder-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Children container (replaces .sidebar-notes / .sidebar-folder-notes). */
.c-sidebar__children.is-collapsed { display: none; }
/* Note row. --home is the subject's Overview row — the first child of an open
   subject, linking to the subject page — with a 13px icon in the slot a
   whiteboard row uses. */
.c-sidebar__note { display: flex; align-items: center; gap: 7px; min-height: var(--sb-row-leaf); padding: 0 10px 0 var(--sb-x2); font-size: 12.5px; font-weight: 400; color: #555; cursor: pointer; text-decoration: none; }
.c-sidebar__note-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-sidebar__note-icon { width: 13px; height: 13px; flex: 0 0 auto; color: var(--text-muted); }
.c-sidebar__note:hover { background: var(--surface-hover); }
.c-sidebar__note.is-active { color: var(--primary); font-weight: 500; background: var(--sb-active, var(--surface-active)); border-left: var(--sb-rule) solid var(--primary); padding-left: calc(var(--sb-x2) - var(--sb-rule)); }
.c-sidebar__note.is-active .c-sidebar__note-icon { color: var(--primary); }
.c-sidebar__note.in-folder { padding-left: var(--sb-x3); }
.c-sidebar__note.in-folder.is-active { padding-left: calc(var(--sb-x3) - var(--sb-rule)); }

/* Footer */
.c-sidebar__footer { display: flex; align-items: center; gap: 8px; padding: 10px 12px 14px; border-top: 1px solid var(--border-subtle); }
.c-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
/* Account chip (promoted from base.html's .sidebar-account-link): the row is the target. */
.c-sidebar__account { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; min-height: 32px; padding: 2px 4px; margin: -2px -4px; border-radius: 6px; text-decoration: none; }
.c-sidebar__account:hover { background: var(--surface-hover); }
.c-sidebar__user { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.c-sidebar__user-name { font-size: 12.5px; font-weight: 500; color: var(--text-body); }
.c-sidebar__user-email { font-size: 11px; color: #8E8E93; }
.c-sidebar__user-name, .c-sidebar__user-email { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Tooltips name icons only in the collapsed rail (below). */
.c-sidebar .c-tooltip { display: none; }

/* ── Collapsed 52px rail (item 7, now a component state) ────────────────────
   Nav icons, one mark per subject, Admin, avatar and sign-out survive and stay
   clickable, each named by a .c-tooltip. overflow: visible so the tooltips can
   escape; the tree must therefore NOT scroll here (a scroll container on either
   axis clips them — fine for a handful of subjects). Collapse sits above theme. */
.c-sidebar.is-collapsed { width: 52px; overflow: visible; }
.c-sidebar.is-collapsed .c-sidebar__brand-text,
.c-sidebar.is-collapsed .c-sidebar__search,
.c-sidebar.is-collapsed .c-nav-link__label,
.c-sidebar.is-collapsed .c-sidebar__subject-name,
.c-sidebar.is-collapsed .c-sidebar__chevron,
.c-sidebar.is-collapsed .c-sidebar__children,
.c-sidebar.is-collapsed .c-sidebar__user { display: none; }
.c-sidebar.is-collapsed .c-sidebar__brand { flex-direction: column; align-items: center; padding: 10px 0 6px; gap: 4px; }
.c-sidebar.is-collapsed .c-sidebar__brand-name { flex: none; margin-bottom: 4px; }
.c-sidebar.is-collapsed .c-sidebar__collapse { order: 1; }
.c-sidebar.is-collapsed .c-sidebar__theme { order: 2; }
.c-sidebar.is-collapsed .c-nav-link,
.c-sidebar.is-collapsed .c-sidebar__subject { position: relative; justify-content: center; padding: 0; gap: 0; }
.c-sidebar.is-collapsed .c-nav-link.is-active,
.c-sidebar.is-collapsed .c-sidebar__subject.is-active { padding: 0 var(--sb-rule) 0 0; }   /* keeps the icon centred beside the rule */
.c-sidebar.is-collapsed .c-sidebar__subject .c-subject-mark .c-icon { width: 16px; height: 16px; }
.c-sidebar.is-collapsed .c-sidebar__subject .c-dot { width: 10px; height: 10px; }   /* 8px reads as dirt alone */
.c-sidebar.is-collapsed .c-sidebar__section { overflow: visible; flex: 0 0 auto; }
.c-sidebar.is-collapsed .c-sidebar__admin { margin-top: auto; }
.c-sidebar.is-collapsed .c-sidebar__footer { flex-direction: column; align-items: stretch; padding: 6px 0; gap: 2px; }
.c-sidebar.is-collapsed .c-sidebar__account { justify-content: center; flex: none; min-height: 36px; margin: 0; padding: 0; position: relative; }
.c-sidebar.is-collapsed .c-avatar { width: 24px; height: 24px; font-size: 9px; }
.c-sidebar.is-collapsed .c-sidebar__footer .c-sidebar__iconbtn { width: 100%; height: 36px; }
.c-sidebar.is-collapsed .c-tooltip { display: block; }

html[data-theme="dark"] .c-sidebar { background: #252525; border-right-color: #3A3A3C; --sb-active: var(--surface-active); }
html[data-theme="dark"] .c-sidebar__note { color: #8E8E93; }
html[data-theme="dark"] .c-sidebar__note.is-active { color: var(--secondary); background: var(--surface-active); border-left-color: var(--primary); }
html[data-theme="dark"] .c-sidebar__note.is-active .c-sidebar__note-icon { color: var(--secondary); }
html[data-theme="dark"] .c-nav-link { color: #D1D1D6; }
html[data-theme="dark"] .c-nav-link.is-active,
html[data-theme="dark"] .c-sidebar__subject.is-active { color: var(--secondary); background: var(--surface-active); border-left-color: var(--primary); }
html[data-theme="dark"] .c-sidebar__user-email { color: #636366; }

/* ── Tooltip ───────────────────────────────────────────────────────────────
   A label that names an icon-only control on hover. Built for the collapsed
   sidebar rail (item 7), where every row is a bare icon, but generic.

   Pure CSS — no JS, no positioning library. Put it INSIDE the control it
   names and give that control `position: relative`; the tooltip sits to its
   right and appears on :hover or :focus-visible.

       <a class="c-nav-link" href="/todos">
           <svg …></svg>
           <span class="c-tooltip">Tasks</span>
       </a>

   `.is-visible` pins it open (for a Gallery still, or a JS-driven case).

   NOTE: an ancestor with `overflow: hidden` will CLIP it — .c-sidebar sets
   exactly that, so .c-sidebar.is-collapsed drops it (see above).
   ───────────────────────────────────────────────────────────────────────── */
.c-tooltip {
	position: absolute;
	left: calc(100% + 8px);
	top: 50%;
	transform: translateY(-50%) translateX(-4px);
	z-index: 60;

	white-space: nowrap;
	font-family: var(--font-ui);
	font-size: 12px;
	font-weight: 500;
	line-height: 1;
	padding: 6px 9px;
	border-radius: 6px;

	color: #fff;
	background: #2C2C2E;
	box-shadow: var(--shadow-elevated);

	opacity: 0;
	pointer-events: none;                 /* never eats the hover it responds to */
	transition: opacity 0.12s ease, transform 0.12s ease;
}
/* Arrow pointing back at the control. */
.c-tooltip::before {
	content: "";
	position: absolute;
	right: 100%;
	top: 50%;
	transform: translateY(-50%);
	border: 4px solid transparent;
	border-right-color: #2C2C2E;
}
:hover > .c-tooltip,
:focus-visible > .c-tooltip,
.c-tooltip.is-visible {
	opacity: 1;
	transform: translateY(-50%) translateX(0);
}
/* Inverted in dark, the way a system tooltip is. */
html[data-theme="dark"] .c-tooltip { color: #1C1C1E; background: #E5E5EA; }
html[data-theme="dark"] .c-tooltip::before { border-right-color: #E5E5EA; }

/* ── App top-bar (narrow layouts) ──────────────────────────────────────────
   Compact 52px top bar shown below the mobile breakpoint, where the 248px
   .c-sidebar is hidden and replaced by a hamburger that slides it in as a
   drawer. Promoted from design/mockups/shell.css; shared shell chrome →
   follows the theme via tokens. The page shell (base.html) owns the @media
   rule that toggles its display + turns .c-sidebar into the drawer. */
.app-topbar {
	flex: 0 0 52px;
	display: flex; align-items: center; gap: var(--space-md);
	height: 52px; padding: 0 var(--space-lg);
	background: var(--surface-nav);
	border-bottom: 1px solid var(--border-subtle);
}
.app-topbar__menu {
	width: 30px; height: 30px; flex: 0 0 30px;
	display: flex; align-items: center; justify-content: center;
	border: 0; background: transparent; border-radius: 6px;
	color: var(--text-muted); cursor: pointer;
}
.app-topbar__menu:hover { background: var(--surface-hover); }
.app-topbar__menu svg { width: 18px; height: 18px; fill: currentColor; }
.app-topbar__brand { display: inline-flex; align-items: baseline; gap: 0.30em;
	font-size: 16px; font-weight: 400; color: var(--primary); letter-spacing: 0; }

/* Drill-down pages swap the wordmark for a back link (item 9, option C). Sits in
   the brand's slot so the hamburger — and therefore the drawer — is untouched. */
.app-topbar__back {
	display: inline-flex; align-items: center; gap: 4px;
	font-size: 15px; font-weight: 600; color: var(--primary);
	text-decoration: none; min-width: 0;
}
.app-topbar__back:hover { text-decoration: none; }
.app-topbar__back svg { width: 16px; height: 16px; fill: currentColor; flex: none; }
.app-topbar__back span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-topbar__spacer { flex: 1; }

/* ═══════════════════════════════════════════════════════════════════════════
   EDITOR CHROME — toolbar, pills/chips, autosave, creation banner
   ═══════════════════════════════════════════════════════════════════════════ */
.c-toolbar { display: flex; align-items: center; gap: 4px; height: 40px; padding: 0 10px; background: #FAFAFA; border-bottom: 1px solid #EBEBEB; }
html[data-theme="dark"] .c-toolbar { background: #1F1F1F; border-bottom-color: #3A3A3C; }
.c-tb-btn { display: inline-flex; align-items: center; flex: 0 0 auto; white-space: nowrap; height: var(--ctl-h-sm); font-size: 12.5px; font-weight: 500; color: var(--text-muted); padding: 0 8px; border: 0; background: transparent; border-radius: 5px; cursor: pointer; }
.c-tb-btn:hover { background: var(--ice); color: var(--primary); }
.c-tb-btn:disabled { opacity: 0.3; }
/* Toggle / pressed state — for toolbar buttons that turn something on (e.g. the
   read page's CONTENTS toggle, editor character styles). */
.c-tb-btn.is-active { background: var(--ice); color: var(--primary); }
html[data-theme="dark"] .c-tb-btn.is-active { background: var(--surface-active); color: var(--secondary); }
/* Active state also gets a hover affordance (a theme-aware deepen) — matches the
   native CTbBtn; the inactive :hover above already has one. */
.c-tb-btn.is-active:hover { filter: brightness(0.97); }
html[data-theme="dark"] .c-tb-btn.is-active:hover { filter: brightness(1.12); }
/* flex-shrink: 0 – an empty 1px item has a min-content width of 0, so in a full bar
   (Safari's wider text overflows sooner) every divider used to shrink to nothing. */
.c-tb-divider { flex-shrink: 0; width: 1px; height: 18px; background: var(--pale); margin: 0 4px; }

/* Button text that may be dropped when the toolbar runs out of room — the icon
   and the title tooltip carry the meaning on their own. __label is an all-or-
   nothing drop (icon buttons); __label-long / __label-short swap a full label for
   an abbreviation on buttons that have no icon to fall back on. */
.c-tb-btn__label { display: inline; }
.c-tb-btn__label-long { display: inline; }
.c-tb-btn__label-short { display: none; }

/* The right-hand action group that folds away on a narrow toolbar. A class rather
   than a page id, so the collapse rule below stays in the component library
   instead of reaching into one page's markup. */
.c-toolbar__actions { display: flex; align-items: center; gap: 6px; }

/* Overflow owner — holds the actions that fold away on a narrow toolbar. Uses the
   documented .c-kebab trigger + .c-menu panel; nothing new is introduced. */
.c-toolbar__overflow { position: relative; display: none; }
.c-toolbar__overflow .c-menu { position: absolute; top: calc(100% + 4px); right: 0; z-index: 60; }
.c-toolbar__overflow .c-menu[hidden] { display: none; }

/* A toolbar button that opens a menu beneath itself (Study tools, R10). Same
   anchoring as the overflow kebab above, but left-aligned: this one sits in the
   middle of the bar, not at its right edge. */
.c-toolbar__menu { position: relative; display: inline-flex; }
.c-toolbar__menu .c-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 60; min-width: 190px; }
.c-toolbar__menu .c-menu[hidden] { display: none; }
/* The two counts on "Manage existing…" — the same numbers the creation-mode
   pills show, so the menu can never disagree with the rows. */
.c-menu__item-count { float: right; margin-left: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ── Narrow toolbar ───────────────────────────────────────────────────────────
   .c-toolbar is a no-wrap flex row whose children are all flex:0 0 auto, and it
   had no overflow handling at all: at a 760px window the last pill's right edge
   sat at x=1131 against a toolbar ending at x=760 — 371px past it, with no scroll
   and no way to reach it (Daniel, 2026-08-31).

   THE BREAKPOINT IS 1150px, not the 900px note.css uses for the split panes. The
   media query sees the WINDOW, but the toolbar only gets what the sidebar leaves
   it — 248px less. Measured: the full toolbar needs ~900px of content, so at a
   901px window it still overflowed by 230px and at 1100px by 31px. 900 + 248 is
   where it actually clears, so 1150 with slack for a longer subject name.

   The consequence is deliberate: with the sidebar collapsed to its 52px rail the
   pills would fit from about 980px, so between 980 and 1150 they fold away a
   little earlier than they strictly must. Nothing is lost — they are one click
   away in the kebab — and the alternative is a second breakpoint keyed to
   body.sidebar-collapsed duplicating every rule below.

   Folding the pills away is NOT enough on its own: what remains still measured
   587px, and the floor is 461px — the editor redirects to the read view below a
   720px window (desktop-only-guard.js), and the sidebar takes the rest. Hence the
   labels drop too: 380px of content, 79px spare at the floor.

   Nothing is hidden without a way to reach it, and every collapsed control keeps
   its title tooltip. */
@media (max-width: 1150px) {
	.c-toolbar__actions { display: none; }
	.c-toolbar__overflow { display: inline-block; }
	.c-toolbar .c-tb-btn__label { display: none; }
	.c-toolbar .c-tb-btn > svg { margin-right: 0 !important; }
	.c-toolbar .c-tb-btn__label-long { display: none; }
	.c-toolbar .c-tb-btn__label-short { display: inline; }
	.c-toolbar .c-backlink__label { display: none; }
}
/* --pale is a fixed light blue in both themes, so the divider needs a dark override
   to recede into the dark toolbar (matches the .c-toolbar dark border colour). */
html[data-theme="dark"] .c-tb-divider { background: #3A3A3C; }

.c-chip { display: inline-flex; align-items: center; height: var(--ctl-h-sm); font-size: 12px; font-weight: 500; color: #555; background: var(--fill-input); border: 1px solid #DDDDE3; border-radius: 20px; padding: 0 12px; cursor: pointer; }
.c-chip:hover { background: var(--ice); border-color: var(--pale); color: var(--primary); }

.c-pill { display: inline-flex; align-items: center; flex: 0 0 auto; white-space: nowrap; height: var(--ctl-h-sm); font-size: 12.5px; font-weight: 600; color: var(--primary); background: transparent; border: 1.5px solid var(--primary); border-radius: 20px; padding: 0 14px; cursor: pointer; }
.c-pill:hover { background: var(--primary); color: #fff; }
html[data-theme="dark"] .c-pill { color: var(--secondary); border-color: var(--secondary); }
html[data-theme="dark"] .c-pill:hover { background: var(--secondary); color: var(--text-body); }

/* Subject chip: a small subject-coloured pill. Two uses — the /todos subject
   FILTER row (with a colour dot; active = solid subject fill, white text) and
   the Add-task modal subject PICKER (no dot; selected = light subject fill).
   The FILL colour is the subject's own hue → set inline (data, not chrome);
   the component supplies the outline default + the .is-active solid treatment. */
.c-subject-chip {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-family: inherit;
	font-size: 11px;
	font-weight: 600;
	padding: 3px 10px;
	border-radius: var(--radius-pill);
	border: 1.5px solid var(--border-subtle);
	background: transparent;
	color: var(--text-muted);
	cursor: pointer;
	transition: border-color 0.1s, background 0.1s, color 0.1s;
}
.c-subject-chip:hover { border-color: var(--border-normal); color: var(--text-body); }
.c-subject-chip__dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
/* Filter active: solid subject fill (set inline) + white text. */
.c-subject-chip.is-active { color: #fff; border-color: transparent; }

.c-autosave { font-size: 11.5px; font-weight: 500; transition: opacity 0.4s; }
.c-autosave--saving { color: var(--text-muted); }
.c-autosave--saved  { color: #2a9d5c; }
.c-autosave--error  { color: #c0392b; }

.c-creation-banner { display: inline-flex; align-items: center; flex: 0 0 auto; white-space: nowrap; gap: 8px; height: var(--ctl-h-sm); font-size: 12px; font-weight: 500; color: #9A3412; background: #FFF7ED; border: 1px solid #FDBA74; border-radius: 20px; padding: 0 12px; }
.c-creation-banner__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); animation: c-pulse 1.5s ease-in-out infinite; }
@keyframes c-pulse { 50% { opacity: 0.5; } }

/* Dark-mode coverage for chrome that was light-only (would render light-on-dark). */
html[data-theme="dark"] .c-chip { background: var(--surface-page); border-color: var(--border-subtle); color: var(--text-muted); }
html[data-theme="dark"] .c-chip:hover { background: rgba(255,255,255,0.08); border-color: var(--border-normal); color: var(--secondary); }
html[data-theme="dark"] .c-creation-banner { background: rgba(232,110,30,0.16); border-color: rgba(232,110,30,0.45); color: #F0A868; }
html[data-theme="dark"] .c-bulk__btn--danger:hover { background: rgba(148,40,90,0.18); }

/* Bulk action toolbar */
/* MOD-2 + MOD-3 (creation-friction wave), matching design/mockups/creation/round2.css.

   Round 1 proposed flex-wrap so the BUTTONS could wrap. Withdrawn: a toolbar that
   grows a second row of buttons changes the editor's sticky-header height
   mid-gesture and shoves the block list down under the cursor. Buttons overflow
   into one ⋯ menu instead (MOD-3). flex-wrap survives only so the clipboard line
   can take a row of its own — one line, always, at every width. */
.c-bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; row-gap: 6px; padding: 6px 10px; background: var(--surface-editor-left); border-bottom: 1px solid var(--border-subtle); font-size: 0.78rem; }
.c-bulk__count { font-size: 0.8rem; font-weight: 600; color: var(--primary); }
.c-bulk__btn { padding: 3px 9px; border-radius: 5px; background: var(--surface-card); border: 1px solid var(--border-normal); font-size: 0.78rem; cursor: pointer; white-space: nowrap; }
.c-bulk__btn--danger { color: var(--plum); border-color: transparent; }
.c-bulk__btn--danger:hover { background: #fff0f4; }
/* ⌘/ Style (block-web-multiselect, S7 – design/mockups/blocks/page.css .bk-bulk-style):
   the selection's block panel. Primary on light, Secondary on dark. */
.c-bulk__btn--style { border-color: var(--primary); color: var(--primary); }
html[data-theme="dark"] .c-bulk__btn--style { border-color: var(--secondary); color: var(--secondary); background: transparent; }

/* ── MOD-2 · the clipboard status line ──────────────────────────────────────
   It can never become two lines: fixed height, nowrap, and exactly ONE
   shrinkable segment. Round 1's version was 130 characters and wrapped at every
   width it was drawn at. */
.c-bulk__clip {
	flex-basis: 100%;
	display: flex; align-items: center; gap: 5px;
	min-width: 0;                      /* required, or the ellipsis never fires */
	height: 18px;                      /* fixed: the line can never become two */
	font-size: 0.72rem; color: var(--text-muted);
	white-space: nowrap;
}
.c-bulk__clip-icon { flex: 0 0 auto; width: 11px; height: 11px; fill: currentColor; opacity: 0.75; }
.c-bulk__clip-n { flex: 0 0 auto; color: var(--text-body); font-weight: 600; }
/* Only the source title is allowed to shrink, and it truncates with an ellipsis.
   The full name is on the element's title attribute. */
.c-bulk__clip-src {
	flex: 0 1 auto; min-width: 2ch;
	overflow: hidden; text-overflow: ellipsis;
	color: var(--text-body); font-weight: 600;
}
.c-bulk__clip-age { flex: 0 0 auto; }
.c-bulk__clip-clear { flex: 0 0 auto; margin-left: auto; }
/* Narrow: the age goes first (it is the least load-bearing token in the line),
   then the "Clear" label collapses to its ✕. Set by the same ResizeObserver that
   drives MOD-3 — a measured width, never a media query and never the tier. */
.c-bulk--narrow .c-bulk__clip-age,
.c-bulk--narrow .c-bulk__clip-sep-age { display: none; }
.c-bulk--tight .c-bulk__clip-clear-label { display: none; }
/* A stale source (its note was deleted) still pastes: the content travels with
   the copy, not a reference. */
.c-bulk__clip--stale .c-bulk__clip-src { font-weight: 400; font-style: italic; }

/* ── MOD-3 · priority-plus overflow ─────────────────────────────────────────
   Daniel's condition was "proper provisions for still providing the toolbar's
   complete functionality at narrower widths". So nothing is ever dropped and
   nothing is ever disabled: controls that do not fit move, in a fixed priority
   order, into one ⋯ menu that carries their FULL labels. The menu itself is the
   locked .c-menu component — this adds no new popup. */
.c-bulk__btn.is-overflowed { display: none; }
.c-bulk__more {
	position: relative;
	display: inline-flex; align-items: center; gap: 4px;
	padding: 3px 8px; border-radius: 5px;
	background: var(--surface-card); border: 1px solid var(--border-normal);
	font-size: 0.78rem; cursor: pointer; color: var(--text-body);
	white-space: nowrap;
}
.c-bulk__more:hover { background: var(--surface-hover); border-color: var(--dusty); }
html[data-theme="dark"] .c-bulk__more:hover { background: rgba(255,255,255,0.08); }

/* ═══════════════════════════════════════════════════════════════════════════
   CHARACTER-STYLE TOOLBAR (floating, above a text selection)
   ═══════════════════════════════════════════════════════════════════════════ */
.c-chartoolbar { position: relative; display: inline-flex; align-items: center; gap: 2px; height: 36px; padding: 4px; background: var(--surface-card); border: 1px solid rgba(0,71,171,0.12); border-radius: var(--radius-md); box-shadow: var(--shadow-elevated); }
/* Downward pointer tucked under the bottom edge, aimed at the selection. Card-coloured
   fill (no border, matching the native DownArrow). 12px wide × 7px tall, centred. */
.c-chartoolbar::after { content: ""; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 7px solid var(--surface-card); }
.c-chartoolbar__btn { width: 28px; height: 28px; border: 0; background: transparent; border-radius: 7px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-body); transition: background 0.08s; }
.c-chartoolbar__btn:hover { background: #F0F4FF; }
/* Pressed: one step deeper than hover, so a touch (which has no hover) sees
   the press register. Native flashes it for 180ms on tap (W6 lock, 2026-09-16). */
.c-chartoolbar__btn:active { background: #DCE6FA; }
.c-chartoolbar__btn.is-active { background: var(--primary); color: #fff; }
.c-chartoolbar__divider { width: 1px; height: 20px; background: var(--border-subtle); margin: 0 4px; }
.c-swatch { width: 14px; height: 14px; border-radius: 3px; }
html[data-theme="dark"] .c-chartoolbar { background: #2C2C2E; border-color: #3A3A3C; }
html[data-theme="dark"] .c-chartoolbar::after { border-top-color: #2C2C2E; }
html[data-theme="dark"] .c-chartoolbar__btn { color: #E5E5EA; }
html[data-theme="dark"] .c-chartoolbar__btn:hover { background: rgba(255,255,255,0.08); }
html[data-theme="dark"] .c-chartoolbar__btn:active { background: rgba(255,255,255,0.14); }

/* ═══════════════════════════════════════════════════════════════════════════
   §SELECTION · .c-check / .c-select-row / .c-provenance / .c-detail
   Creation-friction wave, Item E. Promoted from design/mockups/creation/round2.css.

   .c-select-row is choice S-1: THE ROW IS THE CONTROL. Daniel objected to raw
   platform checkboxes ("they look out of place"), and this is the answer — the
   selected row takes the editor's own treatment (tinted ground, 2px primary left
   rule), matching .c-block-row.is-selected and .c-subject-tile. The tick appears
   only once selected, so an unselected list reads as content rather than as a
   column of empty boxes.

   .c-check is still needed: it appears INSIDE .c-select-row wherever a single
   boolean needs a control of its own, and .c-todo-row__check keeps its circle as
   .c-check--round.
   ═══════════════════════════════════════════════════════════════════════════ */
.c-check {
	width: 18px; height: 18px; flex: 0 0 18px;
	padding: 0; border-radius: 6px;
	border: 1.5px solid var(--pale);
	background: transparent; cursor: pointer;
	display: flex; align-items: center; justify-content: center;
	transition: background 0.12s, border-color 0.12s;
}
.c-check--round { border-radius: 50%; }
.c-check.is-checked { background: var(--primary); border-color: var(--primary); }
.c-check .c-icon { width: 11px; height: 11px; color: #fff; opacity: 0; }
.c-check.is-checked .c-icon { opacity: 1; }
.c-check:hover { border-color: var(--dusty); }
.c-check.is-checked:hover { background: var(--secondary); border-color: var(--secondary); }
.c-select-row {
	display: flex; align-items: flex-start; gap: 10px;
	padding: 7px 10px; border-radius: 7px;
	cursor: pointer; font-size: 0.84rem;
	border: 1px solid transparent;
	box-shadow: inset 2px 0 0 transparent;
	transition: background var(--motion-fast), box-shadow var(--motion-fast);
}
.c-select-row:hover { background: var(--surface-hover); }
.c-select-row.is-selected {
	background: var(--surface-active);
	box-shadow: inset 2px 0 0 var(--primary);
}
html[data-theme="dark"] .c-select-row.is-selected { box-shadow: inset 2px 0 0 var(--secondary); }
.c-select-row__chip {
	flex: 0 0 60px; width: 60px; text-align: right;
	font-size: 0.64rem; font-weight: 600; color: var(--text-muted);
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: 2px;
}
.c-select-row__text {
	flex: 1; min-width: 0; color: var(--text-body);
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.c-select-row__tick {
	flex: 0 0 16px; width: 16px; height: 16px; margin-top: 1px;
	border-radius: 5px; background: var(--primary);
	display: flex; align-items: center; justify-content: center;
	opacity: 0; transition: opacity var(--motion-fast);
}
.c-select-row__tick .c-icon { width: 10px; height: 10px; color: #fff; }
.c-select-row.is-selected .c-select-row__tick { opacity: 1; }
.c-provenance {
	display: inline-flex; align-items: center; gap: 3px;
	font-size: 10px; font-weight: 600; letter-spacing: 0.02em;
	/* A tag keeps its own case wherever it sits — inside an uppercase section
	   label (the manual recall form's "Mark scheme points") it would shout. */
	text-transform: none;
	padding: 1px 6px; border-radius: var(--radius-md);
	background: var(--ice); color: var(--primary);
}
.c-provenance svg { width: 9px; height: 9px; fill: currentColor; }
html[data-theme="dark"] .c-provenance { background: rgba(0,71,171,0.22); color: var(--secondary); }
.c-provenance--edited { background: var(--fill-input); color: var(--text-muted); }
html[data-theme="dark"] .c-provenance--edited { background: var(--border-subtle); color: var(--text-muted); }
.c-detail { border-top: 1px solid var(--border-subtle); margin-top: 12px; padding-top: 8px; }
.c-detail__summary {
	font-size: 12px; color: var(--text-muted); cursor: pointer;
	list-style: none; display: inline-flex; align-items: center; gap: 5px;
}
.c-detail__summary::-webkit-details-marker { display: none; }
.c-detail__summary::before { content: "▸"; font-size: 9px; }
.c-detail[open] .c-detail__summary::before { content: "▾"; }
.c-detail__body {
	margin-top: 6px; padding: 8px 10px;
	background: var(--surface-page); border-radius: var(--radius-sm);
	font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted);
	white-space: pre-wrap; word-break: break-word;
}

/* The modal's own additions to the row: a block count that sits between the text
   and the tick, and the two muted states a heading can be in. */
.c-select-row__meta { flex: 0 0 auto; font-size: 0.72rem; color: var(--text-muted); padding-top: 2px; white-space: nowrap; }
/* Skipped for THIS run — still eligible next time. */
.c-select-row--skipped .c-select-row__text { color: var(--text-muted); }

/* Make cards from table (table-cards mockup, locked 2026-10-08). Layout only:
   everything visible is an existing component. The body is setup | preview
   when the MODAL is 640px or wider, one column with the preview below the rows
   when narrower – table-cards.js toggles --stack from the modal's own width. */
.c-tablecards { display: grid; grid-template-columns: minmax(0, 1fr) 236px; gap: 18px; align-items: start; }
.c-tablecards--stack { grid-template-columns: minmax(0, 1fr); }
/* A picker line: a fixed label column, then the column chips. */
.c-tablecards__pick { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.c-tablecards__pick-lbl { flex: 0 0 68px; font-size: 0.78rem; font-weight: 600; color: var(--text-body); }
.c-tablecards__pick .c-segment__btn { padding: 4px 12px; font-size: 12.5px; }
/* One table row in the row list: equal fixed columns, so the list reads as the
   table it came from. Question cells bold, unused columns muted. */
.c-tablecards__cells { flex: 1; min-width: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.c-tablecards__cells > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-tablecards__q { font-weight: 600; }
.c-tablecards__off { color: var(--text-muted); }
/* The header row is listed (it supplies the labels) but cannot be ticked. */
.c-tablecards__hdr { cursor: default; }
.c-tablecards__hdr:hover { background: transparent; }
.c-tablecards__hdr .c-tablecards__cells { color: var(--text-muted); font-style: italic; }
/* Card-face mini-table, under the section heading for context. */
.c-tablecards__ctx { font-family: var(--font-serif); font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; }
.c-tablecards__face .block-preview.b-table { margin: 0; }
.c-tablecards__face .block-preview table { font-size: 0.85rem; table-layout: fixed; }
.c-tablecards__face .block-preview table thead th { font-size: 0.9rem; }
/* On a coarse pointer each row is a 44pt target (the iPad rule). */
@media (pointer: coarse) { .c-tablecards .c-select-row { min-height: 44px; align-items: center; } }
/* Editing an existing card set (table-cards-edit mockup, locked 2026-10-14).
   Layout only. The set line sits above the columns, with the pickers' gap. */
.c-tablecards__setline { margin-bottom: 14px; }
/* Edit mode's footer: the change count beside Save changes. The count never
   wraps; the button takes the rest of the row. */
.c-tablecards__savebar { display: flex; align-items: center; gap: 12px; }
.c-tablecards__savebar-count { flex: 0 0 auto; font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.c-modal__footer .c-tablecards__savebar .c-btn-primary { flex: 1; width: auto; min-width: 0; }
/* A row's meta holds its own text and, hidden in the same grid cell, the
   widest meta's text – so every row's cells keep one width and the columns
   stay under the header labels whatever the meta says. */
.c-tablecards__meta { display: inline-grid; text-align: right; }
.c-tablecards__meta > span { grid-area: 1 / 1; }
.c-tablecards__meta > span[aria-hidden] { visibility: hidden; }
/* never_draft: a permanent exclusion, struck through so it reads as a decision
   rather than an oversight. */
.c-select-row--never { opacity: 0.55; }
.c-select-row--never .c-select-row__text { text-decoration: line-through; }

/* ── .c-select-row--tree — the shipped row, in a tree ────────────────────────
   Adds: a twisty column, three depths (indent only — a folder, a note and a
   heading are the same row), the PARTIAL state (some children selected: the
   tick box shows a dash), and --empty for 0-card rows (shown, greyed — E-e). */
.c-select-row--tree { align-items: center; padding: 6px 10px; }
.c-select-row__twisty {
	flex: 0 0 14px; width: 14px; height: 16px;
	display: inline-flex; align-items: center; justify-content: center;
	color: var(--text-muted); user-select: none;
}
/* A real chevron icon (the 10px ▾/▸ glyphs rendered as dots — S2 QA); the
   icon points right and rotates to point down when the row is expanded. */
.c-select-row__twisty .c-icon { width: 11px; height: 11px; transition: transform var(--motion-chevron); }
.c-select-row__twisty.is-open .c-icon { transform: rotate(90deg); }
.c-select-row--d1 { margin-left: 24px; }
.c-select-row--d2 { margin-left: 48px; }
.c-select-row--d2 .c-select-row__text { font-size: 0.8rem; }
.c-select-row.is-partial .c-select-row__tick { opacity: 1; background: var(--surface-card); border: 1.5px solid var(--primary); }
.c-select-row.is-partial .c-select-row__tick .c-icon { display: none; }
.c-select-row.is-partial .c-select-row__tick::after { content: ""; width: 7px; height: 2px; border-radius: 1px; background: var(--primary); }
html[data-theme="dark"] .c-select-row.is-partial .c-select-row__tick { border-color: var(--secondary); }
html[data-theme="dark"] .c-select-row.is-partial .c-select-row__tick::after { background: var(--secondary); }
.c-select-row--empty .c-select-row__text,
.c-select-row--empty .c-select-row__meta { color: var(--text-muted); opacity: 0.7; }

/* ═══════════════════════════════════════════════════════════════════════════
   SLASH PICKER / STYLE DROPDOWN
   ═══════════════════════════════════════════════════════════════════════════ */
.c-slash { width: 260px; background: var(--surface-card); border: 1px solid var(--pale); border-radius: 5px; box-shadow: 0 4px 12px rgba(0,0,0,0.12); padding: 0.4rem; }
.c-slash__search { width: 100%; border: 1px solid var(--border-normal); border-radius: 3px; padding: 4px 6px; font-size: 0.82rem; }
.c-slash__list { max-height: 200px; overflow-y: auto; margin-top: 0.3rem; }
.c-slash__item { font-size: 0.82rem; padding: 5px 8px; border-radius: 3px; cursor: pointer; color: var(--text-body); }
.c-slash__item.is-active { background: var(--ice); color: var(--primary); }
/* Group label — the SAME treatment as the live editor's block style picker
   (.dropdown-group-header): secondary, letter-spaced, with a hairline above each
   group but the first. Was --primary with no divider, which made the cell-style
   picker read differently from the block picker (Daniel, 2026-07-23: unify). */
.c-slash__group {
	font-size: 0.7rem; font-weight: 700; color: var(--secondary); text-transform: uppercase;
	letter-spacing: 0.04em; padding: 6px 8px 2px;
	border-top: 1px solid var(--ice); margin-top: 0.2rem;
}
.c-slash__group:first-child { border-top: none; margin-top: 0; }
html[data-theme="dark"] .c-slash { border-color: var(--border-subtle); }
html[data-theme="dark"] .c-slash__item.is-active { background: var(--surface-active); color: var(--secondary); }
html[data-theme="dark"] .c-slash__group { color: var(--text-muted); border-top-color: var(--border-subtle); }

/* ═══════════════════════════════════════════════════════════════════════════
   TABLE BLOCK — compact summary  (the editor itself is § TABLE WORKSPACE, .c-tw-*)
   ═══════════════════════════════════════════════════════════════════════════ */
/* The table block's row in the editor's left pane. It reads out the table's
   HEADINGS in the ordinary UI font — the old mono "4 cols x 3 rows" with a glyph
   said nothing about WHICH table it was (Daniel, W10 QA round 1). */
.c-table-summary { display: flex; align-items: center; gap: 10px; font-family: var(--font-ui); font-size: 0.875rem; color: var(--text-body); min-width: 0; }
.c-table-summary__cols { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-table-summary__edit { font-size: 0.72rem; padding: 2px 8px; border: 1px solid var(--secondary); color: var(--secondary); background: transparent; border-radius: 3px; cursor: pointer; }

/* ═══════════════════════════════════════════════════════════════════════════
   IMAGE BLOCK — the editor row  (W11 Phase A, frames B16–B19; promoted from the
   mockup's .ed-img* at build). The PAGE side (picture, caption, placeholders)
   is paper and lives in styles.css (.img-block*). Actions reuse
   .c-table-summary__edit; the sources reuse .c-btn .c-btn-sm .c-btn-ghost; the
   width menu is a plain .c-menu.
   ═══════════════════════════════════════════════════════════════════════════ */
.c-image-row { display: flex; flex-direction: column; gap: 6px; white-space: normal; }
.c-image-row__top { display: flex; align-items: center; gap: 10px; }
/* The thumbnail is paper: white in both themes, a hairline so it has an edge on the pane. */
.c-image-row__thumb {
	flex: 0 0 auto; width: 104px; height: 60px; object-fit: contain; box-sizing: border-box;
	background: #fff; border: 1px solid var(--border-subtle); border-radius: 3px;
	display: inline-flex; align-items: center; justify-content: center;
}
.c-image-row__thumb--ph { background: transparent; border: 1.5px dashed var(--border-normal); color: var(--text-muted); }
.c-image-row__thumb--failed { border-color: rgba(148,40,90,0.55); }
.c-image-row__thumb svg { width: 18px; height: 18px; fill: currentColor; }
.c-image-row__status { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }
.c-image-row__track { display: block; flex: 0 0 auto; width: 100%; max-width: 180px; height: 6px; }
/* No upload progress from fetch(): the fill sweeps instead of counting. */
.c-image-row__track .c-progress-bar__fill { width: 35%; animation: c-image-row-sweep 1.2s ease-in-out infinite; }
@keyframes c-image-row-sweep { 0% { transform: translateX(-100%); } 100% { transform: translateX(290%); } }
.c-image-row__meta { font-size: 0.75rem; }
.c-image-row__missing { color: var(--text-body); }
/* W11 Phase B: a snapshot row has three buttons + the width menu (B27) — wrap. */
.c-image-row__actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.c-image-row__actions .c-table-summary__edit { white-space: nowrap; }
.c-image-row__caption { display: flex; align-items: baseline; gap: 8px; }
.c-image-row__caption-label { flex: 0 0 auto; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.c-image-row__caption-field { flex: 1; min-width: 0; padding: 1px 0 2px; border-bottom: 1px solid transparent; outline: none; white-space: pre-wrap; word-break: break-word; }
.c-image-row__caption-field:focus { border-bottom-color: var(--dusty); }
.c-image-row__caption-field:empty::before { content: attr(data-placeholder); color: var(--text-muted); font-style: italic; }

/* B18 — the width menu hangs under its button. */
.c-image-row__size { position: relative; display: inline-block; }
.c-image-row__size .c-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 20; min-width: 130px; }
.c-image-row__size .c-menu__item.is-active { color: var(--primary); font-weight: 600; }
html[data-theme="dark"] .c-image-row__size .c-menu__item.is-active { color: var(--secondary); }

/* B16 — the empty block: the row is the chooser (and a drop target). */
.c-image-drop {
	display: flex; flex-direction: column; gap: 6px; padding: 10px 12px;
	border: 1.5px dashed var(--border-normal); border-radius: 6px; white-space: normal;
}
.c-image-drop.is-dragover { border-color: var(--secondary); background: var(--surface-hover); }
.c-image-drop__sources { display: flex; flex-wrap: wrap; gap: 6px; }
.c-image-drop__src { display: inline-flex; flex: 0 0 auto; width: auto; align-items: center; gap: 6px; border-color: var(--border-normal); }
.c-image-drop__src svg { width: 14px; height: 14px; fill: currentColor; }
.c-image-drop__hint { font-size: 0.75rem; color: var(--text-muted); }
.c-image-drop .c-inline-error { font-size: 0.8rem; }

/* A file dragged over the block list (drop = a new Image block below the row). */
.c-block-row.is-file-target { box-shadow: inset 0 -2px 0 var(--secondary); }

/* ═══════════════════════════════════════════════════════════════════════════
   CREATION MODE — right-pane manage/reorder list
   In creation mode the right pane swaps the A4 preview for a management list:
   a Flashcards|Written Recall tab toggle (.c-tabs) over rows keyed by HEADING.
   Each row is draggable to reorder; clicking opens the Create & Manage modal.
   Rows show only the heading + a snippet of the selected blocks (truncated).
   ═══════════════════════════════════════════════════════════════════════════ */
.c-cm-manage { flex: 1; min-width: 0; overflow: auto; background: var(--surface-editor-left); padding: 0 16px 16px; display: flex; flex-direction: column; }
html[data-theme="dark"] .c-cm-manage { background: #1F1F1F; }
.c-cm-manage__tabs { position: sticky; top: 0; background: inherit; padding-top: 12px; }
.c-cm-manage__head { display: flex; align-items: center; justify-content: space-between; margin: 12px 2px 8px; }
.c-cm-manage__count { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); }
.c-cm-manage__hint { font-size: 0.7rem; color: var(--text-muted); font-style: italic; }
.c-cm-entry { display: flex; align-items: center; gap: 10px; padding: 9px 11px; margin-bottom: 6px; background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: 9px; cursor: pointer; transition: border-color var(--motion-fast), box-shadow var(--motion-fast); }
.c-cm-entry:hover { border-color: var(--dusty); box-shadow: var(--shadow-card); }
.c-cm-entry__drag { flex: 0 0 auto; color: var(--text-muted); cursor: grab; display: inline-flex; }
.c-cm-entry__drag:active { cursor: grabbing; }
.c-cm-entry__drag svg { width: 13px; height: 13px; fill: currentColor; }
.c-cm-entry__num { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 6px; background: var(--ice); color: var(--primary); font-size: 0.66rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
html[data-theme="dark"] .c-cm-entry__num { background: var(--surface-active); color: var(--secondary); }
.c-cm-entry__main { flex: 1; min-width: 0; }
.c-cm-entry__heading { font-size: 0.83rem; font-weight: 600; color: var(--text-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-cm-entry__snippet { font-size: 0.72rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.c-cm-entry__chev { flex: 0 0 auto; color: var(--text-muted); }
.c-cm-entry__chev svg { width: 14px; height: 14px; fill: currentColor; transform: rotate(-90deg); }
.c-cm-manage__empty { border: 1.5px dashed var(--pale); border-radius: 8px; padding: 18px; font-size: 12px; color: var(--text-muted); text-align: center; }
html[data-theme="dark"] .c-cm-manage__empty { border-color: var(--border-normal); }

/* ═══════════════════════════════════════════════════════════════════════════
   CREATE & MANAGE MODAL  (opened from a heading's +/counter pills)
   Uses .c-modal (medium) + .c-tabs. Body parts below. The FRONT preview box
   stays light in both themes (it shows serif/black rendered note content).
   ═══════════════════════════════════════════════════════════════════════════ */
.c-tabs { display: flex; border-bottom: 1px solid var(--border-subtle); }
/* Works as either a <div> or a <button> — the reset (appearance/background/
   border/font) keeps a native <button> from drawing its default chrome, so the
   only border that shows is the 2px underline. */
.c-tab {
	appearance: none; -webkit-appearance: none;
	background: transparent; border: 0; border-bottom: 2px solid transparent;
	font-family: inherit;
	padding: 0.6rem 1rem; font-size: 0.82rem; font-weight: 500;
	color: var(--text-muted); cursor: pointer; margin-bottom: -1px;
}
.c-tab:hover { color: var(--secondary); }
.c-tab.is-active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }
/* A tab that exists but cannot be chosen yet – the .c-segment__btn:disabled look. */
.c-tab:disabled, .c-tab:disabled:hover { opacity: 0.4; cursor: default; color: var(--text-muted); }
/* Accent swap (DESIGN.md): --primary (#0047AB) is near-illegible on a dark card, so
   the active tab moves to --secondary in dark — matching how every active nav/link
   colour swaps. Applies to every tabbed surface (card modal, manage pane, admin,
   exam results, study history). */
html[data-theme="dark"] .c-tab.is-active { color: var(--secondary); border-bottom-color: var(--secondary); }
.c-cm-seclabel { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); margin: 14px 0 6px; }
.c-cm-seclabel:first-child { margin-top: 0; }
.c-cm-front { background: #EEF4FF; border: 1px solid #DCE6F5; border-radius: 8px; padding: 9px 13px; color: #000; }
.c-cm-front .block-preview { margin: 0 !important; }

/* ── Written Recall tab ────────────────────────────────────────────────────────
   Read-only reference of the content under the heading (+ any selected extra
   headings) to write mark points against, an ordered-process toggle, and the
   mark-scheme point inputs. */
.c-cm-ref { background: var(--surface-page); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 4px 6px; max-height: 168px; overflow: auto; }
.c-cm-ref__row { display: flex; gap: 10px; padding: 5px 4px; font-size: 0.8rem; border-bottom: 1px solid var(--border-subtle); }
.c-cm-ref__row:last-child { border-bottom: 0; }
.c-cm-ref__chip { flex: 0 0 76px; width: 76px; text-align: right; font-size: 0.62rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: 2px; }
.c-cm-ref__text { flex: 1; min-width: 0; color: var(--text-body); }
.c-cm-ordered { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; color: var(--text-body); cursor: pointer; }
.c-cm-ordered input { accent-color: var(--primary); }
.c-mp-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
/* The point is an auto-growing textarea (the editor sets its height from
   scrollHeight): one control-height when short, taller when the point is long.
   Number and remove button sit on the first line. */
.c-mp-row .c-textarea { min-height: var(--ctl-h); resize: none; overflow: hidden; line-height: 1.45; padding: 0.45rem 0.7rem; }
.c-mp-row__num { margin-top: calc((var(--ctl-h) - 18px) / 2); }
.c-mp-row__rm { margin-top: calc((var(--ctl-h) - 26px) / 2); }
.c-mp-row__num { flex: 0 0 18px; width: 18px; height: 18px; border-radius: 50%; background: var(--ice); color: var(--primary); font-size: 0.66rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
html[data-theme="dark"] .c-mp-row__num { background: var(--surface-active); color: var(--secondary); }
.c-mp-row__rm { flex: 0 0 auto; width: 26px; height: 26px; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; border-radius: 6px; font-size: 14px; }
.c-mp-row__rm:hover { background: var(--surface-hover); color: var(--plum); }
.c-cm-addpoint { align-self: flex-start; font-size: 0.78rem; font-weight: 600; color: var(--primary); background: transparent; border: 1px solid var(--border-normal); border-radius: 6px; padding: 5px 11px; cursor: pointer; }
.c-cm-addpoint:hover { border-color: var(--secondary); background: var(--surface-active); }

/* ═══════════════════════════════════════════════════════════════════════════
   SESSION SUMMARY  (multi-card: header · score · history)
   Mirrors the shared sum- component. Count-number colours match the donut/bar
   (correct #22C55E / partial #EAB308 / wrong #EF4444) so the whole card is one
   colour language.
   ═══════════════════════════════════════════════════════════════════════════ */
.c-sum-wrap { display: flex; flex-direction: column; gap: var(--space-md); }
.c-sum-card { background: var(--surface-card); border-radius: 18px; box-shadow: var(--shadow-card); padding: 22px 26px; }
.c-sum-card__label { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }

/* Header card */
.c-sum-header-inner { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.c-sum-badge { display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; background: var(--primary); color: #fff; border-radius: var(--radius-pill); padding: 4px 11px; margin-bottom: 9px; }
.c-sum-badge--fc { background: var(--primary); }   /* Flashcards badge = same dark primary as Written Recall */
.c-sum-note-name { font-size: 1.1rem; font-weight: 700; color: var(--text-body); letter-spacing: -0.02em; line-height: 1.3; }
.c-sum-meta { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--text-muted); margin-top: 5px; }
.c-sum-duration { flex-shrink: 0; background: var(--ice); color: var(--secondary); font-size: 0.75rem; font-weight: 600; border-radius: var(--radius-pill); padding: 4px 12px; white-space: nowrap; }

/* Score card */
.c-sum-score-inner { display: flex; gap: 24px; align-items: center; }
.c-sum-ring { position: relative; width: 108px; height: 108px; flex-shrink: 0; border-radius: 50%; }
.c-sum-ring__inner { position: absolute; inset: 18px; background: var(--surface-card); border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.c-sum-ring__pct { font-size: 1.1rem; font-weight: 700; color: var(--text-body); letter-spacing: -0.03em; line-height: 1; }
.c-sum-ring__sub { font-size: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.c-sum-score-details { flex: 1; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.c-sum-stackbar { height: 7px; border-radius: var(--radius-pill); overflow: hidden; display: flex; background: var(--border-subtle); }
.c-sum-seg--correct { background: #22C55E; }
.c-sum-seg--partial { background: #EAB308; }
.c-sum-seg--wrong   { background: #EF4444; }
.c-sum-counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.c-sum-count__num { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.c-sum-count__num--correct { color: #22C55E; }
.c-sum-count__num--partial { color: #EAB308; }
.c-sum-count__num--wrong   { color: #EF4444; }
.c-sum-count__num--skipped { color: var(--text-muted); }
.c-sum-count__label { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-top: 2px; }
.c-sum-divider { height: 1px; background: var(--border-subtle); margin: 18px 0 14px; }
.c-sum-pills { display: flex; gap: 10px; }
.c-sum-pill { flex: 1; background: var(--surface-page); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 11px 16px; }
.c-sum-pill__label { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 4px; }
.c-sum-pill__value { font-size: 1.4rem; font-weight: 700; color: var(--text-body); letter-spacing: -0.02em; line-height: 1; }
.c-sum-pill__sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 3px; }

/* History card */
.c-sum-hist-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.c-sum-hist-tabs { display: flex; background: var(--ice); border-radius: 8px; padding: 2px; gap: 2px; }
.c-sum-hist-tab { font-size: 11px; font-weight: 600; color: var(--text-muted); background: transparent; border: 0; border-radius: 6px; padding: 4px 10px; cursor: pointer; white-space: nowrap; }
.c-sum-hist-tab.is-active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,0.10); }
.c-sum-delta { display: inline-flex; align-items: center; font-size: 0.75rem; font-weight: 600; border-radius: var(--radius-pill); padding: 3px 10px; }
.c-sum-delta--up { background: #DCFCE7; color: #166534; }
.c-sum-delta--down { background: #FEE2E2; color: #B91C1C; }
.c-sum-stats { display: flex; gap: 18px; }
.c-sum-stat { text-align: center; }
.c-sum-stat__label { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.c-sum-stat__value { font-size: 1.05rem; font-weight: 700; color: var(--text-body); letter-spacing: -0.02em; }
.c-sum-bars { display: flex; align-items: flex-end; gap: 10px; height: 100px; margin-top: 14px; }
.c-sum-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.c-sum-bar__pct { font-size: 10px; color: var(--text-muted); margin-bottom: 4px; }
.c-sum-bar__pct.is-current { color: var(--primary); font-weight: 700; }
.c-sum-bar__fill { width: 100%; max-width: 40px; background: var(--pale); border-radius: 4px 4px 0 0; min-height: 3px; }
.c-sum-bar__fill.is-current { background: var(--primary); }
.c-sum-bar__lbl { font-size: 10px; color: var(--text-muted); margin-top: 4px; }
.c-sum-bar__lbl.is-current { color: var(--primary); font-weight: 600; }

/* Card breakdown list + result chip (chip also used by the history modal) */
.c-sum-breakdown { max-height: 240px; overflow-y: auto; margin-top: 6px; }
.c-sum-bd-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--border-subtle); }
.c-sum-bd-row:last-child { border-bottom: 0; }
.c-sum-bd-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.c-sum-bd-name { flex: 1; font-size: 0.95rem; color: var(--text-body); }

/* Context line: a card's parent headings ("1 Trig › 1.1 cos equations"), muted,
   one line. context-line.js cuts it from the LEFT by whole headings ("… › 1.1
   cos equations"); the ellipsis here only catches a last heading too wide alone. */
.c-trunc-start {
	display: block; min-width: 0;
	overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.c-context-line {
	font-family: var(--font-ui); font-size: 0.8rem; line-height: 1.4;
	color: var(--text-muted); margin-bottom: 6px;
}
.c-result-chip { font-size: 11px; font-weight: 700; border-radius: var(--radius-pill); padding: 3px 12px; white-space: nowrap; }
.c-result-chip--correct { background: #DCFCE7; color: #166534; }
.c-result-chip--partial { background: #FEF9C3; color: #854D0E; }
.c-result-chip--wrong   { background: #FEE2E2; color: #B91C1C; }
/* Skipped completes the chip family (the session summary's breakdown can include
   skipped items). Uses theme-aware tokens (--border-subtle / --text-muted), so it
   adapts to dark on its own — no dark override needed, unlike the fixed pastels
   above. Mirrors the live `.sum-grade-chip.skipped`. */
.c-result-chip--skipped { background: var(--border-subtle); color: var(--text-muted); }

/* Footer action row */
.c-sum-actions { display: flex; gap: 10px; }
.c-sum-actions .c-btn { flex: 1; }

/* --ice is a fixed light blue in BOTH themes, so any .c-sum-* element using it as a
   fill (the duration pill, the history-tabs track) must flip to a dark surface in
   dark mode — otherwise it reads as a pale pill on the dark card. Recessed track →
   --surface-page; the active tab + duration pill sit raised on --surface-active
   (the same combo the dropdown items use). */
html[data-theme="dark"] .c-sum-duration { background: var(--surface-active); }
html[data-theme="dark"] .c-sum-hist-tabs { background: var(--surface-page); }
html[data-theme="dark"] .c-sum-hist-tab.is-active { background: var(--surface-active); color: var(--secondary); }
/* History bar chart: --pale is a fixed light blue (theme-fixed), so the historic
   bars glare on the dark card. In dark, the historic bars become a muted slate-blue
   (lighter than the --surface-card #2C2C2E so they read, but dim) and the current
   session's bar + labels brighten to --secondary so the just-completed run pops
   most (mirrors the sidebar active-in-dark treatment). */
html[data-theme="dark"] .c-sum-bar__fill { background: #44506B; }
html[data-theme="dark"] .c-sum-bar__fill.is-current { background: var(--secondary); }
html[data-theme="dark"] .c-sum-bar__pct.is-current,
html[data-theme="dark"] .c-sum-bar__lbl.is-current { color: var(--secondary); }
html[data-theme="dark"] .c-sum-delta--up { background: rgba(34,197,94,0.18); color: #4ADE80; }
html[data-theme="dark"] .c-sum-delta--down { background: rgba(239,68,68,0.18); color: #F87171; }
html[data-theme="dark"] .c-result-chip--correct { background: rgba(34,197,94,0.18); color: #4ADE80; }
html[data-theme="dark"] .c-result-chip--partial { background: rgba(234,179,8,0.18); color: #FCD34D; }
html[data-theme="dark"] .c-result-chip--wrong   { background: rgba(239,68,68,0.18); color: #F87171; }

/* ═══════════════════════════════════════════════════════════════════════════
   EXAM SERIES CARD  (Add Result step 1)
   ═══════════════════════════════════════════════════════════════════════════ */
.c-series { border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.c-series:hover { border-color: var(--secondary); background: rgba(0,71,171,0.03); }
.c-series.is-selected { border-color: var(--secondary); background: rgba(0,71,171,0.06); }
.c-series__name { font-size: 13px; font-weight: 600; }
.c-series__meta { font-size: 11px; color: var(--text-muted); }
.c-series__badge { font-size: 10px; font-weight: 600; background: var(--ice); color: var(--secondary); border-radius: var(--radius-pill); padding: 2px 8px; }

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN CARD
   ═══════════════════════════════════════════════════════════════════════════ */
.c-login { width: 380px; max-width: 100%; background: var(--surface-card); border-radius: var(--radius-sm); box-shadow: var(--shadow-elevated); padding: var(--space-xxl); }
.c-login__brand { display: flex; flex-direction: column; align-items: center; gap: 10px;
	font-size: 1.6rem; font-weight: 400; color: var(--primary); text-align: center; }
/* Stacked lockup: the mark sits above the word, so it is sized off the word's
   font-size rather than sharing a baseline with it. */
.c-login__brand .c-brandmark { width: 1.63em; height: 1.95em; }
.c-login__sub { font-size: var(--fs-small); color: var(--secondary); text-align: center; margin-top: 4px; margin-bottom: var(--space-xl); }
/* Stacked form fields with an even rhythm; the submit button spans full width.
   (Evolved from the minimal seed, which spaced fields with inline margins.)
   Controls are the CANONICAL .c-input / .c-btn-primary as-is — no height/font
   override — so auth matches the gallery #login and every other form exactly. */
.c-login__form { display: flex; flex-direction: column; gap: var(--space-md); }
.c-login__form .c-btn-primary { width: 100%; margin-top: 4px; }
/* Two-column row (register first/last name). Collapses to one column when the card
   reflows narrow (mobile frames set their own width; this just stays graceful). */
.c-login__row { display: flex; gap: var(--space-md); }
.c-login__row > .c-field { flex: 1; min-width: 0; }
/* Inline error line — hidden until a failed attempt (.is-shown). Plum, like the
   live; --plum is theme-fixed, so the dark side gets a legible soft-plum override. */
.c-login__error { display: none; color: var(--plum); font-size: var(--fs-small); margin-top: 2px; }
.c-login__error.is-shown { display: block; }
html[data-theme="dark"] .c-login__error { color: #F2B8CD; }
/* Footer action (Create account / Sign in) — a centred ghost button, matching the
   gallery seed. (The live used a plain link; the redesign uses the ghost button.) */
.c-login__footer { text-align: center; margin-top: var(--space-md); }
/* Registration-closed note — single-user tool, ALLOW_REGISTRATION=false. A calm
   info panel above a disabled form. Uses --pale (theme-fixed) as a tint, so it gets
   an explicit dark fill (the fixed-token trap). */
.c-login__note {
	display: flex; gap: 8px;
	padding: 10px 12px; margin-bottom: var(--space-lg);
	background: var(--ice); border: 1px solid var(--pale); border-radius: var(--radius-sm);
	font-size: var(--fs-small); color: var(--text-body); line-height: 1.4;
}
html[data-theme="dark"] .c-login__note { background: rgba(255,255,255,0.05); border-color: var(--border-normal); }

/* ═══════════════════════════════════════════════════════════════════════════
   EDITOR BLOCK ROW  (left-pane editing unit: gutter style-label + content)
   Promoted from the live editor (editor.css .block-edit-row) into the canonical
   set — tokenised + dark-safe. The content uses the UI (sans) font; only the
   rendered preview is serif. States: hover, selected/focus-within (controls
   appear). Equation/code blocks use the --mono content variant.
   ═══════════════════════════════════════════════════════════════════════════ */
.c-block-row { display: flex; align-items: flex-start; position: relative; padding: 2px 0; border-radius: 4px; }
.c-block-row:hover { background: var(--surface-card); }
.c-block-row.is-selected, .c-block-row:focus-within { background: var(--surface-card); }
html[data-theme="dark"] .c-block-row:hover,
html[data-theme="dark"] .c-block-row.is-selected,
html[data-theme="dark"] .c-block-row:focus-within { background: rgba(255,255,255,0.05); }

/* Gutter style label — doubles as the style-picker trigger */
.c-block-row__label {
	flex: 0 0 84px; text-align: right;
	padding: 5px 8px 0 0; line-height: 1.5;
	font-size: 0.75rem; font-weight: 600; letter-spacing: 0.01em;
	color: var(--text-muted); background: none;
	border: 0; border-right: 2px solid transparent; cursor: pointer;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
	transition: color var(--motion-fast), border-color var(--motion-fast);
}
/* The active block reads by its tint alone, like macOS: no vertical bar beside the
   label (Daniel's ruling, bug wave 2026-10). The transparent border-right stays so
   the label does not shift. Keyboard focus still gets the .c-scope ring. */
.c-block-row__label:hover { color: var(--secondary); }
.c-block-row.is-selected .c-block-row__label,
.c-block-row:focus-within .c-block-row__label { color: var(--secondary); }

/* Content (editable area) — UI font; mono variant for equation/code.
   No right padding reservation: the controls have their own column now (below). */
.c-block-row__content {
	flex: 1; min-width: 0;
	font-family: var(--font-ui); font-size: 0.875rem; line-height: 1.65;
	color: var(--text-body); background: transparent;
	padding: 4px 6px;
	border-bottom: 1px solid transparent;
	white-space: pre-wrap; word-break: break-word; outline: none;
}
/* No underline on the focused content: the row's tint marks the active block. */
.c-block-row__content--mono { font-family: var(--font-mono); font-size: 0.81rem; }

/* Mini controls — their own column at the end of the row, appearing on
   hover/selection.
   
   They used to be absolutely positioned OVER the content, which reserved 38px of
   padding for a bar measuring 47px (drag + delete) or 69px (drag + continue +
   delete, on numbered lists and Code) — so they sat on top of 12px or 34px of the
   first line of text (Daniel, 2026-08-31).
   
   The column is reserved PERMANENTLY, never opened on hover: a width that
   appeared on hover would reflow the text of every row the pointer crossed. Only
   the buttons still fade, exactly as before. Standing in their own column they no
   longer need the card background, border and shadow — those existed solely to
   lift them off the text they were covering. */
.c-block-row__controls {
	flex: 0 0 var(--block-controls-w, 84px);
	display: flex; align-items: center; justify-content: flex-end; gap: 2px;
	align-self: flex-start; margin-top: 1px; padding: 1px 0;
	opacity: 0; visibility: hidden; transition: opacity var(--motion-fast);
}
.c-block-row:hover .c-block-row__controls,
.c-block-row.is-selected .c-block-row__controls,
.c-block-row:focus-within .c-block-row__controls { opacity: 1; visibility: visible; }
/* MOD-1 (creation-friction wave, choice R3). Every control is a real 22px square
   with a 12px icon, including the two that used to be the text glyphs ↪ and ✕.
   Uniform squares are what let the four line up; text glyphs never did. */
.c-block-row__btn {
	display: inline-flex; align-items: center; justify-content: center;
	width: var(--block-btn-size, 22px); height: var(--block-btn-size, 22px);
	flex: 0 0 auto;
	padding: 0; border: 0; border-radius: 6px;
	background: transparent; color: var(--text-muted); cursor: pointer;
	transition: background var(--motion-fast), color var(--motion-fast);
}
.c-block-row__btn:hover { background: var(--surface-hover); color: var(--primary); }
.c-block-row__btn--danger:hover { background: rgba(148,40,90,0.12); color: var(--plum); }
.c-block-row__btn svg { width: 12px; height: 12px; fill: currentColor; }
.c-block-row__drag { cursor: grab; }
.c-block-row__drag:active { cursor: grabbing; }

/* R3, the split: the + sits last, past a hairline, and carries a permanent tint.
   It stops reading as a sibling of Delete, and it becomes the natural end-point of
   a left-to-right scan — nearest the thumb on an iPad held in landscape.
   The hairline is a ::before in the margin, as in the locked round-2 frame, NOT
   the button's own border-left: that squared the hover tint's left corners while
   the right ones stayed round (bug wave 2026-10, fix-editor-chrome-web). */
.c-block-row__btn--insert {
	margin-left: 5px;
	position: relative;
	color: var(--primary);
}
.c-block-row__btn--insert::before {
	content: ""; position: absolute; left: -4px; top: 3px; bottom: 3px;
	width: 1px; background: var(--border-subtle);
}
.c-block-row__btn--insert:hover { background: var(--surface-hover); color: var(--primary); }
html[data-theme="dark"] .c-block-row__btn--insert { color: var(--secondary); }

/* A coarse pointer gets bigger targets — a finger, not a trackpad. This is a
   POINTER query, not a platform tier check: an iPad with a trackpad attached is
   fine-pointer and should keep the compact cluster. */
@media (pointer: coarse) {
	.c-block-row__controls { --block-btn-size: 28px; }
	.c-block-row { --block-controls-w: 108px; }
}

/* ── Creation-mode states ──────────────────────────────────────────────────────
   In creation mode the row mini-controls give way to the entry-point pills.
   --front = heading that already has cards (blue left rule + fill)
   --back  = content block included in some card's back (green left rule)
   Both carry a 3px coloured left rule so the front/back grouping reads clearly
   against the editor surface (a plain fill tint was too low-contrast). */
.c-block-row--front { background: #DCE8FF; border-left: 3px solid var(--primary); border-radius: 0 6px 6px 0; padding-left: 8px; }
html[data-theme="dark"] .c-block-row--front { background: rgba(0,71,171,0.32); border-left-color: var(--secondary); }
.c-block-row--back { background: #F0FFF4; border-left: 3px solid #30B060; border-radius: 0 4px 4px 0; padding-left: 8px; }
html[data-theme="dark"] .c-block-row--back { background: rgba(48,176,96,0.14); }

/* Heading entry-point tools (creation mode) — float top-right of a heading row.
   A flashcard counter pill + a written-recall counter pill + an add button; each
   opens the Create & Manage modal on the matching tab. Zero-count pills are muted. */
.c-cm-tools { position: absolute; top: 4px; right: 6px; z-index: 6; display: inline-flex; align-items: center; gap: 4px; }
.c-cm-pill { display: inline-flex; align-items: center; gap: 3px; height: 19px; padding: 0 7px; border: 0; border-radius: 10px; font-size: 0.64rem; font-weight: 700; cursor: pointer; }
.c-cm-pill svg { width: 10px; height: 10px; fill: currentColor; }
.c-cm-pill--fc { background: var(--ice); color: var(--primary); }
.c-cm-pill--recall { background: #E7F6EC; color: #2A8A4A; }
.c-cm-pill.is-zero { background: transparent; color: var(--text-muted); box-shadow: inset 0 0 0 1px var(--border-subtle); }
.c-cm-add { width: 19px; height: 19px; border-radius: 50%; border: 1.5px dashed var(--border-normal); background: transparent; color: var(--text-muted); font-size: 12px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.c-cm-add:hover { border-style: solid; border-color: var(--secondary); color: var(--primary); background: var(--surface-active); }
html[data-theme="dark"] .c-cm-pill--fc { background: rgba(0,71,171,0.22); color: var(--secondary); }
html[data-theme="dark"] .c-cm-pill--recall { background: rgba(48,176,96,0.18); color: #5FCC85; }

/* ═══════════════════════════════════════════════════════════════════════════
   ZOOM CONTROL  (editor toolbar — − / % / +). Buttons reuse .c-tb-btn.
   ═══════════════════════════════════════════════════════════════════════════ */
.c-zoom { display: inline-flex; align-items: center; gap: 2px; }
.c-zoom__display { min-width: 3.1rem; text-align: center; font-size: 0.8rem; font-weight: 500; }

/* ═══════════════════════════════════════════════════════════════════════════
   TABLE OF CONTENTS  (subject-read CONTENTS panel — auto-generated nav)
   ───────────────────────────────────────────────────────────────────────────
   Bold note-title group headers + each note's heading blocks beneath, numbered
   and indented by level, with a search box (reuse .c-search) and a collapse
   toggle (‹). The entry tracking scroll position gets .is-active (scroll-spy).
   Persistent panel on wide layouts; the same panel is reused inside the narrow
   .c-toc-drawer. Tokenised + dark-safe; this is CHROME (follows the theme).
   ═══════════════════════════════════════════════════════════════════════════ */
.c-toc {
	display: flex; flex-direction: column;
	width: 240px; flex: 0 0 240px;
	background: var(--surface-nav);
	border-right: 1px solid var(--border-subtle);
	overflow: hidden;
}
.c-toc__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 8px 8px 16px; }
.c-toc__title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.c-toc__collapse {
	width: 24px; height: 24px; flex: 0 0 24px;
	border: 0; background: transparent; color: var(--text-muted); cursor: pointer;
	border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
}
.c-toc__collapse:hover { background: var(--surface-hover); color: var(--primary); }
.c-toc__collapse svg { width: 14px; height: 14px; fill: currentColor; }
.c-toc__search { padding: 0 12px 10px; }
.c-toc__list { flex: 1; overflow-y: auto; padding: 0 0 16px; }

/* Group header = the note title (bold, not numbered) */
.c-toc__group {
	display: block; padding: 11px 12px 4px 16px;
	font-size: 12.5px; font-weight: 700; color: var(--text-body);
	text-decoration: none; cursor: pointer;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.c-toc__group:hover { color: var(--primary); }

/* Heading entry rows — numbered, level-indented, active scroll-spy state */
.c-toc__link {
	display: block; padding: 3px 12px 3px 16px;
	font-size: 12px; line-height: 1.4; color: var(--text-muted);
	text-decoration: none; cursor: pointer;
	border-left: 3px solid transparent;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
	transition: background var(--motion-fast), color var(--motion-fast), border-color var(--motion-fast);
}
.c-toc__link:hover { background: var(--surface-hover); color: var(--primary); border-left-color: var(--pale); }
.c-toc__link.is-active { background: var(--ice); color: var(--primary); border-left-color: var(--primary); }
.c-toc__num { color: var(--text-muted); font-variant-numeric: tabular-nums; margin-right: 5px; }
.c-toc__link.is-active .c-toc__num { color: var(--primary); }
/* Level indents (headings nest under the note-title group) */
.c-toc__link--l1 { padding-left: 24px; }
.c-toc__link--l2 { padding-left: 38px; }
.c-toc__link--l3 { padding-left: 52px; }
.c-toc__link--l4 { padding-left: 66px; font-size: 11.5px; }
.c-toc__link--l5 { padding-left: 80px; font-size: 11.5px; }

/* Collapsed (wide layouts) — slim rail with just the expand toggle */
.c-toc.is-collapsed { width: 40px; flex-basis: 40px; }
.c-toc.is-collapsed .c-toc__title,
.c-toc.is-collapsed .c-toc__search,
.c-toc.is-collapsed .c-toc__list { display: none; }
.c-toc.is-collapsed .c-toc__head { justify-content: center; padding: 12px 0; }

html[data-theme="dark"] .c-toc__link.is-active { background: var(--surface-active); color: var(--secondary); border-left-color: var(--primary); }
html[data-theme="dark"] .c-toc__link.is-active .c-toc__num { color: var(--secondary); }

/* CONTENTS drawer — narrow widths (iOS / web-mobile / iPad-portrait). The same
   .c-toc panel in a left slide-in sheet over a dimmed backdrop, opened by the
   toolbar's "Contents" button. Anchors to a position:relative ancestor (the
   page sets it on .rd-body); .is-open reveals it. */
.c-toc-drawer { position: absolute; inset: 0; z-index: 40; display: none; }
.c-toc-drawer.is-open { display: block; }
.c-toc-drawer__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.42); }
.c-toc-drawer .c-toc {
	position: absolute; top: 0; left: 0; height: 100%;
	width: 264px; max-width: 84%;
	/* Right-edge shadow only — negative spread = blur cancels the vertical bleed,
	   so no shadow shows on the top (or bottom) edge. */
	box-shadow: 12px 0 12px -12px rgba(0,0,0,0.40);
}

/* Respect reduced-motion: stop the looping shimmer/pulse for users who ask for it. */
@media (prefers-reduced-motion: reduce) {
	.c-skeleton, .c-creation-banner__dot { animation: none; }
	.c-scope *, .c-scope *::before, .c-scope *::after { transition-duration: 0.01ms !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SCORE-TRENDS CHART  (Exam Results — per-subject % line chart)
   ───────────────────────────────────────────────────────────────────────────
   A small data-viz widget: one inline-SVG line chart per subject (gridlines,
   connecting polyline, grade-coloured dots, −45° date labels). Promoted from
   the live exams.js renderSubjectTrends() — the Dashboard's exam card shows the
   same viz, so it's a genuine reusable widget, not page layout.

   Theme-adaptive parts (gridlines, axis text, dot halo) read tokens via these
   classes; the per-subject LINE colour (subject colour) and per-dot FILL (grade
   --g-bar) are set inline by the caller since they're data, not chrome. Dots add
   a g-* class so the fill can also read var(--g-bar) for the grade colour.
   ═══════════════════════════════════════════════════════════════════════════ */
.c-trends { display: flex; flex-wrap: wrap; gap: var(--space-lg); }
.c-trends__chart { min-width: 0; }
.c-trends__label { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 3px; display: flex; align-items: center; gap: 5px; }
.c-trends__svg { display: block; max-width: 100%; height: auto; }
.c-trends__grid { stroke: var(--border-subtle); stroke-width: 0.75; }
.c-trends__axis { fill: var(--text-muted); font-size: 8px; font-family: inherit; }
.c-trends__date { fill: var(--text-muted); font-size: 9px; font-family: inherit; }
.c-trends__line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; opacity: 0.6; }   /* stroke (subject colour) inline */
.c-trends__dot  { stroke: var(--surface-card); stroke-width: 1.5; }                                            /* fill (grade colour) inline */

/* ═══════════════════════════════════════════════════════════════════════════
   TOPIC-BREAKDOWN BARS  (Exam Results — per-topic average % bar list)
   ───────────────────────────────────────────────────────────────────────────
   A labelled horizontal %-bar list: topic name · track+fill · value. Promoted
   from the live exams.js renderTopicChart(); the Dashboard's "weakest topics"
   surface reuses the same pattern. The fill colour is the grade --g-bar for the
   topic's average — add a g-* class to the fill element so it resolves. Track is
   token-driven (theme-adaptive). Collision-checked: distinct from .c-proximity
   (that's an un-labelled 6px score bar with boundary ticks).
   ═══════════════════════════════════════════════════════════════════════════ */
.c-topic-bars { display: flex; flex-direction: column; gap: 6px; }
.c-topic-bars__row { display: grid; grid-template-columns: 130px 1fr 40px; gap: 8px; align-items: center; }
.c-topic-bars__label { font-size: 11px; color: var(--text-muted); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-topic-bars__track { display: block; height: 10px; border-radius: 3px; background: var(--border-subtle); overflow: hidden; }
/* display:block is load-bearing — the fill is a <span> child of the track (not a
   grid item, so not blockified), and an inline span ignores width/height → the
   bar would render empty. The g-* class on the fill sets --g-bar (grade colour). */
.c-topic-bars__fill { display: block; height: 100%; border-radius: 3px; background: var(--g-bar, var(--secondary)); }
.c-topic-bars__value { font-size: 10px; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════════════
   EXAM PREP  (Stage-3 lock 2026-09-12) — countdown pill · readiness stack
   ───────────────────────────────────────────────────────────────────────────
   The /exams Upcoming tab reuses the two-level accordion (§2) verbatim; only
   these two widgets are new. .c-select-row--tree (§SELECTION) is the scope
   picker; .c-progress-bar__badge marks an exam-track session.
   ═══════════════════════════════════════════════════════════════════════════ */
/* ── .c-countdown — days-to-exam pill, colour-graded by proximity ─────────
   default > 14 d (ice / primary) · --soon ≤ 14 d (orange) · --imminent ≤ 3 d (plum) */
.c-countdown {
	display: inline-flex; align-items: baseline; justify-content: center; gap: 5px; flex-shrink: 0;
	/* Fixed width, text centred (Daniel, S1 QA 2026-09-12): sized for "99+ days" —
	   the display caps at 99+ — so every pill in a column is the same size. */
	width: 86px; box-sizing: border-box;
	border-radius: var(--radius-pill); padding: 4px 8px;
	font-size: 12px; font-weight: 600;
	background: var(--ice); color: var(--primary);
	white-space: nowrap;
}
.c-countdown strong { font-size: 15px; font-weight: 700; }
.c-countdown--soon     { background: #FFF4ED; color: var(--orange); }
.c-countdown--imminent { background: #FDF0F7; color: var(--plum); }
html[data-theme="dark"] .c-countdown          { background: rgba(0,71,171,0.22); color: var(--secondary); }
html[data-theme="dark"] .c-countdown--soon     { background: rgba(232,110,30,0.20); color: var(--orange); }
html[data-theme="dark"] .c-countdown--imminent { background: rgba(148,40,90,0.28); color: #E58BB0; }

/* ── .c-readiness — the coverage stack. Structurally .c-sum-stackbar (7px,
   pill, flex segments on a --border-subtle track) with a third semantic:
   solid · shaky · never-seen (the unpainted remainder of the track). */
.c-readiness { display: flex; height: 7px; border-radius: var(--radius-pill); overflow: hidden; background: var(--border-subtle); width: 100%; }
.c-readiness__seg--solid { background: #22C55E; }
.c-readiness__seg--shaky { background: #EAB308; }
.c-readiness__key { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--text-muted); margin-top: 8px; }
.c-readiness__key span { display: inline-flex; align-items: center; gap: 5px; }
.c-readiness__swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.c-readiness__swatch--solid  { background: #22C55E; }
.c-readiness__swatch--shaky  { background: #EAB308; }
.c-readiness__swatch--unseen { background: var(--border-subtle); }

/* ═══════════════════════════════════════════════════════════════════════════
   ADMIN SYSTEMATISATION  (wave 13) — tab error variant · badge semantics ·
   key/value row · table cell helpers · trends bar-series + legend
   ───────────────────────────────────────────────────────────────────────────
   The live /admin page was entirely bespoke (one big <style> block). These
   additions re-express its widgets in the component system. The dominant risk
   was the theme-fixed-token trap: the live leaned on --ice fills + hardcoded
   badge hex, so every fill here either routes through a THEMED token or carries
   an explicit dark override (mirrors how .c-rating / .g-* handle semantic hex).
   ═══════════════════════════════════════════════════════════════════════════ */

/* Errors tab — plum-tinted underline tab (the live .admin-tab.errors-tab). The
   base .c-tab/.c-tabs (above) is already a 2px underline bar, so this is the one
   semantic colour swap; active state underlines in plum too. */
.c-tab--errors { color: var(--plum); }
.c-tab--errors:hover { color: var(--plum); }
.c-tab--errors.is-active { color: var(--plum); border-bottom-color: var(--plum); }

/* ── Badge semantic modifiers ──────────────────────────────────────────────
   Extend the existing .c-badge (--fc/--rq) with the admin status semantics. The
   blue/plum/orange route through tokens; the green (ok) + red (danger) follow
   the curated-semantic-hex pattern (.c-rating, .g-*) with explicit dark
   overrides — there is no green/red token to point at. */
.c-badge--study { background: var(--ice); color: var(--primary); }            /* Study type · admin tag · audit action */
.c-badge--recall { background: #FDF0F7; color: var(--plum); }                 /* Recall type */
.c-badge--ok { background: #E6F4EA; color: #1A7F3C; }                         /* env YES · login success */
.c-badge--danger { background: #FDE8E8; color: #B91C1C; }                     /* env NO · login failed */
.c-badge--warn { background: #FFF4ED; color: var(--orange); }                 /* suspended */
.c-badge--sm { font-size: 9.5px; padding: 1px 6px; letter-spacing: 0.02em; }  /* inline row tags (admin/suspended) */
html[data-theme="dark"] .c-badge--study { background: rgba(0,71,171,0.18); color: var(--secondary); }
html[data-theme="dark"] .c-badge--recall { background: rgba(148,40,90,0.18); color: #E879B0; }
html[data-theme="dark"] .c-badge--ok { background: rgba(26,127,60,0.18); color: #4ADE80; }
html[data-theme="dark"] .c-badge--danger { background: rgba(185,28,28,0.18); color: #F87171; }
html[data-theme="dark"] .c-badge--warn { background: rgba(232,110,30,0.18); color: #FB923C; }

/* ── Key/value row ─────────────────────────────────────────────────────────
   A label-left / value-right divider row. Promoted (recurs on Overview's System
   Health + DB Snapshot, the System tab's three cards, and likely the Account
   page). Chrome → follows the theme. The --boxed variant is the env-grid chip
   (filled, no divider) that sits in a 2-up grid (the grid is page-local). */
.c-kv-row {
	display: flex; align-items: center; justify-content: space-between;
	gap: var(--space-md); padding: 8px 12px;
	border-bottom: 1px solid var(--border-subtle);
	font-size: 13px;
}
.c-kv-row:last-child { border-bottom: 0; }
.c-kv-row__key { color: var(--text-muted); min-width: 0; }
.c-kv-row__key--mono { font-family: var(--font-mono); font-size: 12px; }
.c-kv-row__val { color: var(--text-body); font-weight: 500; text-align: right; white-space: nowrap; }
.c-kv-row__val--mono { font-family: var(--font-mono); font-size: 12px; font-weight: 400; }
.c-kv-row__val--strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.c-kv-row--boxed {
	border-bottom: 0; border-radius: var(--radius-sm);
	background: var(--surface-editor-left); padding: 7px 10px;
}

/* ── Table cell helpers ────────────────────────────────────────────────────
   Small scoped helpers for the dense admin tables (Users/Activity/Audit/DB).
   --zebra stripes even rows with a THEMED fill (the live used --ice → a
   theme-fixed token, which doesn't darken; here it routes through a token +
   dark override). */
.c-table--zebra tbody tr:nth-child(even) > td { background: var(--surface-editor-left); }
html[data-theme="dark"] .c-table--zebra tbody tr:nth-child(even) > td { background: rgba(255,255,255,0.02); }
.c-table .cell-muted { color: var(--text-muted); }
.c-table .cell-mono { font-family: var(--font-mono); font-size: 12px; }
.c-table .cell-num { text-align: right; font-variant-numeric: tabular-nums; }
.c-table .cell-center { text-align: center; }
.c-table .cell-strong { font-weight: 600; }

/* ── Trends bar-series + legend ────────────────────────────────────────────
   The line classes above stay for line charts (Exam Results). Admin's chart is
   a 2-series grouped vertical BAR chart (signups vs sessions), so this adds the
   bar mark + a legend, keeping ONE .c-trends family. The per-series bar FILL +
   legend-dot colour are set inline (data, like the line stroke). rx is set as a
   <rect> attribute in markup. */
.c-trends__bar { opacity: 0.85; }
.c-trends__legend { display: flex; gap: var(--space-lg); flex-wrap: wrap; margin-top: 4px; }
.c-trends__legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); }
.c-trends__legend-dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }

/* ── Action row ────────────────────────────────────────────────────────────
   A label + sub-label on the left, a trailing action button on the right, in a
   filled inset row. Promoted from the admin user-detail modal (toggle admin /
   suspend / export / delete) because the Account page (p14) has near-identical
   account-action rows. Chrome → follows the theme. The danger button variant
   reuses the curated red (mirrors .c-badge--danger) with a dark override. Must
   sit inside a .c-scope (the __btn height reads --ctl-h-sm). */
.c-action-row {
	display: flex; align-items: center; justify-content: space-between;
	gap: var(--space-md); padding: 10px 12px;
	background: var(--surface-editor-left); border-radius: var(--radius-md);
}
.c-action-row__label { font-size: 13px; font-weight: 500; color: var(--text-body); }
.c-action-row__sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.c-action-row__btn {
	appearance: none; -webkit-appearance: none;
	flex: 0 0 auto; height: var(--ctl-h-sm); padding: 0 12px;
	/* inline-flex centring + no underline so an <a> consumer (admin's Export
	   download link) renders identically to a <button>. */
	display: inline-flex; align-items: center; justify-content: center;
	text-decoration: none;
	border: 1px solid var(--border-normal); border-radius: var(--radius-sm);
	background: var(--surface-card); color: var(--text-body);
	font-family: inherit; font-size: 13px; font-weight: 600;
	cursor: pointer; white-space: nowrap;
	transition: background var(--motion-fast), color var(--motion-fast);
}
.c-action-row__btn:hover { background: var(--surface-hover); }
.c-action-row__btn--danger { border-color: #B91C1C; color: #B91C1C; }
.c-action-row__btn--danger:hover { background: #FDE8E8; }
html[data-theme="dark"] .c-action-row__btn--danger { border-color: #F87171; color: #F87171; }
html[data-theme="dark"] .c-action-row__btn--danger:hover { background: rgba(185,28,28,0.18); }

/* ═══════════════════════════════════════════════════════════════════════════
   STUDY LAUNCHERS  (.c-study-mode, .c-study-row)
   ───────────────────────────────────────────────────────────────────────────
   Promoted 2026-06-10 from the Study-Hub wave (was .sh-mode / .shn page-glue).
   Two consumption surfaces for launching a study session:
     · .c-study-mode — a subject-level launcher CARD (one per mode: Flashcards /
       Written Recall): icon+title, blurb, a Total/Due meta block, a Due/All/
       Shuffle scope segment, and a full-width launch CTA.
     · .c-study-row  — a per-NOTE launch row: note name/date + one or more mode
       groups (icon, "<total> · N due" count, a Study/Recall button).
   Both render counts only (no note content) and MUST sit inside a .c-scope (the
   nested .c-segment / .c-btn read the --ctl-h* control-height tokens). Page
   composition — the grids that place several, the streak chip, narrow stacking —
   stays in the page's own CSS.
   ═══════════════════════════════════════════════════════════════════════════ */

.c-study-mode {
	display: flex; flex-direction: column;
	background: var(--surface-card);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-card);
	padding: var(--space-xl);
}
.c-study-mode__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.c-study-mode__icon {
	width: 34px; height: 34px; flex: 0 0 34px;
	border-radius: var(--radius-sm);
	display: flex; align-items: center; justify-content: center;
	background: var(--ice); color: var(--secondary);
}
html[data-theme="dark"] .c-study-mode__icon { background: #383838; }
.c-study-mode__title { font-size: 16px; font-weight: 700; color: var(--text-body); }
.c-study-mode__desc { font-size: 13px; line-height: 1.5; color: var(--text-muted); margin-bottom: var(--space-lg); }
.c-study-mode__meta {
	display: flex; flex-direction: column; gap: 6px;
	border-top: 1px solid var(--border-subtle);
	padding-top: var(--space-md); margin-bottom: var(--space-lg);
}
.c-study-mode__row { display: flex; justify-content: space-between; font-size: 13px; }
.c-study-mode__row span:first-child { color: var(--text-muted); }
.c-study-mode__row span:last-child { color: var(--text-body); font-weight: 600; }
/* The meta Total + Due values share one colour (text-body) in BOTH themes — the
   per-note row keeps the blue "N due" highlight, but the launcher meta does not,
   so the two figures never diverge across light/dark. */
.c-study-mode__scope { margin-bottom: var(--space-md); }
.c-study-mode__scope .c-segment { width: 100%; }
.c-study-mode__scope .c-segment__btn { flex: 1; text-align: center; }
.c-study-mode__foot { margin-top: auto; }
.c-study-mode__foot .c-btn { width: 100%; }

.c-study-row {
	display: flex; align-items: center; gap: var(--space-lg);
	background: var(--surface-card);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-card);
	padding: var(--space-md) var(--space-lg);
}
.c-study-row__id { flex: 1; min-width: 0; }
.c-study-row__name { font-size: 14px; font-weight: 600; color: var(--text-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-study-row__date { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.c-study-row__modes { display: flex; gap: var(--space-md); flex: 0 0 auto; }
.c-study-row__mode { display: flex; align-items: center; gap: 8px; }
.c-study-row__mode-icon {
	width: 28px; height: 28px; flex: 0 0 28px;
	border-radius: var(--radius-sm);
	display: flex; align-items: center; justify-content: center;
	background: var(--ice); color: var(--secondary);
}
html[data-theme="dark"] .c-study-row__mode-icon { background: #383838; }
.c-study-row__count { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.c-study-row__count strong { color: var(--text-body); }
.c-study-row__count .due { color: var(--primary); }
html[data-theme="dark"] .c-study-row__count .due { color: var(--secondary); }

/* ═══════════════════════════════════════════════════════════════════════════
   §16 · STUDY HISTORY  (.c-hist-*)
   The scoped study-history modal (note / folder / subject scope), opened from a
   History pill or the end-of-session summary. Shell = .c-modal--wide + .c-tabs
   (Flashcards | Written Recall); the body is either a LIST of completed sessions
   or a DRILL-DOWN into one, with a stepper walking sibling sessions.

   Reuses rather than reinvents: session results are .c-result-chip, recall mark
   points are .c-mark-scheme, empty states are .c-empty, and deleting a session
   uses .c-confirm-delete. Only the row / item / face shapes are new here.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Session list ─────────────────────────────────────────────────────────── */
.c-hist-list { display: flex; flex-direction: column; gap: 8px; }

.c-hist-row {
	display: flex; align-items: center; gap: 12px;
	padding: 10px 14px;
	background: var(--surface-card);
	border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
}
.c-hist-row:hover { border-color: var(--dusty); }
.c-hist-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.c-hist-row__date { font-size: 0.9rem; font-weight: 600; color: var(--text-body); }
.c-hist-row__chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.c-hist-row__count { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
.c-hist-row__actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* Narrow (phone / web-mobile): the actions drop under the session they act on. */
.c-hist-row--stacked { flex-direction: column; align-items: stretch; gap: 10px; }
.c-hist-row--stacked .c-hist-row__actions { justify-content: flex-end; }

/* ── Drill-down: the session being read ───────────────────────────────────── */
.c-hist-summary {
	display: flex; align-items: center; justify-content: space-between;
	flex-wrap: wrap; gap: 8px 12px;
	padding: 10px 14px; border-radius: var(--radius-md);
	background: var(--ice);
}
html[data-theme="dark"] .c-hist-summary { background: var(--surface-active); }
.c-hist-summary__date { font-size: 0.9rem; font-weight: 600; color: var(--text-body); }
.c-hist-summary__chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* One reviewed card / answered question */
.c-hist-item {
	background: var(--surface-card);
	border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
	overflow: hidden;
}
.c-hist-item + .c-hist-item { margin-top: 10px; }
.c-hist-item__head {
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	padding: 7px 14px;
	background: var(--surface-page); border-bottom: 1px solid var(--border-subtle);
}
.c-hist-item__counter {
	font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
	color: var(--text-muted);
}

/* A labelled face — front/back of a card, or question / answer / feedback of a
   recall question. Note CONTENT is serif (it is the note's own text); the AI
   feedback face is chrome, so it stays in the UI font. */
.c-hist-face { padding: 10px 14px; }
.c-hist-face + .c-hist-face { border-top: 1px solid var(--border-subtle); }
.c-hist-face__label {
	font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
	color: var(--text-muted);
}
.c-hist-face__label--front { color: var(--secondary); }
.c-hist-face__label--back  { color: #2a9d5c; }
html[data-theme="dark"] .c-hist-face__label--back { color: #4ADE80; }
.c-hist-face__text {
	margin-top: 4px;
	font-family: var(--font-serif); font-size: 0.9rem; line-height: 1.5;
	color: var(--text-body); white-space: pre-wrap;
}
.c-hist-face__text--ui { font-family: var(--font-ui); font-size: 0.85rem; }
.c-hist-face__text--missing { font-style: italic; color: var(--text-muted); }
/* A table block on a face is the note's paper table (black rules, black text), so
   it keeps a paper backing – in dark its unshaded rows would otherwise vanish. */
.c-hist-face__text .block-preview table { background: #fff; }

/* ── Session stepper (modal footer while drilled in) ──────────────────────── */
.c-hist-nav { display: flex; align-items: center; justify-content: center; gap: 14px; }
.c-hist-nav__counter { font-size: 0.8rem; color: var(--text-muted); min-width: 54px; text-align: center; }


/* ═══════════════════════════════════════════════════════════════════════════
   WHITEBOARDS  §16–§18  —  promoted from design/mockups/whiteboards/page.css
   at W0 lock, 2026-09-05. Spec: docs/whiteboards/spec.md.
   ───────────────────────────────────────────────────────────────────────────
   Three new components plus two additive evolutions. Everything else the
   whiteboard needed was already here and is reused unchanged: .c-toolbar /
   .c-tb-btn / .c-tb-divider for the top bar, .c-backlink, .c-menu for all four
   dropdowns, .c-kebab, .c-insert, .c-zoom for the zoom readout, .c-swatch-picker
   and .c-swatch for the colour row, .c-empty, .c-autosave, .c-search, .c-badge,
   and — the one worth calling out — .c-chartoolbar as the lasso selection
   context bar. It was already a floating, elevated, caret-pointing bar hovering
   above a selection; a whiteboard selection is the same problem, so no
   .c-float-bar exists and none should be added.

   THE RULE THAT GOVERNS §16: a whiteboard's canvas has its own light/dark
   setting, stored per whiteboard and INDEPENDENT of the app theme, so all four
   combinations must be legible at once. Every canvas colour is a --cv-* custom
   property declared on .c-canvas--light / .c-canvas--dark and is never read
   from an app-theme token. A --cv-* value declared anywhere else is a bug.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════
   §16 · CANVAS  (whiteboards)
   ═══════════════════════════════════════════════════════════════════════════ */
.c-canvas {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
	background: var(--cv-bg);
	touch-action: none;
}

/* Canvas palettes — self-contained, theme-independent (see the rule above). */
.c-canvas--light {
	--cv-bg: #FBFCFD;
	--cv-guide: #B9CBE4;
	--cv-dot: #C3CEDD;
	--cv-ink: #000000;
}
.c-canvas--dark {
	--cv-bg: #1A1C1F;
	--cv-guide: #454D58;
	--cv-dot: #383D45;
	--cv-ink: #F2F2F7;
}

/* Dot grid — 24.803 × 24.761pt (§3 as amended). Per-axis pitch, because A4's
   √2 aspect ratio means no SQUARE grid can land on both page boundaries; see the
   note in content.js. Origin and pitch are set inline so the dots stay welded to
   the page lattice at any pan or zoom.

   inset is 0, NOT negative: a CSS background tiles from its background-position
   in both directions across the whole box, so an inset would offset the pattern
   by an amount that is not a whole number of cells and quietly break alignment. */
.c-canvas__grid {
	position: absolute;
	inset: 0;
	background-image: radial-gradient(circle, var(--cv-dot) 1.1px, transparent 1.2px);
	pointer-events: none;
}

/* ── A4 PAGE LATTICE (§3 as amended, D4) ──────────────────────────────────────
   Not "some page guides tiling downward" — a 2D lattice of contiguous A4 cells
   covering the whole infinite canvas, in both axes, including negative. That is
   what makes "how many pages?" answerable: as many as you have used. Print then
   becomes selecting cells rather than inferring pages from content.

   Contiguous, with NO gutter: a gap between cells would be canvas that belongs
   to no page, which is the exact problem the lattice removes.

   Two repeating 1px lines rather than a box per page — one element, no DOM
   growth as the canvas extends, and the lines stay 1px at every zoom because
   they are chrome, not content. */
.c-canvas__pages {
	position: absolute;
	inset: 0;
	background-image:
		linear-gradient(to right, var(--cv-guide) 0 1px, transparent 1px),
		linear-gradient(to bottom, var(--cv-guide) 0 1px, transparent 1px);
	background-repeat: repeat, repeat;
	pointer-events: none;
}

/* The panned document layer. Everything in canvas points lives in here, so a
   pan is one transform on one element. */
.c-canvas__doc { position: absolute; }

.c-canvas__ink {
	position: absolute;
	left: 0; top: 0;
	overflow: visible;
	pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   §17 · TOOL RAIL  (whiteboards)
   Two orientations from one component: --v floats over the canvas (iPad, the
   reference), --h sits inline in .c-toolbar (the literal spec §7 layout).
   Buttons are 44px in the floating rail because that is the Pencil/finger tap
   target; .c-tb-btn's 30px toolbar density is too small to draw against.
   ═══════════════════════════════════════════════════════════════════════════ */
.c-tool-rail { display: flex; align-items: center; }
.c-tool-rail__btn {
	border: 0; background: transparent; cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center;
	color: var(--text-body); border-radius: 10px;
	transition: background var(--motion-fast), color var(--motion-fast);
}
.c-tool-rail__btn:hover { background: var(--surface-hover); }
.c-tool-rail__btn.is-active { background: var(--primary); color: #fff; }
.c-tool-rail__btn.is-active:hover { background: var(--primary); filter: brightness(1.08); }

.c-tool-rail--v {
	flex-direction: column; gap: 2px; padding: 5px;
	background: var(--surface-card);
	border: 1px solid var(--border-subtle);
	border-radius: 14px;
	box-shadow: var(--shadow-elevated);
}
.c-tool-rail--v .c-tool-rail__btn { width: 44px; height: 44px; }
.c-tool-rail--v .c-icon { width: 21px; height: 21px; }

.c-tool-rail--h { flex-direction: row; gap: 1px; }
.c-tool-rail--h .c-tool-rail__btn { width: 30px; height: var(--ctl-h-sm); border-radius: 6px; }
.c-tool-rail--h .c-icon { width: 17px; height: 17px; }

html[data-theme="dark"] .c-tool-rail__btn { color: #D1D1D6; }

/* ═══════════════════════════════════════════════════════════════════════════
   §18 · TOOL POPOVER  (whiteboards)
   Opens by tapping the ALREADY-ACTIVE tool a second time (locked 2026-09-05),
   so it costs no permanent canvas height. Width and opacity are the 5-step
   ladders from spec §6 — the one genuinely new idiom in this wave; nothing in
   the library does a graduated step picker.
   ═══════════════════════════════════════════════════════════════════════════ */
.c-tool-popover {
	width: 214px; padding: 10px 12px 12px;
	background: var(--surface-card);
	border: 1px solid var(--border-subtle);
	border-radius: 14px;
	box-shadow: var(--shadow-elevated);
}
.c-tool-popover__head {
	display: flex; align-items: center; gap: 8px;
	font-size: 12.5px; font-weight: 600; color: var(--text-body);
	padding-bottom: 9px; border-bottom: 1px solid var(--border-subtle);
}
.c-tool-popover__head .c-icon { width: 16px; height: 16px; color: var(--primary); }
.c-tool-popover__section { margin-top: 11px; }
.c-tool-popover__label {
	font-size: 9.5px; font-weight: 700; letter-spacing: 0.09em;
	text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px;
}
.c-tool-popover__steps { display: flex; gap: 3px; }
.c-tool-popover__step {
	flex: 1 1 0; height: 30px; border: 0; border-radius: 8px;
	background: transparent; cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center;
}
.c-tool-popover__step:hover { background: var(--surface-hover); }
/* --surface-active-card, not --surface-active: this rung sits on --surface-card,
   and in dark that card (#2C2C2E) is LIGHTER than the nav surface --surface-active
   was tuned against, so the old pairing measured 1.00:1 — identical luminance,
   invisible (Daniel, 2026-09-07). Every other dark .is-active gets away with it by
   also recolouring its text to --secondary; a step rung has no text, only a width
   dot, so the fill is the whole signal. Light is unchanged: the token's light
   value IS --ice. */
.c-tool-popover__step.is-active { background: var(--surface-active-card); }

.c-tool-popover__dot { display: block; border-radius: 50%; background: var(--text-body); }
.c-tool-popover__bar { display: block; width: 17px; height: 13px; border-radius: 3px; background: var(--primary); }
/* ── The eraser's variant ──────────────────────────────────────────────────
   Deliberately NOT the shared popover. Opacity and colour cannot mean anything
   for a tool that REMOVES ink, and this app's rule for an affordance that does
   not apply is that it is ABSENT, not disabled — so the eraser has two sections
   where every other tool has four, and one section (Mode) that no other tool
   has at all. Daniel signed the deviation off on 2026-09-06 when he chose both
   eraser modes; back-synced here 2026-09-07.

   Mirrors CEraserPopover in the native library, which is the same two sections
   in the same order. */
.c-tool-popover__modes { display: flex; gap: 4px; }
.c-tool-popover__mode {
	flex: 1 1 0; height: 26px; border: 0; border-radius: 6px;
	background: transparent; cursor: pointer;
	font: 500 11.5px/1 var(--font-ui); color: var(--text-muted);
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.c-tool-popover__mode:hover { background: var(--surface-hover); }
.c-tool-popover__mode.is-active { background: var(--surface-active-card); color: var(--primary); }
/* A saturated active fill takes near-white content in dark — primary blue on it
   is 1.21:1. The same rule the tool rail's active button follows. */
html[data-theme="dark"] .c-tool-popover__mode.is-active { color: var(--text-body); }

/* The eraser's width preview is a HOLLOW ring, not a filled dot: it takes ink
   away rather than laying it down, and a filled dot reads as ink. */
.c-tool-popover__ring {
	display: block; border-radius: 50%;
	border: 1.2px solid var(--text-body); box-sizing: border-box;
}

.c-tool-popover__recents { display: flex; flex-wrap: wrap; gap: 5px; }
.c-tool-popover__recents .c-swatch { border: 0; padding: 0; cursor: pointer; }
.c-tool-popover .c-swatch-picker { gap: 7px; }
.c-tool-popover .c-swatch-picker__swatch,
.c-tool-popover .c-swatch-picker__custom { width: 24px; height: 24px; }
.c-tool-popover .c-swatch-picker__custom { font-size: 14px; }

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR — WHITEBOARD ROWS  (whiteboards under each subject, below notes)
   Additive only: a sub-heading and a two-line row. Everything above and below
   it in the tree is the untouched .c-sidebar component.
   ═══════════════════════════════════════════════════════════════════════════ */
.c-sidebar__subhead {
	padding: 9px 10px 3px 38px;
	font-size: 9.5px; font-weight: 700; letter-spacing: 0.09em;
	text-transform: uppercase; color: var(--text-muted);
}
/* Deliberately the same shape as .c-sidebar__note — one line, no metadata, no
   affordances — with a whiteboard icon as the only thing distinguishing a
   whiteboard from a note. The sidebar navigates; it does not manage. */
.c-sidebar__whiteboard {
	display: flex; align-items: center; gap: 7px;
	min-height: var(--sb-row-leaf);
	padding: 0 10px 0 var(--sb-x2); cursor: pointer; text-decoration: none;
}
.c-sidebar__whiteboard.in-folder { padding-left: var(--sb-x3); }
.c-sidebar__whiteboard.in-folder.is-active { padding-left: calc(var(--sb-x3) - var(--sb-rule)); }
.c-sidebar__whiteboard:hover { background: var(--surface-hover); }
.c-sidebar__whiteboard-icon { width: 13px; height: 13px; flex: 0 0 auto; color: var(--text-muted); }
.c-sidebar__whiteboard-title {
	font-size: 12.5px; color: #555; line-height: 1.3; min-width: 0;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.c-sidebar__whiteboard--none { padding-left: 38px; font-size: 11.5px; color: var(--text-muted); font-style: italic; cursor: default; }
.c-sidebar__whiteboard--none:hover { background: transparent; }

/* Active whiteboard mirrors .c-sidebar__note.is-active exactly — same fill, same
   3px left rule, same padding compensation. (2026-09-14: the whiteboard row sits
   in the note ladder — same --sb-row-leaf height, same 40 / 62 indents, and the
   13px icon's LEFT edge is where a note's title starts at either depth.) */
.c-sidebar__whiteboard.is-active {
	background: var(--sb-active, var(--surface-active));
	border-left: var(--sb-rule) solid var(--primary);
	padding-left: calc(var(--sb-x2) - var(--sb-rule));
}
.c-sidebar__whiteboard.is-active .c-sidebar__whiteboard-title { color: var(--primary); font-weight: 500; }
.c-sidebar__whiteboard.is-active .c-sidebar__whiteboard-icon { color: var(--primary); }

html[data-theme="dark"] .c-sidebar__whiteboard-title { color: #8E8E93; }
html[data-theme="dark"] .c-sidebar__whiteboard.is-active .c-sidebar__whiteboard-title { color: var(--secondary); }
html[data-theme="dark"] .c-sidebar__whiteboard.is-active .c-sidebar__whiteboard-icon { color: var(--secondary); }

/* ═══════════════════════════════════════════════════════════════════════════
   READ-ONLY BANNER  (.c-creation-banner--info)
   Same pill, informational rather than in-progress: blue instead of orange, and
   no pulsing dot, because nothing is happening. --ice and --pale are theme-fixed
   so the dark values are explicit.
   ═══════════════════════════════════════════════════════════════════════════ */
.c-creation-banner--info {
	color: var(--primary);
	background: var(--ice);
	border-color: var(--pale);
}
.c-creation-banner--info .c-icon { width: 14px; height: 14px; }
html[data-theme="dark"] .c-creation-banner--info {
	background: rgba(0, 71, 171, 0.20);
	border-color: rgba(77, 126, 196, 0.45);
	color: var(--secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   § TABLE WORKSPACE  (.c-tw-*)  — W10 Phase A, LOCKED 2026-09-22
   ───────────────────────────────────────────────────────────────────────────
   The note table editor: a near-full-screen workspace replacing the old 980px
   .c-te-* modal. The load-bearing split is that the TOOLBAR carries structural
   verbs only (insert, delete, merge, split, zoom) and everything cosmetic lives
   in the Cell / Row / Column / Table inspector — so each new feature lands as an
   inspector ROW rather than another toolbar button.

   Frames: design/mockups/note-editor/states.html, B1–B11.
   Markup:  static/js/table-workspace.js.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Shell — near-full-screen, replacing the 980px .c-te-modal ─────────────── */
.c-tw-modal {
	width: 96%; height: 94%; background: var(--surface-card);
	border-radius: 14px; overflow: hidden; display: flex; flex-direction: column;
	box-shadow: 0 20px 60px rgba(0,0,0,0.16), 0 4px 16px rgba(0,0,0,0.08);
}
.c-tw-modal__header {
	display: flex; align-items: center; justify-content: space-between;
	padding: 12px 18px; border-bottom: 1px solid var(--border-subtle); flex-shrink: 0;
}
.c-tw-modal__title { font-size: 15px; font-weight: 700; color: var(--text-body); }
.c-tw-modal__subtitle { font-size: 12px; font-weight: 400; color: var(--text-muted); }

/* ── Toolbar — STRUCTURAL verbs only; everything cosmetic lives in the
      inspector. That split is what stops this becoming a Word ribbon. ─────── */
.c-tw-bar {
	display: flex; align-items: center; gap: 6px; padding: 7px 14px;
	background: var(--fill-input); border-bottom: 1px solid var(--border-subtle);
	flex-shrink: 0;
}
.c-tw-btn {
	display: inline-flex; align-items: center; gap: 5px;
	background: var(--surface-card); border: 1px solid var(--border-normal);
	border-radius: 7px; font-family: var(--font-ui); font-size: 12px; font-weight: 500;
	color: var(--text-body); padding: 5px 9px; cursor: pointer; white-space: nowrap;
}
.c-tw-btn:disabled { opacity: 0.34; cursor: default; }
.c-tw-btn--primary { color: var(--primary); background: var(--surface-active); border-color: #B3CAEF; }
.c-tw-btn--danger  { color: #B91C1C; background: #FFF5F5; border-color: #FECACA; }
.c-tw-btn__caret { font-size: 8px; opacity: 0.55; margin-left: 1px; }
.c-tw-sep { width: 1px; height: 19px; background: var(--border-subtle); margin: 0 3px; flex-shrink: 0; }
.c-tw-spacer { flex: 1; }
.c-tw-hint { font-size: 11px; font-style: italic; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Below iPad-landscape width the hint is the first thing to go: it is a
   convenience, and wrapping it to three lines costs 12px of toolbar height. */
@media (max-width: 900px) { .c-tw-hint { display: none; } }

/* Zoom stepper — the direct answer to "too small to read": read at 150%,
   check layout at 100%. The grid is ALWAYS true page width underneath. */
.c-tw-zoom { display: inline-flex; align-items: center; border: 1px solid var(--border-normal); border-radius: 7px; overflow: hidden; background: var(--surface-card); }
.c-tw-zoom__btn { border: 0; background: transparent; width: 24px; height: 25px; font-size: 13px; color: var(--text-body); cursor: pointer; }
.c-tw-zoom__val { font-size: 11.5px; font-weight: 600; color: var(--text-body); min-width: 42px; text-align: center; border-left: 1px solid var(--border-subtle); border-right: 1px solid var(--border-subtle); line-height: 25px; }

/* ── Body: scrolling grid canvas + fixed inspector ─────────────────────────── */
.c-tw-body { flex: 1; display: flex; min-height: 0; }
.c-tw-canvas { flex: 1; min-width: 0; overflow: auto; padding: 22px 18px; background: var(--ice); }
html[data-theme="dark"] .c-tw-canvas { background: #2C2C2E; }

/* ── The grid — a real <table>, so colspan/rowspan are honest ──────────────── */
.c-tw-grid { border-collapse: collapse; table-layout: fixed; }
/* 30px row gutter + the 650px of usable page width (A4 less 0.75in margins) —
   what the workspace sets; it used to say 794 and the JS overrode it inline. */
.c-tw-grid--chrome { width: 680px; background: var(--surface-card); }

/* Corner + header gutters (shared by both concepts) */
.c-tw-corner { width: 30px; height: 24px; background: var(--fill-input); border: 1px solid var(--border-normal); }
.c-tw-ch, .c-tw-rh {
	background: var(--fill-input); border: 1px solid var(--border-normal);
	font-family: var(--font-ui); font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em;
	text-transform: uppercase; color: var(--text-muted); text-align: center;
	cursor: pointer; user-select: none; position: relative;
}
.c-tw-ch { height: 24px; }
.c-tw-rh { width: 30px; }
.c-tw-ch--sel, .c-tw-rh--sel { background: var(--surface-active); color: var(--primary); }
/* Live px readout while dragging an edge — problem 3's other half */
.c-tw-ch__w {
	position: absolute; top: -21px; left: 50%; transform: translateX(-50%);
	background: var(--primary); color: #fff; font-size: 9.5px; font-weight: 700;
	padding: 2px 6px; border-radius: 4px; letter-spacing: 0; white-space: nowrap;
}
.c-tw-ch__w::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -3px; border: 3px solid transparent; border-top-color: var(--primary); }

/* Concept B cells — editor chrome, SANS UI font (Daniel's call) */
/* Our selection ring IS the focus indicator here: the browser's own outline sat
   on top of it and read as a second, competing highlight (QA round 1, item 14). */
.c-tw-cell:focus, .c-tw-cell:focus-visible { outline: none; }
.c-tw-cell {
	border: 1px solid #D8D8D8; font-family: var(--font-ui); font-size: 12.5px;
	line-height: 1.45; color: var(--text-body); background: var(--surface-card);
	padding: 6px 8px; vertical-align: top; height: 30px;
	/* Same contract as the rendered table: long words break rather than spill
	   over the next cell, and anything that still cannot fit is clipped. */
	overflow: hidden; overflow-wrap: break-word;
}
html[data-theme="dark"] .c-tw-cell { border-color: #3A3A3C; background: #2C2C2E; }
.c-tw-cell--head { font-weight: 700; background: #F0F4FF; }
html[data-theme="dark"] .c-tw-cell--head { background: var(--surface-active); }
.c-tw-cell--fill { background: var(--pt-powder); color: #000; }
.c-tw-cell--centre { text-align: center; }
/* A cell's List, Indent and Accent (block-table-cells, B-D47, frame B5): the
   rendered table's geometry – marker at the cell's edge, its text one step in,
   each indent a step more – in the app's theme, since the workspace is UI, not
   paper: body text, and Primary accent (Secondary in dark, for contrast). */
.c-tw-cell { --b-text: var(--text-body); --b-acc: var(--primary); }
html[data-theme="dark"] .c-tw-cell { --b-acc: var(--secondary); }
.c-tw-cell--indent { padding-left: calc(8px + var(--b-in, 0) * 1.5em); }
.c-tw-cell--list { padding-left: calc(8px + var(--b-in, 0) * 1.5em + 1.5em); text-indent: -1.5em; }
.c-tw-cell--list::before { content: attr(data-list-num); display: inline-block; width: 1.5em; text-indent: 0; }
.c-tw-cell--question { text-decoration: underline; }
.c-tw-cell--question::before { content: "Q. "; }
.c-tw-cell--accent { color: var(--b-acc); }
/* A filled cell is paper-coloured in both themes, so its accent is the paper's */
.c-tw-cell--fill.c-tw-cell--accent { color: var(--pt-blue); }

/* Selection ring — identical in both concepts, so the SELECTION idiom is the
   one thing that does not change between them. */
/* One primary line, no inner glow (QA round 2, Daniel); 2px — 1.5px anti-aliased
   to a faint line on the web while native's 1.5×zoom read well. Qualified with
   .c-tw-cell so it beats `.c-tw-cell:focus { outline: none }` above — that rule
   used to erase the ring on the very cell being edited, so the web never showed it. */
.c-tw-cell.c-tw-cell--sel, .c-tw-cell.c-tw-cell--sel:focus {
	outline: 2px solid var(--primary); outline-offset: -2px;
}

/* ── Inspector — the whole Word suite without a ribbon. Every future feature
      is a ROW here, not another toolbar button. ───────────────────────────── */
.c-tw-insp {
	width: 252px; flex: 0 0 252px; border-left: 1px solid var(--border-subtle);
	background: var(--surface-card); display: flex; flex-direction: column; overflow: hidden;
}
.c-tw-insp__tabs { display: flex; border-bottom: 1px solid var(--border-subtle); flex-shrink: 0; }
.c-tw-insp__tab {
	flex: 1; border: 0; background: transparent; padding: 9px 0;
	font-family: var(--font-ui); font-size: 11.5px; font-weight: 600; color: var(--text-muted);
	cursor: pointer; border-bottom: 2px solid transparent;
}
.c-tw-insp__tab--on { color: var(--primary); border-bottom-color: var(--primary); }
.c-tw-insp__scroll { flex: 1; overflow-y: auto; padding: 14px 15px 18px; }
.c-tw-insp__sec { margin-bottom: 15px; }
.c-tw-insp__sec + .c-tw-insp__sec { border-top: 1px solid var(--border-subtle); padding-top: 13px; }
.c-tw-insp__lab { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.c-tw-insp__note { font-size: 11px; color: var(--text-muted); font-style: italic; margin-top: 6px; }
.c-tw-select {
	width: 100%; border: 1px solid var(--border-normal); border-radius: 7px;
	background: var(--surface-card); color: var(--text-body);
	font-family: var(--font-ui); font-size: 12px; padding: 6px 9px; cursor: pointer;
	display: flex; align-items: center; justify-content: space-between;
}

/* Segmented control — align, vertical align, rotation */
.c-tw-seg { display: flex; border: 1px solid var(--border-normal); border-radius: 7px; overflow: hidden; }
.c-tw-seg__btn {
	flex: 1; border: 0; background: var(--surface-card); color: var(--text-body);
	font-family: var(--font-ui); font-size: 12px; padding: 5px 0; cursor: pointer;
	border-right: 1px solid var(--border-subtle);
}
.c-tw-seg__btn:last-child { border-right: 0; }
/* A segment that cannot apply here (Borders ▸ Inside on a single cell) — the
   toolbar buttons' disabled treatment. Tier 2 design pass, B14. */
.c-tw-seg__btn:disabled { opacity: 0.34; cursor: default; }
.c-tw-seg__btn--on { background: var(--surface-active); color: var(--primary); font-weight: 700; }
/* --fit: widths follow the labels instead of equal shares, for a row whose labels
   differ a lot in length ("First column styled" / "Plain" clipped at 111px each). */
.c-tw-seg--fit .c-tw-seg__btn { flex: 1 1 auto; padding: 5px 8px; white-space: nowrap; }

/* Fill / colour swatches — RESTRICTED to the 10 palette tokens + Other */
.c-tw-swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.c-tw-swatch { width: 26px; height: 22px; border-radius: 5px; border: 1px solid rgba(0,0,0,0.20); cursor: pointer; position: relative; }
.c-tw-swatch--none { background: var(--surface-card); }
/* The strike runs corner to corner: a "to top right" gradient puts its 50% line
   exactly on the top-left → bottom-right diagonal, whatever the box's aspect.
   (It was a rotated border-top on an inset box — off centre and short.) */
.c-tw-swatch--none { background: linear-gradient(to top right, transparent calc(50% - 0.6px), #C00 calc(50% - 0.6px), #C00 calc(50% + 0.6px), transparent calc(50% + 0.6px)), var(--surface-card); }
.c-tw-swatch--on { outline: 2px solid var(--primary); outline-offset: 1px; }
.c-tw-swatch--other { display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--text-muted); background: var(--fill-input); width: auto; padding: 0 8px; }

.c-tw-check { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-body); cursor: pointer; }
.c-tw-check__box { width: 15px; height: 15px; border-radius: 4px; border: 1px solid var(--border-normal); background: var(--surface-card); flex-shrink: 0; }
.c-tw-check__box--on { background: var(--primary); border-color: var(--primary); position: relative; }
.c-tw-check__box--on::after { content: "✓"; position: absolute; inset: 0; color: #fff; font-size: 10px; line-height: 15px; text-align: center; }

.c-tw-merge { display: flex; gap: 6px; }
.c-tw-merge .c-tw-btn { flex: 1; justify-content: center; }
.c-tw-state { font-size: 12px; color: var(--text-body); background: var(--fill-input); border-radius: 6px; padding: 6px 9px; }

.c-tw-footer {
	display: flex; align-items: center; justify-content: space-between;
	padding: 10px 18px; border-top: 1px solid var(--border-subtle); flex-shrink: 0;
}
.c-tw-footer__meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.c-tw-footer__actions { display: flex; gap: 8px; }

/* Concept B chosen 2026-09-22 — the surfaces the full set needs on top of the
   shared chrome above. (The .c-tw-paper / .c-tw-handle rules stay only for the
   rejected B/C frame kept at the end of states.html for the record.) */

/* A whole row or column selected from its gutter: every cell in the run is
   tinted, and the run is ringed as one object — so "this applies to the row"
   is visible before you touch the inspector. */
.c-tw-cell--insel { background: var(--surface-active); }
html[data-theme="dark"] .c-tw-cell--insel { background: var(--surface-active); }
.c-tw-cell--runstart { box-shadow: inset 2px 0 0 var(--primary), inset 0 2px 0 var(--primary), inset 0 -2px 0 var(--primary); }
.c-tw-cell--runmid   { box-shadow: inset 0 2px 0 var(--primary), inset 0 -2px 0 var(--primary); }
.c-tw-cell--runend   { box-shadow: inset -2px 0 0 var(--primary), inset 0 2px 0 var(--primary), inset 0 -2px 0 var(--primary); }
.c-tw-cell--coltop   { box-shadow: inset 2px 0 0 var(--primary), inset -2px 0 0 var(--primary), inset 0 2px 0 var(--primary); }
.c-tw-cell--colmid   { box-shadow: inset 2px 0 0 var(--primary), inset -2px 0 0 var(--primary); }
.c-tw-cell--colbot   { box-shadow: inset 2px 0 0 var(--primary), inset -2px 0 0 var(--primary), inset 0 -2px 0 var(--primary); }
/* Whole table selected (Table tab) — ring the grid, tint nothing. */
.c-tw-grid--sel { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Numeric field — column width / row height */
.c-tw-num {
	display: flex; align-items: center; gap: 6px;
}
.c-tw-num__input {
	flex: 1; border: 1px solid var(--border-normal); border-radius: 7px;
	background: var(--surface-card); color: var(--text-body);
	font-family: var(--font-ui); font-size: 12px; padding: 6px 9px;
}
/* Its own focus style, in place of the browser's ring (text-field-focus-style) */
.c-tw-num__input:focus { outline: none; border-color: var(--secondary); }
.c-tw-num__unit { font-size: 11px; color: var(--text-muted); }

/* Inspector empty state — shown on the Cell tab with nothing selected */
.c-tw-insp__empty { font-size: 12px; color: var(--text-muted); text-align: center; padding: 28px 10px; line-height: 1.6; }

/* A dropdown hung off a toolbar button (positioned inline per frame) */
.c-tw-menu-pos { position: absolute; z-index: 40; }
.c-tw-menu-pos .c-menu { min-width: 186px; }
.c-menu__sep { height: 1px; background: var(--border-subtle); margin: 4px 0; }
.c-menu__key { float: right; color: var(--text-muted); font-size: 11px; font-family: var(--font-mono); }

/* Tier marker — every control the Tier-2 wave adds is drawn here but tagged, so
   the surface is designed ONCE and built in two passes. */
.c-tw-t2 {
	display: inline-block; margin-left: 5px; padding: 1px 5px; border-radius: 4px;
	background: var(--fill-input); color: var(--text-muted);
	font-family: var(--font-ui); font-size: 9px; font-weight: 700; letter-spacing: 0.06em;
	vertical-align: 1px;
}
.c-tw-btn--t2, .c-tw-seg__btn--t2 { opacity: 0.5; }

/* The workspace scrolls horizontally when the table is wider than the canvas.
   The row gutter is sticky so you never lose which row you are on. */
.c-tw-rh { position: sticky; left: 0; z-index: 2; }

/* A cell FILL is paper, not chrome: a Powder Blue cell is Powder Blue in both
   themes and keeps black text with it. Without this the dark .c-tw-cell rule wins
   on background (it is more specific) while .c-tw-cell--fill keeps color:#000 —
   black on #2C2C2E. The fill and the ink it implies must move together. */
html[data-theme="dark"] .c-tw-cell--fill { background: var(--pt-powder); color: #000; }

/* ── Excel-style crosshair (Daniel, 2026-09-22) ────────────────────────────────
   The selected cell lights its OWN column letter and row number, so you can
   always read off where you are in a wide table. Two strengths, deliberately
   different: --cross is the passive "you are here" tint; --sel is the active
   "this whole run is selected" state, which is a solid fill. */
.c-tw-ch--cross, .c-tw-rh--cross { background: var(--surface-active); color: var(--primary); }
.c-tw-ch--cross { box-shadow: inset 0 -2px 0 var(--primary); }
.c-tw-rh--cross { box-shadow: inset -2px 0 0 var(--primary); }
.c-tw-ch--sel, .c-tw-rh--sel { background: var(--primary); color: #fff; box-shadow: none; }
/* Dark: the library's usual primary→secondary swap for ACTIVE text (as
   .c-dropdown__item.is-active, .c-nav-link.is-active). --primary on
   --surface-active is unreadable in dark: the selected segments, the active
   inspector tab, the Insert button and the crosshair's letter/number were all
   dark blue on dark (Daniel, 2026-09-23). The fills and the primary indicator
   lines are unchanged; only the text moves. A --sel header keeps its white. */
html[data-theme="dark"] .c-tw-btn--primary,
html[data-theme="dark"] .c-tw-insp__tab--on,
html[data-theme="dark"] .c-tw-seg__btn--on,
html[data-theme="dark"] .c-tw-ch--cross:not(.c-tw-ch--sel),
html[data-theme="dark"] .c-tw-rh--cross:not(.c-tw-rh--sel) { color: var(--secondary); }
/* The light theme's pale-blue edge (#B3CAEF) read as a WHITE rim on the dark
   fill (QA round 2, item 11): in dark the primary button takes the ordinary edge. */
html[data-theme="dark"] .c-tw-btn--primary { border-color: var(--border-normal); }
/* Danger buttons (Delete ▼, Clear all cell formatting) had the same fault — a pale
   pink fill and edge meant for the light theme. Dark: a red tint, the ordinary edge,
   and a lighter red for the text (Daniel, QA round 2). */
html[data-theme="dark"] .c-tw-btn--danger { color: #F87171; background: rgba(185,28,28,0.16); border-color: var(--border-normal); }

/* ── On-demand help (Daniel, 2026-09-22) ──────────────────────────────────────
   The always-on italic note under every control was clutter. The explanation is
   kept, but folded behind an ⓘ on the section label and shown on hover/tap, so
   the resting panel is just controls. */
.c-tw-info {
	width: 13px; height: 13px; margin-left: 5px; padding: 0;
	border: 1px solid var(--border-normal); border-radius: 50%;
	background: transparent; color: var(--text-muted);
	font-family: var(--font-ui); font-size: 9px; font-weight: 700; line-height: 1;
	letter-spacing: 0; text-transform: none; vertical-align: 1px;
	display: inline-flex; align-items: center; justify-content: center; cursor: help;
}
.c-tw-info:hover { border-color: var(--primary); color: var(--primary); }
.c-tw-info--on { border-color: var(--primary); background: var(--primary); color: #fff; }
/* TAP, not hover, is the mechanism: the glyph is a real button and a tap/click
   toggles the popover, because iPad is one of the three editing surfaces and
   neither :hover nor a title= attribute exists on touch. Hover is layered on
   top for pointer devices only, as a convenience — never as the only way in. */
@media (hover: none) {
	.c-tw-info:hover { border-color: var(--border-normal); color: var(--text-muted); }
}
/* 13px is a legible glyph but an illegal tap target (HIG minimum 44pt). The
   button stays 13px; an invisible ::after grows the HIT AREA to 44x44 without
   touching layout. */
.c-tw-info { position: relative; }
.c-tw-info::after { content: ""; position: absolute; top: 50%; left: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); }
.c-tw-pop {
	position: absolute; z-index: 30; width: 208px; padding: 9px 11px;
	background: var(--surface-card); border: 1px solid var(--border-normal);
	border-radius: 9px; box-shadow: 0 6px 20px rgba(0,0,0,0.16);
	font-family: var(--font-ui); font-size: 11.5px; line-height: 1.55; color: var(--text-body);
}
/* The popover is clamped to the workspace, never the inspector: on a narrow
   iPad panel it flips below its label rather than off the left edge. */
.c-tw-pop--below { position: static; width: auto; margin-top: 7px; box-shadow: none; }
.c-tw-pop__close {
	display: none; float: right; margin: -2px -3px 0 6px; width: 20px; height: 20px;
	border: 0; border-radius: 50%; background: var(--fill-input); color: var(--text-muted);
	font-size: 11px; line-height: 1; cursor: pointer;
}
@media (hover: none) { .c-tw-pop__close { display: block; } }

/* Auto/px pair — the checkbox and the field are one control: typing a number
   clears Auto, ticking Auto clears the number. */
.c-tw-autorow { display: flex; align-items: center; gap: 9px; }
/* The field takes only what it needs: as flex:1 it grew until the Auto tick was
   pushed out of the panel entirely (QA round 1, items 22/23). */
.c-tw-autorow .c-tw-num { flex: 0 0 auto; }
.c-tw-autorow .c-tw-num__input { width: 62px; }
.c-tw-autorow .c-tw-check { flex: 0 0 auto; white-space: nowrap; }
.c-tw-num__input::placeholder { color: var(--text-muted); opacity: 0.7; }
.c-tw-num__input:disabled { background: var(--fill-input); color: var(--text-muted); }

/* Resize strips on the gutters. Geometry lives here rather than inline so touch
   can widen the HIT area without changing how it looks: a 7px strip is fine for
   a cursor and unhittable with a finger. */
.c-tw-colrh { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 3; touch-action: none; }
.c-tw-rowrh { position: absolute; left: 0; bottom: -3px; height: 7px; width: 100%; cursor: row-resize; z-index: 3; touch-action: none; }
@media (pointer: coarse) {
	.c-tw-colrh { width: 20px; right: -10px; }
	.c-tw-rowrh { height: 20px; bottom: -10px; }
}


/* ═══════════════════════════════════════════════════════════════════════════
   §PAGE PICKER · .wb-pagepick / .wb-cell — the A4 lattice
   W5's export picker (locked frame 10), promoted VERBATIM from whiteboard.css at
   W11 Phase B so the note editor's whiteboard-snapshot picker (note-editor
   frames B25/B29) shares it — static/js/page-picker.js drives both. The names
   keep their wb- prefix: renaming would touch every locked W5 frame for nothing.
   ═══════════════════════════════════════════════════════════════════════════ */
/* ── Export page picker (W5, 2026-09-14) — verbatim from page.css §10 ─────
   Each cell previews the REAL document clipped to that cell, so what is ticked
   is literally what prints. Empty cells are shown but unticked — the lattice is
   infinite, so the picker offers a ring of empties around the used region
   rather than pretending they do not exist. */
/* CENTRED, not the mockup's flex-start (Daniel, iPad QA 2026-09-14): the frame
   was drawn in a body only slightly wider than three cells and never showed a
   lattice narrower than its container; left-aligned in the real 480px body a
   3-column grid sat 82px off-centre. Cells keep the frame's 126px. */
.wb-pagepick { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.wb-cell {
	position: relative; padding: 0; border: 0; background: transparent;
	cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px;
	font: inherit;
}
.wb-cell__paper {
	position: relative; display: block; overflow: hidden;
	background: var(--surface-card);
	border: 1.5px solid var(--border-subtle);
	border-radius: 3px;
}
.wb-cell__inner { position: absolute; transform-origin: 0 0; pointer-events: none; }
.wb-cell__inner svg { position: absolute; left: 0; top: 0; overflow: visible; }
.wb-cell.is-selected .wb-cell__paper { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0,71,171,0.16); }
/* An empty cell is drawn as what it actually is — a blank white sheet — marked
   by a dashed edge and an unticked badge, NOT by opacity. Fading white paper to
   55% turns it into a solid grey slab on a dark modal, which reads as "filled".
   Honesty and theme-safety happen to be the same fix here. */
.wb-cell.is-empty .wb-cell__paper { border-style: dashed; border-color: var(--border-normal); }
.wb-cell:hover .wb-cell__paper { border-color: var(--secondary); }
/* The badge sits ON the white paper, so its unselected colours are FIXED, not
   theme tokens: --surface-card is dark in dark mode and would put a black blob
   on a white page. Same trap as --ice/--pale, arrived at from the other side —
   anything overlaying always-white paper is outside the theme system. */
.wb-cell__tick {
	position: absolute; top: 6px; right: 6px;
	width: 17px; height: 17px; border-radius: 50%;
	border: 1.5px solid #C4CFDD; background: #FFFFFF;
	font-size: 11px; line-height: 14px; color: transparent;
}
.wb-cell.is-selected .wb-cell__tick { background: var(--primary); border-color: var(--primary); color: #fff; }
.wb-cell__label { font-size: 10px; color: var(--text-muted); }
.wb-cell.is-selected .wb-cell__label { color: var(--primary); font-weight: 600; }
.wb-pagepick__note { font-size: 11.5px; color: var(--text-muted); margin: 12px 0 4px; line-height: 1.5; }
/* Paper is white in BOTH app themes and for a dark canvas alike: export renders
   onto paper, and paper is white. A dark canvas is a screen-reading preference,
   not a property of the document — so the preview must not show dark pages, or
   it would promise an export nobody wants and no printer would produce. */
.wb-cell__paper { background: #FFFFFF; }
/* Text elements previewed on white paper keep black text whatever the canvas
   theme, for the same reason (the dark-canvas colour rule is scoped to
   .c-canvas--dark, which the picker is outside of). */
.wb-cell__inner .wb-textel,
.wb-cell__inner .wb-imgel { position: absolute; }
/* W11 Phase B (B25, LOCKED): a snapshot is a rectangle, so a page inside the
   ticks' bounding rectangle that was not ticked is FILLED IN — part of the
   picture: dashed primary paper, an outline tick, the label "filled in". */
.wb-cell.is-filled .wb-cell__paper { border-color: var(--primary); border-style: dashed; box-shadow: 0 0 0 2px rgba(0,71,171,0.10); }
.wb-cell.is-filled .wb-cell__tick { border-color: var(--primary); color: var(--primary); background: #FFFFFF; }
.wb-cell.is-filled .wb-cell__label { color: var(--primary); font-style: italic; }
html[data-theme="dark"] .wb-cell.is-filled .wb-cell__label { color: var(--secondary); }

/* ═══════════════════════════════════════════════════════════════════════════
   § GRAPH EDITOR + GRAPH BLOCK  (.c-gr-*)  — G0 mockups, LOCKED 2026-10-24
   ───────────────────────────────────────────────────────────────────────────
   The graph editor is the TABLE WORKSPACE's shell (.c-tw-modal / .c-tw-bar /
   .c-tw-body / .c-tw-canvas / .c-tw-insp): the live preview on white paper on
   the left, an Items | Axes inspector (360px, wider than the table's 252px) on
   the right, Cancel · title · Save in the header (G-D13). These are the parts
   it adds: the start step, item rows, the formula field, point values and
   references, canvas overlays (handles, magnet rings, chips), the floating
   piece bar and popovers, the data table, and the note block's row + page.
   Decisions: docs/graphingTools/spec.md G-D12…G-D18.
   Frames:   design/mockups/graphs/ (G1…, S1…, B1…, P1, F1).
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── The editor shell: .c-tw-modal, header carries Cancel · title · Save ──── */
.c-gr-modal { width: 96%; height: 94%; position: relative; }
.c-gr-modal--sheet { width: 100%; height: calc(100% - 26px); border-radius: 14px 14px 0 0; }
.c-gr-modal--mac { width: 94%; height: 96%; border-radius: 0 0 12px 12px; align-self: flex-start; }
.c-gr-head { gap: 12px; }
.c-gr-head .c-btn { flex: 0 0 auto; }
.c-gr-title { flex: 1; min-width: 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.c-gr-title__name { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; color: var(--text-body); border-bottom: 1px dashed transparent; padding: 1px 2px; cursor: text; }
.c-gr-title__name:hover, .c-gr-title__name.is-editing { border-bottom-color: var(--dusty); }
.c-gr-title__name .c-icon { width: 12px; height: 12px; color: var(--text-muted); }
.c-gr-title__kind { font-size: 11.5px; color: var(--text-muted); }
/* Cancel and Save draw as the table editor's (.c-btn-sm, 30px; Daniel, 29 Oct 2026): the 44px
   tap area grows outwards, invisible, as the toolbar's does */
.c-gr-touch .c-gr-head .c-btn { position: relative; }
.c-gr-touch .c-gr-head .c-btn::after { content: ""; position: absolute; left: -6px; right: -6px; top: 50%; height: 44px; transform: translateY(-50%); }

/* The save sweep under the header (W7's bar, as the image row's track). */
.c-gr-sweep { position: absolute; left: 0; right: 0; top: 60px; height: 3px; overflow: hidden; background: var(--surface-active); z-index: 5; }
.c-gr-sweep::after { content: ""; position: absolute; top: 0; bottom: 0; width: 30%; background: var(--primary); animation: c-image-row-sweep 1.2s ease-in-out infinite; }
.c-gr-inert { opacity: 0.55; pointer-events: none; }
.c-gr-banner { display: flex; align-items: center; gap: 10px; padding: 8px 18px; border-bottom: 1px solid var(--border-subtle); background: #FFF5F8; flex-shrink: 0; }
html[data-theme="dark"] .c-gr-banner { background: rgba(148,40,90,0.18); }
.c-gr-banner .c-inline-error { width: auto; flex: 1; }

/* ── Toolbar: structural verbs + the schematic tools ─────────────────────── */
.c-gr-tools { display: inline-flex; border: 1px solid var(--border-normal); border-radius: 8px; overflow: hidden; background: var(--surface-card); }
.c-gr-tool { display: inline-flex; align-items: center; gap: 5px; border: 0; border-right: 1px solid var(--border-subtle); background: transparent; color: var(--text-body); font-family: var(--font-ui); font-size: 12px; font-weight: 500; padding: 5px 10px; cursor: pointer; white-space: nowrap; }
.c-gr-tool:last-child { border-right: 0; }
.c-gr-tool svg { width: 15px; height: 15px; }
.c-gr-tool.is-on { background: var(--surface-active); color: var(--primary); font-weight: 700; }
.c-gr-touch .c-gr-tool, .c-gr-touch .c-tw-btn { min-height: 44px; padding-left: 12px; padding-right: 12px; }
/* In the toolbar the buttons draw as the table editor's (Daniel, 29 Oct 2026): the 44px tap area
   grows outwards, invisible, so the bar keeps the table editor's height */
.c-gr-touch .c-tw-bar .c-tw-btn { min-height: 0; padding-left: 9px; padding-right: 9px; position: relative; }
.c-gr-touch .c-tw-bar .c-gr-tool { min-height: 0; padding-left: 10px; padding-right: 10px; position: relative; }
.c-gr-touch .c-tw-bar .c-tw-btn::after, .c-gr-touch .c-tw-bar .c-gr-tool::after { content: ""; position: absolute; left: -3px; right: -3px; top: 50%; height: 44px; transform: translateY(-50%); }
.c-gr-touch .c-tw-bar .c-gr-tool::after { left: 0; right: 0; }
.c-gr-touch .c-tw-bar .c-gr-tools { overflow: visible; }   /* hidden would clip the tap areas */
.c-gr-touch .c-tw-bar .c-gr-tool:first-child { border-radius: 7px 0 0 7px; }
.c-gr-touch .c-tw-bar .c-gr-tool:last-child { border-radius: 0 7px 7px 0; }
/* An open item's Duplicate and Delete draw at Cancel and Save's height (30px; Daniel, 30 Oct 2026):
   the 44px tap area grows outwards, invisible, as the header's does */
.c-gr-touch .c-gr-item__foot .c-tw-btn { min-height: 0; height: var(--ctl-h-sm); position: relative; }
.c-gr-touch .c-gr-item__foot .c-tw-btn::after { content: ""; position: absolute; left: -6px; right: -6px; top: 50%; height: 44px; transform: translateY(-50%); }

/* ── The canvas: the graph on a paper card, overlays in graph pixels ─────── */
.c-gr-canvas { display: flex; align-items: center; justify-content: center; position: relative; }
.c-gr-paper { position: relative; background: #FFFFFF; box-shadow: 0 1px 4px rgba(0,0,0,0.13); padding: 14px; line-height: 0; }
.c-gr-paper img { display: block; }
.c-gr-paper--dim img { opacity: 0.38; filter: grayscale(0.6); }
.c-gr-ov { position: absolute; left: 14px; top: 14px; overflow: visible; pointer-events: none; }
.c-gr-ov .ring { fill: rgba(0,71,171,0.10); stroke: #0047AB; stroke-width: 1.6; stroke-dasharray: 3 2.5; }
.c-gr-ov .ring--hot { fill: rgba(0,71,171,0.22); stroke-dasharray: none; stroke-width: 2.2; }
.c-gr-ov .ring--bad { fill: rgba(148,40,90,0.14); stroke: #94285A; stroke-dasharray: none; stroke-width: 2.2; }
.c-gr-ov .handle { fill: #FFFFFF; stroke: #0047AB; stroke-width: 2; }
.c-gr-ov .handle--on { fill: #0047AB; }
.c-gr-ov .handle--bad { fill: #FFFFFF; stroke: #94285A; }
.c-gr-ov .sel { fill: none; stroke: #0047AB; stroke-width: 7; stroke-opacity: 0.18; stroke-linecap: round; stroke-linejoin: round; }
.c-gr-ov .ghost { fill: none; stroke: #E86E1E; stroke-width: 2; stroke-dasharray: 5 4; }
.c-gr-ov .ray { stroke: #0047AB; stroke-width: 1.2; stroke-dasharray: 2 3; }
.c-gr-ov .tap { fill: none; stroke: #0047AB; stroke-width: 2; }
.c-gr-ov .tap--fill { fill: rgba(0,71,171,0.16); }
.c-gr-ov .cfill { fill: rgba(232,110,30,0.22); stroke: #E86E1E; stroke-width: 1.4; stroke-dasharray: 4 3; }
.c-gr-ov .finger { fill: rgba(0,0,0,0.10); stroke: rgba(0,0,0,0.25); stroke-width: 1; }
.c-gr-ov .link { fill: #0047AB; }

/* A chip on the canvas: the magnet's name, the coordinates, "Unlinked". */
.c-gr-chip { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; pointer-events: none;
	font-family: var(--font-ui); font-size: 11.5px; font-weight: 600; line-height: 1; padding: 6px 9px; border-radius: 999px;
	background: #0047AB; color: #FFFFFF; box-shadow: 0 2px 8px rgba(0,0,0,0.18); }
.c-gr-chip--quiet { background: #FFFFFF; color: #0047AB; border: 1px solid #A3BFE0; }
.c-gr-chip--bad { background: #94285A; }
.c-gr-chip .c-icon { width: 11px; height: 11px; vertical-align: -1px; margin-right: 3px; fill: currentColor; }

/* The floating bar while drawing a curve, and the piece popover. */
.c-gr-float { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px;
	padding: 6px; border-radius: 14px; background: var(--surface-card); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-elevated); z-index: 6; }
.c-gr-float__lab { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); padding: 0 4px 0 8px; }
.c-gr-float .c-gr-tools { border-radius: 9px; }
.c-gr-float .c-gr-tool { padding: 7px 12px; }
.c-gr-touch .c-gr-float .c-gr-tool, .c-gr-touch .c-gr-float .c-btn { min-height: 44px; }
.c-gr-pop { position: absolute; z-index: 8; width: 300px; padding: 12px; }
.c-gr-pop.c-tool-popover { width: 300px; }
.c-gr-pop--wide.c-tool-popover { width: 340px; }
.c-gr-pop__sentence { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--text-body); margin: 10px 0 8px; line-height: 1.9; }
.c-gr-pop__sentence .c-tw-select { width: auto; display: inline-flex; gap: 8px; padding: 4px 9px; font-size: 13px; font-weight: 600; color: var(--primary); }
.c-gr-pop__list { display: flex; flex-direction: column; gap: 1px; border-top: 1px solid var(--border-subtle); padding-top: 6px; }
.c-gr-pop__list .c-select-row { align-items: center; padding: 5px 8px; font-size: 12.5px; }
.c-gr-pop__list .c-select-row.is-disabled { opacity: 0.45; cursor: default; }
.c-gr-pop__why { font-size: 11px; color: var(--plum); margin: -1px 0 3px 36px; }
.c-gr-pop__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.c-gr-pop__arrow { position: absolute; width: 12px; height: 12px; background: var(--surface-card); border-left: 1px solid var(--border-subtle); border-top: 1px solid var(--border-subtle); transform: rotate(45deg); }

/* ── The inspector: Items | Axes (wider than the table's 252px) ──────────── */
.c-gr-insp { width: 360px; flex: 0 0 360px; }
.c-gr-insp .c-tw-insp__scroll { padding: 10px 12px 18px; scrollbar-width: none; }
.c-gr-insp .c-tw-insp__scroll::-webkit-scrollbar { width: 0; height: 0; }
.c-gr-touch .c-tw-insp__tab { min-height: 44px; font-size: 13px; }

.c-gr-items { display: flex; flex-direction: column; gap: 4px; }
.c-gr-panelhead { font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); margin: 8px 2px 2px; }
.c-gr-item { border: 1px solid var(--border-subtle); border-radius: 9px; background: var(--surface-card); }
.c-gr-item.is-open { border-color: var(--border-normal); box-shadow: inset 2px 0 0 var(--primary); }
.c-gr-item.is-bad { border-color: rgba(148,40,90,0.55); box-shadow: inset 2px 0 0 var(--plum); }
.c-gr-item__row { display: flex; align-items: center; gap: 9px; padding: 8px 10px; min-height: 34px; cursor: pointer; }
.c-gr-touch .c-gr-item__row { min-height: 44px; }
.c-gr-item.is-open .c-gr-item__row { border-bottom: 1px solid var(--border-subtle); }
.c-gr-swatch { width: 14px; height: 14px; flex: 0 0 14px; border-radius: 4px; }
.c-gr-item__name { flex: 1; min-width: 0; font-size: 13px; color: var(--text-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-gr-item__name .katex { font-size: 1.05em; }
.c-gr-item__type { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.c-gr-item__err { width: 16px; height: 16px; border-radius: 50%; background: var(--plum); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.c-gr-item__chev { color: var(--text-muted); font-size: 10px; }
.c-gr-item__body { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 11px; }
.c-gr-add { display: flex; align-items: center; justify-content: center; gap: 6px; border: 1.5px dashed var(--border-normal); border-radius: 9px; background: transparent; color: var(--primary); font-family: var(--font-ui); font-size: 12.5px; font-weight: 600; padding: 9px; cursor: pointer; margin-top: 4px; }
.c-gr-touch .c-gr-add { min-height: 44px; }

.c-gr-field { display: flex; flex-direction: column; gap: 5px; }
.c-gr-field__lab { font-size: 11.5px; font-weight: 600; color: var(--text-muted); }
.c-gr-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-body); }
.c-gr-line > .c-gr-grow { flex: 1; min-width: 0; }
.c-gr-line .c-tw-seg { flex: 1; }
.c-gr-line .c-tw-num__input { min-width: 0; }

/* Formula field: "y =" + monospace input, live KaTeX under it, error caret. */
.c-gr-formula { display: flex; align-items: center; border: 1px solid var(--border-normal); border-radius: 8px; background: var(--surface-card); overflow: hidden; }
.c-gr-formula.is-focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,71,171,0.12); }
.c-gr-formula.is-bad { border-color: var(--plum); box-shadow: 0 0 0 3px rgba(148,40,90,0.12); }
.c-gr-formula__pre { padding: 0 8px 0 10px; font-family: "Times New Roman", serif; font-style: italic; font-size: 15px; color: var(--text-muted); border-right: 1px solid var(--border-subtle); line-height: 34px; }
.c-gr-formula__in { flex: 1; font-family: var(--font-mono); font-size: 13.5px; color: var(--text-body); padding: 8px 10px; white-space: pre; position: relative; }
.c-gr-touch .c-gr-formula__in { padding: 12px 10px; }
.c-gr-formula__in .bad { text-decoration: underline wavy var(--plum); text-underline-offset: 3px; color: var(--plum); }
.c-gr-caret { display: inline-block; width: 1.5px; height: 1.1em; background: var(--primary); vertical-align: -2px; margin-left: 1px; }
.c-gr-caret--bad { background: var(--plum); width: 2px; }
.c-gr-formula__tex { font-size: 14px; color: var(--text-body); padding: 2px 2px 0; min-height: 22px; }
.c-gr-formula__tex.is-stale { color: var(--text-muted); }
.c-gr-hint { font-size: 11px; color: var(--text-muted); line-height: 1.45; }

/* Point values: a number pair or a reference (link glyph). */
.c-gr-pts { display: flex; flex-direction: column; gap: 5px; }
.c-gr-piece { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-body); }
.c-gr-piece__how { flex: 0 0 auto; }
.c-gr-piece__how .c-tw-select { padding: 4px 7px; font-size: 11.5px; width: 84px; }
.c-gr-piece__arrow { color: var(--text-muted); flex: 0 0 auto; }
.c-gr-pt { flex: 1; min-width: 0; display: inline-flex; align-items: center; justify-content: space-between; gap: 6px; border: 1px solid var(--border-normal); border-radius: 7px; background: var(--surface-card); color: var(--text-body); font-family: var(--font-ui); font-size: 12px; padding: 5px 8px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-gr-touch .c-gr-pt { min-height: 44px; }
.c-gr-pt--ref { color: var(--primary); background: var(--surface-active); border-color: #B3CAEF; font-weight: 600; }
.c-gr-pt--bad { color: var(--plum); background: #FFF5F8; border-color: rgba(148,40,90,0.5); font-weight: 600; }
html[data-theme="dark"] .c-gr-pt--bad { background: rgba(148,40,90,0.18); }
.c-gr-pt--on { outline: 2px solid var(--primary); outline-offset: 1px; }
.c-gr-pt .c-icon { width: 12px; height: 12px; flex: 0 0 12px; fill: currentColor; }
.c-gr-pt__num { font-family: var(--font-mono); font-size: 11.5px; }

/* Colour dots — the graph palette tokens (graphTool style.py order). */
.c-gr-dots { display: flex; gap: 6px; }
.c-gr-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15); cursor: pointer; }
.c-gr-dot.is-on { border-color: var(--surface-card); box-shadow: 0 0 0 2px var(--primary); }
.c-gr-touch .c-gr-dot { width: 30px; height: 30px; }

/* ── Data table: x | y, bins; keys as the table workspace ────────────────── */
.c-gr-data { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
.c-gr-data th { font-size: 11px; font-weight: 600; color: var(--text-muted); text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--border-subtle); }
.c-gr-data td { border-bottom: 1px solid var(--border-subtle); padding: 0; height: 30px; }
.c-gr-touch .c-gr-data td { height: 40px; }
.c-gr-data td .cell { display: block; padding: 6px; font-family: var(--font-mono); font-size: 12px; color: var(--text-body); }
.c-gr-data td.is-ro .cell { color: var(--text-muted); background: var(--fill-input); }
.c-gr-data td.is-focus { box-shadow: inset 0 0 0 2px var(--primary); }
.c-gr-data td.is-bad { box-shadow: inset 0 0 0 2px var(--plum); background: #FFF5F8; }
html[data-theme="dark"] .c-gr-data td.is-bad { background: rgba(148,40,90,0.18); }
.c-gr-data td.is-pasted { background: var(--surface-active); }
.c-gr-data td.is-new .cell { color: var(--text-muted); }
.c-gr-data .x { width: 28px; text-align: center; color: var(--text-muted); font-size: 12px; }
.c-gr-data .rn { width: 26px; text-align: right; padding-right: 6px; color: var(--text-muted); font-size: 11px; }

/* ── The start step: three kind cards + starters ─────────────────────────── */
.c-gr-start { flex: 1; overflow: auto; padding: 34px 40px; background: var(--ice); display: flex; flex-direction: column; align-items: center; }
html[data-theme="dark"] .c-gr-start { background: #2C2C2E; }
.c-gr-start__h { font-size: 13px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); align-self: stretch; max-width: 820px; margin: 0 auto 12px; width: 100%; }
.c-gr-kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: 100%; max-width: 820px; margin-bottom: 30px; }
.c-gr-kind { background: var(--surface-card); border: 1.5px solid var(--border-subtle); border-radius: 14px; padding: 16px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.c-gr-kind:hover { border-color: var(--primary); }
.c-gr-kind__art { height: 96px; border-radius: 9px; background: #FFFFFF; display: flex; align-items: center; justify-content: center; margin-bottom: 6px; border: 1px solid var(--border-subtle); }
.c-gr-kind__art svg { width: 150px; height: 84px; }
.c-gr-kind__name { font-size: 15px; font-weight: 700; color: var(--text-body); }
.c-gr-kind__sub { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.c-gr-starters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; width: 100%; max-width: 820px; }
.c-gr-starter { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: 12px; padding: 8px 8px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 7px; }
.c-gr-starter:hover { border-color: var(--primary); }
.c-gr-starter img { width: 100%; height: auto; background: #FFFFFF; border-radius: 6px; border: 1px solid var(--border-subtle); }
.c-gr-starter__name { font-size: 12.5px; font-weight: 600; color: var(--text-body); padding: 0 2px; }
.c-gr-starter__sub { font-size: 11px; color: var(--text-muted); padding: 0 2px; margin-top: -4px; }
.c-gr-more { align-self: center; max-width: 820px; width: 100%; text-align: right; margin-top: 10px; }
.c-gr-more .c-btn { color: var(--primary); }
/* G5 (G-D27): the start step's third section, after the examples' More examples… row. */
.c-gr-start__h--existing { margin-top: 30px; }
.c-gr-existing__none { width: 100%; max-width: 820px; margin: 0; font-size: 13px; color: var(--text-muted); }
.c-gr-start--narrow .c-gr-kinds { grid-template-columns: 1fr; gap: 10px; }
.c-gr-start--narrow .c-gr-kind { flex-direction: row; align-items: center; gap: 14px; }
.c-gr-start--narrow .c-gr-kind__art { height: 72px; width: 120px; flex: 0 0 120px; margin: 0; }
.c-gr-start--narrow .c-gr-kind__art svg { width: 110px; height: 62px; }
.c-gr-start--narrow .c-gr-starters { grid-template-columns: repeat(2, 1fr); }
/* G6 (G-D31, G-D32, G-D35; LOCKED 1 Nov 2026, graphs/describe.html D1–D7): the Describe
   card (a fourth kind, 4 across on wide start steps; greyed with no API key), the describe
   step that replaces the start step's body, and the draft strip – the plum .c-gr-banner's
   quiet ice variant. Touch: buttons keep desktop height; 44px tap areas are invisible. */
.c-gr-kinds--four { grid-template-columns: repeat(4, 1fr); }
.c-gr-kinds--four .c-gr-kind__art svg { width: 100%; max-width: 150px; }
.c-gr-kind--off { opacity: 0.5; cursor: default; }
.c-gr-kind--off:hover { border-color: var(--border-subtle); }
.c-gr-describe { width: 100%; max-width: 680px; display: flex; flex-direction: column; }
.c-gr-describe .c-gr-start__h { max-width: none; }
.c-gr-describe__back { align-self: flex-start; margin: -12px 0 14px -10px; }
.c-gr-describe__card { background: var(--surface-card); border: 1.5px solid var(--border-subtle); border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; margin-bottom: 30px; }
.c-gr-describe__opt { font-weight: 400; }
.c-gr-describe__foot { display: flex; align-items: center; gap: 10px; }
.c-gr-describe__note { flex: 1; font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.c-gr-describe__count { font-size: 11.5px; color: var(--text-muted); text-align: right; margin-top: -8px; }
.c-gr-describe .c-gr-starters { grid-template-columns: repeat(3, 1fr); max-width: none; }
.c-gr-banner--draft { background: var(--ice); color: var(--text-body); font-size: 13px; }
html[data-theme="dark"] .c-gr-banner--draft { background: rgba(77,126,196,0.18); }
.c-gr-banner__text { flex: 1; }

/* ── iPad portrait: stacked, preview on top ──────────────────────────────── */
.c-gr-stack .c-tw-body { flex-direction: column; }
.c-gr-stack .c-gr-canvas { flex: 0 0 44%; padding: 14px; }
.c-gr-stack .c-gr-insp { width: auto; flex: 1; border-left: 0; border-top: 1px solid var(--border-subtle); }

/* ── The graph block in a note: the image row, the page ──────────────────── */
.c-gr-thumb { width: 102px; height: 63px; flex: 0 0 102px; border-radius: 6px; background: #FFFFFF; border: 1px solid var(--border-subtle); object-fit: contain; padding: 2px; box-sizing: border-box; }
.c-gr-rowmeta { font-size: 0.75rem; }
.c-gr-rowmeta b { font-weight: 600; color: var(--text-body); }
.c-gr-keep { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-body); cursor: pointer; padding: 2px 4px; }
.c-gr-keep .c-check { width: 16px; height: 16px; flex-basis: 16px; }
.c-gr-touch-row .c-table-summary__edit, .c-gr-touch-row .c-gr-keep { min-height: 44px; }

/* The page: kept formula (KaTeX, centred) above, the SVG at its size, the caption after. */
.c-gr-block { margin: 0 auto; text-align: center; }
.c-gr-block__formula { font-size: 12pt; color: #000; margin-bottom: 4pt; }
.c-gr-block__img { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.c-gr-block--updating .c-gr-block__img { opacity: 0.5; }

/* ── Dark: --primary text on dark fills is too faint; use --secondary (as
      .c-select-row.is-selected and the image row's size menu do). ────────── */
html[data-theme="dark"] .c-gr-pt--ref { color: var(--secondary); border-color: #3D5A8A; }
html[data-theme="dark"] .c-gr-tool.is-on,
html[data-theme="dark"] .c-gr-add,
html[data-theme="dark"] .c-gr-more .c-btn,
html[data-theme="dark"] .c-gr-pop__sentence .c-tw-select { color: var(--secondary); }
html[data-theme="dark"] .c-gr-formula.is-focus { border-color: var(--secondary); }
html[data-theme="dark"] .c-gr-dot.is-on { box-shadow: 0 0 0 2px var(--secondary); }

/* Portrait: let the panel shrink under the keyboard; no scroll bars anywhere (memory: no-scrollbars). */
.c-gr-stack .c-gr-insp { min-height: 0; }
.c-gr-stack .c-tw-body { min-height: 0; }
.c-gr-start { scrollbar-width: none; }
.c-gr-start::-webkit-scrollbar { width: 0; height: 0; }
/* --plum is theme-fixed: on dark fills the graph editor's error text takes the
   soft-plum override the login error uses (#F2B8CD). */
html[data-theme="dark"] .c-gr-pt--bad,
html[data-theme="dark"] .c-gr-formula__in .bad,
html[data-theme="dark"] .c-gr-item .c-inline-error,
html[data-theme="dark"] .c-gr-banner .c-inline-error,
html[data-theme="dark"] .c-gr-pop__why { color: #F2B8CD; }

/* ═══════════════════════════════════════════════════════════════════════════
   § OCR REVIEW + EXPORT  (.c-ocr-*)  — OCR mockups, LOCKED 2026-10-26
   ───────────────────────────────────────────────────────────────────────────
   The review screen is the GRAPH EDITOR's shell (.c-tw-modal + .c-gr-modal,
   .c-gr-head, .c-tw-bar, .c-gr-item rows, .c-gr-banner, .c-gr-sweep); these
   are the parts it adds: the page picture drawn from the board, the pager,
   the row parts (grip, style chip, struck state, diagram thumbnail + caption),
   the open row's source + preview, the pinned destination, the panel's
   centred states (converting, failed page, cap), the notice text, Swap case
   rows – and the note's Export menu (Print / PDF… · LaTeX (.zip)).
   Decisions: docs/ocr/spec.md O-D1…O-D21. Frames: design/mockups/ocr/.
   ═══════════════════════════════════════════════════════════════════════════ */
/* ── The page picture ───────────────────────────────────────────────────── */
.c-ocr-paper { position: relative; background: #FFFFFF; box-shadow: 0 1px 4px rgba(0,0,0,0.13); overflow: hidden; flex: 0 0 auto; }
.c-ocr-paper__inner { position: absolute; transform-origin: 0 0; width: 1800px; height: 1800px; }
.c-ocr-paper__inner .wb-textel .block-preview { color: #000; }
/* The open diagram row's box on the picture (the elements it took, grown 1.5%). */
.c-ocr-paper__box { position: absolute; border: 2px dashed var(--primary); border-radius: 4px; background: rgba(0,71,171,0.06); }
.c-ocr-paper--dim { opacity: 0.5; }
.c-ocr-canvas { flex-direction: column; justify-content: flex-start; gap: 10px; }
.c-ocr-canvas__label { font-size: 11.5px; color: var(--text-muted); }

/* ── The page arrows (in the toolbar) ───────────────────────────────────── */
.c-ocr-pager { display: inline-flex; align-items: center; gap: 4px; }
.c-ocr-pager .c-tw-btn { padding: 5px 7px; }
.c-ocr-pager .c-tw-btn svg { width: 13px; height: 13px; }
.c-ocr-pager__label { font-size: 12px; font-weight: 600; color: var(--text-body); min-width: 92px; text-align: center; white-space: nowrap; }
.c-ocr-pager__bad { color: var(--plum); }
html[data-theme="dark"] .c-ocr-pager__bad { color: #F2B8CD; }
.c-gr-touch .c-ocr-pager .c-tw-btn { min-height: 44px; min-width: 44px; justify-content: center; }

/* ── Review rows: .c-gr-item + these parts ──────────────────────────────── */
.c-ocr-insp { width: 440px; flex: 0 0 440px; }
.c-gr-stack .c-ocr-insp { width: auto; flex: 1; }
.c-ocr-rows { display: flex; flex-direction: column; gap: 4px; }
.c-ocr-row .c-gr-item__row { align-items: flex-start; gap: 8px; padding: 7px 10px 7px 4px; }
.c-ocr-row__grip { flex: 0 0 18px; height: 22px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); cursor: grab; opacity: 0.7; }
.c-ocr-row__grip svg { width: 14px; height: 14px; }
.c-gr-touch .c-ocr-row__grip { flex-basis: 30px; height: 30px; }
.c-ocr-row__style { flex: 0 0 auto; margin-top: 2px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.c-ocr-row__style .c-tw-btn__caret { font-size: 7px; }
.c-ocr-row__style--fixed { background: var(--fill-input); color: var(--text-muted); cursor: default; }
.c-ocr-row__style--struck { background: var(--fill-input); color: var(--text-muted); }
.c-ocr-row__text { flex: 1; min-width: 0; }
/* The rendered line uses the paperTemplate block styles at panel size. */
.c-ocr-row__text .block-preview { margin: 0 !important; padding: 0 !important; color: var(--text-body); font-size: 15px; line-height: 1.45; }
.c-ocr-row__text .block-preview.style-Level1NoON { font-size: 18px; }
.c-ocr-row__text .block-preview.style-Level2NoON { font-size: 16px; }
.c-ocr-row__text .block-preview.style-EquationLeft { text-align: left; }
.c-ocr-row.is-struck .c-ocr-row__text { opacity: 0.5; }
.c-ocr-row.is-struck.is-kept .c-ocr-row__text { opacity: 1; }
.c-ocr-row.is-lifted { box-shadow: 0 8px 24px rgba(0,0,0,0.16); border-color: var(--primary); transform: rotate(-0.6deg); }
.c-ocr-row__slot { height: 4px; border-radius: 2px; background: var(--primary); margin: 0 6px; }
.c-ocr-row .c-gr-keep { margin-left: auto; flex: 0 0 auto; }
.c-ocr-row__keep-note { font-size: 11px; color: var(--text-muted); padding: 0 10px 8px 34px; margin-top: -4px; }
.c-gr-touch .c-ocr-row .c-gr-keep { min-height: 44px; margin-top: -10px; margin-bottom: -10px; }

/* Open row: the source and its live preview. */
.c-ocr-src { font-family: var(--font-mono); font-size: 12.5px; min-height: 54px; line-height: 1.5; white-space: pre-wrap; }
.c-ocr-src.is-focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,71,171,0.12); }
.c-ocr-preview { border: 1px solid var(--border-subtle); border-radius: 8px; background: #FFFFFF; padding: 8px 12px; }
.c-ocr-preview .block-preview { margin: 0 !important; padding: 0 !important; color: #000; font-size: 15px; }

/* Diagram rows: the snapshot thumbnail + caption field. */
.c-ocr-row__thumb { width: 92px; height: 80px; flex: 0 0 92px; border-radius: 6px; background: #FFFFFF; border: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.c-ocr-row__thumb > svg { width: 86px; height: 74px; }
.c-ocr-row__thumb--empty { border-style: dashed; background: var(--fill-input); font-size: 11px; color: var(--text-muted); text-align: center; padding: 6px; line-height: 1.35; }
.c-ocr-row__diag { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.c-ocr-row__cap { display: flex; align-items: center; gap: 6px; }
.c-ocr-row__cap .c-input { flex: 1; min-width: 0; height: 32px; font-size: 13px; }
.c-gr-touch .c-ocr-row__cap .c-input { height: 44px; }
.c-ocr-row__count { font-size: 10.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.c-ocr-row__meta { font-size: 11.5px; color: var(--text-muted); }
.c-ocr-row.is-empty .c-ocr-row__diag { opacity: 0.6; }

/* ── Destination, pinned under the rows ─────────────────────────────────── */
.c-ocr-dest { border-top: 1px solid var(--border-subtle); padding: 12px 14px 14px; flex-shrink: 0; background: var(--surface-card); display: flex; flex-direction: column; gap: 8px; }
.c-ocr-dest__lab { font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.c-ocr-dest .c-picker-note { margin-top: 0; }
.c-ocr-dest__title { display: flex; align-items: center; gap: 8px; }
.c-ocr-dest__title .c-input { flex: 1; height: 32px; font-size: 13px; }
.c-gr-touch .c-ocr-dest__title .c-input, .c-gr-touch .c-ocr-dest .c-segment__btn { min-height: 44px; }
.c-ocr-dest__into { display: flex; align-items: flex-start; gap: 10px; }
.c-ocr-dest__into .c-picker-note { flex: 1; }
.c-ocr-insp .c-tw-insp__scroll { scrollbar-width: none; }
.c-ocr-insp .c-tw-insp__scroll::-webkit-scrollbar { width: 0; height: 0; }

/* ── Converting, failed page, cap: the panel's centred states ───────────── */
.c-ocr-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px 34px; gap: 10px; }
.c-ocr-state__ring { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface-active); border-top-color: var(--primary); animation: ocr-spin 0.9s linear infinite; }
@keyframes ocr-spin { to { transform: rotate(360deg); } }
.c-ocr-state__title { font-size: 15px; font-weight: 700; color: var(--text-body); }
.c-ocr-state__sub { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; max-width: 330px; }
.c-ocr-state .c-inline-error { width: auto; text-align: center; }
.c-ocr-state__icon { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #FFF5F8; color: var(--plum); }
html[data-theme="dark"] .c-ocr-state__icon { background: rgba(148,40,90,0.18); color: #F2B8CD; }
.c-ocr-state__icon svg { width: 20px; height: 20px; }
.c-ocr-pages { display: flex; gap: 10px; margin-top: 8px; }
.c-ocr-pages__item { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); }
.c-ocr-pages__item .c-ocr-paper { box-shadow: 0 0 0 1px var(--border-subtle); }

/* ── Notice text ────────────────────────────────────────────────────────── */
.c-ocr-notice p { font-size: 14px; line-height: 1.6; color: var(--text-body); margin: 0 0 12px; }
.c-ocr-notice__link { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--primary); text-decoration: none; }
.c-ocr-notice__link svg { width: 12px; height: 12px; }
html[data-theme="dark"] .c-ocr-notice__link { color: var(--secondary); }

/* ── Swap case popover rows ─────────────────────────────────────────────── */
.c-ocr-swap__letter { font-family: "Times New Roman", serif; font-style: italic; font-size: 17px; width: 26px; text-align: center; color: var(--text-body); }
.c-ocr-swap__arrow { color: var(--text-muted); font-size: 12px; }
.c-ocr-swap__count { margin-left: auto; font-size: 11.5px; color: var(--text-muted); }

/* ── The note's Export menu (X) ─────────────────────────────────────────── */
.c-ocr-export-host { position: relative; display: inline-flex; }
.c-ocr-export-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; min-width: 200px; }
.c-ocr-export-host .c-tb-btn.is-working > .c-btn__spinner { margin-right: 5px; }

/* ═══════════════════════════════════════════════════════════════════════════
   BLOCK PANEL + KEY HINT  (block redesign, docs/blockChanges/spec.md – LOCKED
   1 Nov 2026; frames design/mockups/blocks/). Promoted at the mockup lock; the
   served static/css/components.css gets it at the build (diff before and after
   build_tokens.py – it is destructive).

   ONE panel on every editing surface (B-D17): a popover under the block (pill,
   "/", ⌘/), the keyboard's place on the iPad (--dock), the table inspector
   (--flat), touch sizing (--touch). Controls a base can't take are ABSENT, not
   disabled (§7.1). Its options are the .c-tool-popover__mode look.
   Key hints follow H4 (Daniel, 1 Nov): menu-style text, shown only when the
   panel came from the keyboard; clicked or tapped → .c-block-panel--hints-none.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Key hint – plain grey text, like ⌘C in a Mac menu. Never a box. */
.c-kbd {
	display: inline-flex; align-items: center; justify-content: center;
	font: 400 11px/1 var(--font-ui); color: var(--text-muted); opacity: 0.85;
	white-space: nowrap;
}
/* The keys a waiting state asks for (after /h, /c): a soft fill */
.c-kbd--want {
	opacity: 1; color: var(--primary); font-weight: 600;
	background: var(--surface-active-card); border-radius: 4px; padding: 2px 4px;
}
html[data-theme="dark"] .c-kbd--want { color: var(--text-body); }

.c-block-panel {
	width: 304px; box-sizing: border-box; padding-bottom: 6px;
	background: var(--surface-card); color: var(--text-body);
	border: 1px solid var(--border-subtle); border-radius: 14px;
	box-shadow: var(--shadow-elevated);
	font-family: var(--font-ui); font-size: 12px; text-align: left;
	white-space: normal;
}
/* Top line = the search field: empty from the pill; from "/" it shows what was
   typed and what the panel waits for. A click/tap or the s key searches. */
.c-block-panel__top {
	display: flex; align-items: center; gap: 7px;
	padding: 8px 10px; border-bottom: 1px solid var(--border-subtle);
	min-height: 34px; box-sizing: border-box;
}
.c-block-panel__top .c-icon { width: 13px; height: 13px; color: var(--text-muted); flex: none; }
.c-block-panel__typed {
	font: 600 12px/1 var(--font-mono); color: var(--primary);
	background: var(--surface-active-card); border-radius: 4px; padding: 3px 5px;
}
html[data-theme="dark"] .c-block-panel__typed { color: var(--text-body); }
.c-block-panel__typed--bad { color: var(--plum); background: transparent; border: 1px solid var(--plum); }
html[data-theme="dark"] .c-block-panel__typed--bad { color: #F0A3C4; border-color: #F0A3C4; }
.c-block-panel__query { color: var(--text-body); font-size: 12.5px; white-space: pre; }   /* the caret is inside it, after the last character */
.c-block-panel__caret { display: inline-block; width: 1.5px; height: 14px; background: var(--primary); vertical-align: -2px; margin-left: 1px; }
.c-block-panel__hint { flex: 1; min-width: 0; color: var(--text-muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-block-panel__hint .c-kbd { margin: 0 2px; }
.c-block-panel__esc { flex: none; }
/* While ⌥ is held in a clicked panel (hints shown on request) */
.c-block-panel__held { flex: none; white-space: nowrap; text-align: right; font-size: 11px; color: var(--primary); }
html[data-theme="dark"] .c-block-panel__held { color: var(--secondary); }

/* Sections are ROWS (label column + control), so every control starts at one x */
.c-block-panel__sec { padding: 7px 10px 0; }
.c-block-panel__sec + .c-block-panel__sec { padding-top: 6px; }
.c-block-panel__sec--rule { border-top: 1px solid var(--border-subtle); margin-top: 7px; padding-top: 8px !important; }
.c-block-panel__row { display: flex; align-items: center; gap: 8px; }
.c-block-panel__row + .c-block-panel__row { margin-top: 5px; }
.c-block-panel__label {
	flex: 0 0 52px; font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em;
	text-transform: uppercase; color: var(--text-muted);
}
.c-block-panel__ctl { flex: 1; min-width: 0; }

/* Base grid 3 × 3 (Snapshot is an Image source, beside Image) and segmented rows */
.c-block-panel__bases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.c-block-panel__seg { display: flex; gap: 3px; }
.c-block-panel__seg .c-block-panel__opt { flex: 1 1 0; justify-content: center; }
.c-block-panel__opt {
	display: flex; align-items: center; justify-content: space-between; gap: 4px;
	height: 26px; padding: 0 7px; box-sizing: border-box; min-width: 0;
	border: 0; border-radius: 6px; background: transparent; cursor: pointer;
	font: 500 12px/1 var(--font-ui); color: var(--text-body); white-space: nowrap;
}
.c-block-panel__opt:hover { background: var(--surface-hover); }
.c-block-panel__opt.is-active { background: var(--surface-active-card); color: var(--primary); font-weight: 600; }
html[data-theme="dark"] .c-block-panel__opt.is-active { color: var(--text-body); }
/* Keyboard focus (S5) – the app's ring, also drawn as .is-focus for the frames */
.c-block-panel__opt:focus-visible, .c-block-panel__toggle:focus-visible,
.c-block-panel__opt.is-focus, .c-block-panel__toggle.is-focus,
.c-block-panel__note-btn:focus-visible { outline: 2px solid var(--secondary); outline-offset: 1px; }
/* After /h or /c the base is pending until its second key; the rest steps back */
.c-block-panel__opt.is-pending { background: transparent; box-shadow: inset 0 0 0 1.5px var(--primary); color: var(--primary); }
html[data-theme="dark"] .c-block-panel__opt.is-pending { box-shadow: inset 0 0 0 1.5px var(--secondary); color: var(--text-body); }
.c-block-panel.is-waiting .c-block-panel__sec:not(.is-want) { opacity: 0.38; }
/* Stacked option: glyph above its key (List, Indent, Align, Level) */
.c-block-panel__opt--stack { flex-direction: column; justify-content: center; gap: 2px; height: 34px; padding: 0 2px; }
.c-block-panel__opt--stack .c-kbd { font-size: 9.5px; }
.c-block-panel__glyph { font-size: 12.5px; line-height: 1; }

/* Callout colour swatches – the note's own fill + edge */
.c-block-panel__sw { display: inline-block; vertical-align: middle; width: 15px; height: 13px; border-radius: 3px; box-sizing: border-box; flex: none; border: 1px solid; }
.c-block-panel__sw--none { border-color: var(--border-normal); background: linear-gradient(to top right, transparent calc(50% - 0.6px), #C00 calc(50% - 0.6px), #C00 calc(50% + 0.6px), transparent calc(50% + 0.6px)), var(--surface-card); }
.c-block-panel__sw--blue { background: #A3BFE0; border-color: #0047AB; }
.c-block-panel__sw--plum { background: #94285A; border-color: #E86E1E; }
.c-block-panel__sw--orange { background: #E86E1E; border-color: #94285A; }

/* Toggles (Accent, Quotation, Continue numbering, New box, Outline number) – .c-check */
.c-block-panel__toggles { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.c-block-panel__toggle { display: inline-flex; align-items: center; gap: 6px; height: 24px; border-radius: 6px; padding-right: 2px; cursor: pointer; font-size: 12px; color: var(--text-body); }
.c-block-panel__toggle .c-check { width: 15px; height: 15px; flex-basis: 15px; border-radius: 5px; }
.c-block-panel__toggle .c-check .c-icon { width: 9px; height: 9px; }

/* Several blocks selected: a value that differs is "Mixed", nothing chosen */
.c-block-panel__mixed { font-size: 9px; font-weight: 600; letter-spacing: 0.02em; text-transform: none; color: var(--secondary); display: block; margin-top: 1px; }
.c-block-panel__toggle .c-block-panel__mixed { display: inline; margin: 0; }
.c-check--mixed { border-color: var(--secondary); }
.c-check__dash { width: 8px; height: 2px; border-radius: 1px; background: var(--secondary); }

/* The one-line reason (S1: quotation and box can't share a block) */
.c-block-panel__why { margin: 6px 10px 0; padding: 6px 8px; border-radius: 6px; background: var(--fill-input); color: var(--text-body); font-size: 11px; line-height: 1.45; }
/* What a JSON base's panel says instead of controls (table, image, graph) */
/* It spans the panel (no label column) and its one button sits under the text,
   at the left edge, the height of the panel's options */
.c-block-panel__note { font-size: 11.5px; color: var(--text-muted); line-height: 1.45; }
.c-block-panel__note-text { margin: 0; }
.c-block-panel__note-btn {
	display: block; margin-top: 7px; height: 26px; padding: 0 10px; box-sizing: border-box;
	border: 1px solid var(--border-normal); border-radius: 6px; background: transparent; cursor: pointer;
	font: 500 12px/1 var(--font-ui); color: var(--primary);
}
.c-block-panel__note-btn:hover { background: var(--surface-hover); }
html[data-theme="dark"] .c-block-panel__note-btn { color: var(--text-body); }

/* Search (/s or a click on the top line): results name what they set */
.c-block-panel__results { padding: 5px 6px 0; }
.c-block-panel__result { display: flex; align-items: center; gap: 8px; padding: 6px 7px; border-radius: 6px; }
.c-block-panel__result.is-active { background: var(--surface-active-card); }
.c-block-panel__result-name { font-weight: 600; color: var(--text-body); white-space: nowrap; }
.c-block-panel__result-sets { flex: 1; min-width: 0; color: var(--text-muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-block-panel__result-group { padding: 7px 7px 2px; font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.c-block-panel__empty { padding: 14px 12px 8px; color: var(--text-muted); font-size: 12px; line-height: 1.5; }

.c-block-panel__foot {
	display: flex; flex-wrap: wrap; gap: 3px 10px; align-items: center;
	margin-top: 8px; padding: 6px 10px 0; border-top: 1px solid var(--border-subtle);
	font-size: 10.5px; color: var(--text-muted);
}
.c-block-panel__foot span { display: inline-flex; align-items: center; gap: 3px; }

/* H4: opened by a click or tap – no hints, except keys a waiting state asks for */
.c-block-panel--hints-none .c-kbd:not(.c-kbd--want) { display: none; }
.c-block-panel--hints-none .c-block-panel__foot { display: none; }
.c-block-panel--hints-none .c-block-panel__label br { display: none; }

/* Touch sizing (iPad with a hardware keyboard) – 44 pt targets, tap not hover */
.c-block-panel--touch { width: 360px; }
.c-block-panel--touch .c-block-panel__opt { height: 44px; font-size: 14px; border-radius: 9px; }
.c-block-panel--touch .c-block-panel__opt--stack { height: 44px; }
.c-block-panel--touch .c-block-panel__note-btn { height: 44px; font-size: 14px; border-radius: 9px; }
.c-block-panel--touch .c-block-panel__glyph { font-size: 15px; }
.c-block-panel--touch .c-block-panel__toggle { height: 44px; font-size: 14px; gap: 8px; }
.c-block-panel--touch .c-block-panel__toggle .c-check { width: 20px; height: 20px; flex-basis: 20px; }
.c-block-panel--touch .c-block-panel__label { flex-basis: 60px; font-size: 10.5px; }
.c-block-panel--touch .c-block-panel__sw { width: 20px; height: 17px; }
.c-block-panel--touch .c-block-panel__top { min-height: 44px; }
.c-block-panel--touch .c-block-panel__row + .c-block-panel__row { margin-top: 2px; }

/* Docked – in the on-screen keyboard's place (iPad). The keyboard's last-seen
   height as an inline min-height (editor.js, _keyboardHeights), so the page
   doesn't move; columns, so nothing scrolls; the spare
   height goes to bigger targets (no Recent row, Daniel 1 Nov). */
.c-block-panel--dock {
	width: auto; height: 100%; border: 0; border-radius: 0; box-shadow: none;
	background: var(--surface-card); padding: 18px 14px 10px;
	display: grid; grid-template-columns: 1.05fr 1.25fr 1fr; gap: 0 22px; align-content: start;
}
.c-block-panel--dock .c-block-panel__col { min-width: 0; }
.c-block-panel--dock .c-block-panel__sec { padding: 6px 0 0; }
.c-block-panel--dock .c-block-panel__sec + .c-block-panel__sec { padding-top: 12px; }
.c-block-panel--dock .c-block-panel__sec--rule { border-top: 0; margin-top: 0; }
.c-block-panel--dock .c-block-panel__label { flex-basis: 64px; }
.c-block-panel--dock .c-block-panel__opt { height: 62px; font-size: 15px; border-radius: 11px; }
.c-block-panel--dock .c-block-panel__glyph { font-size: 17px; }
.c-block-panel--dock .c-block-panel__row + .c-block-panel__row { margin-top: 12px; }
.c-block-panel--dock .c-block-panel__bases { gap: 12px 8px; }
.c-block-panel--dock .c-block-panel__toggle { height: 62px; font-size: 15px; }
.c-block-panel--dock .c-block-panel__sw { width: 24px; height: 20px; }
.c-block-panel--dock-portrait { grid-template-columns: 1fr 1.2fr; gap: 0 18px; padding-top: 10px; }
.c-block-panel--dock-portrait .c-block-panel__opt { height: 52px; }
.c-block-panel--dock-portrait .c-block-panel__toggle { height: 46px; }
.c-block-panel--dock-portrait .c-block-panel__row + .c-block-panel__row { margin-top: 8px; }
.c-block-panel--dock-portrait .c-block-panel__bases { gap: 8px 6px; }

/* ── Key strip (iPad Safari, frame I6, B-D41 – block-web-ipad) ──────────────
   Safari can't put Aleph's buttons in its keyboard bar, so a strip is pinned
   above it: Outdent · Indent · the block pill, and Keyboard once the panel has
   closed the keyboard. .c-key-dock holds the strip and, docked, the panel under
   it; editor.js places it on the visual viewport. Touch rule (Daniel, 30 Oct):
   drawn at desktop height, the 44 px tap area an invisible ::after. */
.c-key-dock { position: fixed; left: 0; top: 0; width: 100%; z-index: 60; display: flex; flex-direction: column; }
.c-key-dock[hidden] { display: none; }
.c-key-dock.is-rising { background: var(--surface-card); }   /* the panel's place, blank, while the keyboard rises over it */
.c-key-dock .c-block-panel--dock { height: auto; border-top: 1px solid var(--border-subtle); }
.c-key-strip { flex: none; height: 50px; display: flex; align-items: center; gap: 6px; padding: 0 12px; background: var(--surface-card); border-top: 1px solid var(--border-subtle); font-family: var(--font-ui); }
.c-key-strip__btn {
	position: relative; height: 34px; padding: 0 12px; border: 0; border-radius: 9px;
	display: inline-flex; align-items: center; gap: 6px; background: transparent;
	color: var(--text-body); font: inherit; font-size: 14px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.c-key-strip__btn::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }
.c-key-strip__btn svg { width: 20px; height: 20px; flex: none; }
.c-key-strip__btn--icon { width: 44px; padding: 0; justify-content: center; }
.c-key-strip__btn[aria-disabled="true"] { opacity: .35; }
.c-key-strip__pill { margin: 0 4px; font-weight: 600; color: var(--primary); background: var(--fill-input); }
.c-key-strip__pill.is-on { background: var(--primary); color: #fff; }
html[data-theme="dark"] .c-key-strip__pill { color: var(--secondary); }
html[data-theme="dark"] .c-key-strip__pill.is-on { background: var(--secondary); color: #111; }
.c-key-strip__back { margin-left: auto; background: var(--fill-input); }
.c-key-strip__back svg { width: 18px; height: 18px; }
.c-key-strip__back[hidden] { display: none; }
@media (hover: hover) { .c-key-strip__btn:not(.c-key-strip__pill):hover { background: var(--surface-hover); } }

/* Flat – the same rows inside another surface (the table workspace inspector) */
.c-block-panel--flat { width: auto; border: 0; box-shadow: none; background: transparent; padding: 0; border-radius: 0; }
.c-block-panel--flat .c-block-panel__sec { padding-left: 0; padding-right: 0; }
.c-block-panel--flat .c-block-panel__sec--rule { border-top: 0; margin-top: 2px; }
.c-block-panel--flat .c-block-panel__label { flex-basis: 46px; }

/* ── Undo notice (the graph library's L6 toast, promoted for B-D50) ──────
   The #333 pill, bottom centre, with an Undo button: the graph library's
   delete and the block panel's change of base ("Heading has no list – …").
   Moved verbatim from static/css/subject.css (block-web-panel, 9 Nov 2026). */
.gl-toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 9999; display: inline-flex; align-items: center; gap: 14px; background: #333; color: #fff; padding: 0.35rem 0.4rem 0.35rem 1.1rem; border-radius: 6px; font-size: 0.85rem; max-width: calc(100vw - 2rem); }
.gl-toast > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gl-toast__undo { border: 0; background: transparent; color: #A3BFE0; font: inherit; font-weight: 700; padding: 0.3rem 0.7rem; border-radius: 4px; cursor: pointer; flex: 0 0 auto; }
@media (pointer: coarse) { .gl-toast__undo { min-height: 44px; } }
