/* ============================================================================
   Adroit Pulse — pulse.css
   The one stylesheet, for every page on every host.

   WHY THIS EXISTS
     All 19 pages at fleet/ root define their own :root. Three different primary
     blues were in live use (#2f63ad, #1f5fbf, #2563eb) and three different reds
     (#c62f22, #b3372f, #dc2626). None of them matched logo.svg, whose blue is
     #2f63ad. There was no design language; there were nineteen.

   RELATIONSHIP TO portal.css
     portal.css is SUPERSEDED, not deleted. It still styles the eleven portal
     cards and must keep working until each has migrated, because changing it
     would restyle live pages mid-shift for no functional gain. Migration is per
     page: swap the <link>, delete the page's private :root, done. The legacy
     aliases at the end of :root exist so that swap needs no other edit.
     DELETE portal.css once nothing links it.

   THE LOOK, AND WHY IT IS NOT SOFT
     Square corners, hairline rules, tracked uppercase labels, flat fills. This
     is a plant: the reference is a machine-tool panel and a technical drawing,
     not a SaaS dashboard. Rounded corners, tinted icon chips and pill badges
     were tried and rejected -- they read as generic. One tint came back, on
     the owner's ruling of 2026-09-24 (T16c): .p-tag, a square-cornered state
     word inside a dense table row, where the old /it page's chips read
     faster than any square or coloured word.

   TYPE
     DINish, self-hosted beside this file under SIL OFL 1.1 (DINISH-OFL.txt).
     Descends from DIN 1451 via Datto's D-DIN. Measured against D-DIN across all
     231 shared glyphs: identical to within a third of a pixel at 15px for every
     letter, digit and punctuation mark -- DINish was chosen for being smaller
     (47 KB vs 65 KB), wider in coverage (478 glyphs vs 251) and still
     maintained, NOT for looking different. It does not look different.

     TWO WEIGHTS ONLY: 400 and 700. That is all DIN 1451 has ever had. Do not
     write font-weight 500 or 600 -- the browser will synthesise them by
     smearing the outlines. Hierarchy comes from size, case, tracking and
     colour, which is how signage has always done it.

   LIGHT AND DARK (T71, owner 2026-10-28)
     Every page on this file has a light/dark slider in its <pulse-header>, except
     tv.html (<pulse-header no-theme>). The mode is the attribute data-theme=dark
     on <html>; no attribute is light. pulse_header.js sets it from localStorage
     "pulse-theme" while <head> is parsed, before the body paints, and each web
     address (and so each tablet) remembers its own choice. Dark until the slider
     is turned to light (T77, owner 2026-10-29: "make default dark mode"): two
     states, no "follow the device".

     ONE TOKEN SET. :root is light. One block right after it,
     `@media screen { :root[data-theme=dark] { ... } }`, redefines the 23 tokens
     that change and `color-scheme: dark`. No other block in any file sets a token
     for dark, and no page writes a dark rule of its own. A page uses tokens only:
     no hex, rgb() or hsl() colour and no var(--p-x, <fallback>) outside :root and
     the dark block (test_l0_theme row 9 finds the pages, so a new page is in the
     set). The dark block is screen only: a page printed from dark prints light.

     DERIVED TINTS. The state and phase tints (--p-run-tint, -tint-line, -tint-ink,
     and the same for idle, stop, brand; -tint and -tint-ink for qc and maint) are
     color-mix()es of the state colour into --p-card (12% the box, 35% its rule) or
     into --p-ink (80%, its text). They have no dark value: they follow.

     WHICH TEXT TOKEN. --p-on-brand is the text on a coloured fill and turns dark
     in dark (a coloured fill is a lighter shade there). Text on the always-dark
     surface (the readout strip, the toast, the busy flash, tv) is --p-on-dark,
     white in both. Text on --p-bk-attend and --p-bk-closed is --p-on-bright, dark
     in both. A line that was --p-dark is --p-ink (the same in light, the light
     line in dark). --p-sunk is a surface a shade off the card.

     THE STRIP RULE, FOR BOTH MODES. Brand-coloured TEXT never sits on --p-dark: the
     strip takes a 4px --p-brand edge and --p-on-dark figures. In dark --p-brand is
     light (#6ea8fe), so it still must not carry text on the strip.

     CONTRAST. In dark every pair in test_l0_theme's list clears its minimum (4.5:1
     text, 3:1 a mark). In light the same pairs clear it except seven that fail
     today and stay as they are (the owner asked for dark only): faint/ground 3.87,
     idle/card 4.44, disabled/card 2.51, on-brand/idle 4.44, on-brand/disabled 2.51,
     run/run-tint 4.28, idle/idle-tint 3.82. The test names them as known; fix one
     and the test says so, and the name comes off the list.

     THE HEADER is the one place its owner asked to wow (T71, 2026-10-28: "Make it
     cool, give it a wow factor, give it a crazy nice animation"; T77, 2026-10-29:
     "make this header the highlight of Pulse ... turn heads and just wow everyone").
     The slider's circle reveal, round stars and glow, the frosted control strip
     and the live heartbeat are its own, not the language's: every other mark
     stays square, flat and still. Home's department panels answer a hover with the
     strip's frosted blue (.p-panel--nav, below) and nothing more. It is drawn by
     pulse_header.js, which holds its CSS; see THEME and THE STRIP AND THE HEARTBEAT
     there.
   ========================================================================== */

