/* Trueread Weather Intelligence: the portal shell and its shared components (base.html and the pages on it).
   The sign-in, sign-up and legal pages have their own stylesheet (auth.css) and do not load this one.
   Trueread Noir: a near-black ground, monochrome greys, white type, and colour only on a reading
   (Sodium above usual, Mercury below). No sky, no glass, no blur, no shadows; hairlines, not boxes.
   The brand is brand/noir/README.md in the Trueread repo; its tokens are static/noir-tokens.css (an exact copy)
   and its three typefaces are static/fonts/noir-fonts.css. Link both before this file.
   Every token here is read through the portal's own names below, each with its Noir value as a fallback, so a page
   that links this file without noir-tokens.css still draws in Noir (only the Daylight and print switches need it).
   The class contract for page builders is docs/portal-classes.md.
   Page-specific rules belong in portal-a.css and portal-b.css, not here.

   Faces: Mona Sans for words and big figures, Red Hat Mono for labels, column heads and figures in rows,
   Newsreader only for one word on a visual (not used by the shell).
   Corners: 2px on buttons, fields and tags; panels, tiles, bars and the menu are square.
   Focus: a 2px ring in --tr-focus, 2px off, on everything. */

/* ---------------------------------------------------------------- tokens */
/* The portal's own names, mapped to the Noir role tokens, so a page stylesheet written against the old names
   (forecast.css, day.css, ticks.css ...) picks up Noir without changes. Each one falls back to its Noir value if
   noir-tokens.css is missing. Declared wherever a theme can be set, so a [data-theme] subtree maps too. */
