/* One look for every tool — Undergrad, the slide editor (local and the hosted
 * /edit/), the presenter pages (/admin/, /present/, the site's index and
 * viewer) and the desktop tab strip. Each loads shared/ui/fonts.css and this
 * file before its own stylesheet, and names itself on <html data-app="…">:
 *
 *   undergrad   cream Paper by day, navy Night (data-theme / the system)
 *   slides      violet-navy, dark only — so a slide editor is never mistaken
 *               for an Undergrad window at a glance
 *   presenter   graphite, dark only
 *
 * The type, radii, spacing and components are the same for all three; only
 * the palette changes. Undergrad's look is the model: IBM Plex Sans for the
 * interface, italic Spectral for headings, IBM Plex Mono for code and paths.
 *
 * EVERY rule here is wrapped in :where(), so it has no specificity at all: an
 * app's own rule always wins — and every component rule also needs
 * [data-app] on the page, so a page that has not named itself yet is
 * untouched. That is what lets an app move onto this file a
 * piece at a time — delete its own version of a rule, and this one shows
 * through — and what keeps this file from needing !important, with one
 * exception: the [hidden] reset below.
 *
 * Two deliberate exceptions, used by name:
 *   --mono-term   the terminal keeps SF Mono. The bundled Plex Mono is a
 *                 Latin subset with no box-drawing glyphs, and Claude Code's
 *                 rules came out as garbage in it.
 *   black         a slide preview, a mockup stage and the audience viewer's
 *                 deck sit on black: that is the letterbox of a slide.
 */

/* ── type, shape, space ─────────────────────────────────────────────── */