@font-face { font-family: "DINish"; src: url("/portal/Dinish-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal;  font-display: swap; }
@font-face { font-family: "DINish"; src: url("/portal/Dinish-Bold.woff2")    format("woff2"); font-weight: 700; font-style: normal;  font-display: swap; }
@font-face { font-family: "DINish"; src: url("/portal/Dinish-Italic.woff2")  format("woff2"); font-weight: 400; font-style: italic;  font-display: swap; }

:root {
  /* Brand — read straight out of the 2026 lockup (adroit_logo.svg), not
     sampled from a screenshot and not invented. The retired mark was #2f63ad:
     same hue (214 deg) but far lighter and less saturated. The new one is
     L 30% / S 96%, which is why it clears AAA on white (9.32) and on the
     ground (7.79) where the old blue only managed AA.

     It fails against --p-dark (1.95), so brand-coloured TEXT must never appear
     on the readout strip. The strip uses a 4px brand edge and white figures
     for exactly this reason -- that is load-bearing now, not incidental. */
  --p-brand:      #034397;
  --p-brand-ink:  #023374;   /* pressed */
  --p-brand-lift: #0455bf;   /* hover on dark */

  /* White is the only ink that clears AA against --p-brand (7.79). It is
     why .p-btn--primary, .p-btn--danger and the readout strip all resolve to
     white text today -- written as a literal #fff in five places with no
     name of its own. One token so a future brand change cannot orphan it. */
  --p-on-brand: #fff;

  /* Surfaces */
  --p-ground:     #e8ebee;
  --p-card:       #ffffff;
  --p-dark:       #14191f;
  --p-dark-line:  #2b333c;

  /* Ink. --p-faint is the lightest text permitted on white: it clears 4.5:1.
     Anything lighter is a contrast failure, not a design choice. */
  --p-ink:        #14191f;
  --p-muted:      #46525e;
  --p-faint:      #6a7683;
  --p-disabled:   #97a5b5;

  /* --p-faint goes muddy on --p-dark, so the readout strip already drops to
     #7d8ea0 for its eyebrow -- hardcoded there and in two other files, with
     no shared name. This is that colour: the faint ink for a dark surface. */
  --p-faint-dark: #7d8ea0;

  /* Rules */
  --p-line:       #ccd4dc;
  --p-hair:       #e3e8ed;

  /* MACHINE STATE. These three are never decoration and never mean anything
     else. A missing measurement is a grey dash, never a red zero -- an empty
     red ring reads as a real 0%. */
  --p-run:        #157f4f;
  --p-idle:       #a86a00;
  --p-stop:       #a81d14;

  /* --p-run reads muddy on --p-dark, so home.html invented a lighter green
     for the dark strip instead of reusing it there. Same meaning, lifted for
     a dark ground -- not a fourth machine state, and not licence for a fifth. */
  --p-run-lift: #57d492;

  /* T43bb tokens: the breakdown stages after New, in the order of urgency the stack
     light and alarm palettes share (red, orange, yellow), and a light green for Closed
     (nearly done), paler than Running so the two never read alike. Not machine states:
     --p-run/--p-idle/--p-stop keep their one meaning. No standard fixes these colours
     (andon and ISA-18.2-style palettes agree only on that order; owner, round 4: Closed
     light green). On white: --p-bk-ack 5.0:1 white text; --p-bk-attend and
     --p-bk-closed take --p-ink text. */
  --p-bk-ack: #b34700;
  --p-bk-attend: #e0b000;
  --p-bk-closed: #8fd1a8;

  /* ---- T71: tokens the light set gains (inside :root, after --p-bk-closed) ---- */
  /* An off-white surface a shade off --p-card: a row or box that must read as
     set apart without a rule (downtime's windows, guide's task heads, .p-locked). */
  --p-sunk:   #f7f9fb;
  /* The scrim behind a sheet, and the one drop shadow (the header's bell panel). */
  --p-scrim:  rgba(20, 25, 31, .55);
  --p-shadow: rgba(20, 25, 31, .18);
  /* Text on --p-dark (the readout strip, the toast, the busy flash, tv). White in
     both modes: --p-dark stays dark in both. Not --p-on-brand, which is the text
     on a coloured fill and turns dark in the dark set. */
  --p-on-dark:   #fff;
  /* Text on a bright fill (--p-bk-attend yellow, --p-bk-closed light green): dark
     in both modes, where --p-ink turns light. */
  --p-on-bright: #14191f;
  /* The header's logo: drawn as it is in light, reversed to white in dark
     (the mark's own blue measures 1.9:1 on the dark bar). */
  --p-logo: none;
  /* The two phase colours of the operator tablet (QC, maintenance); setting is
     --p-brand. Moved here from downtime.html's private :root. */
  --p-qc:    #5a3d99;
  --p-maint: #8a5a12;
  /* Tints, derived, never picked: a state colour 12% into the card for a box,
     35% for its rule (.p-notice's mix since T2), and the colour deepened a fifth
     toward the ink for text on it (.p-tag's word since T16c). Declared once here;
     they follow the dark set with no value of their own. */
  --p-run-tint:        color-mix(in srgb, var(--p-run) 12%, var(--p-card));
  --p-run-tint-line:   color-mix(in srgb, var(--p-run) 35%, var(--p-card));
  --p-run-tint-ink:    color-mix(in srgb, var(--p-run) 80%, var(--p-ink));
  --p-idle-tint:       color-mix(in srgb, var(--p-idle) 12%, var(--p-card));
  --p-idle-tint-line:  color-mix(in srgb, var(--p-idle) 35%, var(--p-card));
  --p-idle-tint-ink:   color-mix(in srgb, var(--p-idle) 80%, var(--p-ink));
  --p-stop-tint:       color-mix(in srgb, var(--p-stop) 12%, var(--p-card));
  --p-stop-tint-line:  color-mix(in srgb, var(--p-stop) 35%, var(--p-card));
  --p-stop-tint-ink:   color-mix(in srgb, var(--p-stop) 80%, var(--p-ink));
  --p-brand-tint:      color-mix(in srgb, var(--p-brand) 12%, var(--p-card));
  --p-brand-tint-line: color-mix(in srgb, var(--p-brand) 35%, var(--p-card));
  --p-brand-tint-ink:  color-mix(in srgb, var(--p-brand) 80%, var(--p-ink));
  --p-qc-tint:         color-mix(in srgb, var(--p-qc) 12%, var(--p-card));
  --p-qc-tint-ink:     color-mix(in srgb, var(--p-qc) 80%, var(--p-ink));
  --p-maint-tint:      color-mix(in srgb, var(--p-maint) 12%, var(--p-card));
  --p-maint-tint-ink:  color-mix(in srgb, var(--p-maint) 80%, var(--p-ink));
  color-scheme: light;

  /* Geometry. 2px, not 14px. */
  --p-radius:     2px;
  --p-tap:        44px;

  /* Spacing scale. Nothing tokenised this before: every gap and padding
     across the pages was a one-off px value (24 distinct paddings in
     downtime alone, 22 in setter, 12 in qc_table). Six steps, roughly
     doubling from the tightest icon/badge gap up to a page-level gutter, so
     the next page picks one of these instead of inventing a 25th. */
  --p-s1: 4px;
  --p-s2: 8px;
  --p-s3: 12px;
  --p-s4: 16px;
  --p-s5: 24px;
  --p-s6: 32px;

  /* Type scale. ~40 distinct font sizes across the pages (qc_table alone
     has 17 -- 10 plain plus 7 clamp()) resolved to nothing: 15px, the body
     default, was the only one that happened to already sit on a scale.
     Seven steps: tight through the label/UI sizes DINish already uses in
     this file (10.5 / 11 / 12 / 13), the 15px body size, then the two
     figure sizes .p-figure and .p-figure--sm already use (19 / 28). */
  --p-t1: 10.5px;
  --p-t2: 11px;
  --p-t3: 12px;
  --p-t4: 13px;
  --p-t5: 15px;
  --p-t6: 19px;
  --p-t7: 28px;
  /* Display type, card T3: text a kiosk operator reads from across a room.
     The t-scale stops at 28px; qc_table.html's headline alone was
     clamp(40px, 9vw, 96px). Three steps that scale with the screen. */
  --p-d1: clamp(20px, 4vw, 40px);
  --p-d2: clamp(30px, 6.5vw, 68px);
  --p-d3: clamp(40px, 9vw, 96px);

  /* Border weight. The hairline everywhere (--p-line / --p-hair carry the
     colour) and the one thick accent weight -- a panel's 3px top edge today
     -- so anything else that wants the same weight has a name for it
     instead of picking its own number. */
  --p-border:       1px;
  --p-border-thick: 3px;

  /* Stacking layers, spaced a hundred apart so a layer can be slotted in
     later without renumbering anything that already exists. */
  --p-z-sticky:  100;   /* the header bar, above normal page flow */
  --p-z-overlay: 200;   /* modals, dropdowns -- above sticky content */
  --p-z-toast:   300;   /* transient notices -- above everything else */

  /* The one breakpoint, shared with pulse_header.js. pulse.css narrowed
     .p-wrap at 860px while pulse_header.js narrowed the bar at 700px --
     between those two widths the content gutter and the header gutter
     disagreed. 860 is pulse.css's existing number (this card only touches
     :root, so the media query below is unchanged); pulse_header.js now
     matches it instead. A CSS custom property cannot appear inside an
     @media condition, so both files still carry 860 as a literal -- this
     token is the documented single source those two literals must agree
     with. */
  --p-bp-narrow: 860px;

  /* The header bar's height. 60px today, hardcoded a second time as
     downtime.html's top:60px so its fixed content clears the bar.
     pulse_header.js now reads this token instead of repeating the literal. */
  --p-headh: 60px;

  /* ---- legacy aliases: portal.css token names, new values. A portal card
     migrates by swapping its <link> and nothing else. ---- */
  --p-bg:    var(--p-ground);
  --p-blue:  var(--p-brand);
  --p-green: var(--p-run);
  --p-amber: var(--p-idle);
  --p-red:   var(--p-stop);
  --p-label: var(--p-muted);
}

/* ---- T71: the dark set, a second block right after :root's closing brace ---- */
/* Screen only: a page printed from dark prints light. Only the tokens that
   change are here; every other token, and every derived tint, follows. */
@media screen {
  :root[data-theme="dark"] {
    --p-ground:     #0e1216;
    --p-card:       #161b21;
    --p-dark:       #07090b;
    --p-ink:        #e4e9ee;
    --p-muted:      #aab5c0;
    --p-faint:      #8d99a6;
    --p-disabled:   #7d8996;
    --p-line:       #343d47;
    --p-hair:       #232a32;
    --p-brand:      #6ea8fe;
    --p-brand-ink:  #9cc3ff;
    --p-brand-lift: #8dbbff;
    --p-on-brand:   #0e1216;
    --p-run:        #4cc98a;
    --p-idle:       #f0b13c;
    --p-stop:       #ff7b6e;
    --p-bk-ack:     #ff9a57;
    --p-sunk:       #1b2128;
    --p-scrim:      rgba(0, 0, 0, .6);
    --p-shadow:     rgba(0, 0, 0, .5);
    --p-logo:       brightness(0) invert(1);
    --p-qc:         #b9a0ec;
    --p-maint:      #d9a066;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--p-ground);
  color: var(--p-ink);
  font: 400 var(--p-t5)/1.45 "DINish", "DIN Next", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Every digit the same width, so counts align in a column and a machine ID
   never re-flows as it updates. Applied globally: there is no number in this
   system that wants proportional figures. */
body, input, select, textarea, button { font-variant-numeric: tabular-nums; }

a { color: var(--p-ink); text-decoration: none; }
a:hover { color: var(--p-brand); }

/* ----------------------------------------------------------- pulse-header */
/* Sticky. Today downtime.html and setter.html each stick their OWN header
   at top:0 while <pulse-header> itself does not -- so after one scroll the
   top of the viewport shows a different thing on different pages. Settled
   once, here, rather than in _template.html's own <style> block: a rule
   copied into every page a template spawns is the same divergent-copy
   pattern CLAUDE.md names for the machine push and the cycle-time apply --
   "Never add a second implementation of something that exists." One page
   chrome selector, one file. This targets the light-DOM host element
   (pulse-header's own shadow DOM has no opinion on its own position; see
   pulse_header.js's top comment on what does and does not cross that
   boundary), so it applies to <pulse-header> wherever it appears, with no
   page-level copy required. */
pulse-header { position: sticky; top: 0; z-index: var(--p-z-sticky); }
/* T71: the light/dark slider's circle reveal is a View Transition of the page; the
   browser's own cross-fade is off, so the header script animates the new page alone. */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* --------------------------------------------------------------- structure */
.p-wrap { padding: 20px 28px; display: flex; flex-direction: column; gap: var(--p-s4); }

/* A panel. The 3px top edge is the only colour it carries. */
.p-panel {
  background: var(--p-card);
  border: var(--p-border) solid var(--p-line);
  border-top: var(--p-border-thick) solid var(--p-brand);
  padding: 14px var(--p-s4) 6px;
}
.p-panel--plain { border-top: var(--p-border) solid var(--p-line); }
.p-panel--muted { border-top-color: var(--p-muted); }

/* Home's department panels (T77): solid, as any panel, answering a hover with the header
   strip's frosted blue. A greyed row (.p-list-locked) is not a link and does not answer. */
.p-panel--nav { transition: box-shadow .2s ease; }
.p-panel--nav:hover { box-shadow: inset 0 0 22px color-mix(in srgb, var(--p-brand) 12%, transparent); }
.p-panel--nav .p-list > a { padding-left: 8px; margin-left: -8px;
  transition: background-color .2s ease, box-shadow .2s ease, color .2s ease; }
.p-panel--nav .p-list > a:hover, .p-panel--nav .p-list > a:focus-visible {
  background: color-mix(in srgb, var(--p-brand) 10%, transparent); color: var(--p-brand);
  box-shadow: inset 0 0 14px color-mix(in srgb, var(--p-brand) 22%, transparent), inset 2px 0 0 var(--p-brand); }

/* ------------------------------------------------------------------- type */
/* The micro label above a value or a group. Uppercase and tracked is DIN's
   native register for a label, and it is what separates label from value
   without needing a third weight. */
.p-eyebrow {
  font-size: var(--p-t1); font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--p-faint);
}
.p-title {
  margin: 0; font-size: var(--p-t3); font-weight: 700; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--p-ink);
}
.p-figure { font-size: var(--p-t7); font-weight: 400; line-height: 1; }
.p-figure--sm { font-size: var(--p-t6); }

/* ------------------------------------------------------------------ lists */
/* Rows separated by a hairline, not by gaps between cards. */
.p-list { display: flex; flex-direction: column; }
.p-list > * { padding: 9px 0; font-size: var(--p-t5); border-top: var(--p-border) solid var(--p-hair); }
.p-list > .p-list-locked {
  color: var(--p-disabled); display: flex; align-items: center; gap: 7px;
}

/* ---------------------------------------------------------------- controls */
.p-btn {
  height: var(--p-tap); padding: 0 var(--p-s4);
  border: var(--p-border) solid var(--p-line); border-radius: var(--p-radius);
  background: var(--p-card); color: var(--p-ink);
  font: 700 var(--p-t2)/1 "DINish", system-ui, sans-serif;
  letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer; display: inline-flex; align-items: center; gap: var(--p-s2);
}
.p-btn:hover { border-color: var(--p-brand); color: var(--p-brand); }
.p-btn--primary { background: var(--p-brand); border-color: var(--p-brand); color: var(--p-on-brand); }
.p-btn--primary:hover { background: var(--p-brand-ink); border-color: var(--p-brand-ink); color: var(--p-on-brand); }
.p-btn--danger { background: var(--p-stop); border-color: var(--p-stop); color: var(--p-on-brand); }
.p-btn--danger:hover { color: var(--p-on-brand); }

.p-input {
  height: var(--p-tap); padding: 0 var(--p-s3);
  border: var(--p-border) solid var(--p-line); border-radius: var(--p-radius);
  background: var(--p-card); color: var(--p-ink);
  font: 400 var(--p-t5) "DINish", system-ui, sans-serif;
}
.p-input:focus { outline: 2px solid var(--p-brand); outline-offset: -2px; }
.p-field { display: flex; flex-direction: column; gap: 5px; }
.p-field > label { font-size: 12.5px; font-weight: 700; color: var(--p-muted); }

/* ------------------------------------------------------------ status marks */
/* A count. Square, because a pill is soft and this is a number, not a tag. */
.p-badge {
  background: var(--p-stop); color: var(--p-on-brand);
  font-size: var(--p-t2); font-weight: 700; padding: 2px 7px;
}
.p-badge--quiet { background: var(--p-ground); color: var(--p-muted); }
/* T11: employees.html's "has a card"/"active"/"handed over" pills had no
   home in red (alarm) or quiet (neutral/absent) -- a positive state, reused
   from .p-notice--ok/.p-toast--ok/.p-flash--ok's own precedent for --p-run
   meaning "ok" beyond literal machine-running state. */
.p-badge--ok { background: var(--p-run); color: var(--p-on-brand); }

.p-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; }
.p-state::before { content: ""; width: 7px; height: 7px; flex-shrink: 0; }
.p-state--run::before  { background: var(--p-run); }
.p-state--idle::before { background: var(--p-idle); }
.p-state--stop::before { background: var(--p-stop); }
.p-state--run  { color: var(--p-run); }
.p-state--idle { color: var(--p-idle); }
.p-state--stop { color: var(--p-stop); }

/* No measurement. Grey, and a dash -- never a red zero. */
.p-nodata { color: var(--p-disabled); }
.p-nodata::after { content: "\2014"; }

/* --------------------------------------------------------------- readout */
/* The instrument strip: flat, ruled into cells, one figure per cell. */
/* T41: the strip wraps instead of overflowing. One row on the tablets and
   desktops; on a phone the cells take two to a row (120px minimum each, the
   Plant cell wider). Each cell's top rule is pulled up 1px under the strip's
   edge, so only a wrapped row shows it. No new breakpoint: --p-bp-narrow stays
   the only one. */
.p-readout {
  background: var(--p-dark); color: var(--p-on-dark);
  border-left: var(--p-s1) solid var(--p-brand);
  display: flex; align-items: stretch; flex-wrap: wrap; overflow: hidden;
}
.p-readout-cell {
  flex: 1 1 120px; padding: 15px 20px;
  border-left: var(--p-border) solid var(--p-dark-line);
  border-top: var(--p-border) solid var(--p-dark-line); margin-top: -1px;
  display: flex; flex-direction: column; gap: 3px;
}
.p-readout-cell:first-child { border-left: 0; }
.p-readout-cell--key { flex: 1 0 176px; justify-content: center; }
/* A cell that is not ready: greyed, not a link (home.html's Dashboard). */
.p-readout-off {
  flex: 0 0 auto; display: flex; align-items: center; padding: var(--p-s4) var(--p-s5);
  border-left: var(--p-border) solid var(--p-dark-line);
  border-top: var(--p-border) solid var(--p-dark-line); margin-top: -1px;
  color: var(--p-faint-dark); font-size: var(--p-t2); font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
}
.p-readout .p-eyebrow { color: var(--p-faint-dark); }

/* ------------------------------------------------------------------ misc */
.p-locked { background: var(--p-sunk); border-color: var(--p-hair); }
.p-locked .p-title { color: var(--p-faint); }
.p-spacer { flex-grow: 1; }

@media (max-width: 860px) {
  .p-wrap { padding: var(--p-s4); }
}

/* ======================================================================
   PAGE-LEVEL PRIMITIVES -- added under card T2.

   WHY: 111 privately-defined classes across qc_table.html, downtime.html
   and setter.html (home.html has none at all for its own title bar) against
   27 real classes here. Every page reinvented the same dozen shapes with
   its own numbers. These are the one implementation of each; a page that
   needs a shape not listed here gets a new primitive added to THIS file,
   not another private class (CLAUDE.md: "Never add a second implementation
   of something that exists.").
   ====================================================================== */

/* --------------------------------------------------------------- pagehead */
/* The page title bar (qc_table.html:54, downtime.html:36, setter.html:29).
   Sits below <pulse-header> in normal flow -- it is not itself sticky; see
   _template.html for why the header alone is. */
.p-pagehead {
  /* wraps rather than squeezing: at phone width qc_table.html (card T3)
     broke its title one word per line. Nothing may scroll sideways. */
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--p-s3);
  background: var(--p-card); border-bottom: var(--p-border) solid var(--p-line);
}
.p-pagehead h1, .p-pagehead-title {
  margin: 0; white-space: nowrap; font-size: var(--p-t6); font-weight: 700; line-height: 1.2;
}
.p-pagehead-sub { font-size: var(--p-t3); color: var(--p-muted); }

