/* `:root` **and** `[data-theme='dark']`, because `dark` is the default: the palette has to
   apply to a page with no attribute at all, and to the Appearance picker's own swatch, which
   carries `data-theme="dark"` on a bare `<span>`. With `:root` alone that swatch matched
   nothing and inherited whatever theme was *currently* selected - so "Charcoal"'s preview
   showed the warm palette's colours whenever Umber was in use. One block, two selectors: the
   alternative is a second copy of the values, which is the drift this file keeps warning
   about. The accent is not here: it is a separate choice, defined with the other accents. */
:root, [data-theme='dark'] {
  --bg: #08090c;
  /* Translucent, so the ground reads *through* a card: the panel sits on the glow rather than
     beside it, and that is what makes the page read as lit rather than as flat. `--surface` is
     the one opaque plane, for the places the reader is reading rather than scanning - a popup,
     the account menu, the suggestion list, the rail. */
  --panel: rgba(255, 255, 255, 0.032);
  --panel-2: rgba(255, 255, 255, 0.055);
  /* The chrome plane: opaque, and *in* the page - the title bar, the rail. It is deliberately
     close to the ground, because both are edges of the page rather than things on it. */
  --surface: #0e1015;
  /* The plane a thing that **floats above the page** sits on: the navigation panel, a popup, the
     account menu, the suggestion list, a toast. It is a step *above* `--panel-2`, which is the
     whole point - `--surface` is opaque but it lands within a couple of units of a card, so a
     panel using it disappears against one. That is how the navigation panel was reported: it was
     covering the page correctly and could not be told apart from it.
     Derived from the ground and the type, so every dark theme gets it without restating it. 10%
     rather than a hair above `--panel-2`, because the lightest thing it can be drawn over is a
     card with a hovered row - and a panel that is *darker* than a row is not raised at all. */
  --raised: color-mix(in srgb, var(--text) 10%, var(--bg));
  /* The ground's two glows, and **they are the ground**: what the reader sees as the page is
     these two washes painted over `--bg`, not `--bg` itself. So a token that decides their
     colour is a token that decides the page.
     That is why the near one is *derived from the accent* rather than written as the default
     red. A hard-coded wash left the accent picker changing every control on the page and nothing
     behind them, which is what "accents do not work since the redesign" was, and left a theme
     unable to move the ground at all, which is what "themes change the chrome but not the ground"
     was. One token pair answers both.
     The far one stays a **cool** counter-light rather than a second wash of the accent: the
     design's two lights are a warm near one and a cool far one, and two washes of one hue read as
     a single uneven patch rather than as a lit room. A theme that wants a different ground - or
     none at all - sets these; `dark-oled` does. */
  /* **Twenty per cent of the accent was a tint, not a light.** The ground is the near wash and
     the far one, and at 20% the near one read as a red film over the top-left of every page -
     a wide, nearly empty page looked *coloured* rather than lit. Thirteen per cent is still a
     wash the reader can see the card through, and the page reads as a room rather than as a
     stain. */
  --glow-a: color-mix(in srgb, var(--accent) 13%, transparent);
  --glow-b: color-mix(in srgb, #5a78ff 11%, transparent);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.17);
  --text: #e9ebee;
  --muted: #99a1ab;
  --ok: #6fbf8f;
  --warn: #d9a25f;
  --danger: #e0685f;
  --radius: 3px;
  /* One sans for the interface, one mono for machine identifiers (paths, keys, kinds).
     `--sans` was referenced once (`var(--sans, inherit)`) but never defined, so that one
     declaration silently inherited instead. */
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  /* Tell the UA the page is dark so native widget chrome (select popups,
     number spinners, scrollbars) follows the theme instead of rendering
     white-on-dark (site picker, expiry bar). */
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* The UA's scrollbar is a bright, blocky bar that ignores the theme, and on a near-black page
   it is the one piece of chrome that reads as somebody else's. Two rules because there are two
   mechanisms: the standard properties for Firefox, and the WebKit pseudo-elements for Blink
   and WebKit, which still do not implement them. The thumb is inset by a transparent border
   with `background-clip: content-box`, which is what makes it a rounded pill rather than the
   block. A component that needs its own scrollbar colour still wins on specificity. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background-color: var(--border-strong);
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--muted); }
::-webkit-scrollbar-corner { background: transparent; }

/* The interface's type scale. Every `font-size` in this file is in `rem` over a 13px root, so
   the ratios the design was built on stay put and one number moves the whole interface.
   Spacing and borders stay in `px`: larger text wants larger *text*, not a larger sidebar.

   There was a **Font size** picker here, multiplying this root by a saved scale. It is gone:
   every interface that let the reader scale its own type also let them break its layout, and
   the failures were the ones nobody reports - a sidebar entry taller than the rail it sits in,
   a table that stopped lining up. One size, and it is the design's. */
:root { font-size: 13px; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 1.0rem;
  line-height: 1.45;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* The layout's own tokens, beside the palette's. There is one component vocabulary - one
   `.btn`, one `.card`, one `.lb-table` - and a surface that wants it tighter or looser moves
   these numbers rather than restating the components. That is what keeps the two panels from
   drifting into two slightly different versions of the same button.

   `--space` multiplies the *vertical* rhythm only. A reader who wants a denser list wants a
   denser list, not a narrower one, and nothing may reflow sideways when it changes.

   `--card-x` is the card's horizontal inset, named because a row list bleeds back out to the
   card's edges and has to know how far to come back.

   `--surface` is the one *opaque* plane: a popup, the account menu, the suggestion list, the
   rail. The shared `--panel` is translucent so the ground reads through it, which is right for
   a card and wrong for the one place the reader is reading rather than scanning.

   `--link` is text; `--accent` is a *fill* - a primary button, the active tab's rule, the brand
   dot. They are one value by default, so a red link is possible; a surface where red also means
   failed, blocked and deleted moves `--link` alone rather than restating every rule that draws
   a link. */
/* The layout's own tokens, beside the palette's. There is one component vocabulary - one
   `.btn`, one `.card`, one `.lb-table` - and it is the *design*, shared by both panels. A
   surface does not restate it; if a surface ever needs to, that is a token.

   `--space` multiplies the *vertical* rhythm only. A reader who wants a denser list wants a
   denser list, not a narrower one, and nothing may reflow sideways when it changes.

   `--card-x` is the card's horizontal inset, named because a row list bleeds back out to the
   card's edges and has to know how far to come back.

   `--link` is text; `--accent` is a *fill* - a primary button, the active tab's rule, the brand
   dot. They are separate because red also means failed, blocked and deleted here, so a red link
   reads as a warning rather than as a way to go somewhere. */
:root {
  --topbar-h: 44px;
  /* The mobile tab bar's height, and the only thing that decides it: the bar's own slots, the
     panel that opens above it and the page's bottom padding all read it. */
  --tabbar-h: 54px;
  --sidebar-w: 208px;
  --space: 0.7;
  --card-x: 18px;
  --link: #6ea8fe;
  /* **Which layout this window is in, as a word rather than a number.** The sheet asks
     about 700px in its media queries, and a script that asked about the same boundary in
     JavaScript would be a second copy of it - which is how the rail's 900px drifted once
     already. So the sheet *says* which layout it is in, and a script asks the question
     instead of repeating the answer. */
  --layout: wide;
  /* One rail-row height, in **both** states. Collapsing used to take an entry's height from the
     rail's own width, which made a collapsed entry a pixel or so taller than an open one -
     enough for the strip to grow as it shut. The collapsed width is derived from this instead,
     so the icon stays square and collapsing changes the width and nothing vertical. */
  --nav-row-h: calc(14px * var(--space) + 15px);
  /* **The rail of a split section, one width for all of them.** It was `max-content`, so each
     card's rail was as wide as its own tabs and figures - on the Statistics page three cards put
     their separators at three different x, 106px, 95px and 90px of rail, and the page read as
     three slightly different components. The width is the widest rail any section needs (the
     site page's "Configuration 11") plus the room a count needs to reach three digits, so a
     separator is in the same place on every card of a page and a count lines up down the rail. */
  --side-rail: 140px;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 16px;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { font-weight: 600; font-size: 1.0769rem; color: var(--text); }
/* The wordmark the apex and the docs already use, with a slowly pulsing dot. The dot is the one
   place the accent is a *mark* rather than a fill. */
.brand .wordmark {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.82rem;
  /* Full strength, because the surface mark beside it is the muted half - a wordmark that is
     already grey has nothing left to de-emphasise. */
  color: var(--text);
}
.brand .wordmark .dot {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: brand-pulse 2.6s ease-in-out infinite;
  /* The dot's space is its own margin rather than a flex `gap`: the wordmark has three children
     (dot, the word, the surface mark) and a gap pads the space between the word and its suffix
     too, which reads as two words rather than as one title. */
  margin-right: 0.6rem;
}
/* The surface, as typed: "| Admin", "App". The wordmark's uppercase belongs to the product's
   name; the surface is a label, and shouting it was never asked for. */
.brand .wordmark-sub {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
  /* The markup carries a space between the wordmark and this suffix, and it was still rendering
     as one word: the wordmark is an inline-flex container, and whitespace between flex items is
     discarded. The gap has to be a margin here rather than a `gap` on the container, because a
     gap also pads the space around the dot - which reads as two words instead of one title. */
  margin-left: 0.4em;
}
@keyframes brand-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}
.topbar .user { margin-left: auto; color: var(--muted); display: flex; align-items: center; gap: 14px; }
/* The bar's link is chrome, not a destination: Docs reads as a label until it is hovered. A blue
   "Docs" beside a blue "Docs" is two calls to action in a bar that is not asking for one.
   **A child selector, not a descendant one.** `a` reached the account menu's own items, which are
   inside `.user` because the popup is nested there - so Options and Logout were drawn as title-bar
   chrome: muted rather than `--text`, and laid out as bar links. */
.topbar .user > a { color: var(--muted); }
.topbar .user > a:hover { color: var(--text); }

/* The ground's two glows, one at each end of the fold, so the ground reads as *lit* rather than
   as flat black. Fixed rather than in-flow: they belong to the room, not to the content.

   **Anchored to the viewport, not to the panel.** They used to be offset by the rail's width and
   the bar's height, which meant collapsing the rail dragged the background sideways with it -
   the room moving because a drawer opened. The offsets are plain viewport percentages, so nothing
   the chrome does can move the ground.

   They drift, slowly and at random, which `ui.js` does by writing a transform every few seconds.
   The transition is what makes a jump between two random points read as a drift.

   **Their colour is a token pair, `--glow-a` and `--glow-b`**, defined with the palette. They were
   literals here - the default accent's red and a fixed blue - and a literal wash is a ground that
   no accent and no theme can reach. */
.glow {
  position: fixed;
  z-index: -1;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  pointer-events: none;
  transition: transform 16s ease-in-out;
}
.glow-a {
  top: -28vw;
  left: -12vw;
  background: radial-gradient(circle, var(--glow-a), transparent 62%);
}
.glow-b {
  right: -18vw;
  bottom: -34vw;
  background: radial-gradient(circle, var(--glow-b), transparent 62%);
}
/* A light ground has no room for a lit one: the same wash reads as a smudge on white. */
[data-theme^='light'] .glow { display: none; }

/* Effects off: no drift, and no easing to a stop - the glows sit where they started. The
   transition is disabled as well as the movement, or turning effects off would leave them gliding
   home for sixteen seconds, which is the one thing the setting exists to prevent. */
[data-effects='reduced'] .glow { transition: none; transform: none !important; }
@media (prefers-reduced-motion: reduce) {
  .glow { transition: none; transform: none !important; }
}
/* The chrome that still moves, and the popups, answer to the same switch. The setting exists so a
   reader can stop the movement without stopping the interface, and a transition left out of this
   list is a transition that ignores the setting. **The rail is not in it any more**: collapsing it
   is instant, because a width that eases for 220ms spends every frame of the gesture reflowing
   labels that are `nowrap` and clipped - the entries appear to be squeezed. */
[data-effects='reduced'] .topbar,
[data-effects='reduced'] dialog[open],
[data-effects='reduced'] dialog::backdrop,
[data-effects='reduced'] .brand .wordmark .dot { transition: none; animation: none; }
@media (prefers-reduced-motion: reduce) {
  .topbar { transition: none; }
  dialog[open], dialog::backdrop { animation: none; }
}

/* The rail. It is a **tab strip**, and it collapses sideways only: entries are tabs, so the
   treatment is panel-wide by construction - a left rule on the active entry rather than a filled
   pill, because a tab strip reads as a strip when the selected tab touches the edge it belongs
   to. Collapsing changes the width and nothing vertical - **in one step, with no easing**: a
   width that animates spends the whole gesture reflowing its own contents, and a row's label is
   `nowrap` and clipped, so every frame showed the entries cut off a little further. */
.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  /* Clipped across as well as scrolled down. A row's label is `nowrap`, so a label longer than
     the rail - a long site or worker name in a popup's rail, a label from another language - would
     otherwise widen the box and grow a horizontal scrollbar. A non-`visible` cross axis also makes
     the other one `auto`, so `overflow-y: auto` alone had already made this a scroller on both
     axes; this says which of the two is the intended one. */
  overflow-x: hidden;
  overflow-y: auto;
  /* The one plane that is *less* translucent than the page but not solid: fully transparent put
     the ground behind the labels, and fully solid lost the sense that the ground is lit.
     `--surface` is the opaque plane, so the rail is that at 88%. */
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-right: 1px solid var(--border);
  padding: calc(12px * var(--space)) 8px;
  display: flex;
  flex-direction: column;
}

.nav-home,
.nav-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  /* **`flex: none`, and it is not decoration.** A row is a flex item of the rail, and its
     `overflow: hidden` - which clips the label rather than reflowing it - makes its automatic
     minimum size **0**. So a nav taller than the rail (a fixed column, or the phone's drawer) shrank
     every row to nothing instead of the rail scrolling, and the nav became a stack of invisible
     rows. A `min-height` used to hold them up by accident, from the era when every control on a
     phone had one; this says it outright. */
  flex: none;
  /* The same height in both states, so collapsing moves nothing vertically. */
  height: var(--nav-row-h);
  padding: 0 10px;
  border-radius: 0;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
}
.nav-home { margin-bottom: calc(6px * var(--space)); }
.nav-home:hover,
.nav-links a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav-home.active,
.nav-links a.active {
  background: var(--panel-2);
  border-left-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}
.nav-icon { width: 16px; height: 16px; flex: none; color: inherit; }

/* A group heading is a *row* in the strip, and it keeps the same height whether its label is
   showing or not. That is the whole of the alignment fix: collapsing the *groups* moved every
   entry below a heading up by the heading's height, so the strip rearranged itself as it shrank.
   A fixed row cannot move anything - and it means collapsing the rail moves nothing vertically
   either, only the width. */
.nav-group { margin: 0; position: relative; }
.nav-group > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  min-height: calc(26px * var(--space));
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  /* The heading's label reappears whole when the rail expands, so it is clipped here as well as
     by the rail - a heading has no row of its own to hide behind. */
  overflow: hidden;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: none; }
.nav-group > summary:hover { color: var(--text); }
.nav-links { display: flex; flex-direction: column; gap: 0; padding: 0 0 calc(6px * var(--space)); }

/* Collapsed: the width goes, the labels go, and nothing else does. `overflow: hidden` on the rail
   clips the label rather than reflowing the row, and the row's height comes from `--nav-row-h` in
   both states, so an entry is in the same place whether the rail is open or shut - and the strip
   is exactly as tall either way.

   The width cannot be the row's *height* plus the rail's chrome alone: the row's content is the
   icon **plus its own left inset** - the 2px rule and 10px of padding - which is a few pixels
   more than the height. `overflow: hidden` clips to the padding box, so that shortfall shaved
   the right edge off every icon. The extra 23px is that inset (12px) plus the room the toggle's
   glyph needs beneath it. */
[data-sidebar='collapsed'] { --sidebar-w: calc(var(--nav-row-h) + 23px); }
[data-sidebar='collapsed'] .nav-label { display: none; }
/* The label goes and a separator takes its place: with the rail collapsed there is nothing to
   say where one group ends and the next begins - every icon is the same size and the headings
   are invisible - so the boundary is drawn instead. Floating, inset from both edges: a rule
   reaching the rail's sides would read as a divider across the panel rather than as a break
   between two groups. */
[data-sidebar='collapsed'] .nav-group > summary { padding: 0; }
[data-sidebar='collapsed'] .nav-group > summary::before {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  top: 50%;
  border-top: 1px solid var(--border);
}
/* Square, not a rectangle. The rail's width is the only thing that decides how wide an entry is,
   so the entry's *height* is taken from that same number - which is what makes the icon a square
   rather than a box wider than it is tall, and what keeps it square at every density. */
[data-sidebar='collapsed'] .nav-home,
[data-sidebar='collapsed'] .nav-links a,
[data-sidebar='collapsed'] .sidebar-toggle {
  height: var(--nav-row-h);
  padding-top: 0;
  padding-bottom: 0;
  /* Left, not centred. Centred, the icon slides sideways as the rail narrows and has to travel
     back the other way when it opens, so the entries appear to move into place rather than the
     rail appearing to close. */
  justify-content: flex-start;
}
/* Centred by compensating for the rule, not by centring the row. An entry carries a 2px
   `border-left` - the active tab's mark - which the toggle does not, so with the same 10px of
   padding the icon sits 2px right of the entry's centre and reads as misaligned rather than as
   centred. */
[data-sidebar='collapsed'] .nav-home,
[data-sidebar='collapsed'] .nav-links a { padding-left: 8px; }
[data-sidebar='collapsed'] .sidebar-toggle { padding-left: 9px; }