:where(:root) {
  --serif: 'Spectral', 'Iowan Old Style', Georgia, serif;
  --sans:  'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --mono:  'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --mono-term: 'SF Mono', Menlo, Consolas, monospace;

  /* The scale. Anything else is an editor size the user chose (the Aa menu). */
  --fs-label:   11px;   /* uppercase labels, meta, badges */
  --fs-control: 12px;   /* buttons, tabs' neighbours, inputs in toolbars */
  --fs-ui:      13px;   /* the interface's body */
  --fs-prose:   14px;   /* paragraphs of explanation, card bodies */
  --fs-title:   16px;   /* a row's or a card's title */
  --fs-h2:      20px;
  --fs-h1:      28px;
  --lh-ui: 1.45;
  --lh-prose: 1.55;

  --r-sm: 6px;          /* chips, small controls, menu rows */
  --r-md: 8px;          /* buttons, inputs */
  --r-lg: 10px;         /* cards, panes, popovers */
  --r-pill: 999px;
  --radius: var(--r-lg);

  --sp-1: 4px; --sp-2: 6px; --sp-3: 8px; --sp-4: 12px; --sp-5: 16px; --sp-6: 24px;
  --split: 14px;        /* the track a .splitter sits in: the whole of it is the grab area */

  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ── palettes ───────────────────────────────────────────────────────────
   Canonical names: desk (the window), sheet (a raised surface), card (a
   surface inside one), ink / ink-2 / muted (text, strong to quiet), rule /
   rule-soft (lines), accent (links, focus, the primary action's colour where
   it has one), red / good / warn (state), term-* (the terminal). */

/* Undergrad, by day. Its highlight colours and paper grain are its own and
   stay in undergrad/panel/styles.css. */
:where(:root[data-app="undergrad"]) {
  color-scheme: light;
  --desk: #efe9dd; --sheet: #fbf8f1; --card: #f6f1e6;
  --ink: #1f1b16; --ink-2: #4d453b; --muted: #8a7f70;
  --rule: #ddd3c1; --rule-soft: #e9e2d3;
  --red: #c23b2a; --blue: #2d6bb3; --good: #3a7a4c; --warn: #b7791f;
  --accent: var(--blue);
  --shadow: 0 1px 0 rgba(60, 44, 24, 0.05), 0 14px 32px -22px rgba(60, 44, 24, 0.45);
  --term-bg: #1c1915; --term-fg: #e9e2d4; --term-muted: #948a79;
  --term-black: #2a2620; --term-bright: #fbf8f1; --term-edge: #0f0d0a;
}

/* Undergrad at night — written twice, as the system's choice and as the Aa
   menu's, because CSS has no "either" for a media query and an attribute.
   Keep the two identical. */
@media (prefers-color-scheme: dark) {
  :where(:root[data-app="undergrad"]:not([data-theme="light"])) {
    color-scheme: dark;
    --desk: #0f1724; --sheet: #162132; --card: #1c283b;
    --ink: #e3e9f3; --ink-2: #b3bfd2; --muted: #8391a8;
    --rule: #2b3850; --rule-soft: #212d41;
    --red: #e0604c; --blue: #5a8ad8; --good: #7cb98c; --warn: #e2b45a;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 16px 34px -20px rgba(0, 0, 0, 0.85);
    --term-bg: #0b111c; --term-fg: #dfe6f1; --term-muted: #8391a8;
    --term-black: #1e2a3d; --term-bright: #f4f7fc; --term-edge: #060a11;
  }
}
:where(:root[data-app="undergrad"][data-theme="dark"]) {
  color-scheme: dark;
  --desk: #0f1724; --sheet: #162132; --card: #1c283b;
  --ink: #e3e9f3; --ink-2: #b3bfd2; --muted: #8391a8;
  --rule: #2b3850; --rule-soft: #212d41;
  --red: #e0604c; --blue: #5a8ad8; --good: #7cb98c; --warn: #e2b45a;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 16px 34px -20px rgba(0, 0, 0, 0.85);
  --term-bg: #0b111c; --term-fg: #dfe6f1; --term-muted: #8391a8;
  --term-black: #1e2a3d; --term-bright: #f4f7fc; --term-edge: #060a11;
}

/* The slide editor: navy pushed toward violet. Every text colour clears
   4.5:1 on desk, sheet and card (muted, the weakest, is 4.9 on card). */
:where(:root[data-app="slides"]) {
  color-scheme: dark;
  --desk: #16142a; --sheet: #1e1a36; --card: #262044;
  --ink: #e7e4f4; --ink-2: #bdb7d6; --muted: #948dae;
  --rule: #342d55; --rule-soft: #2a2546;
  --accent: #5b8def; --blue: #5b8def; --red: #ef6b5b; --good: #2ecc71; --warn: #f2a93b;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 16px 34px -20px rgba(0, 0, 0, 0.85);
  --term-bg: #100e1f; --term-fg: #e4e0f2; --term-muted: #948dae;
  --term-black: #262044; --term-bright: #f6f4fd; --term-edge: #0a0916;
}

/* The presenter pages: a slightly grey graphite. Same contrast floor. */
:where(:root[data-app="presenter"]) {
  color-scheme: dark;
  --desk: #141518; --sheet: #1c1d21; --card: #24262b;
  --ink: #e6e7ea; --ink-2: #babdc4; --muted: #90939b;
  --rule: #33363d; --rule-soft: #2a2c31;
  --accent: #5b8def; --blue: #5b8def; --red: #ef6b5b; --good: #2ecc71; --warn: #f2a93b;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.35), 0 16px 34px -20px rgba(0, 0, 0, 0.9);
  --term-bg: #0e0f11; --term-fg: #e2e3e6; --term-muted: #90939b;
  --term-black: #24262b; --term-bright: #f5f5f7; --term-edge: #08090a;
}

/* Auditron, by day: a cooler ledger paper than Undergrad's, so the two are
   not mistaken for each other, ruled in a ledger's crimson ink (the accent),
   with Undergrad's pencils for severity (a brick red, blue). Every text
   colour clears 4.5:1 on desk, sheet and card (muted, the weakest, is 4.7 on
   desk; the accent is 6.2). */
:where(:root[data-app="auditron"]) {
  color-scheme: light;
  --desk: #e9ece6; --sheet: #f9faf6; --card: #f1f3ec;
  --ink: #18201b; --ink-2: #414c45; --muted: #5f6b64;
  --rule: #d3d9d0; --rule-soft: #e3e7df;
  --red: #b5382a; --blue: #2b62a8; --good: #2e7347; --warn: #8a5a0e;
  --accent: #a3203c;
  --shadow: 0 1px 0 rgba(24, 40, 30, 0.05), 0 14px 32px -22px rgba(24, 40, 30, 0.45);
  --term-bg: #171213; --term-fg: #ece4e4; --term-muted: #a29597;
  --term-black: #2a2224; --term-bright: #f8f4f4; --term-edge: #0b0809;
}

/* Auditron at night: a warm near-black, so the crimson (here a lighter rose,
   5.9:1 on card) reads as ink and not alarm — twice, like Undergrad's, and
   kept identical. */
@media (prefers-color-scheme: dark) {
  :where(:root[data-app="auditron"]:not([data-theme="light"])) {
    color-scheme: dark;
    --desk: #161213; --sheet: #1d1819; --card: #262021;
    --ink: #efe8e8; --ink-2: #c9bdbe; --muted: #a29597;
    --rule: #3b3133; --rule-soft: #2d2628;
    --red: #e8705b; --blue: #6a96dc; --good: #76bf92; --warn: #e2b45a;
    --accent: #f07890;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 16px 34px -20px rgba(0, 0, 0, 0.85);
    --term-bg: #100c0d; --term-fg: #ece4e4; --term-muted: #a29597;
    --term-black: #262021; --term-bright: #f8f4f4; --term-edge: #080606;
  }
}
:where(:root[data-app="auditron"][data-theme="dark"]) {
  color-scheme: dark;
  --desk: #161213; --sheet: #1d1819; --card: #262021;
  --ink: #efe8e8; --ink-2: #c9bdbe; --muted: #a29597;
  --rule: #3b3133; --rule-soft: #2d2628;
  --red: #e8705b; --blue: #6a96dc; --good: #76bf92; --warn: #e2b45a;
  --accent: #f07890;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 16px 34px -20px rgba(0, 0, 0, 0.85);
  --term-bg: #100c0d; --term-fg: #ece4e4; --term-muted: #a29597;
  --term-black: #262021; --term-bright: #f8f4f4; --term-edge: #080606;
}

/* Reviewer 2: a referee's report — warm grey paper, ink, and a burnt-orange
   accent (its icon's), with the reds kept for what is fatal. Every text
   colour clears 4.5:1 on desk, sheet and card (the accent, the weakest, is
   4.9 on desk); at night 5.8 at the least. Twice, like the others. */
:where(:root[data-app="reviewer2"]) {
  color-scheme: light;
  --desk: #ecebe7; --sheet: #fbfaf8; --card: #f3f2ee;
  --ink: #1c1b19; --ink-2: #46433e; --muted: #67625a;
  --rule: #d8d5ce; --rule-soft: #e7e4de;
  --red: #b3261e; --blue: #2b5fa6; --good: #2c6e45; --warn: #8a5a0e;
  --accent: #a14d0c;
  --shadow: 0 1px 0 rgba(40, 32, 20, 0.05), 0 14px 32px -22px rgba(40, 32, 20, 0.45);
  --term-bg: #161412; --term-fg: #ebe6df; --term-muted: #a29b90;
  --term-black: #2a2622; --term-bright: #f8f5f0; --term-edge: #0a0908;
}
@media (prefers-color-scheme: dark) {
  :where(:root[data-app="reviewer2"]:not([data-theme="light"])) {
    color-scheme: dark;
    --desk: #131211; --sheet: #1b1a18; --card: #24221f;
    --ink: #eeebe5; --ink-2: #c9c3b9; --muted: #a29b90;
    --rule: #38342f; --rule-soft: #2a2724;
    --red: #ef7a6a; --blue: #7aa2e0; --good: #78bf8f; --warn: #e2b45a;
    --accent: #f0a35a;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 16px 34px -20px rgba(0, 0, 0, 0.85);
    --term-bg: #0f0e0d; --term-fg: #ebe6df; --term-muted: #a29b90;
    --term-black: #24221f; --term-bright: #f8f5f0; --term-edge: #070606;
  }
}
:where(:root[data-app="reviewer2"][data-theme="dark"]) {
  color-scheme: dark;
  --desk: #131211; --sheet: #1b1a18; --card: #24221f;
  --ink: #eeebe5; --ink-2: #c9c3b9; --muted: #a29b90;
  --rule: #38342f; --rule-soft: #2a2724;
  --red: #ef7a6a; --blue: #7aa2e0; --good: #78bf8f; --warn: #e2b45a;
  --accent: #f0a35a;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 16px 34px -20px rgba(0, 0, 0, 0.85);
  --term-bg: #0f0e0d; --term-fg: #ebe6df; --term-muted: #a29b90;
  --term-black: #24221f; --term-bright: #f8f5f0; --term-edge: #070606;
}

/* Inquisitive, on a student's phone (inquisitive/app/): a cool white for a
   lecture hall's lights, navy ink, a teal accent. Light only: a phone in a
   bright room. Every text colour
   clears 4.5:1 on desk, sheet and card (muted, the weakest, is 4.53 on desk). */
:where(:root[data-app="inquisitive"]) {
  color-scheme: light;
  --desk: #eef2f6; --sheet: #ffffff; --card: #f4f7fa;
  --ink: #0f2a44; --ink-2: #33495f; --muted: #5d7084;
  --rule: #d3dce6; --rule-soft: #e4eaf0;
  --red: #b42318; --blue: #1f5fa8; --good: #1d7048; --warn: #f2a93b;
  --accent: #0e7c74;
  --shadow: 0 1px 0 rgba(15, 42, 68, 0.05), 0 14px 32px -22px rgba(15, 42, 68, 0.4);
}

/* The names the slide editor and the presenter apps were written against,
   kept as aliases so their stylesheets can move over piece by piece. */
:where(:root[data-app="slides"], :root[data-app="presenter"]) {
  --bg: var(--desk);
  --bg-elevated: var(--sheet);
  --bg-panel: var(--card);
  --fg: var(--ink);
  --fg-muted: var(--muted);
  --border: var(--rule);
  --accent-warm: var(--warn);
  --ok: var(--good);
  --err: var(--red);
  --font-sans: var(--sans);
  --font-mono: var(--mono);
  --font-serif: var(--serif);
}

/* ── the page ───────────────────────────────────────────────────────── */

:where([data-app] *, [data-app] *::before, [data-app] *::after) { box-sizing: border-box; }

/* `hidden` must win. The browser's own [hidden] rule loses to ANY author
   style — even this file's zero-specificity `display: inline-flex` on a
   button — so a hidden button showed (the speaker's "← Back" before any
   jump). The one !important here, and the usual reset for it. */
:where([data-app] [hidden]) { display: none !important; }

:where([data-app] > body) {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-ui);
  line-height: var(--lh-ui);
  -webkit-font-smoothing: antialiased;
}