/* ---------------------------------------------------------------- section */
/* A block with its own uppercase heading (setter.html:48, qc_table.html:91
   -- e.g. the "RECENT" aside heading). */
.p-section { display: flex; flex-direction: column; gap: var(--p-s3); }
.p-section > h2, .p-section-head {
  margin: 0; font-size: var(--p-t3); font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--p-muted);
}

/* ---------------------------------------------------------------- toolbar */
/* A row of buttons/actions (downtime.html:52 .btn-row, setter.html:109
   .footer-in, setter.html:130 .sheet-actions, home.html:143 inline flex).
   --stretch gives every child equal width, the shape downtime and setter
   both wanted for their button rows. */
.p-toolbar { display: flex; align-items: center; gap: var(--p-s3); }
.p-toolbar--stretch > * { flex: 1 1 0; }

/* ------------------------------------------------------------------- grid */
/* A column grid (setter.html:51 .jobgrid, home.html:67 inline
   grid-template-columns). Two columns by default; --3/--4 widen it, and
   BOTH collapse to two columns at --p-bp-narrow (860px) -- the plant's
   834px tablets are meant to see two columns, not three (see --p-bp-narrow
   in :root), so a three- or four-up grid must not silently stay three- or
   four-up on a tablet. */
.p-grid {
  display: grid; gap: var(--p-s3) var(--p-s4);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.p-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.p-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* T11 follow-up: employees.html's 5 summary tiles in --4 left the 5th
   wrapping alone onto its own row, stretched to a quarter-width column with
   nothing beside it -- and the other four read as unnecessarily wide for a
   label and one number. Five even columns seats all of them in one row. */
.p-grid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 860px) {
  .p-grid--3, .p-grid--4, .p-grid--5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* T41: up to three columns, each at least 260px: three on a desktop, two on
   the 834px tablets, one on a phone. Sized by the content, not by a media
   query, so it adds no breakpoint. Opt-in: the fixed grids above are unchanged. */
.p-grid--fit {
  grid-template-columns: repeat(auto-fit,
    minmax(min(100%, max(260px, (100% - 2 * var(--p-s4)) / 3)), 1fr));
  gap: var(--p-s4);
}

/* -------------------------------------------------------------------- rows */
/* A stack of bordered row-cards (qc_table.html:101 #recent taps,
   downtime.html:57 .dt entries, setter.html:71 .legs) -- distinct from
   .p-list's hairline-separated rows above: each row here is its own card. */
.p-rows { display: flex; flex-direction: column; gap: var(--p-s2); }
.p-rows > * {
  border: var(--p-border) solid var(--p-line); border-radius: var(--p-radius);
  padding: var(--p-s3) var(--p-s4); background: var(--p-card);
}

/* ------------------------------------------------------------------- empty */
/* qc_table.html:112 used padding 22px 14px, downtime.html:87 used 26px 0,
   setter.html:139 used 34px 12px -- one settled padding, the s5/s3 step. */
.p-empty {
  text-align: center; color: var(--p-muted); font-size: var(--p-t4);
  padding: var(--p-s5) var(--p-s3); line-height: 1.5;
}

/* ----------------------------------------------------------------- overlay */
/* A full-screen scrim (setter.html:116 .overlay, qc_table.html:121 #result,
   downtime.html:77 #login-overlay). Anchors content to the bottom below
   --p-bp-narrow (a reachable sheet on a handheld tablet) and centers it at
   or above that width, matching setter.html's own responsive split. */
.p-overlay {
  position: fixed; inset: 0; z-index: var(--p-z-overlay);
  background: var(--p-scrim);
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 860px) {
  .p-overlay { align-items: center; padding: var(--p-s5); }
}

/* ------------------------------------------------------------------- sheet */
/* The card inside .p-overlay (setter.html:118 .sheet). Full-width, square
   bottom sheet below --p-bp-narrow; a centered, radiused card at/above it. */
.p-sheet {
  background: var(--p-card); width: 100%; max-width: 560px;
  padding: var(--p-s5); max-height: 92vh; overflow-y: auto; border-radius: 0;
}
@media (min-width: 860px) {
  .p-sheet { border-radius: var(--p-radius); }
}

/* ---- Shared page primitives added by T43a (Production > Admin Settings). ----
   1. .p-pagehead aligns with .p-wrap and the header bar (28px, 16px narrow);
      it was 32px, so the title sat 4px right of everything under it.
   2. .p-sheet lays its children out on one 16px rhythm; h2/p lose the
      browser's default margins, which were the "random" gaps in every sheet.
   3. .p-sheet-foot: Save on the right, the dangerous act alone on the left.
   4. .p-pick: the one chooser. One line (a machine) or several (a Line
      Supervisor) look the same; only the mark differs.
   5. .p-sechead: a section heading with its action on the same line.
   6. tfoot th gets the same padding as td. */
.p-pagehead { padding: var(--p-s4) 28px; }
.p-pagehead-text { display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 860px) { .p-pagehead { padding: var(--p-s4); } }

.p-sheet { display: flex; flex-direction: column; gap: var(--p-s4); }
.p-sheet > h2 { margin: 0; font-size: var(--p-t6); font-weight: 700; line-height: 1.2; }
.p-sheet p { margin: 0; }
.p-sheet-head { display: flex; flex-direction: column; gap: var(--p-s1); }
.p-sheet-head h2 { margin: 0; font-size: var(--p-t6); font-weight: 700; line-height: 1.2; }
.p-sheet-rule { border: 0; border-top: var(--p-border) solid var(--p-hair); margin: 0; }
.p-sheet-foot { display: flex; gap: var(--p-s3); align-items: center; flex-wrap: wrap;
  padding-top: var(--p-s4); border-top: var(--p-border) solid var(--p-hair); }
.p-sheet-foot .p-spacer { flex: 1; }
.p-hint { font-size: var(--p-t3); color: var(--p-faint); }
.p-field > .p-input { width: 100%; }
.p-inline { display: flex; gap: var(--p-s3); }
.p-inline > .p-input { flex: 1; min-width: 0; }

.p-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: var(--p-s2); }
.p-pick > button {
  min-height: 40px; padding: 0 var(--p-s3); display: flex; align-items: center; gap: var(--p-s2);
  border: var(--p-border) solid var(--p-line); border-radius: var(--p-radius); background: var(--p-card);
  font: 700 var(--p-t4)/1.2 "DINish", system-ui, sans-serif; color: var(--p-ink); text-align: left; cursor: pointer;
}
.p-pick > button::before {
  content: ""; flex: 0 0 14px; height: 14px; border: var(--p-border) solid var(--p-line); background: var(--p-card);
}
.p-pick--one > button::before { border-radius: 50%; }
.p-pick > button[aria-pressed="true"] {
  border-color: var(--p-brand); color: var(--p-brand);
  background: color-mix(in srgb, var(--p-brand) 6%, var(--p-card));
}
.p-pick > button[aria-pressed="true"]::before {
  border-color: var(--p-brand); background: var(--p-brand);
  box-shadow: inset 0 0 0 3px var(--p-card);
}
.p-pick > button:focus-visible { outline: 2px solid var(--p-brand); outline-offset: 1px; }
.p-pick > button small { margin-left: auto; font-weight: 400; color: var(--p-faint); }