/* Pinned to the bottom, so it is the one control that does not move when the rail does. */
.sidebar-toggle {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  /* The same height as an entry, in both states: the toggle sits at the foot of the rail, so a
     different height there changes the strip's total height when it collapses. */
  height: var(--nav-row-h);
  padding: 0 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.sidebar-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.sidebar-toggle::before { content: "\00ab"; font-size: 1rem; line-height: 1; }
[data-sidebar='collapsed'] .sidebar-toggle::before { content: "\00bb"; }
[data-sidebar='collapsed'] .sidebar-toggle .nav-label { display: none; }
/* **The toggle has two words, and one is shown at a time.** At desk width it narrows the rail -
   "Collapse" - and on a phone the same button closes the drawer, where "Collapse" is the wrong
   word for it. The switch is the width, so the control stays one control and the handler stays
   one handler; the word that does not apply is hidden with the label rules above. */
.sidebar-toggle-close { display: none; }

/* The build this panel is running: the rail's foot, and the Health header. Hidden when the rail
   is collapsed, because a commit string is far wider than the icon strip and the strip is the
   one place a rail is allowed to lose its labels. Panel mode is unaffected - the rail is only
   shown there when it is expanded. `anywhere` rather than `break-word` because the string has no
   spaces to break at, and it must not set the width of the column it sits in. */
.build-stamp {
  margin: 10px 0 0;
  overflow-wrap: anywhere;
}
.sidebar .build-stamp { padding: 0 10px; }
[data-sidebar='collapsed'] .build-stamp { display: none; }

/* The mobile **tab bar**, and the rail's phone control inside it.
 *
 * Below the breakpoint the rail is a panel, and the destinations worth a thumb's reach live in a
 * bar across the foot of the screen with the menu button in the middle slot. That is also what
 * lets the title bar hide as the reader scrolls: nothing on the title bar is then the only way to
 * anywhere.
 *
 * The menu button is a **sibling** of the rail rather than a row in it, and that is the whole
 * reason the bar exists: the rail's own toggle is *in* the rail, so a rail that is shut has no
 * control left to open it - the button goes with the thing it opens. Above the breakpoint the rail
 * is a column with its own collapse control, so the bar is not drawn at all. */
.tabbar { display: none; }
/* The bell is the fifth slot and it is the *shared* include: same control, same fragment swap,
   one place to change. Its label exists for the bar alone - in the title bar it is an icon beside
   two other icons, where a word under it would be a word in a title bar. */
.notif-bell .tab-label { display: none; }

/* Below 900px the rail has no room beside the content, so it is not a column any more: it is a
   **floating panel**, shut until the bar asks for it. It used to be a static block at the top of
   every page - the whole nav, on the screen with the least room for it, before the page had
   begun - and on a phone the group headings were hidden to buy back a line, which left a folded
   group with no heading to open it again.
 
   900px rather than the phone's 700: this is the same breakpoint the working area already uses to
   say it has no room for a column, and a rail that is a block at 768px is the same complaint on
   a tablet. */
@media (max-width: 900px) {
  .tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    /* The raised plane, like the panel it opens: a bar over the page is over the page. */
    background: var(--raised);
    border-top: 1px solid var(--border);
    /* The iOS home indicator sits over the bottom of the screen, and a bar under it is a bar whose
       labels are inside the gesture area. */
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    /* A thumb's target, the same for every slot - the bar is five of them across the width, and
       one taller than its neighbours is a bar with a dent in it. */
    height: var(--tabbar-h);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-decoration: none;
    background: none;
    border: 0;
    cursor: pointer;
  }
  .tab:hover { color: var(--text); }
  .tab[aria-current='page'] { color: var(--accent); }
  .tab-icon { width: 18px; height: 18px; }
  /* The middle slot is the only one that is not a destination, so it says whether the panel is
     open rather than merely offering it. */
  [data-sidebar='expanded'] .tab-menu { color: var(--accent); }

  .sidebar {
    position: fixed;
    /* **Anchored at both ends, rather than capped and hanging.** It was `max-height: 56vh` grown
       upwards from the bar, which is a card that happens to begin in the middle of the page: the
       page above it and below it stayed fully legible, so the whole navigation read as one thing
       floating over another, and the entries past the fifth were somewhere past the card's edge.
       A drawer is the height of the space *between* the two edges of the chrome: it starts under
       the title bar, ends above the tab bar, and scrolls its own contents in between. */
    top: var(--topbar-h);
    /* **The full width, inset like every other floating card.** It was a 240px column against the
       right edge, which wasted the width on a phone: the entries are short labels and the panel is
       the whole navigation, not a menu hanging off a button. The bar below it is full-bleed, so a
       panel that is not reads as a drawer rather than as the sheet the bar opened. The inset is the
       same 12px gutter the bar's own gap uses, so the two read as one object. */
    left: 12px;
    right: 12px;
    /* Above the bar, because the bar is where the button that opened it is and one of the ways
       out of it. */
    bottom: calc(var(--tabbar-h) + 12px);
    /* **The raised plane and the raised order are one decision.** As a *column* the rail needs
       neither: the working area reserves its width, so nothing can reach it. As a *panel* it floats
       over the page and needs both - and it had the first and not the second, which is the whole
       bug. A `position: fixed` element with no `z-index` is painted in the *same* layer as the
       content, so tree order decides, and the content comes after the rail. uPlot's canvases are
       `position: relative`, so a chart was drawn over the panel that was floating above it.
       The popup layer, the same number as the account menu: it is the same kind of thing, and the
       two cannot overlap - one hangs from the title bar, this one sits above the tab bar. */
    z-index: 60;
    /* The base rule's `--sidebar-w` is the *column*'s width. Both insets decide this box, so the
       width has to be released rather than overridden: `left` plus a width wins over `right`, which
       would be a panel spanning nothing. */
    width: auto;
    /* No cap now that both ends are anchored: the base rule's `overflow-y: auto` turns whatever
       does not fit into the panel's own scroll, which is what reaches the last entry. */
    max-height: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    /* `--raised`, and it is the token's own job: the page plane is below, the chrome plane is the
       frame, and a thing that floats *over* the page is a step above both. Opaque, so the page
       behind it is genuinely behind it rather than legible through it. */
    background: var(--raised);
    box-shadow: 0 10px 32px rgba(0, 0, 0, .5);
    padding: 8px;
    display: none;
    /* The panel is a scroller now: a drag that reaches its end must not start scrolling the page
       underneath it, which on iOS then looks like the panel has come loose. */
    overscroll-behavior: contain;
  }
  [data-sidebar='expanded'] .sidebar { display: flex; }
  /* **The exit is in the panel.** Above the breakpoint the rail carries its own collapse control,
     and here it was hidden - correctly, because a drawer is not a rail you narrow - but that left
     closing it to a tap on the page behind, which is the one tap a reader does not think of. It is
     the same button and the same handler, in its own row at the *top*: an exit at the foot of a
     scrolling list is an exit nobody scrolls to. The glyph and the word change; the control does
     not. */
  .sidebar-toggle {
    display: flex;
    order: -1;
    flex: none;
    margin: 0 0 calc(6px * var(--space));
  }
  .sidebar-toggle::before { content: "\00d7"; font-size: 1.15rem; }
  .sidebar-toggle-open { display: none; }
  .sidebar-toggle-close { display: inline; }

  /* **The page behind the panel is behind it.** An undimmed page under a floating sheet is two
     pages at once: the labels compete with the panel's, and nothing says what is inert. This is
     the backdrop as a pseudo-element - no markup and no second handler, because a pseudo-element
     hit-tests as the element that draws it, so a tap on it arrives as a tap on `body`, which is
     exactly the "away from the panel" `ui.js` already answers. It sits below both chrome edges
     (the title bar at 50 and the tab bar at 55) so the frame stays crisp and the bar's Menu slot
     remains the panel's state and one of its ways out, and below the panel itself (60). */
  body.with-sidebar::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 49;
    background: rgba(10, 11, 14, .68);
    opacity: 0;
    visibility: hidden;
    transition: opacity 160ms ease-out, visibility 0s linear 160ms;
  }
  [data-sidebar='expanded'] body.with-sidebar::after {
    opacity: 1;
    visibility: visible;
    transition: opacity 160ms ease-out;
  }
  /* The Effects setting stops it, like every other thing that moves. It sits after the rule it
     overrides and carries the same specificity, because a fade left out of the switch is a fade
     that ignores the setting - and this one is on screen for every page on a phone. */
  [data-effects='reduced'] body.with-sidebar::after { transition: none; }
  /* A light ground has no room to go dark: the same wash at a lower strength, the way the popup's
     own backdrop answers the theme. */
  :root[data-theme^='light'] body.with-sidebar::after { background: rgba(36, 41, 47, .38); }
  /* A drawer opened after a scroll has no header above it: the title bar has slid away, so the
     panel's top edge goes with it rather than leaving a strip of dimmed page over it. */
  [data-topbar='hidden'] .sidebar { top: 0; }
  /* The panel *is* the nav, and a tablet is a touch device: an entry in it is a thumb's size -
     which is the *pointer* query's business, not this one's. See the floors below. */

  /* The bell as a slot rather than as the title bar's inline icon. */
  .tabbar .notif { display: block; }
  .tabbar .notif-bell {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    width: 100%;
    height: var(--tabbar-h);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 600;
  }
  .tabbar .notif-bell:hover { color: var(--text); }
  .tabbar .notif-bell .tab-label { display: inline; }
  /* A popup at the foot of the screen opens *upward*, or it is a popup off the screen. */
  .tabbar .notif-pop { top: auto; right: 8px; bottom: calc(100% + 8px); }

  /* The bar is fixed, so the page has to end above it - otherwise the last row of a list is behind
     it, which reads as a list that lost its last row. */
  body.with-sidebar .container { padding-bottom: calc(var(--tabbar-h) + 28px); }

  /* The title bar's bell is the bar's fifth slot on a phone; two of them is one too many. Docs and
     the account menu stay where they are - the title bar comes back the moment the reader scrolls
     up, and neither is a thing anybody reaches for mid-scroll. */
  .topbar .menu.notif { display: none; }

  /* The title bar gets out of the way going down and returns coming up. On a phone the bar and the
     tab bar together are a fifth of the screen, and one of them is worth more than the other.
     `ui.js` writes the attribute, and it is `shown` at the top of the page, so a reader who has
     just arrived sees it. */
  .topbar { transition: transform 180ms ease; }
  [data-topbar='hidden'] .topbar { transform: translateY(-100%); }
}

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 16px 16px 48px; }
body.with-sidebar .container { margin-left: calc(var(--sidebar-w) + 16px); margin-right: 16px; max-width: none; }
/* Below this width the rail has no room beside the content, so it stops being a column - and
   `body.with-sidebar` stops reserving the space for one. What the rail *becomes* is with the
   rail, in the sidebar section above; this is only the working area's half of it. */
@media (max-width: 900px) {
  body.with-sidebar .container { margin-left: 0; margin-right: 0; }
}
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
/* Most page headers no longer carry a title: the sidebar marks the current page and the
   browser title carries it, so an `<h1>` reading "Sites" was the nav label said twice. What
   is left is usually one action, and `space-between` puts a lone child at the *start* -
   where the title used to be, not where the button was. */
.page-header > :only-child { margin-left: auto; }
/* **A lone *title* is not a lone action.** The rule above right-aligns a header's only
   child, because that child is usually the page's one action and `space-between` would
   otherwise leave it at the start. A header whose only child carries the title is the
   other case: there the child belongs at the start, and the rule pushed the
   content-analysis page's title 251px to the right - the page's name, indented like a
   caption under nothing, with a 757px-wide title block hanging off the right edge of a
   992px working area. `:has()` is a progressive enhancement: a browser without it leaves
   the title where it was before, which is where it was wrong. */
.page-header > :only-child:has(h1) { margin-left: 0; }
.page-header .flex { flex-wrap: wrap; }
.page-header h1 { font-size: 1.3846rem; margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.page-header .sub { color: var(--muted); font-size: 0.9231rem; max-width: 62ch; }
/* The action belongs at the right, and it belongs there when the row wraps too: the
   header's prose is long enough that the button ends up on a line of its own, and
   `space-between` puts a lone child at the *start* of that line - under the prose. */
.page-header > .btn { margin-left: auto; }

/* Cards */
.grid { display: grid; gap: calc(10px * var(--space)); }
/* Long content must never blow a grid column out; let it wrap instead. */
.grid > *, .detail-grid > * { min-width: 0; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1000px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } .grid.cols-3 { grid-template-columns: 1fr 1fr; } .grid.cols-2 { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  /* Two-up, not one-up. Six figures stacked one per card is a scroll of six screens for six
     numbers, and the values here are short. A card whose value needs the whole width still
     gets it: the grid wraps. */
  .grid.cols-4, .grid.cols-3 { grid-template-columns: 1fr 1fr; }
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: calc(14px * var(--space)) var(--card-x);
}
/* `tabular-nums` and nothing else, deliberately. The report was that these figures looked
   like a different typeface from the table cells beside them, and the tempting fix -- give
   `.value` the mono stack the numeric cells use -- would align them *and* change every
   glyph, which is a different visual change from the one being asked for. Tabular figures
   give the alignment without the face swap. */
/* **One rule, two selectors.** The site detail page's key-fact row restates the figure and
   the label of the stat cards, and a third copy of the same two declarations is how two
   things that look the same stop looking the same: a difference in value is a token, and a
   difference in structure is a rule. */
.stat .value, .site-fact__value { font-size: 1.5385rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .label, .site-fact__label { color: var(--muted); font-size: 0.9231rem; }
/* The dashboard's headline cards carry a secondary line, and the week-over-week movement
   sits beside the figure rather than under it: the cards with no comparison then have the
   same height as the ones with one. The sign is in the text, so colour is reinforcement
   rather than the only signal. */
.stat .stat-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.stat .stat-detail { color: var(--muted); font-size: 0.8462rem; margin-top: 2px; }
.stat .stat-trend { color: var(--muted); font-size: 0.8462rem; font-weight: 500; }
.stat .stat-trend.up, .stat .stat-trend.new { color: var(--ok); }
.stat .stat-trend.down { color: var(--danger); }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: calc(6px * var(--space)) 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 0.8462rem; text-transform: uppercase; letter-spacing: .04em; }
td .mono { font-family: var(--mono); font-size: 0.9231rem; }
tr:last-child td { border-bottom: none; }
/* Row-label th cells (asset Details metadata) lose the last-row separator
   too - the label side kept a border the value side dropped. tbody-scoped:
   thead rows are last-children of their own parent and must keep theirs. */
tbody tr:last-child th { border-bottom: none; }
/* Wide content must never bleed past the table/card borders. */
.card { overflow-x: auto; }

/* The step trail on a run's detail. A fixed layout, because an auto table lets one long step
   message set the column widths - which pushed the time and stage cells into wrapping and made
   the row several lines tall. The message truncates and carries its full text in the title. */
.steps-table { table-layout: fixed; }
.steps-table th:nth-child(1), .steps-table td:nth-child(1) { width: 84px; }
.steps-table th:nth-child(2), .steps-table td:nth-child(2) { width: 128px; }
.steps-table th:nth-child(3), .steps-table td:nth-child(3) {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
td.mono, td code { overflow-wrap: anywhere; }
td .mono { overflow-wrap: anywhere; }
/* Opt a cell out of wrapping (timestamps, hashes, ids). */
.nowrap { white-space: nowrap; }

/* **The asset detail's metadata table: a definition table, not a list.** Its values are
   machine identifiers - a path, a checksum, the served URL - and the rule for a table cell
   that holds one is `white-space: nowrap`, so the value column was as wide as the longest
   of them and the table ran 128px out of the 459px card: the served URL was cut mid-string,
   the checksum was cut, and the "Format rules" chip row lost a chip at the card's edge.

   A definition table has no columns to line up against another row, so nothing is gained by
   keeping it wider than the card: the values wrap inside it instead, which is what `.mono`
   says everywhere else (`overflow-wrap: anywhere`). The label column keeps its own width and
   the value column takes the rest, so the table is the card's width and no value is cut. */
.meta-table { table-layout: fixed; }
/* **The label column is a label, not a column of broken words.** At 96px the longest labels -
   "TOKENS (ORIGIN)", "LAST MODIFIED" - wrapped mid-phrase, so a two-word label read as two
   stacked fragments in a narrow strip while the value column had room to spare. 148px is the
   longest of them ("TOKENS (STORED)", 122px at the small-caps size the `th` rule gives it) plus
   the cell's own insets. */
.meta-table th { width: 148px; }
.meta-table td { white-space: normal; overflow-wrap: anywhere; }
/* **The served URL is one token, and it breaks where it must.** The cell it sits in inherits
   `overflow-wrap: anywhere`, which breaks at whichever character happens to cross the edge - a
   URL one character over the line opened the next with a lone `d`. `break-word` keeps a URL whole
   until it genuinely cannot fit, and the value is set a step smaller than the values around it so
   that a host and a path - the common case - are one line at the width this table has. */
.meta-table td a.served-url {
  font-size: 0.8462rem;
  overflow-wrap: break-word;
}

/* Buttons */
.btn {
  display: inline-block;
  flex-shrink: 0;
  /* Flex items shrink by default, and `white-space: nowrap` below stops the label from
     wrapping -- so a shrinking button does not reflow its text, it lets the text spill out
     of the box. That is the "tab buttons squish when the viewport shrinks" report: the
     `.wrap` utility the tab rows use was already defined, so the flex row could wrap but
     the buttons still shrank instead of wrapping to a new line. With this, a row that
     cannot fit its buttons moves them down rather than deforming them. */
  padding: calc(6px * var(--space)) 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 1.0rem;
  cursor: pointer;
  line-height: 1.3;
  white-space: nowrap;
}
/* **The hover changes the border, not the ink.** The label used to become the accent
   colour, which is 3.21:1 on a card - below AA's 4.5:1 - so *every* button on the page
   dropped out of reach the moment a pointer touched it. The border carries the accent
   now, and the label stays the text colour at 15.8:1. */
.btn:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }
/* **A primary button's label is the text colour.** It was the accent picker's ink - a
   near-black chosen once for the *blue* accent - and never revisited for the red one:
   3.18:1 on the button's own fill. `--text` on the same fill is 4.93:1. */
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--text); font-weight: 600; }
/* **The hover is the same hue, one step lighter.** It used to be a pale blue - the old
   default accent - on a red button, which passes contrast and is still the wrong
   colour. 94% of the accent mixed with white keeps the hue and holds the label at
   4.66:1; 88% gives 4.28:1, which is still a fail. */
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 94%, #ffffff); color: var(--text); }
.btn.danger { background: transparent; border-color: rgba(224,104,95,.45); color: var(--danger); }
.btn.danger:hover { background: rgba(224,104,95,.1); color: var(--danger); border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
/* A ghost button has no border to change, so its hover is the ink - and the ink is the
   text colour, for the same reason every other button's is. */
.btn.ghost:hover { color: var(--text); border-color: transparent; }
/* The **dense** size: a segmented control (the chart's view and period chips), a row action, a
   filter chip. Centred like any other button, because it carries a target floor too - see the
   floors at the foot of this file. */
.btn.small {
  display: inline-flex;
  align-items: center;
  padding: calc(3px * var(--space)) 7px;
  font-size: 0.9231rem;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
a.btn { text-decoration: none; }

/* Forms */
form .row { margin-bottom: 10px; }

/* Stacked form fields: dialogs, the Options tabs, password change. This class had **no rule
   at all** while eight templates used it, so a label, its input and its hint ran together
   with no more space between them than within them - the "fields squish together" report.
   One rule rather than one per dialog, because they are all the same shape. */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: calc(14px * var(--space)); }
.field > label {
  font-size: 0.8462rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.field > .muted.small, .field > .alert, .field > .desc { margin-bottom: 0; }

/* An input with controls beside it - the customer password field's dice and eye. */
.field-row { display: flex; align-items: center; gap: 6px; }
.field-row > input { flex: 1 1 auto; min-width: 0; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; width: 30px; height: 30px; padding: 0;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--panel); color: var(--muted); cursor: pointer;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; }
/* Two glyphs in one button, swapped by `aria-pressed` rather than by a second class the
   handler would have to keep in step with the state. */
.icon-btn .icon-alt { display: none; }
.icon-btn[aria-pressed='true'] .icon-main { display: none; }
.icon-btn[aria-pressed='true'] .icon-alt { display: inline; }
/* **A label is a label, and a *field* label is the one that is shouted.** The global rule
   used to shout every label on the page, and it reached two kinds that are sentences rather
   than field names: a checkbox's caption ("Fetch paths this site's robots.txt tells crawlers
   to leave alone") and the label sitting above a select in a form row ("For how long"). A
   shouted sentence is a caption that has been given the wrong emphasis. The field label -
   the one that names an input in a dialog - keeps the treatment, in `.field > label`. */
label { display: block; color: var(--muted); font-size: 0.8462rem; font-weight: 600; margin-bottom: 3px; }
/* Every field type in one rule. The list is the whole vocabulary rather than the types in use
   when it was written: email/date/search were added later and rendered as unstyled browser
   widgets - white background, system font - because they had fallen through it. A second rule
   repeating the first was the other half of that drift, so there is one now. */
input[type=text], input[type=url], input[type=number], input[type=password],
input[type=email], input[type=date], input[type=search], textarea, select {
  width: 100%;
  padding: calc(6px * var(--space)) 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 1.0rem;
  font-family: inherit;
  /* The same line box as `.btn`, so a field and the button beside it are one height. A control
     inheriting the body's 1.45 stood two pixels taller, which is the search bar not lining up
     with the button next to it. */
  line-height: 1.3;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
/* **The focus ring is the text colour, not the accent.** The accent is the one colour
   in the product that is also a *fill* - the one solid button on a page - and a status
   - the brand dot - so a ring in it reads as "the accent" rather than as "you are
   here". It is also 3.06:1 against the rail's own ground, which passes by a hair. A
   white ring on a dark ground is unmistakable, and it is visible on every ground the
   product uses: the page, a card and the rail.

   The form fields keep their own treatment - a border and a glow - which is the accent
   as a *border* and not as a fill, and which is what they have always had.

   The tab rail's buttons are named here because they are new to the sheet's vocabulary
   of focusable things: a `<button>` with no rule of its own inherits nothing, and the
   rail's own ground is the one the accent ring was measured against. */
.btn:focus-visible, summary:focus-visible, .side-tab:focus-visible,
[data-dialog-open]:focus-visible, a:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}
/* A dialog takes focus when it opens, so the frame itself drew that ring: the white outline
   around the popup. Its own controls still get their themed ring from the rule above. */
dialog:focus, dialog:focus-visible { outline: none; }
input.autocomplete:focus { box-shadow: none; }
input[type=checkbox] { accent-color: var(--accent); width: 14px; height: 14px; }
/* Radio needed accent-color too, or the export dialog's groups sat untinted in the default
   dark theme. */
input[type=radio] { accent-color: var(--accent); width: 14px; height: 14px; }
input[type=file] { font-size: 0.9231rem; color: var(--muted); }
input[type=file]::file-selector-button {
  margin-right: 8px;
  padding: 3px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
input[type=file]::file-selector-button:hover { border-color: var(--accent); color: var(--accent); }
textarea { font-family: var(--mono); font-size: 0.9231rem; }
.checkbox-row { display: flex; align-items: center; gap: 6px; }
/* A format rule's scope pill lines up down the right edge; the name takes the slack. */
.format-rule .rule-name { flex: 1; min-width: 0; }
/* The `started` state is the size of the button it replaced, so the row does not jump. */
.action-done { padding: 7px 11px; }
.checkbox-row label { margin: 0; text-transform: none; letter-spacing: 0; }
.form-actions { display: flex; gap: 8px; margin-top: calc(12px * var(--space)); }

/* Modal dialogs (e.g. API key creation). */
dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  /* The plane the popup floats on. Its own chrome and viewport are painted inside it, so this
     shows only at the frame - but it is what the popup *is*, and what stands it off the page it
     is over. */
  background: var(--raised);
  color: var(--text);
  /* **The frame carries no padding.** A popup is a miniature of the shell, so its head and its
     sidebar *are* the chrome and they have to reach the frame's edges: a rule inset by 16px is a
     rule that stops in the middle of the popup, which is what made it read as a box of loose
     content rather than as a small console. Each part carries the padding it needs. */
  padding: 0;
  width: min(420px, calc(100vw - 32px));
}
/* A taller popup than the viewport scrolls, capped at 80% of the screen. The head stays put
   and only the body moves, so Exit is reachable without scrolling to the bottom.
   **`height: fit-content` is what lets the centring work.** A modal dialog is centred by the UA
   sheet - `inset: 0` with `margin: auto` - and an `auto` height under both pinned edges is a box
   that *stretches* to the screen instead, because the margins have nothing left to share. It is
   stated here rather than in the phone block on purpose: that block names ids to out-rank the
   dialogs carrying their own width, so a `height` in it would out-rank the fixed height a popup
   with panes takes as well, and the panes would resize the frame on every tab. */
dialog[open] {
  display: flex;
  flex-direction: column;
  height: fit-content;
  max-height: 80vh;
  /* Clipped to the radius, or the head's square corners sit outside the frame's rounded ones. */
  overflow: hidden;
  /* A short rise-and-fade rather than an animated height: animating `height` needs a known
     end value, and every one of these popups is content-sized. */
  animation: dialog-in 0.15s ease-out;
}
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { dialog[open] { animation: none; } }
/* **A popup with panes keeps one height.** The frame is the console and the panes are what changes
   inside it, so sizing the frame to the content made the popup jump every time a reader moved
   between tabs - and on a phone, where the popup is most of the screen and it is *centred*, a frame
   that resizes moves its own top and bottom edges as well, so the whole thing shifts under the
   thumb using it. It takes a fixed share of the screen instead: the panes scroll, and a pane with
   less in it leaves the rest as the viewport it is. A dialog with no panes still sizes to its
   content, because a small form in a tall box is a small form with a hole under it. */
dialog:has(.dialog-tabs) { height: 80vh; }
/* The wide shape, for a popup with a sidebar. Set by ui.js from `data-dialog-wide` on the
   fragment, so the short forms keep the narrow dialog they were designed at. */
.dialog-wide { width: min(880px, calc(100vw - 32px)); }
/* The body is the fragment's box. A plain fragment is content on the page ground, with the
   padding the frame no longer supplies. A *tabbed* one fills the body with the popup's own
   sidebar layout, and then the two parts paint their own planes - so the body keeps nothing of
   its own, and the scroll moves inside the parts, which is what holds the sidebar still while
   the viewport scrolls. `:has()` is a progressive enhancement: without it the popup scrolls as
   one piece, as it did before.
   `.dialog-body` is that box as a *class*, shared with the standalone dialogs: their forms
   used to sit straight on `--raised` under the `--surface` head, which made them the dark
   frame's own outliers of the popup family. The shared `#detail-dialog` is the reference; the
   class says the body half of the shape, and every dialog's content carries it.

   The content plane is **the page ground, not a lighter grey of its own.** A dialog is a
   miniature of the shell - head and sidebar on `--surface`, the viewport they frame on the
   ground - and its content used to sit on a middle grey (`color-mix` over `--surface`) that
   read as a lit strip inside the frame. The token went away rather than being re-derived:
   with it on `var(--bg)` it would be a second name for the ground, so the rules below read
   `var(--bg)` directly and there is no dead token left behind. */
.dialog-body,
#detail-dialog-body {
  flex: 1 1 auto; min-height: 0; overflow: auto;
  background: var(--bg);
  padding: calc(12px * var(--space)) 16px;
}
#detail-dialog-body:has(.dialog-tabs) {
  display: flex; overflow: hidden; padding: 0; background: none;
}