:where([data-app] button) { font: inherit; color: inherit; cursor: pointer; }
:where([data-app] button:disabled) { cursor: default; }
:where([data-app] code) { font-family: var(--mono); font-size: 0.9em; }
:where([data-app] kbd) {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;            /* inside a 600 button, a 600 Plex Mono would be faked */
  padding: 1px 4px;
  border: 1px solid currentColor;
  border-radius: 4px;
  opacity: 0.55;
}
:where([data-app] :focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── headings and labels ─────────────────────────────────────────────── */

/* A page or section heading: italic Spectral, as Undergrad's "Projects". */
:where([data-app] .title) {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
:where([data-app] h1.title, [data-app] .title.h1) { font-size: var(--fs-h1); line-height: 1.2; }
:where([data-app] h2.title, [data-app] .title.h2) { font-size: var(--fs-h2); line-height: 1.25; }
:where([data-app] h3.title, [data-app] .title.h3) { font-size: var(--fs-title); line-height: 1.3; }

/* The small-caps label: tabs, section heads in a margin, table heads. */
:where([data-app] .label) {
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Explanatory text under a heading. */
:where([data-app] .hint) { color: var(--ink-2); font-size: var(--fs-ui); line-height: var(--lh-prose); max-width: 70ch; }

/* ── buttons ─────────────────────────────────────────────────────────
   primary  the one thing to do here: ink on the page's colour, inverted
   ghost    everything else
   danger   destructive: red text, red line on hover
   icon     a square for a glyph
   linkish  a link that is a button */

:where([data-app] .primary, [data-app] .ghost, [data-app] .danger) {
  display: inline-flex;
  align-items: center;
  justify-content: center;     /* a full-width button keeps its label centred */
  gap: var(--sp-3);
  padding: 7px 14px;
  border-radius: var(--r-md);
  font-size: var(--fs-control);
  font-weight: 600;
  line-height: 1.2;
  transition: transform 0.12s var(--ease), background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
:where([data-app] .primary) {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--sheet);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08), 0 6px 14px -8px rgba(0, 0, 0, 0.5);
}
:where([data-app] .primary:hover:not(:disabled)) { transform: translateY(-1px); }
:where([data-app] .ghost) { border: 1px solid var(--rule); background: transparent; color: var(--ink-2); }
:where([data-app] .ghost:hover:not(:disabled)) { border-color: var(--ink-2); color: var(--ink); }
:where([data-app] .danger) { border: 1px solid var(--rule); background: transparent; color: var(--red); }
:where([data-app] .danger:hover:not(:disabled)) { border-color: var(--red); }
:where([data-app] .primary:disabled, [data-app] .ghost:disabled, [data-app] .danger:disabled) { opacity: 0.5; }

:where([data-app] .icon) {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: none;
  color: var(--ink-2);
}
:where([data-app] .icon:hover) { background: var(--card); border-color: var(--rule); }

:where([data-app] .linkish) {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── tabs: one segmented control for every view switch ───────────────
   Uppercase labels in a rounded track; the chosen one is lifted onto the
   sheet. The chosen button carries .on (or .active, or aria-selected). */

:where([data-app] .tabs) {
  display: inline-flex;
  flex: none;
  gap: var(--sp-1);
  padding: 3px;
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  background: var(--card);
}
:where([data-app] .tabs > button) {
  padding: 4px 14px;
  border: 0;
  border-radius: var(--r-pill);
  background: none;
  color: var(--muted);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
:where([data-app] .tabs > button:hover:not(:disabled)) { color: var(--ink); }
:where([data-app] .tabs > button:disabled) { opacity: 0.4; }
:where([data-app] .tabs > button.on, [data-app] .tabs > button.active, [data-app] .tabs > button[aria-selected="true"]) {
  background: var(--sheet);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* ── fields ──────────────────────────────────────────────────────────── */

:where([data-app] .field, [data-app] input[type="text"], [data-app] input[type="search"], [data-app] input[type="number"], [data-app] input[type="password"], [data-app] input[type="email"], [data-app] input[type="url"], [data-app] input:not([type]), [data-app] select, [data-app] textarea) {
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-control);
  font-weight: 400;            /* a field inside a bold .label is not bold */
}
:where([data-app] .field:focus, [data-app] input:focus, [data-app] select:focus, [data-app] textarea:focus) { outline: none; border-color: var(--accent); }
:where([data-app] .field.mono, [data-app] input.mono) { font-family: var(--mono); }

/* ── surfaces ────────────────────────────────────────────────────────── */

:where([data-app] .card) {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
}

/* A pill: a kind, a count, a state. */
:where([data-app] .pill) {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 0 7px;
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.6;
  color: var(--ink-2);
  white-space: nowrap;
}
:where([data-app] .pill.accent) { border-color: var(--accent); color: var(--accent); }
:where([data-app] .pill.warn) { border-color: var(--warn); color: var(--warn); }
:where([data-app] .pill.red) { border-color: var(--red); color: var(--red); }
:where([data-app] .pill.good) { border-color: var(--good); color: var(--good); }

/* A popover or menu: a sheet lifted over the page. */
:where([data-app] .menu) {
  padding: var(--sp-3);
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.45);
}

/* ── splitters: the seam between two panes ──────────────────────────
   Undergrad's. A hairline the full length of the seam, so the panes read as
   panes, and a grip in the middle you can find without hunting; both go blue
   under the pointer. The hit area is the whole --split track the app's grid
   gives it, not the line. The axis is .v / .h, or aria-orientation for a
   splitter whose axis turns with the layout: "vertical" is a seam between
   columns (dragged sideways), "horizontal" one between rows. The app wires
   the drag and adds .dragging while it lasts. */

:where([data-app] .splitter) {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  touch-action: none;           /* or a touch drag scrolls the page instead */
}
:where([data-app] .splitter.v, [data-app] .splitter[aria-orientation="vertical"]) {
  cursor: col-resize;
  background: linear-gradient(to right, transparent calc(50% - 1px), var(--rule-soft) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px));
}
:where([data-app] .splitter.h, [data-app] .splitter[aria-orientation="horizontal"]) {
  cursor: row-resize;
  background: linear-gradient(to bottom, transparent calc(50% - 1px), var(--rule-soft) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px));
}
:where([data-app] .splitter.v:hover, [data-app] .splitter.v.dragging,
       [data-app] .splitter[aria-orientation="vertical"]:hover, [data-app] .splitter[aria-orientation="vertical"].dragging) {
  background: linear-gradient(to right, transparent calc(50% - 1px), color-mix(in srgb, var(--accent) 45%, transparent) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px));
}
:where([data-app] .splitter.h:hover, [data-app] .splitter.h.dragging,
       [data-app] .splitter[aria-orientation="horizontal"]:hover, [data-app] .splitter[aria-orientation="horizontal"].dragging) {
  background: linear-gradient(to bottom, transparent calc(50% - 1px), color-mix(in srgb, var(--accent) 45%, transparent) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px));
}
/* The grip, ringed in the desk's colour so it sits on the hairline cleanly. */
:where([data-app] .splitter)::before {
  content: '';
  position: relative;
  z-index: 1;
  border-radius: 2px;
  background: var(--rule);
  box-shadow: 0 0 0 3px var(--desk);
  transition: background 0.15s;
}
:where([data-app] .splitter.v, [data-app] .splitter[aria-orientation="vertical"])::before { width: 4px; height: 56px; }
:where([data-app] .splitter.h, [data-app] .splitter[aria-orientation="horizontal"])::before { width: 56px; height: 4px; }
:where([data-app] .splitter:hover, [data-app] .splitter.dragging, [data-app] .splitter:focus-visible)::before { background: var(--accent); }

