Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

82.9 KB
Raw Blame
/* SPDX-License-Identifier: MIT
   Copyright (c) 2026 The Bento authors
   bento/dash — the whole interface. One stylesheet; it ships deflated. */

/* ————— THE PALETTE, AND THE THEME SWITCH —————
   Two grounds, one set of names. Every colour in dash — here, in panels.css,
   pivot.css, dashboard.css, story.css, saveui.css and about.css — resolves
   through a token below, and no component file states a colour inside a media
   query. Adding a surface means reaching for a token; if none fits, add one
   HERE with both of its values rather than writing a hex where it is used.

   THE THEME IS A VIEWER PREFERENCE AND NEVER ENTERS THE WORKBOOK — the same
   rule as the interface language and reduced motion (PLATFORM §8). Two people
   opening one file may sit in different themes exactly as they may read it in
   different languages. `doc.theme` in model.ts is a DIFFERENT thing: that is
   the document's own palette, it travels in the file, and it colours the
   charts and the static preview. Do not conflate them; nothing here is ever
   read from or written to the document.

   HOW THE SWITCH WORKS — and how it used to, because the old way was reasoned
   and someone will otherwise put it back. :root holds the LIGHT palette; the
   `:root[data-theme="dark"]` block right after it redefines the tokens that
   vary. kernel/src/theme.ts puts `data-theme` on <html> — resolving 'auto'
   against the OS itself, and re-resolving when the OS flips — and also sets
   `color-scheme`, which is what turns the scrollbars, the caret, the native
   selects and the resize grippers dark. Stylesheets key off the attribute;
   `color-scheme` is for the browser's own furniture. That is the division
   theme.ts states, and it is the one slides, spaces and type already follow.

   Dash used `light-dark()` pairs until 2026-09-12, for two reasons this file
   gave at the time. One: a token's two values sat on ONE line, with no second
   copy of the palette to drift from the first. That was a real advantage and
   is the cost of this change; the dark block keeps the same order and the same
   section markers to make side-by-side reading as cheap as it can be, and the
   rig fails on any dark token with no light twin. Two: "an attribute on <html>
   is cloned into every saved file by capturePristine()". True — and answered
   by ORDER, not by avoiding the attribute: main.ts calls startTheme() AFTER
   capturePristine() and before the first paint, so the pristine copy every
   save re-serializes never carries it. slides documents the same two lines.
   The comment also said slides "has none to copy"; it has had a dark block
   since #285. What actually decided it: measured in a browser, setting
   `data-theme="dark"` on dash did NOTHING, so a shared kernel stylesheet keyed
   off the attribute — which is the only key slides can use, since it pins
   `color-scheme: only light` — could not have themed dash at all. Three apps
   on one mechanism and one on another is the divergence, whatever the values.

   `color-scheme: light dark` stays on :root below, for two things that run
   BEFORE theme.ts does: index.html's splash, which is painted from
   `light-dark()` colours before any script runs and so can only follow the OS,
   and the browser furniture in that same window. theme.ts overrides both the
   moment it runs.

   WHICH TOKENS VARY: exactly the ones that appear in the dark block. The
   plain values — the brand amber, the radii, the type scale, the row height —
   are the same object on both grounds and are deliberately NOT themed. The
   amber is the interesting one: it reads ON the dark ground at 9.25:1, so the
   accent does not change when the lights go out. It is 2.02:1 on white, which
   is why it is only ever a border, a badge or a mark there and never body
   text — that was already true and the dark ground does not change it. */