/* The popup's sidebar: the shell's rail, in miniature - the chrome plane, a rule down its right
   edge, and the selected row marked the way the rail marks one. */
.dialog-tabs {
  display: grid; grid-template-columns: 172px minmax(0, 1fr);
  /* Stretched rather than sized to its content: the sidebar's rule *is* the popup's interior, so
     it is as tall as the popup and not as tall as the list of tabs. */
  flex: 1 1 auto; min-height: 0; align-items: stretch;
}
.dialog-side {
  display: flex; flex-direction: column; gap: 2px;
  /* The rule between the chrome and the viewport. Without one the two columns run together: the
     tabs are unfilled buttons and the pane opens with a heading at the same weight, so nothing
     said where the navigation stopped. */
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: calc(8px * var(--space));
  overflow: auto;
}
.side-tab {
  display: flex; align-items: center; gap: 6px; text-align: left;
  /* **The rail's own row, at the rail's own height.** An entry in the popup's sidebar is the same
     control as an entry in the rail, and it was a third taller than one - which is what made the
     popup's list read as a different list rather than as the same one, smaller. The accent edge is
     on the **left** for the same reason: the popup's sidebar *is* the rail, so a reader who has
     learned one has learned the other. Transparent in the base, or the selected row shifts its
     label two pixels sideways. */
  height: var(--nav-row-h);
  /* `flex: none` for the reason the rail's own rows carry it: a row with a specified height can
     still be *shrunk* as a flex item, and a sidebar longer than its panel should scroll rather
     than squeeze its entries flat. */
  flex: none;
  padding: 0 10px; border: 0; border-left: 2px solid transparent;
  background: none; color: var(--text); font: inherit; font-size: 0.95rem;
  cursor: pointer;
}
.side-tab:hover { background: var(--panel); }
/* The selected tab: a light highlight and the accent edge, never an accent *fill*. A filled row
   competes with the pane it opens, and the rail's own selected row has read this way all along -
   it is the same control in two places, so it is the same treatment. */
.side-tab.is-on {
  background: var(--panel-2); border-left-color: var(--accent);
  color: var(--text); font-weight: 600;
}
.side-tab .count { margin-left: auto; color: var(--muted); font-size: 0.8462rem; }
/* The panes sit on the page ground, the same plane the body rule gives a plain fragment - the
   tabbed popup's viewport *is* its body, only scrolled per pane so the sidebar stays put. */
.dialog-panes { min-width: 0; overflow: auto; background: var(--bg); padding: calc(12px * var(--space)) 16px; }
.dialog-pane { display: none; }
.dialog-pane.is-on { display: block; }
/* A member row: a disclosure in the Members tab, a plain block in Security. */
.member-row {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 10px; margin-bottom: 6px;
}
.member-row > summary, .member-head { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.member-head { cursor: default; }
.member-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.security-form { margin-top: 10px; }
.security-form .field { margin-bottom: 6px; }
@media (max-width: 640px) {
  /* One column, and the strip sized to itself: the panes take the rest and scroll, so the tabs
     stay put above them - the same reason the rail and the tab bar stay put on a phone. */
  .dialog-tabs { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .dialog-side { flex-direction: row; flex-wrap: wrap; }
  /* The rule turns with the layout: the sidebar is a row of tabs here, so the separator is
     under it rather than beside it - and so is the selected tab's accent edge. */
  .dialog-side { border-right: 0; border-bottom: 1px solid var(--border); padding: 0 6px 8px; }
  .side-tab { border-left: 0; border-bottom: 2px solid transparent; }
  .side-tab.is-on { border-left-color: transparent; border-bottom-color: var(--accent); }
  .side-tab .count { margin-left: 4px; }
}
dialog::backdrop { background: rgba(10, 11, 14, 0.6); }
:root[data-theme='light'] dialog::backdrop { background: rgba(36, 41, 47, 0.35); }
dialog h2 { margin-top: 0; }
/* Standard dialog header: title left, exit control top-right. Shared by every
   panel dialog (see _dialog_head.html) so the exit lives in one place. The
   header is pinned and the body scrolls, so the exit stays reachable on a dialog
   taller than the viewport. */
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  /* **The title bar.** The popup is a miniature of the shell, so its head is the shell's title
     bar: the chrome plane, the full width, and the rule under it running edge to edge. It used to
     be padded text with a margin beneath it, which is a heading rather than a bar - and the rule
     stopped 16px short of each side, which is the one thing that made the popup read as a box of
     loose content rather than as a small console. */
  flex: 0 0 auto;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: calc(10px * var(--space)) 16px;
}
/* The exit: the glyph in a square the size of a rail row, which is the shape the documentation
   search gives its scope button - a small square that sits *inside* a bar, and a title bar is a
   bar. The word moved into `aria-label`, which keeps the one vocabulary for anyone not reading the
   glyph; a `<button>` carrying a glyph and no name is announced as nothing at all. `flex: none` for
   the reason .btn carries it everywhere else: a flex item shrinks by default, and a square that
   shrinks is no longer square. */
.dialog-exit {
  display: flex; align-items: center; justify-content: center;
  flex: none;
  width: var(--nav-row-h); height: var(--nav-row-h);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
  font: inherit; font-size: 1.0769rem; line-height: 1;
  cursor: pointer;
}
.dialog-exit:hover { color: var(--text); border-color: var(--border-strong); }
/* Capability picker inside the create-key dialog: one standard list. */
#key-dialog { width: min(560px, calc(100vw - 32px)); }
/* The capability picker's two shortcuts: a whole-set "Read only" and a select-all per group.
   They are ordinary checkboxes, so the picker is fully usable with no script - the shortcuts
   are the convenience, not the control. These live in the shared sheet because the picker is a
   shared partial (`ui/_caps_picker.html`) used by both panels, and they were admin-only: a
   customer editing a member's capabilities got an unstyled list. */
.key-cap-shortcut { margin-bottom: calc(4px * var(--space)); }
.key-cap-shortcut > span:first-of-type,
.key-cap-group-head > span:first-of-type { font-weight: 600; }
.key-cap-group-head {
  border-top: 1px solid var(--border);
  padding-top: calc(6px * var(--space));
}
/* The capability's own name, in the interface's font. It was `.mono`, which made nine
   permissions read as a code listing - and the monospace stack at this size is heavier than the
   sans one beside it, so the names shouted. */
.cap-name { font-weight: 600; }
/* Export dialog: statistic checkboxes as one tight column. */
#export-dialog { width: min(460px, calc(100vw - 32px)); }
#export-dialog .export-views { display: grid; gap: 6px; margin-top: 6px; }
/* Site Details action popups reuse the shared detail dialog; the assets
   popup hosts the Add/Remove split and needs the extra room (:has() is a
   progressive enhancement - without it the dialog just stays narrower). */
#detail-dialog:has(.dialog-wide) { width: min(960px, calc(100vw - 32px)); }
/* Add/Remove split inside a popup: two halves, visible center divider. */
.split-grid { display: grid; grid-template-columns: 1fr 1fr; }
.split-grid > :first-child { padding-right: 18px; }
.split-grid > :last-child { border-left: 1px solid var(--border); padding-left: 18px; }
@media (max-width: 800px) {
  .split-grid { grid-template-columns: 1fr; }
  .split-grid > :first-child { padding-right: 0; padding-bottom: 14px; }
  .split-grid > :last-child { border-left: 0; border-top: 1px solid var(--border); padding-left: 0; padding-top: 14px; }
}
/* Master action bar on the site Details tab: buttons wrap instead of
   overflowing on narrow screens. */
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; }
/* A button that posts directly, and the slot it is replaced in when it has. The slot is
   an inline-flex box so the form inside it sits in the row exactly as the button did. */
.action-slot { display: inline-flex; align-items: center; gap: 6px; }
/* Site Configuration: one setting per row - the control, then its plain-English
   description underneath. The description used to sit in a second column beside
   the field, which read fine on a full-width card and squashed to two words a line
   inside the site detail's two-column layout, where this card actually lives. */
.config-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.config-row:last-of-type { border-bottom: 0; }
/* **Fewer rows, not a two-column form.** The row stays stacked - a field and its
   description beside it is what this card's width cannot take - but the *number* of rows
   is what made the card a scroll of nine. The numeric settings go two-up in a wrapper of
   their own: three rows instead of six, and the card reads as a card. */
.config-pair { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; border-bottom: 1px solid var(--border); }
.config-pair .config-row { border-bottom: 0; }
@media (max-width: 700px) { .config-pair { grid-template-columns: 1fr; } }
.config-row > label.field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.config-row > label.field > span { margin: 0; }
/* Full width, deliberately. This was capped at 22rem on the theory that a number field
   stretched across the card reads as an empty page with a line in it - but the card is where
   an operator compares a row's label against its value, and a control that stops two thirds
   of the way across leaves the column ragged for no gain. The rows are the only thing in the
   card, so they are what sets its width; there is no second column for a cap to protect. */
.config-row > label.field input[type="text"],
.config-row > label.field input[type="number"],
.config-row > label.field select { width: 100%; }
.config-row .desc { color: var(--muted); font-size: 0.9231rem; margin: 0; }
.config-row > label.field.checkbox-row { flex-direction: row; align-items: center; padding-top: 0; }
.config-row > label.field.checkbox-row > span { margin: 0; }
/* The split-page count that rides beside a document count. Muted where it is used, and a step
   smaller here, so it reads as a note *on* the number rather than as a second number. */
.pages-note { font-size: 0.8em; font-weight: 400; }

/* A **split section**: a rail of tabs down the left and a body filling the rest. Vertical rather
   than across because the rail is a list of *resources* or *panels* and reads as a legend beside
   what it names - which is also what makes hovering one of the Health chart's tabs highlight its
   series meaningful. Under 720px it turns into a row of tabs above the body: a column of tabs on
   a phone is a column of half the screen, and the rail has to be able to sit above the thing it
   switches. One grid for both, because the chart and the panels differ in what fills the body
   and not in the shape of the split.

   **The rail is a token, not `max-content`.** Sizing it from its own contents made every card a
   little different: on the Statistics page the two chart cards and the tabbed card below them had
   rails 106px, 95px and 90px wide, so their separators stepped in and out down the page. All of
   them read `--side-rail` now. */
.side-section {
  display: grid;
  grid-template-columns: var(--side-rail) minmax(0, 1fr);
  gap: calc(16px * var(--space));
  align-items: start;
}
.side-aside { min-width: 0; }
/* `minmax(0, 1fr)`, not `1fr`: a grid track's default `auto` minimum refuses to shrink below the
   canvas's intrinsic width, so the chart would push the card wider instead of resizing. */
.side-body { min-width: 0; }
/* **The rail's figures and the plot's axis are two columns, not one list.** The chart's y axis
   draws its labels in its own gutter inside the plot, so "0" landed a few pixels past the rail's
   last figure and on the same baseline as "Avg. Asset count 5" - the axis's first tick read as a
   fifth fact in the rail. A chart card's body starts behind a rule, with a gutter of its own: the
   rail ends at the rule, and the plot's axis begins well inside its own column. */
.side-section > .side-body:has(> .chart) {
  border-left: 1px solid var(--border);
  padding-left: calc(18px * var(--space));
}
.side-tabs { display: flex; flex-direction: column; gap: 2px; }
.side-tab {
  text-align: left;
  background: none;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 0;
  padding: calc(6px * var(--space)) 10px;
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  white-space: nowrap;
  /* **The tab is a row, so a count can sit at the far end of it.** The sheet has carried
     `.side-tab .count { margin-left: auto }` since it was written, which does nothing in a
     block - and the popup's own `.side-tab` rule already makes every tab a flex row, so
     the count was only ever half-working. Spelled out here because the rail is a table of
     contents with state in it: a reader should see which section has something in it
     without opening it. The gap keeps the count off the label. */
  display: flex;
  align-items: center;
  gap: 10px;
}
.side-tab:hover { color: var(--text); background: var(--panel-2); }
.side-tab.is-on { color: var(--text); border-left-color: var(--accent); font-weight: 600; }
@media (max-width: 720px) {
  .side-section { grid-template-columns: 1fr; }
  .side-tabs { flex-direction: row; flex-wrap: wrap; }
  .side-tab { border-left: 0; border-bottom: 2px solid transparent; }
  .side-tab.is-on { border-left-color: transparent; border-bottom-color: var(--accent); }
  /* One column: there is no second column to divide from, and the gutter would be an indent. */
  .side-section > .side-body:has(> .chart) { border-left: 0; padding-left: 0; }
}

/* A **tabbed section**: the same split, where the body holds one panel at a time and the rail
   chooses it. Every pane is already rendered and a click only changes which is showing, so there
   is no round trip - the same act, and the same reason, as the popup's own sidebar.

   **Without JavaScript the rail cannot switch anything**, so it is hidden and every pane stacks:
   the page reads as it did before the tabs, rather than showing one panel and hiding the rest
   behind a control that does nothing. `data-panes` is written by `ui.js` and `stacked` is the
   markup default, the shape `data-tables` and `data-effects` already use.

   The rail's *track* goes with it. It is a fixed width now (see `--side-rail`), so a hidden rail
   would leave an empty column down the left of every pane - the pane would start 140px in, under
   nothing. One column when the tabs are off, two when they are on. */
.pane-section .side-tabs { display: none; }
.pane-section .side-pane { display: block; }
:root:not([data-panes='tabs']) .pane-section { grid-template-columns: minmax(0, 1fr); }
[data-panes='tabs'] .pane-section .side-tabs { display: flex; }
[data-panes='tabs'] .pane-section .side-pane { display: none; }
[data-panes='tabs'] .pane-section .side-pane.is-on { display: block; }

/* The figures **stack** - label above value. A two-column list in a column this narrow put the
   label and its number at opposite edges, so the eye had to travel a gap to pair them; stacked,
   each `key\nvalue` reads as one block. `tabular-nums` keeps the values aligned down the edge. */
.facts {
  margin: calc(14px * var(--space)) 0 0;
  padding-top: calc(12px * var(--space));
  border-top: 1px solid var(--border);
}
.facts dt {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: calc(8px * var(--space));
}
.facts dt:first-of-type { margin-top: 0; }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
/* **Two figures to a line on a phone.** Eight stacked lines of "label, value, label,
   value" is a screen of labels, and the pair is one fact - a phone has the width for two
   columns of a short figure and its name. */
@media (max-width: 700px) {
  .facts { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }
}
/* The note under a figure - Reachable's age and unchecked count. A block so it takes its own
   line: run inline it would push the value's tail out of the column the figures align on. */
.facts .fact-note { display: block; font-size: 0.8rem; color: var(--muted); }

/* Long source paths stay on one line; the tail truncates with a tooltip. */
.asset-path { display: inline-block; max-width: 24rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
/* Owner site (wide) + expiry (narrow) share one line in the create-key dialog. */
.key-context-grid { display: grid; grid-template-columns: 4fr 1fr; gap: 10px; }
@media (max-width: 560px) { .key-context-grid { grid-template-columns: 1fr; } }
.key-caps { display: flex; flex-direction: column; gap: 10px; }
.key-cap-group { display: flex; flex-direction: column; gap: 4px; }
.key-cap { display: flex; align-items: center; gap: 8px; font-size: 1.0rem; cursor: pointer; }
/* `.key-cap` is `display: flex`, which as an author rule beats the user-agent's `[hidden]`
   rule - so the picker's filter has to hide a label explicitly. */
.key-cap[hidden] { display: none; }
/* The picker's filter field, sized to the picker rather than growing like a filter bar's. */
.key-caps .search-field { flex: none; }
.key-cap input { accent-color: var(--accent); }
/* Expiry bar: one control holding a number and its unit, select anchored
   right; blank number means "never expires". */
.input-bar {
  display: flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
}
/* `min-width: 0` plus `flex: 1` lets the field shrink until the native spinner's up/down
   arrows are clipped, which is what made the key-expiry control look too short for its
   stepper. `flex-basis: 0` with an `auto` minimum lets it shrink only as far as the
   control genuinely needs. */
.input-bar input {
  flex: 1 1 auto;
  min-width: auto;
  border: none;
  background: transparent;
}
.input-bar select {
  flex: 0 0 auto;
  width: auto;
  border: none;
  border-left: 1px solid var(--border-strong);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}
.input-bar input:focus, .input-bar select:focus { outline: none; border-color: transparent; box-shadow: none; }
.input-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
/* Job-details popup: roomier than the key-creation dialog. */
#detail-dialog { width: min(680px, calc(100vw - 32px)); }
#detail-dialog pre { margin: 0; }
/* Manage-assets popup: tree | selection side by side, the rule bar pinned at
   the bottom (without :has() support the whole dialog body scrolls). */
#detail-dialog:has(.manage-layout) #detail-dialog-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.manage-layout {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 10px;
}
.manage-col { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.manage-pane {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 4px;
  /* Theme-following thin scrollbar on both panes (explorer, selection). */
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.manage-bar {
  flex: 0 0 auto;
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 10px;
}
@media (max-width: 800px) { .manage-layout { grid-template-columns: 1fr; } }
/* Logs/Workers: finished-run history beside the live queue (4:1). */
.jobs-split {
  display: grid;
  grid-template-columns: 4fr 1fr;
  gap: 14px;
  align-items: start;
}
.jobs-split > .card { min-width: 0; }
.queue-list { list-style: none; margin: 0; padding: 0; }
.queue-list li {
  display: flex;
  align-items: center;
  /* Wrap rather than scroll. The report was a horizontal scrollbar on a page that is
     otherwise comfortable, and a row that scrolls is a row nobody scans. `.clip` on the
     site name is what keeps it narrow; the pills and the time never shrink. */
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.queue-list li:last-child { border-bottom: none; }
.queue-list .nowrap { white-space: nowrap; }
@media (max-width: 900px) {
  .jobs-split { grid-template-columns: 1fr; }
  /* **The search control and the thing it submits, on one line.** Once the two cards stack, the
     field's 16rem basis is wider than the header leaves it, so the button wrapped onto a line of
     its own and the applied filter followed on a third: three stacked steps for one query. The
     field takes what the button leaves. */
  .jobs-split .filters .search-field { flex: 1 1 6rem; min-width: 0; }
  .jobs-split .filters .btn { flex: none; }
}
/* Asset tree inside the popup: rows are whole-line click targets; folders
   show a caret, files their page count. Selected rows tint with the accent. */
.tree { list-style: none; margin: 0; padding: 0; font-size: 1.0rem; }
.tree-node { margin: 0; }
.tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
}
.tree-row:hover { background: var(--panel-2); }
.tree-row.selected { background: var(--accent-soft); }
/* Rows never widen their pane: names ellipsize instead of forcing a
   horizontal scrollbar across the whole popup. */
.tree-row .tree-name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tree-row .tree-hint { margin-left: auto; flex: 0 0 auto; }
.tree-row .pill { flex: 0 0 auto; }
.tree-caret {
  flex: 0 0 auto;
  width: 18px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-size: 0.8462rem;
  line-height: 1;
}
.tree-caret.open { color: var(--text); transform: rotate(90deg); }
.tree-caret-spacer { flex: 0 0 auto; width: 18px; }
.tree-hint { margin-left: auto; }
.tree-children { list-style: none; margin: 0; padding: 0 0 0 16px; }
.selection-list { list-style: none; margin: 0; padding: 0; font-size: 1.0rem; }
.selection-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: var(--radius);
}
.selection-list li:hover { background: var(--panel-2); }
.selection-path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selection-remove {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
}
.selection-remove:hover { color: var(--danger); }
/* Rule chips at the bottom of the popup: checkbox + name + scope pill. */
.rule-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rule-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px 3px 8px;
  cursor: pointer;
  font-size: 0.9231rem;
}
.rule-chip input { margin: 0; accent-color: var(--accent); }

