Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

167 KB
Raw Blame
/* SPDX-License-Identifier: MIT
   Copyright (c) 2026 The Bento authors
   bento/spaces chrome.

   Tokens, button shapes, menu shadows and radii are slides' (see
   slides/src/styles.css). Two apps in one suite that draw their chrome
   differently read as two products. What differs is only what the app IS: a
   reading column instead of a canvas. */

/* ————— THEME TOKENS —————————————————————————————————————————————————————
   A THEME IS A VIEWER PREFERENCE, NEVER DOCUMENT DATA (PLATFORM §8, and
   kernel/src/theme.ts). It lives in localStorage exactly as the interface
   language does, and for the same reason: two people opening one space are two
   readers in two rooms, and a theme written into the file would travel to
   whoever received it — and make the bytes depend on who last looked.

   WHAT DARK COVERS, AND WHY IT IS NOT SLIDES' ANSWER. slides themes only the
   chrome AROUND the deck: a slide is a bounded page on a canvas, its
   background is data the author chose, and someone proofing at midnight still
   needs to see what will be projected. A space has no such page. `--bg` is
   THE ONE GROUND — the toolbar, both panels and the reading column all sit on
   it, with hairlines and nothing else between them (see `html, body` below),
   which is the whole point of the chrome-reads-as-one-document work. A dark
   interface with a white reading column would be a white rectangle filling
   most of the window: not a dark interface, and a re-introduction of the
   floating-card look that was deliberately removed.

   So in spaces the reading surface IS chrome, and it follows the reader —
   UNTIL THE DOCUMENT HAS A DESIGN (DECISIONS, 2026-09-26). Then the author's
   design owns the surface and the reader's theme picks between its two
   palettes; designs.css does that, and nothing in this file changes for it.
   `doc.theme.background/color/accent` still exist in the format and are still
   the DOCUMENT's own colours — but the only thing that paints them is the
   static file-manager preview (preview.ts), which renders with scripting off,
   has no reader and no localStorage to ask, and is a thumbnail of the author's
   document. That surface stays the author's, unconditionally and in both
   themes; nothing here reaches it.

   What DOES follow the reader, deliberately, is the document's own colour
   vocabulary: `--c-*` (the nine `sp-fg-*`/`sp-bg-*` marks) and the callout
   tone hues. The author picked "red", not `#c0392b` — the closed vocabulary
   exists precisely so the value under each name can be tuned for the surface,
   which is what the palette comment two hundred lines down already says. An
   ink measured against white is not the same ink on a near-black ground.

   THREE STATES, and the dark values appear TWICE because of it. A reader has
   chosen light, chosen dark, or chosen nothing. An explicit choice stamps
   `data-theme` on <html>; the default follows the OS. So dark must be defined
   under `@media (prefers-color-scheme: dark)` — guarded `:not([data-theme="light"])`
   so an explicit light choice still wins — AND under `[data-theme="dark"]`, or
   the toggle only works in one direction. The two blocks are byte-identical and
   the model rig asserts they stay that way.

   BOTH ARE @media screen, WHICH IS HOW PAPER STAYS LIGHT. Print matches
   neither, so on paper the light block below is the only one that applies and
   the print sheet needs no third copy of the palette. Dark is a screen theme;
   toner is not a screen. */

/* LIGHT — the suite's shared palette, character for character with
   slides/src/styles.css and type/src/styles.css. Do not let these drift. */
:root, :root[data-theme="light"] {
  --ink: #1e2a3a;
  --ink-2: #31445c;
  /* THE ONE GROUND. Named rather than spelled `#fff` at each site, because the
     dark interface redefines exactly these tokens and nothing else — a literal
     at a use site is a thing that stays white when the theme flips. */
  --bg: #ffffff;
  /* raised above the ground: the bar, menus, popovers, dialogs, the row you
     are on. In light it is the same white — the hairlines carry the separation
     — and in dark it has to lift, which is why it is a token and not `--bg`. */
  --surface: #ffffff;
  /* recessed below it: form controls, which read as holes, not cards */
  --field: #ffffff;
  --chrome: #f5f7fa;
  --chrome-2: #eceff4;
  --line: #e3e8ef;
  /* a border that has to be SEEN — hover and selected states, one step past
     the resting hairline */
  --edge: #b9c3d2;
  --muted: #5b6472;
  --accent: #f7a600;
  /* the accent as INK ON THE GROUND: the magic-note answer, the live chip, the
     banner. It flips with the ground, so in dark it lifts to a light amber. */
  --accent-ink: #7a5200;
  /* the accent as ink ON THE ACCENT FILL — the comment badge. The fill does
     not flip (it is brand), so neither does this. */
  --accent-on: #7a5200;
  --blue: #5b8def;
  /* the wordmark's coral, and the splash's. BRAND, so it is the same value in
     both themes — it is a name, not a foreground, and it reads on either
     ground. Named only so a literal cannot be mistaken for chrome later. */
  --brand: #ff9e8a;
  /* the prompt inside an empty block, and the gutter's affordances: both are
     "not yet content", so both are quieter than --muted */
  --ph: #b9c2ce;
  --ghost: #aab4c2;
  /* SHADOWS ARE ONE TOKEN, as CHANNELS rather than a colour, so every
     `rgb(var(--shade) / …)` in this file keeps its own alpha. Eleven shadows
     needed eleven tokens otherwise. Dark goes to pure black: a navy shadow is
     invisible on a navy ground. */
  --shade: 20 30 45;

  /* READING SIZE, and it grows with the screen.
     A 5120px display showed a 900px column of 16px text: 110 characters, 18%
     of the screen, and lines past the range anyone reads comfortably. The fix
     is NOT a wider column — it is bigger type holding the SAME character
     count, because at that width you are also sitting further away.
     16px to about 1600px wide, then up to 19px by 2560, capped there.
     THE FLOOR IS A PX VALUE ON PURPOSE: `vw` shrinks when a reader zooms in
     (zoom reduces the CSS-pixel viewport), so a purely viewport-driven size
     would fight the browser's own accessibility control. The floor means zoom
     can only ever land on today's size or larger. */
  --sp-read: clamp(16px, 11px + 0.3125vw, 19px);
  --radius: 10px;

  /* ————— the document's colour vocabulary —————
     NINE COLOURS IN TWO ROLES: `sp-fg-*` is the ink on a SPAN, `sp-bg-*` is
     the band behind it on a MARK. The band is a color-mix into `transparent`,
     so it needs no second set — alpha lands correctly on any ground. The INKS
     do: these are measured to clear 4.5:1 on white, and their dark twins are
     measured on `--bg` dark. */
  --c-gray: #5b6472;   --c-brown: #8a5a3c;  --c-orange: #b35c00;
  --c-yellow: #8a6a00; --c-green: #1f7a4d;  --c-blue: #1f5fbf;
  --c-purple: #6b3fbf; --c-pink: #b3327a;   --c-red: #c0392b;

  /* ————— syntax colours —————
     Six roles, chosen to survive the places code is read: an editor in either
     theme, and a printed page. The light four clear 4.5:1 against the code
     well AND against white, because a browser drops the block's background
     when printing and keeps the ink — a palette tuned only against the tinted
     well goes pale on paper. Hue does the work, not lightness, so the block
     still reads as prose at 13px and stays legible in greyscale.
     Comments reuse --muted and numbers reuse --accent-ink: the suite's palette
     already had the right two, and a syntax theme that invents a ninth grey is
     a syntax theme nobody can restyle. */
  --code-str: #1c6b4b;
  --code-key: #6b3fa0;
  --code-lit: #0d6382;
  --code-prop: #1c4fb5;

  /* ————— callout tone hues —————
     ONE HUE PER TONE, and the fill and the label DERIVE from it against the
     current ground (see .sp-b-callout). That is why there is no second set:
     `color-mix(hue, --bg)` is a pale tint on white and a deep one on near
     black, and `color-mix(hue, --ink)` darkens the label in light and lifts it
     in dark, from the same five numbers. Fifteen hand-tuned values would have
     needed thirty. */
  --tone-note: #7d9cbd;
  --tone-tip: #4f9e79;
  --tone-important: #8a72cc;
  --tone-warning: #d9a326;
  --tone-caution: #cd6a63;
  /* WHAT OPENS FROM THE BAR wears slides' surfaces (the parity block, below
     the menus). Light they are spaces' own; dark they are slides' #21262e
     family, a step lighter than spaces' panels, so a menu over the page reads
     exactly as it does over a slide. */
  --pop-bg: #ffffff;
  --pop-line: #e3e8ef;
  --pop-hover: #eceff4;
  --update-bg: #ff9e8a;
  --update-ink: #0d1b2e;
  --share-wait: #b8860b;
  --share-ok: #2e8b57;
  --dirty-ring: #16273e;
  --pop-shadow: 0 8px 24px rgb(20 30 45 / 0.14);
  --pop-chrome: #f5f7fa;   /* the Share popover's you-row ground: slides' --chrome */

  /* The BROWSER's own furniture — scrollbars, form controls, the canvas behind
     a rubber-band scroll — follows this, and CSS cannot reach any of it.
     `only` keeps a force-dark engine from inverting what we have already
     decided. kernel/src/theme.ts restates the resolved value inline on <html>,
     which is what makes the choice win over the media query below. */
  color-scheme: only light;
}

/* DARK — the same roles, not the same values. `--ink` is the chrome's
   FOREGROUND, so it inverts; `--accent` does not, because it is brand.
   THE NEXT TWO BLOCKS ARE IDENTICAL BY CONTRACT. See the three-state note
   above; scripts/test-spaces-model.ts compares them character for character. */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e7eaf0;
    --ink-2: #b3bcca;
    --bg: #14181e;
    --surface: #1b2027;
    --field: #12151a;
    --chrome: #1e232b;
    --chrome-2: #272d36;
    --line: #333a45;
    --edge: #454e5c;
    --muted: #8b95a4;
    --accent: #f7a600;
    --accent-ink: #f0b74e;
    --accent-on: #7a5200;
    --blue: #7aa5f5;
    --brand: #ff9e8a;
    --ph: #4a5464;
    --ghost: #5c6675;
    --shade: 0 0 0;
    --c-gray: #9aa3b2;   --c-brown: #d09a72;  --c-orange: #ef9a3d;
    --c-yellow: #d8b64a; --c-green: #4fbe86;  --c-blue: #7aa8f5;
    --c-purple: #b294f0; --c-pink: #ee7ab4;   --c-red: #f0796a;
    --code-str: #6fd39b;
    --code-key: #c4a2f5;
    --code-lit: #62c1e0;
    --code-prop: #82abf5;
    --tone-note: #7d9cbd;
    --tone-tip: #4f9e79;
    --tone-important: #8a72cc;
    --tone-warning: #d9a326;
    --tone-caution: #cd6a63;
    --pop-bg: #21262e;
    --pop-line: #333a45;
    --pop-hover: #262b34;
    --update-bg: #ff9e8a;
    --update-ink: #0d1b2e;
    --share-wait: #b8860b;
    --share-ok: #2e8b57;
    --dirty-ring: #16273e;
    /* slides #573: navy at 14% lifts nothing off dark chrome; black, deeper */
    --pop-shadow: 0 8px 24px rgb(0 0 0 / 0.5);
    --pop-chrome: #1b1f26;
    color-scheme: only dark;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --ink: #e7eaf0;
    --ink-2: #b3bcca;
    --bg: #14181e;
    --surface: #1b2027;
    --field: #12151a;
    --chrome: #1e232b;
    --chrome-2: #272d36;
    --line: #333a45;
    --edge: #454e5c;
    --muted: #8b95a4;
    --accent: #f7a600;
    --accent-ink: #f0b74e;
    --accent-on: #7a5200;
    --blue: #7aa5f5;
    --brand: #ff9e8a;
    --ph: #4a5464;
    --ghost: #5c6675;
    --shade: 0 0 0;
    --c-gray: #9aa3b2;   --c-brown: #d09a72;  --c-orange: #ef9a3d;
    --c-yellow: #d8b64a; --c-green: #4fbe86;  --c-blue: #7aa8f5;
    --c-purple: #b294f0; --c-pink: #ee7ab4;   --c-red: #f0796a;
    --code-str: #6fd39b;
    --code-key: #c4a2f5;
    --code-lit: #62c1e0;
    --code-prop: #82abf5;
    --tone-note: #7d9cbd;
    --tone-tip: #4f9e79;
    --tone-important: #8a72cc;
    --tone-warning: #d9a326;
    --tone-caution: #cd6a63;
    --pop-bg: #21262e;
    --pop-line: #333a45;
    --pop-hover: #262b34;
    --update-bg: #ff9e8a;
    --update-ink: #0d1b2e;
    --share-wait: #b8860b;
    --share-ok: #2e8b57;
    --dirty-ring: #16273e;
    /* slides #573: navy at 14% lifts nothing off dark chrome; black, deeper */
    --pop-shadow: 0 8px 24px rgb(0 0 0 / 0.5);
    --pop-chrome: #1b1f26;
    color-scheme: only dark;
  }
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  /* ONE GROUND for the whole app. The panels used to sit on a --chrome tint
     with the page white on top of it, so the page read as a card floating on
     a slightly different grey — three surfaces where there is one document.
     The hairline borders carry the separation; a second background does not
     need to. --chrome is still what CHIPS and inset controls sit on, which is
     what it was for. */
  background: var(--bg);
  overscroll-behavior: none;
}
#app { height: 100%; }
/* fields take THE FIELD's own ring below; this one would also round them to 4px */
:where(:not(input, select, textarea)):focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
select, input, textarea, [contenteditable='true'] { -webkit-user-select: auto; user-select: auto; }
option { background: var(--field); color: var(--ink); }

/* Copied from slides/src/styles.css as it stands (the suite's one field look,
   docs/DECISIONS.md 2026-10-17). spaces' --field, --line, --ink and
   --accent-ink are the same roles; a design (#559) re-points them inside its
   page surface. Context rules below only SIZE a field. In spaces the block is
   guarded by scripts/test-spaces-fields-browser.mjs. */
/* ————— THE FIELD — one look for every text field, select and textarea ———————
   The suite's reference: dash, spaces and type copy this block as it stands.
   Every chrome field gets it with no class to remember, so a new field cannot
   come out in the browser's own dress — the grey inset 2px border, square
   corners, and in dark theme a #3b3b3b fill nobody chose (five of slides'
   fields had exactly that, each with its own rule that forgot one property).

   :where() keeps the specificity at ZERO, so a context rule that only sizes a
   field (width, flex, font-weight) layers on top without restating the look,
   and a field that is deliberately not a box (the ghost title, the password
   gate's own card) overrides it with an ordinary class. The ring sits ON the
   border (offset -1px), so no scroll container can clip it. Checkboxes,
   radios, ranges and file pickers keep their native controls. Guarded by
   scripts/test-slides-fields-browser.mjs. */
:where(input:not([type='checkbox'], [type='radio'], [type='range'], [type='file'], [type='color'], [type='button'], [type='submit'], [type='reset'], [type='image'], [type='hidden']), select, textarea) {
  box-sizing: border-box;
  height: 26px;
  padding: 0 6px;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 6px;
}
:where(textarea) { height: auto; padding: 6px 8px; line-height: 1.5; resize: vertical; }
:where(input[type='color']) {
  box-sizing: border-box;
  height: 26px;
  padding: 1px 2px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 6px;
}
:where(input, select, textarea):focus-visible { outline: 2px solid var(--accent-ink); outline-offset: -1px; }

/* ————— shell ————— */
.sp-app { height: 100%; display: flex; flex-direction: column; overflow: hidden; }

/* THE BAR IS SLIDES' BAR (`.ed-topbar`), value for value: 8/14 padding, 10
   between groups, 6 inside one, the mark at 15px/400, a 220px title at
   14px/400 with a 6px corner, and every button on the 30px grid. Measured
   before (chrome-unification §2.1, and again on #565): 8/12, gap 6, a bold
   136×30 wordmark button, a 240px semibold title with an 8px corner, groups at
   2 and 4. Two apps of one suite should not teach two toolbars. */
.sp-bar {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 8px max(14px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left));
  background: var(--surface); border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
/* A BUTTON (it opens About, and a keyboard reaches it) drawn as slides' mark,
   which is a plain lockup: no frame, no fill, 15px/400 with the word in bold. */
.sp-mark {
  display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
  font: inherit; font-size: 15px; font-weight: 400; line-height: normal;
  white-space: nowrap; padding: 0; user-select: none;
  background: transparent; border: 0; border-radius: 5px;
  color: var(--ink); cursor: pointer;
}
.sp-mark:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.sp-mark-svg { display: block; flex: 0 0 auto; border-radius: 5px; }
/* the coral is BRAND: the splash's `.bs-word b`, and the mark in every app
   of the suite. It reads on both grounds, so it is one value, not two. */
.sp-mark-word span { color: var(--brand); }
.sp-doctitle {
  /* Sized, not greedy: a title input that eats the slack pushed undo/redo away
     from the document they belong to and left them floating mid-bar. The
     spacer is the right group's margin-inline-start:auto. */
  /* a GHOST field, as slides' deck title: no box at rest, the shared field's
     border on hover, its fill and amber ring once focused */
  flex: 0 1 220px; width: 220px; min-width: 48px;
  height: auto; font-size: 14px; font-weight: 400;
  background: transparent; border-color: transparent; padding: 5px 8px;
}
.sp-doctitle:hover { border-color: var(--line); }
.sp-doctitle:focus { background: var(--field); border-color: var(--line); }
.sp-status {
  font-size: 12px; color: var(--muted); white-space: nowrap;
  opacity: 0; transition: opacity .18s;
}
.sp-status.sp-on { opacity: 1; }
.sp-spacer { flex: 1 1 auto; }

.sp-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 13px; color: var(--ink-2);
  background: transparent; border: 1px solid transparent;
  border-radius: 8px; padding: 6px 9px; cursor: pointer; white-space: nowrap;
}
.sp-btn:hover { background: var(--chrome-2); }
.sp-btn:active { background: var(--line); }
.sp-btn svg { display: block; }
.sp-btn[disabled] { opacity: .45; cursor: default; }
/* filled with the foreground, so its ink is the ground: `#fff` here would
   have been white on near-white the moment the theme flipped. */
.sp-primary { background: var(--ink); color: var(--bg); padding: 6px 14px; }
.sp-primary:hover { background: var(--ink-2); }
/* slides' update chip (.ed-btn-update): peach, bold, beside the wordmark,
   and in the DOM only while an update is waiting */
.sp-btn.sp-update { background: var(--update-bg); color: var(--update-ink); font-weight: 700; }
.sp-btn.sp-update:hover { background: var(--update-bg); filter: brightness(0.96); }
.sp-btn.sp-update[hidden] { display: none; }

/* `relative`: a panel below the drawer breakpoint is an absolute overlay of
   THIS box (the kernel's `.bkp-drawer`), under the bar and over the page. */
.sp-body { display: flex; flex: 1 1 auto; min-height: 0; position: relative; }

/* ————— the side panels: the kernel's (kernel/src/ui/panel.css) —————
   Width, resize strip, collapse chevron, RTL, the drawer: all the primitive's,
   through `--bkp-*`. A closed panel is 0px — the reading column gets its whole
   width back, which is the bargain the properties panel was built on — and its
   chevron docks flush to the screen edge so there is always a way back. */
.sp-app {
  --bkp-bg: var(--bg);
  --bkp-collapsed-w: 0px;
  --bkp-drawer-z: 50;
  --bkp-drawer-shadow: 0 0 50px rgb(var(--shade) / .3);
  --bkp-resizer-hover: color-mix(in srgb, var(--blue) 45%, transparent);
}
.bkp.bkp-collapsed { border-inline-width: 0; }
.bkp-start.bkp-collapsed .bkp-toggle { left: 0; transform: translateY(-50%); }
.bkp-end.bkp-collapsed .bkp-toggle { left: auto; right: 0; transform: translateY(-50%); }
[dir='rtl'] .bkp-start.bkp-collapsed .bkp-toggle { left: auto; right: 0; }
[dir='rtl'] .bkp-end.bkp-collapsed .bkp-toggle { right: auto; left: 0; }
.bkp-toggle { z-index: 15; box-shadow: 0 1px 4px rgb(var(--shade) / .12); }
.bkp-toggle:hover { color: var(--ink); border-color: var(--edge); }
/* On a phone the panels are drawers opened from the bar (Pages, and ⋯ →
   Properties): no strip, no chevron over the page's edge. */