.p-sechead { display: flex; flex-wrap: wrap; align-items: center; gap: var(--p-s3); min-height: var(--p-tap); }
.p-sechead > h2 { margin: 0; font-size: var(--p-t3); font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--p-muted); }
.p-sechead > .p-spacer { flex: 1; }
.p-table tfoot th, .p-table tfoot td { padding: var(--p-s2) var(--p-s3); font-weight: 700; }

/* -------------------------------------------------------------------- tabs */
/* setter.html:125 .modes -- a row of equal-width mode buttons, one active. */
.p-tabs { display: flex; gap: var(--p-s3); }
.p-tabs > button {
  flex: 1 1 0; padding: var(--p-s3) var(--p-s2);
  border: var(--p-border-thick) solid var(--p-line); background: var(--p-card);
  font-size: var(--p-t3); font-weight: 700; color: var(--p-muted);
  text-transform: uppercase; letter-spacing: 0.08em; cursor: pointer;
}
.p-tabs > button.p-tabs-on {
  border-color: var(--p-brand); color: var(--p-brand); background: var(--p-ground);
}

/* ------------------------------------------------------- segmented control */
/* T43da. One choice of two to four, shown side by side, where a column of
   radio buttons would triple a list's height. Joined square boxes on one
   hairline; the chosen one filled with the brand. role="radiogroup" on the
   box, role="radio" and aria-checked on each button.
   --level is the access level (—, View, Use), colour-coded so a column of
   them reads at a glance: — chosen is a quiet grey (what a role cannot open
   should not draw the eye), View a brand tint, Use the brand. */
