/* app2/ui/app.css — the hotkey.gg look, lifted verbatim from the old build and kept in its
   cascade order (index.html <style> 74–2304 + nav.css). The order is load-bearing: the density
   pass at the END is an ID-scoped rule that outranks the base td rule, the selection tint is a
   ::before veil, borders paint on a ::after overlay, and on dark themes .gridwrap re-declares the
   palette so the sheet flips to light paper while the chrome stays dark. Class names are the old
   build's, so the old CSS applies unchanged to the new painter. */

/* the tokens (every color, size, radius, space and duration) live in ui/tokens.css (M87); the
   names this file was written against (--bg, --surface, --text, --accent …) are aliases there */
*{box-sizing:border-box;margin:0;padding:0}
html{height:100%; font-variant-ligatures:no-contextual}  /* JetBrains Mono joins <- <= >= <> into one glyph; a learner must see each key they type (course lane 2026-11-18) */
body{
  background:var(--bg); color:var(--text); font-family:var(--sans);
  /* TOP-ALIGNED like every other page — the old flex vertical-centering made the nav's
     position depend on content height (the "menu jumps down entering the game" bug). */
  min-height:100vh; padding:0 0 var(--s2); user-select:none; -webkit-user-select:none;
}
.app{width:100%; max-width:1180px; margin:0 auto; padding:0 var(--s6)}

/* ---------- 2. top nav + modal base + theme picker (nav.css 8–57, 116–129, 158–168, 228–232, 264–268) ---------- */
.wrap{max-width:1180px; margin:0 auto; padding:0 var(--s6)}

/* ---------- 3. formula bar (index.html 126–149) + .ftimer (761–763) ---------- */
.fbar{display:flex; align-items:stretch; margin-bottom:0; border:0!important; border-bottom:1px solid var(--line)!important; border-radius:0!important; font-family:var(--mono);
  font-size:calc(var(--wb-fs) - 0.5px); border:1px solid var(--line); border-radius:8px; overflow:hidden; background:var(--surface)}
/* Excel's formula bar Cancel and Enter marks: greyed and disabled when idle, lit (red ✕, green ✓) and live the moment an
   edit is open. A click presses the mark's key (Esc or Enter) the way the keyboard does (sheet-view pressMark). */
.fx-actions{display:inline-flex; align-items:center; gap:5px; margin:0 9px 0 3px; user-select:none}
.fx-actions button{width:19px; height:19px; display:inline-flex; align-items:center; justify-content:center;
  border:1px solid var(--line); border-radius:5px; background:var(--surface2); color:var(--faint);
  font-size:calc(var(--wb-fs) - 2.5px); line-height:1; padding:0; cursor:default; transition:color .12s,border-color .12s,background .12s}
.fx-actions.on .fx-x{color:var(--red); border-color:var(--red); background:color-mix(in srgb, var(--red) 12%, transparent)}
.fx-actions.on .fx-ok{color:var(--learn); border-color:var(--learn); background:color-mix(in srgb, var(--learn) 12%, transparent)}
.fx-actions.on button{cursor:pointer}
.fx-actions.on .fx-x:hover{background:color-mix(in srgb, var(--red) 24%, transparent)}
.fx-actions.on .fx-ok:hover{background:color-mix(in srgb, var(--learn) 24%, transparent)}
.sbar .sb-note{color:var(--text)}
.namebox{min-width:56px; padding:7px 10px; color:var(--accent); background:var(--surface2);
  border-right:1px solid var(--line); text-align:center; font-weight:500}
.fx{padding:7px 11px; color:var(--faint); font-style:italic; font-family:var(--sans);
  border-right:1px solid var(--line); display:flex; align-items:center}
/* design-guard: keep the formula bar's own padding (Excel's surface, like the Name Box beside it) */
.fcontent{flex:1; padding:7px 13px; color:var(--text); white-space:nowrap; overflow-x:auto; scrollbar-width:none;   /* r91: long formulas scroll, caret kept in view */
  text-overflow:ellipsis; display:flex; align-items:center; min-width:0}
/* design-guard: end */
.fcontent.isfx{color:var(--accent)}
.fcontent.empty{color:var(--faint); font-style:italic; font-family:var(--sans); font-size:calc(var(--wb-fs) - 1.5px)}

/* The sheet is Excel at 100% (archived SITE_SPEC §4). The wrap is a SCROLL BOX: the frame's flex chain (section
   11) gives it its height and width, and its own content adds nothing to either (the table is absolutely
   positioned inside it), so a 100-row sheet never grows the page or pushes the panel. The table paints
   every row and column of the model at the engine widths with table-layout:fixed; sheet-view.js writes
   the table width and the <col> widths, and --cellh / --cellpad, from the same numbers these tokens
   fall back to. r79: sheet flush to the frame's top-left, like the real thing. */
.gridwrap{background:transparent; border:0; border-radius:0; padding:0; margin:0;
  overflow:auto; position:relative; min-width:0; min-height:0; align-self:stretch; display:block;
  --cellh:20px; --cellpad:3px; --cellfs:14.67px; --rowhdrw:36px}
/* r304: the sheet background paints on the TABLE, not the wrap */
.gridwrap table{position:absolute; top:0; left:0; table-layout:fixed; background:var(--surface); font-size:var(--cellfs,14.67px)}
/* the sheet's own cell rules reach only the sheets (the grid, a tool card's data preview, the sheet preview); a site table
   (.tbl and the rest) draws from its own rules, in the site's type. :where keeps their specificity as it was */
:where(.gridwrap, .tc-preview, .sheet-preview) table{border-collapse:collapse; font-family:var(--cellfont); font-size:var(--wb-fs)}
/* r216: the edit caret is a zero-width CSS bar constrained inside the text's line box, so entering
   edit mode never reflows the row. */
.edcaret{display:inline-block; width:0; height:.92em; border-right:1.6px solid var(--accent);
  vertical-align:-.16em; margin:0; animation:edblink 1s steps(1) infinite}
@keyframes edblink{50%{opacity:0}}
:where(.gridwrap, .tc-preview, .sheet-preview) td:hover{background:inherit}   /* keyboard game — no mouse-hover cell glow (r39) */
:where(.gridwrap, .tc-preview, .sheet-preview) th, :where(.gridwrap, .tc-preview, .sheet-preview) td{border:1px solid var(--line); height:38px; text-align:right; position:relative; overflow:hidden}
:where(.gridwrap, .tc-preview, .sheet-preview) th{background:var(--surface2); color:var(--muted); font-weight:500; text-align:center;
  min-width:34px; height:30px; font-size:calc(var(--wb-fs) - 2.5px)}
.rowhdr{min-width:30px}
/* design-guard: keep the cell's own padding: the sheet's geometry, Excel's, stays exact */
:where(.gridwrap, .tc-preview, .sheet-preview) td{padding:0 9px; height:var(--cellh, 24px); color:var(--text); white-space:nowrap; vertical-align:middle; transition:background .08s}
/* design-guard: end */
td.txt{text-align:left}
td.err, td.txt.err{text-align:center}   /* an error value sits centred under General alignment, as Excel draws it (E3); Alt H A L/R still win */
td.spill{overflow:visible; z-index:3}   /* r107: Excel-parity text spill (see render) */
td.spill .sp{position:absolute; left:var(--cellpad,3px); top:0; bottom:0; display:flex; align-items:center;
  white-space:nowrap; overflow:hidden; pointer-events:none; text-align:left}