/* ── the talk as a line ──────────────────────────────────────────────
   shared/talk-line.js, drawn by the slide editor's timing bar and the
   presenter's Pace. A segment per talk slide, as long as its target: what
   has been given is filled, this slide stands out, a new section starts
   with a tick the full height of the track, the slot's spare time is
   hatched, and slides past the slot are red. The gaps between segments are
   the card's colour, which both panels are, drawn inside each segment (an
   inset shadow, not a border) so a segment's width is its share of the time
   and nothing placed by time — the slot's end, Pace's clock — drifts from
   it by a pixel a slide. */

:where([data-app] .tl-track) {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 18px;
  display: flex;
  align-items: center;
}
:where([data-app] .tl-seg, [data-app] .tl-spare) {
  flex: 1 1 0;
  min-width: 0;
  height: 10px;
  box-shadow: inset -1px 0 0 var(--card);
}
:where([data-app] .tl-seg:first-child) { border-radius: 3px 0 0 3px; }
:where([data-app] .tl-seg:last-of-type, [data-app] .tl-spare) { border-radius: 0 3px 3px 0; }
:where([data-app] .tl-seg.ahead) { background: var(--rule); }
:where([data-app] .tl-seg.done) { background: color-mix(in srgb, var(--accent) 45%, var(--rule)); }
:where([data-app] .tl-seg.here) { height: 18px; border-radius: 2px; background: var(--accent); }
:where([data-app] .tl-seg.over.ahead) { background: color-mix(in srgb, var(--red) 45%, var(--rule)); }
:where([data-app] .tl-seg.over.done) { background: color-mix(in srgb, var(--red) 70%, var(--rule)); }
:where([data-app] .tl-seg.opener) { box-shadow: inset 2px 0 0 var(--ink-2), inset -1px 0 0 var(--card); }
/* The segment the popup is about. */
:where([data-app] .tl-seg:hover) { filter: brightness(1.35); }
:where([data-app] .tl-spare) {
  box-shadow: none;
  background: repeating-linear-gradient(135deg, var(--rule-soft) 0 4px, transparent 4px 8px);
}
:where([data-app] .tl-slot) {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  background: var(--red);
  pointer-events: none;
}
/* The popup over a segment (talk-line.js#tipFor): the slide's number and
   where it stands, its title as the slide shows it, set large, and when it
   runs. The browser's tooltip it replaced was small and one line. Fixed to
   the window, over everything, and out of the pointer's way. */