.p-seg { display: inline-flex; flex: 0 0 auto; border: var(--p-border) solid var(--p-line);
  border-radius: var(--p-radius); background: var(--p-card); }
.p-seg > button {
  min-height: 36px; min-width: 52px; padding: 0 var(--p-s3); border: 0;
  border-left: var(--p-border) solid var(--p-line); background: transparent;
  font: 700 var(--p-t3)/1 "DINish", system-ui, sans-serif; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--p-muted); cursor: pointer;
}
.p-seg > button:first-child { border-left: 0; }
.p-seg > button:hover { color: var(--p-brand); }
.p-seg > button[aria-checked="true"] { background: var(--p-brand); color: var(--p-on-brand); }
.p-seg > button:focus-visible { outline: 2px solid var(--p-brand); outline-offset: 1px; position: relative; }
.p-seg--level > button { min-width: 48px; padding: 0 var(--p-s2); }
.p-seg--level > button[data-v=""][aria-checked="true"] { background: var(--p-ground); color: var(--p-ink); box-shadow: inset 0 0 0 1px var(--p-faint); }
.p-seg--level > button[data-v="view"][aria-checked="true"] {
  background: color-mix(in srgb, var(--p-brand) 16%, var(--p-card)); color: var(--p-brand-ink);
  box-shadow: inset 0 0 0 1px var(--p-brand);
}