/* r312: a spilling cell's highlight is SINGLE-CELL, not spanning. .sphi width is the cell's own width (set in render). */
td.active.spill, td.sel.spill{outline:none; background:transparent}
td.spill .sphi{position:absolute; left:0; top:0; bottom:0; pointer-events:none}
td.active.spill .sphi{outline:1.5px solid var(--cell-cursor); outline-offset:-1px}
td.sel.spill .sphi{background:var(--sel-cell)}
td.wrap{white-space:pre-line}   /* Alt+Enter line breaks show (M41); Wrap Text keeps the cell's own font and line, as Excel's does (UI-83) */
td.bold{font-weight:700}
td.fill-blue{background:var(--xl-fill-blue) !important; color:var(--xl-fill-blue-ink)}   /* r160: #dbeafe was 1.05:1 vs paper sheets — invisible fill */
html[data-dark="1"] td.fill-blue{background:var(--xl-fill-blue-dk) !important; color:var(--xl-fill-blue-ink-dk)}
/* r231: the FILL PALETTE — Alt H H picker. Banker shades: grey headers, yellow flags, green, red. Three theme layers each (light / dark chrome / dark-chrome-light-sheet). */
td.fill-gray{background:var(--xl-fill-gray) !important; color:var(--xl-fill-gray-ink)}
td.fill-yellow{background:var(--xl-fill-yellow) !important; color:var(--xl-fill-yellow-ink)}
td.fill-green{background:var(--xl-fill-green) !important; color:var(--xl-fill-green-ink)}
td.fill-red{background:var(--xl-fill-red) !important; color:var(--xl-fill-red-ink)}
html[data-dark="1"] td.fill-gray{background:var(--xl-fill-gray-dk) !important; color:var(--xl-fill-gray-ink-dk)}
html[data-dark="1"] td.fill-yellow{background:var(--xl-fill-yellow-dk) !important; color:var(--xl-fill-yellow-ink-dk)}
html[data-dark="1"] td.fill-green{background:var(--xl-fill-green-dk) !important; color:var(--xl-fill-green-ink-dk)}
html[data-dark="1"] td.fill-red{background:var(--xl-fill-red-dk) !important; color:var(--xl-fill-red-ink-dk)}
/* Conditional formatting (Chapter 2, sheet-view): a rule's paint wins over the cell's own fill and font colour, as in Excel. The colours are Excel's hexes, so they read the same in every theme. */
.gridwrap td.cf-fill, html[data-dark="1"] .gridwrap td.cf-fill{background:var(--cf-fill) !important}
.gridwrap td.cf-fc, html[data-dark="1"] .gridwrap td.cf-fc{color:var(--cf-fc) !important}
.gridwrap td.cf-bd{box-shadow:inset 0 0 0 1px var(--cf-bd)}
.gridwrap td.cf-bar, html[data-dark="1"] .gridwrap td.cf-bar{background-image:linear-gradient(90deg, var(--cf-bar) var(--cf-pct), transparent var(--cf-pct)) !important; background-repeat:no-repeat !important}
/* r212: DARK CHROME, LIGHT SHEET — like real Excel in dark mode. On dark themes the grid renders
   on a fixed light sheet (dark ink, light gridlines), while the nav / ribbon / background keep the
   theme. Scoped to .gridwrap so only the sheet flips; CSS vars cascade to every cell. BG-34: every light theme draws Workbook's white
   sheet the same way (html[data-sheet="white"], tokens.css), so these legacy names follow it there too. */
html:is([data-dark="1"], [data-sheet="white"]) .gridwrap{
  /* r213: softened off the stark white — a gentle warm off-white sheet. */
  /* palette sprint, Round 1: the light sheet's values are tokens (tokens.css, html[data-dark="1"] .gridwrap; themes.js SHEET_LIGHT), a cool
     off-white on Workbook's slate; these legacy names follow them */
  --bg:var(--paper); --surface:var(--sheet); --surface2:var(--chrome);
  --text:var(--ink); --muted:var(--ink-2); --faint:var(--edge);
  --warn:var(--ink); --bad:var(--red);
  --accent:var(--learn); --accent-dim:var(--learn-ink); --accent-glow:color-mix(in srgb, var(--learn) 14%, transparent);
}
/* the sheet is light now → font swatches + blue fill use their LIGHT base values */
html[data-dark="1"] .gridwrap td.fc-black    {color:var(--text) !important}
html[data-dark="1"] .gridwrap td.fc-darkgray {color:var(--xl-fc-darkgray) !important}
html[data-dark="1"] .gridwrap td.fc-blue     {color:var(--xl-fc-blue) !important}
html[data-dark="1"] .gridwrap td.fc-red      {color:var(--xl-fc-red) !important}
html[data-dark="1"] .gridwrap td.fc-green    {color:var(--xl-fc-green) !important}
html[data-dark="1"] .gridwrap td.fc-purple   {color:var(--xl-fc-purple) !important}
html[data-dark="1"] .gridwrap td.fc-yellow   {color:var(--xl-fc-yellow) !important}
html[data-dark="1"] .gridwrap td.fc-orange   {color:var(--xl-fc-orange) !important}
html[data-dark="1"] .gridwrap td.fill-blue   {background:var(--xl-fill-blue) !important; color:var(--xl-fill-blue-ink) !important}
html[data-dark="1"] .gridwrap td.fill-gray   {background:var(--xl-fill-gray) !important; color:var(--xl-fill-gray-ink) !important}
html[data-dark="1"] .gridwrap td.fill-yellow {background:var(--xl-fill-yellow) !important; color:var(--xl-fill-yellow-ink) !important}
html[data-dark="1"] .gridwrap td.fill-green  {background:var(--xl-fill-green) !important; color:var(--xl-fill-green-ink) !important}
html[data-dark="1"] .gridwrap td.fill-red    {background:var(--xl-fill-red) !important; color:var(--xl-fill-red-ink) !important}
/* explicit alignment overrides (Excel Alt H A L/C/R) — use !important to beat .txt and num defaults */
td.align-l{text-align:left !important}
td.align-c{text-align:center !important}
td.align-r{text-align:right !important}
/* font color palette — modeling-realistic theme row of 10 swatches */
td.fc-black     {color:var(--xl-fc-black) !important}
td.fc-darkgray  {color:var(--xl-fc-darkgray) !important}
td.fc-gray      {color:var(--xl-fc-gray) !important}
td.fc-white     {color:var(--xl-fc-white) !important}
td.fc-blue      {color:var(--xl-fc-blue) !important}
td.fc-red       {color:var(--xl-fc-red) !important}
td.fc-orange    {color:var(--xl-fc-orange) !important}   /* r160: was #ed7d31 — 1.95:1 on paper themes */
td.fc-yellow    {color:var(--xl-fc-yellow) !important}   /* r205: deepened to a higher-contrast amber-gold (~4.5:1) */
td.fc-green     {color:var(--xl-fc-green) !important}
td.fc-purple    {color:var(--xl-fc-purple) !important}
/* dark-theme variants: every swatch stays VISIBLE on dark sheets. themes.js sets data-dark. */
html[data-dark="1"] td.fc-black    {color:var(--text) !important}
html[data-dark="1"] td.fc-darkgray {color:var(--xl-fc-darkgray-dk) !important}
html[data-dark="1"] td.fc-blue     {color:var(--xl-fc-blue-dk) !important}
html[data-dark="1"] td.fc-red      {color:var(--xl-fc-red-dk) !important}
html[data-dark="1"] td.fc-green    {color:var(--xl-fc-green-dk) !important}
html[data-dark="1"] td.fc-purple   {color:var(--xl-fc-purple-dk) !important}
html[data-dark="1"] td.fc-yellow   {color:var(--xl-fc-yellow-dk) !important}
html[data-dark="1"] td.fc-orange   {color:var(--xl-fc-orange-dk) !important}
/* r204: on LIGHT sheets, black-formatted cells read as the softened graphite --text, not pure #000. */
html[data-dark="0"] td.fc-black    {color:var(--text) !important}
td.over{color:var(--warn); letter-spacing:1px}
td .padx{visibility:hidden}
/* r253: the edit box POPS OUT beyond the column so a long formula reads in-cell (Excel behavior).
   The cell stops clipping; an absolute overlay grows to the formula's width and paints over the
   empty neighbors to the right. */
td.editing{text-align:left; color:var(--text); background:transparent; box-shadow:none; padding:0; overflow:visible; z-index:6}
td.editing .edbox{position:absolute; left:0; top:0; bottom:0; min-width:100%; width:max-content; max-width:640px;
  display:flex; align-items:center; padding:0 var(--cellpad,3px); box-sizing:border-box; background:var(--bg); color:var(--text);
  box-shadow:inset 0 0 0 2px var(--accent); z-index:6}