.bkp-drawer > .bkp-resizer { display: none; }
.sp-scrim { position: fixed; inset: 0; background: rgb(var(--shade) / .3); z-index: 45; }

/* ————— sidebar ————— */
.sp-side {
  padding: 10px 8px max(16px, env(safe-area-inset-bottom));
}
.sp-side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 6px 8px;
}
.sp-side-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--muted);
}
.sp-tree { list-style: none; margin: 0; padding: 0; }
.sp-tree li { position: relative; }
.sp-treelink {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px; border-radius: 7px; color: var(--ink-2);
  text-decoration: none; font-size: 13.5px; line-height: 1.35;
}
.sp-treelink span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sp-treelink:hover { background: var(--chrome-2); }
.sp-treelink.sp-here { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgb(var(--shade) / .07); }
.sp-treelink.sp-drop { box-shadow: inset 0 0 0 2px var(--accent); }
.sp-tree-ico { flex: 0 0 auto; width: 16px; text-align: center; font-size: 13px; }
.sp-side-empty { color: var(--muted); font-size: 13px; padding: 10px; }

/* ————— the reading column ————— */
.sp-main {
  flex: 1 1 auto; overflow: auto; background: var(--bg);
  /* AS VARIABLES, because a full-bleed page cover has to escape exactly this
     padding with a negative margin, and this padding is four different numbers
     (here, on a phone, in reading view, on paper). A hard-coded -44px would be
     wrong in three of them, silently. */
  --sp-pad-x: 28px; --sp-pad-y: 44px;
  padding: var(--sp-pad-y) var(--sp-pad-x) 40vh;
}
.sp-page-inner { margin: 0 auto; font-size: var(--sp-read); }
.sp-title {
  font-size: 2.06em; line-height: 1.18; font-weight: 700;
  margin: 0 0 6px; letter-spacing: -0.02em;
}
.sp-title:focus { outline: none; }
.sp-title[data-empty]::before { content: attr(data-ph); color: var(--ph); }
.sp-crumb { font-size: 12.5px; color: var(--muted); margin: 0 0 14px; display: flex; gap: 6px; align-items: center; }
.sp-crumb a { color: var(--muted); text-decoration: none; }
.sp-crumb a:hover { color: var(--ink); text-decoration: underline; }

/* every block is a row with a hover gutter on its start edge */
.sp-b { position: relative; margin: 1px 0; padding: 3px 0; line-height: 1.65; }
.sp-gutter {
  position: absolute; inset-inline-start: -52px; top: 1px;
  display: flex; gap: 1px; opacity: 0; transition: opacity .12s;
}
.sp-b:hover > .sp-gutter, .sp-gutter:focus-within { opacity: 1; }

/* Desktop gutters sit outside the prose. Phone gutters join the block flow,
   so their sizing and spacing stay with the phone rules below. */
@media (min-width: 821px) {
  /* bottom:0, not height:stretch — an abspos box stretches the same way
     and `stretch` is Chrome-only (Firefox has none, Safari needs
     -webkit-fill-available), where it would silently drop back to the
     24px intrinsic height and lose the full-block hover/focus target. */
  .sp-gutter { top: 0; bottom: 0; padding-top: inherit; }
  .sp-b-h2 > .sp-gutter { align-items: center; margin-bottom: 2px; }
  .sp-b-number > .sp-gutter { inset-inline-start: -68px; }
  .sp-b-bullet > .sp-gutter { inset-inline-start: -64px; }
  .sp-b-code > .sp-gutter { margin: 6px 0; }
}

.sp-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 24px; padding: 0; border: 0; border-radius: 5px;
  color: var(--ghost); background: transparent; cursor: pointer;
}
.sp-ghost:hover { background: var(--chrome-2); color: var(--ink-2); }
.sp-ghost[draggable='true'] { cursor: grab; }
.sp-b.sp-dragging { opacity: .4; }
.sp-b.sp-dropline::after {
  content: ''; position: absolute; inset-inline: -8px; bottom: -2px; height: 2px;
  background: var(--blue); border-radius: 2px;
}

.sp-b-h1 { font-size: 1.56em; font-weight: 700; margin: 24px 0 2px; letter-spacing: -0.01em; }
.sp-b-h2 { font-size: 1.25em; font-weight: 700; margin: 20px 0 2px; }
.sp-b-h3 { font-size: 1.03em; font-weight: 700; margin: 16px 0 2px; }
.sp-b-quote {
  margin: 8px 0; padding: 2px 0 2px 15px;
  border-inline-start: 3px solid var(--line); color: var(--ink-2);
}
/* ————— inline marks —————
   The six marks the floating toolbar applies. `b/strong`, `i/em` and `u` need
   nothing — the browser's defaults are right — but `code` and `mark` inside
   prose had NO styling at all, so "inline code" and "highlight" were controls
   that appeared to do nothing. Scoped under .sp-body so the block-level code
   block (.sp-b-code code, its own rule) is untouched. */
.sp-body :is(p, li, h1, h2, h3, blockquote, td, th, figcaption) code {
  font: 0.92em/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--chrome-2); border: 1px solid var(--line); border-radius: 5px;
  padding: 0.1em 0.32em; word-break: break-word;
}
/* the accent at a tint a paragraph can be read through, and an explicit ink:
   `mark`'s UA default is black on yellow, which is not this document's ink */
.sp-body mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 .08em; }

/* THE #TAG CHIP.
   Drawn at render into content that is often contenteditable, and taken back
   out of whatever the editor commits (tags.ts). So it must stay INLINE and
   selectable-through: no `display: inline-block`, no `contenteditable=false`,
   no `user-select: none`. A caret has to be able to walk into it and a
   backspace has to delete one character, because inside the editor this is a
   word somebody is still typing. Everything here is paint. */