/* Why a worker is gone (lane crash, lost heartbeat) under its name. */
.worker-error { color: var(--danger); font-size: 0.8462rem; margin-top: 2px; }

/* Badges / status rules */
.pill {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.8462rem;
  font-weight: 600;
  background: var(--panel-2);
  color: var(--muted);
  line-height: 1.5;
}
.pill.active, .pill.success { border-color: rgba(31,122,61,.35); background: rgba(31,122,61,.08); color: var(--ok); }
.pill.inactive, .pill.stopping, .pill.offline, .pill.idle, .pill.pending { border-color: var(--border); background: var(--panel-2); color: var(--muted); }
.pill.pending_payment, .pill.partial, .pill.warn, .pill.interrupted, .pill.unverified, .pill.blocked { border-color: rgba(154,106,11,.35); background: rgba(154,106,11,.08); color: var(--warn); }
.pill.suspended, .pill.failed { border-color: rgba(192,57,43,.4); background: rgba(192,57,43,.08); color: var(--danger); }
/* Deleted is its own tone rather than reusing danger: nothing is wrong or
   hostile about a retired site, and it should not read as a billing problem. */
.pill.deleted { border-color: var(--border); background: var(--panel-2); color: var(--muted); text-decoration: line-through; }
/* `processing` and `running` are the two accent-tinted statuses. Their background and text
   come from the theme, so the border must too - it was a hardcoded blue that stayed blue
   under every theme, which is a red TapAway pill with a blue outline. The semantic pills
   above can stay hardcoded: green, amber and red mean the same thing in every theme, and
   `accent` does not. `running` needs its own selector because templates interpolate the
   status straight into the class name, and without a rule a live job renders untinted -
   identical to a queued one, which is the one distinction that matters on the workers page. */
.pill.processing, .pill.running {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
  color: var(--accent);
}
/* Pills on the light themes. A 8-14% tint of a dark hue over a white card is very nearly
   white, so the border was carrying the whole shape and the fill said nothing - the same hues
   at strength. The kind chips take a neutral fill instead: their colour is in the border and
   the label already, and repeating seven hex pairs for one theme would be seven more things
   to keep in step. */
:root[data-theme^='light'] .pill.active,
:root[data-theme^='light'] .pill.success { border-color: rgba(31,122,61,.6); background: rgba(31,122,61,.16); }
:root[data-theme^='light'] .pill.pending_payment,
:root[data-theme^='light'] .pill.partial,
:root[data-theme^='light'] .pill.warn,
:root[data-theme^='light'] .pill.interrupted,
:root[data-theme^='light'] .pill.unverified,
:root[data-theme^='light'] .pill.blocked,
:root[data-theme^='light'] .pill.paused,
:root[data-theme^='light'] .pill.skipped { border-color: rgba(154,106,11,.6); background: rgba(154,106,11,.16); }
:root[data-theme^='light'] .pill.suspended,
:root[data-theme^='light'] .pill.failed { border-color: rgba(192,57,43,.65); background: rgba(192,57,43,.16); }
:root[data-theme^='light'] .pill.processing,
:root[data-theme^='light'] .pill.running { background: color-mix(in srgb, var(--accent) 16%, transparent); }
:root[data-theme^='light'] .pill[class*='kind-'] { background: var(--panel-2); }
.pill.cancelled { border-color: var(--border); background: var(--panel-2); color: var(--muted); text-decoration: line-through; }
.pill.paused { border-color: rgba(154,106,11,.35); background: rgba(154,106,11,.08); color: var(--warn); }

/* Job *kind* chips, by kind. Every kind chip was `.pill processing`, so the seven kinds
   were indistinguishable at a glance -- the report this answers.

   Deliberately a **different vocabulary from the status palette above**, and monospace so
   the two are separable by shape as well as hue. A kind chip and a status chip sit on the
   same row (see the queue list), so borrowing green for "index" would leave a reader
   guessing whether a green chip means `active` or `index`. These hues are chosen to sit
   apart from the ok/warn/danger/accent set rather than to extend it.

   A new `KIND_*` needs a rule here or it renders neutral. `tests_worker_kinds.py` fails
   until it has one, so the gap is loud rather than invisible. */