td.editing .edin{white-space:nowrap}

/* The softened gridline is computed ONCE, on the table, and reaches the 2,600 cells by inheritance as a plain
   colour: a var()/color-mix() written on the td itself is substituted and re-parsed per cell and was 40% of a
   full paint's style time. (The selection's edge is an overlay, positionSelEdge, not a border.) */
#grid{border-color:color-mix(in srgb, var(--line) 52%, transparent)}
#grid tbody, #grid tr, #grid td{border-color:inherit}
body.hide-gridlines #grid td{border-color:transparent}

/* ---------- 6. cursor tokens, active, point, selection, fill-handle, marquee (463, 471–494, 501–514) ---------- */
:root{ --active-fill:color-mix(in srgb, var(--learn) 13%, transparent); --sel-grey:color-mix(in srgb, var(--ink) 14%, transparent); --sel-cell:color-mix(in srgb, var(--ink) 22%, transparent); }   /* palette sprint, Round 1: the brand and the ink, not an old green and a slate literal (the light sheet re-declares both in a dark theme); --sel-cell is the selected cells, darker than a menu row, closer to Excel (UI-126) */
td.active{outline:1.5px solid var(--cell-cursor); outline-offset:-1px; z-index:4}
/* Formula pointer — the cell whose reference is currently being inserted into the formula bar.
   Dashed border reads distinct from the solid active-cell outline. */
td.point{outline:2px dashed var(--warn); outline-offset:-2px; background:rgba(224,175,104,.12); z-index:3}
/* a pointed range (Shift with an arrow, AutoSum's proposal): one dashed box round the whole range, never a box per cell */
td.point.pt-range{outline:none; background-image:var(--pt-t, none), var(--pt-b, none), var(--pt-l, none), var(--pt-r, none);
  background-position:top left, bottom left, top left, top right; background-size:100% var(--point-w), 100% var(--point-w), var(--point-w) 100%, var(--point-w) 100%; background-repeat:no-repeat}
td.pt-range.pt-t{--pt-t:repeating-linear-gradient(to right, var(--warn) 0 var(--point-dash), transparent 0 calc(2 * var(--point-dash)))}
td.pt-range.pt-b{--pt-b:repeating-linear-gradient(to right, var(--warn) 0 var(--point-dash), transparent 0 calc(2 * var(--point-dash)))}
td.pt-range.pt-l{--pt-l:repeating-linear-gradient(to bottom, var(--warn) 0 var(--point-dash), transparent 0 calc(2 * var(--point-dash)))}
td.pt-range.pt-r{--pt-r:repeating-linear-gradient(to bottom, var(--warn) 0 var(--point-dash), transparent 0 calc(2 * var(--point-dash)))}
/* r423: SELECTION TINT as an OVERLAY (::before veil) that paints ON TOP of any cell background —
   filled or not, light sheet or dark chrome. ::after stays owned by the fill-handle and borders. */
td.sel::before{content:''; position:absolute; inset:0; background:var(--sel-cell); pointer-events:none}
td.active.sel::before{display:none}                                 /* r345: the anchor is the white window inside the grey selection */
td.sel.spill::before{display:none}                                  /* spill cells keep their single-cell .sphi highlight (r312) */
/* the green range edge, Excel-like (r313: thinner): one rectangle over the grid (sheet-view.js positionSelEdge), never the
   cells' borders, since a border changed on the collapsed-border table repaints every border in the grid (perf, 2026-11-17).
   Each pane's copy is clipped to its pane: the scrolling pane's under the frozen columns (5) and the sticky header (7), a
   frozen column's over its cells, a frozen row's over the header it rides in; the fill handle (6) stays on top of the line */
.sel-edges{position:absolute; left:0; top:0; pointer-events:none}
.sel-clip{position:absolute; overflow:hidden; pointer-events:none; z-index:4}
.sel-clip.sel-fc{z-index:6}
.sel-clip.sel-fr{z-index:7}
.sel-edge{position:absolute; box-sizing:border-box; border:var(--bw-1-5) solid var(--cell-cursor); pointer-events:none}
/* r312/r313: the fill-handle square at the current cell's bottom-right, just inside the corner. */
td.fh::after{content:''; position:absolute; right:0; bottom:0; width:6px; height:6px;
  background:var(--cell-cursor); z-index:6}   /* r317: flush + tight in the corner, Excel-style */
td.editing.fh::after, td.point.fh::after{display:none}
/* the paste flash (§6a: opacity only): an accent veil over each pasted cell fades out. It rides
   ::before, which stays rendered for as long as the cell is .pasted (even as the active cell or a
   spill), so moving the selection never restarts it; multiply keeps the cell's text dark under it.
   A pasted cell that is still selected carries its grey selection veil as a background layer instead. */
@keyframes pasteflash{0%{opacity:.9}100%{opacity:0}}
td.pasted::before{content:''; display:block; position:absolute; inset:0; background:var(--accent); mix-blend-mode:multiply;
  pointer-events:none; opacity:0; animation:pasteflash .5s ease-out}
td.pasted.active::before, td.pasted.spill::before{display:block}
td.pasted.sel:not(.spill){background-image:linear-gradient(var(--sel-cell),var(--sel-cell))}
td.pasted.sel.active{background-image:none}

.marquee{position:absolute; display:none; pointer-events:none; z-index:6;
  background-image:
    linear-gradient(90deg,var(--accent) 50%,transparent 50%),
    linear-gradient(90deg,var(--accent) 50%,transparent 50%),
    linear-gradient(0deg,var(--accent) 50%,transparent 50%),
    linear-gradient(0deg,var(--accent) 50%,transparent 50%);
  background-repeat:repeat-x,repeat-x,repeat-y,repeat-y;
  background-size:8px 2px,8px 2px,2px 8px,2px 8px;
  background-position:0 0,0 100%,0 0,100% 0;
  animation:ants .5s linear infinite}
@keyframes ants{to{background-position:8px 0,-8px 100%,0 -8px,100% 8px}}

/* ---------- 7. applied borders + italic/strike/underline (index.html 586, 625–652) ---------- */
td.bt,td.bb,td.bl,td.br,td.ball,td.bdbl{position:relative}
td.bt:not(.spill):not(.editing),td.bb:not(.spill):not(.editing),td.bl:not(.spill):not(.editing),
td.br:not(.spill):not(.editing),td.ball:not(.spill):not(.editing),td.bdbl:not(.spill):not(.editing){
  overflow:clip; overflow-clip-margin:1px}
td.bt::after,td.bb::after,td.bl::after,td.br::after,td.ball::after,td.bdbl::after{
  content:''; position:absolute; left:-1px; top:-1px; right:-1px; bottom:-1px;
  pointer-events:none; z-index:4; border:0 solid var(--rule,var(--text));
}
td.bt::after{border-top-width:2px}
td.bb::after{border-bottom-width:2px}
td.bl::after{border-left-width:2px}
td.br::after{border-right-width:2px}
td.bdbl::after{border-bottom:3px double var(--rule,var(--text))}   /* r298: Alt H B B — the double rule under a grand total */
td.it{font-style:italic}
td.strike{text-decoration:line-through; opacity:.75}
td.uline{text-decoration:underline; text-underline-offset:2px}
td.uline.strike{text-decoration:underline line-through}
td.ball::after{border-width:2px}
/* r429/r442: thick box — 3px against the 2px thin rule and the 1px gridline; per-edge. Keep integral. */
td.thick.bt::after{border-top-width:3px}
td.thick.bb::after{border-bottom-width:3px}
td.thick.bl::after{border-left-width:3px}
td.thick.br::after{border-right-width:3px}
td.thick.ball::after{border-width:3px}
/* the fill handle shares ::after with a cell's border: on a bordered active cell it keeps its own place, the
   bottom-right corner, as Excel draws it, instead of the border box's top-left */