.sp-tag {
  color: var(--accent-ink);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-radius: 4px; padding: 0 .22em; cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.sp-tag:hover { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.sp-tag-kids { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.sp-tag-chip {
  font: inherit; font-size: 13px; cursor: pointer;
  color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 16%, transparent);
  border: 0; border-radius: 999px; padding: 3px 10px;
}
.sp-tag-chip:hover { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.sp-tag-count { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
/* No blanket link colour here. There was one — `.sp-body a { color: var(--blue) }`
   — and it never painted a single prose link: `.sp-page a` sets the ink at the
   same specificity and later in the sheet, so it won every time. What the rule
   DID reach was the page list, which `.sp-body` also wraps, where it beat
   `.sp-treelink`'s 0-1-0 and turned every page in the tree the blue of a
   hyperlink to somewhere else. A rule with no intended effect and one
   unintended one is not worth scoping; it is worth deleting. */

/* ————— the colour palette —————
   NINE COLOURS IN TWO ROLES: `sp-fg-*` is the ink on a SPAN, `sp-bg-*` is the
   band behind it on a MARK. Notion's shape, and its shape is what makes it
   safe — a closed vocabulary means the sanitizer matches a NAME instead of
   parsing CSS, and it means these values live here, in the app's stylesheet,
   where they can be tuned for the surface. A `style="color:#…"` in the
   document could be none of that.

   TOKENS, so the two roles cannot drift: one hue per colour, the ink at full
   strength and the band as a tint of the same hue. Chosen by measuring, not by
   eye — and measured TWICE, because the ground moved. The `--c-*` values live
   in the theme blocks at the top of this file: an ink that clears 4.5:1 on
   white is a smudge on a near-black ground, so each name carries a light value
   and a dark one. The BAND needs only one set, because it mixes into
   `transparent` and lands correctly on either. */
.sp-body .sp-fg-gray { color: var(--c-gray); }
.sp-body .sp-fg-brown { color: var(--c-brown); }
.sp-body .sp-fg-orange { color: var(--c-orange); }
.sp-body .sp-fg-yellow { color: var(--c-yellow); }
.sp-body .sp-fg-green { color: var(--c-green); }
.sp-body .sp-fg-blue { color: var(--c-blue); }
.sp-body .sp-fg-purple { color: var(--c-purple); }
.sp-body .sp-fg-pink { color: var(--c-pink); }
.sp-body .sp-fg-red { color: var(--c-red); }
.sp-body mark.sp-bg-gray { background: color-mix(in srgb, var(--c-gray) 22%, transparent); }
.sp-body mark.sp-bg-brown { background: color-mix(in srgb, var(--c-brown) 22%, transparent); }
.sp-body mark.sp-bg-orange { background: color-mix(in srgb, var(--c-orange) 22%, transparent); }
.sp-body mark.sp-bg-yellow { background: color-mix(in srgb, var(--c-yellow) 26%, transparent); }
.sp-body mark.sp-bg-green { background: color-mix(in srgb, var(--c-green) 22%, transparent); }
.sp-body mark.sp-bg-blue { background: color-mix(in srgb, var(--c-blue) 20%, transparent); }
.sp-body mark.sp-bg-purple { background: color-mix(in srgb, var(--c-purple) 20%, transparent); }
.sp-body mark.sp-bg-pink { background: color-mix(in srgb, var(--c-pink) 20%, transparent); }
.sp-body mark.sp-bg-red { background: color-mix(in srgb, var(--c-red) 20%, transparent); }

/* ON PAPER, COLOUR SURVIVES — and this is deliberately the OPPOSITE of the
   callout ruling forty lines below, which drops its tint. The difference is
   what else carries the meaning. A callout keeps its box, its heavier start
   rule, its tone's SHAPE and the tone's NAME spelled out, so the fill is
   decoration and dropping it costs nothing. An inline colour has no second
   cue at all: drop it and the sentence prints as ordinary prose, with the
   distinction the author drew silently gone — data loss, not decluttering.
   The area is also a few words rather than a paragraph-sized block of ink.
   `print-color-adjust: exact` because browsers drop backgrounds on paper by
   default, so without it the band would go while the ink stayed. */
@media print {
  .sp-body [class*='sp-fg-'], .sp-body mark {
    print-color-adjust: exact; -webkit-print-color-adjust: exact;
  }
}

/* ————— the floating selection toolbar —————
   Body-mounted (see formatbar.ts (1)), so it is positioned in VIEWPORT
   coordinates and owes nothing to the page's layout. Below .sp-pop's 60: a
   menu or dialog that opens over a selection is the thing being used. */
.sp-fmt {
  position: fixed; z-index: 58; display: flex; align-items: center; gap: 2px;
  padding: 3px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; box-shadow: 0 6px 22px rgb(var(--shade) / .17);
  max-width: calc(100vw - 16px);
}
.sp-fmt-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 7px; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink-2); cursor: pointer;
  font: inherit; font-size: 13px;
}
.sp-fmt-btn:hover { background: var(--chrome-2); color: var(--ink); }
.sp-fmt-btn.sp-fmt-on { background: var(--chrome-2); color: var(--blue); }
.sp-fmt-gap { margin-inline-start: 4px; border-inline-start: 1px solid var(--line); border-radius: 0 6px 6px 0; }
.sp-fmt-url { width: 240px; max-width: 46vw; }
.sp-fmt-url.sp-fmt-bad { border-color: var(--c-red); }
.sp-fmt-go { color: var(--blue); font-weight: 600; }
/* the palette takes the bar over while it is open — two rows, so the bar
   becomes a column for as long as it is showing */
.sp-fmt-pal { flex-direction: column; align-items: stretch; gap: 3px; padding: 7px; }
.sp-fmt-pal-h { font-size: 11px; font-weight: 600; color: var(--muted); padding: 2px 2px 0; }
.sp-fmt-sw-row { display: flex; gap: 3px; }
.sp-fmt-sw {
  width: 26px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--ink); cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 700; line-height: 1;
}
.sp-fmt-sw:hover { border-color: var(--ink-2); }
/* the swatch SHOWS what it does: an A in the ink for the text row, an A on the
   band for the background row. A grid of anonymous squares makes you click one
   to find out what it was. */
.sp-fmt-sw.sp-fg-gray { color: var(--c-gray); } .sp-fmt-sw.sp-fg-brown { color: var(--c-brown); }
.sp-fmt-sw.sp-fg-orange { color: var(--c-orange); } .sp-fmt-sw.sp-fg-yellow { color: var(--c-yellow); }
.sp-fmt-sw.sp-fg-green { color: var(--c-green); } .sp-fmt-sw.sp-fg-blue { color: var(--c-blue); }
.sp-fmt-sw.sp-fg-purple { color: var(--c-purple); } .sp-fmt-sw.sp-fg-pink { color: var(--c-pink); }
.sp-fmt-sw.sp-fg-red { color: var(--c-red); }
.sp-fmt-sw.sp-bg-gray { background: color-mix(in srgb, var(--c-gray) 22%, var(--surface)); }
.sp-fmt-sw.sp-bg-brown { background: color-mix(in srgb, var(--c-brown) 22%, var(--surface)); }
.sp-fmt-sw.sp-bg-orange { background: color-mix(in srgb, var(--c-orange) 22%, var(--surface)); }
.sp-fmt-sw.sp-bg-yellow { background: color-mix(in srgb, var(--c-yellow) 26%, var(--surface)); }
.sp-fmt-sw.sp-bg-green { background: color-mix(in srgb, var(--c-green) 22%, var(--surface)); }
.sp-fmt-sw.sp-bg-blue { background: color-mix(in srgb, var(--c-blue) 20%, var(--surface)); }
.sp-fmt-sw.sp-bg-purple { background: color-mix(in srgb, var(--c-purple) 20%, var(--surface)); }
.sp-fmt-sw.sp-bg-pink { background: color-mix(in srgb, var(--c-pink) 20%, var(--surface)); }
.sp-fmt-sw.sp-bg-red { background: color-mix(in srgb, var(--c-red) 20%, var(--surface)); }
.sp-fmt-back { align-self: flex-start; margin-top: 2px; color: var(--muted); }
/* A COARSE POINTER GETS THE BOTTOM EDGE, not the selection. The OS callout and
   the selection handles own the pixels around a touch selection; sharing them
   is how a toolbar becomes a thing you dismiss rather than a thing you use. */
.sp-fmt-dock {
  inset-inline: 0; bottom: 0; top: auto !important; left: 0 !important;
  max-width: none; border-radius: 0; border-inline: 0; border-bottom: 0;
  justify-content: center; flex-wrap: wrap;
  padding: 6px max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  box-shadow: 0 -6px 22px rgb(var(--shade) / .14);
}
/* All nine on ONE row at 375px — measured: at 40px wide they wrapped, and
   "Clear formatting" sat alone on a second row looking like a separate
   control. 36px is still comfortably over the 34px touch target this app's
   other phone chrome uses. */
.sp-fmt-dock { gap: 1px; }
.sp-fmt-dock .sp-fmt-btn { min-width: 36px; height: 38px; padding: 0 2px; }
.sp-fmt-dock .sp-fmt-gap { margin-inline-start: 2px; }
.sp-fmt-dock .sp-fmt-url { width: auto; flex: 1 1 160px; max-width: none; }
/* It is chrome, and chrome is never on paper. Belt as well as braces: the bar
   is also removed the moment the selection collapses, and print does not run
   in the reading view's way. */
@media print { .sp-fmt { display: none !important; } }

/* ————— callouts —————
   The tone is carried by the MARK'S SHAPE (circle, bulb, square, triangle,
   octagon) and by its name spelled out beside it. The tint is decoration: it
   must be possible to tell a warning from a tip with no colour vision, on a
   monochrome printout, and at a glance — and amber/red/green happen to be the
   hues the most readers cannot separate.

   The BODY TEXT stays --ink, never the tone colour. Coloured prose is a
   readability tax on the sentence that mattered enough to put in a box. */
.sp-b-callout {
  /* THE TONE IS ONE HUE, AND THE BOX IS DERIVED FROM IT AGAINST THE GROUND.
     The fill is that hue mixed into --bg and the label is it mixed into --ink,
     so the same five numbers give a pale tint with a dark label on white and a
     deep tint with a lifted label on near-black. Fifteen hand-tuned values
     would have needed thirty, and thirty values drift.
     --tone-h is the neutral fallback: a tone class always lands on top of it,
     but a stylesheet that only works with one is a stylesheet with a hole. */
  --tone-h: var(--muted);
  --tone-bg: color-mix(in srgb, var(--tone-h) 13%, var(--bg));
  --tone-line: var(--tone-h);
  --tone-ink: color-mix(in srgb, var(--tone-h) 50%, var(--ink));
  display: block; margin: 10px 0; padding: 9px 14px 10px;
  border: 1px solid var(--tone-line); border-inline-start-width: 4px;
  border-radius: var(--radius); background: var(--tone-bg);
}
.sp-callout-chip {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 2px; padding: 0; font: inherit; text-align: start;
  color: var(--tone-ink); background: transparent; border: 0;
  font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
  user-select: none;
}
button.sp-callout-chip { cursor: pointer; }
button.sp-callout-chip:hover { text-decoration: underline; text-underline-offset: 3px; }
.sp-callout-mark {
  display: inline-flex; align-items: center; justify-content: center;
  /* an author-supplied glyph is any string a file carried: hold the row height
     whatever arrives, and never let it push the label off the line */
  min-width: 17px; max-width: 34px; overflow: hidden; line-height: 1;
}
.sp-callout-mark svg { width: 15px; height: 15px; display: block; }
.sp-callout-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-callout-body { padding-inline-start: 0; }
.sp-callout-body > .sp-b:first-child { margin-top: 4px; }
.sp-b-callout .sp-list { padding-inline-start: 20px; }

.sp-tone-note { --tone-h: var(--tone-note); }
.sp-tone-tip { --tone-h: var(--tone-tip); }
.sp-tone-important { --tone-h: var(--tone-important); }
.sp-tone-warning { --tone-h: var(--tone-warning); }
.sp-tone-caution { --tone-h: var(--tone-caution); }
/* the same tone, outside a callout: the search result's icon has no
   .sp-b-callout above it to derive --tone-ink, so it derives its own */
.sp-result-ico.sp-tone-note, .sp-result-ico.sp-tone-tip, .sp-result-ico.sp-tone-important,
.sp-result-ico.sp-tone-warning, .sp-result-ico.sp-tone-caution {
  color: color-mix(in srgb, var(--tone-h) 50%, var(--ink));
}

.sp-tonepop { width: 244px; }
.sp-dditem.sp-sel { background: var(--chrome-2); }
.sp-tonerow { display: block; padding: 8px 9px 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.sp-tonelabel { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.sp-toneicon { width: 100%; }

.sp-b-divider { padding: 12px 0; }
.sp-b-divider hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
.sp-list { margin: 2px 0; padding-inline-start: 24px; }
.sp-b-todo { list-style: none; margin-inline-start: -22px; }
.sp-b-todo.sp-done > .sp-text { text-decoration: line-through; color: var(--muted); }

.sp-b-todo, .sp-b-toggle { display: flex; align-items: flex-start; gap: 8px; }
/* a toggle's BODY is not a sibling column of its title — it wraps onto its own
   full-width line underneath, or the folded content sits beside the heading */
.sp-b-toggle { flex-wrap: wrap; }
.sp-b-todo > .sp-text, .sp-b-toggle > .sp-text { flex: 1 1 auto; }
.sp-check { flex: 0 0 auto; margin: 6px 0 0; accent-color: var(--ink); }

.sp-text { display: block; min-width: 1px; }
.sp-text:focus { outline: none; }
/* the prompt shows on the block you are IN, not on every empty one — a page of
   "Type / for blocks" reads as clutter, not as help */
.sp-text[data-empty]:focus::before { content: attr(data-ph); color: var(--ph); pointer-events: none; }

.sp-b-code { position: relative; }
.sp-b-code pre {
  margin: 6px 0; padding: 12px 14px; overflow-x: auto;
  background: var(--chrome); border: 1px solid var(--line); border-radius: var(--radius);
}
.sp-b-code code { font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.sp-b-code code:focus { outline: none; }

/* ————— syntax colours —————
   Six roles. `--code-*` are defined per theme at the top of this file; the
   other two reuse the suite's palette — comments are --muted and numbers are
   --accent-ink, because a syntax theme that invents a ninth grey is a syntax
   theme nobody can restyle. Both of those flip with the ground already. */
.sp-t-c { color: var(--muted); font-style: italic; }
.sp-t-s { color: var(--code-str); }
.sp-t-n { color: var(--accent-ink); }
.sp-t-k { color: var(--code-key); }
.sp-t-l { color: var(--code-lit); }
.sp-t-p { color: var(--code-prop); }

/* The chip FLOATS OVER the top-right of the well, exactly like .sp-imgtools
   floats over an image — same shadow, same hover-only rule. It can cover the
   end of a long first line, and the alternative (parking it outside the text
   column, where the block gutter lives) only has room on a wide window with the
   sidebar closed. A control that moves depending on the viewport is worse than
   one that overlaps for as long as your pointer is on the block. */
.sp-langchip {
  position: absolute; top: 10px; inset-inline-end: 10px;
  font-size: 11px; padding: 3px 8px; color: var(--muted);
  background: color-mix(in srgb, var(--surface) 94%, transparent); border-color: var(--line);
  box-shadow: 0 2px 8px rgb(var(--shade) / .12);
  opacity: 0; transition: opacity .12s;
}
.sp-b-code:hover .sp-langchip, .sp-langchip:focus { opacity: 1; }
.sp-langpop { width: 190px; }

.sp-twist {
  flex: 0 0 auto; border: 0; background: transparent; color: var(--muted);
  cursor: pointer; padding: 3px 0 0; line-height: 1;
  transition: transform .14s;
}
.sp-twist svg { display: block; }
.sp-twist[aria-expanded='true'] { transform: rotate(90deg); }
.sp-toggle-body { flex: 1 0 100%; padding-inline-start: 22px; }

.sp-b-image figure { margin: 12px 0; }
/* AN IMAGE ON A DARK GROUND. A photograph is fine; a screenshot, a diagram
   or a logo exported with a transparent background is a shape floating in
   nothing, and a white-on-transparent diagram disappears entirely. So a
   picture in the reading column always has a ground of its OWN to sit on —
   white in both themes, because that is the ground the author exported
   against — and a hairline so its edge is where the author put it. The
   picture is document content: it is not inverted, dimmed or filtered. */
.sp-b-image img {
  max-width: 100%; height: auto; border-radius: var(--radius); display: block;
  background: #fff; box-shadow: 0 0 0 1px rgb(var(--shade) / .12);
}
.sp-b-image figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* ————— tables —————
   The block is `sp-b-table`; everything inside it is `sp-tb-*`. NOT `sp-col-*`
   or `sp-cell-*`: `.sp-col` is already the board's column and `sp-col-resizing`
   is already a body class, so a table column reusing either name would style
   the tracker's board from four hundred lines away. */
.sp-b-table { margin: 14px 0; position: relative; }
/* A WIDE TABLE SCROLLS. The measure belongs to the document, so a six-column
   table must not widen the prose column on a phone — it gets its own scroller
   and the paragraph above it keeps its line length. */
/* `overscroll-behavior-x` for the reason spelled out on `.sp-board`: a
   sideways swipe that runs out of table must stop, not become the browser's
   back gesture. */
.sp-tb-wrap { overflow-x: auto; overscroll-behavior-x: contain; position: relative; }
.sp-tb {
  width: 100%; border-collapse: collapse; table-layout: fixed;
  font-size: 15px; line-height: 1.5;
}
.sp-tb-cell {
  border: 1px solid var(--line); padding: 7px 10px;
  text-align: start; vertical-align: top; word-break: break-word;
}
.sp-tb thead .sp-tb-cell { background: var(--chrome); font-weight: 600; }
/* Every cell gets a line box even when it is empty, or a table of blanks
   collapses into a stack of hairlines with nowhere to click. A pseudo-element,
   so it is not in the cell's innerHTML and can never reach the model. */
.sp-tb-cell::after { content: ''; display: inline-block; width: 0; height: 1.5em; vertical-align: text-bottom; }
.sp-tb-cell:focus { outline: 2px solid var(--blue); outline-offset: -2px; }

/* the tools ride over the block like .sp-imgtools, and appear on hover/focus */
.sp-tb-tools {
  position: absolute; inset-block-start: -13px; inset-inline-end: 0;
  display: flex; gap: 4px; opacity: 0; transition: opacity .12s;
  background: var(--surface); padding: 2px; border-radius: 8px; z-index: 2;
}
.sp-b-table:hover .sp-tb-tools, .sp-tb-tools:focus-within, .sp-b-table:focus-within .sp-tb-tools { opacity: 1; }
.sp-tb-tools .sp-btn { font-size: 12px; padding: 2px 7px; }
.sp-tb-tools .sp-on { background: var(--chrome-2); }

/* The column-boundary grip: a hit target wider than the line it moves. It sits
   in the WRAPPER, over the boundary, never inside a cell — a cell's innerHTML
   is the model, so chrome parked in one gets written into the document (and
   the caret lands in it). Editor chrome, added in wire(): the renderer is the
   same for the reading view, print and the still preview. */
.sp-tb-grip {
  position: absolute; top: 0; width: 7px;
  cursor: col-resize; z-index: 1; background: transparent; border: 0; padding: 0;
}
.sp-tb-grip:hover, body.sp-col-resizing .sp-tb-grip { background: color-mix(in srgb, var(--blue) 45%, transparent); }

.sp-pagecard {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; margin: 6px 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px;
  background: var(--surface);
}
.sp-pagecard:hover { background: var(--chrome); }
.sp-pagecard.sp-dead { color: var(--muted); font-style: italic; font-weight: 400; }

/* ————— embeds (transclusion) —————
   A QUOTATION, DRAWN AS ONE. The rule down the left edge and the inset are the
   blockquote's, not the page card's: what is inside came from somewhere else
   and is being shown here, which is exactly what a quote mark has always meant.
   The card border was tried and read as a widget — a thing to press rather than
   a passage to read.

   The source line is the ATTRIBUTION and sits above the content, small and
   quiet, because it is a citation and not a heading. It is also the way back to
   the page, so it keeps a hover state; a citation nobody can click is how a
   reader ends up searching the sidebar for the page they are already looking at. */
.sp-b-embed { margin: 10px 0; }
.sp-embed { border-inline-start: 3px solid var(--line); padding-inline-start: 14px; }
.sp-embed-src {
  display: block; font-size: 12px; color: var(--muted);
  text-decoration: none; margin-bottom: 4px;
}
a.sp-embed-src:hover { color: var(--ink); text-decoration: underline; }
.sp-embed-src.sp-dead { font-style: italic; }
/* The nested page's own blocks keep their spacing, minus the first and last
   margins — an embed that opens with a blank line looks like a rendering bug. */
.sp-embed-body > :first-child { margin-block-start: 0; }
.sp-embed-body > :last-child { margin-block-end: 0; }
/* A NAMED PLACEHOLDER, never a blank: a cycle, a depth stop and a missing page
   each say which one they are, in the reader's language. */
.sp-embed-note { color: var(--muted); font-style: italic; font-size: 13px; margin: 0; }

/* ————— link cards (outward) —————
   Deliberately the page card's sibling: same border, radius and hover, so the
   two read as one family and the difference a reader sees is the one that
   matters — a host name at the foot means this one leaves the space. */
.sp-b-link { position: relative; }
.sp-linkcard {
  display: flex; align-items: stretch; gap: 12px;
  padding: 12px 14px; margin: 6px 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); text-decoration: none; background: var(--surface);
}
.sp-linkcard:hover { background: var(--chrome); }
.sp-page a.sp-linkcard { text-decoration: none; }
.sp-linkcard.sp-dead { color: var(--muted); }
.sp-linkcard-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.sp-linkcard-title { font-weight: 600; font-size: 14px; }
.sp-linkcard.sp-dead .sp-linkcard-title { font-style: italic; font-weight: 400; }
.sp-linkcard-desc {
  font-size: 13px; color: var(--muted);
  /* two lines, then an ellipsis: a card is a summary, and a pasted paragraph
     must not turn one into a page of its own */
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.sp-linkcard-site {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--muted);
  /* a long url has no spaces to wrap at and would push the card wide */
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sp-linkcard-mark { font-size: 13px; line-height: 1; }
.sp-linkcard-img {
  width: 88px; height: 66px; object-fit: cover; flex: none;
  border-radius: calc(var(--radius) - 3px); background: var(--chrome);
}
.sp-linkcard-edit {
  position: absolute; inset-block-start: 4px; inset-inline-end: 6px;
  border: 1px solid var(--line); border-radius: 5px; background: var(--surface);
  font: inherit; font-size: 11px; color: var(--muted);
  padding: 2px 7px; cursor: pointer; opacity: 0;
}
.sp-b-link:hover .sp-linkcard-edit, .sp-linkcard-edit:focus-visible { opacity: 1; }
/* an EMPTY card's button is the only way in, so it never hides */
.sp-linkcard.sp-dead + .sp-linkcard-edit { opacity: 1; }

.sp-page a { color: var(--ink); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent); text-underline-offset: 2px; }
.sp-page a:hover { text-decoration-color: var(--accent); }

/* ————— backlinks ————— */
.sp-backlinks { padding-top: 16px; border-top: 1px solid var(--line); margin-top: 54px; }
.sp-backlinks:empty { display: none; }
.sp-backlinks-h {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--muted); margin: 0 0 8px;
}
.sp-backlink-list { list-style: none; margin: 0; padding: 0; }
.sp-backlink-list li { margin: 5px 0; font-size: 13.5px; }
.sp-backlink-list a { font-weight: 600; text-decoration: none; color: var(--ink); }
.sp-backlink-list a:hover { text-decoration: underline; }
.sp-snippet { color: var(--muted); margin-inline-start: 8px; }

/* Unlinked mentions: the same list as the backlinks, one step quieter, with
   the Link button only visible on hover/focus so a page with thirty of them
   is not thirty buttons shouting. Focus-within keeps it reachable by keyboard,
   where hover does not exist at all. */
.sp-mentions { padding-top: 16px; margin-top: 22px; }
.sp-mentions:empty { display: none; }
.sp-mentions .sp-backlink-list li { display: flex; align-items: baseline; gap: 6px; }
.sp-mentions .sp-snippet { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-mention-link { flex: none; padding: 1px 8px; font-size: 12px; opacity: 0; transition: opacity 0.12s; }
.sp-mentions li:hover .sp-mention-link,
.sp-mentions li:focus-within .sp-mention-link { opacity: 1; }
@media (hover: none) { .sp-mention-link { opacity: 1; } }

/* ————— dialogs: the kernel's (kernel/src/ui/dialog.css) —————
   Every modal is `createDialog`. Its look comes through `--bkd-*`, set on the
   root because the scrim is mounted on <body>, outside `.sp-app`. The heading
   is the kernel's `.bkd-title`, 17px/650 (D4). */
:root {
  --bkd-radius: var(--radius-lg);
  --bkd-shadow: var(--shadow-dlg);
  --bkd-scrim: var(--scrim);
  --bkd-body-ink: var(--ink);
}
/* ————— SLIDES PARITY: dialogs —————
   slides' `.ed-about` card and `.ed-about-overlay` scrim (slides/src/
   styles.css): the same 14px corner, no frame, 20px in, 13px text, slides'
   shadow and scrim, and slides' surface in dark. Widths are slides' too:
   About 440, the shortcut sheet 700. The heading stays the kernel's 17px/650
   title where a dialog has one (D4) — slides' 19.5px/700 `h2` is the deviation,
   filed for slides. Kernel defaults that differ: frame 1px --line (none),
   padding 20px 22px (20px), shadow 0 18px 60px /.30 (0 18px 50px
   rgb(15 23 36 / .3)), scrim rgb(20 30 45 / .44) (rgb(15 23 36 / .38)). */
:root {
  --bkd-bg: var(--pop-bg);
  --bkd-border: transparent;
  --bkd-shadow: 0 18px 50px rgb(15 23 36 / 0.3);
  --bkd-scrim: rgb(15 23 36 / 0.38);
}
.bkd-card.sp-dlg { padding: 20px; font-size: 13px; }
/* slides' .ed-about width, for About and the Save menu's own dialogs */
.bkd-card.sp-dlg.sp-dlg-about, .bkd-card.sp-dlg.sp-dlg-narrow { width: 440px; }
.sp-dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; padding: 0; }
.sp-note.sp-dlg-err { color: var(--c-red); min-height: 1em; margin: 0 4px; }
.sp-ab-field > span { flex: 0 0 120px; font-size: 12px; color: var(--muted); }
/* Selectors carry `.bkd-*` twice where they override the kernel sheet, which
   the bundle places after this file. */
.bkd-card.sp-dlg { width: 560px; }
.bkd-card.sp-dlg-wide { width: 700px; max-width: min(700px, 100%); }
.bkd-card.sp-dlg .bkd-title { letter-spacing: -0.005em; }
/* a palette (search, "link to page") sits high and grows DOWN, so a result
   list arriving does not re-centre the card under the pointer */
.bkd-overlay.sp-dlg-top { align-items: flex-start; padding-top: 11vh; }
/* the graph is a viewer: the whole card is its canvas */
.bkd-card.sp-dlg-graph { width: auto; max-width: none; padding: 0; overflow: hidden; }
.bkd-overlay:has(.sp-dlg-graph) { padding: 14px; }
.sp-card-h {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); margin: 2px 4px 8px;
}
.sp-find { width: 100%; }
.sp-results { list-style: none; margin: 8px 0 0; padding: 0; }
.sp-result {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: start; font: inherit; color: var(--ink);
  background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 9px; cursor: pointer;
}
.sp-result:hover, .sp-result.sp-sel { background: var(--pop-hover); }
.sp-result-ico { flex: 0 0 auto; color: var(--muted); display: flex; }
.sp-result-txt { min-width: 0; }
.sp-result strong { display: block; font-size: 13px; font-weight: 600; }
.sp-result span {
  display: block; color: var(--muted); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sp-result.sp-new { color: var(--blue); }
.sp-noresult { color: var(--muted); padding: 12px 10px; font-size: 13.5px; }
.sp-arch { color: var(--muted); font-size: 11px; font-style: normal; }

/* the block menu is anchored to the caret, not centred on the screen */
.sp-pop {
  /* max-height is set per placement by editor.ts place(), from the room the
     anchor actually leaves. The 44vh that used to live here clipped the share
     panel's primary action off the bottom on an ordinary laptop. This value is
     only the fallback for a popover placed some other way. */
  position: fixed; z-index: 60; width: 260px; max-height: 80vh; overflow: auto;
  /* slides' menu surface (the parity block), as every popover from the bar */
  background: var(--pop-bg); border: 1px solid var(--pop-line); border-radius: var(--radius);
  box-shadow: var(--pop-shadow); padding: 6px;
}

/* ————— banners + gates ————— */
.sp-banner {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  /* an accent WASH on whatever the ground is: `#fff6dd` was cream on white
     and a bright card on a dark chrome. */
  background: color-mix(in srgb, var(--accent) 15%, var(--bg)); color: var(--accent-ink);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); font-size: 13.5px;
}
.sp-banner .sp-btn { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent-ink) 30%, transparent); }
/* the default action (the recovery banner's "Keep the file") is slides' primary
   on its banner: ink ground, page text, not the wash-coloured outline */