:root {
  color-scheme: light dark;

  /* ————— ground and chrome —————
     THE LIGHT VALUES ARE bento/slides' VALUES, to the byte. slides
     (slides/src/styles.css :root) is the shipped app and its palette is the
     suite's; where dash had picked a neighbouring grey for the same job the
     two apps drifted for no reason anybody could state, and a user moving
     between them saw two different products. The DARK values are dash's own —
     slides is `color-scheme: only light` and has none to copy.

     The name on the left is dash's; slides' name for the same thing is given
     in the comment, and is aliased at the foot of this block so a rule ported
     from slides resolves without being rewritten. */
  --bg: #ffffff;          /* the page, and the sheet itself */
  /* chrome bands: top bar, status bar. slides: --chrome */
  --panel: #f5f7fa;
  /* Raised opaque surfaces — menus, dialogs, popovers, inputs, buttons, the
     side panels. On white it IS the page colour; on dark it has to lift off
     the page or a menu floating over the grid has no edge but its shadow, and
     shadows barely read on a dark ground. */
  --surface: #ffffff;
  /* form-control fill — THE FIELD below. Dash's fields have always sat on
     --surface; naming it lets the shared block read slides' token as is. */
  --field: var(--surface);
  /* menu rows, buttons, list items. slides: --chrome-2 */
  --hover: #eceff4;
  /* A wash for hover states drawn OVER unknown content (a chart band, a table
     row that may already be tinted). Alpha, not a colour, for that reason. */
  --wash: rgb(0 0 0 / 0.04);
  --line: #e3e8ef;
  --line-strong: #cbd5e1;
  --ink: #1e2a3a;
  /* Secondary ink — control labels, panel rows. slides: --ink-2. dash had no
     such token and reached for --muted, which is a CAPTION grey and a step too
     light for a word somebody is meant to act on. */
  --ink-2: #31445c;
  /* MEASURED, and the reason this is slides' #5b6472 rather than the #64748b
     dash had: --muted carries 11–11.5px captions, and at #64748b it was
     4.34:1 on --hover and 4.22:1 on --accent-wash — under AA on the two
     grounds a caption most often lands on. slides' grey is 5.19:1 and 5.30:1
     on those same two, 5.57:1 on --panel, and it is the same hue family. */
  --muted: #5b6472;
  --accent: #f7a600;
  /* Ink for a word that MEANS amber — a partial total, a "+ add" invitation —
     where the amber itself is 2.02:1 on white and cannot be the text. slides:
     --accent-ink. dash referenced this name in two rules and never declared
     it, so both silently fell back and neither mark ever appeared; the dark
     value is the amber ink --warn-ink already uses, so the app carries one
     amber-on-dark and not two. MEASURED: 6.92:1 on white, 9.22:1 on the dark
     header band. */
  --accent-ink: #7a5200;
  --slash: #ff9e8a;                            /* the wordmark's peach */
  /* Focus, and the selection ring, are ONE colour — see the focus note below.
     slides calls it --blue and uses it for the same job. */
  --blue: var(--sel-ring);
  /* slides' scrim and its two shadow tiers (popover, dialog), verbatim. */
  --scrim: rgb(15 23 36 / 0.38);
  /* ————— THE SHADOWS HAVE TO BE BUILT THIS WAY, and it is not a style choice —————
     `light-dark()` is a <color> function. A CUSTOM property holds any token
     stream, so `--shadow-pop: light-dark(0 12px 32px …, …)` is a perfectly
     legal declaration — and then `box-shadow: var(--shadow-pop)` substitutes a
     colour function into a position that wants lengths, the declaration is
     INVALID AT COMPUTED-VALUE TIME, and box-shadow falls back to its initial
     `none`. Silently. MEASURED before this change, on the built shell:
     `getComputedStyle(document.querySelector('.dx-about')).boxShadow` was
     "none" — every menu, every popover, the save menu, the find bar, the help
     card, the About dialog and the phone drawers had been drawing NO shadow at
     all, on both grounds, for as long as the tokens have existed.

     This is the same trap --bar-opacity fell into a few lines below, which is
     why the note there says any non-colour theme-varying token needs another
     shape. The shape is here: vary the COLOUR, which light-dark() can carry,
     and keep the lengths outside it. A media query would also work but would
     NOT follow the explicit light/dark override (that override flips
     `color-scheme`, and only light-dark() reads it) — so a reader who picks
     Light on a dark desktop would get light surfaces wearing dark-tuned
     shadows. `scripts/test-dash-theme.ts` now fails on any light-dark() whose
     light half is not a colour. */
  --shadow-pop-color: rgb(15 23 36 / 0.18);
  --shadow-dialog-color: rgb(15 23 36 / 0.3);
  --shadow-pop: 0 12px 32px var(--shadow-pop-color);
  --shadow-dialog: 0 18px 50px var(--shadow-dialog-color);

  /* ————— semantic ————— */
  --warn-bg: #fffbeb;     /* the findings strip */
  --warn-ink: #b45309;
  --warn-chip: #fef3c7;
  --err-ink: #b91c1c;
  --err-bg: #fef2f2;
  --up-ink: #1f8a5b;
  --down-ink: #c0503c;
  /* The toast inverts against the app on light and merely lifts on dark:
     a white slab on a dark sheet is a flashbulb, not a status line. */
  --toast-bg: #1e2a3a;
  --toast-ink: #ffffff;
  /* Accent-tinted surfaces — the active sheet, a filter chip. Distinct from
     --sel: this one means "this is the chosen one", not "this is selected
     data", and the two stopped being the same colour when selection went
     blue. */
  --accent-wash: #fdf0d6;
  /* The bar under the ACTIVE worksheet tab — a non-text indicator, so it has a
     3:1 floor to clear rather than a decorative one. MEASURED against the tab
     it sits on: the brand amber is 9.25:1 on the dark sheet and 2.02:1 on the
     white one, so the light ground takes the darker amber the warning ink
     already uses (#b45309 — 5.02:1 on white) and the dark ground keeps the
     brand colour. Same hue family either way, so the mark still reads as
     dash's; this is the one place the accent has to give ground, because it is
     the only thing on screen saying which sheet you are looking at. */
  /* NOT theme-varying, deliberately: the ink that goes over a cell the
     DOCUMENT has coloured. See the conditional-formatting section below. */
  --ink-on-fill: #1e2a3a;
  /* How much of the sheet a data bar lets through. MEASURED: at 0.55 the
     default amber bar over #0e1319 comes to rgb(142,100,11) and the sheet's
     own ink on top of it is 3.9:1 — under AA on the one figure a data bar
     exists to draw attention to. At 0.45 the same bar is 5.0:1 and still reads
     as the same bar. (A rule may name any colour it likes, so this makes the
     DEFAULT safe; it cannot promise anything about an arbitrary one.)

     WRITTEN THE LONG WAY, and it is the only token that is: `light-dark()` is
     a <color> function and nothing else. Fed a number it does not fail
     loudly — the declaration is simply invalid, `opacity` falls back to its
     initial 1, and the bar goes fully opaque. That is exactly what happened
     here, and the audit caught it at 1.49:1. Any future NON-COLOUR token that
     varies by theme needs this shape too. */
  --bar-opacity: 0.55;
  /* Chart text. charts-lite (kernel/src/charts.ts) bakes a literal #6B7280
     into every axis label, legend entry and pie label unless the OPTION says
     otherwise, and dash's chart.ts does not say otherwise — so on the dark
     ground the labels came out at 3.6:1 and the axis was unreadable. The light
     value here IS the kernel's default, so light-theme charts are untouched;
     see the rule near .dx-chart-body for why CSS can reach them at all. */
  --chart-ink: #6b7280;

  /* COUPLED TO grid.ts `ROW_H`, and there is no mechanism keeping them honest.
     The body is virtualised: JS positions every row at `top: i * ROW_H` as an
     inline style, so this variable only sizes the cell that lands there.
     Setting it to 26 to get Excel's density left the rows 30px apart with a
     4px transparent band between them — the gridlines stopped meeting and the
     grid looked perforated. Change one and you must change the other. */
  /* FALLBACK ONLY — grid.ts writes this from its ROW_H constant when it
     mounts, because the row boxes are positioned from that constant and the
     two must never disagree. Editing it here alone changes nothing. */
  --row-h: 20px;

  /* ————— the grid's own greys —————
     Split out from --line because they answer a different question. --line is
     chrome: the edge of a panel, where one surface stops. These are the GRID,
     and a spreadsheet's gridlines are the strongest signal that what you are
     looking at is a spreadsheet and not a table on a web page. At #e3e8ef
     dash's grid had vertical rules only, no horizontal ones at all, and read as
     a web table with zebra striping — which is what it was. Excel and Sheets
     both rule both axes and neither stripes.

     THE WEIGHT CAME DOWN. A full 1px lattice at #d8dee7 on both axes is the
     look of a spreadsheet from 2006: at that contrast the rules compete with
     the figures, and a screen of numbers reads as a screen of boxes. Measured
     against the paper, the rule drops from 1.35:1 to 1.14:1 — still a lattice
     at any zoom, no longer a cage. The header band
     came down with it: hierarchy in the header is carried by TYPE (11.5px
     semibold, tracked, darker ink) rather than by a grey fill, which is the
     one change that dates a spreadsheet fastest.

     On the dark ground the pair invert about the sheet: lines slightly ABOVE
     the page, the header band slightly above the lines. Ruling a dark sheet
     with a darker line would work, but every scrolled seam then disappears
     into the background the moment a shadow lands on it. */
  /* ————— THE DESK: the ground a DATASET sits on —————
     A dataset has exactly the rows it has, so its grid ends — and when the
     ground under it was the same colour as its paper, "the table ended here"
     and "the app stopped drawing" looked identical. At 1440x900 an eight-row
     workbook filled the top 180px and left two thirds of the window blank
     white, which is the single strongest unfinished signal the app had.

     So the sheet is an OBJECT and this is what it lies on. It is NOT --panel:
     the chrome bands (top bar, status bar) are furniture the object sits
     between, and a desk the same colour as them would make the object float in
     chrome rather than rest on a surface. ONE RULE decides both values — the
     desk is one step further from the paper than the chrome band is, in
     whichever direction "further" runs on that ground. MEASURED against --bg:
     1.13:1 on the light sheet and 1.18:1 on the dark one, with --panel at
     1.03:1 and 1.09:1 in between, so the three grounds are monotone on both.
     The dark half is LIGHTER than the sheet and the light half is DARKER, the
     same inversion --grid-line and --panel already make and for the same
     reason: at #0e1319 there is no room left below the paper (a darker desk
     came out at 1.04:1, invisible).

     The SPREADSHEET kind never shows it. Its extent is a frontier rather than
     a fact — it grows with the cursor and the window, and reports its size to
     ARIA as unknown — so there is no edge to draw and a desk would claim a
     bound the kind does not have. `.dg-canvas .dg-scroll` puts --bg back. That
     the two kinds look different here is the product's argument made visible,
     not an inconsistency.

     Text on it: --muted is 5.28:1 (light) and 5.97:1 (dark), --ink 12.81:1 and
     11.69:1 — the empty-state note is the only thing that ever lands here. */
  --desk: #eef1f6;

  --grid-line: #edf0f4;
  --grid-head: #fbfcfd; /* the header/gutter band */
  --grid-head-ink: #4a5568;
  --grid-head-on: #dbe7fb; /* a selected row/column header */

  /* ————— selection —————
     Cool, and deliberately NOT the brand amber. The amber tint used to sit on
     top of amber conditional-format data bars, so a selected cell and a cell
     the document had coloured were the same warm smear; the two things are
     unrelated and now cannot be confused. --sel-ring is the cursor cell's ring
     and the range outline; --sel is the range fill. */
  --sel: #eef4ff;
  --sel-ring: #2563eb;
  --point: #7c3aed;

  /* ————— one scale, five surfaces —————
     The pivot, the dashboard, the story editor, the save menu and the About
     dialog were each written separately and each picked its own radii, shadows
     and caption size. These are the agreed values; every one of those files
     now reads them rather than restating a number. */
  /* 10px, NOT 7px, and the 7px was a real choice, not drift: dash split the
     radius into a three-step scale (control / floating surface / dialog) and
     7px was the control step, recorded as a deliberate divergence in
     test-dash-theme.ts. It goes because `--radius` is about to be a SHARED
     token in kernel's stylesheet with one value across four apps, and a dash
     that redefined it would be the one app whose buttons differ from the
     other three. --radius-lg and --radius-xl are dash's own and keep the scale
     where dash still needs it; `--radius` and `--radius-lg` now coincide. */
  --radius: 10px;        /* controls: buttons, inputs, chips — the shared value */
  --radius-lg: 10px;     /* floating surfaces: menus, popovers, cards */
  --radius-xl: 14px;     /* dialogs */
  /* the two shadows are theme-varying and live in the palette block above */
  --fs-ui: 13px;         /* control and menu text */
  --fs-small: 11.5px;    /* captions, sub-labels, meta */
  --fs-micro: 11px;      /* section headers, badges */

  /* ————— the suite's type face —————
     slides' stack, verbatim (slides/src/styles.css html,body). It was already
     the same faces on every platform either stack can reach — system-ui and
     -apple-system both resolve to SF on macOS/iOS and to Segoe UI on Windows —
     but "the same faces by coincidence" is not the same claim as "the same
     stack", and only one of them survives somebody adding a font.
     NAMED, because pivot.css already asks for `var(--ui, …)` and nothing
     declared it: the pivot has been rendering off its own fallback rather
     than off the app's font since it was written. */
  --ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  /* ————— slides' names for things dash had already named —————
     Aliases, not second definitions: a rule lifted out of slides/src/styles.css
     resolves here unchanged, and there is still exactly one place each colour
     is decided. */
  --chrome: var(--panel);
  --chrome-2: var(--hover);
}

/* THE DARK PALETTE, keyed off `data-theme` — see the note above :root for why
   this is a block and no longer a light-dark() pair per token. Same names, same
   ORDER, same section markers as :root, so the two can be read side by side;
   a token that appears here and not in :root is a bug the rig catches. */
:root[data-theme="dark"] {

  /* ————— ground and chrome ————— */
  --bg: #0e1319;
  --panel: #161c24;
  --surface: #1b222c;
  --hover: #26303d;
  --wash: rgb(255 255 255 / 0.07);
  --line: #1f2731;
  --line-strong: #2f3a49;
  --ink: #d6dee9;
  --ink-2: #b9c5d4;
  --muted: #93a0b2;
  --accent-ink: #f0b357;
  --scrim: rgb(2 5 9 / 0.66);

  /* ————— THE SHADOWS HAVE TO BE BUILT THIS WAY, and it is not a style choice ————— */
  --shadow-pop-color: rgb(0 0 0 / 0.55);
  --shadow-dialog-color: rgb(0 0 0 / 0.7);

  /* ————— semantic ————— */
  --warn-bg: #221b0d;
  --warn-ink: #f0b357;
  --warn-chip: #3a2e10;
  --err-ink: #ff9b8f;
  --err-bg: #2b1618;
  --up-ink: #4fbf8b;
  --down-ink: #f08a78;
  --toast-bg: #2b3543;
  --toast-ink: #e8edf5;
  --accent-wash: #38290c;
  --chart-ink: #a7b3c4;

  /* ————— THE DESK: the ground a DATASET sits on ————— */
  --desk: #1b232d;
  --grid-line: #212a35;
  --grid-head: #151c25;
  --grid-head-ink: #a9b6c7;
  --grid-head-on: #1d3050;

  /* ————— selection ————— */
  --sel: #16243c;
  --sel-ring: #3b82f6;
  --point: #a78bfa;

  /* the one themed token that is not a colour; was a media query */
  --bar-opacity: 0.45;
}