td.fh:is(.bt,.bb,.bl,.br,.ball,.bdbl)::after{left:auto; top:auto; right:0; bottom:0; border:0; z-index:6}

/* r426: the strip floats inside a FIXED-HEIGHT SLOT: a menu that needs a second line grows the
   ribbon DOWNWARD as an overlay over the sheet, so the grid top is a constant in every state. */
.ribbon-slot{position:relative; flex:0 0 var(--rib-h,34px); height:var(--rib-h,34px); z-index:12}   /* above the sheet's own layers (td 2-6, marquee 6); BELOW the floating dialogs (30) */
.ribbon-slot > .ribbon{position:absolute; top:0; left:0; right:0}
.ribbon-slot > .ribbon.ribbon-open{box-shadow:0 8px 18px rgba(0,0,0,.16)}   /* the overlay reads as a layer above the sheet */
.ribbon{display:flex; align-items:center; flex-wrap:wrap; gap:4px 7px; min-height:var(--rib-h,34px); row-gap:2px;
  font-family:var(--mono); font-size:var(--xl-fs); margin:0; border:0; border-bottom:1px solid var(--line);
  background:var(--surface2); border-radius:0; padding:2px 12px; box-sizing:border-box}
.ribbon .rhint{color:var(--faint); font-size:calc(var(--xl-fs) - 1px)}
/* r58 flat pass: a quiet tint is enough. r426: LAYERED over an opaque surface (it paints over live grid cells). */
.ribbon.show{background-color:var(--surface2);
  background-image:linear-gradient(var(--accent-glow),var(--accent-glow))}
.ribbon .rhint{color:var(--muted); font-size:var(--xl-fs); display:inline-flex; align-items:center}
.ribbon .rhint k{display:inline-grid; place-items:center; min-width:19px; height:19px; margin-right:7px;
  color:var(--text); background:var(--surface2); border:1px solid var(--line); border-radius:4px; padding:0 5px; font-size:var(--xl-fs); font-weight:600}
.ribbon .path{color:var(--on-accent); background:var(--accent); font-weight:700; margin-right:4px; letter-spacing:.2px;
  padding:4px 10px; border-radius:6px}
.ribbon .rtab, .ribbon .opt{display:inline-flex; align-items:center; gap:7px; color:var(--text);
  background:var(--surface2); border:1px solid var(--line); border-radius:7px; padding:4px 10px}   /* r357: 4px vertical keeps the tab strip at the 34px lean-row height */
.ribbon .opt{color:var(--text)}                          /* r315: readable at rest, not muted */
.ribbon .opt.on{color:var(--accent)}
.ribbon .opt.on k{border-color:var(--accent); color:var(--accent)}
.ribbon .rtab k, .ribbon .opt k{display:inline-grid; place-items:center; min-width:20px; height:20px;
  color:var(--on-accent); background:var(--accent); border:none; border-radius:4px; padding:0 5px;
  font-weight:700; font-size:calc(var(--xl-fs) + 0.5px)}
/* r315: the Alt+H flyout, grouped like Excel's real Home tab — chips in clusters with a thin divider. */
.ribbon .rgrp{display:inline-flex; flex-direction:column; align-items:center; gap:3px;
  padding:1px 10px; border-left:1px solid var(--line)}
.ribbon .rgrp:first-of-type{border-left:0; padding-left:2px}
.ribbon .rgrp-chips{display:inline-flex; gap:5px; flex-wrap:nowrap}

/* r327: ICON-ribbon tiles — icon over name, a KeyTip badge in the corner (Excel-real). */
.ribbon .rgrp-ico{padding:1px 8px}
.ribbon .rgrp-ico .rgrp-chips{gap:2px; align-items:flex-start}
/* r332: the groups grow to share the full width (Excel's Home tab spans edge-to-edge). */
.ribbon.ribbon-ico{gap:0}
.ribbon.ribbon-ico .rgrp-ico{flex:1 1 auto; justify-content:center}
.ribbon.ribbon-ico .rgrp-ico .rgrp-chips{justify-content:center; flex-wrap:wrap}
.ribbon.ribbon-lean .rgrp-ico .rgrp-chips{flex-wrap:nowrap}
/* r340: LEAN always-on bar — compact tiles (badge + icon, names in tooltips), same strip height as the idle hint. */
.ribbon.ribbon-lean{background:var(--surface2); flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; position:relative; padding-right:74px}
.ribbon.ribbon-lean::-webkit-scrollbar{display:none}
.ribbon.ribbon-lean .rgrp-ico{flex:0 0 auto; padding:1px 3px}
.ribbon.ribbon-lean .rgrp-chips{gap:1px}
.ribbon.ribbon-lean .rpin{position:sticky; right:0; background:var(--surface2); box-shadow:-6px 0 8px var(--surface2)}
.ribbon.ribbon-lean .ri-cmd{flex-direction:row; align-items:center; gap:2px; padding:2px 3px;
  width:auto; min-width:0; min-height:0; flex:0 0 auto}
.ribbon.ribbon-lean .ri-ico{height:17px}
.ribbon.ribbon-lean .ri-ico svg{width:15px; height:15px}
.ribbon.ribbon-lean .ri-g{font-size:calc(var(--xl-fs) + 1px)}
.ribbon.ribbon-lean .ri-key{position:static; font-size:calc(var(--xl-fs) - 2.5px); line-height:1.5; order:2}
.ribbon.ribbon-lean .rgrp-ico{padding:1px 6px}
/* r426: THE OPEN MENU — every glyph steps up to a legible size (KeyTip 9→11px, labels 11→12.5px,
   icons 15→18px, glyphs 13→15px). It stays ONE row, like the lean bar: a second row landed as an
   orphan over the formula bar, so a menu too wide for the sheet scrolls sideways instead (the
   KeyTips still reach every command). Groups sit a little tighter so Home fits at 1280. */
.ribbon.ribbon-open{padding-right:12px; flex-wrap:nowrap; overflow-x:auto; overflow-y:hidden}
.ribbon.ribbon-open .rgrp-ico .rgrp-chips{flex-wrap:nowrap}
.ribbon.ribbon-lean.ribbon-open .rgrp-ico{padding:1px 3px}
.ribbon.ribbon-open > .path{flex:none; white-space:nowrap}   /* "Home →" never folds onto two lines */
.ribbon.ribbon-open .ri-key{font-size:calc(var(--xl-fs) - 1px); font-weight:800; line-height:1.35}
.ribbon.ribbon-open .ri-lbl{font-size:calc(var(--xl-fs) + 0.5px)}
.ribbon.ribbon-open .ri-g{font-size:calc(var(--xl-fs) + 3px)}
.ribbon.ribbon-open .ri-ico{height:20px}
.ribbon.ribbon-open .ri-ico svg{width:18px; height:18px}
.ribbon.ribbon-open .ri-cmd{padding:2px; gap:3px}
/* r343: menus without icons use badge+label chips — same family, same 34px row */
.ribbon.ribbon-lean .ri-cmd.ri-txt{gap:5px}
.ribbon.ribbon-lean .ri-lbl{font-family:var(--mono); font-size:calc(var(--xl-fs) - 1px); color:var(--text); white-space:nowrap}
.ribbon.ribbon-lean.ribbon-open .ri-lbl{font-size:calc(var(--xl-fs) + 0.5px)}
/* r343: anchored color DROPDOWN (Excel-style) under the triggering tile */
.rdrop{position:fixed; z-index:40; background:var(--surface); min-width:190px}
.rdrop.rdrop-parent{z-index:39}   /* a submenu's parent menu (ribbon-view.js subDropShow): under the submenu that overlaps it */
.rdrop-cap{font-family:var(--font); font-size:var(--xl-fs-small); font-weight:var(--fw-bold);
  color:var(--muted); margin-bottom:7px}   /* sentence case, as Excel titles its own dropdowns */