:root, [data-theme], [data-tr-surface] {
  --ground: var(--tr-bg, #050505);              /* Void: the page */
  --panel: var(--tr-surface, #0D0D0E);          /* Carbon: panels and the phone menu */
  --primary-fill: var(--tr-primary, #F2F2F0);   /* the one White button of a view */
  --primary-hover: var(--tr-primary-hover, #CDCECF);
  --sky-top: var(--tr-bg, #050505);             /* retired: the sky is gone; kept so old rules still resolve */
  --sky-bottom: var(--tr-bg, #050505);
  --text: var(--tr-text, #F2F2F0);              /* White: headings, figures, the words that matter */
  --body: var(--tr-text-body, #CDCECF);         /* Silver: sentences */
  --muted: var(--tr-text-2, #9FA1A3);           /* Smoke: labels, meta, help, sources */
  --faint: var(--tr-ref, #737578);              /* Ash: decoration and reference marks only. Never words */
  --ink: var(--tr-on-primary, #050505);         /* text on White: the primary button, a ticked box, roster bars */
  --glass: var(--panel);                        /* a panel (was frosted glass; now Carbon, solid) */
  --glass-deep: var(--panel);                   /* the phone menu */
  --edge: var(--tr-line, #242526);              /* the rim of a panel */
  --line: var(--tr-line, #242526);              /* hairlines between groups */
  --line-strong: var(--tr-line-strong, #343537);/* the top of a list, axes */
  --outline: var(--tr-field-edge, #68696B);     /* the edge of a field, the quiet button and a pill */
  --hover: var(--tr-well, #161718);             /* a row or item under the pointer */
  --tile: var(--tr-well, #161718);              /* a selected row, an inner fill */
  --field: var(--tr-well, #161718);             /* inside a field */
  --selected: var(--tr-well, #161718);          /* the page you are on, in the menu */
  --pin: var(--panel);                          /* a panel's colour, solid, behind a pinned table column */
  --scrim: rgba(5, 5, 5, .72);                  /* behind the menu on small screens */
  --frost: none;                                /* retired: no blur in Noir. backdrop-filter: var(--frost) does nothing */

  /* Readings. Sodium and Mercury mean busier and quieter (above and below the usual) and nothing else. */
  --busier: var(--tr-above, #E3832E);
  --quieter: var(--tr-below, #8FB3CF);
  --about: var(--tr-about, #737578);            /* within the usual band; graphics only */
  /* Noir has no green and no red: done and failed are said in words, in White. */
  --good: var(--tr-text, #F2F2F0);
  --bad: var(--tr-text, #F2F2F0);

  /* Roster bars: three steps of grey, none of them a reading colour. Text on them is --ink (6.3:1 or more). */
  --role-1: #F2F2F0;
  --role-2: #BFC0C2;
  --role-3: #8E9092;
}
:root {
  --sans: var(--tr-font-sans, "Mona Sans", "Helvetica Neue", Arial, system-ui, sans-serif);
  --mono: var(--tr-font-mono, "Red Hat Mono", ui-monospace, Menlo, Consolas, monospace);
  --serif: var(--tr-font-serif, "Newsreader", Georgia, serif);
  --radius: var(--tr-radius, 2px);
  --curve: var(--tr-ease, cubic-bezier(0.16, 1, 0.3, 1));
  --pad: 24px;          /* the inset of a panel's contents; 16px on phones and inside tiles */
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ground); color: var(--text); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--body); font-family: var(--sans); font-size: 14px; line-height: 20px; font-weight: 400;
  font-stretch: 100%; font-kerning: normal; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
h1, h2, h3 { font-size: inherit; line-height: inherit; font-weight: 500; color: var(--text); text-wrap: balance; }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--outline); text-decoration-thickness: 1px; text-underline-offset: 3px;
  transition: text-decoration-color var(--tr-dur-1, 120ms) linear, color var(--tr-dur-1, 120ms) linear; }
a:hover { text-decoration-color: currentColor; }
b, strong { font-weight: 600; }
/* Bold words in a Silver or Smoke sentence step up to White. Direct children only, so a bold figure inside a
   reading (a .busier or .quieter span) keeps its colour. */
:is(.prose, .note, .empty, .help, .figure-sub, p.empty, .content > .note) > :is(b, strong) { color: var(--text); }
::selection { background: var(--text); color: var(--ground); }
:focus-visible { outline: 2px solid var(--tr-focus, #F2F2F0); outline-offset: 2px; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: square; stroke-linejoin: miter; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip { position: absolute; left: 12px; top: -96px; z-index: 60; padding: 12px 16px; border-radius: var(--radius); background: var(--primary-fill); color: var(--ink);
  font-weight: 500; text-decoration: none; }
.skip:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------------------------------------------------------------- panels */
/* A panel is a square Carbon sheet with a hairline rim. Inside a panel use .tile (a ruled frame, no fill) for a box
   within the box, never a second panel. Sentences placed straight in .content get a sheet of their own. */
.panel, .section, .figures, .content > :is(.prose, .note, .empty) {
  min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 0; }
.tile { min-width: 0; border: 1px solid var(--line); background: transparent; --pad: 16px; }

/* ---------------------------------------------------------------- type roles */
/* Section headings. */
.section-head h2 { font-size: 16px; line-height: 24px; font-weight: 500; color: var(--text); }
/* Labels (Red Hat Mono 12, Smoke, sentence case): column headers, the label above a figure, group labels in the
   menu and in tables. The kit's § and (01) labels use .label. */
table.grid thead th, table.grid tr.group th, .figure-label, .side-label, .label {
  font-family: var(--mono); font-size: 12px; line-height: 16px; font-weight: 400; letter-spacing: .02em; color: var(--muted); }
.label b { font-weight: 400; color: var(--text); }
/* Explanatory sentences: page notes, empty states, help under fields. */
.prose, .empty p, p.empty { color: var(--body); text-wrap: pretty; }
.prose { max-width: 72ch; font-size: 15px; line-height: 24px; }
.help, .field .hint { color: var(--muted); font-size: 13px; line-height: 20px; text-wrap: pretty; }
.prose a, .empty a, .help a, .note a { color: var(--text); }
/* The wordmark: the mark (two square bars and the reading dot, in White) and "Trueread" in Mona Sans 500, semi-wide. */
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 19px; line-height: 24px; font-weight: 500;
  font-stretch: 112.5%; letter-spacing: -0.01em; text-decoration: none; }
.wordmark:hover { text-decoration: none; }
.wordmark svg { display: block; width: 34px; height: 34px; flex: none; fill: currentColor; }

/* Figures line up: tabular numerals wherever numbers are compared down a column or across a row. */
table.grid, .num, .figures, .change, .section-foot, input, select { font-variant-numeric: tabular-nums; }

/* small helpers */
.num { text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.strong { font-weight: 500; color: var(--text); }
.nowrap { white-space: nowrap; }
.grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.scroll { overflow-x: auto; }
.scroll:focus-visible { outline-offset: -2px; }   /* a scrolling region runs to the panel's edge, so its ring sits inside */
.scroll, .side { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* ---------------------------------------------------------------- shell */
/* The menu is a column at the left with a hairline at its edge; the top bar and the page share the rest. */
body.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

.side { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column; padding: 20px 12px 16px; background: var(--ground); border-right: 1px solid var(--line); }
.side-head { position: relative; display: grid; gap: 14px; padding: 0 12px 24px; }
.side-head .wordmark { justify-self: start; }
/* "§ 01  Weather Intelligence": the offering's section number, then its name in White. */
.side-tag { display: flex; flex-wrap: wrap; gap: 2px 10px; font-family: var(--mono); font-size: 12px; line-height: 16px; letter-spacing: .02em; color: var(--muted); }
.side-tag b { font-weight: 400; color: var(--text); }
.side-nav, .side-foot nav { display: grid; gap: 2px; }
.side-label { padding: 20px 12px 8px; }
.side form { margin: 0; }
.side .item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 8px 12px;
  border: 0; border-radius: var(--radius); background: none; color: var(--muted);
  font: inherit; font-weight: 400; text-align: left; text-decoration: none; cursor: pointer;
  transition: background-color var(--tr-dur-1, 120ms) linear, color var(--tr-dur-1, 120ms) linear; }
.side .item:hover { background: var(--hover); color: var(--text); }
/* The page you are on: White words on Gunmetal, with a White rule at the left edge. */
.side .item.on { background: var(--selected); color: var(--text); box-shadow: inset 2px 0 0 var(--text); }
.side .item.current { color: var(--text); }                            /* the venue you are in */
.side .item:focus-visible { outline-offset: -2px; }
.side-foot { margin-top: auto; }
.side-user { display: grid; gap: 2px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.side-email { padding: 8px 12px 4px; font-family: var(--mono); font-size: 12px; line-height: 16px; letter-spacing: .02em; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.side-close { display: none; position: absolute; top: 0; right: 0; }
/* The word "Demo" beside a venue's name: a mono label in brackets, so it can't read as part of the name. */
.demo-word { display: inline-block; color: var(--muted); font-family: var(--mono); font-size: 12px; line-height: 16px; font-weight: 400; letter-spacing: .02em;
  white-space: nowrap; }
.demo-word::before { content: "("; }
.demo-word::after { content: ")"; }
.side .item .demo-word { margin-left: auto; }
.side .item:hover .demo-word, .side .item.on .demo-word { color: var(--body); }

.scrim { display: none; }   /* shown only behind the menu on small screens */
.main { min-width: 0; display: flex; flex-direction: column; }
/* The top bar: Void, a hairline under it, and it stays in view. Solid, because the page scrolls beneath it. */
.top { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  min-height: 72px; padding: 12px 32px; background: var(--ground); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 22px; line-height: 28px; font-weight: 400; font-stretch: 112.5%; letter-spacing: -0.01em; color: var(--text); }
.top form { margin: 0; }
.top .actions { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn.menu-btn { display: none; }
/* Status and context beside the title: plain words with a middle dot between them, in Smoke. A status here is
   said in White, never in a reading colour: "Updating" or "Up to date" is not a reading. */
.context { display: flex; flex-wrap: wrap; align-items: baseline; min-width: 0; color: var(--muted); }
.context > * + *:not(.demo-word)::before { content: "\00B7"; margin: 0 10px; color: var(--faint); }
.context > .demo-word { margin-left: 8px; }   /* "(Demo)" keeps its brackets instead of taking the dot */
.context .where { white-space: nowrap; }
.context .venue-name { color: var(--text); font-weight: 500; }
.context :is(.busier, .quieter, .good, .bad) { color: var(--text); }

.content { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; padding: 24px 32px 48px; }
.content.narrow { width: 100%; max-width: 872px; }   /* 808px of page, plus the gutters */
.content:focus { outline: none; }
.content > :is(.prose, .note) { max-width: none; padding: 14px var(--pad); }
.content > .prose { padding-top: 16px; padding-bottom: 16px; }
.content > .note { padding-left: calc(var(--pad) + 20px); }
.content > .note::before { left: var(--pad); }

/* ---------------------------------------------------------------- panels and sections */
/* A section is one panel: a heading, then a body. A table or list in it runs edge to edge. */
.section, .panel { overflow: hidden; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; padding: 20px var(--pad) 0; }
.section-head .aside { margin-left: auto; color: var(--muted); font-size: 14px; line-height: 20px; font-weight: 400; }
.section-head .aside b { color: var(--text); font-weight: 500; }
.section-body { padding: 16px var(--pad) 24px; }
.section-body.flush { padding: 8px 0; }
.section-body + .section-body { padding-top: 8px; }
.section-body > p + p { margin-top: 8px; }
.section-body:not(.flush) > .scroll { margin-left: calc(var(--pad) * -1); margin-right: calc(var(--pad) * -1); }
.section > .empty { padding: 16px var(--pad) 24px; }
/* Totals strip under a table or a timeline: on a hairline, figures in White. */
.section-foot { display: flex; flex-wrap: wrap; gap: 4px 24px; padding: 12px var(--pad); border-top: 1px solid var(--line); color: var(--muted); }
.section-foot b { color: var(--text); font-weight: 500; }
/* A disclosure at the foot of a section or tile. */
details.more summary { display: flex; align-items: center; gap: 10px; padding: 12px var(--pad); color: var(--muted); font-weight: 500; cursor: pointer; list-style: none;
  transition: color var(--tr-dur-1, 120ms) linear; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: ""; flex: none; width: 7px; height: 7px; border: solid currentColor; border-width: 0 1.5px 1.5px 0;
  transform: translateY(-2px) rotate(45deg); transition: transform var(--tr-dur-3, 480ms) var(--curve); }
details.more[open] summary::before { transform: translateY(2px) rotate(-135deg); }
details.more summary:hover { color: var(--text); }
details.more summary:focus-visible { outline-offset: -2px; }

/* ---------------------------------------------------------------- figures (a row of headline numbers in one panel) */
/* Mona Sans 300, semi-wide, tabular: the big figures of a view. Their labels are mono, their notes Smoke. */
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 32px; padding: 24px var(--pad); }
.figure { min-width: 0; }
.figure-value { margin-top: 12px; color: var(--text); font-size: clamp(32px, 2.6vw, 40px); line-height: 1.1; font-weight: 300; font-stretch: 112.5%;
  letter-spacing: -0.02em; overflow-wrap: anywhere; }
.figure-sub { margin-top: 8px; color: var(--muted); text-wrap: balance; }

/* ---------------------------------------------------------------- tables */
/* No box of their own: a table sits in a panel and runs to its edges. Heads are mono labels over a Seam rule;
   rows are split by Rule hairlines; figures in rows are Red Hat Mono in White. */
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; }
table.grid th, table.grid td { padding: 12px; text-align: left; vertical-align: middle; font-weight: 400; }
table.grid :is(th, td):first-child { padding-left: var(--pad); }
table.grid :is(th, td):last-child { padding-right: var(--pad); }
table.grid thead th { padding-top: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; vertical-align: bottom; }
table.grid tbody :is(td, th) { border-bottom: 1px solid var(--line); }
table.grid tbody th { color: var(--text); }
table.grid:not(:has(tfoot)) tbody tr:last-child > * { border-bottom-color: transparent; }
table.grid tbody tr:hover > * { background-color: var(--hover); }
table.grid tr.on > * { background-color: var(--tile); }   /* the selected row */
table.grid tr.on > :first-child { box-shadow: inset 2px 0 0 var(--text); }
table.grid th.num, table.grid td.num { text-align: right; }
table.grid tbody td.num, table.grid tfoot td.num { font-family: var(--mono); color: var(--text); }
table.grid td.strong { font-weight: 500; }
table.grid tr.group th { padding-top: 24px; padding-bottom: 8px; vertical-align: bottom; }
table.grid tbody tr.group:hover > * { background-color: transparent; }
table.grid tfoot :is(td, th) { color: var(--muted); border-top: 1px solid var(--line-strong); }
table.grid tfoot b { color: var(--text); font-weight: 500; }
table.grid form { margin: 0; }
.range { display: block; font-family: var(--mono); font-size: 12px; line-height: 16px; letter-spacing: .02em; color: var(--muted); }
.wx { display: flex; align-items: center; gap: 8px; }
.wx svg.i { color: var(--text); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------------------------------------------------------------- tags */
/* A tag is a mono label in a 2px-cornered hairline box. It never takes a reading colour of its own. */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--muted); font-family: var(--mono); font-size: 12px; line-height: 16px; font-weight: 400; letter-spacing: .02em; white-space: nowrap; }
.tag.violet { background: var(--tile); border-color: var(--outline); color: var(--text); }   /* holidays and events: the stronger neutral */
/* The unboxed form: words with a round dot before them (the mark's reading dot). */
.tag.mark { gap: 8px; padding: 0; border: 0; border-radius: 0; font-family: var(--sans); font-size: 14px; line-height: 20px; letter-spacing: 0; }
.tag.mark::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
/* The change against usual, as signed text. */
.change { color: var(--muted); white-space: nowrap; }

/* Tones. One class sets the colour; tags, marks and changes take it from there. Keep these after the pieces above.
   Sodium is above usual (busier), Mercury below (quieter). Done and failed are White words. */
.busier { color: var(--busier); }
.quieter { color: var(--quieter); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.change:is(.busier, .quieter) { font-weight: 500; }

/* ---------------------------------------------------------------- sparkline and meter */
/* A sequence with no reference: Ash bars, the peak in White. Square ends, like the mark's bars. */
.spark { display: inline-flex; align-items: flex-end; gap: 2px; height: 24px; min-width: 64px; vertical-align: middle; }
.spark i { display: block; width: 4px; min-height: 2px; background: var(--faint); }
.spark i.peak { background: var(--text); }
.meter { display: inline-flex; gap: 2px; margin-right: 8px; vertical-align: middle; }
.meter i { width: 4px; height: 12px; background: var(--line-strong); }
.meter i.on { background: var(--text); }

/* ---------------------------------------------------------------- roster timeline */
.jump { display: flex; flex-wrap: wrap; gap: 8px; }
.jump a { padding: 6px 12px; border: 1px solid var(--outline); border-radius: var(--radius); color: var(--text); font-size: 13px; line-height: 16px; font-weight: 500;
  text-decoration: none; white-space: nowrap; transition: background-color var(--tr-dur-1, 120ms) linear, border-color var(--tr-dur-1, 120ms) linear; }
.jump a:hover { background: var(--hover); }
.tl { position: relative; overflow: hidden; padding: 16px var(--pad) 12px; }
.tl-axis, .tl-row { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; }
.tl-axis { margin-bottom: 8px; color: var(--muted); font-family: var(--mono); font-size: 11px; line-height: 16px; }
.tl-ticks { position: relative; height: 16px; }
.tl-ticks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.tl-ticks span:first-child { transform: none; }
.tl-ticks span::after { content: ""; position: absolute; left: 50%; top: 24px; width: 1px; height: 4000px; background: var(--line); }   /* the hour tick, drawn down the whole chart */
.tl-ticks span:first-child::after { left: 0; }
.tl-ticks span[style*="left: 100"] { transform: translateX(-100%); }   /* the closing hour ends at the chart's edge */
.tl-ticks span[style*="left: 100"]::after { left: auto; right: 0; }
.tl-role { padding-right: 8px; color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-role .muted { font-family: var(--mono); font-size: 12px; line-height: 16px; font-weight: 400; }
.tl-track { position: relative; height: 24px; margin-bottom: 4px; }
.tl-bar { container-type: inline-size; position: absolute; top: 0; bottom: 0; display: flex; align-items: center; padding: 0 8px; border-radius: 0;
  background: var(--c, var(--role-1)); color: var(--ink); font-family: var(--mono); font-size: 12px; line-height: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; }
@container (max-width: 80px) { .tl-time { display: none; } }   /* the shift time shows only when it fits */
.tl-gap { height: 8px; }
.role-0, .role-3 { --c: var(--role-1); }
.role-1, .role-4 { --c: var(--role-2); }
.role-2 { --c: var(--role-3); }

/* ---------------------------------------------------------------- buttons and links */
/* .btn alone is the quiet button (an Edge rim, White words); .primary is the one White button of a view.
   No shadows, blur, gradients or scaling: hover and press change the fill only. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 18px;
  border: 1px solid var(--outline); border-radius: var(--radius); background: transparent; color: var(--text);
  font: inherit; font-size: 14px; line-height: 20px; font-weight: 500; letter-spacing: .005em; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color var(--tr-dur-1, 120ms) linear, border-color var(--tr-dur-1, 120ms) linear, color var(--tr-dur-1, 120ms) linear; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:active { background: var(--line-strong); }
.btn.primary { background: var(--primary-fill); border-color: var(--primary-fill); color: var(--ink); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.primary:active { background: var(--muted); border-color: var(--muted); }
/* A destructive button looks like any quiet one: it gets a confirm step, not a colour. */
.btn.danger:hover { border-color: var(--text); }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; line-height: 16px; }
.btn.big { min-height: 48px; padding: 0 24px; font-size: 16px; line-height: 24px; }
.btn svg.i { width: 16px; height: 16px; }
.btn:disabled, .btn[aria-disabled="true"] { background: transparent; border-color: var(--line); color: var(--muted); cursor: not-allowed; }
/* A text link with an arrow after it, for a link that takes you somewhere else. Underlined in Edge; White on hover. */
.arrow { display: inline; padding: 0; border: 0; border-radius: 0; background: none; color: var(--text); font: inherit; font-weight: 500; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--outline); text-decoration-thickness: 1px; text-underline-offset: 4px; }
.arrow:hover { text-decoration-color: var(--text); }
.arrow::after { content: "\2192"; display: inline-block; margin-left: 6px; transition: transform var(--tr-dur-2, 240ms) var(--curve); }
.arrow:hover::after { transform: translateX(3px); }

/* ---------------------------------------------------------------- notes and flashes */
/* A sentence in a hairline frame, with a round dot at the left. The dot is Smoke for information, Sodium or Mercury
   only for busier or quieter, White for done; a problem also gets a White rim. The words stay Silver.
   Between panels the note is a Carbon sheet of its own (see the shell). */
.note { position: relative; padding: 12px 16px 12px 36px; border: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--body); text-wrap: pretty; }
.note::before { content: ""; position: absolute; left: 16px; top: 12px; width: 8px; height: 20px;
  background: radial-gradient(circle closest-side, var(--dot, var(--muted)) 92%, transparent); }   /* a gradient, so it stays in forced colours */
.note.busier { --dot: var(--busier); }
.note.quieter { --dot: var(--quieter); }
.note.good, .note.ok { --dot: var(--good); }
.note.bad, .note.error { --dot: var(--bad); border-color: var(--text); }
.note:is(.busier, .quieter, .good, .bad) { color: var(--body); }   /* a tone colours the dot, never the words */
.note.working::before { animation: pulse 2s var(--curve) infinite alternate; }
@keyframes pulse { from { opacity: 1; } to { opacity: .3; } }
.note .arrow { margin-left: 4px; white-space: nowrap; }

/* ---------------------------------------------------------------- forms */
/* A field: 40px, Gunmetal inside, an Edge rim, White words, 2px corners. A field found wrong gets a White rim. */
.form { display: grid; gap: 16px; max-width: 480px; }
.field { display: grid; gap: 8px; }
.field label { color: var(--text); font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel], select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--outline); border-radius: var(--radius); background-color: var(--field); color: var(--text);
  font: inherit; text-overflow: ellipsis; }
textarea { height: auto; min-height: 80px; padding: 8px 12px; }
select { -webkit-appearance: none; appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F2F2F0' stroke-width='1.5' stroke-linecap='square'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px 16px; }
option { background-color: #0D0D0E; color: #F2F2F0; }
::placeholder { color: var(--muted); opacity: 1; }
[aria-invalid="true"] { border-color: var(--text); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--tr-focus, #F2F2F0); outline-offset: 2px; }
input.small { width: 80px; }
select.small { width: auto; min-width: 144px; }
input[type=file] { max-width: 100%; color: var(--muted); font: inherit; }
input[type=file]::file-selector-button { margin-right: 12px; min-height: 40px; padding: 0 18px; border: 1px solid var(--outline); border-radius: var(--radius); background: transparent;
  color: var(--text); font: inherit; font-weight: 500; cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--hover); }
input[type=checkbox], input[type=radio] { -webkit-appearance: none; appearance: none; display: inline-grid; place-content: center; flex: none; width: 20px; height: 20px; margin: 0;
  border: 1px solid var(--outline); background: var(--field); vertical-align: middle; cursor: pointer; }
input[type=checkbox] { border-radius: var(--radius); }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]::before, input[type=radio]::before { content: ""; background: var(--ink); transform: scale(0); transition: transform var(--tr-dur-1, 120ms) var(--curve); }
input[type=checkbox]::before { width: 12px; height: 12px; clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%); }
input[type=radio]::before { width: 8px; height: 8px; border-radius: 50%; }
input[type=checkbox]:checked, input[type=radio]:checked { background: var(--text); border-color: var(--text); }
input[type=checkbox]:checked::before, input[type=radio]:checked::before { transform: scale(1); }
.check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }

/* ---------------------------------------------------------------- empty states */
.empty { display: grid; gap: 4px; justify-items: start; }
.content > .empty { padding: 24px var(--pad); }
.empty h2 { font-size: 16px; line-height: 24px; font-weight: 500; color: var(--text); }
.empty p { max-width: 64ch; }
.empty p:has(> .arrow) { margin-top: 8px; }

/* ---- account page (portal): the delete section is the one place a destructive button sits. A firmer rim, no colour. */
.account-delete { border-color: var(--outline); }

/* ---------------------------------------------------------------- touch screens */
@media (pointer: coarse) {
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel], select { height: 44px; }
  .btn, input[type=file]::file-selector-button { min-height: 44px; }
  .side .item { min-height: 44px; }
  .jump a { padding: 12px 16px; }
  input[type=checkbox], input[type=radio] { width: 24px; height: 24px; }
}

/* ---------------------------------------------------------------- small screens */
@media (max-width: 1000px) {
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  :root { --pad: 16px; }
  body.app { display: block; }
  /* The menu opens over the page as one Carbon sheet. It fades in; nothing slides. */
  .side { position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: min(304px, calc(100vw - 56px)); height: auto; padding-top: 16px;
    background: var(--panel); border-right: 1px solid var(--line-strong); visibility: hidden; opacity: 0;
    transition: opacity var(--tr-dur-2, 240ms) var(--curve), visibility 0s var(--tr-dur-2, 240ms); }
  .side-open .side { visibility: visible; opacity: 1; transition-delay: 0s; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: var(--scrim); opacity: 0; pointer-events: none;
    transition: opacity var(--tr-dur-2, 240ms) var(--curve); }
  .side-open .scrim { opacity: 1; pointer-events: auto; }
  .btn.side-close, .btn.menu-btn { display: inline-flex; }
  .btn.menu-btn { padding: 0 12px; }
  .top { gap: 8px 12px; min-height: 60px; padding: 10px 16px; }
  .top h1 { font-size: 20px; line-height: 28px; }
  .context .where { display: none; }
  .context > *::before { content: none; }
  .context { gap: 0 12px; }
  .content { gap: 12px; padding: 16px 16px 24px; }
  .section-head { padding-top: 16px; }
  .section-body, .section > .empty { padding-bottom: 16px; }
  .figures { padding-top: 16px; padding-bottom: 16px; gap: 16px; }
  .content > .empty { padding-top: 16px; padding-bottom: 16px; }
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel], select, textarea { font-size: 16px; line-height: 24px; }   /* stops phones zooming in on focus */
}
@media (max-width: 520px) {
  .figures { grid-template-columns: minmax(0, 1fr); }
  .tl-axis, .tl-row { grid-template-columns: 64px minmax(0, 1fr); }
  .tl-ticks span:nth-child(even) { color: transparent; }   /* phones: every second hour label goes, its tick stays */
  .top .actions { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media (forced-colors: active) {
  input[type=checkbox], input[type=radio] { -webkit-appearance: auto; appearance: auto; }
  input[type=checkbox]::before, input[type=radio]::before { content: none; }
  .side .item.on, table.grid tr.on > :first-child { outline: 2px solid CanvasText; outline-offset: -2px; }   /* fills and inset rules are dropped */
}
/* Print: Daylight on white (noir-tokens.css switches the tokens), the page alone: no menu, top-bar buttons or tab bar. */
@media print {
  body.app { display: block; }
  .side, .scrim, .tabbar, .skip, .btn.menu-btn, .top .actions { display: none !important; }
  .top { position: static; padding: 0 0 12px; }
  .content { padding: 16px 0 0; }
  .panel, .section, .figures, .tile { break-inside: avoid; }
}