/* --------------------------------------------------------------- padlock */
/* T43da. An icon toggle for one fact that is on or off and takes effect at
   once: open padlock grey (off), closed padlock in the brand (on).
   <button aria-pressed> with an aria-label that names the state, and a
   title for the pointer. */
.p-lock { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 36px; height: 36px; padding: 0; border: var(--p-border) solid var(--p-line);
  border-radius: var(--p-radius); background: var(--p-card); color: var(--p-disabled); cursor: pointer; }
.p-lock:hover { border-color: var(--p-brand); color: var(--p-brand); }
.p-lock[aria-pressed="true"] { background: var(--p-brand); border-color: var(--p-brand); color: var(--p-on-brand); }
.p-lock:focus-visible { outline: 2px solid var(--p-brand); outline-offset: 1px; }

/* ------------------------------------------------------------------- toast */
/* downtime.html:70 anchored at bottom:20px in --p-run (green); setter.html:144
   anchored at bottom:96px in near-black. setter.html's 96px was not an
   inconsistency to resolve away -- read in context it clears that page's
   own fixed idle bar, which this file's .p-idlebar (below) now generalises.
   One answer, built the same way setter.html's number was earned rather
   than picked: bottom anchor, tokenised, high enough to clear .p-idlebar
   plus one more gap so the two never touch. .p-idlebar is
   2*(--p-s3) padding + one (--p-t4) text line at line-height:1 tall; this
   adds one more --p-s3 on top of that, i.e. 3*(--p-s3) + (--p-t4) =
   3*12 + 13 = 49px at the current token values. Default colour is a
   neutral near-black rather than downtime's green: green as a DEFAULT
   mislabels every non-success toast (downtime's own error paths reused the
   same green box). A page wanting a state colour reaches for --ok/--bad,
   same pattern as .p-notice below, not a fourth default. */
.p-toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(3 * var(--p-s3) + var(--p-t4));
  background: var(--p-dark); color: var(--p-on-dark);
  padding: var(--p-s3) var(--p-s5); border-radius: var(--p-radius);
  font-weight: 700; font-size: var(--p-t4); opacity: 0;
  transition: opacity .2s; pointer-events: none; z-index: var(--p-z-toast);
  max-width: 92vw; text-align: center;
}
.p-toast.p-toast-show { opacity: 1; }
.p-toast--ok { background: var(--p-run); color: var(--p-on-brand); }
.p-toast--bad { background: var(--p-stop); color: var(--p-on-brand); }

/* ------------------------------------------------------------------ notice */
/* setter.html:65-67 and downtime.html:133-151 each hardcoded a full
   ok/warn/bad palette -- nine hexes between them, two different sets for the
   same three states. These derive from the three canonical state colours
   already in :root (--p-run/--p-idle/--p-stop) instead of a tenth hand-picked
   set, so a future state-colour change updates every notice for free. */
.p-notice {
  border: var(--p-border) solid var(--p-line); border-radius: var(--p-radius);
  padding: var(--p-s3) var(--p-s4); font-size: var(--p-t4); line-height: 1.45;
  background: var(--p-card); color: var(--p-ink);
}
.p-notice b { font-weight: 700; }
.p-notice--ok {
  background: var(--p-run-tint);
  border-color: var(--p-run-tint-line);
  color: var(--p-run);
}
.p-notice--warn {
  background: var(--p-idle-tint);
  border-color: var(--p-idle-tint-line);
  color: var(--p-idle);
}
.p-notice--bad {
  background: var(--p-stop-tint);
  border-color: var(--p-stop-tint-line);
  color: var(--p-stop);
}

/* ---------------------------------------------------------------- idlebar */
/* downtime.html:112 pinned it bottom:0 z-900; setter.html:41 pinned the same
   element top:0 z-20, above its own sticky header. One answer: bottom. The
   sticky header (see pulse-header below) already owns the top edge on every
   page; a second fixed bar up there competes with it and, on setter's own
   layout, sits ABOVE the logo. Bottom is unclaimed on every page this
   primitive is used on.

   line-height:1 is explicit, not incidental -- .p-toast's bottom offset
   (above) is computed from this rule's own padding and font-size ON THE
   ASSUMPTION the text is exactly one line-height-1 line tall. Without this,
   the inherited body line-height (1.45) would make the real height taller
   than that formula accounts for and the toast could clip the bar again. */