.rdrop-sw{display:grid; grid-template-columns:repeat(var(--sw-cols, 5), max-content); gap:5px; max-width:230px}
.rdrop-name{font-family:var(--mono); font-size:calc(var(--xl-fs) + 0.5px); color:var(--text); margin-top:7px}
.rdrop-hint{font-family:var(--font); font-size:var(--xl-fs-small); color:var(--muted); margin-top:4px}
.rpin{font-family:var(--mono); font-size:calc(var(--xl-fs) - 1.5px); font-weight:700; letter-spacing:.08em; color:var(--faint);
  margin-left:auto; padding:2px 9px; border:1px solid var(--line); border-radius:99px; cursor:pointer;
  align-self:center; flex:none; transition:.12s}
.rpin:hover{color:var(--text); border-color:var(--accent-dim)}
.rpin.on{color:var(--accent); border-color:var(--accent-dim); background:var(--accent-glow)}
.ribbon .ri-cmd{position:relative; display:inline-flex; flex-direction:column; align-items:center; justify-content:flex-start;
  gap:3px; width:50px; min-height:44px; padding:5px 2px 4px; border-radius:7px; cursor:default; transition:background .1s}
.ribbon .ri-cmd:hover{background:var(--surface2)}
.ribbon .ri-ico{height:19px; display:flex; align-items:center; justify-content:center; color:var(--text)}
.ribbon .ri-ico svg{width:18px; height:18px}
.ribbon .ri-g{font-family:var(--mono); font-size:calc(var(--xl-fs) + 3px); line-height:1; color:var(--text)}

.ribbon .ri-key{position:absolute; top:1px; right:2px; font-family:'Key Legend',var(--mono); font-size:calc(var(--xl-fs) - 2px); font-weight:700;
  color:var(--on-accent); background:var(--accent); border-radius:3px; padding:0 3px; line-height:1.5}

/* (the old whole-sheet "solved" background flash is gone: nothing sets .solved in the rebuild, and
   the finish ring in 12b is the one completion cue) */
.ribbon .rtab.dim{color:var(--faint); background:transparent; border-color:transparent}
.ribbon .rtab.dim k{color:var(--faint); background:var(--surface2)}
.ribbon .rnote{color:var(--warn); margin-left:6px}
/* font color swatch picker */
.ribbon .fc-swatch, .rdrop .fc-swatch{display:inline-block; width:20px; height:20px; border:2px solid var(--line); border-radius:4px;
  vertical-align:middle; margin:0 1px; transition:.1s; cursor:pointer}
.ribbon .fc-swatch.on, .rdrop .fc-swatch.on{border-color:var(--accent); outline:2px solid var(--accent-glow); transform:scale(1.18)}
.ribbon .fc-name{color:var(--accent); font-family:var(--mono); font-size:calc(var(--xl-fs) + 0.5px); margin:0 8px 0 4px; min-width:54px}

/* r191: Excel parity — Paste Special / Format Cells float OVER the sheet as a compact card;
   the page never dims and the card is exactly content-sized (no inset stretch) */
.pd-backdrop{display:none; z-index:50}
.pd-sect{padding:5px 2px 2px; font-size:calc(var(--wb-fs) - 3px); letter-spacing:.08em; text-transform:uppercase; color:var(--faint)}
.pd-box{background:var(--surface); width:280px; overflow:hidden}   /* r353: ONE card; its corner, edge, shadow and air are the workspace dialog's (workspace.css) */
.pd-title{padding:9px 13px; border-bottom:1px solid var(--line); font-size:calc(var(--wb-fs) - 0.5px); font-weight:600;
  display:flex; justify-content:space-between; align-items:center}
.pd-title .x{color:var(--muted); font-family:var(--mono); font-size:calc(var(--wb-fs) - 2.5px); font-weight:400}
.pd-title:empty{display:none}   /* an alert with no title (the confirms, the Data Validation alert): the icon and the message speak */
.pd-group h4{font-size:calc(var(--wb-fs) - 3px); color:var(--muted); font-weight:500; margin:0 0 5px 4px;
  text-transform:uppercase; letter-spacing:.6px}
.pd-opt{display:flex; align-items:center; gap:9px; padding:3px 7px; border-radius:6px; font-size:calc(var(--wb-fs) - 1px); color:var(--text)}
.pd-opt.on{background:var(--accent-glow); color:var(--accent)}
.pd-radio{font-family:var(--mono); width:12px; text-align:center; color:var(--faint)}
.pd-opt.on .pd-radio{color:var(--accent)}
.pd-key{font-family:var(--mono); font-size:calc(var(--wb-fs) - 2.5px); background:var(--surface2); border:1px solid var(--line);
  border-radius:4px; padding:0 6px; color:var(--muted)}
.pd-opt.on .pd-key{border-color:var(--accent); color:var(--accent)}
.pd-foot{display:flex; justify-content:flex-end; gap:8px; border-top:1px solid var(--line)}
.pd-btn{font-family:var(--mono); font-size:calc(var(--wb-fs) - 2px); padding:5px 11px; border-radius:6px;
  border:1px solid var(--line); background:var(--surface2); color:var(--muted)}
.pd-btn kbd{font-size:calc(var(--wb-fs) - 3.5px)}
.pd-btn.ok{border-color:var(--accent); color:var(--accent)}

/* ---------- 10. toast (905–921), keycaps (973–982, 997–999), row-header cues (1069–1070) ---------- */
#hkToast{position:fixed; bottom:26px; left:50%; transform:translateX(-50%) translateY(8px);
  background:var(--surface2); color:var(--text); border:1px solid var(--accent-dim);
  font-family:var(--mono); font-size:var(--fs-2); padding:var(--s2) var(--s4); border-radius:999px;
  opacity:0; pointer-events:none; transition:all .18s; z-index:360}
#hkToast.show{opacity:1; transform:translateX(-50%) translateY(0)}
/* design-guard: keep a keycap's own padding (the toast's keys, the key flash's chips): the keycaps stay as they are (CLAUDE.md) */
#hkToast kbd{display:inline-block; font-family:inherit; font-size:var(--fs-1); color:var(--text);
  background:var(--surface); border:1px solid var(--line); border-bottom-width:2px;
  border-radius:4px; padding:0 6px; margin:0 2px}
/* design-guard: end */

.rowhdr.grp{box-shadow:inset 3px 0 0 var(--accent)}

/* ---------- 11. stage flex chain (index.html 1305, 1406–1408, 1445–1447) ---------- */

.stage{display:flex; flex-direction:column; gap:0; background:var(--surface);
  border:1px solid var(--line); border-radius:12px; overflow:hidden}
.stage-row{display:flex; align-items:stretch; gap:0; flex:1; min-height:clamp(400px, calc(100vh - 330px), 800px)}   /* r60/r398: the frame fills the screen; the sheet grows DOWN into the page's bottom whitespace */
.stage-main{flex:1 1 auto; min-width:0; display:flex; flex-direction:column; min-height:0}
.stage-main .fbar{flex:0 0 auto}
.stage-main .gridwrap{flex:1 1 auto; min-height:0}
/* a SheetView mounted in a host element of its own (not .stage-main itself) carries the same flex chain */
.sheet-view{display:flex; flex-direction:column; min-width:0; min-height:0}
.stage-main > .sheet-view{flex:1 1 auto}
.sheet-view .fbar{flex:0 0 auto}
.sheet-view .gridwrap{flex:1 1 auto; min-height:0}

/* ---------- 12. comment triangle (index.html 1809–1810) ---------- */
td.cmt::after{content:''; position:absolute; top:0; right:0; width:0; height:0;
  border-top:8px solid var(--bad); border-left:8px solid transparent}

.rpin-b:focus-visible, .rf-tab:focus-visible{outline:var(--focus-w) solid var(--cell-cursor); outline-offset:var(--focus-off)}

/* ---------- 12b. feedback (archived SITE_SPEC §1): the finish ---------- */
/* the finish: a fixed layer on the stage's box (effects.js places it) whose accent ring fades out
   while it grows a touch — opacity and transform only; the ring under the result overlay (z 40) */
.fx-ring{position:fixed; z-index:30; pointer-events:none; opacity:0; transform-origin:center;
  box-shadow:0 0 0 3px var(--accent), 0 0 0 12px var(--accent-glow); animation:fxRing .75s ease-out forwards}
