/* The shared kit's styles (Round 2, item 2.1): kpiTile, dataChip, statusTag, compactList, scenarioPanel, aboutDrawer, screenHead.
   web/grammar.js builds the nodes; this file styles them from TOKENS ONLY. Below the END marker no rule may hold a colour literal
   (tests/test_grammar.py checks that), so a look re-skins every screen by setting the tokens in this block and nothing else.

   TOKEN CONTRACT (defaults = today's house values, so existing screens look the same):
     status marks   --st-bad-mark  --st-warn-mark  --st-ok-mark  --st-watch-mark   shape fills for Act now / This week / Fine / Watch
     mark ink       --st-*-on      text drawn ON a mark-coloured fill (stacked-bar segment labels)
     reference      --viz-ref      the "before" series: last year, plan, baseline (grey; wine is "now")
     surfaces       --surface-2    inset fill (bar tracks, hover rows)     --line-strong   a border that must be seen (buttons, switch off)
     tile           --k-radius --k-elev --k-rule --k-gap --k-pad --k-pill-radius
     figures        --f-num (font)  --k-num-feat (font-variant-numeric)  --k-tile-val-size  --k-tile-val-weight
     labels         --k-lbl-case (text-transform)  --k-lbl-size
     motion         --k-motion (duration of hover and switch transitions; 0s = none)
   Status TEXT keeps the house --bad / --warn / --ok (text contrast); MARKS use --st-*-mark.
   Marks validated with the dataviz validator 2026-10-16: light #B42318 / #C27A00 / #1E7A45 pass all five checks (worst colour-blind
   difference 8.0, normal vision 18.2, contrast 3:1 or better). Dark #F47A6E / #F2C14B / #5BC088 pass separation (9.3) and contrast; they sit
   above the validator's lightness band, which is acceptable only because every mark carries a shape and a word. Reference grey vs wine:
   light #7C7370, dark #6F655F (dark #A89F9B failed, red-blind difference 0.6). Dark watch grey = the reference grey. */