.p-idlebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--p-z-sticky);
  background: var(--p-stop); color: var(--p-on-brand);
  text-align: center; padding: var(--p-s3) var(--p-s4);
  font-weight: 700; font-size: var(--p-t4); line-height: 1;
}

/* p-state normally sits on --p-card; the readout strip is --p-dark, where
   --p-run reads muddy (see --p-run-lift's own comment in :root) -- this is
   the one place that lift belongs. */
.p-readout .p-state--run { color: var(--p-run-lift); }
.p-readout .p-state--run::before { background: var(--p-run-lift); }

/* =======================================================================
   KIOSK PRIMITIVES -- added under card T3, migrating qc_table.html.
   WHY: the first real page moved onto this file needed four shapes the
   portal pages never had -- a screen that must never scroll, type read from
   across a room, a full-bleed result flash, and a row with a head. They were
   138 lines of qc_table's private <style>; they are one implementation here,
   for downtime.html and setter.html to reuse when they migrate.
   ======================================================================= */

/* A kiosk page. Put on <body>. It fills the screen, never scrolls and
   selects nothing: the tablet runs for weeks without a reload, and a page
   that can scroll or select text can end up somewhere no operator can undo. */
.p-kiosk {
  height: 100vh; height: 100dvh; overflow: hidden;
  display: flex; flex-direction: column;
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
/* Below the page head: a stage beside a side column, stacked below
   --p-bp-narrow (so the plant's 834px tablets stack, as with .p-grid). */
.p-kiosk-main { flex: 1; display: flex; min-height: 0; }
.p-kiosk-side {
  flex: 0 0 340px; display: flex; flex-direction: column; min-height: 0;
  background: var(--p-card); border-left: var(--p-border) solid var(--p-line);
  padding: var(--p-s4);
}
.p-kiosk-scroll { flex: 1; min-height: 0; overflow-y: auto; }
@media (max-width: 860px) {
  .p-kiosk-main { flex-direction: column; }
  .p-kiosk-side {
    flex: 0 0 34%; border-left: 0;
    border-top: var(--p-border) solid var(--p-line);
  }
}

/* Display type -- read from across a room. See --p-d1..3 in :root. */
.p-d1 { font-size: var(--p-d1); font-weight: 700; line-height: 1.3; }
.p-d2 { font-size: var(--p-d2); font-weight: 700; line-height: 1.05; }
.p-d3 { font-size: var(--p-d3); font-weight: 700; line-height: 1; }

/* The stage: one centred prompt filling the space it is given. */
.p-stage {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center;
  gap: var(--p-s5); padding: var(--p-s5);
}
.p-stage > h1 { margin: 0; text-transform: uppercase; letter-spacing: 0.04em; }
.p-stage-sub {
  margin: 0; max-width: 760px; line-height: 1.5;
  font-size: var(--p-t6); color: var(--p-muted);
}
.p-stage-icon {
  width: 74px; height: 74px; color: var(--p-faint);
  animation: p-float 2.4s ease-in-out infinite;
}
@keyframes p-float { 50% { transform: translateY(-10px); } }

/* The flash: a full-bleed result an operator reads without walking over.
   Not .p-overlay -- that dims the page behind a sheet; this REPLACES the
   page with one colour for a few seconds. Flat fills, the state colours. */
.p-flash {
  position: fixed; inset: 0; z-index: var(--p-z-overlay);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; word-break: break-word;
  gap: var(--p-s3); padding: var(--p-s6); color: var(--p-on-brand);
}
.p-flash--ok   { background: var(--p-run); }
.p-flash--bad  { background: var(--p-stop); }
.p-flash--busy { background: var(--p-dark); color: var(--p-on-dark); }
.p-flash .p-eyebrow { font-size: var(--p-t6); color: inherit; opacity: .85; }
.p-flash-sub { font-size: var(--p-t6); opacity: .9; }
.p-flash-foot {
  position: absolute; bottom: var(--p-s5);
  font-size: var(--p-t5); opacity: .8;
}
/* The countdown: the page script scales it from 1 to 0 over the flash. */
.p-flash-bar {
  position: absolute; left: 0; bottom: 0; height: 7px; width: 100%;
  background: color-mix(in srgb, currentColor 85%, transparent);
  transform-origin: left center;
}
/* The loading ring -- the one round mark the language allows. */
.p-spin {
  width: 64px; height: 64px; border-radius: 50%;
  border: 7px solid color-mix(in srgb, currentColor 28%, transparent);
  border-top-color: currentColor;
  animation: p-spin .85s linear infinite;
}
@keyframes p-spin { to { transform: rotate(360deg); } }

/* Row anatomy inside .p-rows: a head line (title, then trailing meta) and
   meta lines under it. --ok/--bad put the outcome on the row's left edge,
   the panel's coloured top edge turned sideways for a list. */
.p-row-head { display: flex; align-items: baseline; gap: var(--p-s2); }
.p-row-title {
  font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.p-row-meta { font-size: var(--p-t4); color: var(--p-muted); line-height: 1.35; }
.p-row-head > .p-row-meta { margin-left: auto; flex: 0 0 auto; }
.p-rows > .p-row--ok  { border-left: var(--p-border-thick) solid var(--p-run); }
.p-rows > .p-row--bad { border-left: var(--p-border-thick) solid var(--p-stop); }

/* ------------------------------------------------------------------ hidden */
/* Independently redefined at downtime.html:86 and setter.html:150. */
.p-hidden { display: none !important; }

/* =======================================================================
   TABLE PRIMITIVES -- added under card T10.
   WHY: the only table styling in the app is .tbl in portal.css, a file
   this file's own header comment (:11-17) already calls SUPERSEDED. Every
   page migrated onto pulse.css so far (qc_table.html, downtime.html,
   setter.html, home.html, tv.html) is kiosk/tablet-shaped; none is a dense,
   searchable, multi-column admin grid. .p-table ports .tbl's shape as the
   one implementation, built only from --p-* tokens.
   ======================================================================= */

/* T16c (2026-09-24): redesigned on the old /it device table, which the owner
   found "much better" to read than this primitive's first two versions --
   the same complaint employees.html raised under T11. What it takes from
   that table, and why:
   - Rows on white, parted by a hairline, with a hover tint -- not zebra.
     T11's stripes were --p-ground, the page's own grey, on every other row.
     At IT Portal's and employees.html's density that read as noise, and a
     striped row could not be told from a group heading.
   - Column headings in their own case, --p-t3 bold, muted, on white over a
     rule -- not --p-t1 tracked capitals on a grey band, which were hard to
     read across ten columns.
   - A group row (.p-table-group) that is plainly a heading: ink, bold, a
     light band, the full width.
   - A key column (.p-key) in bold; numbers (.p-num) right-aligned.
   The frame is a card with the panel's brand top edge, so a table and the
   tiles above it read as one family. Corners stay square. (T11 follow-up's
   reason for the card background -- a --p-hair divider vanishes against
   --p-ground -- still holds: the divider now sits on white.) */
.p-table {
  width: 100%; border-collapse: collapse; background: var(--p-card);
  border: var(--p-border) solid var(--p-line);
  border-top: var(--p-border-thick) solid var(--p-brand);
  font: 400 var(--p-t4) "DINish", system-ui, sans-serif;
}
.p-table th { text-align: left; }
.p-table thead th {
  font-size: var(--p-t3); font-weight: 700; color: var(--p-muted);
  padding: var(--p-s3) var(--p-s3) var(--p-s2);
  border-bottom: var(--p-border) solid var(--p-line);
  white-space: nowrap;
}
/* vertical-align: middle, deliberately not .tbl's top -- T11's pill/button
   cells need to sit centred in the row, not hang from its top edge. */
.p-table td {
  padding: var(--p-s2) var(--p-s3); border-bottom: var(--p-border) solid var(--p-hair);
  vertical-align: middle;
}
.p-table tbody tr:last-child td { border-bottom: 0; }
/* Only where there is a pointer: on a tablet a tapped row would keep it. */
@media (hover: hover) {
  .p-table tbody tr:hover td { background: color-mix(in srgb, var(--p-brand) 5%, var(--p-card)); }
}
/* A heading inside the body: <tr class="p-table-group"><th colspan="N">. */
.p-table .p-table-group th {
  font-size: var(--p-t4); font-weight: 700; color: var(--p-ink);
  padding: var(--p-s2) var(--p-s3);
  background: color-mix(in srgb, var(--p-ground) 65%, var(--p-card));
  border-top: var(--p-border) solid var(--p-line);
  border-bottom: var(--p-border) solid var(--p-line);
}
.p-table .p-key { font-weight: 700; }
.p-table .p-num { text-align: right; }
/* Totals: <tfoot>, which pulse_table.js never sorts, under a rule. */
.p-table tfoot tr:first-child td { border-top: var(--p-border) solid var(--p-line); }
.p-table tfoot tr:last-child td { border-bottom: 0; }

/* ------------------------------------------------------------------ sort */
/* The owner, 2026-09-26: every .p-table sorts by any column. pulse_table.js
   makes each heading's words a button -- the same words in the same place --
   and puts aria-sort on the sorted heading; the arrow is drawn from that.
   Every heading keeps the arrow's room, so sorting shifts no column. On a
   right-aligned (.p-num) heading the arrow goes before the words, which stay
   over their figures. */
.p-table .p-sort {
  display: inline-flex; align-items: center; gap: var(--p-s1);
  margin: 0; padding: 0; border: 0; background: none;
  font: inherit; color: inherit; text-align: inherit; cursor: pointer;
}
.p-table .p-num .p-sort { flex-direction: row-reverse; }
.p-table .p-sort::after {
  content: "\25B2"; font-size: var(--p-t1); color: var(--p-faint); visibility: hidden;
}
@media (hover: hover) {
  .p-table .p-sort:hover { color: var(--p-ink); }
  .p-table .p-sort:hover::after { visibility: visible; }
}
.p-table .p-sort:focus-visible { outline: var(--p-border) solid var(--p-brand); outline-offset: var(--p-s1); }
.p-table th[aria-sort] .p-sort { color: var(--p-ink); }
.p-table th[aria-sort] .p-sort::after { visibility: visible; color: var(--p-brand); }
.p-table th[aria-sort="descending"] .p-sort::after { content: "\25BC"; }

/* -------------------------------------------------------------------- tag */
/* T16c: a state word in a table row -- Online, Running, Good, Not found. The
   old /it page's chips read at a glance in a dense row where .p-state's 7px
   square does not. Flat and square-cornered like everything here: the state
   colour's word on a 14% tint of it. .p-badge stays what it is, a count.
   The word is the state colour deepened a fifth toward --p-ink: plain
   --p-run and --p-idle on their own tint measure 4.2:1 and 3.7:1, under the
   4.5:1 small text needs (the old /it chips had the same fault); deepened,
   all three clear it. */
.p-tag {
  display: inline-block; padding: 0 var(--p-s2); line-height: 1.7;
  font-size: var(--p-t3); font-weight: 700; white-space: nowrap;
  border-radius: var(--p-radius);
  background: var(--p-ground); color: var(--p-muted);
}
.p-tag--ok {
  background: color-mix(in srgb, var(--p-run) 14%, var(--p-card));
  color: var(--p-run-tint-ink);
}
.p-tag--warn {
  background: color-mix(in srgb, var(--p-idle) 14%, var(--p-card));
  color: var(--p-idle-tint-ink);
}
.p-tag--bad {
  background: color-mix(in srgb, var(--p-stop) 14%, var(--p-card));
  color: var(--p-stop-tint-ink);
}

/* T16b: a table wider than the screen scrolls sideways inside this frame and
   the page does not ("Nothing may scroll sideways", .p-pagehead). IT Portal's
   machines table has ten columns and must read at phone width (IT-PAGES-SPEC.md
   S2.5, S4.4). Inside the frame a row stays on one line: the frame scrolls
   rather than each cell folding into a tall, narrow column. */
.p-table-wrap { overflow-x: auto; }
.p-table-wrap .p-table td { white-space: nowrap; }

/* T29e: .p-table--stack. A row of a list a supervisor works through on a
   phone (Test 1) must not scroll sideways: its inputs and buttons are cut off
   at the frame's edge, which is where the "Save" lives. Below --p-bp-narrow a
   row becomes a block: the first cell (the key) and the second (its state)
   share a line, every later cell takes a full line and shows its column's name
   from data-label. Same markup, no second layout. Every <td> of a stacked
   table carries data-label. The cells are placed by first-child and its next
   sibling, not by position: a position selector in a .p-table rule reads as
   zebra striping to test_l0_table_design. */
@media (max-width: 860px) {
  .p-table--stack thead { display: none; }
  .p-table--stack, .p-table--stack tbody { display: block; width: 100%; }
  .p-table--stack tr {
    display: grid; grid-template-columns: 1fr auto; align-items: center;
    column-gap: var(--p-s3); padding: var(--p-s2) var(--p-s3);
    border-bottom: var(--p-border) solid var(--p-hair);
  }
  .p-table--stack td, .p-table-wrap .p-table--stack td {
    display: block; border: 0; padding: var(--p-s1) 0; white-space: normal;
    grid-column: 1 / -1;
  }
  .p-table--stack td:first-child { grid-column: 1; }
  .p-table--stack td:first-child + td { grid-column: 2; }
  .p-table--stack td[data-label]::before {
    content: attr(data-label); display: block;
    font-size: var(--p-t2); font-weight: 700; color: var(--p-muted);
  }
  .p-table--stack td:first-child[data-label]::before,
  .p-table--stack td:first-child + td[data-label]::before { content: none; }
}