.fx-ring.still{animation-name:fxRingFade}
@keyframes fxRing{0%{opacity:0; transform:scale(.992)}35%{opacity:1; transform:scale(1)}100%{opacity:0; transform:scale(1.012)}}
@keyframes fxRingFade{0%{opacity:0}35%{opacity:1}100%{opacity:0}}
@media (prefers-reduced-motion: reduce){ .fx-ring{animation-name:fxRingFade} }

/* the slot stays a constant height in each mode, so the sheet never moves when a menu opens */
.ribbon-slot.rib-full{--rib-h:96px}
.ribbon.ribbon-full{height:var(--rib-h,96px); min-height:0; padding:0; gap:0; flex-direction:column; align-items:stretch; flex-wrap:nowrap; overflow:hidden}
.ribbon.ribbon-full.show{background-image:linear-gradient(var(--accent-glow),var(--accent-glow))}
.rf-tabs{display:flex; align-items:flex-end; gap:2px; height:25px; padding:2px 8px 0; border-bottom:1px solid var(--line); background:var(--surface); flex:none}
.rf-tab{position:relative; font-family:var(--mono); font-size:calc(var(--xl-fs) - 0.5px); color:var(--muted); background:transparent; border:1px solid transparent; border-bottom:0;
  border-radius:6px 6px 0 0; padding:3px 11px 4px; cursor:pointer; line-height:1.2; transition:color .12s, background .12s}
.rf-tab:hover{color:var(--text); background:var(--surface2)}
.rf-tab.on{color:var(--accent); background:var(--surface2); border-color:var(--line); font-weight:600; margin-bottom:-1px; padding-bottom:5px}
.rf-tab.dead{color:var(--faint)}
.rf-tab k{position:absolute; left:50%; bottom:-7px; transform:translateX(-50%); display:inline-grid; place-items:center; min-width:16px; height:15px;
  color:var(--on-accent); background:var(--accent); border-radius:3px; padding:0 4px; font-size:calc(var(--xl-fs) - 2px); font-weight:800; line-height:1; z-index:3;
  box-shadow:0 1px 3px rgba(0,0,0,.25)}
.rf-tab k.dim{background:var(--surface2); color:var(--faint); box-shadow:none; border:1px solid var(--line)}
.rf-tools{margin-left:auto; display:flex; align-items:center; gap:8px; padding-bottom:3px}
.rf-tools .rnote{font-size:calc(var(--xl-fs) - 1px)}
.rf-body{display:flex; align-items:stretch; flex:1 1 auto; min-height:0; padding:2px 4px 0; overflow-x:auto; overflow-y:hidden; scrollbar-width:none}
.rf-body::-webkit-scrollbar{display:none}
.rf-grp{display:flex; flex-direction:column; align-items:center; justify-content:space-between; padding:0 6px 1px; border-right:1px solid var(--line); flex:none}
.rf-grp:last-child{border-right:0}
.rf-cols{display:flex; align-items:flex-start; gap:2px; flex:1 1 auto; min-height:0}
.rf-col{display:flex; flex-direction:column; gap:1px}
.rf-row{display:flex; align-items:center; gap:1px}
/* the number-format row ($ % , and the two decimal buttons): its glyphs (",000", ".00") are wider than an
   icon button, so the buttons fit their glyphs and keep 2px apart instead of running together */
.rf-row-num{gap:2px}
.rf-row-num > .rf-btn.ico{width:auto; min-width:22px; padding:0 3px}
.rf-gname{font-family:var(--mono); font-size:calc(var(--xl-fs) - 2px); letter-spacing:.06em; text-transform:uppercase; color:var(--faint); font-weight:600; line-height:1; padding-top:2px; white-space:nowrap; flex:none}
/* buttons: small (icon + label in a row) and big (icon over label); both carry a KeyTip badge in the corner */
.rf-btn{position:relative; display:inline-flex; align-items:center; gap:4px; height:17px; padding:0 4px; border:1px solid transparent; border-radius:5px;
  background:transparent; color:var(--text); font-family:var(--mono); font-size:calc(var(--xl-fs) - 2px); line-height:1; cursor:pointer; white-space:nowrap; transition:background .1s, border-color .1s}
.rf-btn:hover{background:var(--surface); border-color:var(--line)}
.rf-btn:active{background:var(--accent-glow)}
.rf-btn.on{background:var(--accent-glow); border-color:var(--accent-dim); color:var(--accent)}
.rf-btn.open{background:var(--surface); border-color:var(--accent-dim)}
.rf-btn.ico{width:22px; padding:0; justify-content:center}
.rf-btn.ico.rf-arrow{width:14px}
.rf-btn .rf-ico{display:inline-flex; align-items:center; justify-content:center; width:16px; height:16px; color:var(--text); flex:none}
.rf-btn .rf-ico svg{width:15px; height:15px}
.rf-btn .rf-ico .ri-g{font-size:calc(var(--xl-fs) + 0.5px); line-height:1}
.rf-btn .rf-lbl{color:var(--text)}
.rf-btn .rf-caret, .rf-box .rf-caret{font-size:calc(var(--xl-fs) - 4px); color:var(--muted); margin-left:-2px; line-height:1}
.rf-btn.ico .rf-caret{position:absolute; right:1px; bottom:0; margin:0; font-size:calc(var(--xl-fs) - 5px)}
.rf-btn.big{flex-direction:column; justify-content:flex-start; gap:2px; height:53px; width:52px; padding:4px 2px 2px; white-space:normal; text-align:center}
.rf-btn.big .rf-ico{width:24px; height:24px}
.rf-btn.big .rf-ico svg{width:22px; height:22px}
.rf-btn.big .rf-ico .ri-g{font-size:calc(var(--xl-fs) + 6px)}
.rf-btn.big .rf-lbl{font-size:calc(var(--xl-fs) - 2px); line-height:1.15; max-width:52px}
/* a big label is set on at most two lines (ribbon-view bigLabelLines: "Page Break" / "Preview", as Excel sets it); a line never
   rewraps, so the button widens past its 52/60px for a long line instead of spilling onto a neighbour or the caption row */
.rf-btn.big:not(.rf-grpbtn){min-width:max-content}
.ribbon.ribbon-full .rf-btn.big .rf-lbl{max-width:none; flex:none}   /* beats the density step's max-width (scale.css); never squeezed, so a second line is never cut */
.rf-btn.big .rf-ln{display:block; white-space:nowrap}
.rf-btn.big .rf-ln .rf-caret{margin-left:3px}   /* a two-line label's menu arrow sits after its last word ("Panes ▾"), not on a third row */
.rf-btn.dis, .rf-box.dis{opacity:.42; cursor:not-allowed}
.rf-btn.dis:hover{background:transparent; border-color:transparent}
.rf-btn.dis .rf-ico, .rf-btn.dis .rf-lbl{color:var(--muted)}
/* a split button: face + arrow share one outline */
.rf-split{position:relative; display:inline-flex; align-items:stretch; border-radius:6px}
.rf-split .rf-face{border-radius:5px 0 0 5px}
.rf-split .rf-arrow{border-radius:0 5px 5px 0; width:14px; padding:0; justify-content:center; height:auto}
.rf-split.big{flex-direction:column; align-items:center; width:52px}
.rf-split.big .rf-face{border-radius:5px 5px 0 0; height:42px; width:52px; flex-direction:column; justify-content:flex-start; gap:2px; padding:4px 2px 2px; white-space:normal; text-align:center}
.rf-split.big .rf-face .rf-ico{width:24px; height:24px}
.rf-split.big .rf-face .rf-ico svg{width:22px; height:22px}
.rf-split.big .rf-face .rf-lbl{font-size:calc(var(--xl-fs) - 2px); line-height:1.15}
.rf-split.big .rf-arrow{border-radius:0 0 5px 5px; width:52px; height:11px}
.rf-split.open .rf-arrow{background:var(--surface); border-color:var(--accent-dim)}
/* a folded group (the bar is too narrow for its buttons): one big button, its live KeyTips stacked beneath */
.rf-grp.rf-collapsed .rf-grpbtn{width:50px}
.ribbon.ribbon-full .rf-btn.rf-grpbtn .rf-lbl{max-width:100%}
.rf-btn.rf-grpbtn .rf-ln{overflow:hidden; text-overflow:ellipsis}
.rf-grptips{position:absolute; left:50%; bottom:9px; transform:translateX(-50%); display:flex; gap:2px; z-index:3}
.ribbon-full .rf-grptips .ri-key{position:static; transform:none}
.rdrop-item.on .rdrop-lbl{color:var(--xl-ink)}
/* the disabled name / size / number-format boxes */
.rf-box{position:relative; display:inline-flex; align-items:center; justify-content:space-between; height:17px; padding:0 5px; border:1px solid var(--line); border-radius:4px;
  background:var(--surface); font-family:var(--mono); font-size:calc(var(--xl-fs) - 2px); color:var(--text); white-space:nowrap; overflow:hidden}