.pill[class*="kind-"] { font-family: var(--mono); font-weight: 600; }
.pill.kind-index     { border-color: rgba(23,107,74,.4);  background: rgba(23,107,74,.10);  color: #17a06a; }
.pill.kind-gc        { border-color: rgba(122,92,17,.4);  background: rgba(122,92,17,.10);  color: #b08900; }
.pill.kind-stats     { border-color: rgba(88,86,214,.4);  background: rgba(88,86,214,.10);  color: #7a78e8; }
.pill.kind-rescan    { border-color: rgba(16,124,130,.4);  background: rgba(16,124,130,.10);  color: #17a3aa; }
.pill.kind-import    { border-color: rgba(168,72,20,.4);  background: rgba(168,72,20,.10);  color: #d0762f; }
.pill.kind-reconvert { border-color: rgba(140,74,160,.4); background: rgba(140,74,160,.10); color: #ab63c4; }
.pill.kind-cert      { border-color: rgba(20,90,150,.4);  background: rgba(20,90,150,.10);  color: #2f8fd0; }
/* Mauve, not a shade of the blue-greys: the host sampler is the one kind that runs on a
   timer and touches nothing of the customer's, and it should not read as a sibling of
   `cert` or `stats` in a column where the colour is the whole label. */
.pill.kind-health    { border-color: rgba(150,64,120,.4); background: rgba(150,64,120,.10); color: #c069a0; }

/* A kind as a **stub**: the colour and two initials, in a small rounded chip. The registry's
   Kinds column and the queue list carry many kinds in a narrow track, where the word repeated
   what the colour already said and widened the row past the point of scanning. The full name
   and the description stay in `title`, and the Job history keeps the word, because that table
   has the width and is where a kind is read rather than glanced at.

   Two initials rather than the colour alone: seven unlabelled colours is a vocabulary the
   reader has to have memorised. At 13px a pair of characters was a smudge, so the chip is
   sized to its text now rather than to a fixed square. */
.pill[class*='kind-'].stub {
  display: inline-block;
  min-width: 24px;
  padding: 0 4px;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.7;
  text-align: center;
  border-radius: 3px;
  vertical-align: -1px;
}

/* Skipped pipeline runs: deliberate, not an error (amber). */
.pill.skipped { border-color: rgba(154,106,11,.35); background: rgba(154,106,11,.08); color: var(--warn); }
/* Status pills inside table cells: uniform width + centered label so the
   right edges line up regardless of the status word length. */
td .pill { min-width: 58px; box-sizing: border-box; text-align: center; }
/* The same floor for pills inside a leaderboard *card* grid, where the column is a
   fractional track rather than a `td`. Without it "interrupted" is visibly wider than
   "done" and "failed", so the Status column looks ragged rather than like a column. */
.lb-jobs .pill, .lb-jobs-site .pill { min-width: 74px; box-sizing: border-box; text-align: center; }

/* Storage columns: the used-size number is right-aligned in a fixed-width
   slot so values line up vertically across rows despite unit changes. */
.val { display: inline-block; min-width: 7ch; text-align: right; }

/* Customer rows: one name column wide enough for the "no owner" warning under it, and an
   action column with room for both buttons. */
.lb-customers { --lb-grid: 1.7fr 1.1fr .9fr .7fr .9fr 1fr max-content; }
/* Leaderboard lists: a spaced header line (.lb-cols) whose columns line up
   with every card row through a shared grid (--lb-grid, set per list on the
   .lb-table wrapper). Rows are flat cards (.lb-head) or dropdowns
   (> summary) whose expansion reveals a .lb-detail body. Lists that only
   need ranked rows (agents, outcomes) stay outside .lb-table. */
.lb-table > .lb-cols,
.lb-table .lb-row > summary,
.lb-table .lb-row > .lb-head {
  display: grid;
  grid-template-columns: var(--lb-grid, 1fr);
  /* No gap. The separation is each cell's own padding, which is also what lets the rule
     between rows run the full width - there is no card border for it to stop short of - and
     the header and each row are separate grids that only line up while their tracks resolve
     identically. */
  gap: 0;
  align-items: center;
}
.lb-table > .lb-cols {
  padding: 0;
  border-bottom: 1px solid var(--border-strong);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8462rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
/* A header cell wraps; a row cell clips. The header is the one thing in a list that must be
   readable, and it was clipping with everything else - "STATUS" and "ACTIONS" came out as
   "STAT…" and "ACTIO…" on every narrow card, which is a column nobody can name. Wrapping it
   cannot move a column, because the tracks are `fr` and resolve from the container. */
.lb-table > .lb-cols > * {
  min-width: 0; padding: calc(6px * var(--space)) 10px;
  overflow: visible; white-space: normal;
}
.lb-table > .lb-cols > :last-child { text-align: right; }
/* A row cell clips instead of widening its column: the header and each row are separate grids,
   so any content-driven width there would push that row's later columns sideways and break the
   shared alignment. */
.lb-table .lb-row > summary > *,
.lb-table .lb-row > .lb-head > * {
  min-width: 0; padding: calc(5px * var(--space)) 10px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Sortable header labels read as headers, not links. `.th-sort` is named as well as
   positional: it is carried by 5 templates and until now no rule mentioned it, so it
   read as a class doing a job nothing did. Both selectors are kept -- the positional
   one covers headers that carry no class. */
.lb-table > .lb-cols a, .lb-table > .lb-cols a.th-sort { color: inherit; }
.lb-table > .lb-cols a:hover, .lb-table > .lb-cols a.th-sort:hover { color: var(--accent); text-decoration: none; }
/* Sort direction: one glyph, rotated. `<` turned a quarter turn points up and `>` turned
   the same way points down, so the pair reads as one control seen from two directions rather
   than as two characters that happen to sit in the same table. The template names the
   direction; this owns the drawing. */
.sort-arrow::before {
  content: ">";
  display: inline-block;
  margin-left: 3px;
  font-size: 0.9em;
  line-height: 1;
  transform: rotate(90deg);
}
.sort-arrow.asc::before { content: "<"; }

th a.th-sort { color: inherit; text-decoration: none; }
th a.th-sort:hover { color: var(--accent); }
.lb-table .clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* A row is a line in a list, not a card: no border of its own, no radius, and the only
   separator is the rule under it. The ranked leaderboards used to be the exception - a `.lb-line`
   flex row outside `.lb-table`, keeping its card because it had no columns to line up - and they
   are tables now too, so `.lb-table` really is the only list primitive. */
.lb-table .lb-row {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: none;
}
.lb-table .leaderboard { gap: 0; }
.lb-table .lb-row > .lb-head,
.lb-table .lb-row > summary { padding: 0; }
.lb-table .lb-row:hover { background: var(--panel-2); }

/* **A list that *is* the card's child bleeds to the card's edges; a list inside a dropdown body
   does not.** The dropdown bodies are lists too now, and they sit inside the rows - so the bleed
   that aligns the outer list with the card pushed the inner one past the expansion's edges, and its
   first cell carried the card's inset on top of its own. `>` is the whole distinction: a nested list
   is a grandchild of a row, never the card's child. */
.card > .lb-table {
  margin-left: calc(-1 * var(--card-x));
  margin-right: calc(-1 * var(--card-x));
}
.card > .lb-table > .lb-cols > :first-child,
.card > .lb-table > .leaderboard > .lb-row > summary > :first-child,
.card > .lb-table > .leaderboard > .lb-row > .lb-head > :first-child,
.card > .lb-table > .lb-row > summary > :first-child,
.card > .lb-table > .lb-row > .lb-head > :first-child {
  padding-left: calc(var(--card-x) + 10px);
}
.card > .lb-table > .lb-cols > :last-child,
.card > .lb-table > .leaderboard > .lb-row > summary > :last-child,
.card > .lb-table > .leaderboard > .lb-row > .lb-head > :last-child,
.card > .lb-table > .lb-row > summary > :last-child,
.card > .lb-table > .lb-row > .lb-head > :last-child {
  padding-right: calc(var(--card-x) + 10px);
}
/* A status cell may hold two pills (the status and an error marker). The generic cell rule
   clips with an ellipsis, so a pair that exceeded the track rendered as "failed ..." - the
   second pill's content replaced by a lone ellipsis. This cell lays its pills out instead. */
.lb-table .lb-row > summary > .lb-status,
.lb-table .lb-row > .lb-head > .lb-status {
  display: flex; align-items: center; gap: 6px;
  overflow: visible; text-overflow: clip;
}
.lb-table .asset-path { max-width: 100%; }

/* Key/value detail listing (`ui/_kv_table.html`): the list primitive with two tracks - a
   label column that holds its own width and a value column that takes the rest - so a detail
   popup's facts read as the same grammar as every other list. Two `minmax(0, …)` tracks:
   a fixed label track would clip a long label, and a value track narrower than its
   container cannot line up with the header. */
.lb-kv { --lb-grid: minmax(0, 38%) minmax(0, 1.6fr); }
/* The right-aligned last header cell is the ranked lists' grammar for counts; a key/value
   pair reads left to right, so the value header stays at the label side. */
.lb-kv > .lb-cols > :last-child { text-align: left; }
.lb-kv .lb-kv-label { color: var(--muted); font-weight: 600; }
/* A value may hold its own inline markup, and may be long: it wraps rather than clipping,
   because a clipped value in a detail popup is a fact somebody cannot read. */
.lb-kv .lb-kv-value { white-space: normal; overflow: visible; text-overflow: clip; }
.lb-row .asset-cell { display: flex; align-items: center; gap: 8px; }
.lb-row .asset-cell .asset-path { flex: 0 1 auto; min-width: 0; }
/* Action cells stretch to the last track's full width and anchor their
   buttons to the row's right edge. */
/* `flex-wrap: wrap`, because `.btn` is `flex-shrink: 0` with `white-space: nowrap`: without
   it, a row whose action column runs out of width pushes the buttons past the row and the
   card scrolls sideways instead - the "buttons cut off on a smaller screen" report.
   Wrapping keeps them inside the column. */
.lb-row .lb-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
/* A list inside a dropdown body sits under the row that opened it, inset by the caret column so
   the nesting reads. Without it a nested list starts further left than the row above it, which is
   the one thing a hierarchy must not do. The card's own inset is included because the list is
   inside the card, not beside it.
   **And it is as wide as its own content, capped.** That is the one place `max-content` is right:
   the outer list spreads to the card because the card is the reader's frame, but the expansion is
   as wide as the table's *tracks* - wider than the card for a five-column list - so spreading to it
   gave three columns a third of 666px each, two thirds of it off-screen. The cap keeps a very long
   path inside the expansion, where its own scroll takes over. */
:root:not([data-tables='fit']) .lb-table .lb-row .lb-table {
  margin-left: calc(var(--card-x) + 20px);
  width: max-content;
  max-width: calc(100% - var(--card-x) - 20px);
  /* The `1fr` ceilings exist to spread a list across the card, and a dropdown body has no card to
     spread across: in a `max-content` box they sized all three tracks to the widest one, which put
     two thirds of the list off the edge. Tight tracks are what "as wide as its content" means. Both
     dropdown bodies are three columns; a fourth would get an implicit track. */
  grid-template-columns: repeat(3, max-content);
}
/* Dropdown expansion body: indented under the caret column. */
.lb-row > .lb-detail {
  display: grid; gap: 8px;
  padding: 10px 12px 12px 46px;
  border-top: 1px solid var(--border);
}
.lb-row .rank.caret {
  /* A fixed square that centres its glyph, so the quarter turn is a spin in place.
     It used to be a bare glyph in a 20px track: left-aligned inside a box wider than
     the glyph (the shared `.rank` rule gives it a min-width past the column width), so
     `rotate()` pivoted about a centre the glyph was not on and the arrow swung
     sideways as the row opened. */
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; min-width: 20px; height: 20px; line-height: 1;
  transition: transform .12s;
}
.lb-row[open] > summary .rank.caret { transform: rotate(90deg); }
.lb-row > .lb-head { padding: 4px 12px; }
/* Pills in a leaderboard row get the same `min-width` treatment `td .pill` has had, so
   "active" and "inactive" are the same size and the column reads as a column. The `.lb-jobs`
   override below is wider because its statuses are longer words. */
.lb-head .pill { min-width: 58px; box-sizing: border-box; text-align: center; }
/* Column templates per list (assets - cache - API keys - rules - sites -
   conversion runs - worker jobs - API requests - audit entries). Only
   content-independent sizing is allowed here: a fixed px caret column plus
   fr proportions. max-content/auto tracks are sized per grid container -
   and header and rows are separate containers - so any content-driven
   track would line up differently in every row. fr resolves purely from
   the container width, which is identical for the header and all rows,
   so the columns align exactly everywhere; long text truncates via the
   cell clip rule above. Narrow split cards (dashboard board, site
   detail) use the trimmed variants below.
   **The Actions column is the exception, and it is the one that must not
   clip**: it is a control, not a value, so it is sized to its content.
   `var(--lb-actions, <px>)` resolves to `max-content` in `Dynamic` - where
   the header and the rows share one grid, so the track is measured against
   every cell in the column - and to the list's own px in `Fixed`, where
   they are separate grids and a content-sized track would break the
   alignment `Fixed` exists to keep. See the note on `--lb-actions` in the
   `Dynamic` block above. */
/* Fixed-width chrome columns (Type/Pages labels) take px so their content
   never clips and the fr columns keep all slack: px tracks resolve
   identically in the header and every row, so alignment still holds. The
   Actions set (Re-convert - Details - Delete) is the exception above: it
   was a hand-sized px too, and a control set wider than that overflowed
   the track and was cut off at the card's edge. */
.lb-asset { --lb-grid: 20px 1.6fr 56px 56px 2.6fr .9fr .9fr .9fr 1.4fr var(--lb-actions, 224px); }
.lb-cache { --lb-grid: 1.5fr 3fr .7fr .9fr 1fr 1.2fr 1.2fr var(--lb-actions, 100px); }
.lb-keys { --lb-grid: 1.3fr 1.2fr 2fr .9fr 1fr 1fr 1.2fr var(--lb-actions, 140px); }
.lb-rules-global { --lb-grid: 2.2fr 1.6fr .8fr 1.4fr var(--lb-actions, 200px); }
.lb-rules-client { --lb-grid: 1.8fr 1.2fr 1.2fr 1.3fr .6fr 1fr var(--lb-actions, 200px); }
.lb-sites { --lb-grid: 1.6fr 2fr 1.6fr 1.5fr 1.5fr max-content; }
/* The robots.txt authorisations in force: site, who granted it, when, until when, what it covers,
   and the withdraw button. */
.lb-robots { --lb-grid: 1.3fr 1fr 1fr 1fr 2.2fr max-content; }
.lb-runs { --lb-grid: 20px 1.2fr 2.8fr 1.2fr 1fr 1.4fr 1.4fr var(--lb-actions, 90px); }
.lb-runs.compact { --lb-grid: 20px 1.4fr 3.4fr 1.3fr 1.3fr var(--lb-actions, 90px); }
.lb-jobs { --lb-grid: 20px 2.2fr 2.2fr 2fr 1.6fr 3fr 2.4fr var(--lb-actions, 90px); }
/* The Workers registry: the name, the kinds, the job it is on, how many it has done, how
   it is, how long it has been up, and the one control. It was a bare table, so it is the
   one list on either surface that did not become a card per row on a phone. */
.lb-workers { --lb-grid: 1.3fr .9fr 1.6fr .8fr 1fr .9fr var(--lb-actions, 90px); }
/* The customer's own members: the name, the address, the rank, the status, and the one
   control. */
.lb-members { --lb-grid: 1.1fr 2fr 1.1fr .9fr var(--lb-actions, 90px); }
/* The domains a site is served on: the hostname, and the one control that removes it.
   **`max-content` for both**, so the list is as wide as the names and the Remove button
   sits next to the hostname it removes - rather than at the far edge of a card that is
   three times as wide as the list. */
.lb-domains { --lb-grid: max-content max-content; }
/* A site's recent jobs, on the customer's own page: the kind, the status and when it
   started. */
.lb-jobs-site-client { --lb-grid: 1.2fr 1fr 1.4fr; }
.lb-jobs-site { --lb-grid: 20px 1.6fr 2fr 2.4fr 2fr var(--lb-actions, 90px); }
/* **The site page's own lists.** They were bare `<table>`s - six of them on one page - so
   they had no header rule, no width setting and no phone layout, which is the house's
   rule that `.lb-table` is the only list primitive.
   The dead links: the path, where it redirects to, and when it was marked. */
.lb-dead-links { --lb-grid: 2.4fr 2fr 1.2fr; }
/* The site's own exclusion rules: the value, the kind, the three effects, the note, and
   the one control. **Seven columns do not fit a phone** - this table measured 475px of
   itself inside a 368px card, and the Note and the Remove button were the 127px that
   was off the screen - so the phone's card-per-row layout carries it instead. */
.lb-exclusions { --lb-grid: 2.2fr 1.2fr 0.8fr 0.9fr 0.8fr 2fr var(--lb-actions, 90px); }
/* A CMS group's own rules: the path, the kind of match, and why it is excluded. */
.lb-filter-rules { --lb-grid: 1.6fr 1fr 3fr; }
/* The AI sitemap: the URL the site serves it under, the original path it came from, the
   size of the rendition and when it was last written. **It was a bare `<table>`** - the only
   list in the product that was - so it had no header rule, no width setting and none of the
   phone layout, and the bytes and the modified date were unreachable on a phone. The URL
   leads because it is the row's own name; the size is the narrowest of the four. */
.lb-sitemap { --lb-grid: 2.8fr 1.3fr .6fr 1.1fr; }
.lb-api { --lb-grid: 20px 1fr .8fr 3fr .9fr 1fr 1.4fr var(--lb-actions, 90px); }
.lb-audit { --lb-grid: 20px 1.4fr 1.2fr 1.2fr 2.2fr 1.4fr var(--lb-actions, 90px); }
/* The system log: the level, the logger, the message, the trace id and when. The message
   takes the room because it is the row's own text, and the trace id is a machine
   identifier - narrow, and never wrapped. */
.lb-system { --lb-grid: 20px .8fr 1.4fr 3fr 1.2fr 1fr var(--lb-actions, 90px); }
/* Customer panel (`app.`) equivalents. Same component, fewer columns - the client sees their
   own slice, so a separate grid rather than a shared one that would leave empty tracks. */
.lb-assets-client { --lb-grid: 2.2fr 2.2fr .8fr var(--lb-actions, 220px); }
.lb-cache-client { --lb-grid: 2.6fr .8fr 1.3fr; }
.lb-jobs-client { --lb-grid: 1.4fr 1fr 1fr 1.2fr 1.2fr 2.2fr; }
.lb-runs-client { --lb-grid: 1.2fr 2.4fr 1fr 2.4fr 1.2fr var(--lb-actions, 90px); }
.lb-api-client { --lb-grid: 1fr 3fr .9fr .9fr 1.3fr; }
.lb-audit-client { --lb-grid: 1.2fr 1.2fr 1.8fr 1.2fr var(--lb-actions, 100px); }
.lb-signins-client { --lb-grid: 1.2fr 1fr 1.6fr; }
/* Dashboard summary and the rule list, which have no admin counterpart to share a grid
   with: the overview's job list is a four-column digest, and the format rules carry the
   pattern and its replacement inline. */
.lb-jobs-mini { --lb-grid: 1.2fr 1.4fr 1fr 1.4fr; }
.lb-format-rules { --lb-grid: 1.6fr 1.2fr 1.2fr 1fr 2.2fr 2.2fr var(--lb-actions, 90px); }

/* **The ranked boards: a rank, what is being counted, and the count.** These used to be
   `.lb-line` - a flex line inside a card row, deliberately *outside* `.lb-table` - which gave them
   no header, no columns, and no answer to the width setting: they were the one list that stayed
   card-shaped whatever a reader chose, and the one place a value could not be read across rows.
   They are tables now. `max-content` for the rank because a rank is one or two characters and
   `fr` would hand it a share of the card; the count is the last track, as in every other list. */
.lb-traffic { --lb-grid: 20px max-content 1.6fr 1.6fr max-content; }
/* The trace list: a caret column, a timestamp, the layer, the event, the detail and the
   site. It declared no grid, so it fell back to the header-counted ladder - which hands
   the empty caret track a sixth of the width for a 20px arrow. Every other list declares
   its own columns, and this one is the only one that did not. */
.lb-trace { --lb-grid: 20px 1fr .8fr 1.4fr 2.2fr 1fr; }
/* The dashboard's failures board: a timestamp, the kind, what broke, and the link to
   where it goes. It is the trace list's shape with an actions column instead of a site
   one - a site is inside "what broke", because the failures of several kinds share the
   card and a kind without a site (the system log) has none to show. */
.lb-failures { --lb-grid: 20px 1fr .9fr 3fr var(--lb-actions, 90px); }
.lb-agents { --lb-grid: 20px max-content 1fr max-content; }
.lb-outcomes { --lb-grid: max-content 1fr max-content; }
.lb-missed { --lb-grid: max-content 1fr max-content; }
.lb-missed.show-site { --lb-grid: max-content 1fr 1fr max-content; }
.lb-top-groups { --lb-grid: 20px 1fr 1fr max-content; }
.lb-top-rows { --lb-grid: max-content 1fr max-content; }
.lb-history { --lb-grid: 20px max-content 1fr max-content; }
/* A dropdown body is a list too: the per-site pages and a model's products, under the row that
   opened them. No caret column - the row above it is the caret. */
.lb-pages { --lb-grid: max-content 1fr max-content; }
.lb-products { --lb-grid: max-content max-content 1fr; }
/* The vendor's colour dot and its name are one cell: as two items they would be two columns, and
   the dot would get a track of its own. */
.lb-row .vendor-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
/* The anchored Models board is the one list that scrolls vertically, so its header has to come
   with it rather than sliding out of the top of the card. */
.models-anchored > .lb-cols { position: sticky; top: 0; background: var(--panel); }

/* Pager */
.pager { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pager-links a { text-decoration: none; padding: 1px 5px; border-radius: var(--radius); }
.pager-links a:hover { background: var(--panel-2); color: var(--accent); }
.pager-current { color: var(--accent); }

/* Misc */
.muted { color: var(--muted); }
.small { font-size: 0.9231rem; }
.mono { font-family: var(--mono); overflow-wrap: anywhere; }

/* Storage usage severity (sites table): amber / orange / red at 75/85/95%.
   Declared after .muted so the severity wins on "muted small quota-*" spans. */
.quota-warn { color: var(--warn); }
.quota-alert { color: #e0885c; }
.quota-danger { color: var(--danger); font-weight: 600; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.flex { display: flex; gap: 8px; align-items: center; }
/* `.wrap` on a flex row was in 16 templates and meant nothing, because `.flex` never
   set flex-wrap. Those rows are chip bars whose whole point is reflowing when the
   viewport narrows; without this they stay one long line. */
.flex.wrap { flex-wrap: wrap; }
.flex.between { justify-content: space-between; }
.inline-form { display: inline-flex; align-items: center; vertical-align: middle; }

/* Filter bars: search wider than selects, identical proportions everywhere */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: calc(12px * var(--space)); }
/* A filter bar that carries a search box fills the row. Without this the whole bar
   shrink-wraps to the field's `flex-basis` plus its button, so the search box stops well
   short of the space available while the suggestion list under it - which is as wide as the
   field - reads as the wider control. `:has()` so a filter row made of buttons (Statistics'
   window picker) is left alone; a row with no search box has nothing to fill the space. */
.filters:has(.search-field) { flex: 1 1 auto; }
/* The *input* has to fill too, and this is the rule that was missing. `.filters input[type=text]`
   below is `0,2,1` and `.search-field input` is `0,1,1`, so the fixed 18rem won on every filter
   bar: the form grew, the field around the input grew, and the input inside it stayed 18rem -
   which is exactly the report, "the bar does not span but the suggestions do". The suggestions
   are positioned against `.search-field`, so they were the only part that looked right. */
.filters .search-field input[type="text"] { width: 100%; }
/* Two controls that belong together travel together. The Statistics row mixes a set of
   window buttons with a scope select and an Export button; wrapping put Export alone on its
   own line, which reads as a detached control rather than as "export what you just picked".
   `flex: none` so the pair wraps as a unit instead of the select growing to fill the row. */
.control-group { display: inline-flex; align-items: center; gap: 6px; flex: none; }
/* **A row of chips is one control, not a sentence.** A borderless ghost button beside a
   solid accent one reads as a sentence with a word in red, and five solid accent fills on
   one screen is five things shouting. The group is one bordered track, the chips inside it
   share it, and the selected one is marked by the ground, the accent's text and a rule
   under it - which leaves the page's one solid accent button as the page's primary
   action. */
.chip-group {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1px;
  gap: 0;
}
.chip-group > .btn.small {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}
.chip-group > .btn.small:hover { background: var(--panel); color: var(--text); }
.chip-group > .btn.small.primary {
  background: var(--panel-2);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--accent);
}
.chip-group > .btn.small.primary:hover {
  background: var(--panel-2);
  color: var(--accent);
}
/* `select` is `width: 100%` globally. In a shrink-to-fit group that resolves to "as wide as
   the longest option", so one site with a long name pushed the Export button past the
   viewport - a page-wide horizontal scrollbar from a header control. Capped and content-sized
   instead; the group still travels as a unit because `flex: none` is above. */
.control-group select { width: auto; max-width: 12rem; }
.filters input[type="text"] { width: 18rem; }
.filters select { width: 10rem; }
/* **The one filter-bar contract: filter types on the left, a flexible spacer, the timeframe
   or period control on the right.** Two named groups carry the two halves in every surface
   that has both — the customer log pages' forms, the dashboard leaderboard's chip row and
   the chart card's view/period rows — and `.filter-period`'s `margin-left: auto` is the
   spacer itself: it eats whatever room the types leave, so the right group is flush right
   whether the bar is a form's shrink-wrapped row or a card's full-width one, and the pair
   wraps to its own (still right-flush) line on a phone. A bar that carries only a timeframe
   (the statistics cards' chip rows) uses the same group for the same result. */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-types { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-period {
  display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-left: auto;
}
/* The chip-track forms of the two groups keep the track's own zero gap: the chips are one
   control, and an eight-pixel spread inside the bordered track reads as five controls. */
.chip-group.filter-types, .chip-group.filter-period { gap: 0; }
/* Filter-value suggestions (ui.js). The list is positioned against the input's own parent,
   which is why the form becomes the containing block: a fixed position would detach from the
   field it belongs to as soon as the page scrolls. */
form[data-debounced-submit] { position: relative; }
/* The search box and its suggestion dropdown. The dropdown is anchored to the *field*
   rather than to the filter bar: `position: absolute` under a static parent resolves to the
   bar's own origin, which put the list on top of the box you were typing in. */
.search-field { position: relative; display: flex; flex: 1 1 16rem; min-width: 12rem; }
.search-field input { width: 100%; }
/* Room for the clear button, which is pinned over the input's right edge rather than sitting
   beside it as a second control. On the *input* rather than on `.search-field`, because the
   field is what the text would otherwise run under. */
.search-field input[type="text"], .search-field input[type="search"] { padding-right: 1.8rem; }
.search-clear {
  position: absolute; top: 50%; right: 3px; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 1.35rem; height: 1.35rem;
  border-radius: var(--radius); color: var(--muted); text-decoration: none;
  font-size: 1.0769rem; line-height: 1; cursor: pointer;
}
.search-clear:hover { color: var(--text); background: var(--panel-2); }
/* Applied filters, under the box they were typed into. `flex-basis: 100%` is what puts them on
   their own row: the bar is a wrapping flex row, so the pills take a full row and the box, the
   button and everything else stay put. */
.filter-pills { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
/* The pill is `.pill`'s shape - the same radius, border and weight - because it *is* a pill,
   and a second, rounder one read as a different kind of control. */
.filter-pill {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 1px 3px 1px 7px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--panel-2); color: var(--text);
  font-size: 0.8462rem; font-weight: 600; line-height: 1.5;
}
/* A negation is a different claim, so it looks like one: dashed rather than solid, and the
   label keeps the `!` it was typed with. */
.filter-pill.negated { border-style: dashed; }
.filter-pill-label { font-family: var(--mono); }
.filter-pill-remove {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.0769rem; height: 1.0769rem;
  border-radius: var(--radius); color: var(--muted); text-decoration: none; line-height: 1;
}
.filter-pill-remove:hover { color: var(--danger); background: var(--border); }
/* Exactly as wide as the field it completes: `min-width: 100%` plus a `24rem` cap made the
   two disagree the moment the field grew past the cap, so the box and the list under it had
   different right edges. The background is the **raised** surface, not the card's own: the
   list opens *over* a card, and a card-coloured panel on a card is a panel with no background
   at all - the text floated on the table behind it, which is the report. */
.suggest-list {
  position: absolute; top: calc(100% + 2px); left: 0; z-index: 40; margin: 0; padding: 2px;
  list-style: none; width: 100%; max-height: 14rem; overflow-y: auto;
  background: var(--raised); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.suggest-list li { padding: 4px 8px; border-radius: 3px; cursor: pointer; font-size: 0.9615rem; }
.suggest-list li.active, .suggest-list li:hover { background: var(--accent-soft); color: var(--accent); }

.error, .toast.error { color: var(--danger); }
/* **The left edge is what makes an alert an alert.** A box with a hairline border and a
   17%-white stripe is a field: the stripe is too faint to read as a rule, so what was left
   was a rounded box around some text - which is exactly what an input looks like. The rule
   is now the muted grey, which is visible without being a tone: red is a failure, amber a
   warning, and a plain note is neither. */
.alert { padding: calc(8px * var(--space)) 12px; border: 1px solid var(--border); border-left: 3px solid var(--muted); background: var(--panel); margin-bottom: calc(12px * var(--space)); }
.alert.error { color: var(--danger); border-color: rgba(224,104,95,.4); border-left-color: var(--danger); background: rgba(224,104,95,.08); }
/* warn and success were in the templates long before they were in here: 11 `warn` and
   6 `success`/`ok` banners rendered as neutral grey boxes, so an amber warning and a
   green confirmation looked identical to plain information. `.ok` is the same idea as
   `.success` spelled differently in three templates; both selectors are kept so the
   rename can happen separately from the styling that was missing. */
.alert.warn { color: var(--warn); border-color: rgba(224,176,92,.4); border-left-color: var(--warn); background: rgba(224,176,92,.08); }
.alert.success, .alert.ok { color: var(--ok); border-color: rgba(126,198,153,.4); border-left-color: var(--ok); background: rgba(126,198,153,.08); }

/* Asset preview */
.code { font-family: var(--mono); font-size: 0.9231rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; margin: 0; }
/* **A short code token is not broken.** A link tag in a card's width wraps between its
   attributes, which is right, but `word-break: break-word` also lets it break *inside* one - and
   the last character of the tag, its closing `>`, then lands alone on the next line, which reads
   as a tag that was cut off. This block breaks at whitespace only and scrolls sideways if a
   single token is still wider than it. */
.code-token { white-space: pre-wrap; word-break: normal; overflow-wrap: normal; overflow-x: auto; }
/* Syntax tint, for the detail popups' highlighted JSON and traceback listings
   (the `json_html` / `trace_html` filters). The tokens are spanned in the code
   itself; these set the colours, and nothing new is allowed to reach the page
   unescaped by anyone else. Names are `code-*`: they belong to the code family
   above, not to a source-language vocabulary. */
.code-key { color: var(--link); }
.code-str { color: var(--text); }
.code-num { color: var(--warn); }
.code-bool, .code-null { color: var(--accent); }
/* A traceback's frame lines are the boring part; the headline names what was raised. */
.trace .code-file { color: var(--muted); }
.trace .code-exc { color: var(--danger); font-weight: 600; }
/* A copy control's brief copied state. The class is written by ui.js for a moment
   and removed; a colour, not a modal, so a reader who missed the flash loses nothing. */
.btn.is-copied { color: var(--ok); border-color: rgba(126,198,153,.4); }
/* A collapsible section that *is* a card: the summary is the card's one row, given the
   section title's weight, and the caret is the browser's own marker (a disclosure is a
   semantic control here, not a script's). */
.steps-disclosure > summary,
.detail-section > summary {
  cursor: pointer; font-weight: 600;
  /* The browser's own disclosure triangle is off: the caret is this rule's, one
     glyph the rail's groups already draw, so the button is one shape everywhere. */
  list-style: none;
  display: flex; align-items: center; gap: 6px;
}
.steps-disclosure > summary::-webkit-details-marker { display: none; }
.steps-disclosure > summary .muted,
.detail-section > summary .muted { font-weight: 400; }
.steps-disclosure > summary::before,
.detail-section > summary::before {
  content: ">"; display: inline-block;
  color: var(--muted); font-size: 0.9em;
  transform: rotate(90deg);
  transition: transform 0.12s ease-out;
}
.steps-disclosure[open] > summary::before,
.detail-section[open] > summary::before { transform: rotate(-90deg); }
/* A traceback or a step trail as a pseudo-editor: a frame that sets it apart from the rest of
   the card (so it reads as nested rather than as more prose), monospace lines, and a gutter of
   line numbers. The numbers come from the <ol>, so no JavaScript is involved - the panel's
   CSP would have to allow an inline script to number lines any other way. */
.trace-box {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); padding: 8px 10px 8px 6px;
  max-height: 420px; overflow: auto;
}
/* A read-only code box: a box around a `pre.code` whose content the reader copies rather
   than edits - the detail popups' "Full request JSON" and the system log's Context
   diagnostic. The trace-box's visual grammar, for content that has no numbered gutter:
   the page ground framed and inset, a scroll cap so a captured body of any size stays
   inside the card, and nothing editable - a field or a textarea is a different component.
   Keep the Copy control naming this box (`data-copy="#…"`) when one belongs beside it. */
.code-box {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); padding: 10px 12px;
  max-height: 420px; overflow: auto;
}
.trace { margin: 0; padding-left: 3.2em; font-family: var(--mono); font-size: 0.9231rem; line-height: 1.55; }
.trace li { white-space: pre-wrap; word-break: break-word; }
.trace li::marker { color: var(--muted); }
/* Job "More" rundown inside a table cell */
.job-detail { max-height: 320px; overflow: auto; min-width: 24rem; text-align: left; }
.scroll { max-height: 70vh; overflow: auto; }
.markdown-body.preview { line-height: 1.55; }
.markdown-body.preview h1, .markdown-body.preview h2, .markdown-body.preview h3 { margin-top: 1.1em; }
.markdown-body.preview h1, .markdown-body.preview h2 { border-bottom: 1px solid var(--border); padding-bottom: .25em; }
.markdown-body.preview code { font-family: var(--mono); font-size: 0.9231rem; background: var(--panel-2); padding: 1px 4px; border-radius: 3px; }
.markdown-body.preview pre { background: var(--panel-2); padding: 10px 12px; border-radius: var(--radius); overflow: auto; border: 1px solid var(--border); }
.markdown-body.preview pre code { background: none; padding: 0; }
.markdown-body.preview blockquote { border-left: 3px solid var(--border-strong); margin-left: 0; padding-left: 12px; color: var(--muted); }
.markdown-body.preview table { border-collapse: collapse; width: 100%; }
.markdown-body.preview th, .markdown-body.preview td { border: 1px solid var(--border); padding: 5px 8px; text-align: left; }
.markdown-body.preview img { max-width: 100%; }

/* Toasts */
.toasts { position: fixed; top: 56px; right: 16px; z-index: 100; display: grid; gap: 6px; }
.toast {
  /* Flex so a long message wraps while the close button stays in the top-right corner,
     rather than riding down the middle of a wrapped paragraph. */
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
  max-width: min(360px, calc(100vw - 32px));
  font-size: 1.0rem;
}
.toast-body { flex: 1; min-width: 0; }
.toast-close {
  flex: none;
  margin: -2px -4px 0 0;
  padding: 0 4px;
  border: none;
  background: none;
  color: inherit;
  font-size: 1.1538rem;
  line-height: 1;
  cursor: pointer;
  opacity: .55;
  border-radius: 3px;
}
.toast-close:hover { opacity: 1; }
/* A visible focus ring, because a control reachable only by pointer is not dismissable by
   everyone - and this one is the only way to get a message off the screen. */
.toast-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; opacity: 1; }
/* Leaving is animated rather than instant: the toast is fixed to the corner, so an
   instantaneous removal reads as the page flickering rather than as the message going. */
.toast.leaving { opacity: 0; transform: translateX(8px); transition: opacity .18s, transform .18s; }

.toast.success { border-left-color: var(--ok); color: var(--ok); }
.toast.error { border-left-color: var(--danger); color: var(--danger); }
.toast.warning { border-left-color: var(--warn); color: var(--warn); }
.toast.info { border-left-color: var(--accent); color: var(--accent); }

/* Pager / lists */
/* Side-by-side cards split by **how many there are**, not by a ratio picked per page: two
   cards are half each, three a third each. The rule was a fixed `1fr 1.4fr` with a `.flip`
   variant to put the wide side first, which is why the same visual pair came out opposite ways
   on the Dashboard and on a site's Details tab - and why neither could answer a change in the
   count: a third card wrapped to a lone full-width row. `grid-auto-flow: column` gives every
   child its own equal track, so the count is the only thing that decides. */
.detail-grid { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
/* Two side-by-side panels get cramped before the phone breakpoint; stack early. */
@media (max-width: 1100px) { .detail-grid { grid-auto-flow: row; } }
.empty { color: var(--muted); padding: calc(20px * var(--space)); text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
/* Empty states rendered as a table cell keep their full dashed outline:
   the last-row rule strips td border-bottoms, which cut the box open. */
tr:last-child td.empty { border-bottom: 1px dashed var(--border-strong); }
.section-title { margin: calc(18px * var(--space)) 0 calc(8px * var(--space)); font-size: 1.0769rem; font-weight: 600; }

/* User menu */
.user { margin-left: auto; position: relative; }
.menu summary {
  list-style: none;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1.0rem;
  user-select: none;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: "\25be"; margin-left: 6px; color: var(--muted); font-size: 0.8462rem; }
.menu[open] summary { background: var(--panel-2); color: var(--accent); }
.menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 140px;
  background: var(--raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  padding: 4px;
  z-index: 60;
}
.menu-item {
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1.0rem;
}
.menu-item:hover { background: var(--panel-2); color: var(--accent); text-decoration: none; }
/* A form wrapping a menu item must not add its own padding on top of the
   button's, or logout renders larger than its neighbours. */
form.menu-item { padding: 0; }
button.menu-item {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
}

/* Notification bell, shared by both panels. Reuses the account menu's `details` chrome with
   the chevron turned off, and a popup sized for a list rather than a menu. */
.notif summary::after { content: none; }
.notif-bell { display: inline-flex; align-items: center; position: relative; }
/* The icon and its badge, together, so the badge can be pinned to the icon wherever the pair is
   drawn - the title bar's inline control and the tab bar's slot are the same markup. */
.notif-mark { position: relative; display: inline-flex; }
.notif-icon { width: 16px; height: 16px; }
.notif-count {
  position: absolute; top: -3px; right: -7px;
  min-width: 15px; padding: 0 4px;
  border-radius: 999px;
  /* **The badge's label is the text colour too.** It was the accent picker's ink on
     the accent's own fill - the same 3.18:1 as the primary button's label, on eleven
     pixels of type. */
  background: var(--accent); color: var(--text);
  font-size: 0.6923rem; font-weight: 600; line-height: 15px; text-align: center;
}
.notif-pop { min-width: 300px; max-width: 360px; padding: 0; }
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.notif-heading { font-weight: 600; }
.notif-clear, .notif-read {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--muted); font: inherit; font-size: 0.8462rem;
  /* `padding: 0` is why the button was exactly the height of its 11px line of text - 16px,
     on a control a finger has to hit. The 24px floor is declared with the other controls
     that sit under WCAG 2.2 AA's target minimum, further down. */
}
.notif-clear:hover, .notif-read:hover { color: var(--accent); text-decoration: underline; }
.notif-item { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.notif-item:last-child { border-bottom: none; }
/* Unread is an edge, not a background: the popup already sits on a panel colour and a second
   fill would make a long list read as a striped block. */
.notif-item.unread { box-shadow: inset 3px 0 0 var(--accent); }
.notif-title { display: block; color: var(--text); font-weight: 600; }
a.notif-title:hover { color: var(--accent); text-decoration: none; }
.notif-body { margin: 2px 0 0; color: var(--muted); font-size: 0.9231rem; }
.notif-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.notif-when { color: var(--muted); font-size: 0.7692rem; }
.notif-empty { margin: 0; padding: 16px 10px; color: var(--muted); text-align: center; }
.notif-item.level-warning .notif-title { color: var(--warn); }
.notif-item.level-critical .notif-title { color: var(--danger); }

/* Login */
.login-wrap { display: flex; justify-content: center; padding-top: 72px; }
.login-card { width: 360px; max-width: calc(100vw - 32px); text-align: center; }
.login-card form { text-align: left; margin-top: 12px; }
.login-card h1 { margin: 0 0 4px; font-size: 1.2308rem; font-weight: 600; }

/* Statistics chart (uPlot, client-rendered). Four series colours, because the combined Health
   chart draws four resources and alternating two of them made CPU and disk the same colour. */
:root {
  --chart-1: #4da3ff;
  --chart-2: #34d399;
  --chart-3: #fbbf24;
  --chart-4: #c084fc;
}
html[data-theme^='light'] {
  --chart-1: #2563eb;
  --chart-2: #059669;
  --chart-3: #d97706;
  --chart-4: #7c3aed;
}
.chart { width: 100%; min-height: 200px; overflow: hidden; position: relative; }
/* **The legend is a list of readings, not a centred paragraph.** uPlot centres it, and its own
   stylesheet appends a colon to every label - a mark that is there whether or not anything
   follows it, so a window with no readings read "Total:" and then nothing, three times. Its
   entries also have different widths, and centring them left a ragged block down the middle on a
   phone. Left-aligned, with a gap where the colon was, the markers line up on one edge and each
   value sits beside the label it belongs to. */
.chart .u-legend { font-size: 0.8462rem; color: var(--muted); text-align: left; }
.chart .u-legend .u-marker { width: 10px; height: 2px; }
/* The legend is a <table>, so the global `th, td` rule gave its label and its value a bottom
   border each - and the two did not line up, because the label's cell also carries the series
   marker and comes out a pixel taller. uPlot's own stylesheet has no borders on it: it is a
   legend, not tabular data, and it should not look like the tables further down the page. */
.chart .u-legend th, .chart .u-legend td {
  border-bottom: 0;
  padding: 0 8px 0 0;
  vertical-align: middle;
}
/* The colon uPlot puts after every label, gone: the label is muted and the value is not, and a gap
   says "this names that" without claiming there is a value when there is none. */
.chart .u-legend.u-live th::after { content: none; }
.chart .u-legend .u-value { padding-left: 6px; color: var(--text); }
/* **One gap between entries, not two.** The last cell of every row carried the label's right
   padding as well, so the space between one reading and the next was the label's inset plus
   uPlot's own 16px - and the legend's spacing was ragged for no reason a reader could see. */
.chart .u-legend tr > :last-child { padding-right: 0; }
/* **The legend is a legend, not a column heading.** The global `th` rule shouts - uppercase,
   small, letter-spaced - so every series name came out as "TOTAL: N/A" and the legend was the
   loudest thing on a page whose subject is a number. The label keeps the muted grey and
   loses the shouting; the marker still says which series it is. */
.chart .u-legend th {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  color: var(--muted);
}
/* **The x axis is not a series, but its time is.** uPlot gives the x axis a legend row of
   its own - "Time", with no marker, because the axis carries a label by default - and that
   row is the only place a chart says *when* the reading under the pointer is from, which is
   the one thing a time series cannot do without.

   The row was hidden, to quiet a legend that opened with "TIME: N/A" and took the loudest
   slot on a page whose subject is a number. That fixed the shout and took the time with it:
   the chart said no time at all, at any point, and the operator could not tell what a
   reading was from.

   The row is here instead. The label is muted grey like every other label in the legend -
   the shouting was the uppercase, which is gone - and the value is the time of the sample
   under the pointer, or the first sample's time when the pointer is off the left end of the
   plot, so the row is never empty and never a placeholder. The first row is always the x
   series: uPlot builds the legend in series order and the x series is series 0. */
.chart .u-legend tr.u-series:first-child { font-weight: 400; }
/* **The x axis has no marker, but it still held a marker's place.** uPlot gives every series a
   marker box, the x axis included - and the axis' own box is never drawn, because the axis is not
   a series. It went on taking its 14px (a 10px box and its 4px margin), so "Time" began a marker's
   width to the right of the entries under it: on a phone, where the legend wraps, the wrapped
   entry looked as though it had fallen out of the legend's left edge. Hidden, every line starts on
   the same edge, which is what a legend is. */
.chart .u-legend tr.u-series:first-child .u-marker { display: none; }
/* The sentence an empty window carries, inside the plot rather than under it. */
.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.9231rem;
  pointer-events: none;
}

/* Access leaderboard / asset history rows */
.leaderboard { display: flex; flex-direction: column; gap: 6px; }
/* Six vendor rows, then a scrollbar. The row height is not fixed (an expanded row is
   tall), so this caps the *collapsed* stack: `--lb-row` is one collapsed row plus its
   gap, and six of them is the anchor. */
.models-anchored { --lb-row: 2.5rem; max-height: calc(6 * var(--lb-row)); overflow-y: auto; }
.vendor-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.lb-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
}
/* Commit hash chip (asset history): square-ish like other containers. */
.chip {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel-2);
  font-size: 0.9231rem;
  font-weight: 600;
}
.lb-row > summary {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 12px; cursor: pointer; list-style: none;
}
.lb-row > summary::-webkit-details-marker { display: none; }
.lb-row > summary:hover { background: var(--accent-soft); }
.lb-row .rank {
  min-width: 22px; color: var(--muted); font-size: 0.9231rem; font-weight: 600;
  flex: none;
}
.lb-row .lb-hits { font-weight: 600; }
/* The count is a figure, and the header above it already aligns right - so the cell has to as
   well, or the column reads ragged. `.lb-actions` is the same treatment for a control. */
.lb-table .lb-row > summary > .lb-hits,
.lb-table .lb-row > .lb-head > .lb-hits { text-align: right; }
.lb-row > table { margin: 0; border-top: 1px solid var(--border); }
.lb-row > table thead th { font-size: 0.8462rem; }
.lb-row > .empty { padding: 8px 12px; }

/* Asset history: side-by-side diff */
.diff-table { width: 100%; border-collapse: collapse; font-size: 0.9615rem; }
.diff-table th { font-size: 0.8462rem; text-align: left; }
.diff-table td {
  padding: 1px 8px; vertical-align: top;
  font-family: var(--mono); white-space: pre-wrap; word-break: break-word;
}
.diff-table .num { color: var(--muted); text-align: right; user-select: none; width: 1%; white-space: nowrap; }
.diff-table .diff-del { background: rgba(192, 57, 43, 0.14); }
.diff-table .diff-chg { background: rgba(154, 106, 11, 0.12); }
.diff-table .diff-gap td {
  text-align: center; color: var(--muted); padding: 2px;
  font-family: var(--sans, inherit); border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
}

/* Themes. `data-theme` names a *monochrome* set - the greys - and the colour comes from a
   separate `data-accent` choice below. They were one value before, so "TapAway dark" was a
   palette of its own and wanting a different accent meant changing every grey with it.

   `:root` is the default (the console's near-black) and each variant states what it changes.
   What a **dark** variant changes is the ground and the type; the chrome is the design's, so a
   variant that restated `--panel` would be a second design rather than a second grey. A **light**
   variant does state its own chrome, because there is no glow on a light ground for a translucent
   panel to read through - a lit ground is a dark-ground device.

   Light variants share the mode-level declarations (color-scheme, the primary button's
   label, the two shadows) through `^=`, so none of them can be forgotten per variant. Both
   choices persist in localStorage via ui.js.

   The palette blocks are `[data-theme=...]` rather than `:root[data-theme=...]` so the picker's
   swatches can carry `data-theme="<variant>"` on a plain `<span>` and have the real
   variables resolve inside it. Hand-copying three colours per swatch would have drifted the
   first time a palette changed. */
:root[data-theme^='light'] { color-scheme: light; }
:root[data-theme^='light'] .toast { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
:root[data-theme^='light'] .menu-pop { box-shadow: 0 8px 24px rgba(0,0,0,.12); }
:root[data-theme^='light'] .btn.primary { color: #fff; }
:root[data-theme^='light'] .btn.primary:hover { color: #fff; }

/* A **dark** variant changes the ground and the type, and nothing else. The chrome - translucent
   panels, hairline rules, the opaque `--surface` - is the design, and a variant that restated it
   would be a second design: the white-alpha panels are what make a card sit *on* the glow rather
   than beside it, and they work on any dark ground. So these omit `--panel`, `--panel-2`,
   `--border`, `--border-strong`, `--radius` and the status colours on purpose. */
[data-theme='dark-warm'] {
  --bg: #14101a; --surface: #1a1522;
  --text: #e7e1eb; --muted: #a498ae;
}
[data-theme='dark-oled'] {
  /* OLED black: a true `#000` background, so the pixels are off on an OLED panel. The greys
     are neutral throughout; the colour is the accent's business, not the theme's. */
  --bg: #000000; --surface: #0a0a0a;
  --text: #d9d9d9; --muted: #8c8c8c;
  /* And **no wash**: two 60vw glows over `#000` are the one thing that defeats the theme - the
     panel is lit again, in the accent's colour, and the pixels are on. This is the theme that
     needed the ground to be a token, and the reason it is one. */
  --glow-a: transparent; --glow-b: transparent;
}

/* A **light** variant is the same design with the sign flipped, and it does state its own chrome:
   there is no glow to read through (a lit ground is a dark-ground device), so the panels are
   solid and the rules are dark-alpha rather than white. */
[data-theme='light'] {
  --bg: #f4f5f6; --panel: #ffffff; --panel-2: #eceef1; --surface: #ffffff; --raised: #ffffff;
  /* Hairlines need enough contrast against white cards to stay visible. */
  --border: #ced3d8; --border-strong: #aeb5bc;
  --text: #24292f; --muted: #6b7280;
  --ok: #1f7a3d; --warn: #9a6a0b; --danger: #c0392b;
  --link: #2f5fb8;
}
[data-theme='light-warm'] {
  --bg: #f6f2ec; --panel: #fffdf9; --panel-2: #efe9e0; --surface: #fffdf9; --raised: #fffdf9;
  --border: #d8cfc2; --border-strong: #b8ab99;
  --text: #2a251f; --muted: #6f6759;
  --ok: #1f7a3d; --warn: #8a5a06; --danger: #b0362a;
  --link: #2f5fb8;
}
[data-theme='light-flashbang'] {
  /* The bright end of the light range: black on white. Named for what it does to a dark
     room rather than for what it looks like. */
  --bg: #ffffff; --panel: #ffffff; --panel-2: #f0f0f0; --surface: #ffffff; --raised: #ffffff;
  --border: #d0d0d0; --border-strong: #a6a6a6;
  --text: #000000; --muted: #555555;
  --ok: #1f7a3d; --warn: #9a6a0b; --danger: #c0392b;
  --link: #2f5fb8;
}

/* Accents. Each carries one hue twice: the dark-theme value and the light-theme one, which
   is the same colour made visible against a pale card rather than a different colour that
   happens to be nearby. The order is fixed and the two lists must never be reordered
   independently.

   `--accent-soft` is *derived* rather than written out eight more times: it is the accent at
   12%, which is what every one of the hand-written tints already was. Custom properties
   resolve lazily, so it follows whichever accent wins on the element. */
:root {
  --accent-dark: #c80f2e; --accent-light: #c80f2e;   /* TapAway, the default */
  --accent: var(--accent-dark);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
}
/* Declared after `:root` and with the same specificity, so the light value wins on a light
   theme by source order rather than by an `!important`. */
[data-theme^='light'] { --accent: var(--accent-light); }

[data-accent='tapaway'] { --accent-dark: #c80f2e; --accent-light: #c80f2e; }
[data-accent='blue']    { --accent-dark: #6ea8fe; --accent-light: #2f5fb8; }
[data-accent='green']   { --accent-dark: #6fcf97; --accent-light: #1f7a3d; }
[data-accent='amber']   { --accent-dark: #e0b05c; --accent-light: #8a5a06; }
[data-accent='violet']  { --accent-dark: #b197fc; --accent-light: #6741d9; }
[data-accent='teal']    { --accent-dark: #63d4c6; --accent-light: #0f766e; }
[data-accent='pink']    { --accent-dark: #f78fb3; --accent-light: #b8336a; }
[data-accent='slate']   { --accent-dark: #c9c9c9; --accent-light: #3f4650; }

/* Appearance: four choices side by side - theme, accent, font size, and the layout extras.
   A row of columns rather than the old theme-plus-colour split, because they are four
   independent answers to "how should this look" and stacking them made the tab a scroll.
   Each column is its own list, and the accent is a **vertical** list: there are five of them,
   and a grid of five reads as a table of swatches with no order to it. */
.page-header .filters { margin-bottom: 0; }

/* The Appearance tab is a **list of settings**, one question per row: a label on the left, its
   controls on the right, a hairline between. The four-column grid it replaced made unrelated
   questions read as the columns of a table, which is a comparison the reader is not making; a
   list says "these are independent" by giving each one its own line. One surface, one shape -
   the customer panel used the grid while the admin used this. */
.appearance-table { display: grid; grid-template-columns: 1fr; gap: 0; }
.appearance-table > * {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: calc(14px * var(--space)) 0;
  border-top: 1px solid var(--border);
}
.appearance-table > *:first-child { border-top: 0; }
.appearance-table .picker-label { margin: 0; padding-top: 2px; }
.appearance-table .theme-choice,
.appearance-table .accent-choice { padding: calc(5px * var(--space)) 10px; }
/* The sentence under a picker explains the row, so it takes the whole width rather than being
   squeezed into the control column beside its buttons. */
.appearance-table .table-modes > .muted { flex-basis: 100%; }
@media (max-width: 700px) {
  .appearance-table > * { grid-template-columns: 1fr; gap: 8px; }
}
/* A row of choices, not a column: a column of five buttons is a scroll, and the point of a
   settings row is that one line answers one question. */
.theme-list { display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 4px; }
.accent-list { display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 4px; }
.table-modes { display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 4px; }
/* The only grouping cue: a rule between the dark set and the light one. The words "Dark" and
   "Light" were doing no work - the swatches show it, and the labels took a line each. */
.theme-sep { border-top: 1px solid var(--border); margin: 8px 0 6px; }
.picker-label {
  color: var(--muted); font-weight: 600; font-size: 0.8462rem;
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px;
}
.theme-choice {
  display: flex; align-items: center; gap: 9px; text-align: left;
  padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel-2); color: var(--text); cursor: pointer;
}
.theme-choice:hover { border-color: var(--border-strong); }
.theme-choice[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); }
/* A swatch painted from the variant's own variables, so the picker shows the real colours
   rather than a hand-copied approximation that drifts the moment a palette changes. */
.theme-swatch { display: flex; flex: none; border: 1px solid var(--border-strong); border-radius: 3px; overflow: hidden; }
.theme-swatch span { width: 11px; height: 22px; display: block; }

.accent-choice {
  display: flex; align-items: center; gap: 8px; text-align: left;
  padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel-2); color: var(--text); cursor: pointer;
}
.accent-choice:hover { border-color: var(--border-strong); }
.accent-choice[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); }
/* The dot shows the accent *as this theme would render it*: the swatch carries its own
   `data-accent`, and the light override is matched on the ancestor `data-theme` rather than
   needing the server to know which theme the browser has chosen. */
.accent-dot {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  --accent: var(--accent-dark); background: var(--accent);
}
[data-theme^='light'] .accent-dot { --accent: var(--accent-light); }

/* Table width. **Unset is a mode of its own** (`auto`): `Dynamic` on a screen wide enough to hold
   a table, and the card-per-row layout on a phone (the block near the foot of this file), which is
   why this block's scope is "not `Fixed`" rather than "`scroll`". `Fixed` clips every leaderboard
   cell with an ellipsis so the columns line up and nothing runs off the row; `Dynamic` lets a row
   be as wide as its content and scrolls the list instead. The server-side truncations
   (`truncatechars` on a checksum) are untouched either way - the toggle is about layout, not about
   how much data the page was sent. */
/* The scroll container is the *table*, not `.leaderboard`: the header row is the table's
   sibling, so scrolling the rows alone left the columns' labels behind. */
/* The table is the scroll container, and it is as wide as its widest row and no wider.
   Both halves are the fix. The container used to be `.leaderboard`, which holds only the
   rows - the header is the table's sibling, so it stayed put while the columns slid under
   it. And each row is its own grid, so a row that sized *itself* to its own content put its
   columns somewhere different from the row above, while drawing its border around the
   container's width and letting the content run outside it. One definite width, shared by
   every row, fixes both. */
:root:not([data-tables='fit']) .lb-table {
  display: grid;
  /* **The list's own columns, and the ladder only for a list that never declared any.** `--lb-grid`
     is the design's template for this list - a 20px caret, `max-content` or a fixed px for the
     chrome, `fr` for the columns that hold text - and `Dynamic` is that template *with a floor*,
     not a different layout. Taking the header-derived equal shares instead handed every chrome
     column a slice of the slack it could not use: the caret column measured 84px on the dashboard's
     leaderboard for a 20px arrow, 113px on the runs list and 135px on the audit log, which is the
     "the arrow indicator spans significantly more space than it actually takes". The ladder stays
     below as the fallback for a list written without a `--lb-grid`. */
  grid-template-columns: var(--lb-grid, var(--lb-tracks, 1fr));
  /* **The actions column is sized to its content, and it is the one column that must never be
     clipped.** `docs/style.md`: "The last column is the actions column, and it is a *control*,
     not a value: it is sized to its content and never clipped."

     It was a hand-sized px, and the cells carry a `max-content` floor (below), so a control set
     wider than the hand-written px **overflowed its track and was cut off at the card's edge** -
     the Revoke and Delete buttons read "Revol" and "Delet" on seven pages across two surfaces.
     One root cause: a content-independent track and a content-floored cell.

     `max-content` is right here and only here, and the reason is the mode. **`Dynamic` is the
     mode where the header and the rows share one grid** - the subgrid chain below - so the track
     is sized against every cell in the column: the widest button set in the list, and the
     "ACTIONS" label above it. One set of tracks, so the columns still line up exactly.

     `Fixed` is the mode where the header and the rows are separate grids, so a content-sized
     track would resolve differently in each and the columns would *not* line up - which is the
     one promise `Fixed` makes. There the list's own px stands (the fallback in each `--lb-grid`),
     and a control that does not fit wraps inside its cell rather than being cut off. */
  --lb-actions: max-content;
  align-content: start;
  /* The scroll container is the list, not the card - see the note on `width` below. */
  overflow-x: auto;
  /* **The list is the scroll container, so its box must be the card's width.** This said
     `fit-content`, which sizes the box to its *tracks* - so on a phone a 579px list inside a 370px
     card was a 579px box, `overflow-x: auto` had nothing to overflow, and the only thing that moved
     was the card itself: swipe, and the card's own heading slid away with the columns while the
     list's sticky header did nothing. Measured at 390px, `scrollWidth === clientWidth` on both
     lists, which is the signature of a scroll container that is not overflowing. It was equally
     wrong on a desktop (`/workers/`: an 833px box in a 795px card, clipped with no scrollbar).
     `auto` fixes both halves: the box is the card's width, so the tracks overflow *inside* it and
     swipe; and because the width is definite, the `1fr` ceilings on the tracks still resolve, so a
     list that fits spreads to the card exactly as `Fixed` would. `min-width: 0` is for a flex
     parent, where `auto` would otherwise resolve to the content width. */
  width: auto;
  min-width: 0;
}
/* **The floor is per cell, and that is what "no clipping" needs from this layout.** The list keeps
   the design's `fr` ratios, so a long path would ellipsis inside its own share rather than widening
   the list; `min-width: max-content` on each cell is the floor that stops it. The ceiling comes from
   the ratios themselves, so a list that fits still spreads to the card exactly as `Fixed` does. */
:root:not([data-tables='fit']) .lb-table > .lb-cols > *,
:root:not([data-tables='fit']) .lb-table .lb-row > summary > *,
:root:not([data-tables='fit']) .lb-table .lb-row > .lb-head > * {
  min-width: max-content;
}
/* **The rows are one level down, inside `.leaderboard`, and that is why none of this worked.**
   The rules below were written for `.lb-table > .lb-row`, which matched nothing - so the row kept
   its block display, and `grid-template-columns: subgrid` on the row's own grid was *invalid* (a
   subgrid needs a grid parent) and fell back to a single column. Every cell then stacked on its
   own line: the "wraps after every field" this setting was abandoned for. It was wrong on a
   **desktop** too - the header lined up and the data did not - which is why looking for it on the
   surface it was reported against found nothing.
   So the wrapper joins the chain rather than being routed around. Selectors match the DOM and not
   the box tree, so `display: contents` here would lift the rows into the table's grid while
   leaving `> .lb-row` still unable to match them - the same bug with a different symptom. */
:root:not([data-tables='fit']) .lb-table > .leaderboard {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
}
/* The table *is* the grid here, and the header, the wrapper and every row are **subgrids** of it.
   That is what makes a column as wide as its widest cell: the parent sees every row's cells, so
   the tracks below can resolve to each column's own maximum. With the rows as separate grids -
   which is what the rest of the sheet uses, and what keeps the columns lined up while they are
   being clipped - there is nothing to resolve against but the container's width, so a column
   holding three characters was handed the same share as one holding a path and the scroll was
   mostly empty space.
   `.lb-row` is named as the wrapper's child *and* as the table's, so a list written without a
   `.leaderboard` in it is still a table here. */
:root:not([data-tables='fit']) .lb-table > .lb-cols,
:root:not([data-tables='fit']) .lb-table > .leaderboard > .lb-row,
:root:not([data-tables='fit']) .lb-table > .lb-row,
:root:not([data-tables='fit']) .lb-table .lb-row > summary,
:root:not([data-tables='fit']) .lb-table .lb-row > .lb-head {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
}
/* **The tracks need a content floor, and the `fr` ratios do not have one.** This block used to say
   "the ratios stop mattering once the container is sized to its content", which is the opposite of
   what happens: an `fr` track in a content-sized container resolves to `flex-fraction x ratio`, so
   a column holding three characters is handed a share of the width the *widest* column needs.
   Measured on the Workers list, that made the table 2456px wide where its cells need 833px - two
   thirds of what a reader scrolled past was the grid's own arithmetic.
   So every track is `minmax(max-content, 1fr)`, and each half does a job: the `max-content` floor
   is what stops a value being clipped and makes a wide list exactly as wide as it needs to be, and
   the `1fr` ceiling is what lets a list that *does* fit spread to the card - which is why a short
   list still looks like `Fixed` rather than stopping halfway across it. Measured: 1006/1006 filling
   the card on the run list, 833 tight against a 793px card on the Workers list.
   CSS cannot count a list of tracks, and the count is already written down: in the header. So it
   is read from there, one rung per column count. It is the **fallback** now - a list with a
   `--lb-grid` uses its own columns and its cells' `max-content` floor - so what it covers is a list
   written without a grid at all, and a header with more columns than the ladder covers keeps
   `--lb-grid`/`1fr` rather than breaking. `services/tests_panel_css.py` fails if the widest header
   in the tree grows past the last rung, so neither fallback becomes the normal case by accident. */
:root:not([data-tables='fit']) .lb-table:has(> .lb-cols > :nth-child(1):last-child) { --lb-tracks: repeat(1, minmax(max-content, 1fr)); }
:root:not([data-tables='fit']) .lb-table:has(> .lb-cols > :nth-child(2):last-child) { --lb-tracks: repeat(2, minmax(max-content, 1fr)); }
:root:not([data-tables='fit']) .lb-table:has(> .lb-cols > :nth-child(3):last-child) { --lb-tracks: repeat(3, minmax(max-content, 1fr)); }
:root:not([data-tables='fit']) .lb-table:has(> .lb-cols > :nth-child(4):last-child) { --lb-tracks: repeat(4, minmax(max-content, 1fr)); }
:root:not([data-tables='fit']) .lb-table:has(> .lb-cols > :nth-child(5):last-child) { --lb-tracks: repeat(5, minmax(max-content, 1fr)); }
:root:not([data-tables='fit']) .lb-table:has(> .lb-cols > :nth-child(6):last-child) { --lb-tracks: repeat(6, minmax(max-content, 1fr)); }
:root:not([data-tables='fit']) .lb-table:has(> .lb-cols > :nth-child(7):last-child) { --lb-tracks: repeat(7, minmax(max-content, 1fr)); }
:root:not([data-tables='fit']) .lb-table:has(> .lb-cols > :nth-child(8):last-child) { --lb-tracks: repeat(8, minmax(max-content, 1fr)); }
:root:not([data-tables='fit']) .lb-table:has(> .lb-cols > :nth-child(9):last-child) { --lb-tracks: repeat(9, minmax(max-content, 1fr)); }
:root:not([data-tables='fit']) .lb-table:has(> .lb-cols > :nth-child(10):last-child) { --lb-tracks: repeat(10, minmax(max-content, 1fr)); }
/* Anything that is not a column - the expansion body, an empty-state line, a footer row -
   spans the table rather than landing in the first column. */
:root:not([data-tables='fit']) .lb-table > :not(.lb-cols):not(.lb-row),
:root:not([data-tables='fit']) .lb-table .lb-row > :not(summary):not(.lb-head) {
  grid-column: 1 / -1;
}
/* **The expansion body needs naming separately, and this is the one place the grid is not where
   the markup says it is.** `<details>` lays everything after its `<summary>` out through an
   internal wrapper, and *that wrapper* is the grid item - not `.lb-detail`, which is a plain
   block inside it. So the rule above put `.lb-detail` in column 1 and the body wrapped into the
   caret's twenty pixels, which is what "the table wraps after each field" looked like on the
   rows that expand. `display: contents` on the row does not help: it takes the row's box away and
   leaves the wrapper exactly where it was - measured, not assumed.
   `::details-content` is the wrapper's own name. It is Baseline 2025 (Chrome 131, Firefox 143,
   Safari 18.4), so the fallback below is for browsers older than that, not for the common case. */
:root:not([data-tables='fit']) .lb-table details.lb-row::details-content {
  grid-column: 1 / -1;
  /* **And it contributes nothing to the columns.** The wrapper is a grid item spanning every
     track, and an item with an automatic minimum hands its min-content to the tracks it spans - so
     opening a dropdown widened every column, the caret column among them: "expanding a list pushes
     the arrow across". It is a body inside a row, not a column, so it has no minimum. */
  min-width: 0;
}
/* Without `::details-content` the wrapper cannot be spanned, so the body sizes to its own content
   instead of wrapping into the caret column: narrower than the table, and readable. Only the
   rule under it stops short, which is the one thing that is wrong in that case. */
@supports not (selector(::details-content)) {
  :root:not([data-tables='fit']) .lb-table details.lb-row > .lb-detail { width: max-content; }
}
/* The caret column is content-sized here, and the caret carries a fixed square so its quarter
   turn spins in place. In a `fr` track that square is advisory - the caret is wider than its
   column either way, and the box clips by a few pixels on a desktop in `Fixed` as well. A
   content-sized column takes it literally, though, and on a **phone** that is a clip the card
   layout never had: `Fixed` lays the row out as a card, where the caret is not in a column at
   all. So the square goes here and the box becomes the glyph's own, which is what the column is
   measuring. `padding` too - the caret is a control, not a value, and the cell's inset is what
   pushed its content past the box. */
:root:not([data-tables='fit']) .lb-table .lb-row > summary > .rank.caret {
  width: auto;
  min-width: 0;
  padding: 0;
}

/* "Allow horizontal scroll" promises that a long value is not wrapped, and it was wired to the
   leaderboard alone - so a plain table, which is most of the tables that hold a path or a key,
   kept wrapping whatever the setting said. These cells are the machine identifiers: a path, a
   checksum, an id. They are the ones `overflow-wrap: anywhere` was breaking mid-token, and they
   are the ones the setting is for. Prose cells still wrap, because a sentence is not a value and
   a paragraph on one line is not what anybody asked for. Nothing sets a width: the table's own
   layout widens past the card once a cell cannot shrink, and the card is already the scroller. */
:root:not([data-tables='fit']) td.mono,
:root:not([data-tables='fit']) td code,
:root:not([data-tables='fit']) td .mono {
  white-space: nowrap;
  overflow-wrap: normal;
}
/* **The asset detail's metadata table is the exception, and it is a definition table rather than
   a list.** The rule above is a list's rule: a list has columns to line up against another
   row, so a value that cannot be shortened is scrolled rather than broken. A definition table
   has no second row to line up with, and the card it lives in is half of a two-column grid -
   459px of content - so the value column was as wide as the longest identifier in it and the
   table ran 128px out of the card: the served URL was cut mid-string, the checksum was cut,
   and the "Format rules" chip row lost a chip at the card's edge.

   There is nothing to line up here, so the values wrap inside the card instead - which is
   what `.mono` says everywhere else (`overflow-wrap: anywhere`). A checksum broken across two
   lines is still a checksum; a checksum cut off at the card's edge is not one at all.

   **This is the one place the rule is excepted, and it is excepted by name.** The selectors
   repeat the rule's own shape, because a rule with a lower specificity than the one it
   excepts does not except it. */
:root:not([data-tables='fit']) .meta-table td,
:root:not([data-tables='fit']) .meta-table td.mono,
:root:not([data-tables='fit']) .meta-table td code,
:root:not([data-tables='fit']) .meta-table td .mono {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* **The floor for every pointer is WCAG 2.2 AA's target minimum: 24x24 CSS px.** A base rule rather
   than a query, because it is not about the pointer - and five controls sat under it: the dense
   button (21.8px), the two links in the title bar (20.3 and 18.8), the × inside an
   applied-filter chip (14px), and the notification bell's two buttons (16px). A pill grows with
   its × for the same reason: a 24px control inside a 20px chip stretches the chip.

   The bell's buttons are the reach of them all: the bell is the shared include both panels
   render, twice, on **every** signed-in page - so a floor that misses it misses the whole
   product. They were exactly the height of their own 11px line of text, because the rule
   that sizes them is `padding: 0`. */
.btn.small, .brand, .topbar .user > a, .lb-table > .lb-cols a, .filter-pill, .filter-pill-remove, .notif-clear, .notif-read { min-height: 24px; }
/* **`min-height` does nothing to an inline box, and a sort link is inline.** So the floor above
   read as enforced while every one of those links was 13px tall - which is exactly the shape of
   the defect it was written for, one level down: the rule was added, and it could not apply. A
   list header is a row of controls, so they are boxes. In `Fixed` on a phone they are already
   chips and this changes nothing; in `Dynamic` it is the difference between a 13px link and a
   24px one, on the surface where a finger is doing the pointing. */
.lb-table > .lb-cols a { display: inline-flex; align-items: center; }

/* **A link in a row is a target, and a target is 24x24.** The floor above is a
   `min-height`, and `min-height` does nothing to an inline box - so the sheet already knew
   that a list's links needed a companion rule, and gave one to the *sort* links. These are
   the row links: the site's name in a list, the path under it, the worker's name in the
   registry, the "Open" in a Health table. Each is the whole content of its cell, so a
   finger has to hit the glyph.

   `display: inline-block` is what gives the box a height at all, and the padding is what
   makes it 24: a 14px line of text plus 5px above and below. The text does not move -
   an inline-block with a visible overflow keeps its baseline on the text - and the pad
   falls in the row's own padding, so the row grows by the pad and not by a line.

   `.btn` is excluded twice over: it is a control and already carries a floor of its own,
   and a button's padding is its own. `max-width` keeps a long path inside its cell
   rather than pushing the column wider.

   The first selector is the phone's own: the card layout resets every cell's padding to
   zero, and a rule that lost to it would leave the phone's links exactly as small as
   they were. */
:root:not([data-tables='scroll']) .lb-table .lb-row a:not(.btn),
.lb-table .lb-row a:not(.btn),
td a:not(.btn),
.page-header .sub a:not(.btn) { display: inline-block; max-width: 100%; padding: 5px 0; }

/* **One rule for a coarse pointer, and it is not about size.** The 44px floors that used to be
   here made every control on a phone a third to a half taller than the same control on a desktop -
   a button, a nav row, a popup tab, a field, the exit - which reads as a form built for a different
   device rather than as the same one held closer. The design's own sizes are the sizes.
   What a *coarse pointer* actually changes is the one thing below, and it is a browser behaviour
   rather than a taste. WCAG 2.2 AA's 24px target minimum still applies to every pointer, and is a
   base rule above this one. */
@media (pointer: coarse) {
  /* iOS zooms the page when a field under 16px takes focus, and the zoom is not undone when it
     blurs - the reader is left scrolled with the rest of the form off screen. `max()` keeps the
     font-size setting in charge once it is larger than the floor, and `select.btn.small` is named
     because a `select` styled as a small button carries the button's 12px, which is a *field*
     under the floor however it is dressed. */
  input[type=text], input[type=url], input[type=number], input[type=password],
  input[type=email], input[type=date], input[type=search], textarea, select,
  select.btn, select.btn.small {
    font-size: max(16px, 1rem);
  }
}

/* Phones: the layout the console is mostly used from. Two things change here, and they are the two
   a narrow window kept reporting - a list whose columns are squeezed into 390px clips every one of
   them to an ellipsis ("ac…", "failed…", "ACTIO…") instead of showing a value, and a popup's
   sidebar that has no room to sit beside its pane. **Layout only**: a control is the same height
   here as anywhere, and the one thing a coarse pointer changes is the 16px field floor above. */
@media (max-width: 700px) {
  :root { --layout: phone; }
  body { font-size: 0.9615rem; }
  .topbar { gap: 10px; padding: 0 10px; }
  .container { padding: 12px 10px 40px; }
  th, td { padding: 5px 6px; }
  /* The card's horizontal inset is a token, so the row rule that bleeds out to the card's edge
     follows it. Overriding `.card`'s padding here instead left the two disagreeing, and the
     separator overshot the card. */
  :root { --card-x: 10px; }
  .section-title { margin: 14px 0 6px; }

  /* A popup's sidebar becomes a strip above its pane: a 172px column and a pane do not fit
     side by side at 390px. */
  .dialog-tabs { grid-template-columns: 1fr; }
  .dialog-side {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: calc(8px * var(--space));
  }

  /* A data table scrolls inside its own box rather than widening the card. The box is the
     viewport and the content moves, which is the one shape that leaves the page itself unable
     to scroll sideways - and a seven-column listing at 390px is going to move whatever it
     does. */
  .card > table, details > table, .filter-group table {
    display: block;
    overflow-x: auto;
  }

  /* A popup takes the **width** on a phone, and stays centred. `inset: 0` with `margin: auto` is
     the browser's own centring for a modal dialog - the one the desktop has always had - and a
     popup that drops to the bottom edge is a popup whose *height* decides where it sits as well as
     how much page it leaves: a short form sits on the floor and a tall one fills the screen.
     A centred 420px box on a 390px screen still has to scroll its own chrome, with Exit off screen,
     so the width is the thing that changes; the height is capped so the page stays visible around
     it, and it is capped rather than set, because a dialog with no panes is a form.
     **`:is()` on the third selector, because an id out-ranks `dialog[open]`.** Every dialog that
     carries a width of its own carries it by id, so a rule written as `dialog[open]` alone lost to
     all of them: `#detail-dialog` is `min(680px, calc(100vw - 32px))`, which is 358 on a 390px
     screen - a popup 32px short down its right edge. `:is()` takes the highest specificity of its
     arguments, so this beats them without repeating their declarations.
     `services/tests_panel_css.py` reads that list back against the stylesheet, so a dialog that
     gains a width later cannot quietly miss it. */
  dialog[open], dialog[open].dialog-wide,
  dialog[open]:is(#detail-dialog, #key-dialog, #export-dialog) {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: 100%;
    max-height: 78vh;
    margin: auto;
    border-radius: var(--radius);
  }
  /* And shorter again with panes: the fixed height that stops the frame resizing between tabs takes
     less of the screen here than it does on a desktop, because a popup on a phone is most of the
     screen to begin with. */
  dialog[open]:has(.dialog-tabs) { height: 70vh; }
}

/* **The phone's list layout, and on a phone it is the default.** The columns cannot all fit in
   390px, so the row becomes a card per row - the name on the first line, its values flowing under
   it, its actions last - and the header line becomes the sort control.

   This is the `auto` answer: a reader who has not chosen gets this on a phone, and `Dynamic` on a
   screen wide enough to hold a table. A reader who *has* chosen **Dynamic** has answered the same
   question the other way, so this block steps aside for them and the list stays a table: the
   columns keep their labels, which is what the card-per-row gives up. Nothing here is about the
   pointer or the screen, so it is the width that decides and the setting that overrides.

   It has to take the *table* back as well as its rows - the first two rules. The `Dynamic` block
   above is active in `auto` (that is what makes a desktop a table), and a card layout laid out
   inside a `display: grid` scroll container is a table whose rows wrapped, with a grid track where
   the first column should be. */
@media (max-width: 700px) {
  /* The table goes back to being a plain block, and the wrapper gives its rows to it. `width:
     auto` too: a *nested* list is `max-content` (see the card-bleed rules), which on a phone would
     make a whole column of cards as narrow as its widest value. */
  :root:not([data-tables='scroll']) .lb-table {
    display: block;
    overflow-x: visible;
    width: auto;
  }
  /* A nested list is `max-content` on a wide screen; on a phone it is a column of cards, so it
     takes the width left by its own indent. */
  :root:not([data-tables='scroll']) .lb-table .lb-row .lb-table {
    width: auto;
    max-width: none;
  }
  :root:not([data-tables='scroll']) .lb-table > .leaderboard { display: contents; }

  /* A list is a card per row on a phone. The header line becomes the sort control and nothing
     else - a chip per sortable column, and no chip for a column that cannot be sorted, because
     a label with no row under it is not a control. */
  :root:not([data-tables='scroll']) .lb-table > .lb-cols {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 0 calc(8px * var(--space));
    border-bottom: 1px solid var(--border-strong);
  }
  :root:not([data-tables='scroll']) .lb-table > .lb-cols > * {
    padding: 0;
    overflow: visible;
    white-space: nowrap;
  }
  :root:not([data-tables='scroll']) .lb-table > .lb-cols > :not(:has(a)) { display: none; }
  /* A list with nothing sortable has no header here at all - otherwise an empty chip row keeps
     its rule and reads as a row that failed to render. */
  :root:not([data-tables='scroll']) .lb-table > .lb-cols:not(:has(a)) { display: none; }
  :root:not([data-tables='scroll']) .lb-table > .lb-cols a {
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  :root:not([data-tables='scroll']) .card .lb-table > .lb-cols > :first-child,
  :root:not([data-tables='scroll']) .card .lb-table > .lb-cols > :last-child { padding: 0; }
  /* **The job history's header line is gone here, pills and all.** Every row is a card that
     already names its own fields, so five chips above them labelled nothing - and, being the
     loudest thing at the top of the card, they read as the list's content. The wide layout keeps
     them, where they are the table's column heads and the way to sort it. */
  :root:not([data-tables='scroll']) .lb-table.lb-jobs > .lb-cols { display: none; }

  /* The row itself: the thing's name takes the first line, its values flow under it, and its
     actions get the last. Nothing is clipped, which is the whole point. A list whose first
     column is a caret keeps the caret beside the name rather than on a line of its own. */
  :root:not([data-tables='scroll']) .lb-table .lb-row > summary,
  :root:not([data-tables='scroll']) .lb-table .lb-row > .lb-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 3px 10px;
    padding: calc(8px * var(--space)) 10px;
  }
  :root:not([data-tables='scroll']) .lb-table .lb-row > summary > *,
  :root:not([data-tables='scroll']) .lb-table .lb-row > .lb-head > * {
    flex: 0 1 auto;
    min-width: 0;
    padding: 0;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }
  /* **The phone's card layout keeps the column names.** The header line becomes the sort
     control, so the values under it lost the names they had - a row read "5 (121.1 KiB /
     1.0 GiB)" with nothing to say what the five was. Every cell past the first carries the
     name of its column, and the card renders it in front of the value. The first cell is
     the row's own name (or its caret), and it needs no label. */
  :root:not([data-tables='scroll']) .lb-table .lb-row > .lb-head > *[data-label]::before,
  :root:not([data-tables='scroll']) .lb-table .lb-row > summary > *[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--muted);
    font-size: 0.8462rem;
  }
  /* The *name* takes the first line, not the rank: `:not(.rank)` keeps the number inline, because
     a ranked `.lb-head` row's first cell *is* the rank. */
  :root:not([data-tables='scroll']) .lb-table .lb-row > .lb-head > :first-child:not(.rank) { flex: 1 1 100%; }
  /* **The caret shares its line with the name.** The name after a caret took a whole line of
     its own (`flex: 1 1 100%`), so the caret was stranded above it - a row that opened with a
     lone `>` and the name on the next line. The basis is the line minus the caret's own
     column and the gap beside it (20px + 10px), so the two fit on one line and everything
     after the name wraps below it. */
  :root:not([data-tables='scroll']) .lb-table .lb-row > summary > .rank + * { flex: 1 1 calc(100% - 32px); }
  /* **Except a ranked row, which flows.** A `#` is two characters, so giving the name a line of its
     own spends the first line on `v 1.` - and the ranked boards are exactly the lists whose rows
     carry a rank. A caret-plus-number pair is that, and so is a `.lb-head` rank cell with a value in
     it; every other list leads with a caret only, or with an empty placeholder cell, and keeps the
     name-first card above. The rank cells themselves keep `flex: 0 0 auto` from the rule below,
     which is why they are excluded rather than flowed. */
  :root:not([data-tables='scroll']) .lb-table .lb-row:has(> summary > .rank.caret + .rank) > summary > :not(.rank),
  :root:not([data-tables='scroll']) .lb-table .lb-row:has(> .lb-head > .rank:not(:empty)) > .lb-head > :not(.rank) {
    flex: 0 1 auto;
  }
  :root:not([data-tables='scroll']) .lb-table .lb-row > summary > .rank,
  :root:not([data-tables='scroll']) .lb-table .lb-row > .lb-head > .rank { flex: 0 0 auto; }
  :root:not([data-tables='scroll']) .lb-table .lb-row .lb-actions { flex: 1 0 100%; justify-content: flex-start; }
  /* **The destructive control is set apart from the values.** Every other list on a
     phone puts its actions at the left, under the row's name; this one puts the Remove
     button at the right of its own line, so a finger reaching for the row's values does
     not land on it. Same specificity as the rule above, and after it, so it wins. */
  :root:not([data-tables='scroll']) .lb-exclusions .lb-row .lb-actions { justify-content: flex-end; }
  :root:not([data-tables='scroll']) .card .lb-table .lb-row > summary > :first-child,
  :root:not([data-tables='scroll']) .card .lb-table .lb-row > .lb-head > :first-child,
  :root:not([data-tables='scroll']) .card .lb-table .lb-row > summary > :last-child,
  :root:not([data-tables='scroll']) .card .lb-table .lb-row > .lb-head > :last-child { padding: 0; }

  /* **The key/value table does not fold into a card** (`ui/_kv_table.html`, `.lb-kv`).
     A definition is still two columns meeting: the field on the left, its value on the
     right. The card layout treats a row's first cell as the row's own name and re-labels
     the rest - right for a record with a name, pointless for a Field/Value pair: the
     field took the whole line and the value appeared beneath it wearing a "Value: " label
     read out of its own `data-label`, so the two facts that belong on one line stacked.
     So the table keeps the desktop's grid at every width and in both table modes:
     the header and every row stay on the two `--lb-grid` tracks (the first `minmax(0, …)`
     for the label, the flexible second for the value, which wraps inside its own column),
     the `data-label` pseudo is never drawn, and the first-cell line cannot apply because
     the row is a grid. The last two selectors repeat the card rule above at its own
     specificity and after it, so the rows keep the cells' padding the card rule zeroes. */
  :root:not([data-tables='scroll']) .lb-table.lb-kv > .lb-cols {
    display: grid;
    grid-template-columns: var(--lb-grid, 1fr);
    gap: 0; padding: 0;
    border-bottom: 1px solid var(--border-strong);
  }
  :root:not([data-tables='scroll']) .lb-table.lb-kv > .lb-cols > * {
    display: block;
    padding: calc(6px * var(--space)) 10px;
    overflow: visible; white-space: normal;
  }
  :root:not([data-tables='scroll']) .lb-table.lb-kv .lb-row > .lb-head {
    display: grid;
    grid-template-columns: var(--lb-grid, 1fr);
    gap: 0; align-items: center;
    padding: calc(5px * var(--space)) 10px;
  }
  :root:not([data-tables='scroll']) .lb-table.lb-kv .lb-row > .lb-head > *,
  :root:not([data-tables='scroll']) .lb-table.lb-kv .lb-row > .lb-head > :first-child,
  :root:not([data-tables='scroll']) .lb-table.lb-kv .lb-row > .lb-head > :last-child {
    padding: calc(5px * var(--space)) 10px;
    overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere;
  }
  :root:not([data-tables='scroll']) .lb-table.lb-kv .lb-row > .lb-head > [data-label]::before {
    content: none;
  }
}
/* Crawl-filter groups on a site page. Each CMS is a disclosure, so the rules are readable
   without the card becoming a wall of table, and the summary carries the on/off state. */
.filter-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 8px 12px;
  margin-bottom: 8px;
}
.filter-group > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}
.filter-group > summary::-webkit-details-marker { display: none; }
.filter-group > summary::before {
  content: "\25b8";
  color: var(--muted);
  transition: transform 120ms ease;
}
.filter-group[open] > summary::before { transform: rotate(90deg); }
.filter-group table { margin-top: 8px; }
/* The group's rules are the list primitive now, so the same space under the summary. */
.filter-group .lb-table { margin-top: 8px; }

/* The model-path matrix: rows are the page a link was followed *from*, columns the page read,
   and a cell counts the steps taken. The heat classes (0-5) are computed in
   `services/stats.py::path_matrix`, not in the template; the shade is one hue at rising
   opacity, so a cell's weight reads the same in either theme. */
.path-matrix-scroll { overflow-x: auto; }
.path-matrix { border-collapse: collapse; font-size: 0.8462rem; }
.path-matrix th, .path-matrix td {
  border: 1px solid var(--border);
  padding: 3px 7px;
  text-align: right;
  white-space: nowrap;
}
.path-matrix thead th { color: var(--muted); font-weight: 600; }
.path-matrix-corner { text-align: left; }
.path-matrix-row { text-align: left; max-width: 240px; }
.path-matrix-row .muted { margin-left: 6px; font-weight: 400; }
.path-matrix-label {
  display: inline-block;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}
.path-matrix-entry { color: var(--muted); font-style: italic; }
.path-matrix td.heat-0 { color: var(--muted); }
.path-matrix td.heat-1 { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.path-matrix td.heat-2 { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.path-matrix td.heat-3 { background: color-mix(in srgb, var(--accent) 38%, transparent); }
.path-matrix td.heat-4 { background: color-mix(in srgb, var(--accent) 52%, transparent); }
.path-matrix td.heat-5 { background: color-mix(in srgb, var(--accent) 68%, transparent); }

/* The authenticator QR. Its modules are black by default, so it needs its own light ground:
   a black-on-transparent code is invisible on the dark theme, and a QR needs a quiet zone
   around it to scan at all. The white is deliberately *not* a theme variable - a QR is read
   by a camera rather than by the theme, so it is white in both. Sized here rather than in the
   markup because the factory writes a fixed `mm` width that does not follow the type scale. */
.otp-qr {
  display: inline-block;
  width: 12rem;
  padding: 0.75rem;
  background: #fff;
  border-radius: 0.5rem;
  line-height: 0;
}
.otp-qr svg { display: block; width: 100%; height: auto; }

/* The document strip on Other stats: a preview surface for the content measurements. The line
   is the lexical-drift series, the vertical rules are the part boundaries (where the product
   itself cut the document) and the ticks are findings by severity. `non-scaling-stroke` keeps
   the rules one pixel wide under the stretched viewBox - without it a 100-unit line is drawn
   at whatever the card's width makes of it. */
.strip { display: block; }
.strip-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.strip-boundary { stroke: var(--border-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.strip-marker { stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.strip-marker.warn { stroke: var(--danger); }
.strip-marker.info { stroke: var(--muted); }

/* ---------------------------------------------------------------------
   The site detail page: one band, one banner, one tabbed section.

   The page's own grid is declared here rather than in a second file, so
   the measurements that decide this page's shape live with the rest of
   the sheet. `--cols` and `--gutter` are named because a number in a
   `grid-template-columns` is not a decision anybody can read.
   --------------------------------------------------------------------- */

.site-head {
  --cols: 12;
  --gutter: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "identity actions"
    "facts    facts";
  column-gap: var(--gutter);
  row-gap: calc(10px * var(--space));
  align-items: start;
  margin-bottom: calc(14px * var(--space));
}
.site-head__identity { grid-area: identity; min-width: 0; }
.site-head__actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.site-head__facts { grid-area: facts; min-width: 0; }

/* On a phone the band is one column - the chip, the name, the meta line,
   the action, the facts. The action moves under the identity rather than
   beside it, so a long name never pushes it off the row and leaves it
   stranded against the card's edge. */
@media (max-width: 700px) {
  .site-head {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "identity"
      "actions"
      "facts";
  }
  .site-head__actions .btn { flex: 1 1 auto; }
}

/* The name and the chip share a line, and the chip is a status - so it
   comes first. `overflow-wrap: anywhere` lets a 95-character name wrap
   rather than widen the band. */
.site-head__title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.site-head h1 {
  font-size: 1.3846rem;
  line-height: 1.45;
  font-weight: 600;
  margin: 0;
  overflow-wrap: anywhere;
}
/* The identity facts, in one line: the domain once, the count, the origin
   only when it differs from the root domain, and when it was added. */
.site-head__meta {
  color: var(--muted);
  font-size: 0.9231rem;
  line-height: 1.45;
  margin-top: 2px;
  overflow-wrap: anywhere;
}
/* The reason the site is in the state the chip shows. One line, with the
   whole of it in the tooltip: a three-line paragraph in the header is how
   the most consequential fact on the page became its quietest.
   **Muted, not the danger colour.** The banner above is where the alarm
   lives, and it repeats this sentence when the reason is why the site is
   not working - two red lines saying the same thing is one line too many,
   and the second one stops being read. */
.site-head__reason {
  color: var(--muted);
  font-size: 0.9231rem;
  line-height: 1.45;
  margin-top: 4px;
  /* **Two lines at most, and it wraps rather than being cut.** The reason is the
     site's own sentence about itself, and a phone has no tooltip: with the text
     on one line and clipped, the tail of the reason was unreachable on a
     phone (the audit flagged it on two viewports), and the band is the first
     thing an operator reads. The clamp keeps the header from carrying a
     paragraph - which is what the one-line rule was for - while the failed
     run's reason is in the banner below, in the danger colour, in full. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
/* The status chip. `.pill` is the component; this only gives it the context
   a screen reader needs and the room to breathe. */
.site-state { display: inline-flex; align-items: center; gap: 6px; }
.site-state .pill { font-size: 0.8462rem; }

/* The key facts: value over label - the order the stat cards use, so this row reads as
   the stat row the rest of the panel uses.

   **Three tracks, and the run's strip spans them.** The fourth cell was a chip where the
   numerals are (see `_site_facts.html`); a strip under the figures is the shape that says
   "this is the state of the last run" rather than "this is the fourth count". */
.site-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 var(--gutter);
  border-top: 1px solid var(--border);
  padding-top: calc(10px * var(--space));
  margin: 0;
}
.site-fact { min-width: 0; display: flex; flex-direction: column; }
/* The label reads under the value, so it is ordered after it in the box
   while staying before it in the markup: a `<dl>` announces the term first. */
.site-fact__label { order: 2; }
.site-fact__body { order: 1; min-width: 0; margin: 0; }
.site-fact__note {
  display: block;
  color: var(--muted);
  font-size: 0.9231rem;
  overflow-wrap: anywhere;
}
/* **The last run is a strip, and its own kind of fact.** It carries a chip and two words
   rather than a number and its label: the label goes in front of them and the strip takes the
   full width under the figures, divided from them by a rule, so it reads as the state of the
   last run rather than as the row's fourth quantity. */
.site-fact--run {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin-top: calc(10px * var(--space));
  padding-top: calc(8px * var(--space));
  border-top: 1px solid var(--border);
}
.site-fact--run .site-fact__label { order: 0; }
.site-fact--run .site-fact__body {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 10px;
}
/* The chip and the age it happened at, as one group: the age is about the chip, and it is the
   run's own clock rather than the page's. */
.site-fact__status { display: inline-flex; align-items: baseline; gap: 8px; }
.site-fact__when { color: var(--muted); font-size: 0.9231rem; }
@media (max-width: 700px) {
  .site-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: calc(8px * var(--space)); }
  /* **A note is at most two lines on a phone.** A hostname can be a hundred characters
     and the cell it sits in is half a phone wide, so the note was seven lines tall in a
     row of figures - and the figure it belonged to became the smallest thing on the
     page. The count and the label stay; the note is bounded. */
  .site-fact__note {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* The banner sits between the facts and the sections: the failure is the
   first thing after the state, not the last thing on the page. */
.site-banner { margin-bottom: calc(14px * var(--space)); }
.site-banner .alert { margin-bottom: 0; }
.site-banner .alert .btn { margin-top: calc(6px * var(--space)); }

/* The tabbed section. The panes are the page now: one band, one banner, one
   section with four panes in it, so the page is one screen instead of eight
   cards. The pane's own heading carries no top margin - it is the first thing
   in the pane, and the space above it is the section's. */
.site-sections .side-pane > .section-title:first-child { margin-top: 0; }
/* A block inside a pane. The pane is the card now, so the blocks inside it
   are separated by space rather than by a card edge each. */
.site-block { margin-top: calc(16px * var(--space)); }

/* **Starting a run**, under the heading that says so: the page's own age at the left, the two
   buttons that start the next run at the right. The run's result is not repeated here - it is
   the band above the sections, which is on every tab - so this is a footer strip and not a
   summary of a run. */
.site-run {
  display: flex;
  align-items: center;
  gap: calc(10px * var(--space));
  flex-wrap: wrap;
  padding-bottom: calc(12px * var(--space));
  border-bottom: 1px solid var(--border);
  margin-bottom: calc(12px * var(--space));
}
.site-run__actions { display: flex; gap: 8px; margin-left: auto; }
/* The "as of" line: when the page was rendered. It is the age of the picture, which no run's own
   age says - the last run may have finished an hour ago and the page may be five minutes old, or
   the other way round. */
.site-run__asof { margin: 0; }
@media (max-width: 700px) {
  /* On a phone the buttons go under the line and take the width: two buttons and a caption
     fighting for 348px is one thing per line anyway. */
  .site-run__actions { margin-left: 0; flex: 1 1 100%; }
  .site-run__actions .btn, .site-run__actions .action-slot { flex: 1 1 auto; }
}

/* The destructive pair, alone, behind a rule, at the foot of the pane. It
   was in a row of nine at the top of the page, where a finger reaching for
   the wrong one stops a customer's site from serving. */
.site-danger {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: calc(16px * var(--space));
  padding-top: calc(12px * var(--space));
  border-top: 1px solid var(--border);
}

/* The customer's pause control, in the band's own track: the field that says
   why, and the button that acts on it, on one line. The field takes the room
   the row has, so the placeholder is not cut in half on a phone. */
.site-head__status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  max-width: 26rem;
}
.site-head__status input[type='text'] { flex: 1 1 9rem; width: auto; min-width: 0; }

/* The operator's domains: the hostname and what its certificate is doing.
   The last column is a value rather than an actions cell, so it is not
   right-aligned the way an actions column is. */
.lb-domains-operator { --lb-grid: max-content 1fr; }
.lb-domains-operator > .lb-cols > :last-child { text-align: left; }

/* Visually hidden, and read by a screen reader. Six lines, and the
   standard name: the status chip needs "Site status: " in front of the
   word it shows.

   **`overflow: clip`, not `hidden`.** A hidden box is a scroll container,
   and the content in it is text a reader can see the start of and cannot
   read - which is exactly what the harness's "clipped text" check is
   looking for, and it reported this element on every page that carries
   it. `clip` cuts the content away instead of hiding it behind a
   scrollbar, which is what a visually hidden element is. The `hidden`
   above it is the fallback for the browsers that do not know `clip`;
   `clip` and `clip-path` below it are the other two ways of saying the
   same thing, and every one of them is supported where it matters. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  overflow: clip;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