/* NO OS MEDIA QUERY, deliberately. `data-theme` is always EXPLICIT on <html>:
   kernel/src/theme.ts resolves 'auto' against prefers-color-scheme itself,
   sets the attribute, and re-sets it when the OS flips. A media block here
   would be a second opinion about the same fact, and the two would disagree
   the first time a reader chose the opposite of their OS. --bar-opacity, the
   one themed token that is not a colour, therefore lives in the dark block
   above with everything else. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 var(--ui);
  -webkit-text-size-adjust: 100%;
}

#app { display: flex; flex-direction: column; height: 100%; }

/* ————— 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 here by
   scripts/test-dash-fields-browser.mjs (slides' rig, ported). */
: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; }

/* ————— top bar ————— */
.dx-bar {
  display: flex;
  align-items: center;
  /* 10px / 8px 14px / 1px --line: slides' topbar metrics (its .ed-topbar), so
     the two apps' bars are the same object at the same height. dash's bar had
     been 1px shorter with 2px less gap and a --line-strong rule under it —
     three small differences that read, side by side, as two products. The bar
     keeps its --panel tint rather than slides' white: dash's DOCUMENT is the
     white sheet directly below, and a white bar over a white sheet leaves the
     seam doing work a 1px line cannot. */
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  flex: 0 0 auto;
  min-width: 0;
  /* THE NOTCH, AND THE HOST THAT LIES ABOUT IT. viewport-fit=cover puts the
     page under the rounded corners, the Dynamic Island and the home indicator,
     so fixed chrome insets itself. dash asked for the TOP only, in `env()`
     only — which meant two failures slides had already fixed:
       · a landscape phone put the end buttons under the corner curve, because
         nothing inset the left or right edge; and
       · inside bento/tray's WKWebView `env(safe-area-inset-*)` reads 0px even
         when the device genuinely has insets (measured in tray: native
         62/0/34/0, CSS 0px), so the tray publishes the real numbers as
         `--tray-safe-*` (tray/ios/EditorViewController.swift) — and dash, not
         reading them, drew its toolbar under the island.
     max() keeps the normal padding on every device reporting 0, and in a
     browser the variables are undefined, resolve to 0px, and env() does the
     work as normal. The BACKGROUND still bleeds to the edge; only the content
     is inset. */
  padding: max(8px, env(safe-area-inset-top), var(--tray-safe-top, 0px)) max(14px, env(safe-area-inset-right), var(--tray-safe-right, 0px))
           8px max(14px, env(safe-area-inset-left), var(--tray-safe-left, 0px));
}
.dx-mark {
  /* a real <button> now (it opens About): shed the UA button look */
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 8px;
  padding: 2px 4px;
  cursor: pointer;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex: 0 0 auto;
  /* the mark and the wordmark are ONE control — both open About, and a gap
     between them that is not clickable is a target with a hole in it */
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
/* The glyph does NOT take the theme. It is a logo: four fixed fills, the same
   in light and dark, the same as slides'. A mark that changes colour with the
   interface is not a mark. */
.dx-mark-svg { flex: 0 0 auto; display: block; }
.dx-mark-t { white-space: nowrap; }
.dx-slash { color: var(--slash); }
.dx-title {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  /* slides' .ed-title: 6px, 5px 8px, a --line hover edge and a --blue focus
     edge. Same field, same app. */
  border-radius: 6px;
  padding: 5px 8px;
  line-height: normal;   /* same reason as .dx-btn: match slides' 28.5px field */
  /* `flex: 0 1` and never `1 1`: the title is elastic, but it is not entitled
     to the slack — the buttons to its right are, and a growing title is what
     pushes them off the end. */
  flex: 0 1 240px;
  min-width: 60px;
  background: transparent;
  color: inherit;
}
.dx-title:hover { border-color: var(--line); }
.dx-title:focus { outline: none; border-color: var(--blue); background: var(--surface); }
/* From the keyboard the ghost title gets the ring every other control has;
   a 1px border change is too quiet to find by Tab. */
.dx-title:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 1px; }

.dx-group { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
/* everything after the insert group is pushed to the far end */
.dx-bar-end { margin-inline-start: auto; }

/* slides' .ed-btn, adopted whole: 13px, 6px 9px, an 8px radius, --ink-2 for the
   label, and a hover that FILLS rather than a border that darkens. dash's
   button was 5px 10px on a 7px radius with a standing --line-strong box and a
   0.5px press-shift — geometry nobody had a reason for, and a press animation
   slides does not have and `prefers-reduced-motion` cannot switch off (that
   media query kills transitions; a transform is not one).

   The BOX comes back wherever a button stands on its own — see .dx-btn-boxed
   below. In a toolbar, where a dozen of them sit in a row against a tinted
   band, the boxes were the loudest thing on the screen. */
.dx-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: var(--fs-ui);
  /* `normal`, not the body's 1.45. slides' .ed-btn inherits a body with no
     line-height at all, so its buttons are 30px and its bar 47px; dash's body
     sets 1.45, which put 2.8px of leading inside every button and made the bar
     49.8px — a toolbar two pixels taller than the other app's for no reason
     anyone chose. MEASURED after: button 29.8px, bar 47px, both slides'. */
  line-height: normal;
  color: var(--ink-2);
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}
.dx-btn:hover { background: var(--hover); }
.dx-btn:active { background: var(--line); }
/* 0.35, which is slides' figure for a dead control (.ed-arrange-btn:disabled,
   .sv-btn[disabled]). dash had 0.45 here, 0.45 in the save menu and 0.6 in the
   tab menu — three answers to one question. */
.dx-btn[disabled] { opacity: 0.35; cursor: default; }
/* FOCUS IS --accent-ink, NOT THE BRAND AMBER. The bright amber is 2.02:1 on
   white and 1.88:1 on the top bar's band — WCAG 2.2 SC 1.4.11 asks 3:1 of a
   focus indicator. dash answered that with --blue for a while; slides then
   moved its buttons to the DARK amber, --accent-ink (#7a5200 light, #f0b357
   dark, both well over 3:1), which the fields here already ring with — so
   dash follows (docs/DECISIONS.md 2026-10-20), and one ring reads the same in
   every app. */
.dx-btn:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 1px; }
/* A FLOOR under everything else a keyboard can reach: any button, link or
   tab stop with no ring of its own gets this one, at zero specificity so a
   control's own rule always wins. Without it, Tab reached controls (panel
   buttons, menu rows) that showed no sign of having focus at all. */
:where(button, a[href], [role="button"], [role="tab"], [role="option"], [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 1px;
}

/* A button that is NOT in a row of its own kind — a dialog's actions, the
   gate's way out, the chart head — keeps a rest-state box, because there is
   nothing around it to say it is a control. Exactly slides' arrangement:
   ghost in the chrome, `.ed-about .ed-btn:not(.ed-btn-primary)` outlined in
   the dialog. */
.dx-about-actions .dx-btn,
.dx-about .dx-btn,
.dx-help .dx-btn,
.dx-ask-foot .dx-btn,
.dx-gate .dx-btn,
.dx-btn-boxed {
  /* --line-strong, where slides writes --line. slides' dialog is white and a
     #e3e8ef edge on it is a box; dash's dialog is --surface on BOTH grounds,
     and on the dark one --line (#1f2731) against --surface (#1b222c) is not an
     edge at all — MEASURED in the dark About: the "Check for updates" button
     read as a line of loose text. --line-strong is the weight dash already
     boxes .dp-btn with, and it is what .dx-btn itself used before it became a
     ghost, so nothing here is heavier than it was. */
  border-color: var(--line-strong);
  background: var(--surface);
}
.dx-about-actions .dx-btn:hover,
.dx-about .dx-btn:hover,
.dx-help .dx-btn:hover,
.dx-ask-foot .dx-btn:hover,
.dx-gate .dx-btn:hover,
.dx-btn-boxed:hover { background: var(--hover); }
.dx-i { flex: 0 0 auto; }
/* the caret on a dropdown trigger is a hint, not a peer of the icon */
.dx-dd-trig > .dx-i:last-child { opacity: 0.5; margin-inline-start: -2px; }

/* Unsaved-changes dot: it badges SAVE rather than floating in the bar, where
   an amber bullet next to the title explained nothing. Absolutely positioned,
   so it costs the button no width — which matters, because Save is the control
   that has to survive every width. */
.dx-btn-save { position: relative; }
/* Scoped through .dx-bar .dx-btn-save, not written bare, because the dot IS a
   <span> inside a bar button and the narrow-window rule below hides exactly
   that. A bare `.dx-dirty { display: block }` lost the specificity duel and the
   dot measured 0×0 at every width under 1280 — i.e. the unsaved-changes signal
   silently vanished on the widths that need it most. */
.dx-bar .dx-btn-save > .dx-dirty {
  display: block;
  position: absolute;
  top: 3px;
  inset-inline-end: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
}
.dx-bar .dx-btn-save > .dx-dirty[hidden] { display: none; }

/* The write-back tag: "Saved", for ~1.8s, under the Save button.
   Same specificity ladder as the dot above, and for the same reason — the
   narrow-window rule hides bare spans inside bar buttons, and this one has to
   survive every width because it is the ONLY confirmation that the automatic
   save landed. Absolutely positioned and pointer-transparent so it can never
   shift the bar or eat the click on Save it is sitting under. */
.dx-bar .dx-btn-save > .dx-wb {
  display: block;
  position: absolute;
  top: calc(100% + 4px);
  inset-inline-end: 0;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
}
.dx-bar .dx-btn-save > .dx-wb[hidden] { display: none; }

/* ————— top-bar dropdowns —————
   One panel style, shared with .dx-pop and the save menu. */
.dx-dd { position: relative; flex: 0 0 auto; }
.dx-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-start: 0;
  z-index: 60;
  min-width: 200px;
  flex-direction: column;
  gap: 1px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
}
.dx-dd.open > .dx-menu { display: flex; }
.dx-menu .dx-btn {
  width: 100%;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  padding: 6px 9px;
}
.dx-menu .dx-btn:hover { background: var(--hover); }
.dx-menu .dx-i { color: var(--muted); }
/* Labels ALWAYS show inside an OPEN menu panel. The narrow-window rule below
   strips them from bar buttons, and the first pass stripped them here too —
   which left an icon-only mystery menu. slides hit this and wrote the same
   exception; what slides did NOT have is dash's insert group, whose buttons
   live inside a .dx-menu that is a plain inline row until 900px. Written with
   `!important` the exception forced labels back on in that row too, so the bar
   never actually shrank (measured: the group stayed 516px wide at 1100px).
   Keying on `.open` says the real thing — a FLOATING PANEL is what needs
   words — and wins on specificity without reaching for !important. */