.rf-row > .rf-box:only-child{flex:1 0 auto}   /* the Excel width is a floor (inline min-width): a box grows to its text, and a column's boxes share one width */
.rf-box > .rf-caret{margin-left:6px}
.rf-box-cell .rf-box-v{font-variant-numeric:tabular-nums}   /* the size box reads the active cell: 11 and 12 take the same width, so the bar never shifts */
/* the KeyTip badge on a full-bar control: hangs under a small control and sits on a big one's icon, never in the layout flow;
   sized to its letters (right:auto: the base .ribbon .ri-key's right:2px plus a left stretched it over the whole button, hiding the label) */
.ribbon-full .ri-key, .rdrop-menu .ri-key, .rdrop-dialog .ri-key{position:absolute; top:auto; left:50%; right:auto; bottom:-6px; width:max-content; transform:translateX(-50%); font-family:'Key Legend',var(--mono); font-size:calc(var(--xl-fs) - 2px); font-weight:800; line-height:1.3;
  color:var(--on-accent); background:var(--accent); border:1px solid color-mix(in srgb, var(--accent-dim) 60%, transparent); border-radius:3px; padding:0 3px; z-index:3; box-shadow:0 1px 3px rgba(0,0,0,.3); pointer-events:none; white-space:nowrap}
.rf-btn.big > .ri-key, .rf-split.big > .ri-key{top:1.4em; bottom:auto}   /* on the icon's lower half: the label under it stays readable at either density */
.rf-btn.ico > .ri-key{left:auto; right:-4px; transform:none}
.rf-btn:not(.ico):not(.big) > .ri-key, .rf-box > .ri-key{left:-2px; transform:none}
/* menus and small dialogs as anchored dropdowns */
.rdrop.rdrop-menu, .rdrop.rdrop-dialog{min-width:200px}
.rdrop-menu .rdrop-hint{white-space:nowrap; padding:5px 8px 3px 10px; margin-top:4px; border-top:1px solid var(--line)}   /* the footer hint: one line, lined up with the items, off the menu's edge */
.rdrop-item{position:relative; display:flex; align-items:center; gap:9px; padding:4px 8px 4px 10px; border-radius:6px; font-family:var(--mono); font-size:var(--xl-fs); color:var(--text); cursor:pointer}
.rdrop-item:hover{background:var(--accent-glow)}
.rdrop-item.dis{opacity:.45; cursor:not-allowed}
.rdrop-item.dis:hover{background:transparent}
.rdrop-item .ri-key{position:static; box-shadow:none; min-width:18px; text-align:center; line-height:1.5}
.rdrop-menu .rdrop-item .ri-key{position:static}
.rdrop-ico{display:inline-flex; align-items:center; justify-content:center; width:18px; height:18px; color:var(--text); flex:none}
.rdrop-ico svg{width:16px; height:16px}
.rdrop-ico .ri-g{font-size:calc(var(--xl-fs) + 1px)}
.rdrop-lbl{white-space:nowrap}
.rdrop-chips{display:flex; gap:5px; flex-wrap:wrap; max-width:300px}
.rdrop-chips .opt{display:inline-flex; align-items:center; color:var(--text); background:var(--surface2); border:1px solid var(--line); border-radius:7px; padding:3px 9px; font-family:var(--mono); font-size:var(--xl-fs); cursor:pointer}
.rdrop-chips .opt.on{color:var(--accent); border-color:var(--accent)}
.rdrop-val{font-family:var(--mono); font-size:calc(var(--xl-fs) + 1px); color:var(--accent); padding:6px 8px; margin:2px 0 4px; background:var(--surface2); border:1px solid var(--line); border-radius:6px; min-height:30px}
.rdrop-foot{display:flex; justify-content:flex-end; gap:8px; padding-top:8px; margin-top:6px; border-top:1px solid var(--line)}
.rdrop .pd-btn{cursor:pointer}
.rdrop .pd-btn:hover{border-color:var(--accent-dim); color:var(--text)}
.pd-opt[data-act]{cursor:pointer}
.pd-opt[data-act]:hover{background:var(--accent-glow)}
.pd-btn[data-act]{cursor:pointer}
.pd-btn[data-act]:hover{border-color:var(--accent-dim); color:var(--text)}
.ribbon .ri-cmd[data-act]{cursor:pointer}
.ribbon .opt[data-act], .ribbon .rtab[data-act]{cursor:pointer}
.ribbon .opt[data-act]:hover, .ribbon .rtab[data-act]:hover{border-color:var(--accent-dim)}
/* the full / slim toggle (was the "bar" pin): two segments, the current one lit */
.rpin{display:inline-flex; align-items:center; padding:0; border:1px solid var(--line); border-radius:99px; overflow:hidden; margin-left:auto; align-self:center; flex:none; cursor:default}
.rpin:hover{border-color:var(--line)}
.rpin-b{font-family:var(--mono); font-size:calc(var(--xl-fs) - 2px); font-weight:700; letter-spacing:.08em; color:var(--faint); background:transparent; border:0; padding:3px 9px; cursor:pointer; line-height:1.2}
.rpin-b:hover{color:var(--text)}
.rpin-b.on{color:var(--accent); background:var(--accent-glow)}
.ribbon.ribbon-lean .rpin{position:sticky; right:0; background:var(--surface2); box-shadow:-6px 0 8px var(--surface2)}
.rf-tools .rpin{margin-left:0}