.sp-banner .sp-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.sp-banner .sp-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.sp-gate { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--chrome); }
.sp-gate-card {
  max-width: 620px; background: var(--surface); padding: 26px;
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 14px 40px rgb(var(--shade) / .12);
}
.sp-gate-card h1 { font-size: 21px; margin: 0 0 8px; letter-spacing: -0.01em; }
.sp-gate-card p { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.sp-gate-card .sp-btn { margin-inline-end: 8px; }
.sp-gate-card .sp-find { margin-bottom: 12px; }
.sp-gate-raw {
  margin-top: 16px; padding: 12px; max-height: 30vh; overflow: auto;
  background: var(--chrome); border: 1px solid var(--line); border-radius: 8px;
  font: 12px/1.5 ui-monospace, monospace; white-space: pre-wrap; color: var(--muted);
}
.sp-empty { color: var(--muted); }

/* ————— about —————
   Slides' dialog, in this app's tokens: one scrolling card, sections with real
   headings, and the weightier things last and marked. Everything that opens
   inside it opens IN FLOW — the card scrolls, and a scroll container clips
   BOTH axes (hard-won #10), so a floating child of it would be cut on the left
   and the bottom with nothing to show for it. */
.sp-note { color: var(--muted); font-size: 12.5px; margin: 6px 4px 10px; line-height: 1.55; }
/* The kernel dialog's card is the scroller and sizes itself to the viewport
   (a bottom sheet on a phone); this is the column inside it. */
.sp-about {
  display: flex; flex-direction: column; gap: 2px;
  /* Sections are flex items, and a flex item SHRINKS by default — which is how
     slides' update block collapsed to its min-height and spilled its children
     over the controls beneath it. Let the card scroll instead; that is what
     its overflow is for. */
  overscroll-behavior: contain;
}
.sp-about > * { flex-shrink: 0; }
.sp-ab-sec {
  padding-top: 14px; margin-top: 12px;
  border-top: 1px solid var(--line);
}
.sp-about .sp-card-h { margin: 0 2px 8px; }
/* the head and the promo line are the title of the dialog, not a section */
.sp-ab-promo { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 6px 4px 2px; }
.sp-ab-promo a { color: color-mix(in srgb, var(--blue) 72%, var(--ink)); text-decoration: underline; text-underline-offset: 2px; }
.sp-ab-promo a:hover { text-decoration: underline; }

/* What is in this file. Four numbers, and then the sentence that explains
   them — a space is big because of its images, always. */
.sp-ab-stats {
  /* 112px, not 96: at 96 a 351px card fitted THREE and left the fourth alone
     on its own row. 112 makes it 2×2 on a phone and one row of four on a
     desktop card, which is the same readout either way rather than a ragged
     one. Measured inner widths: 315px at 375, 524px at 1600. */
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px; margin: 0 2px 4px;
}
/* four across in slides' 440 card; two by two on a narrow phone */
@media (max-width: 420px) { .sp-ab-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sp-ab-stat {
  background: var(--chrome); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; min-width: 0;
}
.sp-ab-stat b {
  display: block; font-size: 17px; letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis;
}
.sp-ab-stat span { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }

/* a labelled field, the shape slides' document properties use */
.sp-ab-field { display: flex; align-items: center; gap: 10px; padding: 2px 4px 8px; }
.sp-ab-field label { flex: 0 0 auto; font-size: 12px; color: var(--muted); }
.sp-ab-field .sp-input { flex: 1 1 auto; min-width: 0; }

/* `.sp-btn` is transparent by design — the topbar is icon-only and a row of
   outlined boxes there would be noise. In THIS card the same class has to read
   as a control against a white panel with no hover to help it, so the dialog
   gives every non-primary button its border back. Slides' about does exactly
   this, for exactly this reason.
   EVERY dialog, not only About: Import's "Choose a folder…" and "Choose a
   space…" and Export's "Close" rendered as bare words beside a filled primary,
   with nothing to say they were buttons. And the primary's ink is the GROUND,
   never `#fff` — on the dark theme's near-white fill `#fff` was invisible. */
.bkd-card .sp-btn { border-color: var(--line); background: var(--pop-bg); }  /* slides' About: --surface */
.bkd-card .sp-btn:hover { background: var(--chrome-2); }
.bkd-card .sp-primary { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.bkd-card .sp-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }

.sp-ab-check {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--muted); cursor: pointer;
  user-select: none; padding: 2px 4px 4px;
}
.sp-ab-status { display: flex; flex-direction: column; gap: 8px; }

/* the one moment in the dialog with a decision in it, given its own room */
.sp-ab-update {
  display: flex; flex-direction: column; gap: 8px;
  padding: 11px 13px; margin: 2px 4px;
  border: 1px solid var(--line); border-radius: 10px;
}
.sp-ab-update .sp-note { margin: 0; }
.sp-ab-new { font-weight: 650; font-size: 13.5px; }
.sp-ab-release {
  color: var(--ink-2); background: var(--chrome); border-radius: 8px;
  padding: 9px 12px; line-height: 1.5; font-size: 12.5px;
  /* Its OWN scroll region, sized off the viewport: release.mjs caps the notes
     at five bullets plus an "…and N more" line, which fits whole at any normal
     height, and anything longer scrolls HERE rather than the whole dialog. */
  max-height: min(300px, 42vh); overflow-y: auto; overflow-wrap: anywhere;
}
.sp-ab-release > div + div { margin-top: 5px; }
/* hanging indent: a wrapped bullet lines up under its own text, not the marker */
.sp-ab-note { padding-inline-start: 14px; text-indent: -14px; }
.sp-ab-note::before { content: '•\00a0'; }
.sp-ab-more { color: var(--muted); font-style: italic; }
.sp-ab-link { border-color: var(--line); }

/* Weightier by construction: a marked button, and a confirmation that says
   what will happen before the verb is offered. */
.sp-about .sp-ab-danger { color: #a3231a; border-color: rgb(163 35 26 / .3); }
.sp-about .sp-ab-danger:hover { background: #fdeceb; }
.sp-ab-confirm {
  margin: 8px 4px 2px; padding: 11px 13px;
  background: #fdf4f3; border: 1px solid rgb(163 35 26 / .28); border-radius: 10px;
}
.sp-ab-confirm strong { display: block; font-size: 13.5px; }
.sp-ab-confirm .sp-note { margin: 5px 0 8px; }
.sp-ab-confirm .sp-actions { padding: 0; }
.sp-about .sp-ab-go { background: #a3231a; color: #fff; border-color: #a3231a; }
.sp-about .sp-ab-go:hover { background: #8a1d15; }
.sp-ab-json { width: 100%; margin-bottom: 8px; font: 11.5px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
.sp-ab-json.sp-ab-bad { border-color: #a3231a; }

.sp-ab-fine {
  font-size: 10.5px; line-height: 1.5; color: var(--muted);
  border-top: 1px solid var(--line); margin: 14px 4px 0; padding-top: 10px;
}
/* Close stays reachable at the end of the list rather than pinned over it: a
   sticky footer inside a scroll container is one more thing to clip. */
.sp-ab-foot { display: flex; justify-content: flex-end; padding: 10px 4px 2px; }
.sp-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px; font-size: 14px; }
.sp-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 4px; }
.sp-mono { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }

/* ————— phone ————— */
.sp-menu { display: none; }
@media (max-width: 820px) {
  .sp-menu { display: inline-flex; }
  .sp-main { --sp-pad-x: 18px; --sp-pad-y: 26px; padding: var(--sp-pad-y) var(--sp-pad-x) 45vh; }
  /* THE MARGIN THE GUTTER LIVES IN — see below — and it hangs off the PAGE, not
     off `.sp-main`. `.sp-main` is chrome and follows the interface direction;
     the gutter is anchored to a block, and blocks follow the DOCUMENT's
     direction (`renderPage` puts `theme.dir` on `.sp-page-inner`). Reserving it
     on the scroller sent the padding left while an rtl document sent the gutter
     right: measured at 390px on a doc with `theme.dir: 'rtl'`, the gutter
     landed at x = 378…412 and the column scrolled to 412. On the inner element
     the two flip together. The end side is untouched: the page is not centred
     at this width, so widening both would cost twice. */
  .sp-page-inner { padding-inline-start: 26px; }
  /* THE GUTTER STAYS ON TOUCH, AND STOPS TAKING A ROW.
     It used to be display:none here, on the reasoning that there is no hover —
     but hover was how you reached the only controls a block has, so hiding it
     meant a block could not be reordered or deleted on a phone AT ALL. The fix
     for that made it `position: static`, which put it IN the flow: measured at
     390px, a one-line paragraph was 68px tall and 36px of that was the two
     affordances. Half the page was chrome.
     So it goes back to being absolutely positioned, the way it is on a desktop,
     in a 44px start margin reserved for it — visible at rest (no hover to
     discover it with), out of the flow, and costing 0px of height. It keeps ONE
     control: the grip, whose menu already offers "Add below", so the + is a
     second button for something a thumb can already reach.
     Measured: one-line paragraph 68.4px → 32.4px; the column loses 26px of
     width (354 → 328) to buy it back. */
  .sp-gutter { opacity: 1; top: 0; inset-inline-start: -40px; }
  .sp-gutter .sp-ghost-add { display: none; }
  /* 34×32 rather than a full 44: it must fit beside a 26px line of text without
     overlapping the block above or below it, and the margin it sits in is
     coming out of the prose. */
  .sp-gutter .sp-ghost { width: 34px; height: 32px; }
  .sp-gutter .sp-ghost svg { width: 17px; height: 17px; }
  .sp-title { font-size: 27px; }
}

/* ————— print: the only export-to-PDF path, so it is a contract ————— */
@media print {
  /* PAPER IS NOT A SCREEN. --sp-read grows with the viewport, and the viewport
     while printing is whatever window happened to be open — so without this the
     same document would set larger printed from a 27-inch monitor than from a
     laptop. Pinned. */
  :root {
    --sp-read: 16px;
    /* PAPER IS LIGHT, AND IT COSTS NOTHING TO SAY SO. Both dark blocks at the
       top of this file are `@media screen`, so none of their tokens reach
       here and the light palette is simply what applies — no third copy.
       What DOES reach here is kernel/src/theme.ts's `color-scheme` on the
       <html> element, which is an inline style and beats a media query; an
       author !important is the one thing that beats an inline style. Without
       it a dark reader's UA furniture prints dark over our white. */
    color-scheme: only light !important;
  }
  .sp-bar, .bkp, .sp-side, .sp-insp, .sp-banner, .sp-gutter, .sp-scrim, .sp-langchip { display: none !important; }
  .sp-tb-tools, .sp-tb-grip { display: none !important; }
  .sp-main { overflow: visible; --sp-pad-x: 0px; --sp-pad-y: 0px; padding: 0; background: #fff; }
  .sp-toggle-body[hidden] { display: block !important; }  /* toggles print OPEN */
  .sp-b-h1, .sp-b-h2, .sp-b-h3, .sp-title { break-after: avoid; }
  .sp-b-code, .sp-b-image figure, .sp-b-quote { break-inside: avoid; }
  /* A TABLE ON PAPER. The scroller is a screen affordance and would CLIP on
     paper (an overflow box prints what fits and drops the rest), so it is
     unwound; the header tint goes the way the callout's does, because browsers
     do not print backgrounds by default and a table whose only header cue was
     a fill would print with no header at all. The rules are what survive, and
     they are black on white. A header row repeats across a page break, which
     is the whole reason <thead> is a real element here. */
  .sp-tb-wrap { overflow: visible; }
  .sp-tb-cell { border-color: #999; }
  .sp-tb thead .sp-tb-cell { background: none; border-bottom-width: 2px; }
  .sp-tb thead { display: table-header-group; }
  .sp-tb tr { break-inside: avoid; }
  .sp-b-code, .sp-b-image figure, .sp-b-media figure, .sp-b-quote { break-inside: avoid; }
  /* A CALLOUT ON PAPER, IN BLACK AND WHITE.
     The tint is dropped rather than trusted: browsers do not print backgrounds
     by default, so a callout whose only cue was its fill would print as bare
     text — and where they DO print, a mid-grey tint under body text costs
     contrast for nothing. What survives is the box, the heavier start rule, the
     tone's shape and the tone's name, all of which are pure black on white. */
  .sp-b-callout {
    background: none; border-color: #767676;
    break-inside: avoid; padding: 8px 12px;
  }
  .sp-callout-chip { color: #000; }
  .sp-callout-chip svg { stroke-width: 2.4; }
  p, li { orphans: 2; widows: 2; }
}

/* ————— the chrome scale, named as the suite's shared sheet names it —————
   The values the D1–D8 rulings settled (2026-09-25), under the names the
   kernel's tier-4 token sheet gives them, so adopting that sheet later is a
   deletion here and a rename nowhere. Its own block, and UNTHEMED: these are
   sizes, and the one colour in them (the shadow) reads `--shade`, which the
   dark blocks already flip. */
:root {
  --radius-sm: 6px;      /* inputs, menu rows */
  --radius-lg: 14px;     /* dialogs and sheets */
  --shadow-pop: 0 12px 32px rgb(var(--shade) / .16);   /* menus, popovers */
  --shadow-dlg: 0 18px 50px rgb(var(--shade) / .28);   /* dialogs */
  --scrim: rgb(var(--shade) / .38);                    /* the dim behind a dialog */
  --ctl-h: 30px;
  --tap: 44px;           /* D5: a coarse pointer's target */
  --fs-hint: 12px;
  --z-pop: 60;
  --z-toast: 1100;       /* a notice, above a dialog on purpose */
}

/* ————— menus: the kernel's (kernel/src/ui/menu.css) —————
   Every dropdown and anchored menu is `createMenu`; see menus.ts for why. The
   primitive reads its look through `--bkm-*` chains, and these are this app's
   answers. Structure and behaviour are the kernel's and are not restated here.
   Menus keep `--radius` (10px): `--radius-lg` is the DIALOG corner, and the
   kernel's chain would otherwise hand a menu 14px. */
/* ————— SLIDES PARITY: menus —————
   Every value in this block is slides' `.ed-menu` / `.ed-btn` / `.ed-menu-sep`
   (slides/src/styles.css), so a menu opened from either app's bar is the same
   object: 13px/400 rows in --ink-2, 16px icons in the same ink, 30px rows
   (6px 9px, a 1px transparent frame, 6px gap, 8px corners), a 4px list
   padding, 4px off the trigger, hairline separators 3px 2px, slides' shadow,
   and the Save menu at 12.5px. scripts/test-spaces-chrome.ts reads slides'
   numbers out of slides' stylesheet and holds these computed values to them.

   It is ONE block because it is a set of answers to the kernel menu's hooks,
   not a fork of it. Where the kernel has a hook (`--bkm-*`) it is used; where
   it has none — the list padding, a row's padding, gap and frame, the
   separator's margin, a pressed state — the rule is here, and each of those is
   filed for the kernel as a proposed default (board, 2026-09-26), so that
   slides can one day adopt the kernel menu without changing how it looks.
   Kernel defaults that differ from slides': offset 6 (slides 4), list padding
   5 (4), row padding 7px 9px (6px 9px), row gap 9 (6), row frame 0 (1px
   transparent), row radius 7 (8), row ink --ink-2 via chain (same), icon ink
   --muted (--ink-2), font 13 (same), min-width 200 (150), shadow
   0 12px 32px /.16 (0 8px 24px /.14), separator margin 4px 6px (3px 2px), no
   :active (--line). */
.sp-app, .sp-mn-anchored {
  --bkm-radius: var(--radius);
  --bkm-item-radius: 8px;
  --bkm-shadow: var(--pop-shadow);
  --bkm-bg: var(--pop-bg);
  --bkm-border: var(--pop-line);
  --bkm-hover: var(--pop-hover);
  --bkm-ink: var(--ink-2);
  --bkm-ico: var(--ink-2);
  --bkm-font-size: 13px;
  --bkm-min-width: 150px;
  --bkm-gap: 4px;
  --bkm-z: var(--z-pop);
}
.sp-mn-pop { font-family: inherit; }
.bkm-menu.sp-mn-pop { padding: 4px; }
.sp-mn-pop .bkm-item {
  gap: 6px; padding: 6px 9px; border: 1px solid transparent;
  min-height: var(--ctl-h); line-height: normal;
}
.sp-mn-pop .bkm-item:active { background: var(--pop-line); }
/* a row is ONE line, as slides' (`.ed-btn` is nowrap): the list is as wide as
   its longest name. Without it an absolutely placed list shrinks toward its
   150px floor and names wrap into 44px rows. A description still wraps, under
   the name, at the width the names set; a name longer than the cap ellipses. */
.sp-mn-pop .bkm-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 16px; }
/* 16px, not `normal`: a language row carries `lang="ja"`, and the Japanese
   face's normal line is 20px — its row came out 34px among 30px ones */
.sp-mn-pop .bkm-body { min-width: 0; }
/* a scrolling list is a flex column with a max-height, so its 1px separators
   SHRANK to nothing — the folded ⋯ lost the rule between the bar's controls
   and the Save list. Nothing in a menu shrinks; the list scrolls instead. */
.bkm-menu.sp-mn-pop > * { flex-shrink: 0; }
.sp-mn-pop .bkm-sep { margin: 3px 2px; }
/* read by a screen reader, never drawn: a Save row's description */
.sp-vh {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
/* D2 descriptions, slides' `.ed-mi-desc` (#573): 12px/1.35 --muted, 2px under
   the name, regular weight; the icon lines up with the NAME, not the middle */
.sp-mn-pop .bkm-hint { font-size: 12px; font-weight: 400; line-height: 1.35; color: var(--muted); margin-top: 2px; }
.sp-mn-pop .bkm-item:has(.bkm-hint) { align-items: flex-start; }
.sp-mn-pop .bkm-item:has(.bkm-hint) > .bkm-ico { margin-top: 1px; }
/* slides' Save menu is the one list set a half-point smaller, and at least 190
   wide; its descriptions (D2) wrap under the name rather than widening it */
/* slides #573: the list is 264 wide (less on a phone) and scrolls in the room
   under the bar, which topbar.ts publishes as --sp-bar-bottom */
.sp-savemenu > .bkm-menu.sp-mn-pop {
  width: min(264px, calc(100vw - 16px));
  max-height: calc(100dvh - var(--sp-bar-bottom, 56px) - 12px);
}
.sp-savemenu .bkm-item { font-size: 12.5px; }
/* Selectors that override the kernel sheet carry `.bkm`/`.bkm-menu`: the
   bundle places that sheet AFTER this file, so equal specificity loses.
   A row that TEACHES may wrap, but no menu here is wider than a phone column. */
.bkm-menu.sp-mn-pop { max-width: min(320px, calc(100vw - 16px)); }
.sp-savemenu > .bkm-menu.sp-mn-pop { max-width: min(264px, calc(100vw - 16px)); }
.sp-mn-pop .bkm-body { flex: 1 1 auto; }
/* ⋯ exists only once the bar has folded, as slides' does */
.sp-bar .sp-more { display: none; }
.sp-bar.sp-bar-fold .sp-more { display: inline-flex; }
/* a SHORTCUT sits at the row's end, in the interface face, right-aligned, in
   ⌃⌥⇧⌘ order (D8) — never a second line under the name, where it read as a
   description of the command */
.sp-mkbd {
  margin-inline-start: auto; padding-inline-start: 14px; flex: none;
  font: inherit; font-size: var(--fs-hint); color: var(--muted);
  letter-spacing: .02em; white-space: nowrap;
}
/* the trigger is a bar button like any other */
.sp-mn > .bkm-trigger { display: inline-flex; align-items: center; gap: 6px; }
/* the menu hanging off the save caret is the save split's; reset the wrapper */
.sp-split .sp-mn { display: flex; align-items: stretch; }
/* the anchored menu's wrapper sits exactly over its anchor (menus.ts places it)
   and must take no clicks of its own */
.bkm.sp-mn-anchored { position: fixed; pointer-events: none; z-index: var(--z-pop); }
.bkm.sp-mn-anchored > .bkm-menu { pointer-events: auto; }
/* …and on a phone it is a SHEET at the bottom edge, where a thumb reaches it and
   nothing can be placed off-screen */
.bkm.sp-mn-anchored > .bkm-menu.sp-mn-sheet {
  position: fixed; top: auto; left: 8px; right: 8px;
  bottom: max(8px, env(safe-area-inset-bottom));
  max-width: none; min-width: 0; max-height: 62vh;
  border-radius: var(--radius-lg); padding: 8px;
  box-shadow: 0 -8px 40px rgb(var(--shade) / .28);
}
/* rows that are not commands — the "Width" caption, a filter's field name */
.sp-mn-pop .sp-menu-label:first-child { border-top: 0; margin-top: 0; }
/* a form inside a menu (a new property, a callout's own icon) */
.sp-mn-pop .sp-newprop, .sp-mn-pop .sp-tonerow { padding: 4px 6px 6px; }

/* ————— rows outside the kernel menu —————
   The design picker's rows (designpanel.ts) are built by hand and keep this
   class; they are drawn to match a kernel row exactly. */
.sp-dditem {
  display: flex; align-items: center; gap: 9px; width: 100%;
  text-align: start; font: inherit; font-size: 13.5px; color: var(--ink);
  background: transparent; border: 0; border-radius: var(--radius-sm);
  padding: 7px 9px; cursor: pointer;
}
.sp-dditem:hover { background: var(--chrome-2); }
.sp-dditem strong { display: block; font-size: 13.5px; font-weight: 600; }
.sp-dditem span span { display: block; color: var(--muted); font-size: 12px; }
.sp-panel-toggle { display: inline-flex; }

/* ————— page icon ————— */
.sp-pageicon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; margin: 0 0 6px -4px; padding: 0;
  color: var(--muted); background: transparent;
  border: 1px solid transparent; border-radius: 8px; cursor: pointer;
}
.sp-pageicon:hover { background: var(--chrome-2); color: var(--ink); }
.sp-pageicon svg { width: 22px; height: 22px; }
.sp-iconpop { width: 232px; display: flex; flex-wrap: wrap; gap: 2px; }
.sp-iconopt {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 38px; padding: 0; color: var(--ink-2);
  background: transparent; border: 0; border-radius: 7px; cursor: pointer;
}
.sp-iconopt:hover { background: var(--chrome-2); }
.sp-tree-ico svg { width: 15px; height: 15px; display: block; }
.sp-tree-ico { display: flex; align-items: center; justify-content: center; color: var(--muted); }
.sp-treelink.sp-here .sp-tree-ico { color: var(--ink); }

/* ————— print sheet ————— */
.sp-choices { display: flex; gap: 8px; margin: 4px 0 12px; }
.sp-choice {
  flex: 1 1 0; text-align: start; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; cursor: pointer;
}
.sp-choice:hover { background: var(--chrome); }
.sp-choice.sp-sel { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.sp-choice strong { display: block; font-size: 13.5px; }
.sp-choice span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.sp-optlist { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.sp-opt { display: flex; align-items: flex-start; gap: 9px; padding: 6px 4px; cursor: pointer; }
.sp-opt input { margin-top: 3px; accent-color: var(--ink); }
.sp-opt strong { display: block; font-size: 13.5px; font-weight: 500; }
.sp-opt span span { display: block; color: var(--muted); font-size: 12px; }

/* ————— print output ————— */
.sp-printroot { display: none; }
.sp-toc { break-after: page; }
.sp-toc-h { font-size: 26px; margin: 0 0 14px; }
.sp-toc-list { list-style: none; margin: 0; padding: 0; }
.sp-toc-list li { padding: 3px 0; border-bottom: 1px dotted var(--line); font-size: 14px; }
@media print {
  body.sp-printing > *:not(.sp-printroot) { display: none !important; }
  body.sp-printing .sp-printroot { display: block; }
  .sp-printroot .sp-page { break-after: page; }
  .sp-printroot .sp-page:last-child { break-after: auto; }
  .sp-printroot .sp-pageicon, .sp-printroot .sp-backlinks,
  .sp-printroot .sp-mentions { display: none; }
  @page { margin: 18mm 16mm; }
}

/* ————— images ————— */
.sp-b-image { position: relative; }
.sp-imgtools {
  position: absolute; top: 8px; inset-inline-end: 8px;
  display: flex; gap: 4px; opacity: 0; transition: opacity .12s;
}
.sp-b-image:hover .sp-imgtools, .sp-imgtools:focus-within { opacity: 1; }
.sp-imgtools .sp-btn {
  background: color-mix(in srgb, var(--surface) 94%, transparent); border-color: var(--line);
  font-size: 12px; padding: 4px 8px;
  box-shadow: 0 2px 8px rgb(var(--shade) / .12);
}
.sp-imgtools .sp-badge { color: var(--accent-ink); }
.sp-b-image figure { position: relative; }
.sp-page.sp-filedrop { outline: 2px dashed var(--blue); outline-offset: 8px; border-radius: var(--radius); }

/* ————— video and audio —————
   Same shape as an image: a <figure> in the column, tools that appear on
   hover. A video is sized as a percentage of the measure like an image; an
   audio element is a control bar, so it takes the full width and ignores the
   width stepper (the editor does not offer one). */
.sp-b-media { position: relative; }
.sp-b-media figure { margin: 12px 0; position: relative; }
.sp-b-media video { max-width: 100%; height: auto; border-radius: var(--radius); display: block; background: #000; }
.sp-b-media audio { width: 100%; display: block; }
.sp-b-media figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
.sp-mediatools {
  position: absolute; top: 8px; inset-inline-end: 8px;
  display: flex; gap: 4px; opacity: 0; transition: opacity .12s;
  flex-wrap: wrap; justify-content: flex-end;
}
.sp-b-media:hover .sp-mediatools, .sp-mediatools:focus-within { opacity: 1; }
.sp-mediatools .sp-btn {
  background: color-mix(in srgb, var(--surface) 94%, transparent); border-color: var(--line);
  font-size: 12px; padding: 4px 8px;
  box-shadow: 0 2px 8px rgb(var(--shade) / .12);
}
/* The still that paper and a file-manager thumbnail get instead of a player. */
.sp-media-still {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  background: var(--chrome-2); text-align: center;
}
.sp-media-still img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 0 auto 8px; }
.sp-media-badge { font-size: 13px; color: var(--muted); }
/* A block whose source has not been chosen yet. */
.sp-media-empty {
  border: 1px dashed var(--line); border-radius: 10px; padding: 18px 20px;
  background: var(--chrome-2);
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
}
.sp-media-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media print { .sp-media-empty { border-color: #999; background: none; } }

/* ————— import ————— */
.sp-dropzone {
  display: grid; place-items: center; margin: 4px 4px 10px; padding: 22px 12px;
  color: var(--muted); font-size: 13px; text-align: center;
  border: 1.5px dashed var(--line); border-radius: var(--radius); background: var(--chrome);
}
.sp-dropzone.sp-drop { border-color: var(--blue); color: var(--blue); }

/* ————— page rows: the options button ————— */
.sp-treelink { position: relative; padding-inline-end: 26px; }
.sp-rowmore {
  position: absolute; inset-inline-end: 3px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; padding: 0; border: 0; border-radius: 5px;
  color: var(--muted); background: transparent; cursor: pointer; opacity: 0;
}
.sp-treelink:hover .sp-rowmore, .sp-rowmore:focus { opacity: 1; }
.sp-rowmore:hover { background: var(--chrome-2); color: var(--ink); }
.sp-rowmore svg { width: 14px; height: 14px; }

/* ————— archived ————— */
.sp-archived { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 8px; }
.sp-archived summary {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--muted); cursor: pointer;
  padding: 4px 6px; list-style: none;
}
.sp-archived summary::-webkit-details-marker { display: none; }
.sp-archived summary::before { content: '▸ '; }
.sp-archived[open] summary::before { content: '▾ '; }
.sp-arch-row { opacity: .72; }
.sp-arch-row:hover { opacity: 1; }

/* ————— find bar ————— */
.sp-findbar {
  position: absolute; top: 54px; inset-inline-end: 18px; z-index: 55;
  display: flex; align-items: center; gap: 6px; padding: 7px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 34px rgb(var(--shade) / .2);
}
.sp-findbar .sp-find { width: 190px; }
.sp-findcount { font-size: 12px; color: var(--muted); min-width: 68px; text-align: center; }
.sp-b.sp-hit { background: color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 4px; transition: background .5s; }

/* ————— reading view ————— */
.sp-app.sp-reading .sp-main { --sp-pad-y: 56px; padding-top: var(--sp-pad-y); }
.sp-app.sp-reading .sp-doctitle { pointer-events: none; }
.sp-btn.sp-on { background: var(--chrome-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.sp-app.sp-reading .sp-page-inner { font-size: 17px; }
.sp-app.sp-reading .sp-title { margin-bottom: 18px; }

/* THE TOOLS GO, NOT THE DOCUMENT. Reading view was a font-size bump and some
   padding: every editing control was still on screen, merely inert, which
   reads as a broken editor rather than as a document. What leaves is anything
   whose only purpose is CHANGING the space; what stays is everything a reader
   uses — the page tree, ⌘K search, Graph, print, and the eye to come back
   (the floating Reading view button, which is how a reader leaves).
   `!important` throughout because these are one-line overrides of the layout
   rules that build each control, not a competition of specificity. (The insert
   group already leaves, with the insert group's own rules below.) */
.sp-app.sp-reading .sp-group-history,
.sp-app.sp-reading .bkp-end,
.sp-app.sp-reading .sp-fmt,
.sp-app.sp-reading .sp-newsplit,
.sp-app.sp-reading .sp-rowmore,
.sp-app.sp-reading .sp-gutter,
.sp-app.sp-reading .sp-pageicon { display: none !important; }

/* A SEALED READING COPY (`doc.readonly`) has no editing to go back to, so the
   eye, the way to write this file and the live control are not hidden-because-
   inert, they are absent. Nothing here is protection — see reading.ts on which
   guarantees are cryptographic and which are only this. connectSync REPLACES
   the live slot with the real control, which carries `.sp-live` and not the
   slot class, so both are named. */
.sp-app.sp-sealed .sp-readtoggle,
.sp-app.sp-sealed .sp-split,
.sp-app.sp-sealed .sp-live-slot,
.sp-app.sp-sealed .sp-live { display: none !important; }

/* The reader's footer: what came before, what comes next.
   `.sp-page a` underlines every link in the reading column and out-specifies a
   bare class, so these say so with `.sp-page` in front of them. */
.sp-rnav {
  display: flex; align-items: stretch; gap: 12px;
  margin: 54px 0 0; padding-top: 20px; border-top: 1px solid var(--line);
}
.sp-rnav-gap { flex: 1 1 0; }
.sp-page a.sp-rnav-link, .sp-rnav-link {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); text-decoration: none;
}
.sp-rnav-link:hover { border-color: var(--edge); background: var(--chrome-2); }
.sp-rnav-next { text-align: end; }
.sp-rnav-kicker {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted);
}
.sp-rnav-title {
  font-size: 14.5px; font-weight: 600; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* PAPER WANTS WHAT READING MODE WANTS — no tools — and it already hides the
   bar, the panels and the gutters. The footer is the one thing reading mode
   ADDS, so it is the one thing this has to take away again: a "Next ›" card is
   a control, and a control on paper is a card that does nothing. */
@media print { .sp-rnav { display: none !important; } }

/* A remote image that has not been loaded. Deliberately quiet and boxy — it
   holds the place without pretending to be the picture. */
.sp-remote {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  background: var(--chrome-2);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.sp-remote-line { font-weight: 600; font-size: 14px; }
.sp-remote-why { font-size: 13px; color: var(--muted); max-width: 46ch; }
.sp-remote-alt { font-size: 13px; color: var(--muted); font-style: italic; }
.sp-remote-load {
  /* .sp-btn is transparent by design (the topbar is icon-only), so this one
     states itself: it asks the reader to make a decision. */
  margin-top: 6px;
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  font-weight: 550;
  padding: 7px 13px;
}
.sp-remote-load:hover { background: var(--chrome); border-color: var(--muted); }
/* Print shows the placeholder text, never a blank gap the reader can't explain. */
@media print { .sp-remote { border-color: #999; background: none; } .sp-remote-load { display: none !important; } }

/* The version timeline. A row is one button so the whole strip is the target —
   a "Restore" word alone is a 44px miss on a touch screen. */
.sp-ab-versions { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 8px; }
.sp-ab-version {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 9px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--ink); font: inherit; font-size: 13px;
  text-align: start; cursor: pointer;
}
.sp-ab-version:hover { background: var(--chrome-2); border-color: var(--line); }
.sp-ab-version:focus-visible { border-color: var(--blue); outline: none; }
.sp-ab-when { font-variant-numeric: tabular-nums; }
.sp-ab-vtag { color: var(--muted); font-size: 12px; }
/* the verb sits at the end and only colours up on approach, so a list of ten
   rows does not read as ten buttons all shouting at once */
.sp-ab-vdo { margin-inline-start: auto; color: var(--muted); }
.sp-ab-version:hover .sp-ab-vdo, .sp-ab-version:focus-visible .sp-ab-vdo { color: var(--blue); }

/* Versions in this file (doccmds.ts openFileHistory, history.ts). The row is
   the same .sp-ab-version with a "Changes" button beside it; the word diff
   hangs UNDER the row, because prose needs the card's full width. Colours are
   the shared --c-green/--c-red tokens both themes define. */
.sp-hist-row { display: flex; flex-direction: column; }
.sp-hist-head { display: flex; align-items: center; gap: 4px; }
.sp-hist-head .sp-ab-version { flex: 1 1 auto; min-width: 0; }
.sp-hist-head .sp-ab-when { white-space: nowrap; }
/* the summary WRAPS rather than truncating: in the 440px card a derived
   sentence is the whole point of the row, and an ellipsis hid it */
.sp-hist-head .sp-ab-vtag { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.sp-ab-version:disabled { cursor: default; }
.sp-ab-version:disabled:hover { background: transparent; border-color: transparent; }
.sp-ab-version:disabled .sp-ab-vdo { display: none; }
.sp-hist-diff-btn {
  flex: 0 0 auto; padding: 6px 9px; border: 1px solid transparent;
  border-radius: 8px; background: transparent; color: var(--muted);
  font: inherit; font-size: 12px; cursor: pointer;
}
.sp-hist-diff-btn:hover { background: var(--chrome-2); border-color: var(--line); color: var(--ink); }
.sp-hist-diff-btn:focus-visible { border-color: var(--blue); outline: none; }
.sp-hist-diff-btn[aria-expanded='true'] { color: var(--blue); }
.sp-hist-diff {
  margin: 2px 0 10px; padding: 8px 10px; border-inline-start: 2px solid var(--line);
  background: var(--chrome); border-radius: 0 8px 8px 0;
  max-height: 320px; overflow-y: auto;
}
.sp-hist-page { font-size: 12px; font-weight: 600; margin: 6px 0 2px; }
.sp-hist-page:first-child { margin-top: 0; }
.sp-hist-chip {
  display: inline-block; margin-inline-start: 6px; padding: 0 6px;
  border-radius: 999px; background: var(--chrome-2); color: var(--muted);
  font-size: 11px; font-weight: 400;
}
.sp-hist-line { margin: 0 0 4px; font-size: 12.5px; line-height: 1.5; color: var(--ink-2); overflow-wrap: anywhere; }
.sp-hist-line ins { text-decoration: none; background: color-mix(in srgb, var(--c-green) 16%, transparent); color: var(--c-green); }
.sp-hist-line del { background: color-mix(in srgb, var(--c-red) 14%, transparent); color: var(--c-red); }
.sp-hist-empty { color: var(--muted); font-style: italic; }

/* The new-property form inside the add-property popover: a name, a type and a
   button, on one line until the popover is too narrow for it. */
.sp-newprop { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 6px 6px; }
.sp-newprop .sp-input { flex: 1 1 120px; min-width: 0; }
.sp-newprop .sp-select { flex: 0 1 auto; }
.sp-newprop .sp-btn { flex: 0 0 auto; }

/* The shortcut list. Two columns, keys right-aligned against their meanings,
   so the eye runs down one edge instead of hunting across a ragged gap. */
/* The sheet opens WIDE (`sp-dlg-wide`, 720px): a 560px card leaves too little
   for two 260px columns plus the gap, which silently collapsed the grid to one. */
.sp-keys-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0 30px; align-items: start;
}
.sp-keys-g { min-width: 0; }
.sp-keys-h {
  margin: 16px 2px 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.sp-keys-g:first-child .sp-keys-h, .sp-keys-g:nth-child(2) .sp-keys-h { margin-top: 8px; }
.sp-keys-list {
  display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px;
  margin: 0; align-items: baseline;
}
.sp-keys-list dt { justify-self: end; }
.sp-keys-list dd { margin: 0; font-size: 13px; color: var(--ink); }
.sp-kbd {
  display: inline-block; padding: 2px 6px; font: inherit; font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--ink);
  background: var(--pop-hover); border: 1px solid var(--line);
  border-radius: 5px; white-space: nowrap;
}

/* ⋯ IS A HOME, NOT JUST AN OVERFLOW. It used to be display:none until the bar
   folded, which was right while every command it held also had a button in the
   bar. It no longer does: the commands you reach for once a session live here
   at every width, so hiding it on a desktop would make New page, the journal,
   import, print and About unreachable with a mouse. It still ALSO collects
   whatever the bar drops as the window narrows. */
.sp-more { display: inline-flex; }

/* ————— the topbar fits itself by MEASURING —————
   Slides' tiers, stepped through by slides' algorithm (topbar.ts, the port of
   slides' fitTopbar): each is tried only while the bar still does not fit.
   They were px media queries once (820 and 600), and then a hand-copy of
   slides' algorithm that had drifted to other thresholds (§3.2: spaces went
   compact at 800 where slides goes at 1360). A px guess cannot answer the
   question: the same buttons need different room at the same width under
   browser zoom, OS text scaling, and eight catalogs of labels. The PADDING and
   GAP of each tier are slides' too. */

/* compact: the words beside the icons go. */
.sp-bar-compact .sp-primary span.sp-savelabel { display: none; }
.sp-bar-compact .sp-btnlabel { display: none; }
.sp-bar.sp-bar-compact {
  gap: 6px;
  padding: 8px max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left));
}

/* tight: the wordmark loses its word, keeping the mark — which is the route
   to About, and the corner every app in the suite puts it in. Narrower
   horizontally only, as in slides: the bar must not change height as a window
   is dragged. */
.sp-bar.sp-bar-tight {
  gap: 4px;
  padding: 8px max(6px, env(safe-area-inset-right)) 8px max(6px, env(safe-area-inset-left));
}
.sp-bar-tight .sp-mark-word { display: none; }

/* fold: whole controls move into ⋯. Nothing is lost, everything is one tap
   away, and the editor asks the DOM which tier is live rather than re-deriving
   it from a width. The mark stays, as slides' does: it is the corner. */
.sp-bar-fold .sp-sec { display: none; }
.sp-bar-fold .sp-group-history { display: none; }
.sp-bar-fold .sp-split .sp-caret { display: none; }
.sp-bar-fold .sp-lang, .sp-bar-fold .sp-help { display: none; }
/* with the caret gone Save is one button again, not the left half of two —
   and a SQUARE one, the icon centred. */
.sp-bar-fold .sp-split > .sp-btn:first-child {
  border-start-end-radius: 8px; border-end-end-radius: 8px;
  border-inline-end: 1px solid var(--ink);
  padding-inline: 9px; justify-content: center;
}
/* THE STATUS LINE LEAVES THE FLOW. It is a nowrap span, so a long message
   ("Reading view — press Esc or the eye to edit" is ~250px) would shove the
   bar into overflow for the 1.8s it is up and put Save off-screen again.
   Overlaid on the title strip it says its piece and costs no width. */
.sp-bar-fold { position: relative; }
.sp-bar-fold .sp-status {
  position: absolute; z-index: 2; pointer-events: none;
  inset-inline: 46px 96px; bottom: 2px; text-align: center;
  overflow: hidden; text-overflow: ellipsis; background: var(--bg);
}

/* Belt and braces at every width: a status message can shrink and clip, but it
   can never be the reason a control leaves the bar — nor the reason the bar
   changes tier. Basis 0 keeps the message out of the bar's intrinsic width, so
   text arriving cannot push fitTopbar into hiding labels and resizing buttons
   under the pointer; grow lets it use whatever slack is going, and it
   ellipsises when there is none. */
.sp-status { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* D3's second level (editor.ts notice): what the reader must not miss. The
   inverse of the surface — ink fill, ground text — like slides' toast and the
   kernel tooltip, above a dialog on purpose. */
.sp-notice {
  position: fixed; left: 50%; bottom: max(26px, calc(env(safe-area-inset-bottom) + 16px));
  transform: translate(-50%, 12px); z-index: var(--z-toast);
  max-width: min(520px, calc(100vw - 32px)); padding: 9px 16px;
  /* slides' .ed-toast: --ink pill, --surface ink, no shadow, .25s */
  border-radius: 999px; background: var(--ink); color: var(--pop-bg);
  font-size: 13px; text-align: center;
  pointer-events: none;
  opacity: 0; transition: opacity .25s ease, transform .25s ease;
}
.sp-notice.sp-on { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .sp-notice { transition: none; } }

/* Hit targets: a 30px button is a miss on a touch screen. 44, not 40 (D5 —
   HIG, and slides' phone bar): measured, five bar buttons were 40×40, the
   Live button 35×29, a page row 28px tall and its ⋯ 20×20. */
@media (pointer: coarse) {
  .sp-bar .sp-btn, .sp-bar .sp-live, .sp-bar .sp-mark { min-width: var(--tap); min-height: var(--tap); justify-content: center; }
  .sp-treelink { min-height: var(--tap); padding-inline-end: 40px; }
  .sp-treelink .sp-rowmore { width: 36px; height: var(--tap); inset-inline-end: 2px; }
  .sp-fmt-btn { min-height: var(--tap); }
  .sp-dditem { padding-block: 11px; }
  /* D5: a menu row is a 44px target under a finger, like every other one */
  .sp-mn-pop .bkm-item { min-height: var(--tap); }
  /* …and a shortcut is noise where there is no keyboard to press it on */
  .sp-mkbd { display: none; }
}

/* WHILE A FINGER IS DRAGGING. The press that starts a touch drag is also the
   press that arms text selection on iOS and Android, and a card whose title is
   being selected mid-drag paints a blue smear across the gesture. touch.ts
   clears the selection when the hold fires; this stops a new one starting. */
body.sp-touchdrag, body.sp-touchdrag * { -webkit-user-select: none; user-select: none; }
/* AND SCROLL SNAPPING STANDS DOWN WHILE IT LASTS. The board's
   `scroll-snap-type: x proximity` is right for a thumb flicking between
   columns and wrong for the 12px-per-frame creep that carries a held card
   towards an off-screen column: each step lands inside the proximity of the
   snap point it just left and is pulled straight back. Measured before this
   rule, with the finger parked at the board's right edge for 1400ms:
   scrollLeft 0 → 0. */
body.sp-touchdrag .sp-board { scroll-snap-type: none; }

/* ————— find & replace on a small screen —————
   Measured at a 575px viewport: the bar laid out 644px wide and started at
   x = -87, so the Find field itself was off the left edge — the one control
   you must reach to use the feature at all. It is anchored to the end edge and
   sized by its contents, so it grows off the opposite side rather than
   wrapping.

   Below the breakpoint it spans the viewport and wraps to two rows: the two
   fields share the first row, the buttons and the counter take the second. */
@media (max-width: 720px) {
  .sp-findbar {
    inset-inline: 8px; top: 52px;
    flex-wrap: wrap; gap: 5px;
  }
  .sp-findbar .sp-find { flex: 1 1 120px; width: auto; min-width: 0; }
  .sp-findcount { order: 1; flex: 1 1 100%; text-align: start; }
}

/* ————— the toolbar, grouped as slides groups it —————
   LEFT is the document (mark · title · history), then the insert tools, then
   RIGHT, what you do with it. 6px inside a group, as slides' `.ed-group` —
   history was 2 and the right group 4, which made spaces' bar the denser of
   two bars that were meant to be one. */
.sp-group { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.sp-group-right { margin-inline-start: auto; }

/* Save is ONE control with two halves, fused — not two buttons that happen to
   be adjacent. The caret is visibly part of the thing it modifies. Slides'
   proportions (a 70×30 half and a 21px caret, where spaces' were 97 and 30);
   spaces' fill, because Save is the primary action in both apps (D1). */
.sp-split { display: inline-flex; align-items: stretch; }
/* Slides' split as #568 made it primary: --surface ink on an --ink fill, a
   1px --ink frame with no seam on the Save half, and the caret parted from it
   by a hairline in the text colour mixed into the fill — slides' `.ed-split`
   and `.ed-split-caret`, value for value, measured at 1440 and at the compact
   tier (Save 70/35 wide, caret 21, both 30 tall). */
.sp-split > .sp-btn:first-child {
  position: relative;
  border-start-end-radius: 0; border-end-end-radius: 0;
  padding: 6px 9px;
  border-color: var(--ink); border-inline-end: none; color: var(--pop-bg);
}
.sp-split > .sp-btn:first-child:hover { border-color: var(--ink-2); }
.sp-split .sp-caret > .sp-btn {
  height: 100%; padding: 6px 7px;
  border-start-start-radius: 0; border-end-start-radius: 0;
  border-color: var(--ink);
  border-inline-start-color: color-mix(in srgb, var(--pop-bg) 35%, var(--ink));
  background: var(--ink); color: var(--pop-bg);
}
.sp-caret-g { font-size: 10px; line-height: 1; }
.sp-split .sp-caret > .sp-btn:hover { background: var(--ink-2); border-color: var(--ink-2); }

/* The unsaved dot lives ON Save: the place you look to find out whether you
   need to press it is the button itself. A BADGE on the corner, as slides'
   `.ed-dirty` — not a slot that holds the button 14px wider for a dot that is
   usually not there. Ringed in the button's own fill so it reads on it. */
.sp-dirty {
  position: absolute; top: 3px; inset-inline-end: 3px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 1.5px var(--dirty-ring);
  opacity: 0; transition: opacity .18s; pointer-events: none;
}
.sp-dirty.sp-on { opacity: 1; }

/* `?` is slides' glyph, on the bar's grid: slides' own is 28×29 because a
   16px-wide slot was never reserved for it; here it is a 36×30 button like
   its neighbours, the glyph centred in a 16px box. */
.sp-help { justify-content: center; }
.sp-help-q { display: block; width: 16px; font-size: 15px; font-weight: 800; line-height: 16px; text-align: center; }

/* the language in force, marked as slides marks it */
.sp-lang-on .bkm-text::after { content: ' ✓'; color: var(--accent-ink); }

/* ————— the phone bar —————
   Viewport-scoped, like slides' `@media (max-width: 700px)`: this is about
   touch and small screens, not about whether the bar fits, so it stays a media
   query. topbar.ts folds unconditionally at the same 700.

   The tighter padding is listed with the tier classes: a media query adds no
   specificity, so a bare `.sp-bar` here loses to `.sp-bar.sp-bar-tight` and the
   phone bar silently keeps the desktop padding (slides measured exactly that). */
@media (max-width: 700px) {
  .sp-bar, .sp-bar.sp-bar-compact, .sp-bar.sp-bar-tight {
    padding: 6px max(6px, env(safe-area-inset-right)) 6px max(6px, env(safe-area-inset-left));
  }
  /* slides' phone rows: 44px targets, the desktop padding (D5) */
  .sp-mn-pop .bkm-item { min-height: var(--tap); }
  .sp-bar .sp-btn, .sp-bar .sp-live { min-width: var(--tap); min-height: var(--tap); justify-content: center; }
  /* the mark is a button (About), so it is a 44px target like the rest (D5);
     the glyph stays slides' 20px, centred in it */
  .sp-bar .sp-mark { min-width: var(--tap); min-height: var(--tap); justify-content: center; }
  .sp-doctitle { min-width: 0; }

  /* BELOW THE FOLD'S FLOOR THE BAR SCROLLS. Fully folded it still needs the
     mark, the title and seven 44px targets — about 330px — and a 320px screen
     (an iPhone SE, any iPhone with Display Zoom) does not have them. The app
     root clips, so the excess used to be simply cut off; in slides that hid ⋯,
     the only route to half the commands. A partly visible button is its own
     affordance. (slides' CLAUDE.md, hard-won detail 10.) */
  .sp-bar {
    overflow-x: auto; overscroll-behavior-x: contain;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .sp-bar::-webkit-scrollbar { display: none; }
  /* …and a scroll container clips BOTH axes, so every menu hanging off the bar
     would now be cut off by the bar itself. `fixed` takes it out of that clip;
     it is pinned to the end of the screen, under the bar's bottom edge, which
     topbar.ts publishes because it moves with the safe-area insets. */
  .sp-bar .bkm.bkm-open > .bkm-menu {
    position: fixed;
    top: calc(var(--sp-bar-bottom, 57px) + 4px);
    inset-inline-end: max(6px, env(safe-area-inset-right));
    inset-inline-start: auto;
  }
}

/* About opens with the suite's mark, as slides does — a dialog that starts on a
   section heading does not say what you are looking at. */
.sp-about-head { margin-bottom: 4px; }
.sp-about-logo {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: inherit;
}
.sp-about-logo b { display: block; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; }
/* `b + span`, NOT a bare `span`. The wordmark's peach slash is a `<span>`
   INSIDE the `<b>`, so a rule for "the version line" was making it
   display:block — and a block in the middle of a line breaks the line on both
   sides. The mark rendered as three stacked lines ("bento" / "/" / "spaces")
   from the day it shipped; measured with a Range over the b's text: rects at
   y=79 (w 42), y=98 (w 4) and y=112 (w 51). The selector is the whole fix. */
.sp-about-logo b + span { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.sp-about-logo:hover b { text-decoration: underline; }

/* the table's column grip borrows the panels' old resize cursor */
body.sp-col-resizing { cursor: col-resize; user-select: none; }

/* THE PAGES BUTTON ONLY EXISTS WHERE THE PANEL IS A DRAWER.
   Above the breakpoint the panel has its own chevron, on its own edge, where
   you are already looking — so a second control for the same thing sat to the
   LEFT of the wordmark, pushing the suite's mark out of the corner every app in
   the suite puts it in. Slides has no topbar panel toggle at all, for the same
   reason. Below the breakpoint there is no strip to hang a chevron on, so the
   button is the only way in; it follows the title, where slides' phone bar
   puts its Slides button, and the mark keeps the corner. */
.sp-panel-toggle { display: none; }
@media (max-width: 820px) {
  .sp-panel-toggle { display: inline-flex; }
}

/* ————— the properties panel —————
   The sibling of the page list, on the other edge — the same kernel panel, so
   the same strip and the same chevron. IT COSTS NOTHING WHILE CLOSED
   (`--bkp-collapsed-w: 0px` above): the reading column is the width it would
   be if this panel did not exist. */
.sp-insp {
  padding: 10px 10px max(16px, env(safe-area-inset-bottom));
}

.sp-insp-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--muted);
  margin: 2px 6px 8px;
}
/* The accordion header. Clicking anywhere on it opens or shuts the group — the
   same retrofit slides applies to `.ed-section`, so a section added below is
   collapsible without anyone remembering to make it so. */
.sp-insp-sec {
  display: flex; align-items: center; gap: 6px;
  margin: 10px 0 4px; padding: 5px 6px;
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  border-radius: 7px; cursor: pointer; user-select: none;
}
.sp-insp-sec:hover { background: var(--chrome-2); }
/* a drawn disclosure caret, turning as the group opens — the ▾/▸ glyphs at
   9px rendered as a bullet dot beside each heading, and read as a list */
.sp-insp-sec::before {
  content: ''; flex: none; width: 0; height: 0; margin: 0 2px;
  border-inline: 4px solid transparent; border-top: 5px solid var(--muted);
  transition: transform .12s ease;
}
.sp-insp-sec.sp-shut::before { transform: rotate(-90deg); }
[dir='rtl'] .sp-insp-sec.sp-shut::before { transform: rotate(90deg); }
.sp-insp-sub {
  margin-inline-start: auto; font-weight: 400; font-size: 11.5px;
  color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sp-insp-body { display: block; }
.sp-insp-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 4px 6px; font-size: 13px;
}
.sp-insp-lbl { color: var(--ink-2); flex: 0 1 auto; min-width: 0; }
.sp-insp-row > :not(.sp-insp-lbl) { flex: 0 0 auto; max-width: 60%; }
.sp-insp-txt, .sp-insp-num { width: 148px; min-width: 0; }
.sp-insp-num { width: 64px; }
.sp-insp-tog { width: 15px; height: 15px; accent-color: var(--blue); }
.sp-insp-step { display: inline-flex; align-items: center; gap: 2px; }
.sp-insp-step .sp-btn { padding: 2px 8px; line-height: 1.2; }
.sp-insp-n { min-width: 26px; text-align: center; font-variant-numeric: tabular-nums; }
.sp-insp-icon { padding: 4px 8px; }
.sp-insp-icon svg { width: 15px; height: 15px; }
.sp-insp-hint {
  margin: 4px 6px 8px; font-size: 12px; line-height: 1.45; color: var(--muted);
}
/* Measurements of the page, not advice about it. Set apart from the hint above
   by a rule and tabular figures, so the numbers line up and read as data. */
.sp-insp-stat {
  margin: 10px 6px 8px; padding-top: 8px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.sp-insp .sp-select { max-width: 100%; }

/* Below the breakpoint BOTH panels are overlays, not columns — 820px of window
   does not hold two panels and a page. The kernel panel does that itself
   (`drawerBelow`, editor.ts DRAWER_BELOW). */

/* THE BAR HAS NO PROPERTIES BUTTON (maintainer, 2026-10-20). It had one at
   every width because a closed panel's only affordance was once a 5px strip
   against the screen edge. The kernel panel's chevron now docks flush to that
   edge when the panel is shut (`.bkp-end.bkp-collapsed .bkp-toggle` above), so
   the panel is reached as slides' is — its chevron, `]` — and, once the bar has
   folded, from the Properties row in ⋯. test-spaces-chrome measures all three. */

/* A disabled action is shown, not hidden: "move up" missing from the top block
   is a menu that changes shape, and a menu that changes shape is one you have
   to re-read every time. */
.sp-dditem.sp-off { opacity: .38; pointer-events: none; }

/* On a phone a popover anchored to a 5px gutter button is unusable, so the
   block menu is a sheet at the bottom edge — within reach of a thumb, and it
   cannot be positioned off-screen. */
.sp-pop.sp-sheet {
  position: fixed; inset-inline: 8px; bottom: max(8px, env(safe-area-inset-bottom));
  top: auto; width: auto; max-height: 62vh; border-radius: 14px;
  padding: 8px; box-shadow: 0 -8px 40px rgb(var(--shade) / .28);
  transform: translateY(8px); opacity: 0;
  transition: transform .16s ease, opacity .16s ease;
}
.sp-pop.sp-sheet.sp-sheet-in { transform: none; opacity: 1; }
.sp-pop.sp-sheet .sp-dditem { padding-block: 13px; }

/* ————— typed fields, and the boards that read them —————
   An issue is a page; its fields are blocks. The chip always carries its LABEL
   as well as its colour, so it reads correctly in monochrome, in print, and
   without colour vision — colour is a hint, never the meaning. */
.sp-props {
  display: flex; flex-wrap: wrap; gap: 6px 8px;
  margin: -4px 0 20px; padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.sp-props .sp-b { margin: 0; }
.sp-prop { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
.sp-prop-key { color: var(--muted); }
.sp-prop-val {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; color: var(--ink); background: var(--chrome);
  border: 1px solid var(--line); border-radius: 7px;
  padding: 3px 9px; cursor: pointer;
}
button.sp-prop-val:hover { background: var(--surface); border-color: var(--edge); }
.sp-prop-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--line); flex: 0 0 auto;
}

.sp-view { margin: 0 0 18px; }
.sp-view-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.sp-view-btn { font-size: 12.5px; padding: 4px 9px; }
.sp-view-btn:first-of-type { margin-inline-start: auto; }
.sp-view-btn.sp-on { background: var(--chrome-2); border-color: var(--edge); color: var(--ink); }
/* a field's name above its values, in the filter picker */
.sp-fgroup { display: block; padding: 9px 9px 3px; font-size: 12px; color: var(--muted); }
.sp-view-title { font-weight: 650; font-size: 15px; }
.sp-view-count {
  font-size: 12px; color: var(--muted);
  background: var(--chrome-2); border-radius: 20px; padding: 1px 8px;
}
.sp-view-empty { color: var(--muted); font-size: 14px; }

/* The board scrolls SIDEWAYS inside itself — never the page. A horizontally
   scrolling document is the thing that makes a phone unusable. */
.sp-board {
  display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px;
  scroll-snap-type: x proximity;
  /* …AND THE SWIPE STOPS AT ITS OWN EDGE. `overflow-x: auto` keeps the board's
     columns out of the document, but by default a touch scroll that reaches
     the end of a scroller CHAINS to its ancestors — and on a phone the
     outermost ancestor is the browser's own back-navigation gesture. Measured
     at 390px: the board holds 1452px of columns in a 257px box, so a reader
     swiping through five columns hits that end on nearly every gesture.
     Containment ends the scroll where the board does. */
  overscroll-behavior-x: contain;
}
.sp-col {
  flex: 0 0 232px; min-width: 232px; scroll-snap-align: start;
  background: var(--chrome); border-radius: 10px; padding: 9px;
}
.sp-col-head {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  padding: 2px 4px 9px;
}
.sp-col-count { margin-inline-start: auto; color: var(--muted); font-weight: 500; }

/* AN ISSUE CARD IS NOT A DIALOG CARD. Both were `.sp-card`, and the dialog's
   rule (line ~333) sets `width: min(560px, 92vw)` — so every card on the board
   was 560px wide inside a 232px column and spilled across its neighbours, on
   every screen, since the board shipped. Measured, not theorised. Its own name
   is the fix that cannot come back. */
.sp-issue {
  display: block; position: relative; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 10px; margin-bottom: 7px;
}
.sp-issue:hover { border-color: var(--edge); box-shadow: 0 2px 8px rgb(var(--shade) / .07); }
/* `.sp-page a` underlines every link in the reading column and out-specifies a
   bare class — a card title is a card, not a link in a sentence. */
.sp-page a.sp-issue-title, .sp-issue-title { display: block; font-size: 13.5px; line-height: 1.4; color: inherit; text-decoration: none; }
/* THE WHOLE CARD IS THE LINK, and the status button is still a real button.
   The card cannot BE an <a> any more (interactive content inside a link is
   invalid and unreachable from the keyboard), so the title's ::after stretches
   over the card and the button lifts above it. */
a.sp-issue-title::after { content: ''; position: absolute; inset: 0; }
.sp-issue-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.sp-issue-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--muted);
  background: var(--chrome); border-radius: 5px; padding: 1px 6px;
}
button.sp-issue-set {
  position: relative; z-index: 1; font: inherit; font-size: 11.5px;
  border: 1px solid var(--line); cursor: pointer;
  /* a finger's target, not a mouse's */
  padding: 4px 8px; min-height: 26px;
}
button.sp-issue-set:hover { background: var(--chrome-2); border-color: var(--edge); }
/* A FINGER: the status button is the only way to move an issue where HTML5
   drag does not exist, so on a touch device it gets a target worth aiming at.
   BOTH predicates — `coarse` is the honest one, and the width is the one a
   desktop browser at 375px can be measured against (58×29 → 58×34 there). */
@media (pointer: coarse), (max-width: 700px) {
  button.sp-issue-set { min-height: 34px; padding: 7px 10px; }
}

/* dragging a card: what is moving, and exactly where it would land */
.sp-issue[draggable='true'] { cursor: grab; }
.sp-issue.sp-dragging { opacity: .4; }
.sp-col.sp-drop { background: var(--chrome-2); outline: 2px solid var(--accent); outline-offset: -2px; }
.sp-issue.sp-dropbefore { box-shadow: 0 -7px 0 -5px var(--accent); }
.sp-col.sp-dropend::after {
  content: ''; display: block; height: 2px; border-radius: 2px;
  background: var(--accent); margin: 0 1px;
}
/* THE TABLE. Rows are pages, so the first column reads as a list of links and
   the rest as data: tabular figures, a quiet rule under the head, and no
   vertical lines — a grid of boxes is a spreadsheet, and this is a list of
   documents that happens to have columns. */
.sp-view-tablewrap { overflow-x: auto; overscroll-behavior-x: contain; margin: 0 0 4px; }
.sp-view-table {
  border-collapse: collapse; width: 100%; font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.sp-view-table th {
  text-align: start; font-weight: 600; font-size: 12px; color: var(--muted);
  padding: 4px 12px 7px 0; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.sp-view-table td {
  padding: 7px 12px 7px 0; border-bottom: 1px solid var(--line-2, var(--line));
  vertical-align: baseline;
}
.sp-view-table tr:last-child td { border-bottom: 0; }
.sp-view-table tr:hover td { background: var(--chrome); }
/* the page's own column carries the weight; the values are supporting text */
.sp-view-table td:first-child { font-weight: 500; }
.sp-view-cellink { color: var(--ink); text-decoration: none; }
.sp-view-cellink:hover { text-decoration: underline; }
.sp-view-empty { color: var(--ph, var(--muted)); }
/* A HEADER AND A CELL ARE CONTROLS, and they say so only on approach: a table
   whose every box is drawn as a button reads as a form, and this is a document.
   So no chrome at rest, a tint on hover, and a real focus ring — the keyboard
   is the one reader that cannot hover, and it must still be able to see where
   it is. */
.sp-view-sort {
  font: inherit; color: inherit; background: none; border: 0; border-radius: 5px;
  padding: 2px 4px; margin: 0 0 0 -4px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}
.sp-view-sort:hover { background: var(--chrome); color: var(--ink); }
.sp-view-sort.sp-on { color: var(--ink); }
.sp-sortdir { font-size: 10px; line-height: 1; }
.sp-view-cell {
  font: inherit; color: inherit; background: none; border: 0; border-radius: 5px;
  padding: 2px 6px; margin: -2px 0 -2px -6px; cursor: pointer; text-align: start;
  max-width: 100%; min-width: 2.2em;
}
.sp-view-cell:hover { background: var(--chrome); box-shadow: inset 0 0 0 1px var(--line); }
.sp-view-sort:focus-visible, .sp-view-cell:focus-visible {
  outline: 2px solid var(--accent, currentColor); outline-offset: 1px;
}
/* a select's value, the same chip the header strip and the board cards use */
.sp-prop-chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

.sp-view-list { list-style: none; margin: 0; padding: 0; }
.sp-view-list li { margin: 0 0 6px; }

/* CHARTS: the timeline and the workload chart.
   Almost nothing here. Both pictures are svg carrying their own colour and
   geometry as PRESENTATION ATTRIBUTES (render.ts says why), so this file owns
   only the box around them — which is exactly what makes them print, and what
   makes them survive into the file-manager still, whose stylesheet is not this
   one. A rule here that the picture depended on would be a rule the thumbnail
   never sees. */
.sp-gt-wrap, .sp-wl-wrap { overflow-x: auto; margin: 0 0 6px; }
.sp-gt-note { margin: 2px 0 0; font-size: 12.5px; }
.sp-wl-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }

/* Print: the scroller is a screen affordance and paper has no scrollbar, so it
   becomes an ordinary box — otherwise a timeline wider than the page is
   silently guillotined, which is the same class of bug as a board printing as
   a cut-off row of columns (below). `min-width` goes with it for the same
   reason: it is there to keep labels legible on a phone. */
@media print {
  .sp-gt-wrap, .sp-wl-wrap { overflow: visible; }
  .sp-gt-wrap svg, .sp-wl-wrap svg { min-width: 0 !important; break-inside: avoid; }
}

/* Print: a board is columns of cards on screen and a LIST on paper — a
   horizontal scroller cannot be printed, and cutting it off would silently
   drop issues. */
@media print {
  .sp-board { display: block; overflow: visible; }
  .sp-col { break-inside: avoid; margin-bottom: 10px; }
  .sp-issue { box-shadow: none; }
  .sp-prop-val { background: none; }
}

/* Journal: the day strip above an entry's title. Quiet by default — it is
   navigation, not content — and the date reads at the weight of a subtitle. */
.sp-jnav { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; }
.sp-jdate { font-size: 13px; color: var(--muted); }
.sp-jstep {
  border: 0; background: none; cursor: pointer; color: var(--muted);
  font: inherit; font-size: 13px; line-height: 1; padding: 3px 6px; border-radius: 6px;
}
.sp-jstep:hover { background: var(--chrome-2); color: var(--ink); }
.sp-jtoday { margin-inline-start: 2px; }
/* Magic notes. The answer is OUTPUT, not text: it sits beside the line in the
   accent, lighter than the writing, so a page of prose with one sum in it
   still reads as prose. The ghost preview is the same thing at half strength —
   it has not been committed to the document yet, and it should not look as
   though it has. */
/* `.sp-text` is display:block, so a sibling drops to its own line however it
   is floated — a float after a full-width block has nothing to sit beside. The
   host goes INLINE instead, and only on a block that actually has an answer,
   so nothing else in the editor changes. The answer stays a SIBLING rather
   than moving inside the host: inside, contentEditable would hand it back on
   the next keystroke and the derived number would be committed to the file. */
.sp-b:has(> .sp-ans) > .sp-text { display: inline }

.sp-ans {
  margin-inline-start: .45em;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  user-select: none;
}
.sp-b:has(> .sp-preview) > .sp-text { display: inline }

.sp-preview {
  margin-inline-start: .45em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  user-select: none;
  opacity: .8;
}
.sp-preview kbd {
  font: inherit; font-size: .82em; opacity: .8;
  border: 1px solid currentColor; border-radius: 4px; padding: 0 .3em;
  margin-inline-start: .4em;
}
@media (prefers-reduced-motion: no-preference) {
  .sp-preview { animation: sp-ghost-in .12s ease-out }
  @keyframes sp-ghost-in { from { opacity: 0 } to { opacity: .75 } }
}

/* ---- who else is here ---------------------------------------------------
   Presence has to be legible without being loud: a shared space is still a
   document, and a colleague reading a page two levels down the tree is not an
   event. Dots, not banners. */

/* A bar button like every other: the 30px grid, no frame, the same ink. It was
   35×29 with a 16px glyph, `--muted` ink (3.45:1) and the only border in the
   bar, so it read as a different kind of control. The border comes back only
   as the LIVE state below, where it means something. */
.sp-live {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-width: 36px; height: var(--ctl-h);
  border: 1px solid transparent; background: none; color: var(--ink-2);
  border-radius: 8px; padding: 6px 9px; cursor: pointer; font: inherit; font-size: 13px; line-height: 1;
}
.sp-live:hover { background: var(--chrome-2); color: var(--ink); }
.sp-live .sp-ico { display: inline-flex; }
.sp-live .sp-ico svg { width: 16px; height: 16px; }
.sp-live-n:empty { display: none; }
.sp-live-n { font-size: 12px; font-variant-numeric: tabular-nums; }
/* LIVE is a state worth seeing at a glance, and OFF must not look broken —
   the overwhelmingly common case is a document nobody is sharing, and a red
   or struck-through control would make normal use look like a fault. */
.sp-live-on { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent-ink) 45%, var(--line)); }
.sp-live-off { opacity: .75; }
/* dialling, or retrying after a drop — not a failure yet, and not "off" */
.sp-live-wait { opacity: .75; animation: sp-live-pulse 1.4s ease-in-out infinite; }
@keyframes sp-live-pulse { 50% { opacity: 1; } }

.sp-presence { display: inline-flex; gap: 2px; margin-inline-start: auto; padding-inline-start: 6px; }
.sp-dot {
  width: 16px; height: 16px; border-radius: 50%;
  display: inline-grid; place-items: center;
  /* the dot's fill is a generated saturated hue set inline by collabui, so
     its ink is white on both grounds — not a chrome surface. */
  font-size: 9px; font-weight: 700; color: #fff;
  text-transform: uppercase; letter-spacing: 0;
}
.sp-dot-more { background: var(--chrome-2); color: var(--muted); }

/* ————— SLIDES PARITY: the Share popover —————
   slides' `.ed-share-pop` and its parts (slides/src/styles.css), value for
   value: 12px padding, 7px between parts, 250–290 wide, your name on one line,
   10.5px/700 uppercase section labels, the status in amber or green, and the
   actions as framed 12.5px buttons with the first one filled. The one thing
   that is not slides' is the second line on each action — D2 rules Share a
   consequence menu, so what a button does is written on it. */
.sp-pop.sp-people {
  display: flex; flex-direction: column; gap: 7px;
  width: auto; min-width: 250px; max-width: 290px; padding: 12px;
}
.sp-pop.sp-people.sp-sheet { max-width: none; }
/* slides' popover sits at its 250px floor (it is sized against its button);
   a fixed popover would instead grow to the cap as soon as a note wraps */
.sp-pop.sp-people:not(.sp-sheet) { width: 250px; }
.sp-share-name { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.sp-share-name .sp-input { flex: 1; min-width: 0; }
/* a stacked field (the link card's) */
.sp-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.sp-field-lbl { font-size: 12px; color: var(--muted); }
.sp-share-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--muted); margin-top: 3px;
}
.sp-input { width: 100%; }
.sp-plist { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; }
.sp-pitem {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 0; background: none; font: inherit; font-size: 12.5px; color: var(--ink);
  padding: 4px 6px; border-radius: 6px; cursor: pointer; text-align: start;
}
.sp-pitem:hover { background: var(--pop-hover); }
.sp-pname { font-weight: 550; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* where they are, quietly — the page title is context, not the subject */
.sp-ppage { color: var(--muted); font-size: 11.5px; margin-inline-start: auto;
  max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-pempty, .sp-pnote { color: var(--muted); font-size: 12px; line-height: 1.45; margin: 0; }
.sp-pacts { display: flex; flex-direction: column; gap: 0; }
/* slides #573: Share's actions are plain menu rows — `.ed-btn` in a menu:
   12.5px, one 30px line, 6px 9px inside a transparent 1px frame, a hover fill
   and nothing at rest, no filled primary; adjacent rows touch */
.sp-paction {
  display: flex; align-items: center; gap: 6px; width: 100%; text-align: start;
  font: inherit; font-size: 12.5px; color: var(--ink-2);
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  padding: 6px 9px; cursor: pointer; white-space: nowrap;
}
.sp-paction:hover { background: var(--pop-hover); }
.sp-paction:active { background: var(--pop-line); }
.sp-paction-ico { display: flex; flex: none; }
.sp-paction-ico svg { display: block; }
.sp-paction-body { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* the rows touch, so the rule carries the popover's 7px either side, as
   slides' `.ed-share-sep` gets from its gap */
.sp-paction-sep { height: 1px; background: var(--pop-line); margin: 9px 0; }

/* THIS device's row in the People list, on a chrome ground as slides' */
.sp-pme { cursor: default; background: var(--pop-chrome); border-radius: 7px; gap: 7px; }
.sp-pme:hover { background: var(--pop-chrome); }
.sp-pme .sp-pname { font-weight: 600; }
.sp-pme .sp-ppage { font-size: 11px; font-variant-numeric: tabular-nums; }

/* Remove, on a peer row. Deliberately faint until the row is hovered — a
   revocation is one click and it is not undoable, so it must not read as
   part of the row's own affordance (clicking a person FOLLOWS them). */
.sp-pkick {
  margin-inline-start: 6px; padding: 0 4px; border-radius: 5px;
  color: var(--muted); font-size: 12px; line-height: 1.6; opacity: 0;
}
.sp-pitem:hover .sp-pkick { opacity: 1; }
.sp-pkick:hover { background: color-mix(in srgb, var(--c-red) 18%, transparent); color: var(--c-red); }

/* The connection line, slides' `.ed-share-status`: amber until live, green
   once it is. One glance = which of the five states this copy is in. */
.sp-pstatus { font-size: 12.5px; font-weight: 600; color: var(--share-wait); }
.sp-pstatus.ok { color: var(--share-ok); }

/* A heading inside a menu: the three width rows are a CHOICE among themselves,
   not three more actions in the list above them. */
.sp-menu-label {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 10px 10px 4px; margin-top: 4px;
  border-top: 1px solid var(--line);
}

/* ————— review comments —————
   A marker sits in the END margin, opposite the block gutter: outside the text
   column, so it never reflows the prose it is about, and beside the line it
   refers to. Page-level threads sit in a row under the title instead, because
   the page's identity is what they are about. Both are chrome — the print
   sheet below drops them, and the reading view never paints them. */
.sp-cm-mark {
  position: absolute; inset-inline-end: -34px; top: 2px;
  min-width: 21px; height: 21px; padding: 0 5px;
  border: 1px solid var(--line); border-radius: 10px 10px 10px 3px;
  background: var(--surface); color: var(--muted);
  font: inherit; font-size: 11px; font-weight: 650; line-height: 19px;
  cursor: pointer;
}
.sp-cm-mark:hover { border-color: var(--accent); color: var(--accent-ink); }
/* resolved is QUIET, never gone: the argument is still in the file */
.sp-cm-done { opacity: .45; }
.sp-cm-new { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
/* the page-level row is in the flow, so its markers are too */
.sp-cm-row { display: flex; gap: 4px; margin: 0 0 10px; }
.sp-cm-row .sp-cm-mark { position: static; }
/* the tree badge: a page with unanswered comments, seen from another page */
.sp-cm-badge {
  margin-inline-start: auto; flex: 0 0 auto;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  /* ink ON the fill, and the fill is brand: --accent-on does not flip. */
  background: var(--accent); color: var(--accent-on);
  font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
}
.sp-cm-pop { width: 290px; }
.sp-cm-head {
  display: flex; align-items: baseline; gap: 8px; justify-content: space-between;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 4px 6px 8px;
}
.sp-cm-me {
  border: 0; background: none; font: inherit; font-size: 11px; text-transform: none;
  letter-spacing: 0; color: var(--muted); cursor: pointer;
  /* a 49×13 target was a miss; the padding is the hit area, pulled back out
     of the layout by the negative margin so the heading does not move */
  padding: 6px 8px; margin: -6px -8px; border-radius: 6px;
}
.sp-cm-me:hover { color: var(--ink); }
.sp-cm-entries { display: flex; flex-direction: column; gap: 8px; padding: 0 6px 8px; }
.sp-cm-entry b { font-size: 12.5px; }
.sp-cm-time { color: var(--muted); font-size: 11px; margin-inline-start: 6px; }
.sp-cm-entry p { margin: 2px 0 0; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.sp-cm-reply { width: 100%; }
.sp-cm-foot { display: flex; gap: 6px; padding: 8px 6px 4px; }
@media (max-width: 820px) {
  /* no end margin is reserved at this width — the marker tucks into the
     column's own end edge rather than off the side of the screen */
  .sp-cm-mark { inset-inline-end: 0; }
}
@media print { .sp-cm-mark, .sp-cm-row { display: none !important; } }

/* ————— page covers ————— */
/* A COVER IS FULL-BLEED. It belongs to the page rather than to the prose, so
   it ignores the measure and escapes the reading column's padding — which is
   why that padding is `--sp-pad-x/y` rather than four literals scattered
   through this file. The height is viewport-relative with a floor and a
   ceiling: a fixed 200px is a stripe on a large screen and half the window on
   a short one. */
.sp-cover {
  /* NO BOTTOM MARGIN. It used to be 26px, and the inner column's -30px lift is
     its ADJACENT SIBLING, so the two collapsed to -4px: measured, cover bottom
     317 against icon top 313. The disc sat tangent to the picture and the
     comment below described an arrangement that was not happening. The air
     under the cover is the inner's business now, because only one of the two
     can own it. */
  margin: calc(-1 * var(--sp-pad-y, 0px)) calc(-1 * var(--sp-pad-x, 0px)) 0;
  height: clamp(150px, 30vh, 320px);
  overflow: hidden; position: relative; background: var(--chrome-2);
  /* A near-white photograph — a scan, snow, a whiteboard — is the same colour
     as the page, so without an edge it reads as "the image failed to load"
     rather than as a picture. An inset hairline costs nothing and is invisible
     on every other image. */
  box-shadow: inset 0 0 0 1px rgb(var(--shade) / .08);
}
.sp-cover-img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* A PROCEDURAL cover (procedural.ts): the figure fills the same box, over the
   same ground — `slice` crops it to whatever the band's aspect is. */
.sp-gen { display: block; width: 100%; height: 100%; }
/* The lift is what makes it read as a cover rather than as a banner sitting on
   top of a document: the title rises INTO the picture's lower edge, which is
   the arrangement everyone recognises. A scrim under the title would fight the
   page background in one theme or the other, so the page's own background does
   the work — the column is opaque and the picture ends behind it. */
/* WHAT MAKES IT A COVER RATHER THAN A BANNER: the page's own icon rides up
   over the picture's lower edge, on the column's own left margin. That is the
   arrangement everybody recognises, and the icon is the thing to lift — the
   title is a line of text and putting THAT over a photograph means a scrim,
   contrast rules and a colour that works over every possible image. A 54px
   disc in the page background does not. */
/* THE LIFT IS THE ICON'S, so it only applies where an icon renders. The reading
   view draws no page icon, and the lift still applied there: measured, cover
   bottom 197 against title top 193 — the TITLE on the photograph, unscrimmed,
   which is the one thing the comment above says this design exists to avoid. It
   survived over a dark sky and would not over a light one. `:has()` asks the
   only question that matters — is there a disc to do the lifting. */
.sp-page.sp-has-cover .sp-page-inner { position: relative; margin-top: 26px; }
.sp-page.sp-has-cover .sp-page-inner:has(> .sp-pageicon) { margin-top: -26px; }
.sp-page.sp-has-cover .sp-pageicon {
  width: 58px; height: 58px; margin-inline-start: -6px; margin-bottom: 2px;
  background: var(--bg); border-radius: 14px; color: var(--ink-2, var(--ink));
  box-shadow: 0 1px 4px rgb(var(--shade) / .16);
}
.sp-page.sp-has-cover .sp-pageicon:hover { background: var(--chrome-2); }
.sp-page.sp-has-cover .sp-pageicon svg { width: 32px; height: 32px; }
/* an emoji icon is TEXT in that box, and 34px is the size that fills it */
.sp-page.sp-has-cover .sp-pageicon { font-size: 32px; line-height: 1; }
@media print {
  /* on paper the picture is the picture; the lift is a screen affordance, and
     the icon is hidden in print anyway */
  .sp-cover { height: 5cm; margin-bottom: 10mm; break-inside: avoid; }
  .sp-page.sp-has-cover .sp-page-inner { margin-top: 0; }
}

/* ————— the gallery ————— */
/* THE SHAPE THAT MAKES A READING LIST LOOK LIKE ONE. Cards are as wide as they
   need to be and the grid decides how many fit — `auto-fill` with a minimum,
   never a column count, so the same view is three across in the panel-open
   editor and five across on a wide screen without anybody configuring it. */
.sp-gallery {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  margin-bottom: 4px;
}
.sp-gcard {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden;
}
.sp-gcard:hover { border-color: var(--edge); box-shadow: 0 4px 14px rgb(var(--shade) / .10); }
.sp-gcard-shot {
  aspect-ratio: 3 / 2; background: var(--chrome-2);
  /* the same floor the page cover gets: a white picture still has an edge */
  box-shadow: inset 0 0 0 1px rgb(var(--shade) / .08);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.sp-gcard-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* A CARD WITH NO COVER IS NOT A HOLE. Its own figure, derived from the page id
   (procedural.ts — the tint this rule used to draw, plus a pattern), so a
   gallery nobody has given pictures to still reads as a set of distinct
   things. Alpha over the ground keeps it a tint in both themes rather than a
   colour that glows on the dark one. The mark sits above the figure. */
.sp-gcard-bare { position: relative; }
.sp-gcard-bare .sp-gen { position: absolute; inset: 0; }
.sp-gcard-bare .sp-gcard-mark { position: relative; }
/* --ink-2, not --muted: a grey letter on a 30% tint was the same value as the
   tint in the dark theme. */
.sp-gcard-mark { font-size: 34px; line-height: 1; color: var(--ink-2, var(--ink)); font-weight: 600; }
.sp-gcard-ico svg { width: 30px; height: 30px; }
.sp-gcard-body { padding: 10px 11px 11px; }
/* CLAMPED. One four-line title inflates its grid row and every card beside it
   gets stretched with dead space under a one-line title — measured at seven
   columns, six cards carrying ~60px of nothing. Two lines is the difference
   between a grid and a pile. (`a.sp-gcard` is dead — the card is a div — so the
   selector loses it.) */
/* SPECIFICITY, not source order. `.sp-gcard .sp-issue-title` is (0,2,0) and
   loses to `.sp-page a.sp-issue-title` (0,2,1) further up, which sets
   `display: block` — so `display: -webkit-box` never applied and the clamp sat
   there inert. Measured before this line: computed display `block`,
   -webkit-line-clamp `2`, and a long title rendering FOUR lines with
   scrollHeight == clientHeight, i.e. nothing clipped. The comment above was
   describing a fix that was not in effect.
   Going through `.sp-gcard-body` makes it (0,3,0), which beats a
   two-classes-plus-an-element selector outright rather than by winning a tie on
   order — the card's title is inside that wrapper in both shapes it renders as. */
.sp-gcard .sp-gcard-body .sp-issue-title {
  font-size: 13.5px; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.sp-gcard .sp-issue-meta { margin-top: 6px; }

/* THE WHOLE CARD IS THE TARGET, not the two words of its title. In a gallery
   the picture IS the thing you point at — a shelf of book covers where only the
   caption responds is a shelf that feels broken, and the cover is the largest
   and most obvious target on the card by a wide margin.

   Done by stretching the title's OWN link over the card rather than by wrapping
   the card in a second anchor: one link, one accessible name, and no anchor
   nested inside another. `.sp-gcard` is already `position: relative`, and
   nothing between it and the title is positioned, so `inset: 0` resolves to the
   card. Only the editable card has an anchor to stretch — in reading view the
   title is a span, there is no link, and correctly nothing to click. */
.sp-gcard .sp-issue-title::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
}

/* ————— CANVAS ————————————————————————————————————————————————————————————
   A bounded surface with cards placed on it (canvas.ts). The block is
   `sp-b-canvas`; its parts are `sp-cv-*`, on the `sp-tb-*` precedent — `.sp-card`
   is already the DIALOG card and `.sp-issue` the board's, and a third meaning
   for one class name is how the 560px-wide board card happened.

   THE SURFACE HOLDS ITS SHAPE. `aspect-ratio` from the block's own `ratio`,
   so the same file lays out identically at 400px and at 2000px and on paper —
   which is the whole reason the coordinates are percentages. `--sp-ratio` is
   set inline by the renderer because it is document data; everything else here
   is chrome. */
.sp-b-canvas { margin: 18px 0; }
.sp-canvas-head {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-bottom: 7px;
}
.sp-canvas-title {
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  min-width: 40px; outline: none; border-radius: 5px; padding: 1px 3px;
}
.sp-canvas-title:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }
.sp-canvas-title[data-ph]:empty::before {
  content: attr(data-ph); color: var(--ph); pointer-events: none;
}
.sp-canvas-btn { font-size: 12px; padding: 3px 9px; }
.sp-canvas-head .sp-canvas-btn:first-of-type { margin-inline-start: auto; }
.sp-canvas-empty {
  position: absolute; inset-inline: 0; top: 44%; margin: 0;
  text-align: center; color: var(--muted); font-size: 13px; pointer-events: none;
}
/* the empty line is positioned against the BLOCK, so the block is the frame */
.sp-b-canvas { position: relative; }

.sp-canvas-body {
  position: relative;
  aspect-ratio: var(--sp-ratio, 1.6);
  background: var(--chrome);
  border: 1px solid var(--line);
  border-radius: 10px;
  /* The surface reads as a surface: a faint grid, not a texture.
     MIXED FROM `--ink`, not from `--shade`. `--shade` is the shadow token and
     it goes to pure black in dark — a black grid on a near-black ground is a
     grid nobody can see, which is what the first draft shipped. `--ink` flips
     with the ground, so the same declaration is a dark grid on white and a
     light one on black. */
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 1px);
  background-size: 5% 8%;
}

/* A CARD. `--sp-x`/`--sp-y` are percentages of the surface, written by the
   renderer from the model and by the drag while it is running — which is what
   lets the drag move the card without a repaint, and lets the phone rule below
   ignore the position entirely. An inline `left` could do neither. */
.sp-canvas-body > .sp-cv-card {
  position: absolute;
  left: calc(var(--sp-x, 0) * 1%);
  top: calc(var(--sp-y, 0) * 1%);
  width: 22%; min-width: 96px;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
  font-size: 13px; line-height: 1.4;
  box-shadow: 0 1px 3px rgb(var(--shade) / .08);
  overflow-wrap: anywhere;
}
.sp-canvas-body > .sp-cv-card:hover { border-color: var(--edge); }
.sp-cv-moving { box-shadow: 0 6px 18px rgb(var(--shade) / .22) !important; z-index: 3; }
/* while a card is being dragged the whole document stops trying to select text */
body.sp-canvas-dragging { user-select: none; cursor: grabbing; }

/* THE GRIP AND THE ✕ are the card's own chrome, so they sit ON it rather than
   in the gutter — the block gutter is hidden inside a canvas (below) because
   its drag reorders a LIST, which is not what this surface means. */
.sp-cv-grip {
  position: absolute; top: 2px; width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: none; color: var(--ph); padding: 0;
  border-radius: 5px; opacity: 0; transition: opacity .12s;
}
.sp-cv-grip { inset-inline-start: 2px; cursor: grab; }
.sp-cv-grip svg { width: 13px; height: 13px; }
.sp-cv-card:hover .sp-cv-grip, .sp-cv-grip:focus-visible { opacity: 1; }
.sp-cv-grip:hover { color: var(--ink-2); background: var(--chrome-2); }
.sp-cv-grip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* room for the controls, so a card's first line never runs under them */
.sp-canvas-body > .sp-cv-card { padding-top: 20px; }
/* THE BLOCK GUTTER STAYS. It is where every block in a space is turned into
   another type, duplicated and deleted, and on a phone it is the ONLY way to
   reach any of that — hiding it inside a canvas would have made a card the one
   block you cannot delete without a mouse. It only moves: the gutter lives in
   the reading column's left margin, which on a surface is another card. Inside
   a canvas it tucks into the card's own top-left, beside the drag grip. */
.sp-canvas-body > .sp-cv-card > .sp-gutter {
  position: absolute; inset-inline-start: 24px; inset-inline-end: auto;
  top: 1px; width: auto; margin: 0; padding: 0;
  display: flex; gap: 0;
}
/* THE GRIP FOLLOWS THE GUTTER'S RULE, not its own. Below 820px the gutter
   stops hiding until hover, because a touch screen has no hover to reveal it
   with — and a drag handle that only appears on hover is exactly the same
   problem. Measured at 719px: the gutter was drawn on every card and the grip
   beside it was not, so the one control that moves a card was the one you
   could not see. */
@media (max-width: 820px) { .sp-cv-grip { opacity: 1; } }
/* a page card inside a canvas fills its card rather than drawing a second one */
.sp-canvas-body > .sp-cv-card .sp-pagecard {
  border: 0; background: none; padding: 0; margin: 0; font-size: 13px;
}

/* A PHONE IS NOT A SURFACE. Four cards on a 360px-wide board are four
   unreadable stamps, so below this width the canvas becomes what it is a
   picture OF: the list of what is on it, in document order. The positions are
   untouched in the file — this is a rendering choice, made where the layout
   lives, and the same file laid out spatially again on the next screen up. */
@media (max-width: 560px) {
  .sp-canvas-body {
    aspect-ratio: auto; display: flex; flex-direction: column; gap: 8px;
    padding: 9px; background-image: none;
  }
  /* `relative`, not `static`: the card flows in the column but stays the
     gutter's positioning parent, so the gutter is still OUT OF THE FLOW.
     Putting it in the flow costs every card a 36px row it does not need —
     the measured mistake the block gutter already made once. */
  /* `relative`, and `left`/`top` EXPLICITLY CLEARED. A relative box still
     honours its offsets — measured at 375px, every card kept its `left` and
     `top` as a nudge and the surface came out as a diagonal staircase running
     off the side of the screen. `position` alone does not undo a placement. */
  .sp-canvas-body > .sp-cv-card {
    position: relative; inset: auto; width: auto;
  }
  /* no hover on a phone, and nothing to drag to on a stacked list */
  .sp-cv-grip { display: none; }
}

/* ——— CHARTS OF THE TRAIL ————————————————————————————————————————————————
   Burndown, burnup, cumulative flow (src/charts.ts). The svg carries no
   colours of its own beyond the band fills the schema declares, so the chrome
   below is the one place light and dark are answered.

   THE GAP AND THE SAMPLE ARE STYLED HERE AND NOWHERE ELSE. A hatched band
   means "not recorded" and a dashed segment means "this reading stands for
   more than a day"; both are content, not decoration, so both are legible on
   a monochrome printout and neither depends on colour vision. */
.sp-b-chart { margin: 0 0 18px; }
.sp-chart-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.sp-chart-title { font-weight: 600; }
.sp-chart-range { color: var(--muted); font-size: 12.5px; }
.sp-chart-empty { color: var(--muted); font-size: 13.5px; margin: 6px 0; }
/* 100% of the column, but never BIGGER than it was drawn: the viewBox is
   640×300, and scaling that up to a 1100px board page gave a 520px-tall chart
   in the middle of a page of prose — measured. A chart is evidence in a
   document, not a dashboard tile. */
.sp-chart-svg { display: block; width: 100%; max-width: 640px; height: auto; overflow: visible; }
.sp-chart-grid { stroke: var(--edge); stroke-width: 0.5; opacity: 0.5; }
.sp-chart-axisline { stroke: var(--edge); stroke-width: 1; }
.sp-chart-axis { fill: var(--muted); font-size: 10px; }
.sp-chart-note { fill: var(--muted); font-size: 9.5px; }
.sp-chart-hatch { stroke: var(--edge); stroke-width: 1.5; }
.sp-chart-gap { opacity: 0.55; }
.sp-chart-line { stroke-width: 2; fill: none; stroke-linecap: round; }
/* A SAMPLE IS DASHED. Thinning keeps one row per week and drops the rest, so
   the segment arriving at it covers days nobody observed one at a time — and a
   weekly reading drawn as a solid daily line is the same lie as interpolating
   a gap. */
.sp-chart-sampled { stroke-dasharray: 5 4; }
.sp-chart-sampledot { stroke: var(--bg); stroke-width: 1.5; }
.sp-chart-band { opacity: 0.82; }
.sp-chart-ideal { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 4; }
.sp-chart-committed { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 8 4; }
.sp-chart-cut { stroke: var(--edge); stroke-width: 2; }
.sp-chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.sp-chart-key { display: inline-flex; align-items: center; gap: 6px; }
.sp-chart-key i { width: 10px; height: 10px; border-radius: 2px; background: var(--edge); display: inline-block; }
.sp-chart-keygap i { background: repeating-linear-gradient(45deg, var(--edge) 0 2px, transparent 2px 4px); }
.sp-chart-keysample i { background: none; border-top: 2px dashed var(--muted); height: 0; border-radius: 0; }
.sp-chart-pick { margin-top: 8px; }

@media print {
  /* a chart is the page's evidence: it prints, whole, and without its control */
  .sp-b-chart { break-inside: avoid; }
  .sp-chart-pick, [data-chart-period] { display: none !important; }
  /* the surface IS the content: it prints where it was placed, and it is not
     broken across a page boundary */
  .sp-b-canvas { break-inside: avoid; }
  .sp-canvas-body { background: none; background-image: none; }
  .sp-cv-grip, .sp-canvas-btn { display: none !important; }
}

/* ---- the calendar layout -------------------------------------------------
   A GRID OF SEVEN COLUMNS, and the number of ROWS is never asserted here: a
   month is four, five or six weeks depending on the month and on where the
   reader's week starts, so `grid-auto-rows` lets the cells the renderer emitted
   decide. `repeat(6, …)` would clip a six-week month's last week silently. */
.sp-cal-hint { color: var(--muted); font-size: 12px; margin: 0 0 8px; }
.sp-cal-bar { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; }
.sp-cal-month { font-weight: 600; font-size: 14px; min-width: 8.5em; text-align: center; }
.sp-cal-step { padding: 2px 8px; }
.sp-cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; margin-bottom: 4px;
}
.sp-cal-wd {
  background: var(--chrome); color: var(--muted);
  font-size: 11px; font-weight: 600; text-align: center; padding: 5px 2px;
}
.sp-cal-cell {
  background: var(--surface); min-height: 76px; padding: 4px 5px 6px;
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
/* the neighbouring months' days are drawn, not hollowed out: a grid whose
   corners are holes reads as broken, and an entry on the 1st of next month is
   what somebody looking at the last week of this one wants to see */
.sp-cal-out { background: var(--chrome-2, var(--chrome)); }
.sp-cal-out .sp-cal-num { opacity: .45; }
.sp-cal-today { box-shadow: inset 0 0 0 2px var(--accent, var(--edge)); }
.sp-cal-today .sp-cal-num { color: var(--accent, var(--ink)); font-weight: 700; }
.sp-cal-num { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sp-cal-entry {
  display: block; font-size: 12px; line-height: 1.3; color: var(--ink);
  text-decoration: none; background: var(--chrome); border-radius: 4px;
  padding: 2px 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sp-cal-entry:hover { background: var(--edge, var(--chrome)); text-decoration: underline; }
.sp-cal-day { margin: 0 0 14px; }
.sp-cal-dayhead {
  font-size: 12px; font-weight: 600; color: var(--muted);
  padding-bottom: 4px; margin-bottom: 6px; border-bottom: 1px solid var(--line);
}
.sp-cal-undated { margin-top: 14px; }
.sp-cal-undated-list { display: flex; flex-wrap: wrap; gap: 5px; }
.sp-cal-undated-list .sp-cal-entry { max-width: 220px; }
/* A PHONE CANNOT SHOW SEVEN READABLE COLUMNS of entries, but it can show the
   shape of the month. The cells shrink and the entries become dots-with-a-tail
   rather than disappearing — an empty-looking calendar is worse than a cramped
   one, because it is wrong. */
@media (max-width: 640px) {
  .sp-cal-cell { min-height: 54px; padding: 3px 2px 4px; }
  .sp-cal-entry { font-size: 10px; padding: 1px 3px; }
}
@media print {
  /* the arrows navigate nothing on paper */
  .sp-cal-bar .sp-cal-step { display: none; }
}
/* ————— the block format row —————
   Lives at the top of the block menu, which is a bottom SHEET on a phone, so
   this is the same markup at both widths and the touch targets are sized for
   the smaller of them (44px is the floor a thumb needs; the row wraps rather
   than scrolls, because a scroll container inside a popover clips the other
   axis too). blockbar.ts records why these controls are not in the selection
   toolbar. */
.sp-blockbar {
  display: flex; flex-wrap: wrap; gap: 2px; align-items: center;
  padding: 2px 2px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line);
}
.sp-blockbar-gap { flex: 1 1 auto; min-width: 4px; }
.sp-blockbtn {
  display: inline-flex; align-items: center; justify-content: center;
  /* 28, not 30: eight type buttons plus their gaps have to fit one row of a
     260px popover (8×28 + 7×2 = 238 ≤ 248 of usable width), so the row breaks
     between the types and the two nesting controls rather than orphaning the
     quote button on a line of its own. Measured in the built shell. */
  width: 28px; height: 28px; padding: 0; border: 0; border-radius: 7px;
  background: none; color: var(--ink-2); cursor: pointer;
}
.sp-blockbtn svg { width: 17px; height: 17px; }
.sp-blockbtn:hover { background: var(--chrome-2); color: var(--ink); }
.sp-blockbtn.sp-sel { background: var(--chrome-2); color: var(--accent); }
/* aria-disabled, NOT disabled: the control has to stay focusable so a keyboard
   can reach the label that explains why it is off (blockbar.ts). So the opacity
   is the only thing that changes — clicks still land, and land on the code that
   says why. */
.sp-blockbtn.sp-off { opacity: .38; }
@media (pointer: coarse) {
  .sp-blockbar { gap: 4px; padding-bottom: 8px; }
  .sp-blockbtn { width: 44px; height: 44px; }
  .sp-blockbtn svg { width: 20px; height: 20px; }
}

/* A refused gesture, at the block it was aimed at. The words are in the status
   line; this is the pointer. Motion only — no layout, so it cannot reflow the
   prose under the caret. */
@media (prefers-reduced-motion: no-preference) {
  .sp-nudge { animation: sp-nudge .34s ease; }
  @keyframes sp-nudge {
    0%, 100% { transform: none }
    25% { transform: translateX(3px) }
    60% { transform: translateX(-2px) }
  }
}
/* ---------------------------------------------------------------------------
   FOOTNOTES (src/footnotes.ts)

   The marker is a superscript number and the notes are a numbered list at the
   foot of the page. Both are DERIVED — nothing here has a document field
   behind it — so the styling only has to do two jobs: keep the marker from
   disturbing the line it sits in, and keep the notes quieter than the prose
   they belong to.
   --------------------------------------------------------------------------- */
/* THE MARKER MUST NOT CHANGE THE LINE HEIGHT. `vertical-align: super` on a
   normal-size box grows the line box, and a paragraph with one footnote in it
   then sits taller than the one above it — visible as a stutter down a page of
   prose. `line-height: 0` on the raised box is what stops that. */
.sp-fnref { font-size: 0.72em; line-height: 0; vertical-align: super; }
.sp-fnref a {
  color: var(--accent-ink); text-decoration: none; padding: 0 1px; border-radius: 3px;
}
.sp-fnref a:hover, .sp-fnref a:focus-visible { background: var(--chrome-2); }

.sp-fnotes {
  margin: 40px 0 0; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 14px; color: var(--muted);
}
.sp-fnlist { margin: 0; padding-inline-start: 22px; }
.sp-fnote { margin: 0 0 6px; }
.sp-fnote::marker { color: var(--accent-ink); }
.sp-fnbody { display: inline; }
.sp-fnbody[data-ph]:empty::before {
  content: attr(data-ph); color: var(--ph); pointer-events: none;
}
.sp-fnbody[contenteditable="true"]:focus {
  outline: none; box-shadow: 0 0 0 2px var(--chrome-2); border-radius: 3px;
}
/* THE WAY BACK. Quiet until you want it — a column of arrows down the notes
   reads as decoration, and the arrow is only ever wanted once you have
   finished reading the note it belongs to. */
.sp-fnback {
  color: var(--ph); text-decoration: none; margin-inline-end: 6px; font-size: 12px;
}
.sp-fnote:hover .sp-fnback, .sp-fnback:focus-visible { color: var(--accent-ink); }

@media print {
  /* WHERE FOOTNOTES LAND ON PAPER: at the foot of the PAGE OF THE DOCUMENT,
     not of the sheet. CSS `float: footnote` is the typographic answer and no
     browser implements it (it is Paged Media, and print-to-PDF from Chrome,
     Safari and Firefox all ignore it) — so a "real" footnote here would be one
     that silently did not print, which is the single outcome this feature
     cannot have. A page of a space is one flow under one heading and the
     section already sits at the end of it: endnotes per page, which is what a
     multi-page handout wants anyway. Kept whole across a sheet break, because
     a note split down the middle is worse than one that starts lower. */
  .sp-fnotes { break-inside: avoid; color: #000; border-top-color: #999; }
  .sp-fnote { break-inside: avoid; }
  /* the arrow is navigation, and paper has none */
  .sp-fnback { display: none !important; }
  /* an accent marker on a monochrome printer is a grey smudge at 7px */
  .sp-fnref a { color: #000; background: none !important; }
}

/* ————— SLIDES PARITY: the keyboard ring —————
   slides #573 (and the kernel's .bkm-item): 2px --accent-ink. Bar and dialog
   buttons draw it OUTSIDE, on the surface they sit on (inside, it would vanish
   into Save's ink fill); rows in a list draw it INSIDE, where the list's own
   padding would clip it. :focus-visible, so a pointer never sees it. */
.sp-bar button:not(.bkm-item):focus-visible, .bkd-card button:not(.bkm-item):focus-visible {
  outline: 2px solid var(--accent-ink); outline-offset: 2px;
}
.sp-pop .sp-paction:focus-visible, .sp-pop .sp-pitem:focus-visible, .sp-mn-pop .bkm-item:focus-visible,
.bkd-card .sp-result:focus-visible, .bkd-card .sp-ab-version:focus-visible {
  outline: 2px solid var(--accent-ink); outline-offset: -2px;
}


/* ————— the insert group (inserts.ts) —————
   Slides' insert group: one button per kind, icon + word, on the bar's 30px
   grid (.sp-btn is slides' .ed-btn), 6px apart inside the group. The words go
   at the compact tier with every other label (.sp-btnlabel); at the fold the
   whole group moves into ⋯, under its captions. Reading view has nothing to
   insert into, so the group leaves the bar there. */
.sp-bar-fold .sp-group-insert { display: none; }
.sp-app.sp-reading .sp-group-insert { display: none; }
/* the / menu's sections: the families' captions, and a rule before a run of
   one-member kinds — the menus' caption, in the popover's list */
.sp-results-cap {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 10px 10px 4px; margin-top: 4px; border-top: 1px solid var(--line);
}
.sp-results-cap:first-child { border-top: 0; margin-top: 0; padding-top: 4px; }
.sp-results-rule { height: 1px; background: var(--line); margin: 4px 2px; }

/* the page list's + ▾: New page, and the caret for the other ways a page
   arrives. Two ghost halves that touch, like the Save split's two halves. */
.sp-newsplit { display: inline-flex; align-items: stretch; }
.sp-newsplit > .sp-newpage { border-start-end-radius: 0; border-end-end-radius: 0; padding-inline: 7px 5px; }
.sp-newsplit .sp-newmenu { display: flex; align-items: stretch; }
.sp-newsplit .sp-newmenu > .sp-btn {
  border-start-start-radius: 0; border-end-start-radius: 0;
  padding-inline: 4px 6px; color: var(--muted);
}
@media (pointer: coarse), (max-width: 700px) {
  .sp-newsplit > .sp-newpage, .sp-newsplit .sp-newmenu > .sp-btn {
    min-width: var(--tap); min-height: var(--tap); justify-content: center;
  }
}

/* ————— the Reading view pill —————
   Slides' Slideshow pill (.ed-present-pill, .ed-pill-main): a surface pill on
   a hairline, its soft shadow, 600 weight, the chrome tint on hover — in the
   corner slides gives it, bottom-END (inset-inline-end, so RTL mirrors it),
   14px in from the page's edge and above the safe area. `.sp-corner` is a
   zero-width box after the page, so `inset-inline-end` measures from the
   page's own edge, never from under the properties panel. The page's 40vh
   bottom padding is what lets the last line scroll clear of it. */
.sp-corner { position: relative; flex: 0 0 0; width: 0; min-width: 0; }
.sp-corner > .sp-readfab {
  position: absolute; z-index: 11;
  inset-inline-end: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: 0 4px 14px rgb(20 30 45 / 0.10);
  padding-block: 6px; padding-inline: 14px; font-weight: 600; color: var(--ink-2);
}
.sp-corner > .sp-readfab:hover { background: var(--chrome); }
.sp-corner > .sp-readfab.sp-on { background: var(--chrome-2); color: var(--ink); box-shadow: 0 4px 14px rgb(20 30 45 / 0.10), inset 0 0 0 1px var(--line); }
@media (pointer: coarse), (max-width: 700px) {
  .sp-corner > .sp-readfab { min-height: var(--tap); }
}
@media print { .sp-corner { display: none !important; } }

/* the page list's header: Graph beside + ▾ */
.sp-side-acts { display: inline-flex; align-items: center; gap: 2px; }
.sp-graphbtn { padding-inline: 6px; color: var(--muted); }
.sp-graphbtn:hover { color: var(--ink); }
@media (pointer: coarse), (max-width: 700px) {
  .sp-graphbtn { min-width: var(--tap); min-height: var(--tap); justify-content: center; }
}

/* ————— page templates —————
   One row in the Templates dialog: the icon beside the name rather than above
   it. `.sp-result-ico` and `.sp-tree-ico` are both `display: flex` and expect a
   flex PARENT; dropped into a plain span each became a block of its own. */
.sp-tpl-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sp-tpl-name svg { width: 15px; height: 15px; display: block; color: var(--muted); }

/* ————— the design picker and the customise panel —————
   CHROME: the app's controls for choosing a design, drawn in the app's
   tokens. The designs themselves live in designs.css and never reach here —
   the panel sits on <body>, outside the reading surface. */
.sp-dsg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin: 2px 4px 8px; }
.sp-dsg-choice strong { display: flex; align-items: center; gap: 7px; }
.sp-dsg-sw { display: inline-flex; flex: 0 0 auto; border-radius: 4px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.sp-dsg-sw b { width: 9px; height: 14px; display: block; }
.sp-dsg-panel {
  position: fixed; z-index: 55; top: 58px; bottom: 12px; inset-inline-end: 12px;
  width: min(340px, calc(100vw - 24px)); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 34px rgb(var(--shade) / .2); padding: 10px 12px 12px;
}
.sp-dsg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sp-dsg-sub { font-size: 12px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
.sp-dsg-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 13px; }
.sp-dsg-row > span { color: var(--ink-2); }
.sp-dsg-row .sp-select, .sp-dsg-row .sp-input { max-width: 58%; }
.sp-dsg-range { display: inline-flex; align-items: center; gap: 6px; }
.sp-dsg-range input { width: 120px; }
.sp-dsg-range output { min-width: 38px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.sp-dsg-cols { display: grid; grid-template-columns: 1fr 48px 48px; gap: 4px 8px; align-items: center; font-size: 13px; }
.sp-dsg-cols > span { color: var(--ink-2); }
.sp-dsg-cols > span:nth-child(2), .sp-dsg-cols > span:nth-child(3) { font-size: 11.5px; color: var(--muted); text-align: center; }
/* one page's design choices (page ⋯ menu, properties panel): the swatch sits
   where a menu item's icon does, so the rows read as the page menu's own */
.bkm-menu.sp-dsg-menu { min-width: 250px; }
.sp-dsg-item .bkm-ico { align-items: center; }
.sp-dsg-item .sp-dsg-sw b { height: 16px; }
.sp-insp-dsg { max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-dsg-cols input[type='color'] { width: 44px; }
@media (max-width: 720px) { .sp-dsg-panel { top: auto; height: 62vh; inset-inline: 8px; width: auto; } }
@media print { .sp-dsg-panel { display: none !important; } }