.dx-bar .dx-dd.open > .dx-menu .dx-btn > span { display: inline; }
.dx-menu-sep { height: 1px; background: var(--line); margin: 4px 6px; }
/* the data menu hangs off a button near the right edge, so it grows inward */
.dx-data-dd > .dx-menu { inset-inline-start: auto; inset-inline-end: 0; }

/* ————— the responsive top bar: labels give way, never the page —————
   The tiers are CLASSES that topbar.ts sets by MEASURING the bar, exactly as
   slides' fitTopbar does — not width breakpoints. The old ladder here had
   seven of them (1600 … 380), each measured once against the bar as it was
   that day, and every control added since quietly invalidated the numbers:
   measured at 390px the bar was 509px wide and the DOCUMENT scrolled sideways.
     dx-bar-compact  labels hide (icons + tooltips take over)
     dx-bar-tight    the wordmark goes; the glyph stays as the About button
     dx-bar-fold     insert tools under +, the occasional controls under ⋯ */
.dx-group { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.dx-insert { margin-inline-start: 6px; }
/* everything after the insert group is pushed to the far end */
.dx-bar-end { margin-inline-start: auto; }
.dx-title { flex: 0 1 240px; min-width: 48px; }
.dx-phone-only { display: none; }
.dx-phone-tools { display: contents; }

.dx-bar.dx-bar-compact .dx-btn > span { display: none; }
/* …except the two words that ARE the state: Save, and Share/Live. A bare dot
   and a bare floppy are guesses; these keep their word at every width. */
.dx-bar.dx-bar-compact .dx-btn > .dx-save-lab,
.dx-bar.dx-bar-compact .dx-btn > .dx-share-lab,
.dx-bar.dx-bar-compact .dx-btn > .dx-share-n,
.dx-bar.dx-bar-compact .dx-btn > .dxs-caret-g { display: inline; }
/* the badges on Save are spans too, and have their own rules below */
.dx-bar.dx-bar-compact .dx-btn-save > .dx-dirty:not([hidden]),
.dx-bar.dx-bar-compact .dx-btn-save > .dx-wb:not([hidden]) { display: block; }
/* never inside an open menu: those rows are text */
.dx-bar.dx-bar-compact .dx-menu .dx-btn > span { display: inline; }
.dx-bar.dx-bar-compact .dx-menu .dx-btn > span.dx-sr-only { display: block; }
.dx-bar.dx-bar-compact {
  gap: 6px;
  padding: max(8px, env(safe-area-inset-top), var(--tray-safe-top, 0px)) max(8px, env(safe-area-inset-right), var(--tray-safe-right, 0px))
           8px max(8px, env(safe-area-inset-left), var(--tray-safe-left, 0px));
}
.dx-bar.dx-bar-tight {
  gap: 4px;
  padding: max(8px, env(safe-area-inset-top), var(--tray-safe-top, 0px)) max(6px, env(safe-area-inset-right), var(--tray-safe-right, 0px))
           8px max(6px, env(safe-area-inset-left), var(--tray-safe-left, 0px));
}
.dx-bar.dx-bar-tight .dx-mark-t { display: none; }
.dx-bar.dx-bar-tight .dx-insert { margin-inline-start: 0; }

/* fold: the phone-only controls exist in the DOM at every width; only the
   fold shows them, so topbar.ts never creates or destroys anything */
.dx-bar.dx-bar-fold .dx-phone-only { display: inline-flex; }
.dx-bar.dx-bar-fold .dx-dd.dx-phone-only { display: block; }
.dx-bar.dx-bar-fold .dx-insert:empty { display: none; }
/* Save stays one tap; its caret does not fit beside a phone's few buttons, and
   the list it opens is appended to ⋯ instead (topbar.ts). */
.dx-bar.dx-bar-fold .dxs-caret { display: none; }
.dx-bar.dx-bar-fold .dxs-wrap > .dx-btn:first-child { border-radius: 8px; border-inline-end: 1px solid var(--ink); }
/* ⋯ and + can outgrow the screen in BOTH directions: anchor to the end, bound
   the height, scroll inside. */
.dx-bar.dx-bar-fold .dx-menu {
  inset-inline-start: auto;
  inset-inline-end: 0;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 96px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.dx-bar.dx-bar-fold .dx-insert-dd > .dx-menu { inset-inline-start: 0; inset-inline-end: auto; }
/* A demoted widget's own popover opens INLINE, inside the ⋯ list (CLAUDE.md
   hard-won 10): `overflow-y: auto` makes ⋯ a clipping box in BOTH axes, so a
   floating Share popover or language menu inside it would be cut off. Inside
   ⋯ they stop floating and render as a section of the list. */
.dx-bar.dx-bar-fold .dx-menu .dx-menu {
  position: static;
  min-width: 0;
  max-width: none;
  max-height: none;
  overflow: visible;
  box-shadow: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  border-block: 1px solid var(--line);
  margin-block: 3px;
  padding-inline: 6px;
}
.dx-bar.dx-bar-fold .dx-menu .dx-dd { width: 100%; }
.dx-bar.dx-bar-fold .dx-menu .dx-dd-trig,
.dx-bar.dx-bar-fold .dx-menu .dx-share { width: 100%; justify-content: flex-start; }
.dx-more-trig b { font-size: 16px; line-height: 1; padding-inline: 2px; }
.dx-more-fixed { display: flex; flex-direction: column; gap: 1px; border-top: 1px solid var(--line); margin-top: 3px; padding-top: 3px; }

/* phones proper: about TOUCH and a small screen, so it stays a media query */
@media (max-width: 700px) {
  .dx-bar,
  .dx-bar.dx-bar-tight {
    padding: max(6px, env(safe-area-inset-top), var(--tray-safe-top, 0px)) max(6px, env(safe-area-inset-right), var(--tray-safe-right, 0px))
             6px max(6px, env(safe-area-inset-left), var(--tray-safe-left, 0px));
  }
  /* HIG touch targets */
  .dx-bar .dx-btn, .dx-bar .dx-mark { min-width: 44px; min-height: 44px; justify-content: center; }
  .dx-bar .dx-btn-save { min-width: 0; }
  .dx-bar .dx-menu .dx-btn { min-width: 0; min-height: 36px; justify-content: flex-start; }
  .dx-title { flex: 0 1 160px; min-width: 0; }
  .dx-phone-tools { display: flex; align-items: center; gap: 2px; flex: 1 1 auto; min-inline-size: max-content; }
  .dx-bar .dx-bar-end { margin-inline-start: 0; flex: 0 0 auto; }

  /* BELOW THE FOLD'S FLOOR THE BAR SCROLLS — never the document. Fully folded
     the bar still needs its 44px targets, the mark and the title, and a 320px
     phone has less; `overflow: hidden` on the app would just CUT the end off
     (slides measured ⋯ unreachable at x=356 on a 320px screen). A partly
     visible button is its own affordance. */
  .dx-bar {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .dx-bar::-webkit-scrollbar { display: none; }
  /* …and since a scroll container clips BOTH axes, the menus hanging off +
     and ⋯ come out of it as `fixed`, under the bar (--dx-bar-bottom is
     published by topbar.ts — it moves with the safe-area insets). */
  .dx-bar .dx-dd.open > .dx-menu,
  .dx-bar .dxs-wrap.dxs-open > .dxs-menu {
    position: fixed;
    top: calc(var(--dx-bar-bottom, 56px) + 4px);
    inset-inline-end: max(6px, env(safe-area-inset-right), var(--tray-safe-right, 0px));
    inset-inline-start: auto;
  }
  .dx-bar .dx-insert-dd.open > .dx-menu {
    inset-inline-start: max(6px, env(safe-area-inset-left), var(--tray-safe-left, 0px));
    inset-inline-end: auto;
  }
  /* (nested menus inside ⋯ stay static — the rule above is for the outer) */
  .dx-bar .dx-menu .dx-dd.open > .dx-menu { position: static; }

  /* THE PROPERTIES PANEL GETS AN OBVIOUS CLOSE on a phone — it covers two
     thirds of the screen, and the only way out was a 16px chevron on its edge. */
  #app .dp-panel:not(.dp-shut) > .dx-panel-close { display: inline-flex; }
}

/* ————— Share ————— */
.dx-share { position: relative; }
.dx-share-n:empty { display: none; }
.dx-share-n {
  font-size: 11px; font-weight: 700; min-width: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--hover); color: var(--ink); text-align: center; line-height: 16px;
}
/* THE STATE IS A WORD AND A DOT TOGETHER: grey dormant, amber connecting,
   green live (slides' .ed-btn-share). Never the dot alone. */
.dx-share::after {
  content: ''; position: absolute; top: 3px; inset-inline-end: 3px;
  width: 7px; height: 7px; border-radius: 50%; background: #9aa4b2;
}
.dx-share.dx-share-wait::after { background: #d9a13b; animation: dx-live-pulse 1.1s ease-in-out infinite; }
.dx-share.dx-share-live::after { background: #34a866; animation: none; }
.dx-share.dx-share-live .dx-share-lab { color: var(--up-ink); font-weight: 600; }
@keyframes dx-live-pulse { 0%, 100% { opacity: 1 } 50% { opacity: 0.3 } }
@media (prefers-reduced-motion: reduce) { .dx-share.dx-share-wait::after { animation: none; } }
.dx-menu.dx-share-pop {
  min-width: 260px; max-width: min(300px, calc(100vw - 16px));
  padding: 12px; gap: 6px;
  inset-inline-start: auto; inset-inline-end: 0;
}
.dx-share-name { display: flex; align-items: center; gap: 8px; font-size: var(--fs-ui); color: var(--ink-2); }
.dx-share-name > span { flex: none; }
.dx-share-in {
  flex: 1 1 auto; min-width: 0; font: inherit; font-size: var(--fs-ui);
  padding: 4px 7px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--field); color: var(--ink);
}
.dx-share-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted); margin-top: 3px;
}
.dx-pitem {
  display: flex; align-items: center; gap: 8px; width: 100%; font: inherit; font-size: var(--fs-ui);
  padding: 4px 6px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); text-align: start;
}
button.dx-pitem { cursor: pointer; }
button.dx-pitem:hover { background: var(--hover); }
.dx-pme { background: var(--hover); font-weight: 600; }
.dx-pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-pwhere { margin-inline-start: auto; font-size: 11px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.dx-pdot {
  flex: none; width: 18px; height: 18px; border-radius: 50%; color: #fff;
  font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.dx-pkick { margin-inline-start: 4px; padding: 0 4px; border-radius: 4px; color: var(--muted); cursor: pointer; }
.dx-pkick:hover { color: var(--err-ink); background: var(--err-bg); }
.dx-plist { display: flex; flex-direction: column; gap: 1px; }
.dx-pnote { font-size: 12px; line-height: 1.45; color: var(--muted); }
.dx-pstatus { font-size: 12.5px; font-weight: 600; color: var(--warn-ink); }
.dx-pstatus.ok { color: var(--up-ink); }
.dx-menu .dx-paction { font-size: 12.5px; }
/* adjacent action rows touch, as in every other menu — the panel's gap spaces
   its SECTIONS (slides' .ed-share-pop does the same) */
.dx-share-pop > .dx-paction + .dx-paction { margin-block-start: -5px; }
/* inside a menu the state dot sits after the word, not at the row's far edge */
.dx-menu .dx-share::after { position: static; flex: none; margin-inline-start: 2px; }
.dx-menu .dx-paction-danger { color: var(--err-ink); }
.dx-menu .dx-paction-danger .dx-i { color: inherit; }

/* one-line menu rows: the description is the tooltip and the accessible
   description, never a second line (maintainer ruling D2) */
.dx-mi { display: inline; }
.dx-sr-only {
  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;
}

/* ————— 🌐 ————— */
.dx-menu.dx-lang-menu { inset-inline-start: auto; inset-inline-end: 0; min-width: 160px; }
.dx-lang-on { font-weight: 700; }
.dx-lang-on::after { content: ' ✓'; color: var(--accent-ink); }

/* ————— the phone panel's close ————— */
.dx-panel-close {
  display: none; position: sticky; top: 0; float: inline-end; z-index: 2;
  margin: 2px 0 0; align-items: center; justify-content: center;
  min-width: 36px; min-height: 36px; font-size: 16px;
}

/* ————— findings: what import refused to decide ————— */
.dx-findings {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
  background: var(--warn-bg);
  padding: 8px 12px;
  font-size: 13px;
  display: grid;
  gap: 4px;
}
/* `display: grid` beats the [hidden] attribute's own display:none, so an
   empty banner kept a visible strip of its background. Say it explicitly. */
.dx-findings[hidden] { display: none; }
.dx-findings b { font-weight: 650; }
.dx-findings .dx-f { display: flex; gap: 8px; align-items: baseline; }
.dx-findings .dx-dot { color: var(--accent); }

/* ————— body: grid, and the chart beside it ————— */
.dx-body { flex: 1 1 auto; min-height: 0; display: flex; }
.dx-grid { flex: 1 1 auto; min-width: 0; min-height: 0; position: relative; }

.dx-chart {
  flex: 0 0 clamp(280px, 34%, 520px);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-width: 0;
}
.dx-chart[hidden] { display: none; }
.dx-chart-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.dx-chart-title {
  flex: 1 1 auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dx-chart-head .dx-btn { padding: 3px 8px; font-size: 12px; }
/* A COLUMN, not a block. This panel hosts three different things — a chart, a
   3D scene and a whole pivot table — and only the chart is happy sizing itself
   from a 100% height. `.dxp` is a flex column that caps its own scroller at the
   panel height; in a block parent it had no height to cap against and the pivot
   ran off the bottom of the panel instead of scrolling inside it. */
.dx-chart-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 6px;
  display: flex;
  flex-direction: column;
}
.dx-chart-body > * { flex: 1 1 auto; min-height: 0; }
.dx-chart-body svg { display: block; width: 100%; height: 100%; }
/* CHART TEXT IS REACHABLE FROM CSS, and this is the only reason the dark theme
   did not need a change inside the chart engine: charts-lite writes its label
   colour as the `fill` PRESENTATION ATTRIBUTE, and any author rule beats a
   presentation attribute. Every piece of text in a charts-lite plot takes the
   same colour (axis labels, legend, pie labels all default to one grey), so a
   blanket rule cannot recolour something that was meant to differ. Marks are
   `rect`/`path`/`circle` and are never touched — the series palette is
   DOCUMENT data and must not move with the viewer's theme.
   The proper fix lives in dash/src/chart.ts, which owns the option and should
   set axisLabel/legend.textStyle colours; this rule is the half that fits in a
   stylesheet. */
/* charts-lite writes `fill` as a presentation ATTRIBUTE, which loses to a
   stylesheet — that is what lets the theme reach chart text at all, and it is
   the right layer, because the theme is a VIEWER preference and the chart
   option is derived from the DOCUMENT. Baking a theme colour into the option
   would put one reader's preference into everyone's chart.

   Matched on the kernel's default (#6B7280) rather than on every `text`, so a
   colour somebody CHOSE — `legend.textStyle.color`, an axis label, a future
   per-series colour — still wins. A blanket rule would flatten all three, and
   would do it silently. */
.dx-chart-body svg text[fill="#6B7280"] { fill: var(--chart-ink); }

/* stack on a phone rather than squeezing both */
@media (max-width: 760px) {
  .dx-body { flex-direction: column; }
  .dx-chart { flex: 0 0 45%; border-left: 0; border-top: 1px solid var(--line); }
}
/* ————— THE SHEET IS AN OBJECT ON A SURFACE —————
   The scroller is the DESK; `.dg-table` is the thing lying on it. Everything
   below is one idea: a dataset's extent is a FACT about the file, so it can be
   drawn, and drawing it is what stops a short sheet from reading as a render
   that gave up. Excel says the same thing with a ListObject's borders; Notion
   and Airtable — both table-model, like the dataset kind — say it with a
   bounded table on a plain ground.

   WHAT WAS REJECTED, because each is the old lie in new paint:
     • banding, or a lattice that fades out below the data. Any ruled or ruled-
       ish treatment past the last row draws rows that are not there, which is
       exactly what `frontierRow` and Grid.paintEmptyGrid were written to stop.
       The desk must be PLAIN — flat colour, no gradient, no repeat.
     • a card with a radius and a drop shadow. The corners would need
       `overflow: hidden` on `.dg-table`, and that turns it into the nearest
       scrollport, which is what `position: sticky` on the header and the
       totals row resolves against — a rounded sheet is a sheet whose header
       does not stick.
     • filler rows past the data, which is the thing this whole area exists to
       refuse. See the `frontierRow` note in grid.ts.

   WHERE THE EDGES ARE, and why only two of them are drawn. A grid's origin is
   its top-left corner, and the gutter and the heading strip are pinned there
   the way they are in every spreadsheet ever shipped; there is no desk to the
   left of column A or above row 1. The RIGHT and the BOTTOM are where a
   dataset's extent is a claim, and those are the two edges it now draws. */
.dg-scroll { position: absolute; inset: 0; overflow: auto; background: var(--desk); }
/* 12.5px, not the 14px the rest of the UI runs at. A grid is read a hundred
   cells at a time and a spreadsheet's type is always a step smaller than its
   chrome's — Excel's default is 11pt against a 12pt UI, Sheets' 10pt against
   13px. At 14px in a 30px row the type filled the row and the grid read as
   prose; at 12.5 in a 20px row the figures have air on both sides, which is
   what makes a dense grid legible rather than merely small. */
.dg-table {
  position: relative;
  /* SHRINK-WRAPPED, and this line is most of the fix. As a plain block the
     table stretched to the window and its background bled to both edges, so
     the columns stopped in the middle of a white field with no edge anywhere.
     At max-content it ends where its last column ends and the desk begins. */
  width: max-content;
  min-width: max-content;
  font-size: 12.5px;
  /* the paper, stated: the scroller behind it is no longer the same colour */
  background: var(--bg);
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  /* Room under the object when it is TALLER than the window, so a full sheet
     still ends on desk rather than against the status bar. */
  margin-bottom: 28px;
}
/* THE SPREADSHEET KIND KEEPS ITS FULL BLEED, deliberately. See the --desk note
   in the palette: an unbounded sheet has no extent to draw, and a border round
   a frontier would be a bound the kind does not have. Ruling to the window edge
   is honest here and is what Excel and Sheets do. */
.dg-canvas .dg-scroll { background: var(--bg); }
.dg-canvas .dg-table {
  width: auto;
  border-right: 0;
  border-bottom: 0;
  margin-bottom: 0;
}

/* ————— the empty states —————
   Three screens that cannot explain themselves by showing their contents: a
   dataset with no rows, a dataset with no columns, and a new spreadsheet. Each
   says which kind it is and what the next gesture is (grid.ts `noteFor`).

   Two placements, because the two kinds have different room. The dataset's
   note is in FLOW under `.dg-table`, so it lands on the desk just below the
   object — the desk says the table ended, the note says why there is so little
   of it. The spreadsheet's FLOATS over the lattice near A1, because that kind
   has no desk and its content box is a thousand rows tall; `pointer-events:
   none` keeps it out of the way of the cells it is sitting on, which stay
   clickable underneath it. */
.dg-note {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 52ch;
  padding: 20px;
  color: var(--muted);
  font-size: var(--fs-small);
  line-height: 1.5;
}
/* `display: flex` above out-ranks the user-agent `[hidden] { display: none }`,
   so the attribute needs saying again here or a hidden note is a visible one. */
.dg-note[hidden] { display: none; }
.dg-note b { color: var(--ink); font-size: var(--fs-ui); font-weight: 600; }
.dg-note-float {
  position: absolute;
  top: calc(var(--row-h) * 3);
  left: 64px;
  padding: 0;
  pointer-events: none;
}
/* the sizer is the ONLY absolutely-positioned region: header and totals stay in
   flow so `position: sticky` resolves against the scroller */
.dg-sizer { position: relative; }

.dg-row { display: flex; position: absolute; height: var(--row-h); left: 0; }
.dg-head-row,
.dg-foot-row {
  display: flex;
  position: sticky;
  z-index: 3;
  height: var(--row-h);
  background: var(--grid-head);
}
/* 2px, and --line-strong: the seam under the header is the one edge in the
   grid that has to survive being scrolled under. A 1px --line rule there read
   as one more gridline. */
.dg-head-row { top: 0; border-bottom: 2px solid var(--line-strong); }
.dg-foot-row { bottom: 0; border-top: 2px solid var(--line-strong); font-weight: 600; }

/* A TOTAL OVER A FILTERED SHEET SAYS SO. The number is now correct — it covers
   the rows on screen — but "correct" is not the same as "unambiguous": £69,050
   under a filtered table and £69,050 under a whole one are the same glyphs
   answering different questions. The tint is the cheapest way to make the
   footer and the status bar's "4 of 8 rows" visibly parts of one statement. */
/* NOT .dg-filtered — that already means "this column carries a filter" on a
   header. This means "this total covers part of the sheet", a different fact
   about a different row. */
.dg-foot-row .dg-cell.dg-part { color: var(--accent-ink, inherit); }
.dg-foot-row .dg-gutter { color: var(--muted); font-weight: 400; cursor: default; }

/* THE FOOTER CELL IS A CONTROL, and it has to look like one before it is
   clicked — a total nobody knows they can click is the state this replaces.
   The hover is the same `--hover` every other menu row in the app uses.

   `.dg-tot-add` is the invitation under a numeric column with no total yet, and
   it is REVEALED BY THE ROW rather than standing permanently. It used to sit at
   0.55 opacity on every numeric column at once, and the claim in this comment
   was that eight of them "do not read as data". Three of them read as TOTAL
   TOTAL TOTAL — a chant across the bottom of the sheet, louder than the one
   real total beside it, and competing with the numbers it is meant to help
   somebody add.

   Hovering ANY footer cell brings up every invitation in the row, so the whole
   affordance is still discovered in one gesture rather than one column at a
   time, and `:focus-within` does the same for a keyboard. At rest the footer
   shows totals and nothing else. Opacity, never `display`, so nothing moves
   when they appear. */
.dg-foot-row .dg-cell.dg-tot { cursor: pointer; }
.dg-foot-row .dg-cell.dg-tot:hover { background: var(--hover); }
.dg-agg-add {
  color: var(--muted);
  font-weight: 400;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.dg-foot-row:hover .dg-agg-add,
.dg-foot-row:focus-within .dg-agg-add { opacity: 0.55; }
.dg-foot-row .dg-cell.dg-tot-add:hover .dg-agg-add,
.dg-foot-row .dg-cell.dg-tot-add:focus-visible .dg-agg-add {
  opacity: 1;
  color: var(--accent-ink);
}
/* the app kills chrome motion globally; this fade is chrome */
@media (prefers-reduced-motion: reduce) { .dg-agg-add { transition: none; } }

/* BOTH AXES. The grid drew vertical rules only and separated rows with a zebra
   stripe — the arrangement of a web table, not of a spreadsheet, and the single
   biggest reason dash did not read as one. Excel and Sheets both rule every
   cell on all four sides and neither stripes; with real horizontal lines the
   stripe is redundant AND busy, so it is gone.
   box-sizing is border-box globally, so the 1px bottom border eats into the
   row height — hence the line-height below, or the text sits a pixel low. */
.dg-cell {
  flex: 0 0 auto;
  padding: 0 8px;
  height: var(--row-h);
  line-height: calc(var(--row-h) - 1px);
  border-right: 1px solid var(--grid-line);
  border-bottom: 1px solid var(--grid-line);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.dg-cell.dg-editing {
  background: var(--bg);
  box-shadow: inset 0 0 0 2px var(--accent);
  overflow: visible;
  cursor: text;
}
.dg-cell.dg-noted { box-shadow: inset 2px 0 0 var(--accent); }

.dg-h { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.dg-name { cursor: pointer; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; }
.dg-name:hover { color: var(--accent); }
/* the column name, renamed in place (double-click). Sized to the slot the name
   occupies so the header does not jump; the field look comes from the shared
   input rule. */
.dg-rename {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  font: inherit;
  font-weight: 600;
}
.dg-type {
  font: 500 10px/1.6 inherit;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 5px;
  cursor: pointer;
  flex: 0 0 auto;
}
.dg-type:hover { border-color: var(--accent); color: var(--ink); }
.dg-warn {
  color: var(--warn-ink);
  background: var(--warn-chip);
  border-radius: 50%;
  width: 15px;
  height: 15px;
  text-align: center;
  font: 700 11px/15px inherit;
  flex: 0 0 auto;
  cursor: help;
}
.dg-err { color: var(--err-ink); background: var(--err-bg); font-weight: 600; }
.dg-fx {
  font: 600 9px/1.6 inherit;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0 3px;
  flex: 0 0 auto;
}
.dg-agg { color: var(--muted); font-weight: 400; font-size: 11px; text-transform: uppercase; }

/* ————— gate: an unreadable document, and the way back out of it ————— */
.dx-gate {
  max-width: 34rem;
  margin: 12vh auto;
  padding: 0 1.5rem;
}
.dx-gate h1 { font-size: 20px; margin: 0 0 8px; }
.dx-gate p { color: var(--muted); margin: 0 0 14px; }
.dx-gate .dx-btn { margin-right: 8px; }
/* The two lines under the raw block. The WARNING is the one that has to carry:
   it appears only when the block could not be parsed, so its keys are still in
   the text on screen and on the clipboard. `--accent-ink` is the token the
   theme rig guards; a bare colour here is how the filtered-footer tint shipped
   drawing nothing for a week. */
.dx-gate-warn {
  color: var(--accent-ink);
  background: var(--accent-wash);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 8px 10px;
}
.dx-gate-note { color: var(--muted); font-size: 13px; }
.dx-gate code {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin: 12px 0;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 30vh;
  overflow: auto;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ————— formula bar —————
   Excel and Sheets both build this out of three parts with visible seams: the
   name box, a rule, then the entry field running the full width. dash had the
   three parts floating in whitespace, which reads as a search bar. The rule and
   the fixed 30px height are what make it furniture. */
.dx-formula {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 4px 10px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--bg);
  flex: 0 0 auto;
  min-height: 32px;
}
.dx-ref {
  min-width: 82px;
  font: 600 12px/22px ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink);
  background: var(--grid-head);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0 8px;
  text-align: center;
  flex: 0 0 auto;
  align-self: center;
}
/* the seam between "where you are" and "what is in it" */
.dx-fx-mark {
  color: var(--muted);
  font: italic 600 13px/1 serif;
  flex: 0 0 auto;
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 0 10px;
  margin-inline-start: 8px;
  border-inline-start: 1px solid var(--line);
}
/* The look is THE FIELD; this sizes it and sets the monospace face, because
   a formula is read character by character. */
.dx-fx-input {
  flex: 1 1 auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  min-width: 0;
  align-self: center;
}

/* ————— status bar —————
   Excel's reads left: what you are looking at; right: what the selection adds
   up to. The sum is the half people actually use, so it gets the ink — grid
   figures on the app's own surface, not muted like the label beside it. */
.dx-status {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 3px 12px;
  border-top: 1px solid var(--line-strong);
  background: var(--panel);
  font-size: 12px;
  color: var(--muted);
  flex: 0 0 auto;
  min-height: 26px;
  font-variant-numeric: tabular-nums;
  /* the home indicator, and the tray's own number for it — same reasoning as
     the top bar's padding, and this is the bar the indicator actually lands on */
  padding-bottom: max(3px, env(safe-area-inset-bottom), var(--tray-safe-bottom, 0px));
}
.dx-status-view { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-status-sum {
  margin-left: auto;
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  padding-inline-start: 16px;
  border-inline-start: 1px solid var(--line-strong);
}
.dx-status-sum:empty { border: 0; padding: 0; }

/* ————— row gutter and column letters ————— */
/* Row numbers and the corner: one band, but a QUIET one. A grey header slab is
   the second thing that dated this grid — Excel 2007 painted one and every
   spreadsheet since has been walking it back. What has to be true is that the
   header reads as not-data; a fill two shades off the sheet plus a heavier
   bottom edge does that, and the rest of the separation is carried by type
   (see .dg-hmain below). Row numbers are 10.5px: they are a coordinate, and
   a coordinate should never out-weigh the figure it is pointing at. */
.dg-gutter {
  width: 52px;
  flex: 0 0 52px;
  background: var(--grid-head);
  color: var(--grid-head-ink);
  text-align: right;
  font-size: 10.5px;
  font-weight: 500;
  border-right: 2px solid var(--line-strong);
  position: sticky;
  left: 0;
  z-index: 2;
  cursor: pointer;
  user-select: none;
}
.dg-gutter:hover { background: var(--hover); color: var(--ink); }
.dg-gutter-on { background: var(--grid-head-on); color: var(--ink); font-weight: 700; }
.dg-corner {
  width: 52px;
  flex: 0 0 52px;
  background: var(--grid-head);
  border-right: 2px solid var(--line-strong);
  position: sticky;
  left: 0;
  z-index: 4;
  cursor: pointer;
}
.dg-letter {
  font: 600 10px/1.6 inherit;
  color: var(--grid-head-ink);
  letter-spacing: 0.05em;
  flex: 0 0 auto;
  cursor: pointer;
  padding: 0 3px;
  border-radius: 4px;
}
.dg-letter:hover { background: var(--hover); color: var(--ink); }

/* ————— selection —————
   COOL, not the brand amber. The old amber tint landed on top of amber
   conditional-format data bars — two unrelated meanings in one warm smear, and
   the reader had no way to tell "I selected this" from "the document coloured
   this". Selection is chrome; conditional formatting is data; they no longer
   share a hue.

   `!important` on the fill because a conditional-format background is written
   INLINE by grid.ts, and an inline style beats any selector. Selection has to
   win: a selected cell that does not look selected is a lost cursor. */
.dg-cell.dg-sel { background: var(--sel) !important; }
.dg-cell.dg-cursor {
  box-shadow: inset 0 0 0 2px var(--sel-ring);
  background: var(--bg) !important;
  z-index: 1;
}
.dg-cell { position: relative; }
/* …but NOT the pinned ones. `.dg-cell` and `.dg-gutter` have the same
   specificity, so this later rule silently won and the row numbers scrolled
   away with the data — measured: after scrolling 500px right, the gutter sat at
   left −495, entirely off screen. A spreadsheet whose row numbers leave when
   you scroll sideways has lost the thing they are for. Frozen columns are
   restated for the same reason. */
.dg-cell.dg-gutter { position: sticky; left: 0; }
.dg-cell.dg-frozen { position: sticky; }
/* and the gutter wins the overlap: equal z-index leaves it to DOM order, and
   the gutter comes first, so a frozen column would slide over the numbers. */
.dg-cell.dg-gutter { z-index: 3; }
/* The HEADER's corner is the same pin one row up. It was not sticky at all, so
   a scrolled column header slid straight under it and showed through where the
   row numbers' heading should be — the corner read "age", the tail of "Stage".
   It is the one cell that has to outrank both axes: the row gutter slides
   beneath it and so does every column header. */
.dg-head-row .dg-cell.dg-corner { position: sticky; left: 0; z-index: 6; }
.dg-head-row .dg-cell.dg-gutter { z-index: 6; }
.dg-v { position: relative; z-index: 1; }

/* ————— conditional formatting —————
   THESE COLOURS ARE DATA, NOT CHROME. A colour scale and a data bar are
   computed from the numbers by condfmt.ts and travel in the file, so the theme
   does NOT recolour them: two people looking at one workbook have to be
   looking at the same encoding, or the colours stop meaning anything that can
   be discussed. What the theme changes is the INK ON TOP of them.

   A data bar is drawn behind the figure at 55% over whatever ground the sheet
   has, so it tints rather than replaces and the sheet's own ink still reads.
   The bar therefore needs nothing here. A colour-SCALE fill does: it is an
   opaque wash written inline onto the cell, and the fills a scale produces are
   pale by construction (they interpolate between two or three chosen colours,
   and every preset picks light ones for a white sheet). Light ink on a pale
   green cell is invisible, so a cell carrying a data-driven fill takes the
   LIGHT theme's ink on both themes — which also means one cell reads the same
   in both, and that is the right answer for a cell whose colour is data.

   `[style*='background']` is how a cell announces one: grid.ts appends
   `;background:<colour>` to the inline style for exactly this case and for
   nothing else (a frozen column gets position/left, every cell gets a width).
   A rule that also sets an explicit text colour still wins — it is written
   inline too, and the author meant it. Selection replaces the fill with the
   selection tint, so a selected cell opts back out and takes the theme's ink
   again. */
.dg-cell[style*='background'] { color: var(--ink-on-fill); }
.dg-cell.dg-sel[style*='background'] { color: var(--ink); }

.dg-bar {
  position: absolute;
  top: 5px;
  bottom: 5px;
  border-radius: 2px;
  opacity: var(--bar-opacity);
  z-index: 0;
}

/* ————— header controls ————— */
.dg-filter {
  color: var(--muted);
  cursor: pointer;
  flex: 0 0 auto;
  padding: 0 2px;
  font-size: 10px;
}
.dg-filter:hover { color: var(--accent); }
/* A filtered column is amber and a SELECTED one is blue — the two states are
   unrelated and used to share --grid-head-on, so a filter looked like a
   selection that would not go away. */
.dg-h.dg-filtered { background: var(--accent-wash); }
.dg-h.dg-filtered .dg-filter { color: var(--accent); }
/* THE SELECTED COLUMN'S HEADER — the counterpart to .dg-gutter-on, and
   deliberately the SAME strength: same band colour, same step up to full ink.
   Two headers marking one selection have to look like one gesture; a column
   header lit differently from the row gutter reads as a second, competing
   thing being selected.

   The `.dg-hstrip` rule is not optional. The header is two stacked boxes and
   the letter strip paints its OWN --grid-head background, so tinting only
   .dg-h lights the name row and leaves the letter — the part the eye actually
   tracks a column by — sitting on the unselected band.

   It also outranks .dg-filtered above (later, same specificity), which is the
   right way round: the filter is a persistent state and the selection is the
   one the hand is on. Nothing is lost by yielding — the filter caret keeps its
   amber, and that is the mark that says a filter exists. */
.dg-h.dg-h-on,
.dg-h.dg-h-on .dg-hstrip { background: var(--grid-head-on); }
.dg-h.dg-h-on .dg-letter,
.dg-h.dg-h-on .dg-name { color: var(--ink); }
.dg-grip {
  position: absolute;
  right: -3px;
  top: 0;
  bottom: 0;
  width: 7px;
  cursor: col-resize;
  z-index: 5;
}
.dg-grip:hover { background: var(--accent); opacity: 0.5; }
.dg-h { position: relative; }

/* ————— popover menus ————— */
/* Same panel as .dx-menu and the save menu — one floating-surface style for
   the whole app, so a right-click menu and a top-bar menu are recognisably
   the same object. */
.dx-pop {
  position: fixed;
  z-index: 9999;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.dx-pop button {
  font: inherit;
  font-size: var(--fs-ui);
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: var(--radius);
  padding: 6px 9px;
  cursor: pointer;
  color: inherit;
}
.dx-pop button:hover { background: var(--hover); }
.dx-pop-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.dx-pop-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 9px 6px;
  font-size: var(--fs-micro);
  color: var(--muted);
}

/* ————— selection outline and fill handle ————— */
.dg-outline {
  position: absolute;
  pointer-events: none;
  border: 2px solid var(--sel-ring);
  border-radius: 2px;
  z-index: 4;
}
/* ————— copy marks (the "marching ants") —————
   What ⌘C / ⌘X took, outlined until Escape, the next edit or a paste. Four
   dashed edges drawn as background gradients so the dashes can MOVE (a CSS
   `border-style: dashed` cannot be animated). Same ring colour as the
   selection, so the two read as one family: solid = here, dashed = copied. */
.dg-ants {
  position: absolute;
  pointer-events: none;
  z-index: 5;
  margin: -1px 0 0 -1px;
  padding: 1px;
  --ant: var(--sel-ring);
  background:
    linear-gradient(90deg, var(--ant) 50%, transparent 0) repeat-x 0 0 / 8px 2px,
    linear-gradient(90deg, var(--ant) 50%, transparent 0) repeat-x 0 100% / 8px 2px,
    linear-gradient(0deg, var(--ant) 50%, transparent 0) repeat-y 0 0 / 2px 8px,
    linear-gradient(0deg, var(--ant) 50%, transparent 0) repeat-y 100% 0 / 2px 8px;
  animation: dg-ants 0.6s linear infinite;
}
@keyframes dg-ants {
  to { background-position: 8px 0, -8px 100%, 0 -8px, 100% 8px; }
}
@media (prefers-reduced-motion: reduce) { .dg-ants { animation: none; } }
/* ————— point mode: the range a formula is pointing at ————— */
.dg-point {
  position: absolute;
  pointer-events: none;
  z-index: 5;
  border: 2px dashed var(--point, #3b82f6);
  background: color-mix(in srgb, var(--point, #3b82f6) 12%, transparent);
  border-radius: 2px;
}
.dg-handle {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 8px;
  height: 8px;
  background: var(--sel-ring);
  border: 1px solid var(--bg);
  border-radius: 1px;
  cursor: crosshair;
  pointer-events: auto;
}
/* the cursor cell no longer needs its own ring — the outline draws it */
.dg-cell.dg-cursor { box-shadow: none; background: var(--bg) !important; }
.dg-scroll:focus { outline: none; }
/* …and neither does a FOCUSED cell, for the same reason: focus and the cursor
   are the same cell by construction (see Grid.restoreFocus), so a focus ring on
   top of the selection outline would draw the same rectangle twice, 2px apart.
   The one case where they differ is the scroller holding focus because the
   cursor is scrolled out of the window, and that has nothing on screen to ring. */
.dg-cell:focus, .dg-cell:focus-visible { outline: none; }

/* ————— the appender: the dataset's whole frontier —————
   ONE row past the data, and it must not look like a row of data. The gutter
   carries `+` where a row number would be and the cells are empty and muted;
   the ruled lattice (painted by Grid.paintEmptyGrid) now stops immediately
   below it, so what is under the sheet is plain background rather than a
   picture of rows that do not exist. */
.dg-add-row .dg-cell { color: var(--muted); cursor: cell; }
.dg-add-gutter { font-weight: 700; }
.dg-add-row:hover .dg-cell { background: var(--hover); }

/* …and the same invitation past the last COLUMN, which the sheet had in one
   direction only. Narrow (28px, against a column's 130) because it is a
   control and not a column: at full width the eye reads it as an empty column
   the sheet already has, which is the confusion the row appender's `+` gutter
   exists to avoid. Muted until hovered, like its row counterpart. */
.dg-add-col {
  width: 28px;
  flex: 0 0 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  background: var(--grid-head);
  user-select: none;
}
.dg-add-col:hover { background: var(--hover); color: var(--accent); }

/* Text for assistive technology only. Not `display:none` and not
   `visibility:hidden` — both remove the node from the accessibility tree, which
   is the one place this text is FOR. */
.dg-a11y {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Frozen columns stay put while the rest scrolls under them, so they need an
   opaque background (the cells behind would show through) and an edge that
   says where the frozen pane ends. */
/* --surface and --sel-bg were never declared anywhere in dash: a frozen cell
   resolved to `background: <invalid>` and stayed TRANSPARENT — the exact
   failure the rule above exists to prevent — and a frozen cell inside a
   selection fell back to a hard-coded blue while the rest of the selection was
   amber. Both now read dash's own tokens. */
.dg-cell.dg-frozen { background: var(--bg); z-index: 2; }
.dg-head-row .dg-cell.dg-frozen { background: var(--grid-head); }
.dg-head-row .dg-cell.dg-frozen { z-index: 5; }
/* …and it still lights with the selection. This rule exists only to out-rank
   the one above it, which is more specific than the .dg-h-on pair and would
   otherwise leave the frozen columns as the one place a selected header stays
   grey. */
.dg-head-row .dg-cell.dg-frozen.dg-h-on { background: var(--grid-head-on); }
.dg-cell.dg-frozen.dg-freeze-edge { border-right: 2px solid var(--line-strong); }
.dg-cell.dg-sel.dg-frozen { background: var(--sel); }

/* ————— two-line column header —————
   The letter strip on top (Excel's position, and the click target for
   selecting the column), the name and its controls below. One line could not
   hold both: the name was being clipped to a single character. */
.dg-head-row { height: calc(var(--row-h) + 20px); }
.dg-head-row .dg-cell { height: calc(var(--row-h) + 20px); line-height: normal; padding: 0; }
.dg-h { flex-direction: column; align-items: stretch; gap: 0; }
/* THE LETTER STRIP IS LAID OUT IN FLOW: the letter at the left, the type chip
   at the right, each in its own space. It used to centre the letter and float
   the chip over the right half, which left the chip about 50px: enough for
   "PERCENT" only at 9px and 75% opacity, the least readable text in the app,
   and still 0px from the letter (the old note here filed exactly this). In
   flow the chip gets everything the letter does not use, so it reads at 11px,
   the floor slides holds its own small uppercase labels to (its section heads,
   .ed-help-sec h3), and the two can never paint over each other in any locale:
   the chip truncates with an ellipsis, the letter (the ADDRESS, how a person
   says which column they mean) never does. The full type is in `title`. */
.dg-hstrip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 19px;
  padding: 0 3px 0 8px;
  /* --line, not --line-strong: a seam INSIDE the header; at the heavier
     weight the two-line header read as two stacked bands */
  border-bottom: 1px solid var(--line);
  background: var(--grid-head);
}
.dg-h .dg-letter {
  display: block;
  height: 19px;
  line-height: 19px;
  text-align: center;
  border-radius: 0;
  padding: 0;
}
.dg-hstrip .dg-letter { flex: none; text-align: left; }
.dg-hstrip .dg-type {
  flex: 0 1 auto;
  min-width: 0;
  margin-left: auto;
  height: 19px;
  line-height: 17px;
  border: 0;
  background: transparent;
  font-size: 11px;
  padding: 0 2px;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dg-hstrip .dg-type:hover { opacity: 1; color: var(--accent); }
/* HIERARCHY FROM TYPE, NOT FROM FILL. The column name is the one piece of
   furniture that has to out-rank the data without a heavy band under it:
   11.5px (a step below the 12.5px figures), semibold, tracked slightly open,
   and a darker ink than the muted grey the rest of the header runs at. Tracking
   is what makes a smaller, quieter label still read as a heading — it is the
   move that separates a 2024 spreadsheet from a 2006 one. */
.dg-hmain {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 8px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--grid-head-ink);
}
.dg-head-row .dg-corner { padding: 0; }
.dx-pop-on { color: var(--accent); font-weight: 600; }

/* THE SPREADSHEET KIND ONLY, and the scoping is the whole point.
   `paintEmptyGrid` rules the space past the last row, and the inner table has
   to fill the scroller for that lattice to reach the bottom — which is honest
   on a CANVAS sheet, whose grid genuinely does not end.
   It is a lie on a DATASET, and this rule outlived the behaviour it was written
   for: the frontier work removed that lattice from the table kind precisely
   because rows that are not there must not be drawn. Left unscoped, it also
   defeats the shrink-wrap above — MEASURED at 1440x900 with the starter open,
   `.dg-table` ran 521px past the last row, so the paper still bled to the
   bottom of the window and the "bottom edge" landed at the foot of the
   viewport rather than under the data. The horizontal half of the fix worked
   and the vertical half was silently cancelled by a rule 700 lines away. */
.dg-canvas .dg-table { min-height: 100%; }

/* ONE ACCENT. Comments were violet here — chosen because amber already meant
   "the app did something" — which left dash with three accents (amber, violet
   and the selection blue) where slides and spaces have one: slides' comment
   pins are its amber. The review measured the three side by side and the
   suite's rule is that slides is the reference for the chrome's look, so a
   comment wears the accent: the marker and its rule in --accent, any TEXT in
   --accent-ink (the amber itself is 2.02:1 on white and cannot be text). */
:root {
  --cmt: var(--accent);
  --cmt-ink: var(--accent-ink);
  --cmt-wash: var(--accent-wash);
}

/* ————— the spreadsheet kind (grid.ts, `kind: 'canvas'`) —————
   ONE HEADER LINE, not two. The dataset's header carries a name, a type
   control, a filter caret and a sort mark, which is what forced it onto two
   rows. A spreadsheet's column has none of those — it is not typed and cannot
   be, because the type lives on the cell — so it carries the letter alone and
   the row that would hold the name is not there to be empty. */
.dg-canvas .dg-head-row { height: var(--row-h); }
.dg-canvas .dg-head-row .dg-cell {
  height: var(--row-h);
  line-height: calc(var(--row-h) - 1px);
  padding: 0;
}
.dg-ch {
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  position: relative;
  background: var(--grid-head);
}
.dg-ch .dg-letter {
  display: block;
  flex: 1 1 auto;
  height: var(--row-h);
  line-height: var(--row-h);
  text-align: center;
  border-radius: 0;
  padding: 0;
}
/* THE SPACER for the columns scrolled off to the left. One element instead of
   five hundred empty ones — the horizontal half of the virtualiser, which the
   dataset path never needed because a dataset has as many columns as the file
   has and this kind has 16,384. It always sits behind the sticky gutter, so it
   carries no rule of its own; a border here would draw a line inside a cell. */
.dg-pad {
  border-right: 0;
  border-bottom: 1px solid var(--grid-line);
  padding: 0;
}
.dg-canvas .dg-head-row .dg-pad { border-bottom: 0; background: var(--grid-head); }

/* ROW HEIGHT, dragged from the gutter's bottom edge — the counterpart to the
   column grip, and the reason `CanvasSheet.rows` exists. Wider than it looks
   (5px of grab for a 1px line) because a resize handle you have to hunt for is
   a resize handle nobody finds.

   WHOLLY INSIDE THE CELL, which is not a detail. `.dg-cell` is
   `overflow: hidden`, so any part of a handle that hangs over the edge is
   CLIPPED — it still measures in `getBoundingClientRect`, it still draws
   nothing, and it does not hit-test. Straddling the boundary therefore makes
   half the grab band dead while the handle looks symmetrical: measured on the
   column grip, which sits at `right: -3px`, the outer 3px of a 7px handle
   answer `elementFromPoint` with the CELL. A grip you have to aim at is worse
   than a thinner one you can hit. */
.dg-rgrip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  cursor: row-resize;
  z-index: 4;
}
.dg-rgrip:hover { background: var(--accent); opacity: 0.5; }
/* …and the same correction for the column grip, scoped to this kind. The
   dataset header's grip shares a row with a filter caret and has been QA'd
   against a real mouse where it stands; this one has the strip to itself. */
.dg-canvas .dg-grip { right: 0; width: 6px; }
.dg-canvas .dg-gutter { position: sticky; }