/* ---- Excel at 100% (archived SITE_SPEC §4): 20px rows, 11pt Arial/Calibri-class cells, 11px headers that stick ---- */
#grid td, :is(#grid, .grid-rh) th{font-size:var(--cellfs,14.67px); height:var(--cellh,20px); padding:0 var(--cellpad,3px); line-height:1.15}   /* 11pt sits in a 20px row with 1.5px to spare, like Calibri 11 in Excel's 15pt row */
#grid td{transition:none}   /* no 80ms background fade on 2,600 cells: it cost a fifth of a full paint and was never visible */
:is(#grid, .grid-rh) th{font-size:calc(var(--wb-fs) - 2.5px); padding:0 2px; z-index:7; background:var(--surface2)}   /* above every cell layer (active 4, editing 6, marquee 6); the ribbon slot (12) and dialogs (30) stay above */
/* The headers stick as two elements, not one per header cell (each sticky cell was its own compositing layer,
   ~130 of them, re-layered on every key): the column letters ride the top edge in the grid's <thead>, the
   corner rides both edges inside it, and the row numbers ride the left edge as one strip (.grid-rh, painted
   by sheet-view.js with the grid's row tags) over the grid's own row-number cells, which keep the geometry.
   The strip sticks within .grid-rhs, a box as wide as the grid, so it holds at any scroll. Its lines are
   transparent: the lines between the numbers were always the grid's own (a sticky cell paints only its
   ground and text), so they still scroll with the sheet and line up with it at rest. */
#grid thead{position:sticky; top:0; z-index:7}
#grid tr.hdr th.rowhdr{position:sticky; left:0; z-index:8}
/* the sticky column letters' collapsed top border left a 1px slit the scrolled rows painted through (pane polish, round 2) */
#grid tr.hdr th{border-top:0}
/* the strip's header row only matches the grid's height; the grid's own numbers sit under the strip */
.grid-rh tr.hdr th{visibility:hidden}
#grid tbody th.rowhdr{z-index:auto}
.gridwrap .grid-rhs{position:absolute; top:0; left:0; pointer-events:none}
.gridwrap table.grid-rh{position:sticky; left:-.5px; z-index:7; pointer-events:auto; background:transparent}
.gridwrap .grid-rh th{border-color:transparent !important}
/* r353: the Paste Special / Format Cells wrapper is positioning-only; .pd-box carries the one tight card look. */
#pasteDialog,#fmtDialog{position:fixed; z-index:30; display:none; flex-direction:column; font-size:calc(var(--wb-fs) - 1.5px)}

/* ---- phase C: hidden rows/columns, row heights, the freeze seam ---- */
#grid tr.hidrow, .grid-rh tr.hidrow{display:none}
#grid td.hidc, :is(#grid, .grid-rh) th.hidc{padding:0 !important; border-left:0 !important; border-right:0 !important; font-size:0 !important; overflow:hidden}
:is(#grid, .grid-rh) th.seam-c{border-left:3px double var(--line)}
:is(#grid, .grid-rh) th.rowhdr.seam-r{border-top:3px double var(--line)}
#grid td.frz-b{border-bottom:2px solid var(--faint)}
#grid td.frz-r{border-right:2px solid var(--faint)}
/* Freeze Panes: the frozen rows ride in the grid's sticky <thead> (sheet-view.js render), so they hold under the column
   letters at any scroll. Their numbers are the grid's own, stuck to the left edge like the corner: the header layer
   sits above the strip, so the strip's numbers for them (kept, in its own sticky <thead>, for the geometry) would be
   covered by cells scrolling sideways. The frozen columns' cells stick to the left edge after the row numbers, each
   at the left the render writes on it. A frozen cell paints the sheet's ground (zero specificity, so a fill still
   wins) and sits above the cells scrolling under it. */
.gridwrap table.grid-rh thead{position:sticky; top:0}
#grid thead{background:var(--surface); box-shadow:inset 0 0 0 100vmax var(--surface)}   /* the ground under the header layer: a gridline the sheet hides is transparent, and the rows scrolling beneath would show through it. The collapsed border between two frozen rows is a 1px slit no cell background paints (the section's own background is painted per cell, so it skips it too), where the text of rows scrolled under the head showed as dotted ghost lines; the section's inset shadow fills its whole box, slits included, under the cells (Excel's frozen rows are opaque) */
#grid thead tr:not(.hdr) th.rowhdr{position:sticky; left:0; z-index:8}
:where(#grid thead td, #grid td.frz-c){background:var(--surface)}
#grid td.frz-c, #grid tr.hdr th.frz-c{position:sticky}
#grid td.frz-c{z-index:5}
#grid td.frz-c.spill{z-index:6}   /* a title spilling from a frozen column paints over the frozen neighbour's ground, not under it (the model pages' A1, 2026-10-26) */
#grid tr.hdr th.frz-c{z-index:8}

/* ---- C2 gap 4: the outline bar — a bracket over a grouped band, ⊖ / ⊕ on the row or column past it; a folded band hides like Excel's ---- */
:is(#grid, .grid-rh) tr.hdr th.ol-c{box-shadow:inset 0 3px 0 var(--accent)}
:is(#grid, .grid-rh) th.ol-host{overflow:visible}
:is(#grid, .grid-rh) th .ol-btn{position:absolute; left:1px; top:1px; width:13px; height:13px; padding:0; line-height:11px; font-family:var(--mono); font-size:calc(var(--wb-fs) - 2.5px); font-weight:700; color:var(--accent); background:var(--surface); border:1px solid var(--accent); border-radius:2px; cursor:pointer; z-index:9}
:is(#grid, .grid-rh) th .ol-btn:hover{background:var(--accent); color:var(--on-accent)}
:is(#grid, .grid-rh) tr.hdr th .ol-btn{left:auto; right:1px; top:auto; bottom:1px}
/* ---- C2 gap 5: show formulas (Ctrl+`) — formula text sits left like text, never a #### verdict ---- */
#grid td.fxshow{font-family:var(--mono); font-size:calc(var(--wb-fs) - 1.5px); text-align:left !important}

/* run R1 engine work: the status bar, the Name Box list, Formula AutoComplete, the expanded formula bar, a collapsed ribbon */
.sbar{display:flex; align-items:center; gap:14px; flex:0 0 auto; min-height:22px; padding:0 10px; border-top:1px solid var(--line); background:var(--surface2);
  font-family:var(--mono); font-size:calc(var(--wb-fs) - 2.5px); color:var(--muted); position:relative; user-select:none}
.sbar .sb-mode{color:var(--text)}
.sbar .sb-group{color:var(--accent)}
.sbar .sb-fill{flex:1 1 auto}
.sbar .sb-stats{display:flex; gap:14px}
.sbar .sb-stat b{color:var(--text); font-weight:600}
.fbar{position:relative; overflow:visible}   /* the Name Box list drops below it */
/* design-guard: keep the Name Box's list: Excel's own measurements */
.nb-list{position:absolute; left:0; top:100%; min-width:140px; background:var(--surface); border:1px solid var(--line); border-radius:0 0 6px 6px; padding:3px; z-index:25}
.nb-list[hidden]{display:none}
.nb-item{padding:2px 8px; border-radius:4px; color:var(--text); cursor:pointer}
.nb-item:hover{background:var(--accent-glow)}
/* design-guard: end */
.fbar.expanded .fcontent{white-space:pre-wrap; min-height:5.5em}   /* Ctrl+Shift+U opens the bar to several lines, as Excel's (E4) */
td.editing .ac-rest{background:var(--accent); color:var(--on-accent)}
/* design-guard: keep the in-cell autocomplete and the function argument ScreenTip: Excel's own measurements */
td.editing .ed-below{position:absolute; left:0; top:100%; display:flex; flex-direction:column; align-items:flex-start; gap:2px; z-index:8}
/* Formula AutoComplete (C19): the workspace menu shell (min --ws-menu-min), its rows the in-cell row at 22px in the Ribbon's
   12px Hanken Grotesk, the ink on the sheet (it was 15px rows of 11.5px mono, the tightest text on the platform) */
td.editing .ac-list{display:flex; flex-direction:column; min-width:var(--ws-menu-min); max-width:var(--ws-menu-max); box-sizing:border-box; background:var(--xl-body); font-family:var(--xl-font); font-size:var(--xl-fs); font-weight:var(--fw-body); text-align:left}
td.editing .ac-item{display:flex; align-items:center; height:var(--ws-cell-row-h); box-sizing:border-box; padding:0 var(--s2); border-radius:var(--kt-r); color:var(--xl-ink); line-height:1; white-space:nowrap}
/* the function argument ScreenTip (ui/formula-tip.js): Excel's small pale box under the cell, the caret's argument in bold;
   on the sheet's own tokens (light on every theme, as the sheet is), keyboard only (no pointer, never focus) */
td.editing .fx-tip{display:block; width:max-content; max-width:640px; padding:2px 6px; box-sizing:border-box; border-radius:3px; background:var(--fx-tip-bg); color:var(--ink); border:1px solid var(--line);
  box-shadow:var(--fx-tip-shadow); font-family:var(--font); font-weight:400; font-size:calc(var(--wb-fs) - 2px); line-height:1.3; text-align:left; white-space:nowrap; pointer-events:none; user-select:none}
td.editing .fx-tip b{font-weight:700; color:var(--ink)}
/* design-guard: end */
td.editing .ac-item.ac-name{font-style:italic}
td.editing .ac-item.on{background:var(--sel-grey); color:var(--xl-ink)}   /* the arrows' row: the workspace menu's keyboard highlight, the ink at 14% (controls 2d) */
.rib-collapsed .rf-body{display:none}