:where([data-app] .tl-tip) {
  position: fixed;
  z-index: 1000;
  display: grid;
  gap: var(--sp-1);
  box-sizing: border-box;
  width: max-content;
  min-width: 220px;
  max-width: min(420px, calc(100vw - 16px));
  padding: var(--sp-3) var(--sp-4);
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
:where([data-app] .tl-tip-kicker) {
  font-size: var(--fs-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
:where([data-app] .tl-tip.over .tl-tip-kicker) { color: var(--red); }
:where([data-app] .tl-tip-title) {
  font-family: var(--serif);
  font-size: var(--fs-h2);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
:where([data-app] .tl-tip-time) {
  font-family: var(--mono);
  font-size: var(--fs-ui);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

/* ── what happened ───────────────────────────────────────────────────
   status  a quiet line under a control (.err / .ok to colour it)
   msg     a boxed message with a coloured edge (.err / .ok / .warn) */

:where([data-app] .status) { min-height: 18px; color: var(--muted); font-size: var(--fs-label); }
:where([data-app] .status.err, [data-app] .msg.err) { color: var(--red); }
:where([data-app] .status.ok) { color: var(--good); }
:where([data-app] .msg) {
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--ink-2);
  font-size: var(--fs-ui);
  line-height: var(--lh-prose);
}
:where([data-app] .msg.err) { border-left-color: var(--red); }
:where([data-app] .msg.ok) { border-left-color: var(--good); }
:where([data-app] .msg.warn) { border-left-color: var(--warn); }

/* ── a folder's files ─────────────────────────────────────────────────
   The file tree (notes-app/file-tree.js): Undergrad's project tree and the
   slide editor's Files column. The column around it is each app's own; this
   is its head and its rows. Last in the file: its rows are buttons, and at
   base's zero specificity the later rule wins over base's button defaults. */

:where([data-app] .pt-head) { display: flex; align-items: center; gap: 6px; padding: 8px 6px 7px 12px; border-bottom: 1px solid var(--rule-soft); }
/* The folder's name: .title h3, as a button. */
:where([data-app] .pt-title) {
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
:where([data-app] .pt-title:hover) { text-decoration: underline; text-underline-offset: 2px; }
:where([data-app] .pt-x) { display: grid; place-items: center; width: 24px; height: 24px; flex: none; border: 0; border-radius: var(--r-sm); background: none; color: var(--muted); }
:where([data-app] .pt-x svg) { width: 9px; height: 9px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
:where([data-app] .pt-x:hover) { background: var(--card); color: var(--ink); }
:where([data-app] .pt-body) { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; padding: 6px 4px 14px; }
:where([data-app] .pt-list) { list-style: none; margin: 0; padding: 0; }
:where([data-app] .pt-row) {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 3px 8px 3px calc(6px + var(--d, 0) * 13px);
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink-2);
  font-size: var(--fs-ui);
  line-height: 1.45;
  text-align: left;
  white-space: nowrap;
}
:where([data-app] .pt-row:hover) { background: var(--card); color: var(--ink); }
:where([data-app] .pt-row.on) { background: color-mix(in srgb, var(--ink) 9%, transparent); color: var(--ink); font-weight: 600; box-shadow: inset 2px 0 0 var(--ink); }
:where([data-app] .pt-row.missing) { opacity: 0.55; }
:where([data-app] .pt-name) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
:where([data-app] .pt-dir .pt-name) { color: var(--ink); font-weight: 600; }
:where([data-app] .pt-other) { color: var(--muted); }
:where([data-app] .pt-caret) { display: grid; place-items: center; width: 10px; height: 10px; flex: none; transition: transform 0.15s var(--ease); }
:where([data-app] .pt-caret svg) { width: 8px; height: 8px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
:where([data-app] .pt-caret.open) { transform: rotate(90deg); }
:where([data-app] .pt-dot) { display: grid; place-items: center; width: 10px; flex: none; }
:where([data-app] .pt-dot)::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--rule); }
:where([data-app] .pt-doc .pt-dot)::before { background: var(--ink-2); }
:where([data-app] .pt-tag) { flex: none; color: var(--muted); }
:where([data-app] .pt-more) { padding: 2px 8px 2px 30px; color: var(--muted); font: italic var(--fs-control)/1.5 var(--serif); }
:where([data-app] .pt-sect) { margin: 14px 8px 4px; }