:root {
  --st-bad-mark: #B42318; --st-warn-mark: #C27A00; --st-ok-mark: #1E7A45; --st-watch-mark: #7C7370;
  --st-bad-on: #FFFFFF; --st-warn-on: #1E1A19; --st-ok-on: #FFFFFF; --st-watch-on: #FFFFFF;
  --viz-ref: #7C7370;
  --surface-2: var(--head); --line-strong: #8A9099;
  --k-radius: 0; --k-pill-radius: 14px; --k-elev: none; --k-rule: 1px; --k-gap: 10px; --k-pad: 11px 14px 10px;
  --f-num: var(--f-title); --k-num-feat: tabular-nums; --k-tile-val-size: 32px; --k-tile-val-weight: 700;
  --k-lbl-case: none; --k-lbl-size: 13.5px; --k-motion: .12s;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --st-bad-mark: #F47A6E; --st-warn-mark: #F2C14B; --st-ok-mark: #5BC088; --st-watch-mark: #6F655F;
  --st-bad-on: #1E1A19; --st-warn-on: #1E1A19; --st-ok-on: #1E1A19; --st-watch-on: #FFFFFF;
  --viz-ref: #6F655F; --line-strong: #5C5250; } }
:root[data-theme="dark"] {
  --st-bad-mark: #F47A6E; --st-warn-mark: #F2C14B; --st-ok-mark: #5BC088; --st-watch-mark: #6F655F;
  --st-bad-on: #1E1A19; --st-warn-on: #1E1A19; --st-ok-on: #1E1A19; --st-watch-on: #FFFFFF;
  --viz-ref: #6F655F; --line-strong: #5C5250; }
/* ==== END TOKEN CONTRACT: no colour literal below this line ==== */

/* ---- screen head ---------------------------------------------------------------------------------------------------- */
.g-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.g-head .gn-title { font-size: 28px; }
.g-spacer { flex: 1 1 auto; }
.g-head .per { font: 600 13px/1.2 var(--f-body); color: var(--muted); font-variant-numeric: var(--k-num-feat); white-space: nowrap; }
.g-head .g-headline { flex: 1 1 100%; margin: 2px 0 0; font: 600 19px/1.35 var(--f-body); color: var(--ink); }
.g-answer { margin: 6px 0 0; font: 600 19px/1.35 var(--f-body); color: var(--ink); max-width: 1100px; }
.g-answer .n { font-variant-numeric: var(--k-num-feat); white-space: nowrap; }
.g-btn { font: 600 13px/1 var(--f-body); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--k-radius); padding: 7px 11px; cursor: pointer; white-space: nowrap; transition: border-color var(--k-motion), color var(--k-motion); }
.g-btn:hover { border-color: var(--gn-wine); color: var(--gn-wine); }
.g-btn.primary { border-color: var(--gn-wine); color: var(--gn-wine); }
.g-btn[disabled] { opacity: .5; cursor: default; }
.g-ask { font: 600 13px/1 var(--f-body); color: var(--gn-wine); background: var(--surface); border: 1px solid var(--gn-wine); border-radius: var(--k-pill-radius); padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.g-seg { display: inline-flex; border: var(--k-rule) solid var(--line); border-radius: var(--k-radius); overflow: hidden; }
.g-seg button { font: 600 13px/1 var(--f-body); color: var(--ink); background: var(--surface); border: 0; border-right: 1px solid var(--line); padding: 7px 11px; cursor: pointer; }
.g-seg button:last-child { border-right: 0; }
.g-seg button[aria-pressed="true"] { background: var(--gn-wine-soft); color: var(--gn-wine); }

/* ---- data chip and Scenario tag: one freshness signal per screen --------------------------------------------------------- */
.g-chip, .g-scn-tag { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font: 600 13px/1 var(--f-body); padding: 6px 10px; border-radius: var(--k-pill-radius); border: var(--k-rule) solid var(--line); background: var(--surface); color: var(--ink); max-width: 100%; }
.g-chip svg { width: 13px; height: 13px; flex: none; }
.g-chip.current { border-color: var(--ok); } .g-chip.current svg { color: var(--st-ok-mark); }
.g-chip.behind { border-color: var(--warn); background: var(--warn-soft); } .g-chip.behind svg { color: var(--st-warn-mark); }
.g-chip.held { border-color: var(--bad); background: var(--bad-soft); } .g-chip.held svg { color: var(--st-bad-mark); }
.g-chip.unknown { border-color: var(--line-strong); } .g-chip.unknown svg { color: var(--st-watch-mark); }
.g-scn-tag { border-color: var(--gn-wine); background: var(--gn-wine-soft); color: var(--gn-wine); }
.g-scn-tag[hidden] { display: none; }

/* ---- status tag: shape + word, never colour alone ---------------------------------------------------------------------- */
.g-st { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font: 600 13px/1 var(--f-body); }
.g-st svg { width: 11px; height: 11px; flex: none; }
.g-st.bad svg { color: var(--st-bad-mark); } .g-st.warn svg { color: var(--st-warn-mark); } .g-st.ok svg { color: var(--st-ok-mark); } .g-st.watch svg { color: var(--st-watch-mark); }
.g-st.bad { color: var(--bad); } .g-st.warn { color: var(--warn); } .g-st.ok { color: var(--ok); } .g-st.watch { color: var(--muted); }
.g-st.off { outline: 1px dashed var(--bad); outline-offset: 2px; }   /* a word the table does not allow: visible in review, still rendered */

/* ---- tiles ------------------------------------------------------------------------------------------------------------- */
.g-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--k-gap); margin-top: 14px; }
.g-tile { position: relative; background: var(--surface); border: var(--k-rule) solid var(--line); border-radius: var(--k-radius); box-shadow: var(--k-elev); padding: var(--k-pad); display: grid; align-content: start; gap: 3px; min-width: 0; container-type: inline-size; transition: border-color var(--k-motion); }
.g-tile.click { cursor: pointer; }
.g-tile.click:hover { border-color: var(--gn-wine); }
.g-tile .lbl { display: flex; align-items: center; gap: 6px; padding-right: 22px; font: 600 var(--k-lbl-size)/1.2 var(--f-body); text-transform: var(--k-lbl-case); color: var(--muted); }
.g-tile .lbl .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-tile .lbl svg { width: 11px; height: 11px; flex: none; }
.g-tile .lbl .bad { color: var(--st-bad-mark); } .g-tile .lbl .warn { color: var(--st-warn-mark); } .g-tile .lbl .ok { color: var(--st-ok-mark); } .g-tile .lbl .watch { color: var(--st-watch-mark); }
.g-tile .val { font: var(--k-tile-val-weight) min(var(--k-tile-val-size), 15cqw)/1.05 var(--f-num); color: var(--gn-cocoa); font-variant-numeric: var(--k-num-feat); white-space: nowrap; }
.g-tile .sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-tile .dlt { font: 600 13px/1.2 var(--f-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-tile .dlt.good { color: var(--ok); } .g-tile .dlt.bad { color: var(--bad); } .g-tile .dlt.flat { color: var(--muted); }
.g-tile .dlt .vs { color: var(--muted); font-weight: 400; }
.g-tile .per { font: 500 12.5px/1.25 var(--f-body); color: var(--muted); font-variant-numeric: var(--k-num-feat); overflow-wrap: anywhere; }
.g-tile .nocmp { font: 400 12.5px/1.25 var(--f-body); color: var(--muted); overflow-wrap: anywhere; }
/* Round Range (R2) layout of the period line: look B keeps its air, but not between the lines of a tile that now carries a period and a comparison, so the first chart stays in the first view at 1440 x 1100 (tests/test_text_budget.py, Today, look b) */
html[data-look="b"] .g-tile:has(> .per) { gap: 3px; padding-block: 12px; }
html[data-look="b"] .g-tile:has(> .per) .val { margin-top: 2px; }
html[data-look="b"] .g-tile:has(> .per) .spark svg { max-height: 28px; }
.g-answer .per { font: 400 12.5px/1.25 var(--f-body); color: var(--muted); font-variant-numeric: var(--k-num-feat); white-space: nowrap; margin-left: 8px; }
.g-tile .was { font-size: 12.5px; color: var(--muted); font-variant-numeric: var(--k-num-feat); }
.g-tile .q { position: absolute; top: 8px; right: 9px; width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: 700 11px/16px var(--f-body); text-align: center; cursor: pointer; }
.g-tile .q:hover { border-color: var(--gn-wine); color: var(--gn-wine); }
html[data-ask="off"] .g-tile .q { display: none; }
.g-tile .spark { min-height: 24px; }
.g-mini { height: 22px; display: block; }
.g-mini .bar { fill: var(--viz-1, var(--gn-wine)); } .g-mini .ref { stroke: var(--viz-ref); stroke-width: 2; } .g-mini .trk { fill: var(--surface-2); }
/* A re-render that changes a tile's value rings it for about two seconds. The ring is not motion, so it stays under reduced-motion; only the fade is dropped. */
.g-tile.g-changed { box-shadow: 0 0 0 2px var(--gn-wine); animation: g-flash 2s ease-out; }
@keyframes g-flash { from { background: var(--gn-wine-soft); } to { background: var(--surface); } }
@media (prefers-reduced-motion: reduce) { .g-tile.g-changed { animation: none; } .g-tile, .g-btn, .g-sw::after { transition: none; } }

/* ---- charts rows and panels -------------------------------------------------------------------------------------------- */
.g-row { display: grid; gap: 12px; margin-top: 14px; align-items: start; }
.g-row.c75 { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.g-row.c66 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.g-row > .gn-chart, .g-row > .g-panel { margin: 0; }
@media (max-width: 760px) { .g-row.c75, .g-row.c66 { grid-template-columns: minmax(0, 1fr); } }
.g-panel { background: var(--surface); border: var(--k-rule) solid var(--line); border-radius: var(--k-radius); box-shadow: var(--k-elev); padding: 12px 14px; min-width: 0; }
.g-panel h3 { font: 700 15px/1.2 var(--f-title); color: var(--gn-cocoa); text-transform: uppercase; letter-spacing: .02em; margin: 0 0 8px; }
.g-panel h3 small { font: 400 13px var(--f-body); color: var(--muted); text-transform: none; letter-spacing: 0; margin-left: 6px; }

/* ---- compact list ------------------------------------------------------------------------------------------------------ */
.g-list { width: 100%; border-collapse: collapse; font-size: 13.5px; table-layout: auto; }
.g-list td { border-top: 1px solid var(--line); padding: 6px 6px; vertical-align: middle; white-space: nowrap; }
.g-list tr:first-child td { border-top: 0; }
.g-list td.step { white-space: normal; overflow-wrap: anywhere; line-height: 1.3; max-width: 0; width: 100%; }   /* Round 2 fix pass (M3): a step wraps to a second line, it is never cut with an ellipsis */
.g-list td.step a { color: inherit; text-decoration: underline dotted; text-underline-offset: 2px; }   /* a record named in a step: a link (W4, F1), shown as one */
.g-list td.own { color: var(--muted); text-align: right; }
.g-more { display: inline-block; margin-top: 8px; font-weight: 600; font-size: 13.5px; }
@media (max-width: 560px) { .g-list td.own { display: none; } }

/* ---- scenario panel ---------------------------------------------------------------------------------------------------- */
.g-scn { background: var(--surface); border: var(--k-rule) solid var(--line); border-top: 3px solid var(--gn-wine); border-radius: var(--k-radius); box-shadow: var(--k-elev); padding: 12px 14px; margin-top: 14px; }
.g-scn-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.g-scn-head h3 { font: 700 15px/1.2 var(--f-title); color: var(--gn-cocoa); text-transform: uppercase; letter-spacing: .02em; margin: 0; }
.g-scn-res { margin-left: auto; font: 700 20px/1.1 var(--f-num); font-variant-numeric: var(--k-num-feat); color: var(--gn-cocoa); white-space: nowrap; }
.g-scn-res .was { font: 400 13px var(--f-body); color: var(--muted); margin-left: 6px; }
.g-lev { display: grid; grid-template-columns: 44px minmax(0, 1fr) 96px 200px; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.g-lev:first-of-type { border-top: 0; }
.g-lev.off .what, .g-lev.off .eff { color: var(--muted); }
.g-lev .what { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-lev .what b { font-weight: 600; }
.g-lev .eff { font: 600 14px var(--f-body); text-align: right; font-variant-numeric: var(--k-num-feat); }
.g-sw { width: 38px; height: 22px; border-radius: 11px; background: var(--line-strong); position: relative; border: 0; padding: 0; cursor: pointer; }
.g-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); transition: left var(--k-motion); }
.g-sw[aria-checked="true"] { background: var(--gn-wine); }
.g-sw[aria-checked="true"]::after { left: 19px; }
.g-lev svg { width: 200px; max-width: 100%; height: 14px; display: block; }
.g-lev .zero { stroke: var(--line); stroke-width: 1; }
.g-lev .pos, .g-lev .neg { fill: var(--viz-1, var(--gn-wine)); } .g-lev.off .pos, .g-lev.off .neg { fill: var(--viz-ref); opacity: .55; }
.g-scn-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 9px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.g-sens { margin-left: auto; }
@media (max-width: 640px) { .g-lev { grid-template-columns: 44px minmax(0, 1fr) auto; } .g-lev svg { grid-column: 1 / -1; width: 100%; } }

/* ---- About this number drawer ------------------------------------------------------------------------------------------ */
.g-about-scrim { position: fixed; inset: 0; z-index: 60; }
.g-about { position: fixed; top: 0; right: 0; bottom: 0; z-index: 61; width: min(460px, 100vw); overflow: auto; background: var(--surface); color: var(--ink); border-left: var(--k-rule) solid var(--line-strong); box-shadow: var(--k-elev); padding: 16px 18px 28px; }
.g-about[hidden], .g-about-scrim[hidden] { display: none; }
.g-about-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.g-about-head h2 { font: 700 18px/1.2 var(--f-title); color: var(--gn-cocoa); text-transform: uppercase; letter-spacing: .02em; margin: 0; flex: 1 1 auto; }
.g-about h3 { font: 700 13px/1.2 var(--f-body); color: var(--gn-wine); text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.g-about .note { margin: 0 0 10px; }
.g-about .note .at { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.g-about .note p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- one screen on the kit; layout by the screen's own width (Round 2: items 2.3 and 2.5) ------------------------------------ */
/* .g-screen is the screen's wrapper. Its width is what the content gets, not the window's: with the Ask panel open the same window gives the
   screen 600 to 800 px. Below 1,100 px of content width the five tiles wrap 3 + 2 and the chart rows stack; below 560 px the tiles go two across. */
.g-screen { container-type: inline-size; min-width: 0; }
.screen-head:has(+ .screen-body .g-screen) { display: none; }       /* the shell's own title row gives way to the screen's screenHead */
.g-row.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@container (max-width: 1099px) {
  .g-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-row.c75, .g-row.c66, .g-row.c3 { grid-template-columns: minmax(0, 1fr); }
}
@container (max-width: 559px) { .g-tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }
.g-tile .sub.wrap { white-space: normal; overflow: visible; text-overflow: clip; }
.g-tile .dlt a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.g-bars-click .gn-hit { cursor: pointer; }
.g-list tr.click { cursor: pointer; }
.g-list tr.click:hover td { background: var(--surface-2); }
.g-list tr.click:focus-visible { outline: 2px solid var(--gn-wine); outline-offset: -2px; }
.g-foot { margin-top: 14px; }
.g-wrap, .g-wrap * { overflow-wrap: anywhere; }
.g-row.even { align-items: stretch; }
@container (max-width: 235px) { .g-tile .dlt, .g-tile .sub { white-space: normal; overflow: visible; text-overflow: clip; } }   /* a narrow tile wraps its lines instead of cutting them */

/* ---- Today: What I'd do today (Round I, item 1): one summary row per move, the detail in the row's disclosure. Tokens only. ---------------------- */
.g-moves { margin-top: 14px; padding: 10px 14px 8px; }
.g-moves h3 { margin-bottom: 4px; }
.g-mv-list { list-style: none; margin: 0; padding: 0; }
.g-mv-list > li { border-top: 1px solid var(--line); }
.g-mv-list > li:first-child { border-top: 0; }
.g-move > summary { display: grid; grid-template-columns: 14px 56px minmax(0, 1fr) 148px 240px 12px; align-items: baseline; column-gap: 10px; row-gap: 2px; padding: 6px 2px; cursor: pointer; list-style: none; font-size: 13.5px; line-height: 1.3; }
.g-move > summary::-webkit-details-marker { display: none; }
.g-move > summary::after { content: '\203A'; grid-column: 6; grid-row: 1; justify-self: end; color: var(--muted); font-weight: 700; }
.g-move[open] > summary::after { transform: rotate(90deg); }
.g-move > summary:hover { background: var(--surface-2); }
.g-move > summary:focus-visible { outline: 2px solid var(--gn-wine); outline-offset: -2px; }
.g-mv-lv { display: inline-flex; align-self: start; margin-top: 4px; }
.g-mv-lv svg { width: 11px; height: 11px; }
.g-mv-lv.bad { color: var(--st-bad-mark); } .g-mv-lv.warn { color: var(--st-warn-mark); } .g-mv-lv.watch { color: var(--st-watch-mark); } .g-mv-lv.ok { color: var(--st-ok-mark); }
.g-mv-who { font-weight: 700; color: var(--ink); }
.g-mv-act { min-width: 0; overflow-wrap: anywhere; }
.g-mv-note { display: block; margin-top: 1px; font-size: 12.5px; color: var(--muted); }
.g-moves .g-mv-left { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.g-left { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }   /* polish-3 T1: "1 left out: SO19666 closed in NetSuite ..." under a Blocking list */
.g-left a { color: inherit; text-decoration: underline dotted; text-underline-offset: 2px; }
.g-mv-tail { display: contents; }
.g-mv-cons { white-space: nowrap; font-family: var(--f-num); font-variant-numeric: var(--k-num-feat); font-size: 12.5px; }
.g-mv-usd { font-weight: 700; }
.g-mv-date { color: var(--muted); margin-left: 6px; }
.g-mv-ev { display: flex; flex-wrap: wrap; gap: 0 8px; align-items: baseline; font-size: 12.5px; }
.g-mv-ev a { color: inherit; text-decoration: underline dotted; text-underline-offset: 2px; }
.g-mv-rest { color: var(--muted); }
.g-mv-body { padding: 2px 2px 10px 24px; font-size: 13px; line-height: 1.4; color: var(--ink); }
.g-mv-body p { margin: 3px 0; max-width: 96ch; }
.g-mv-evs { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); }
.g-mv-evs li { margin: 2px 0; }
.g-mv-body a { color: inherit; text-decoration: underline dotted; text-underline-offset: 2px; }
@container (max-width: 899px) {
  .g-move > summary { grid-template-columns: 14px auto minmax(0, 1fr) 12px; }
  .g-move > summary::after { grid-column: 4; }
  .g-mv-tail { display: flex; flex-wrap: wrap; gap: 2px 14px; grid-column: 2 / 4; align-items: baseline; }
  .g-mv-body { padding-left: 2px; }
}

/* ---- Staged requests (Round I, item 3): the payload disclosure under a request's state. Tokens only. ------------------------------------------ */
.stg-payload { margin-top: 4px; }
.stg-payload > summary { cursor: pointer; }
.stg-payload > summary:focus-visible { outline: 2px solid var(--gn-wine); outline-offset: 2px; }
.stg-payload .raw-json { max-width: 52ch; max-height: none; }   /* the whole payload, not a scroll box: it is the exact thing that would go */

/* ---- Buy and Ship: What matters (Round I, item 2): one chart and at most three lines under the desk's run strip. Tokens only. -------------------- */
.g-matters { padding: 10px 14px 10px; }
.g-mt-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.g-mt-head h3 { margin: 0; flex: 1 1 auto; }
.g-matters .gn-chart, .g-matters figure { margin: 0 0 6px; }
.g-mt-lines { list-style: none; margin: 4px 0 0; padding: 0; font-size: 13.5px; line-height: 1.4; }
.g-mt-lines li { padding: 2px 0; }
.g-matters .w5-clickable .gn-hit { cursor: pointer; }

/* ---- ui-1 G: the page never scrolls sideways and nothing is cut. Wrap, shrink, and let a wide table scroll in its own box. ------------------- */
/* A screen's one-column stack may shrink to the window (an implicit grid column is min-content wide, so one wide table stretched the notes and filters above it). */
.cl-wrap, .in-wrap, .tp-wrap, .rh-wrap, .lo-wrap, .ob-wrap { grid-template-columns: minmax(0, 1fr); }
.cl-wrap > *, .in-wrap > *, .tp-wrap > *, .rh-wrap > *, .lo-wrap > *, .ob-wrap > * { min-width: 0; }
#main .pm-sec { grid-template-columns: minmax(0, 1fr); }      /* Model > Profit: the table sections shrink to the window (a heading was 566 px wide on a 390 px phone) */
/* A table too wide for the window scrolls inside its own box; the shadow at the edge says there is more (it hides when the box is scrolled to that end). */
.g-hscroll, .w5-scroll {
  overflow-x: auto; max-width: 100%; scrollbar-width: thin;
  background-color: var(--surface);
  background-image: linear-gradient(to right, var(--surface), var(--surface)), linear-gradient(to left, var(--surface), var(--surface)),
    linear-gradient(to right, color-mix(in srgb, var(--ink) 26%, var(--surface)), var(--surface)), linear-gradient(to left, color-mix(in srgb, var(--ink) 26%, var(--surface)), var(--surface));
  background-position: left center, right center, left center, right center;
  background-size: 22px 100%, 22px 100%, 12px 100%, 12px 100%;
  background-repeat: no-repeat; background-attachment: local, local, scroll, scroll;
}
/* A record number (SO, PO, TO) never breaks in the middle of the number. */
td.nw, td.nw a, td.id, td.lo-sos a, td.ob-sos a, .g-recno { white-space: nowrap; }
/* Tile title, caption and change line wrap to a second line rather than run under the "?" or end in "...". */
.g-tile .lbl { align-items: flex-start; }
.g-tile .lbl .t { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.g-tile .sub, .g-tile .dlt { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
/* The goal-bar value (a long "value against target" text) wraps; on a phone the bar drops under its label and value. */
#main .gn-bullet.gn-chart .gn-bullet-val { white-space: normal; min-width: 0; overflow-wrap: anywhere; text-align: right; }
#main .gn-bullet.gn-chart .gn-bullet-label { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  #main .gn-bullet.gn-chart { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
  #main .gn-bullet.gn-chart .gn-bullet-label { grid-area: 1 / 1; }
  #main .gn-bullet.gn-chart .gn-bullet-val { grid-area: 1 / 2; }
  #main .gn-bullet.gn-chart .gn-bullet-bar { grid-area: 2 / 1 / 3 / -1; }
  /* four stacked control rows above the first number become two: label and field pairs sit two to a row */
  .cl-filters, .in-bar, .tp-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; align-items: end; }
  .cl-filters label, .in-bar label, .tp-bar label { min-width: 0; }
  .cl-filters select, .cl-filters input, .in-bar select, .tp-bar input { width: 100%; min-width: 0; box-sizing: border-box; }
  .cl-filters > .cl-meta, .in-bar > .in-meta, .tp-bar > .tp-meta { grid-column: 1 / -1; }
  .g-hscroll > table, .g-hscroll > .gn-table-wrap > table { min-width: 720px; }      /* a wide list keeps its columns readable and scrolls in its own box, instead of squeezing a word per line */
  #main .w5-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
  #main .w5-filters label { min-width: 0; }
  #main .w5-filters select, #main .w5-filters input[type=search], #main .w5-filters input[type=text] { width: 100%; max-width: none; min-width: 0; box-sizing: border-box; }
  #main .w5-filters .w5-count { grid-column: 1 / -1; margin-left: 0; }
}
