/* ============================================================================
   RailCompliant — design system  (railcompliant.com)
   FRA locomotive inspection, maintenance & compliance for heritage railroads.

   Direction: "builder's plate + signal cabin." A precise, official steel-and-
   brass identity that stays approachable. Three deliberate signatures:
     1. Signal-aspect status  — status pills borrow the railroad's own regulated
        colour vocabulary (green = clear, amber = approach/due, red = danger/
        overdue). The colour IS the meaning, not decoration.
     2. Monospaced regulatory data — locomotive marks, CFR citations, part
        numbers and audit hashes are set in a mono "data" face, like a stencilled
        number plate or a typewritten compliance form.
     3. Stencilled eyebrows — tracked uppercase labels evoke equipment lettering.
   System fonts only (strict CSP; no remote fonts, no CDN assets).
   ============================================================================ */

:root {
  /* ---- Neutrals: cool rolled-steel, not cream ---- */
  --paper:      #eef1f5;   /* app background — steel mist        */
  --surface:    #ffffff;   /* cards / data surfaces              */
  --surface-2:  #f4f6f9;   /* zebra, insets, foot bars           */
  --ink:        #15212e;   /* deep steel blue-black              */
  --ink-soft:   #42505e;
  --ink-faint:  #5b6977;   /* >=4.5:1 on white, surface-2, paper and every tinted row (AA) */
  --line:       #d8dee6;
  --line-soft:  #e8ecf1;

  /* ---- Brand steel (primary) ---- */
  --steel:      #1f3a54;   /* primary — builder's-plate blue     */
  --steel-700:  #16293d;   /* hover / pressed                    */
  --steel-900:  #0f1e2c;   /* sidebar deep                       */
  --steel-800:  #13253a;   /* sidebar gradient stop              */
  --steel-50:   #e6ecf2;   /* faint steel tint                   */

  /* ---- Brass (signature heritage accent, used with restraint) ---- */
  --brass:      #b07a2b;
  --brass-600:  #8a5c1c;   /* brass as text: 5.8:1 on white */
  --brass-ink:  #2c1e08;   /* text on brass                      */
  --brass-50:   #f6ecd9;
  /* Filled brass surfaces that carry text (buttons, badges, the impersonation
     bar): a hair lighter than the accent so brass-ink clears 4.5:1. */
  --brass-fill:       #b8822f;
  --brass-fill-hover: #c08b3d;

  /* ---- Signal aspects — the status colour language ---- */
  --ok:    #1c7a46; --ok-bg:  #e3f0e7;   /* clear / compliant  */
  --due:   #925700; --due-bg: #fbeed4;   /* approach / due     */
  --over:  #b02a22; --over-bg:#f8e2e0;   /* danger / overdue   */
  --over-fill: #b02a22;                   /* solid red under white text (badges) */
  --info:  #2c5578; --info-bg:#e4ecf4;   /* advisory           */

  /* ---- Shape & depth ---- */
  --radius:     10px;
  --radius-sm:  7px;
  --radius-pill:999px;
  --shadow-sm:  0 1px 2px rgba(16,32,48,.06), 0 1px 3px rgba(16,32,48,.07);
  --shadow:     0 1px 3px rgba(16,32,48,.07), 0 8px 20px -10px rgba(16,32,48,.22);
  --shadow-lg:  0 24px 60px -20px rgba(15,30,44,.45);
  --ring:       0 0 0 3px rgba(31,58,84,.28);

  /* ---- Type ---- */
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --tracking-caps: .09em;   /* stencilled eyebrow tracking */

  /* ---- Legacy aliases (keep every token templates + old rules reference) ---- */
  --green:      var(--steel);      --green-700: var(--steel-700);   --green-50: var(--steel-50);
  --background: var(--paper);      --foreground: var(--ink);
  --card: var(--surface);          --card-foreground: var(--ink);
  --primary: var(--steel);         --primary-foreground: #ffffff;
  --secondary: #cdd5de;            --secondary-foreground: var(--ink);
  --muted: var(--surface-2);       --muted-foreground: var(--ink-faint);
  --accent: var(--steel-50);       --accent-foreground: var(--ink);
  --destructive: var(--over);      --destructive-foreground: #ffffff;
  --border: var(--line);           --input: var(--line);
  --sidebar: var(--steel-900);     --sidebar-foreground: #c6d2df;
  --sidebar-primary: var(--brass); --sidebar-primary-foreground: var(--brass-ink);
  --sidebar-accent: rgba(255,255,255,.08); --sidebar-accent-foreground: #ffffff;
  --sidebar-border: rgba(255,255,255,.09); --sidebar-ring: var(--brass);
  --tracking-normal: 0;
}

/* ============================================================================
   DARK MODE — token overrides only; components keep reading the same vars.
   The theme toggle sets data-theme="dark" on <html>; an inline head script
   applies the stored choice (or the OS preference) before first paint.
   ============================================================================ */
[data-theme=dark] {
  color-scheme: dark;
  --paper:      #0f151c;
  --surface:    #161e27;
  --surface-2:  #1c2632;
  --ink:        #e2e9f0;
  --ink-soft:   #a9b6c3;
  --ink-faint:  #8d9ba8;   /* 5.9:1 on surface, 5.4:1 on surface-2 (AA) */
  --line:       #2b3745;
  --line-soft:  #222d39;

  --steel:      #7ca6cb;   /* links + active text, lightened for dark paper */
  --steel-700:  #94b9d9;
  --steel-900:  #0b141d;
  --steel-800:  #101c29;
  --steel-50:   #1b2836;

  --brass:      #c08b3d;
  --brass-600:  #d3a35a;
  --brass-50:   #2a2214;
  --brass-fill:       #c08b3d;
  --brass-fill-hover: #d3a35a;

  --ok:   #62c48d; --ok-bg:  #14261c;
  --due:  #dfa353; --due-bg: #2b2210;
  --over: #e88379; --over-bg:#2e1917;
  --over-fill: #b02a22;
  --info: #82aed3; --info-bg:#18242f;

  --secondary:  #2a3644;
  --shadow-sm:  0 1px 2px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.35);
  --shadow:     0 1px 3px rgba(0,0,0,.4), 0 8px 20px -10px rgba(0,0,0,.6);
  --shadow-lg:  0 24px 60px -20px rgba(0,0,0,.7);
  --ring:       0 0 0 3px rgba(124,166,203,.3);
}
/* Solid steel stays a fill colour in dark mode (light --steel would wash out
   white button text); everything else follows the tokens. */
[data-theme=dark] .btn.primary { background: #2c5578; border-color: #2c5578; }
[data-theme=dark] .btn.primary:hover { background: #356588; border-color: #356588; }
[data-theme=dark] .btn.danger { border-color: #5a322f; }
[data-theme=dark] .tabbar .tab.active .tabn { background: #2c5578; }
[data-theme=dark] .topbar { background: rgba(15,21,28,.85); }
[data-theme=dark] input:hover, [data-theme=dark] select:hover, [data-theme=dark] textarea:hover { border-color: #3c4a59; }
[data-theme=dark] .note { background: #251d0e; border-color: #4d3d1c; color: #d9b877; }
[data-theme=dark] .note.proto { background: #16222c; border-color: #2c4256; color: #9ec3e0; }
[data-theme=dark] .note.ok { background: var(--ok-bg); border-color: #2a4a37; color: var(--ok); }
[data-theme=dark] .badge.steam { color: #e0a37b; background: #2c1e12; border-color: #54371e; }
[data-theme=dark] .badge.diesel { color: #9ec3e0; background: var(--info-bg); border-color: #2c4256; }
[data-theme=dark] .badge.violet { color: #aeb9f5; background: #1d2138; border-color: #363e6b; }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 34px; height: 34px; border-radius: 8px; border: none; background: transparent;
  color: var(--ink-soft); font-size: 1.02rem; cursor: pointer; line-height: 1;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--ink); }
.theme-toggle .ic { width: 18px; height: 18px; display: block; }
.theme-toggle .tt-sun, [data-theme=dark] .theme-toggle .tt-moon { display: none; }
[data-theme=dark] .theme-toggle .tt-sun { display: block; }

/* Inline SVG icons from partials/icons.html: 1em by default, sized per context. */
svg.ic { width: 1em; height: 1em; flex: none; vertical-align: -.125em; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--steel); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.18; font-weight: 700; letter-spacing: -.011em; color: var(--ink); }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.18rem; }
h3 { font-size: 1.02rem; letter-spacing: -.005em; }
p { margin: 0 0 1em; }
small { font-size: .8rem; }
code, .mono, .loco-id { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--steel); outline-offset: 2px; border-radius: 3px; }

/* ---------- Logo mark ---------- */
/* Side-profile diesel road-switcher on a rail: low short hood + tall cab +
   long hood, two trucks, drawn in currentColor so it themes to any surface.
   The brass ".hub" is the headlight — the one warm point. Horizontal ~2:1
   viewBox (0 0 40 20); scales from favicon to hero. */
/* Brand mark = the circular locomotive icon (PNG). Square; sized per context. */
.rc-mark { display: block; object-fit: contain; }
.mark .rc-mark { width: 100%; height: 100%; }
.mk-brand .rc-mark { width: 34px; height: 34px; }

/* ============================================================================
   APP SHELL
   ============================================================================ */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }

/* ---------- Sidebar: deep steel cab panel ---------- */
.sidebar {
  background: linear-gradient(178deg, var(--steel-800), var(--steel-900) 62%);
  color: var(--sidebar-foreground);
  padding: 0 0 1.25rem;
  position: sticky; top: 0; align-self: start; height: 100vh;
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(0,0,0,.35);
}
.brand {
  display: flex; align-items: center; gap: .7rem;
  padding: 1.15rem 1.25rem 1.1rem;
  border-bottom: 1px solid var(--sidebar-border);
}
.brand .mark {
  width: 42px; height: 42px; flex: none; /* square roundel icon */
  display: grid; place-items: center;
}
.brand b { color: #fff; font-size: 1.02rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
.brand small { display: block; color: #8ea3b8; font-size: .64rem; letter-spacing: var(--tracking-caps); text-transform: uppercase; margin-top: 2px; }

.org-switch {
  margin: .9rem 1rem; padding: .6rem .75rem; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.06); border: 1px solid var(--sidebar-border);
  font-size: .84rem; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  transition: background .12s;
}
.org-switch:hover { background: rgba(255,255,255,.1); }
.org-switch b { color: #fff; font-weight: 600; }
.org-switch span { color: #8ea3b8; }

/* One login can belong to several railroads (contract crews, consultants, a
   museum running two lines). With only one there is nothing to choose, so the
   control renders as a plain label with no affordance. */
.org-switch.solo { cursor: default; }
.org-switch.solo:hover { background: rgba(255,255,255,.06); }
.org-switch-wrap summary { list-style: none; }
.org-switch-wrap summary::-webkit-details-marker { display: none; }
.org-switch-wrap[open] .org-switch span { transform: rotate(180deg); }
.org-menu { margin: -.4rem 1rem .5rem; padding: .3rem; border-radius: var(--radius-sm);
  background: rgba(0,0,0,.25); border: 1px solid var(--sidebar-border); }
.org-menu-head { color: #7f95ab; font-size: .62rem; text-transform: uppercase;
  letter-spacing: var(--tracking-caps); font-weight: 700; padding: .4rem .55rem .3rem; }
.org-menu form { margin: 0; }
.org-menu-item { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem;
  width: 100%; text-align: left; padding: .45rem .55rem; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--sidebar-foreground); font: inherit; cursor: pointer; }
.org-menu-item:hover { background: rgba(255,255,255,.09); }
.org-menu-item b { color: #fff; font-weight: 600; font-size: .84rem; }
.org-menu-item span { color: #8ea3b8; font-size: .7rem; }
.org-menu-item.current { cursor: default; background: rgba(255,255,255,.05); }

.nav { padding: .35rem .6rem; overflow-y: auto; }
.nav .group {
  color: #7f95ab; font-size: .64rem; text-transform: uppercase;
  letter-spacing: var(--tracking-caps); font-weight: 700; margin: .9rem .7rem .3rem;
}
.nav a {
  display: flex; align-items: center; gap: .65rem;
  color: var(--sidebar-foreground); padding: .44rem .7rem; border-radius: var(--radius-sm);
  font-size: .9rem; margin-bottom: 1px; position: relative;
  transition: background .12s, color .12s;
}
/* When the nav is taller than the sidebar it scrolls; fade whichever edge has
   more items beyond it so the hidden groups announce themselves. Scroll-driven,
   so the fade only exists while the nav actually overflows. */
@property --nav-fade-top { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --nav-fade-bot { syntax: "<length>"; inherits: false; initial-value: 0px; }
@supports (animation-timeline: scroll()) {
  .sidebar .nav {
    mask-image: linear-gradient(to bottom, transparent, #000 var(--nav-fade-top), #000 calc(100% - var(--nav-fade-bot)), transparent);
    animation: nav-fade linear both; animation-timeline: scroll(self);
  }
  @keyframes nav-fade {
    0%   { --nav-fade-top: 0px;  --nav-fade-bot: 36px; }
    6%   { --nav-fade-top: 36px; }
    94%  { --nav-fade-bot: 36px; }
    100% { --nav-fade-top: 36px; --nav-fade-bot: 0px; }
  }
}
.nav a:hover { background: var(--sidebar-accent); text-decoration: none; color: #fff; }
.nav a.active {
  background: rgba(176,122,43,.16); color: #fff; font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brass);
}
.nav a .ic { width: 18px; height: 18px; opacity: .8; }
.nav a.active .ic { opacity: 1; color: var(--brass); }
.nav a .count {
  margin-left: auto; font-size: .72rem; font-variant-numeric: tabular-nums;
  background: rgba(255,255,255,.14); color: #dfe8f1; padding: .05rem .45rem; border-radius: var(--radius-pill);
}
.nav a.active .count { background: rgba(0,0,0,.28); color: #fff; }
/* Standalone footer link (Platform console). Deliberately NOT class="nav": that
   class is the scroll container (overflow-y:auto), and as a compressed flex item
   it would sprout its own scrollbar. flex-shrink:0 keeps it a fixed row. */
.nav-admin {
  display: flex; align-items: center; gap: .55rem; flex-shrink: 0;
  margin: .35rem .6rem 0; padding: .5rem .65rem; border-radius: var(--radius-sm);
  color: #cfe0d7; font-size: .85rem; transition: background .12s, color .12s;
}
.nav-admin .ic, .console-tag .ic { width: 16px; height: 16px; }
.nav-admin:hover { background: var(--sidebar-accent); color: #fff; text-decoration: none; }
.sidebar .spacer { flex: 1; }
.who {
  padding: .7rem 1.1rem 0; border-top: 1px solid var(--sidebar-border);
  margin: .7rem .6rem 0; font-size: .8rem; color: #97abbf;
}
.who b { color: #fff; display: block; margin-bottom: .05rem; }
.side-attribution { padding: .55rem 1.1rem .8rem; margin: 0 .6rem; font-size: .68rem; color: #6d8095; letter-spacing: .01em; }

/* ---------- Main column ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1.6rem; background: rgba(255,255,255,.85);
  backdrop-filter: saturate(1.4) blur(6px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.crumbs { color: var(--ink-faint); font-size: .85rem; }
.crumbs a { color: var(--ink-soft); }
/* Mobile menu button (hidden on desktop) and the drawer backdrop. */
.nav-toggle {
  display: none; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; padding: 0;
}
.nav-toggle:hover { background: var(--surface-2); }
.nav-toggle-ic, .nav-toggle-ic::before, .nav-toggle-ic::after {
  display: block; width: 16px; height: 2px; border-radius: 1px; background: currentColor;
}
.nav-toggle-ic { position: relative; }
.nav-toggle-ic::before, .nav-toggle-ic::after { content: ""; position: absolute; left: 0; }
.nav-toggle-ic::before { top: -5px; }
.nav-toggle-ic::after { top: 5px; }
.nav-backdrop { display: none; }
.topbar .theme-toggle { margin-left: auto; }
.topbar .theme-toggle ~ .theme-toggle, .topbar .op-badge ~ .theme-toggle { margin-left: 0; }

.content { padding: 1.6rem 1.9rem 3rem; max-width: 1680px; width: 100%; animation: rc-rise .28s ease both; }
@keyframes rc-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.35rem; }
.page-head .titles { flex: 1; min-width: 0; }
.page-head h1 { margin-bottom: .2rem; }
.page-head .sub { color: var(--ink-soft); font-size: .9rem; max-width: 68ch; }
.page-head .actions { display: flex; align-items: center; gap: .55rem; flex: none; flex-wrap: wrap; }

/* Stencilled eyebrow — a section label that reads like equipment lettering */
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .68rem; font-weight: 700; letter-spacing: var(--tracking-caps);
  text-transform: uppercase; color: var(--ink-faint);
}
.eyebrow::before { content: ""; width: 14px; height: 2px; background: var(--brass); border-radius: 2px; }

/* ============================================================================
   BUTTONS & INPUTS
   ============================================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; cursor: pointer;
  font: inherit; font-size: .88rem; font-weight: 600; line-height: 1.1;
  padding: .52rem .95rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: background .12s, border-color .12s, box-shadow .12s, transform .04s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--steel); border-color: var(--steel); color: #fff; }
.btn.primary:hover { background: var(--steel-700); border-color: var(--steel-700); }
.btn.brass { background: var(--brass-fill); border-color: var(--brass-fill); color: var(--brass-ink); }
.btn.brass:hover { background: var(--brass-fill-hover); border-color: var(--brass-fill-hover); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--ink-soft); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.sm { padding: .34rem .62rem; font-size: .8rem; }
.btn.danger { color: var(--over); border-color: #e6c6c3; }
.btn.danger:hover { background: var(--over-bg); border-color: var(--over); }

label.field { display: block; margin-bottom: 1rem; }
label.field > span { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .32rem; }
label.field .hint { font-weight: 400; color: var(--ink-faint); }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=search], input[type=tel], input[type=url], select, textarea {
  width: 100%; font: inherit; font-size: .9rem; color: var(--ink);
  padding: .5rem .62rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:hover, select:hover, textarea:hover { border-color: #c2cbd5; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--steel); box-shadow: var(--ring);
}
textarea { min-height: 72px; resize: vertical; }
/* Read only: shown, not editable (a field your role can't change). */
input[readonly], input[readonly]:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink-soft); cursor: default; }
.inline-fields { display: flex; gap: .5rem; }
.inline-fields > * { flex: 1; }

/* inspection form item layout: checklist rows span the card; scalar fields flow
   in a compact two-up grid; long-text items take the full row */
.insp-items { display: flex; flex-wrap: wrap; gap: 0 1.4rem; }
.insp-items .checkrow { flex: 1 1 100%; }
.insp-items label.field { flex: 1 1 300px; max-width: 430px; margin: .7rem 0 .4rem; }
.insp-items label.field.wide { flex: 1 1 100%; max-width: none; }
.insp-items textarea { min-height: 58px; }

/* ============================================================================
   CARDS & GRID
   ============================================================================ */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card .card-head {
  display: flex; align-items: center; gap: .6rem;
  padding: .85rem 1.15rem; border-bottom: 1px solid var(--line-soft);
}
.card .card-head h2, .card .card-head h3 { margin: 0; font-size: 1.02rem; }
.card .card-head .actions { margin-left: auto; display: flex; gap: .4rem; }
.card .card-body { padding: 1.15rem; }
.card .card-foot {
  padding: .7rem 1.15rem; border-top: 1px solid var(--line-soft);
  background: var(--surface-2); font-size: .85rem; color: var(--ink-soft);
}
a.card { color: inherit; }
a.card:hover { text-decoration: none; border-color: color-mix(in srgb, var(--steel) 40%, var(--line)); box-shadow: var(--shadow); }

.grid { display: grid; gap: 1.15rem; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.sidebar-right { grid-template-columns: 1fr 360px; align-items: start; }
/* Grid items default to min-width:auto, so one wide table (even inside a
   .scroll wrapper) would stretch its column past the viewport on phones. */
.grid.sidebar-right > * { min-width: 0; }
@media (max-width: 980px) { .grid.cols-3, .grid.cols-4, .grid.cols-2, .grid.sidebar-right { grid-template-columns: 1fr; } }

.checkgrid { display: grid; grid-template-columns: 1fr; column-gap: 2rem; }
@media (min-width: 1100px) { .checkgrid { grid-template-columns: 1fr 1fr; } }

@media (min-width: 1600px) {
  .app { grid-template-columns: 268px 1fr; }
  .content { padding: 1.9rem 2.6rem 3.5rem; }
  .grid { gap: 1.4rem; }
  .grid.sidebar-right { grid-template-columns: 1fr 400px; }
}
@media (min-width: 2000px) { .content { max-width: 1880px; } }

/* ============================================================================
   STAT TILES
   ============================================================================ */
.stat { padding: 1.05rem 1.15rem; }
.stat .label { color: var(--ink-faint); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.stat .value { font-size: 2rem; font-weight: 700; line-height: 1.05; margin: .3rem 0 .15rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .value.over { color: var(--over); }
.stat .value.due { color: var(--due); }
.stat .value.ok { color: var(--ok); }
.stat .foot { font-size: .8rem; color: var(--ink-faint); }

/* ============================================================================
   SIGNAL-ASPECT PILLS / BADGES
   The lamp dot glows a hair — this is the app's status vocabulary.
   ============================================================================ */
.badge {
  display: inline-flex; align-items: center; gap: .38rem;
  font-size: .72rem; font-weight: 650; padding: .16rem .55rem; border-radius: var(--radius-pill);
  border: 1px solid transparent; white-space: nowrap; line-height: 1.35;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); flex: none; }
.badge.ok   { color: var(--ok);   background: var(--ok-bg);   border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.badge.due  { color: var(--due);  background: var(--due-bg);  border-color: color-mix(in srgb, var(--due) 26%, transparent); }
.badge.over { color: var(--over); background: var(--over-bg); border-color: color-mix(in srgb, var(--over) 24%, transparent); }
.badge.info { color: var(--info); background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 20%, transparent); }
.badge.muted{ color: var(--ink-soft); background: var(--surface-2); border-color: var(--line); }
.badge.steam { color: #8a3d12; background: #f6e6d6; border-color: #e6c6a8; }   /* steam = 49 CFR 230 */
.badge.diesel{ color: #2c5578; background: var(--info-bg); border-color: #c3d5e6; } /* diesel = 49 CFR 229 */

/* ============================================================================
   TABLES — dense, legible, tabular
   ============================================================================ */
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.tbl th {
  text-align: left; font-size: .66rem; text-transform: uppercase; letter-spacing: var(--tracking-caps);
  color: var(--ink-faint); font-weight: 700; padding: .6rem .85rem; border-bottom: 1px solid var(--line);
  background: var(--surface-2); position: sticky; top: 0;
}
.card table.tbl th { background: var(--surface-2); }
table.tbl td { padding: .62rem .85rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: background .1s; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* A row that is past due: the danger tint holds under hover too. */
table.tbl tr.row-over, table.tbl tbody tr.row-over:hover { background: var(--over-bg); }
/* The line whose correction form is open below the table. */
table.tbl tr.row-editing, table.tbl tbody tr.row-editing:hover, table.tbl.stack tbody tr.row-editing:hover {
  background: color-mix(in srgb, var(--brass) 12%, transparent); box-shadow: inset 3px 0 0 var(--brass); }
.hint.block { display: block; margin-top: .15rem; }
/* A banner led by an icon: the text wraps beside the icon, not under it. */
.note.lock-note { flex-wrap: nowrap; align-items: flex-start; }
.note.lock-note > .ic { flex: none; width: 16px; height: 16px; margin-top: .1rem; }
.over-text { color: var(--over); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.filed-form { display: inline-flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: 0; }
.filed-form input[type=date] { width: 9.5rem; }
.filed-form select { width: auto; }
.filing-note { max-width: 440px; }
.loco-id { font-family: var(--mono); font-weight: 600; letter-spacing: -.01em; }
.muted { color: var(--ink-faint); }
.right { text-align: right; }

/* ============================================================================
   TIMELINE (inspection / maintenance history)
   ============================================================================ */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1.1rem 1.45rem; border-left: 2px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: .2rem;
  width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--steel);
}
.timeline li.over::before { border-color: var(--over); }
.timeline li.alter::before { border-color: var(--brass); background: var(--brass); }
.timeline .when { font-size: .78rem; color: var(--ink-faint); }
.timeline .what { font-weight: 600; }

/* ---------- Spec sheet ---------- */
dl.spec { display: grid; grid-template-columns: max-content 1fr; gap: .55rem 1.3rem; margin: 0; }
dl.spec dt { color: var(--ink-faint); font-size: .82rem; }
dl.spec dd { margin: 0; font-weight: 550; font-variant-numeric: tabular-nums; }

/* ============================================================================
   RENDERED INSPECTION FORMS (from jsonb template)
   ============================================================================ */
.form-section { margin-bottom: 1.5rem; }
.form-section > h3 { padding-bottom: .45rem; border-bottom: 2px solid var(--line); display: flex; align-items: baseline; gap: .5rem; }
.form-section > h3 .cite { font-size: .7rem; font-weight: 600; color: var(--ink-faint); margin-left: auto; font-family: var(--mono); }
.checkrow { display: flex; align-items: center; gap: .8rem; padding: .55rem .25rem; border-bottom: 1px solid var(--line-soft); }
.checkrow .q { flex: 1; }
.checkrow .opts { display: flex; gap: .25rem; flex: none; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.seg label { padding: .3rem .62rem; font-size: .78rem; cursor: pointer; border-right: 1px solid var(--line); background: var(--surface); transition: background .1s; }
.seg label:last-child { border-right: none; }
.seg label:hover { background: var(--surface-2); }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg label:has(input:checked) { color: #fff; font-weight: 600; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--steel); outline-offset: -2px; }
.seg label.g:has(input:checked) { background: var(--ok); }
.seg label.f:has(input:checked) { background: var(--due); }
.seg label.p:has(input:checked) { background: var(--over); }
.seg label.na:has(input:checked) { background: var(--ink-faint); }
.seg label.c:has(input:checked) { background: var(--steel); }
[data-theme=dark] .seg label.c:has(input:checked) { background: #2c5578; }
/* multi_select checkboxes on an inspection form (ADR-038) */
.opt-field { flex: 1 1 100%; border: 0; padding: 0; margin: .7rem 0 .4rem; min-width: 0; }
.opt-field legend { font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .4rem; padding: 0; }
.opt-grid { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; }
.opt-grid label { display: inline-flex; align-items: center; gap: .4rem; font-size: .88rem; }
.opt-grid input { width: auto; margin: 0; }

/* ============================================================================
   REGULATION READER + HELP PROSE (ADR-002)
   ============================================================================ */
.reg-layout { display: grid; grid-template-columns: 280px 1fr; gap: 1.4rem; align-items: start; }
@media (max-width: 900px){ .reg-layout { grid-template-columns: 1fr; } }
.reg-toc { font-size: .85rem; position: sticky; top: 84px; }
.reg-toc a { display: block; padding: .32rem .55rem; border-radius: var(--radius-sm); color: var(--ink-soft); }
.reg-toc a:hover { background: var(--surface-2); text-decoration: none; }
.reg-toc a.active { background: var(--steel-50); color: var(--steel); font-weight: 600; box-shadow: inset 2px 0 0 var(--brass); }
.reg-toc .lvl2 { padding-left: 1.2rem; font-size: .82rem; }
.reg-body { font-size: .95rem; line-height: 1.7; max-width: 74ch; }
.reg-body h2 { margin-top: 0; }
.note.row .ic { width:16px; height:16px; }
.reg-body .cite-bar {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  font-size: .8rem; color: var(--ink-soft); margin-bottom: 1rem; font-family: var(--mono);
  padding-bottom: .8rem; border-bottom: 1px solid var(--line);
}
.reg-body p { margin-bottom: 1rem; }
.reg-body .para-num { font-weight: 700; color: var(--brass-600); font-family: var(--mono); }

.reg-prose { line-height: 1.65; }
.reg-prose p { margin: 0 0 .9rem; }
.reg-prose h3 { margin: 1.4rem 0 .5rem; font-size: 1.04rem; }
.reg-prose ul { margin: .35rem 0 .95rem; padding-left: 1.2rem; }
.reg-prose li { margin: .28rem 0; }
.reg-prose a { color: var(--steel); }
.reg-snippet mark, .reg-prose mark { background: var(--due-bg); color: var(--due); padding: 0 .18em; border-radius: 3px; }

/* ============================================================================
   LOGIN / AUTH  — steel cab wall, a single brass-lit card
   ============================================================================ */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background:
    radial-gradient(1100px 620px at 72% -12%, rgba(176,122,43,.16), transparent 58%),
    linear-gradient(168deg, var(--steel-800), var(--steel-900) 70%);
  position: relative;
}
/* faint blueprint tick line across the base — restraint: one atmospheric touch */
.auth-wrap::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 1px, transparent 1px 40px);
}
.auth-card {
  position: relative; width: 100%; max-width: 408px; background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden;
  border-top: 3px solid var(--brass);
}
.auth-card .head { padding: 1.7rem 1.75rem .4rem; }
.auth-card .head .brand { padding: 0; border: none; margin-bottom: 1.1rem; }
.auth-card .head .brand .mark { color: var(--steel); }
.auth-card .body { padding: .6rem 1.75rem 1.75rem; }
.auth-card .foot {
  padding: 1rem 1.75rem; background: var(--surface-2); border-top: 1px solid var(--line);
  font-size: .8rem; color: var(--ink-faint); text-align: center;
}
.auth-card .foot a { color: var(--ink-soft); }

/* ============================================================================
   MISC COMPONENTS
   ============================================================================ */
.note { background: var(--brass-50); border: 1px solid #ecd9b6; border-radius: var(--radius-sm); padding: .75rem .95rem; font-size: .85rem; color: #6b531f; }
.note.proto { background: var(--info-bg); border-color: #c5dcef; color: #214e72; }
.bridge { border: 1px dashed var(--brass); background: var(--brass-50); border-radius: var(--radius-sm); padding: .85rem 1rem; font-size: .87rem; }
.kv-inline { display: flex; gap: 1.4rem; flex-wrap: wrap; font-size: .85rem; }
.kv-inline div { display: flex; flex-direction: column; }
.kv-inline span { color: var(--ink-faint); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.kv-inline b { font-variant-numeric: tabular-nums; }
.progress { height: 8px; background: var(--line-soft); border-radius: var(--radius-pill); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--steel), var(--brass)); border-radius: inherit; }
hr.soft { border: none; border-top: 1px solid var(--line-soft); margin: 1.15rem 0; }
.tag-row { display: flex; gap: .4rem; flex-wrap: wrap; }
summary { cursor: pointer; }
summary::-webkit-details-marker { display: none; }
summary::marker { content: ""; }
.nav-pop:hover { background: var(--surface-2); text-decoration: none; }

/* Empty states — an empty screen is an invitation to act */
.empty { text-align: center; padding: 2.4rem 1.5rem; color: var(--ink-faint); }
.empty .empty-mark { width: 40px; height: 40px; margin: 0 auto .7rem; opacity: .5; color: var(--steel); }
.empty h3 { color: var(--ink-soft); }

/* ============================================================================
   PLATFORM (back-office) console — distinct slate/violet theme, unchanged intent
   ============================================================================ */
.sidebar.platform { background: #171c29; }
.sidebar.platform .brand { border-color: rgba(255,255,255,.08); }
.sidebar.platform .brand .mark { color: #aeb9f5; }
.sidebar.platform .brand b { color: #fff; }
.sidebar.platform .brand small { color: #8f9bd4; }
.sidebar.platform .nav a { color: #c3cae6; box-shadow: none; }
.sidebar.platform .nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar.platform .nav a.active { background: rgba(124,140,240,.2); color: #fff; box-shadow: inset 3px 0 0 #7c8cf0; }
.sidebar.platform .nav a.active .ic { color: #aeb9f5; }
.sidebar.platform .nav a.active .count { background: rgba(0,0,0,.28); }
.sidebar.platform .nav .group { color: #7e8ab8; }
.sidebar.platform .who { color: #aab2d6; border-color: rgba(255,255,255,.08); }
.sidebar.platform .who b { color: #fff; }
.console-tag {
  margin: .9rem 1rem; padding: .55rem .72rem; border-radius: var(--radius-sm);
  background: rgba(124,140,240,.16); border: 1px solid rgba(124,140,240,.32);
  color: #cdd4f2; font-size: .76rem; display: flex; align-items: center; gap: .4rem;
}
.exit-link { display: block; margin: .5rem 1rem 0; padding: .48rem .62rem; border-radius: var(--radius-sm); color: #8f9bd4; font-size: .82rem; }
.exit-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.badge.violet { color: #4a57b8; background: #e7e9fb; border-color: #c9cef4; }
.badge.plat { color: #fff; background: #6c7bd6; }
.switchy { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; color: var(--ink-soft); cursor: pointer; }

/* ============================================================================
   EQUIPMENT PHOTOS & GALLERY
   ============================================================================ */
.equip-photo { width:100%; max-width:340px; aspect-ratio:4/3; object-fit:cover; border-radius:var(--radius); border:1px solid var(--line); display:block; }
.equip-ph { width:100%; max-width:340px; aspect-ratio:4/3; border-radius:var(--radius); border:1px dashed var(--line); display:grid; place-items:center; color:var(--ink-faint); background:var(--surface-2); font-size:.85rem; }
.equip-thumb { width:72px; height:44px; object-fit:cover; border-radius:var(--radius-sm); border:1px solid var(--line); vertical-align:middle; margin-right:.55rem; }
.equip-thumb-ph { width:72px; height:44px; border-radius:var(--radius-sm); background:var(--surface-2); color:var(--ink-faint); display:inline-grid; place-items:center; vertical-align:middle; margin-right:.55rem; }
.equip-thumb-ph .eq-thumb { width: 62px; height: auto; max-height: 34px; overflow: hidden; color: var(--ink-soft); }
/* Equipment drawings (partials/equipment.html): side elevations 28 units tall
   and as long as the subject, in currentColor. --eq-h sets the height. */
.eq-art { display: block; flex: none; height: var(--eq-h, 56px); width: auto; overflow: visible; }
.eq-rail { stroke-width: .7; opacity: .3; }
.eq-fine { stroke-width: .5; opacity: .8; }
.eq-wire { stroke-width: .6; opacity: .5; }
.eq-solid { fill: currentColor; stroke: none; }
/* a run's train: its consist drawn end to end, head end at the right */
.train-strip { display: flex; align-items: flex-end; overflow-x: auto; padding: 1rem 1.15rem .8rem; scrollbar-width: thin; --eq-h: 40px; }
.train-unit { flex: none; display: flex; flex-direction: column; align-items: center; gap: .3rem; color: var(--ink); text-decoration: none; }
.train-unit span { font-family: var(--mono); font-size: .68rem; color: var(--ink-faint); white-space: nowrap; }
.train-unit:hover { color: var(--steel); text-decoration: none; }
.train-unit:hover span { color: var(--steel); }
.badge.attach { margin-top:.6rem; }
.badge .ic { width:12px; height:12px; }

.gallery-upload { display:flex; flex-wrap:wrap; align-items:end; gap:.6rem; margin-bottom:1rem; }
.gallery-help { flex:1; min-width:200px; font-size:.8rem; }
.gallery-check { flex-basis:100%; font-size:.82rem; color:var(--ink-soft); }
.gallery-check:empty { display:none; }
.gallery-check.bad { color:var(--over); font-weight:600; }
.gallery { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:.9rem; }
.gtile { border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; background:var(--surface); position:relative; display:flex; flex-direction:column; box-shadow:var(--shadow-sm); }
.gtile.cover { border-color:var(--brass); box-shadow:0 0 0 2px var(--brass-50); }
.gimg { width:100%; aspect-ratio:4/3; object-fit:cover; display:block; }
.gbadge { position:absolute; top:8px; left:8px; background:var(--brass-fill); color:var(--brass-ink); font-size:.68rem; font-weight:700; padding:.1rem .5rem; border-radius:var(--radius-pill); }
.gmeta { padding:.55rem .65rem .35rem; }
.gcap { font-size:.82rem; font-weight:600; line-height:1.2; }
.gsub { font-size:.74rem; color:var(--ink-faint); margin-top:.15rem; }
.gedit { padding:.2rem .65rem .65rem; margin-top:auto; }
.gedit > summary { list-style:none; cursor:pointer; width:100%; justify-content:center; }
.gedit > summary::-webkit-details-marker { display:none; }
.gedit input, .gedit select { width:100%; }

/* Photos at scale (ADR-042): the photo-space meter, folders, moving, kept
   originals and album links. */
.pmeter { border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface-2); padding:.65rem .8rem; margin-bottom:1rem; }
.pmeter-head { display:flex; flex-wrap:wrap; justify-content:space-between; gap:.2rem 1rem; font-size:.85rem; }
.pmeter-figure { font-variant-numeric:tabular-nums; color:var(--ink-soft); }
.pmeter-bar { height:8px; border-radius:var(--radius-pill); background:var(--line-soft); overflow:hidden; margin:.45rem 0 .4rem; border:1px solid var(--line); }
.pmeter-bar > span { display:block; height:100%; background:var(--ok); border-radius:inherit; }
.pmeter.due .pmeter-bar > span { background:var(--due); }
.pmeter.over .pmeter-bar > span { background:var(--over); }
.pmeter.over { border-color:color-mix(in srgb, var(--over) 35%, var(--line)); }
.pmeter-sub { font-size:.78rem; color:var(--ink-faint); margin-top:.15rem; overflow-wrap:anywhere; }
.gallery-upload .gu-file { min-width:0; max-width:100%; }
.gallery-upload .gu-file input { max-width:100%; font:inherit; font-size:.85rem; color:var(--ink-soft); padding:.3rem .45rem; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface); }
.gallery-upload .gu-folder select { min-width:9rem; max-width:100%; }
.gallery-upload .gu-keep { display:inline-flex; align-items:center; gap:.4rem; font-size:.85rem; font-weight:600; padding-bottom:.35rem; white-space:nowrap; }
.gallery-upload .gu-keep input { width:auto; margin:0; }
.gallery-upload .gallery-help { flex-basis:100%; }
#photos > .card-head { flex-wrap:wrap; row-gap:.4rem; }
#photos > .card-head .actions { flex-wrap:wrap; }
#photos > .card-head .btn { white-space:nowrap; }
.pfolders { display:flex; flex-wrap:wrap; align-items:center; gap:.4rem; margin-bottom:.7rem; }
.pchip { display:inline-flex; align-items:center; gap:.35rem; padding:.28rem .7rem; border:1px solid var(--line); border-radius:var(--radius-pill); background:var(--surface); color:var(--ink-soft); font-size:.8rem; text-decoration:none; max-width:100%; }
.pchip:hover { border-color:var(--steel); color:var(--ink); }
.pchip.on { background:var(--steel); border-color:var(--steel); color:#fff; }
[data-theme=dark] .pchip.on { background:#2c5578; border-color:#2c5578; }
.pchip-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:16rem; }
.pchip-n { font-variant-numeric:tabular-nums; font-size:.72rem; opacity:.8; }
.pfolder-new > summary { list-style:none; cursor:pointer; }
.pfolder-new > summary::-webkit-details-marker { display:none; }
.pfolder-new[open] { flex-basis:100%; }
.pinline { display:flex; flex-wrap:wrap; align-items:center; gap:.4rem; font-size:.82rem; margin:0; }
.pinline input, .pinline select { min-width:0; flex:1 1 10rem; max-width:22rem; }
.pfolder-new .pinline { margin-top:.4rem; }
.pfolder-tools { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem .8rem; padding:.55rem .7rem; border:1px dashed var(--line); border-radius:var(--radius-sm); margin-bottom:.8rem; }
.pfolder-tools form { margin:0; }
.pwo-filter { display:flex; flex-wrap:wrap; align-items:end; gap:.5rem; margin-bottom:.8rem; }
.pwo-filter select { max-width:100%; min-width:12rem; }
.pwo-filter .field { flex:0 1 30rem; min-width:0; max-width:100%; }
.pmove { position:sticky; top:64px; z-index:3; display:flex; flex-wrap:wrap; align-items:center; gap:.5rem .7rem; padding:.5rem .7rem; margin-bottom:.8rem; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface); box-shadow:var(--shadow-sm); font-size:.82rem; }
.pmove-count { font-variant-numeric:tabular-nums; color:var(--ink-soft); }
.pmove .pinline { flex-wrap:nowrap; white-space:nowrap; }
.pmove .pinline select { flex:0 1 13rem; width:auto; min-width:8rem; }
.gpick { position:absolute; top:6px; right:6px; z-index:2; display:grid; place-items:center; width:30px; height:30px; border-radius:var(--radius-sm); background:color-mix(in srgb, var(--surface) 88%, transparent); border:1px solid var(--line); cursor:pointer; }
.gpick input { width:18px; height:18px; margin:0; cursor:pointer; }
.gtile.picked { border-color:var(--steel); box-shadow:var(--ring); }
.gsize { font-variant-numeric:tabular-nums; }
.gorig { display:inline-block; margin-top:.35rem; font-size:.76rem; font-weight:600; }
.gedit-form { margin-top:.4rem; display:grid; gap:.35rem; }
.gedit-label { font-size:.72rem; }
.gedit-actions { display:flex; gap:.35rem; margin-top:.35rem; }
.gedit-actions form { flex:1; margin:0; }
.palbums { margin-top:1.2rem; padding-top:.9rem; border-top:1px solid var(--line-soft); }
.palbums h4 { margin:0 0 .5rem; font-size:.9rem; }
.palbum-list { list-style:none; margin:0 0 .7rem; padding:0; display:grid; gap:.35rem; }
.palbum-list li { display:flex; flex-wrap:wrap; align-items:center; gap:.2rem .6rem; font-size:.86rem; overflow-wrap:anywhere; }
.palbum-list a { font-weight:600; }
.palbum-del { margin:0 0 0 auto; }
.palbum-add { display:flex; flex-wrap:wrap; align-items:end; gap:.5rem; margin-bottom:.5rem; }
.palbum-add .field { flex:1 1 14rem; min-width:0; }
.palbum-add .field input { width:100%; }
.pstore-list { list-style:none; margin:0; padding:0; display:grid; gap:.4rem; font-size:.85rem; }
.pstore-list li { display:grid; grid-template-columns:minmax(5rem,9rem) 1fr auto; align-items:center; gap:.6rem; }
.pstore-bar { height:6px; border-radius:var(--radius-pill); background:var(--line-soft); overflow:hidden; }
.pstore-bar > span { display:block; height:100%; background:var(--ok); }
.pstore-bar.due > span { background:var(--due); }
.pstore-bar.over > span { background:var(--over); }
@media (max-width: 560px) {
  .gallery { grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:.6rem; }
  .pmove { top:56px; }
  .pstore-list li { grid-template-columns:1fr auto; }
  .pstore-list .pstore-bar { grid-column:1 / -1; grid-row:2; }
}

/* ============================================================================
   DETAIL-PAGE TABS
   ============================================================================ */
.tabbar { display:flex; gap:.15rem; border-bottom:1px solid var(--line); margin:0 0 1.3rem; flex-wrap:wrap; }
.tabbar .tab { background:none; border:none; border-bottom:2px solid transparent; margin-bottom:-1px; padding:.58rem .72rem; font:inherit; font-size:.9rem; color:var(--ink-soft); cursor:pointer; border-radius:var(--radius-sm) var(--radius-sm) 0 0; display:inline-flex; align-items:center; gap:.4rem; transition:background .1s,color .1s; }
.tabbar .tab:hover { background:var(--surface-2); color:var(--ink); }
.tabbar .tab.active { color:var(--steel); border-bottom-color:var(--brass); font-weight:600; }
.tabn { background:var(--surface-2); color:var(--ink-soft); font-size:.72rem; font-weight:600; padding:0 .42rem; border-radius:var(--radius-pill); font-variant-numeric:tabular-nums; }
.tabn.over { background:var(--over-bg); color:var(--over); }
.tabn.due { background:var(--due-bg); color:var(--due); }
.tabbar .tab.active .tabn { background:var(--steel); color:#fff; }
/* On phones the tab row scrolls sideways instead of wrapping into a stack. */
@media (max-width: 760px) {
  .tabbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
  .tabbar .tab { flex: none; white-space: nowrap; }
}
.tab-panel { display:none; }
.tab-panel.show { display:block; }

/* ============================================================================
   RESPONSIVE — collapse the shell to a stacked mobile layout
   ============================================================================ */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  /* The sidebar is a drawer: off-canvas until the menu button opens it. */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100dvh; width: min(300px, 86vw);
    transform: translateX(-102%); transition: transform .2s ease-out;
    z-index: 30; overflow-y: auto; box-shadow: var(--shadow-lg);
  }
  .app.nav-open .sidebar { transform: none; }
  .sidebar .nav { overflow: visible; flex: none; }
  .nav-backdrop { position: fixed; inset: 0; z-index: 25; background: rgba(10,18,26,.5); }
  .app.nav-open .nav-backdrop { display: block; }
  body.nav-lock { overflow: hidden; }
  .nav-toggle { display: inline-flex; }
  .sidebar .spacer { min-height: 1rem; }
  .topbar { padding-inline: 1rem; flex-wrap: wrap; gap: .6rem; }
  .content { padding: 1.1rem 1rem 2.5rem; }
  .page-head { flex-direction: column; gap: .6rem; }
  table.tbl { font-size: .84rem; }
  table.tbl th, table.tbl td { padding: .5rem .55rem; }
  /* Tables with four or more columns keep a readable width and scroll inside
     their card; narrower key/value tables stay fluid. */
  .card:has(table.tbl) {
    overflow-x: auto;
    /* Scrolling shadows (the covers scroll with the content, the shadows do
       not), so a table with more columns than the phone shows says so. */
    background:
      linear-gradient(to right, var(--surface) 40%, transparent) left / 36px 100% no-repeat local,
      linear-gradient(to left, var(--surface) 40%, transparent) right / 36px 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, rgba(16,32,48,.22), transparent) left / 12px 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, rgba(16,32,48,.22), transparent) right / 12px 100% no-repeat scroll,
      var(--surface);
  }
  table.tbl:has(thead th:nth-child(4)) { min-width: 620px; }
  table.tbl:has(thead th:nth-child(6)) { min-width: 760px; }
}

/* ============================================================================
   STACKED TABLES (table.tbl.stack) — a normal table from 761px up; on phones
   each row becomes a card: the key cell (.c-key) and status (.c-flag) on top,
   the row's title (.c-wide) full width, every data-label cell in a labelled
   two-column grid, and the row's actions (.c-act) along the bottom. Markup
   carries explicit table roles so assistive tech keeps the table semantics
   when the display changes.
   ============================================================================ */
@media (max-width: 760px) {
  table.tbl.stack { min-width: 0 !important; font-size: .88rem; }
  table.tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td { display: block; }
  .tbl.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .card:has(table.tbl.stack) { overflow: hidden; background: var(--surface); }
  .card:has(table.tbl.stack) .scroll { overflow: visible; }
  .tbl.stack tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .55rem 1rem;
    padding: .9rem 1rem; border-bottom: 1px solid var(--line-soft);
  }
  .tbl.stack tbody tr:last-child { border-bottom: none; }
  .tbl.stack tbody tr:hover { background: none; }
  .tbl.stack tbody tr.row-over, .tbl.stack tbody tr.row-over:hover { background: var(--over-bg); }
  table.tbl.stack td { padding: 0; border: none; text-align: left; min-width: 0; }
  .tbl.stack td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: .1rem;
    font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps);
    color: var(--ink-faint); font-family: var(--sans);
  }
  .tbl.stack td.c-key  { order: 0; align-self: center; font-size: .95rem; }
  .tbl.stack td.c-flag { order: 1; justify-self: end; align-self: center; }
  .tbl.stack td.c-wide { order: 2; grid-column: 1 / -1; font-weight: 600; }
  .tbl.stack td.c-wide .sub-cell, .tbl.stack td.c-wide .hint { font-weight: 400; }
  .tbl.stack td.c-wide .hint { display: block; margin-top: .2rem; font-size: .8rem; color: var(--ink-faint); line-height: 1.45; }
  .tbl.stack td.c-act > .btn.ghost:first-child { margin-left: -.62rem; } /* text lines up with the card edge */
  .tbl.stack td[data-label] { order: 3; }
  .tbl.stack td.c-act  { order: 4; grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .45rem;
    white-space: normal; padding-top: .2rem; }
  .tbl.stack td.c-act:empty { display: none; }
  .tbl.stack .filed-form { display: flex; width: 100%; }
  .tbl.stack .filed-form input[type=date], .tbl.stack .filed-form select { flex: 1 1 8.5rem; width: auto; }
  .tbl.stack .filing-note { max-width: none; }
}

/* ============================================================================
   MOTION PREFERENCES
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .content { animation: none; }
  .sidebar { transition: none; }
  .sidebar .nav { animation-duration: auto !important; } /* scroll-driven, not timed */
}

/* ============================================================================
   MARKETING SITE (public landing + pricing). Prefix .mk-. Steel/brass identity.
   ============================================================================ */
.mk { background: var(--surface); color: var(--ink); }
.mk a { color: var(--steel); }
.mk-wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* --- legal pages (terms, privacy) — long-form prose, measured for reading --- */
.mk-legal-head { background: var(--steel-900); color: #fff; padding: 46px 0 40px; }
.mk-legal-head h1 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); line-height: 1.1; letter-spacing: -.02em; margin: 0 0 10px; color: #fff; }
.mk-legal-head .lede { color: #9fb1c2; font-size: .95rem; margin: 0; }
.mk-legal { padding: 46px 0 64px; }
.mk-legal .mk-wrap { max-width: 760px; }
.mk-legal h2 { font-size: 1.12rem; letter-spacing: -.01em; margin: 2.1rem 0 .55rem; padding-top: 1.5rem;
  border-top: 1px solid var(--line-soft); color: var(--ink); }
.mk-legal h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 1.6rem; }
.mk-legal p { color: var(--ink-soft); line-height: 1.72; margin: 0 0 .95rem; }
.mk-legal a { color: var(--steel); text-decoration: underline; text-underline-offset: 2px; }
.mk-legal .mk-lead { font-size: 1.06rem; color: var(--ink); line-height: 1.68; }
.mk-legal-caps { font-size: .84rem; letter-spacing: .01em; color: var(--ink-faint); }
.mk-legal-foot { margin-top: 2.4rem; padding-top: 1.3rem; border-top: 1px solid var(--line-soft); font-size: .9rem; }
.mk-callout { background: var(--brass-50); border: 1px solid color-mix(in srgb, var(--brass) 45%, transparent); border-radius: var(--radius-sm);
  padding: 1.05rem 1.25rem; margin: 1.2rem 0 1.6rem; }
.mk-callout p { color: var(--ink); margin-bottom: .7rem; }
.mk-callout p:last-child { margin-bottom: 0; }
.mk-legal-table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: .9rem; }
.mk-legal-table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-faint); border-bottom: 2px solid var(--line); padding: 0 .8rem .5rem 0; font-weight: 700; }
.mk-legal-table td { border-bottom: 1px solid var(--line-soft); padding: .65rem .8rem .65rem 0;
  color: var(--ink-soft); line-height: 1.55; vertical-align: top; }
.mk-legal-table tr:last-child td { border-bottom: 0; }

/* --- top nav --- */
.mk-nav { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.9);
  backdrop-filter: saturate(1.2) blur(8px); border-bottom: 1px solid var(--line-soft); }
.mk-nav .mk-wrap { display: flex; align-items: center; gap: 20px; height: 64px; }
.mk-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink); letter-spacing: -.01em; }
.mk-brand .mark { width: 40px; height: 20px; color: var(--steel); }
.mk-brand .hub { fill: var(--brass); }
.mk-nav .links { display: flex; align-items: center; gap: 26px; margin-left: auto; }
.mk-nav .links a:not(.mk-btn) { color: var(--ink-soft); font-size: .92rem; font-weight: 600; text-decoration: none; }
.mk-nav .links a:not(.mk-btn):hover { color: var(--steel); }
.mk-btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 10px; padding: .62rem 1.05rem;
  font-weight: 700; font-size: .92rem; text-decoration: none; border: 1px solid transparent; transition: transform .08s, background .12s, box-shadow .12s; }
.mk-btn:active { transform: translateY(1px); }
.mk-btn.primary { background: var(--steel); color: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.mk-btn.primary:hover { background: var(--steel-700); }
.mk-btn.brass { background: var(--brass-fill); color: var(--brass-ink); }
.mk-btn.brass:hover { background: var(--brass-fill-hover); }
.mk-btn.ghost { border-color: var(--line); color: var(--ink); background: #fff; }
.mk-btn.ghost:hover { border-color: var(--steel); color: var(--steel); }
.mk-btn.lg { padding: .8rem 1.4rem; font-size: 1rem; }

/* --- hero --- */
.mk-hero { position: relative; overflow: hidden;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(176,122,43,.16), transparent 60%),
    linear-gradient(180deg, var(--steel-900), var(--steel-800) 60%, #12283d);
  color: #eaf0f6; border-bottom: 3px solid var(--brass); }
.mk-hero::before { /* faint blueprint grid */
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 34px 34px; mask-image: radial-gradient(1000px 500px at 70% 0%, #000, transparent 75%); }
.mk-hero .mk-wrap { position: relative; padding: 70px 24px 88px; }
.mk-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: .74rem;
  letter-spacing: .14em; text-transform: uppercase; color: #d9b877; margin-bottom: 20px; }
.mk-eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--brass); display: inline-block; }
.mk-hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.5rem); line-height: 1.05; letter-spacing: -.02em; margin: 0 0 18px; max-width: 15ch; color: #fff; }
.mk-hero h1 .u { color: #e7c485; }
.mk-hero .lede { font-size: clamp(1.05rem, 1.8vw, 1.28rem); color: #b9c7d6; max-width: 54ch; margin: 0 0 30px; }
.mk-cta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.mk-hero .fineprint { margin-top: 16px; font-size: .84rem; color: #8ea1b4; }
.mk-hero .fineprint b { color: #d9b877; font-weight: 700; }

/* --- browser-framed screenshot --- */
.mk-shot { border-radius: 12px; overflow: hidden; border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.55), 0 8px 20px -8px rgba(0,0,0,.4); background: #0d1b28; }
.mk-shot .bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: #101f2e; border-bottom: 1px solid rgba(255,255,255,.07); }
.mk-shot .bar i { width: 10px; height: 10px; border-radius: 50%; background: #33465a; }
.mk-shot img { display: block; width: 100%; height: auto; }
.mk-hero-shot { margin-top: 52px; }
.mk-hero-shot .mk-shot { border-color: rgba(255,255,255,.16); }

/* --- trust strip --- */
.mk-trust { background: var(--surface-2); border-bottom: 1px solid var(--line-soft); }
.mk-trust .mk-wrap { padding: 22px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 26px; justify-content: center;
  font-size: .82rem; color: var(--ink-faint); font-family: var(--mono); letter-spacing: .04em; }
.mk-trust b { color: var(--ink-soft); }

/* --- section scaffolding --- */
.mk-section { padding: 84px 0; }
.mk-section.alt { background: var(--surface-2); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.mk-head { max-width: 62ch; margin: 0 0 44px; }
.mk-head .mk-eyebrow { color: var(--brass-600); }
.mk-head .mk-eyebrow::before { background: var(--brass); }
.mk-head h2 { font-size: clamp(1.7rem, 3vw, 2.35rem); line-height: 1.12; letter-spacing: -.02em; margin: 0 0 14px; }
.mk-head p { font-size: 1.08rem; color: var(--ink-soft); margin: 0; }

/* --- alternating feature rows --- */
.mk-feature { display: grid; grid-template-columns: 1fr 1fr; gap: 54px; align-items: center; }
.mk-feature + .mk-feature { margin-top: 92px; }
.mk-feature.flip .mk-copy { order: 2; }
.mk-feature .mk-shot { border-color: var(--line); box-shadow: 0 24px 50px -22px rgba(21,33,46,.5); }
.mk-feature .mk-shot .bar { background: #f0f3f7; border-bottom-color: var(--line-soft); }
.mk-feature .mk-shot .bar i { background: #cfd8e2; }
.mk-kicker { font-family: var(--mono); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--brass-600); margin-bottom: 12px; }
.mk-feature h3 { font-size: 1.6rem; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 14px; }
.mk-feature p { color: var(--ink-soft); font-size: 1.02rem; margin: 0 0 18px; }
.mk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mk-list li { display: flex; gap: 10px; align-items: flex-start; font-size: .98rem; color: var(--ink); }
.mk-list li::before { content: "✓"; color: var(--ok); font-weight: 800; }

/* --- feature cards grid --- */
.mk-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.mk-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.mk-section.alt .mk-card { background: #fff; }
.mk-card .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--steel-50); color: var(--steel); font-size: 1.2rem; margin-bottom: 14px; }
.mk-card .ic svg { width: 20px; height: 20px; display: block; }
.mk-card h3 { margin: 0 0 8px; font-size: 1.08rem; }
.mk-card p { margin: 0; color: var(--ink-soft); font-size: .94rem; }

/* --- pricing --- */
.mk-price-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 28px; align-items: start; }
.mk-price-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 30px; box-shadow: 0 24px 50px -30px rgba(21,33,46,.4); }
.mk-price-card.feature { border-color: var(--brass); box-shadow: 0 24px 50px -24px rgba(176,122,43,.4); position: relative; }
.mk-price-card.feature::before { content: "14-day free trial"; position: absolute; top: -12px; left: 30px; background: var(--brass); color: var(--brass-ink);
  font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 4px 12px; border-radius: 999px; }
.mk-amount { display: flex; align-items: baseline; gap: 8px; margin: 8px 0 4px; }
.mk-amount .n { font-size: 2.6rem; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.mk-amount .p { color: var(--ink-faint); font-size: .95rem; }
.mk-plus { font-family: var(--mono); color: var(--brass-600); font-weight: 700; margin: 14px 0; }
.mk-estimator { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .92rem; }
.mk-estimator th, .mk-estimator td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line-soft); }
.mk-estimator th { font-family: var(--mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }
.mk-estimator td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }

/* --- final CTA band + footer --- */
.mk-band { background: linear-gradient(180deg, var(--steel-900), var(--steel-800)); color: #eaf0f6; text-align: center; padding: 74px 0; border-top: 3px solid var(--brass); }
.mk-band h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); margin: 0 0 12px; color: #fff; letter-spacing: -.02em; }
.mk-band p { color: #b9c7d6; margin: 0 0 26px; font-size: 1.05rem; }
.mk-foot { background: var(--steel-900); color: #93a6b8; padding: 40px 0; font-size: .88rem; }
.mk-foot .mk-wrap { display: flex; flex-wrap: wrap; gap: 16px 30px; align-items: center; }
.mk-foot a { color: #b9c7d6; text-decoration: none; }
.mk-foot a:hover { color: #fff; }
.mk-foot .sp { margin-left: auto; }

@media (max-width: 820px) {
  .mk-nav .links a:not(.mk-btn) { display: none; }
  .mk-feature, .mk-price-grid { grid-template-columns: 1fr; gap: 30px; }
  .mk-feature.flip .mk-copy { order: 0; }
  .mk-cards { grid-template-columns: 1fr; }
  .mk-section { padding: 60px 0; }
}

/* FAQ accordion on the marketing landing */
.mk-faq { max-width: 800px; margin: 0 auto; display: grid; gap: 10px; }
.mk-faq details { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 10px; }
.mk-faq summary { cursor: pointer; font-weight: 600; padding: 16px 44px 16px 20px; color: var(--ink); list-style: none; position: relative; }
.mk-faq summary::-webkit-details-marker { display: none; }
.mk-faq summary::after { content: "+"; position: absolute; right: 18px; top: 14px; color: var(--brass-600); font-weight: 700; font-size: 1.1rem; }
.mk-faq details[open] summary::after { content: "\2013"; }
.mk-faq .a { padding: 0 20px 16px; color: var(--ink-soft); line-height: 1.6; font-size: .95rem; }

/* ============================================================================
   OPERATOR CONSOLE — platform back office. Same two-column shell as the tenant
   app; the .sidebar.platform slate/violet theme (above) marks the chrome as
   cross-tenant back office.
   ============================================================================ */
.op-badge { font-family: var(--mono); font-size: .62rem; letter-spacing: .12em; text-transform: uppercase;
  background: var(--brass-fill); color: var(--brass-ink); padding: 2px 8px; border-radius: 999px; margin-left: 8px; font-weight: 800; }
.scroll { overflow-x: auto; }
/* Inline magnitude bar for metric tables: flat at the baseline, rounded at the
   data end; the value sits beside it in ink (never on the bar). */
.meter { display: flex; align-items: center; gap: .55rem; min-width: 120px; }
.meter i { display: block; height: 10px; flex: none; border-radius: 0 4px 4px 0; background: var(--steel);
  min-width: 0; max-width: calc(100% - 2.6em); /* the value must never be pushed out of the cell */ }
.meter i.brass { background: var(--brass); }
.meter b { flex: none; font-variant-numeric: tabular-nums; font-size: .85rem; }
.t-status { font-family: var(--mono); font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; font-weight: 700; }
.t-status.trialing { color: var(--brass-600); }
.t-status.active { color: var(--ok); }
.t-status.past_due { color: var(--due); }
.t-status.canceled, .t-status.incomplete { color: var(--ink-faint); }
.t-status.suspended { color: var(--over); }
.imperson-bar { background: var(--brass-fill); color: var(--brass-ink); text-align: center; padding: .5rem 1rem; font-size: .88rem; font-weight: 600; }
.imperson-bar a, .imperson-bar button { color: var(--brass-ink); font-weight: 800; text-decoration: underline; background: none; border: none; cursor: pointer; font-size: inherit; }

/* ============================================================================
   SPLIT AUTH LAYOUT (login / signup): brand panel + form column
   ============================================================================ */
.auth-split { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; }
.auth-brand {
  position: relative; overflow: hidden; color: #eaf0f6;
  background: linear-gradient(160deg, var(--steel-900), var(--steel-800) 60%, #12283d);
  border-right: 3px solid var(--brass);
  display: flex; align-items: center; justify-content: center; padding: 3rem;
}
.auth-brand::before {
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 34px 34px; mask-image: radial-gradient(720px 520px at 38% 22%, #000, transparent 75%);
}
.auth-brand-inner { position: relative; max-width: 430px; }
.auth-logo { width: min(330px, 82%); height: auto; display: block; margin-bottom: 1.7rem; }
.auth-tag { font-size: 1.06rem; color: #b9c7d6; line-height: 1.5; margin: 0 0 1.7rem; }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: .85rem; }
.auth-points li { display: flex; align-items: flex-start; gap: .65rem; font-size: .92rem; color: #cdd8e3; line-height: 1.4; }
.auth-points .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: .32rem; flex: none; }
.auth-points .dot.ok { background: #4ecd8a; } .auth-points .dot.due { background: #e8b93d; } .auth-points .dot.info { background: #7fb2ff; }
.auth-brand-foot { margin: 2rem 0 0; font-family: var(--mono); font-size: .8rem; letter-spacing: .07em; color: #7f93a8; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 3rem 2rem; background: var(--surface); }
.auth-form { width: 100%; max-width: 384px; }
.auth-form h1 { font-size: 1.7rem; letter-spacing: -.02em; margin: 0 0 .2rem; }
.auth-form > .muted { margin: 0 0 1.5rem; font-size: .92rem; }
@media (max-width: 860px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-brand { padding: 2.4rem 1.5rem 2rem; border-right: none; border-bottom: 3px solid var(--brass); }
  .auth-brand-inner { max-width: 540px; text-align: center; margin: 0 auto; }
  .auth-logo { margin: 0 auto 1.1rem; }
  .auth-tag { font-size: .98rem; margin-bottom: 0; }
  .auth-points, .auth-brand-foot { display: none; }
  .auth-panel { padding: 2rem 1.4rem 2.6rem; }
}

/* ---- notifications: topbar bell, center, preferences (ADR-030) ---- */
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px; color: var(--ink-soft); font-size: 1rem; flex: none; }
.bell:hover { background: var(--surface-2); }
.bell .bell-ic { display: block; width: 18px; height: 18px; opacity: .75; }
.bell.has-unread .bell-ic { opacity: 1; color: var(--ink); }
.bell .bell-badge { position: absolute; top: -2px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9px; background: var(--over-fill); color: #fff; font-size: .66rem; font-weight: 700;
  line-height: 16px; text-align: center; border: 2px solid var(--surface); }

.note.ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 26%, transparent); color: var(--ok); }
.note.over { background: var(--over-bg); border-color: color-mix(in srgb, var(--over) 26%, transparent); color: var(--over); }

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-item { display: flex; gap: .8rem; align-items: flex-start; padding: .85rem .4rem;
  border-bottom: 1px solid var(--line-soft); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: color-mix(in srgb, var(--info-bg) 55%, transparent); }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: .38rem; flex: none; background: var(--ink-faint); }
.notif-dot.ok { background: var(--ok); } .notif-dot.due { background: var(--due); }
.notif-dot.over { background: var(--over); } .notif-dot.info { background: var(--info); }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-weight: 600; color: var(--ink); }
.notif-text { color: var(--ink-soft); font-size: .9rem; margin-top: .12rem; }
.notif-meta { color: var(--ink-faint); font-size: .76rem; margin-top: .3rem; }
.notif-act { flex: none; }

.pref-group { margin: 1.1rem 0 .4rem; }
.pref-group-name { margin: 0 0 .3rem; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.pref-table { width: 100%; border-collapse: collapse; }
.pref-table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-faint); font-weight: 600; padding: .3rem .4rem; border-bottom: 1px solid var(--line); }
.pref-table th.pref-col, .pref-table td.pref-col { width: 74px; text-align: center; }
.pref-table td { padding: .6rem .4rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.pref-table tr:last-child td { border-bottom: none; }
.pref-label { font-weight: 600; color: var(--ink); }
.pref-desc { color: var(--ink-faint); font-size: .82rem; margin-top: .1rem; }
.pref-table input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--steel); }

/* ============================================================================
   SHOP OVERVIEW (dashboard). Panels stack in bands; each band is its own grid
   so the KPI strip, posture row, and detail rows keep independent columns.
   ============================================================================ */
.dash-band { margin-top: 1.15rem; }
.kpi-row .stat { display: block; text-decoration: none; color: inherit; transition: border-color .12s, box-shadow .12s; }
.kpi-row .stat:hover { border-color: var(--steel-50); box-shadow: var(--shadow); }

/* Compliance gauge — a conic ring driven by --pct, no chart library. */
.gauge-card .card-body { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .7rem; }
.gauge {
  --size: 132px;
  width: var(--size); height: var(--size); border-radius: 50%;
  background: conic-gradient(var(--ok) calc(var(--pct) * 1%), var(--line-soft) 0);
  display: grid; place-items: center; position: relative;
}
.gauge::after {
  content: ""; position: absolute; inset: 12px; border-radius: 50%;
  background: var(--surface); box-shadow: inset 0 1px 2px rgba(16,32,48,.06);
}
.gauge-val { position: relative; z-index: 1; font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; color: var(--ink); }
.gauge-val span { font-size: .95rem; font-weight: 600; color: var(--ink-faint); margin-left: 1px; }
.gauge-foot { font-size: .8rem; color: var(--ink-faint); }

/* Shop activity figures + 8-week hours bars */
.shop-figures { display: flex; flex-wrap: wrap; gap: 1.6rem; margin-bottom: 1.1rem; }
.shop-figures .label { display: block; color: var(--ink-faint); font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: var(--tracking-caps); margin-bottom: .2rem; }
.shop-figures b { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.sparkbars { display: flex; align-items: flex-end; gap: 10px; height: 92px; }
.sb-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 6px; }
.sb-bar { width: 100%; max-width: 34px; background: linear-gradient(180deg, var(--steel) 0%, var(--steel-700) 100%);
  border-radius: 3px 3px 0 0; min-height: 2px; }
.sb-col:last-child .sb-bar { background: linear-gradient(180deg, var(--brass) 0%, var(--brass-600) 100%); }
.sb-label { font-size: .64rem; color: var(--ink-faint); white-space: nowrap; }

/* Fleet status list */
.fleet-list { display: flex; flex-direction: column; }
.fleet-row { display: flex; align-items: center; gap: .7rem; padding: .68rem 1.15rem;
  border-bottom: 1px solid var(--line-soft); text-decoration: none; color: inherit; }
.fleet-row:last-child { border-bottom: none; }
.fleet-row:hover { background: var(--surface-2); }
.fl-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--ok); }
.fl-dot.over { background: var(--over); }
.fl-dot.due { background: var(--due); }
.fl-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.fl-main b { font-size: .92rem; }
.fl-next { font-size: .76rem; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================================
   LOCOMOTIVE OVERVIEW — the first tab of a locomotive record: KPI strip,
   12-month activity, compliance posture (gauge + interval runway bars).
   Reuses .stat, .gauge and .sparkbars from the Shop Overview.
   ============================================================================ */
.lo-band { margin-top: 1.15rem; }
.lo-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.15rem; }
.lo-kpis .stat { display: block; text-decoration: none; color: inherit; transition: border-color .12s, box-shadow .12s; }
.lo-kpis .stat:hover { border-color: var(--steel-50); box-shadow: var(--shadow); }
.lo-kpis .stat .value { font-size: 1.7rem; white-space: nowrap; }
.lo-kpis .stat .value .unit { font-size: .85rem; font-weight: 600; color: var(--ink-faint); margin-left: .25rem; letter-spacing: 0; }
.lo-kpis .stat .foot { line-height: 1.35; }
@media (max-width: 1280px) { .lo-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px)  { .lo-kpis { grid-template-columns: 1fr; } }

.lo-posture { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 1.6rem; align-items: center; }
.lo-gauge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .6rem; }
.gauge.due  { background: conic-gradient(var(--due) calc(var(--pct) * 1%), var(--line-soft) 0); }
.gauge.over { background: conic-gradient(var(--over) calc(var(--pct) * 1%), var(--line-soft) 0); }
@media (max-width: 640px) { .lo-posture { grid-template-columns: 1fr; } }

.runway { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .8rem; min-width: 0; }
.rw-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; font-size: .86rem; }
.rw-head b { font-weight: 600; min-width: 0; }
.rw-cfr { font-size: .72rem; color: var(--ink-faint); white-space: nowrap; }
.rw-track { height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; margin: .32rem 0 .22rem; }
.rw-fill { height: 100%; min-width: 4px; border-radius: inherit; background: var(--ok); }
.rw-fill.due  { background: var(--due); }
.rw-fill.over { background: var(--over); }
.rw-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .1rem .75rem; font-size: .76rem; color: var(--ink-faint); }
.rw-due.due  { color: var(--due); font-weight: 600; }
.rw-due.over { color: var(--over); font-weight: 600; }

.lo-note { margin: 1.1rem .15rem 0; max-width: 90ch; font-size: .8rem; line-height: 1.55; color: var(--ink-faint); }
.lo-note b { color: var(--ink-soft); font-weight: 600; }

.lo-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem; }
.lo-chart-label { color: var(--ink-faint); font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: var(--tracking-caps); margin-bottom: .6rem; }
.lo-chart-label .hint { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: .3rem; }
.lo-spark { gap: 5px; height: 110px; }
.lo-spark .sb-label { font-size: .6rem; }
.lo-spark.hours .sb-bar { background: linear-gradient(180deg, var(--info) 0%, color-mix(in srgb, var(--info) 70%, #000) 100%); }
.lo-spark.hours .sb-col:last-child .sb-bar { background: linear-gradient(180deg, var(--brass) 0%, var(--brass-600) 100%); }
@media (max-width: 760px) { .lo-charts { grid-template-columns: 1fr; } }

/* Activity feed */
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; align-items: center; gap: .65rem; padding: .62rem 1.15rem;
  border-bottom: 1px solid var(--line-soft); font-size: .85rem; }
.activity li:last-child { border-bottom: none; }
.act-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--info); }
.act-dot.create { background: var(--ok); }
.act-dot.approve { background: var(--brass); }
.act-dot.amend { background: var(--due); }
.act-main { flex: 1; min-width: 0; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-main b { color: var(--ink); }
.act-when { font-size: .74rem; color: var(--ink-faint); white-space: nowrap; }

/* ============================================================================
   PAGE COMPONENTS — the shared building blocks every app/console page uses,
   so a form, a banner or an action row looks the same on every screen.
   ============================================================================ */
/* Status banners above a page's content. .note is the advisory (brass) tone;
   .note.ok / .note.over / .note.proto are success / error / info. */
.flash { margin: 0 0 1.1rem; }
a.note { display: block; color: inherit; }
a.note.over { color: var(--over); }
a.note:hover { text-decoration: none; border-color: currentColor; }

/* Width rails for single-column pages: forms read best at ~720px; wider
   records (inspections, form editor) get the wide rail. */
.w-form { max-width: 720px; }
.pace-input { max-width: 7rem; }
/* A value carried in from the page that started the flow (the locomotive on
   a new inspection): shown fixed, with a way out, instead of a select. */
.locked-field { margin-bottom: 1rem; }
.locked-field > span { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .32rem; }
.locked-value { display: flex; align-items: baseline; gap: .75rem; padding: .5rem .7rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface-2); }
.locked-value .hint { font-size: .8rem; }
.w-wide { max-width: 880px; }
.w-prose { max-width: 820px; }

/* Field grid inside a form card. Fields sit flush (the grid gap spaces them);
   .span-2 / .span-all take more columns; everything stacks on phones. */
.form-grid { display: grid; gap: .8rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid > label.field, .form-grid > .field { margin: 0; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
.form-note { font-size: .8rem; color: var(--ink-faint); margin: 0 0 .5rem; }
@media (max-width: 760px) {
  .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}

/* The submit row under a form (primary action first, then Cancel). */
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.card-foot.form-actions { margin-top: 0; }

/* A form that is only a button (POST actions in toolbars and table rows). */
form.inline { display: inline; margin: 0; }

/* Small utilities for the handful of one-off alignments that recur. They stand
   in for the inline styles they replaced, so they keep that precedence. */
.m-0 { margin: 0 !important; }
.mb-1 { margin-bottom: 1rem !important; }
.mt-1 { margin-top: 1rem !important; }
.mb-s { margin-bottom: .6rem !important; }
.mt-s { margin-top: .6rem !important; }
.mb-card { margin-bottom: 1.15rem !important; }
.mt-card { margin-top: 1.15rem !important; }   /* stacked cards in one column: the grid gap */
.sticky { position: sticky !important; top: 84px !important; }   /* side rail that stays in view under the topbar */
.sep-top { border-top: 1px solid var(--line-soft) !important; }
.soft { color: var(--ink-soft) !important; }
.ml-auto { margin-left: auto !important; }
.btn.block { width: 100%; }
.fine { font-size: .8rem !important; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
/* A card footer with a note on the left and its actions on the right. */
.card-foot.foot-split { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; }
.foot-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
/* A one-line quick-add form (fields side by side, wrapping on narrow screens). */
.quick-row { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem 1rem; }
.form-grid.align-end-grid { align-items: end; }
.quick-row .field { min-width: 0; }
[data-fill-manual][hidden] { display: none !important; }

/* A card whose body folds away behind its header (a <details class="card">
   with a <summary class="card-head">). */
details.card > summary.card-head { cursor: pointer; list-style: none; }
details.card:not([open]) > summary.card-head { border-bottom: 0; }
details.card > summary.card-head::after {
  content: ""; flex: none; width: .45rem; height: .45rem; margin: -.2rem .15rem 0 .35rem;
  border-right: 2px solid var(--ink-faint); border-bottom: 2px solid var(--ink-faint);
  transform: rotate(45deg); transition: transform .15s;
}
details.card[open] > summary.card-head::after { transform: rotate(225deg); margin-top: .3rem; }
details.card > summary.card-head:focus-visible { outline: 2px solid var(--brass); outline-offset: -2px; }

/* Side rail on record pages (locomotive). The whole column sticks under the
   topbar; a lone sticky card let the cards beneath it slide under it. With a
   cover photo the rail is ~850px tall, so it only sticks on screens tall
   enough to hold it, and lets go while a folded panel is open, so it is never
   clipped. */
.side-rail > .card + .card { margin-top: 1.1rem; }
@media (min-width: 981px) and (min-height: 960px) {
  .side-rail { position: sticky; top: 84px; }
  .side-rail:has(details[open]) { position: static; }
}
.rail-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.rail-photo { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.rail-photo-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
  aspect-ratio: 16 / 10; background: var(--surface-2); color: var(--ink-faint);
  border-bottom: 1px dashed var(--line); font-size: .85rem; font-weight: 600; text-decoration: none;
}
.rail-photo-empty .ic { width: 34px; height: 34px; }
.rail-photo-empty .eq-art { --eq-h: 62px; max-width: 88%; color: var(--ink-soft); }
.rail-photo-empty:hover { color: var(--steel); text-decoration: none; }
.rail-title { display: flex; align-items: center; gap: .55rem; margin-bottom: .6rem; }
.rail-title .loco-id { font-size: 1.05rem; }
.rail-intro { margin: 0 0 .6rem; }
.note .note-next { display: block; margin-top: .2rem; }
a.note .note-cta { display: block; margin-top: .3rem; font-weight: 600; }

/* In-page jumps land below the sticky topbar and briefly mark the card. */
.tabbar, [data-jump-target] { scroll-margin-top: 90px; }
[data-jump-target]:focus { outline: none; }
.card.is-target { box-shadow: 0 0 0 2px var(--brass), var(--shadow-sm); transition: box-shadow .25s; }

/* My Career (ADR-036) */
.cert-files { list-style: none; margin: 0 0 .6rem; padding: 0; display: grid; gap: .3rem; }
.cert-files li { display: flex; align-items: center; justify-content: space-between; gap: .6rem; font-size: .88rem; }
.share-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .4rem; }
.btn.share-on { border-color: var(--ok); color: var(--ok); }
details.cert-edit > summary.card-foot { cursor: pointer; list-style: none; font-weight: 600; }
details.cert-edit > summary.card-foot::-webkit-details-marker { display: none; }
details.cert-edit[open] > summary.card-foot { border-bottom: 1px solid var(--line-soft); }
.cert-card .card-head { align-items: flex-start; }

/* 6180.49A tab */
.a49-head { flex-wrap: wrap; align-items: flex-start; }
.a49-head .actions { flex-wrap: wrap; }
.year-step { display: inline-flex; gap: .25rem; }
dl.spec.spec-2col { grid-template-columns: max-content 1fr max-content 1fr; }
@media (max-width: 760px) { dl.spec.spec-2col { grid-template-columns: max-content 1fr; } }
.a49-legal { margin: .6rem 0 0; }

/* A strip of stat tiles (or summary cards) above the page's main content. */
.grid.stat-row { margin-bottom: 1.15rem; }
@media (min-width: 1600px) { .grid.stat-row { margin-bottom: 1.4rem; } }

/* Link cards: a titled, described destination (help topics, import types,
   export datasets). The whole card is the target when it is an <a>. */
.link-card .card-body { height: 100%; }
a.link-card { transition: border-color .12s, box-shadow .12s; }
.lc-title { display: flex; align-items: center; gap: .6rem; margin: 0; font-size: 1rem; font-weight: 700; color: var(--ink); }
.lc-ic { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: var(--radius-sm);
  background: var(--steel-50); color: var(--steel); }
.lc-ic .ic { width: 18px; height: 18px; }
.lc-desc { margin: .45rem 0 0; font-size: .88rem; color: var(--ink-faint); }
.lc-split { display: flex; align-items: flex-start; gap: 1rem; }
.lc-split > div { flex: 1; min-width: 0; }
.lc-split .lc-desc { margin-top: .25rem; }

/* A row of filter fields over a list (season, kind…), ending in its button. */
.filter-row { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; }
.filter-row .field select, .filter-row .field input { min-width: 9rem; }

/* A run's operating report: the headline figures, then labelled sections. */
.op-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .9rem 1.2rem; }
.op-kpis > div { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.op-kpis span { color: var(--ink-faint); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.op-kpis b { font-size: 1.35rem; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--ink); }
.op-kpis small { color: var(--ink-faint); font-size: .76rem; line-height: 1.35; }
.op-section { padding: 1.05rem 1.15rem; border-top: 1px solid var(--line-soft); }
.op-section > .eyebrow { margin-bottom: .6rem; }
.op-section > .scroll { margin: 0 -1.15rem; }
.op-section > .scroll > .tbl { width: 100%; }
/* In-page anchors (#report, #costs, #fuel) land below the sticky topbar. */
.card[id] { scroll-margin-top: 84px; }
.op-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.op-split > .op-section + .op-section { border-left: 1px solid var(--line-soft); }
.op-lines { margin: 0; padding: 0; list-style: none; font-size: .88rem; }
.op-lines li { display: flex; justify-content: space-between; gap: 1rem; padding: .32rem 0; border-bottom: 1px dashed var(--line-soft); }
.op-lines li:last-child { border-bottom: none; }
.op-lines li b, .op-lines li .amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.op-lines li.total { border-top: 1px solid var(--line); border-bottom: none; margin-top: .2rem; padding-top: .5rem; font-weight: 700; }
.op-rates { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-top: .7rem; font-size: .84rem; color: var(--ink-soft); }
.op-rates b { color: var(--ink); font-variant-numeric: tabular-nums; }
@media (max-width: 980px) {
  .op-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .op-split { grid-template-columns: 1fr; }
  .op-split > .op-section + .op-section { border-left: none; }
}
@media (max-width: 560px) { .op-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Alignment helpers for grid items (a form's button cell, a side rail). */
.align-end { align-self: end; }
.align-start { align-self: start; }
.kv-inline.kv-stack { flex-direction: column; gap: .5rem; }
.kv-stack small { color: var(--ink-faint); font-size: .76rem; }

/* The run wrap-up: one fieldset per locomotive / per crew list. */
/* Row menu: one small button per table row that opens the row's actions
   (edit, remove…) in a popover, instead of a stack of buttons in the row.
     <td class="c-menu">
       <button class="row-menu-btn" type="button" popovertarget="ID" aria-label="Actions for …">icon "menu"</button>
       <div class="row-menu" id="ID" popover> <a>…</a> <form><button class="danger">…</button></form> </div>
     </td>
   The popover opens above everything (a card clips its own overflow) and
   closes on an outside click or Escape; shell.js places it under its button. */
.tbl th.c-menu, .tbl td.c-menu { width: 1%; padding-left: 0; text-align: right; white-space: nowrap; }
.row-menu-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent;
  color: var(--ink-faint); cursor: pointer; vertical-align: middle; transition: background .12s, border-color .12s, color .12s;
}
.row-menu-btn:hover, .row-menu-btn[aria-expanded=true] { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.row-menu-btn:focus-visible { outline: none; border-color: var(--steel); box-shadow: var(--ring); }
.row-menu-btn .ic { width: 16px; height: 16px; }
.row-menu {
  position: fixed; inset: auto; margin: 0; min-width: 11.5rem; padding: .3rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow); font-size: .86rem; text-align: left;
}
.row-menu form { margin: 0; }
.row-menu a, .row-menu button {
  display: flex; align-items: center; gap: .55rem; width: 100%; padding: .46rem .6rem;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink);
  font: inherit; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer;
}
.row-menu a:hover, .row-menu button:hover, .row-menu a:focus-visible, .row-menu button:focus-visible { background: var(--surface-2); outline: none; }
.row-menu .danger { color: var(--over); }
.row-menu .danger:hover, .row-menu .danger:focus-visible { background: var(--over-bg); }
.row-menu .ic { width: 15px; height: 15px; flex: none; }
@media (max-width: 760px) {
  .tbl.stack td.c-menu { width: auto; padding: 0; }
  .tbl.stack td.c-menu:empty { display: none; }
  .tbl.stack td.c-wide.muted { font-weight: 400; }
}
/* ---- Runs: plan vs actual, multi-day excursions, the calendar (ADR-044) ---- */
div.field > span:first-child { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .32rem; }
/* "what are you planning?": two big choices */
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; max-width: 860px; }
.choice-card { display: flex; flex-direction: column; gap: .5rem; padding: 1.4rem 1.4rem 1.2rem; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); color: var(--ink-soft);
  text-decoration: none; font-size: .9rem; line-height: 1.5; transition: border-color .12s, box-shadow .12s, transform .12s; }
.choice-card:hover, .choice-card:focus-visible { border-color: var(--steel); box-shadow: var(--shadow); transform: translateY(-1px); outline: none; }
.choice-card b { font-size: 1.15rem; color: var(--ink); }
.choice-ic { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: var(--radius-sm); background: var(--steel-50); color: var(--steel); }
.choice-ic .ic { width: 22px; height: 22px; }
.choice-go { margin-top: auto; padding-top: .4rem; font-weight: 600; color: var(--steel); }
/* an open run is a plan, and says so loudly */
.plan-bar { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; margin-bottom: 1.1rem; padding: .8rem 1rem;
  border: 1.5px dashed var(--brass); border-radius: var(--radius); font-size: .88rem; color: var(--ink-soft);
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--brass) 9%, var(--surface)) 0 14px, var(--surface) 14px 28px); }
.plan-bar-text { flex: 1 1 22rem; min-width: 0; }
.plan-bar-text b { color: var(--ink); }
.plan-bar-note { display: block; margin-top: .25rem; font-size: .82rem; }
.plan-bar.late { border-color: var(--over); background: var(--over-bg); }
.plan-bar.off { border-style: solid; border-color: var(--line); background: var(--surface-2); }
.plan-chip { flex: none; padding: .22rem .6rem; border-radius: var(--radius-pill); background: var(--brass-fill); color: var(--brass-ink);
  font-size: .68rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.plan-chip.sm { font-size: .6rem; padding: .14rem .45rem; }
.plan-bar.late .plan-chip { background: var(--over-fill); color: #fff; }
.plan-bar.off .plan-chip { background: var(--ink-soft); color: var(--surface); }
.badge.plan { background: color-mix(in srgb, var(--brass) 16%, var(--surface)); color: var(--ink); border: 1px dashed var(--brass); }
.plan-card { border-style: dashed; border-color: var(--brass); }
table.tbl tr.row-total td { border-top: 1px solid var(--line); background: var(--surface-2); }
.row-menu-note { display: block; max-width: 15rem; padding: .46rem .6rem; font-size: .8rem; color: var(--ink-faint); line-height: 1.4; }
.page-head .actions .row-menu-btn { border-color: var(--line); background: var(--surface); }
/* a multi-day excursion: step through its days */
.day-strip { margin-bottom: 1.1rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm); }
.day-strip-head { display: flex; align-items: baseline; gap: .3rem .9rem; flex-wrap: wrap; margin-bottom: .65rem; font-size: .86rem; }
.day-strip-head > b { font-size: .98rem; }
.day-strip-sum { margin-left: auto; color: var(--ink-soft); }
.day-strip-row { display: flex; align-items: center; gap: .5rem; }
.day-pills { display: flex; gap: .45rem; overflow-x: auto; padding: 2px; scrollbar-width: thin; }
.day-pill { flex: none; display: flex; flex-direction: column; align-items: center; min-width: 4.4rem; padding: .4rem .6rem .45rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-soft);
  text-decoration: none; line-height: 1.25; border-top-width: 3px; }
.day-pill small { font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }
.day-pill b { font-size: .95rem; color: var(--ink); }
.day-pill span { font-size: .78rem; }
.day-pill:hover { background: var(--surface-2); }
.day-pill.current { border-color: var(--steel); box-shadow: var(--ring); }
.day-pill.s-planned { border-top-color: var(--brass); }
.day-pill.s-running { border-top-color: var(--info); }
.day-pill.s-completed { border-top-color: var(--ok); }
.day-pill.s-cancelled { border-top-color: var(--line); opacity: .65; }
.day-pill.s-cancelled b { text-decoration: line-through; }
.day-step { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 44px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  font-size: 1.25rem; line-height: 1; text-decoration: none; }
a.day-step:hover { background: var(--surface-2); border-color: var(--steel); }
.day-step.off { opacity: .35; }
.day-strip-actions { margin-left: auto; display: flex; gap: .45rem; flex-wrap: wrap; justify-content: flex-end; }
.day-strip-actions form { margin: 0; }
/* the month calendar on Excursions & Runs */
.cal .card-head { gap: .8rem; flex-wrap: wrap; }
.cal-legend { display: flex; gap: .7rem; flex-wrap: wrap; font-size: .74rem; color: var(--ink-faint); }
.cal-key::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: .3rem; border-radius: 2px; background: var(--c); }
.s-planned { --c: var(--brass); } .s-running { --c: var(--info); } .s-completed { --c: var(--ok); } .s-cancelled { --c: var(--ink-faint); }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
/* The weekday row is a header, not a week: its own steel tint and a firm rule
   under it, so it never reads as part of last month's greyed-out days. */
.cal-dow { background: var(--steel-50); border-top: 1px solid var(--line); border-bottom: 1px solid color-mix(in srgb, var(--steel) 38%, var(--line)); }
[data-theme=dark] .cal-dow { background: var(--steel-900); }
.cal-dow > div { padding: .42rem .5rem; font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--steel) 78%, var(--ink)); background: none; border: 0; }
.cal-cell { position: relative; min-height: 5.4rem; padding: .3rem .35rem .4rem; border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-row:last-child .cal-cell { border-bottom: 0; }
.cal-cell.out { background: var(--surface-2); }
.cal-cell.out .cal-num { color: var(--ink-faint); opacity: .6; }
.cal-num { font-size: .78rem; font-weight: 600; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.cal-cell.today .cal-num { align-self: flex-start; padding: 0 .4rem; border-radius: var(--radius-pill); background: var(--steel); color: var(--surface); }
.cal-run { display: block; padding: .14rem .4rem; border-radius: 4px; border-left: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 13%, var(--surface)); color: var(--ink); font-size: .74rem; font-weight: 600;
  line-height: 1.35; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-run small { display: block; font-weight: 400; font-size: .68rem; color: var(--ink-soft); }
.cal-run:hover { background: color-mix(in srgb, var(--c) 24%, var(--surface)); }
.cal-run.s-cancelled { text-decoration: line-through; color: var(--ink-faint); }
.cal-add { position: absolute; top: .2rem; right: .25rem; width: 20px; height: 20px; display: none; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  font-size: .9rem; line-height: 1; text-decoration: none; }
.cal-cell:hover .cal-add, .cal-add:focus-visible { display: inline-flex; }
.cal-add:hover { border-color: var(--steel); color: var(--steel); }
.cal-agenda { display: none; list-style: none; margin: 0; padding: .4rem 0; border-top: 1px solid var(--line-soft); }
.cal-agenda li { padding: 0; }
.cal-agenda li.muted { padding: .5rem 1rem; font-size: .86rem; }
.cal-agenda a { display: flex; align-items: baseline; gap: .5rem; padding: .5rem 1rem; color: var(--ink); text-decoration: none; font-size: .88rem; }
.cal-agenda a b, .cal-agenda a small, .cal-agenda a .muted { flex: none; white-space: nowrap; }
.cal-agenda a small { color: var(--ink-soft); }
.cal-agenda a .cal-what { flex: 1 1 auto; min-width: 0; }
.cal-agenda a .muted { margin-left: auto; font-size: .78rem; }
.cal-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--c); align-self: center; }
@media (max-width: 760px) {
  .choice-grid { grid-template-columns: 1fr; }
  .day-strip-sum { margin-left: 0; flex-basis: 100%; }
  .day-strip-row { flex-wrap: wrap; }
  .day-pills { order: 3; flex-basis: 100%; }
  .day-strip-actions { margin-left: auto; }
  .cal-legend { display: none; }
  .cal-cell { min-height: 2.9rem; align-items: center; padding: .25rem .1rem; gap: .15rem; }
  .cal-run { width: 70%; height: 5px; padding: 0; border: 0; border-radius: 3px; background: var(--c); font-size: 0; }
  .cal-run small { display: none; }
  .cal-add { display: none !important; }
  .cal-agenda { display: block; }
}
/* ---- The railroad's calendar (ADR-045): one colour per kind of date ---- */
.l-runs { --c: var(--brass); } .l-inspections { --c: #2f6fb0; } .l-cars { --c: #16808a; } .l-waivers { --c: #7a55b8; }
.l-quals { --c: var(--ok); } .l-work_orders { --c: #5a6b7d; } .l-workdays { --c: #c85a1e; }
[data-theme=dark] .l-inspections { --c: #6aa5e0; } [data-theme=dark] .l-cars { --c: #45b6c0; } [data-theme=dark] .l-waivers { --c: #a98be0; }
[data-theme=dark] .l-work_orders { --c: #9fb0c2; } [data-theme=dark] .l-workdays { --c: #ec8a4f; }
.cal-layers { display: flex; flex-wrap: wrap; gap: .4rem; padding: .6rem .85rem; border-bottom: 1px solid var(--line-soft); }
.cal-layer { display: inline-flex; align-items: center; gap: .4rem; padding: .22rem .6rem; border: 1px solid var(--line);
  border-radius: var(--radius-pill); background: var(--surface); color: var(--ink); font-size: .78rem; font-weight: 600; text-decoration: none; }
.cal-layer:hover { background: var(--surface-2); }
.cal-layer small { font-weight: 400; color: var(--ink-faint); }
.cal-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--c); border: 1.5px solid var(--c); }
.cal-layer.off { color: var(--ink-faint); font-weight: 400; }
.cal-layer.off .cal-swatch { background: transparent; }
a.cal-num { align-self: flex-start; min-width: 1.5rem; text-decoration: none; }
a.cal-num:hover { color: var(--steel); text-decoration: underline; }
.appcal .cal-cell.selected { box-shadow: inset 0 0 0 2px var(--steel); }
/* The whole day is the link: click anywhere in a day to open it below, where
   the work-day form is already set to that date. Entries sit above the link
   and keep their own. */
.appcal a.cal-num::after { content: ""; position: absolute; inset: 0; }
.appcal .cal-run, .appcal .cal-more { position: relative; z-index: 1; }
.appcal .cal-cell:hover { background: color-mix(in srgb, var(--steel) 6%, var(--surface)); }
.appcal .cal-cell.out:hover { background: color-mix(in srgb, var(--steel) 9%, var(--surface-2)); }
.appcal a.cal-num:focus-visible { outline: none; }
.appcal .cal-cell:has(> a.cal-num:focus-visible) { box-shadow: inset 0 0 0 2px var(--steel), var(--ring); }
.appcal .cal-cell { min-height: 6.2rem; }
.cal-run.is-done { opacity: .62; }
.cal-run.is-overdue { box-shadow: inset 0 0 0 1px var(--over); }
.cal-run.is-overdue::before { content: "! "; color: var(--over); font-weight: 800; }
.cal-run.is-soon::before { content: "• "; color: var(--due, var(--brass)); font-weight: 800; }
.cal-run.is-cancelled { text-decoration: line-through; color: var(--ink-faint); }
.cal-run.is-approx { border-left-style: dashed; }
.cal-run.is-approx::after { content: " ≈"; color: var(--ink-faint); font-weight: 400; }
.cal-more { font-size: .7rem; color: var(--ink-faint); text-decoration: none; padding: 0 .4rem; }
.cal-more:hover { color: var(--steel); text-decoration: underline; }
.day-list { list-style: none; margin: 0; padding: 0; }
.day-list:empty { display: none; }
.day-list li { display: flex; align-items: center; gap: .65rem; padding: .6rem 1rem; border-bottom: 1px solid var(--line-soft); font-size: .9rem; }
.day-list li:last-child { border-bottom: 0; }
.day-list li > div { flex: 1 1 auto; min-width: 0; }
.day-list li a { font-weight: 600; }
.day-list li .fine { display: block; }
.feed-url { display: flex; gap: .5rem; align-items: center; }
.feed-url input { font-family: var(--mono, ui-monospace, monospace); font-size: .8rem; }
.feed-how { padding-left: 1.1rem; }
.feed-how li { margin: .25rem 0; }
.page-head .actions .btn .ic { width: 15px; height: 15px; vertical-align: -2px; margin-right: .2rem; }
@media (max-width: 760px) {
  .appcal .cal-cell { min-height: 2.9rem; }
  .cal-more { display: none; }
  .cal-run.is-overdue::before, .cal-run.is-soon::before, .cal-run.is-approx::after { content: none; }
  .feed-url { flex-direction: column; align-items: stretch; }
}
/* a table's totals, in a strip under it */
.tbl-total { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: baseline; gap: .3rem 1.1rem;
  padding: .7rem .85rem; border-top: 1px solid var(--line-soft); font-size: .88rem; }
.tbl-total .muted { margin-right: auto; }
.btn-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.check-set { display: flex; flex-wrap: wrap; gap: .55rem 1.3rem; margin: .55rem 0 .95rem; }
/* a run's crew card: each person's hours, typed in their row */
.tbl input.hours-box { width: 5.25rem; padding: .32rem .5rem; text-align: right; }
.wrap-set { border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: .9rem 1rem 1rem; margin: 0 0 .9rem; }
.wrap-set legend { padding: 0 .35rem; font-weight: 700; font-size: .92rem; color: var(--ink); }
.wrap-set .form-note { margin: .1rem 0 .7rem; }

/* Shared small helpers used by the overview tables */
.sub-cell { display: block; font-size: .74rem; color: var(--ink-faint); margin-top: .1rem; }
td.nowrap, .nowrap { white-space: nowrap; }
.badge.sm { font-size: .68rem; padding: .1rem .42rem; }
.empty.sm { padding: 1.4rem 1rem; font-size: .86rem; }
.empty.ok-empty { padding: 2rem 1.5rem; color: var(--ok); font-weight: 600; }

/* A banner with its own action (low stock → "Create requisition"): the text
   and the button share a row and wrap cleanly on phones. */
.note.note-bar { display: flex; align-items: center; justify-content: space-between; gap: .6rem 1rem; flex-wrap: wrap; }
/* Link tabs (status filters) reuse the tab bar; they are anchors, not buttons. */
.tabbar a.tab, .tabbar a.tab:hover { text-decoration: none; }

/* Purchasing (requisitions) */
.req-receive { display: flex; align-items: flex-end; gap: .4rem; margin: 0; justify-content: flex-end; flex-wrap: wrap; }
.req-receive label { display: flex; flex-direction: column; gap: .15rem; font-size: .66rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--ink-faint); }
.req-receive input { width: 5.2rem; padding: .3rem .45rem; font-size: .85rem; text-transform: none; letter-spacing: normal; font-weight: 400; }
.req-next .form-actions { margin-top: .8rem; align-items: center; }
.req-notes { margin: .9rem 0 0; padding-top: .8rem; border-top: 1px solid var(--line-soft); font-size: .86rem; color: var(--ink-soft); white-space: pre-line; }
.req-rail { align-self: start; gap: 1.1rem; }
.form-grid-button { display: flex; align-items: flex-end; }
.check-row { display: flex; align-items: center; gap: .5rem; font-size: .88rem; }
.check-row input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--steel); }
.btn.danger-text { color: var(--over); }
@media (max-width: 760px) {
  .req-receive { justify-content: flex-start; width: 100%; }
  .req-receive label { flex: 1 1 5rem; }
  .req-receive input { width: 100%; }
  /* A stacked table's footer (a total) becomes one padded label/value row. */
  .tbl.stack tfoot { display: block; }
  .tbl.stack tfoot tr { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; border-top: 1px solid var(--line-soft); }
  .tbl.stack tfoot td { padding: 0; border: none; }
  .tbl.stack tfoot td:empty { display: none; }
}

@media (max-width: 1100px) {
  .grid.cols-3.dash-band { grid-template-columns: 1fr; }
  .grid.cols-3.dash-band .card[style*="span 2"] { grid-column: auto !important; }
}

/* --- real logo lockup on the marketing site ---
   The wordmark lives inside the artwork, so the nav/footer brand is the image
   alone — no adjacent text to duplicate it. Sized by height so the lockup's
   2:1 aspect governs the width. */
.mk-logo { height: 42px; width: auto; display: block; }
.mk-logo-foot { height: 44px; width: auto; display: block; }
.mk-hero-logo { height: 84px; width: auto; display: block; margin: 0 0 26px; }

@media (max-width: 720px) {
  .mk-logo { height: 32px; }
  .mk-hero-logo { height: 62px; margin-bottom: 20px; }
}

/* Settings rows (Railroad settings): one hairline row per setting, what it
   does on the left, the control on the right, one sticky Save. */
.settings-rows { padding: 0; }
.settings-rows .srow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem;
  padding: 1.15rem 1.35rem; border-bottom: 1px solid var(--line-soft); align-items: start; }
.settings-rows .srow-intro h3 { margin: 0 0 .3rem; }
.settings-rows .srow-intro p { margin: 0 0 .55rem; color: var(--ink-soft); font-size: .88rem; max-width: 52ch; }
.settings-rows .srow-fields { display: grid; gap: .6rem; align-content: start; }
.settings-rows .srow-check { display: flex; gap: .55rem; align-items: center; font-weight: 600; }
.srow-save { position: sticky; bottom: 0; z-index: 2; display: flex; justify-content: flex-end; gap: .6rem;
  padding: .85rem 1.35rem; background: var(--surface); border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius); }
@media (max-width: 760px) { .settings-rows .srow { grid-template-columns: 1fr; gap: .8rem; } }

/* Toggle switch: a real checkbox (role=switch) over a pill track. */
.switch { position: relative; display: inline-flex; align-items: center; vertical-align: middle; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch-track { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--line);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 12%, transparent); transition: background .15s ease; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.28); transition: transform .15s ease; }
.switch input:checked + .switch-track { background: var(--ok); box-shadow: none; }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--brass); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .45; }
@media (prefers-reduced-motion: reduce) { .switch-track, .switch-track::after { transition: none; } }
.switch-row { display: flex; align-items: center; gap: .65rem; font-weight: 600; cursor: pointer; }

/* Roles & permissions matrix (Settings). */
.perm-matrix, .settings-rows { padding: 0; overflow: hidden; }
.pm-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap;
  padding: 1.15rem 1.35rem .95rem; border-bottom: 1px solid var(--line); }
.pm-head h2 { margin: 0 0 .3rem; font-size: 1.12rem; }
.pm-head p { margin: 0; color: var(--ink-soft); font-size: .88rem; max-width: 64ch; }
.pm-note { margin: .9rem 1.35rem 0; }
.pm-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .88rem; }
.pm-table .pm-col { width: 6.5rem; }
.pm-table .pm-col-admin { width: 8.5rem; }
.pm-table thead th { background: var(--surface-2); color: var(--ink-faint); font-size: .66rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: var(--tracking-caps); padding: .55rem .6rem; text-align: center;
  border-bottom: 1px solid var(--line); }
.pm-table thead th.pm-area-h { text-align: left; padding-left: 1.35rem; vertical-align: bottom; }
.pm-table thead .pm-role { color: var(--ink); font-size: .72rem; border-bottom: 1px solid var(--line-soft); }
.pm-table thead .pm-sub th { padding-top: .35rem; }
.pm-table td { text-align: center; padding: .6rem .6rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.pm-table th.pm-area { text-align: left; font-weight: 400; padding: .65rem 1rem .65rem 1.35rem; border-bottom: 1px solid var(--line-soft); }
.pm-label { display: flex; align-items: center; gap: .4rem; font-weight: 600; color: var(--ink); }
.pm-desc { display: block; margin-top: .12rem; color: var(--ink-faint); font-size: .8rem; line-height: 1.4; }
.pm-table .pm-group th { background: var(--surface); color: var(--steel); font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: var(--tracking-caps); text-align: left; padding: 1rem 1.35rem .4rem; border-bottom: 1px solid var(--line); }
.pm-table .pm-admin { background: color-mix(in srgb, var(--steel) 6%, transparent); }
.pm-table tbody tr:not(.pm-group):hover > * { background: var(--surface-2); }
.pm-table tbody tr:not(.pm-group):hover > .pm-admin { background: color-mix(in srgb, var(--steel) 10%, var(--surface-2)); }
.pm-changed > th.pm-area { box-shadow: inset 3px 0 0 var(--brass); }
.pm-dot { display: inline-block; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--brass); }
.pm-always, .pm-na { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; }
.pm-always { color: var(--ok); font-weight: 600; }
.pm-na, .pm-who { color: var(--ink-faint); font-size: .8rem; }
.pm-always .ic, .pm-na .ic { width: 14px; height: 14px; }
.pm-locked .pm-label { font-weight: 500; color: var(--ink-soft); }
@media (max-width: 760px) {
  .pm-table .pm-col { width: 3.4rem; }
  .pm-table .pm-col-admin { width: 2.4rem; }
  .pm-table thead .pm-admin { font-size: 0; }
  .pm-table thead .pm-role.pm-admin::after { content: "Admin"; font-size: .6rem; }
  .pm-table .pm-locked .pm-admin .pm-who { font-size: 0; }
  .pm-table .pm-locked .pm-admin .pm-who::after { content: "✓"; font-size: .85rem; color: var(--ok); }
  .pm-desc { font-size: .76rem; }
  .pm-table th.pm-area, .pm-table thead th.pm-area-h, .pm-table .pm-group th { padding-left: 1rem; }
  .pm-always span, .pm-table .pm-locked td .pm-na { font-size: 0; gap: 0; }
  .pm-table .pm-locked td .pm-na .ic { width: 14px; height: 14px; }
  .pm-who { font-size: .72rem; }
}

/* Part / store stock-in column: the receive card and an admin's count
   correction, stacked and sticky beside the record. */
.stock-side { gap: 1.1rem; position: sticky; top: 84px; align-self: start; }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; font-size: .88rem; }
details.card > summary.card-head { cursor: pointer; list-style: none; }
details.card > summary.card-head::-webkit-details-marker { display: none; }

/* Cost Center: headline tiles, then category / month / locomotive tables.
   One series per chart, so one hue (steel); values are the table text and
   each bar has a hover title. */
.cc-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.15rem; }
.cc-tile .card-body { display: grid; gap: .3rem; }
.cc-k { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--ink-faint); }
.cc-v { font-size: 1.7rem; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.cc-s { font-size: .8rem; color: var(--ink-soft); line-height: 1.4; }
.cc-arrow { font-size: .7rem; }
.cc-warn { box-shadow: inset 3px 0 0 var(--due); }
.cc-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.15rem; margin-bottom: 1.15rem; align-items: start; }
@media (max-width: 960px) { .cc-grid { grid-template-columns: 1fr; } }
.cc-barcol { width: 34%; min-width: 80px; }
.cc-bar { display: block; height: 10px; min-width: 2px; background: var(--steel); border-radius: 0 4px 4px 0; opacity: .85; }
.cc-bar:hover { opacity: 1; }
.cc-change { color: var(--ink-soft); white-space: nowrap; }
@media (max-width: 760px) { .tbl.stack td.cc-barcol { display: none; } }

/* Cost Center breakdown switch: a segmented control of plain links. */
.cc-bd-head { flex-wrap: wrap; gap: .6rem; }
.cc-tabs { display: inline-flex; margin-left: auto; padding: 2px; gap: 2px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); }
.cc-tabs a { padding: .28rem .75rem; border-radius: 999px; font-size: .8rem; font-weight: 600; color: var(--ink-soft); }
.cc-tabs a:hover { color: var(--ink); text-decoration: none; }
.cc-tabs a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
@media (max-width: 760px) { .cc-tabs { margin-left: 0; overflow-x: auto; max-width: 100%; } }

/* The clock a two-limit rule's runway bar is not drawn by ("· 28 of 1472
   service days" beside "14.8 of 15 years"). */
.rw-other { white-space: nowrap; }

/* ============================================================================
   IN SERVICE TODAY — a locomotive's Overview logs today as an in-service day
   in one click, or says it already is one (from any source).
   ============================================================================ */
.lo-today { margin-bottom: 1.15rem; }
.lo-today-body { display: flex; align-items: center; flex-wrap: wrap; gap: .8rem 1.2rem; padding: .9rem 1.15rem; }
.lo-today-text { display: flex; flex-direction: column; gap: .12rem; flex: 1 1 15rem; min-width: 0; }
.lo-today-text b { font-size: .98rem; }
.lo-today-text > span { font-size: .84rem; color: var(--ink-soft); }
.lo-today-form { margin: 0; flex: none; }
.lo-today.served { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 28%, transparent); }
.lo-today.served .lo-today-text b { color: var(--ok); }
.lo-today-mark { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: var(--ok); color: var(--ok-bg); font-weight: 800; font-size: 1rem; line-height: 1; }
/* A rail chip in place of the button once today is logged. */
.served-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .34rem .66rem; border-radius: var(--radius-pill);
  font-size: .8rem; font-weight: 600; line-height: 1.1; color: var(--ok); background: var(--ok-bg);
  border: 1px solid color-mix(in srgb, var(--ok) 28%, transparent); }

/* A regulation passage quoted under a control (partials/cfr-hint.html). */
.cfr-hint { margin: 0; padding: .6rem 1.15rem .75rem; border-top: 1px solid var(--line-soft);
  font-size: .78rem; line-height: 1.5; color: var(--ink-faint); }
.cfr-hint b { color: var(--ink-soft); font-weight: 600; }
.cfr-hint a { white-space: nowrap; font-family: var(--mono); font-size: .74rem; }

/* ============================================================================
   TODAY'S DAILIES — the dashboard card: each locomotive that owes a daily,
   with today's filed, started, or a button to file it. Amber only for an
   engine already in service today without one; the rest stay quiet.
   ============================================================================ */
.daily-card .card-head { flex-wrap: wrap; row-gap: .2rem; }
.daily-card .card-head h3 { white-space: nowrap; }
.daily-sub { font-size: .8rem; color: var(--ink-faint); }
@media (max-width: 520px) { .daily-sub { order: 3; flex-basis: 100%; } }
/* Cells in columns; the last column's divider tucks under the card edge. */
.daily-list { list-style: none; margin: 0 -1px 0 0; padding: 0; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.daily-row { display: flex; align-items: center; gap: .55rem .75rem; flex-wrap: wrap; min-width: 0;
  padding: .7rem 1.15rem; border-bottom: 1px solid var(--line-soft); box-shadow: inset -1px 0 0 var(--line-soft); }
.daily-mark { font-weight: 700; font-size: .92rem; color: var(--ink); margin-right: auto; }
.daily-state { display: inline-flex; align-items: baseline; gap: .35rem; font-size: .82rem; font-weight: 600; color: var(--ink-faint); }
.daily-state:empty { display: none; }
.daily-state small { font-weight: 400; color: var(--ink-faint); font-size: .76rem; }
.daily-state.ok { color: var(--ok); }
.daily-state.due { color: var(--due); }
.daily-state.info { color: var(--info); }
.daily-row.in-use { background: var(--due-bg); }

/* ============================================================================
   QUICK FIND — the top bar's search box (in the drawer on phones) and the
   /search results page. "/" focuses it (static/shell.js).
   ============================================================================ */
.qf { position: relative; display: flex; align-items: center; gap: .5rem; margin: 0; min-width: 0; }
.qf .qf-ic { position: absolute; left: .62rem; top: 50%; transform: translateY(-50%); display: flex;
  color: var(--ink-faint); pointer-events: none; }
.qf .qf-ic .ic { width: 16px; height: 16px; }
.qf input[type=search] { padding-left: 2rem; }
.qf-top { margin-left: auto; flex: 0 1 320px; }
.qf-top input[type=search] { height: 36px; padding-right: 2.1rem; background: var(--surface-2); }
.qf-top input[type=search]:focus { background: var(--surface); }
.qf-key { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); pointer-events: none;
  font: 600 .72rem/1 var(--mono); color: var(--ink-faint); background: var(--surface);
  border: 1px solid var(--line); border-radius: 4px; padding: .16rem .38rem; }
.qf-top input:focus ~ .qf-key, .qf-top input:not(:placeholder-shown) ~ .qf-key { display: none; }
.topbar .qf-top ~ .theme-toggle { margin-left: 0; }
/* In the drawer: the sidebar's own dark surface. */
.qf-side { display: none; margin: 0 1rem .7rem; }
.qf-side .qf-ic { color: #8ea3b8; }
.qf-side input[type=search] { background: rgba(255,255,255,.06); border-color: var(--sidebar-border); color: #fff; }
.qf-side input[type=search]::placeholder { color: #9fb1c3; }
.qf-side input[type=search]:focus { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(176,122,43,.3); }
@media (max-width: 760px) {
  .qf-top { display: none; }
  .qf-side { display: flex; }
}
/* The results page. */
.qf-page { max-width: 720px; margin-bottom: 1.15rem; }
.qf-page input[type=search] { flex: 1; min-width: 0; height: 42px; font-size: 1rem; }
.qf-count { margin: 0 0 .8rem; font-size: .85rem; }
.qf-groups { display: grid; gap: 1.15rem; align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); }
.qf-hits { list-style: none; margin: 0; padding: 0; }
.qf-hits li { display: flex; align-items: center; gap: .6rem; padding: .62rem 1.15rem; border-bottom: 1px solid var(--line-soft); }
.qf-hits li:last-child { border-bottom: 0; }
.qf-hits a { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.qf-hits a b { font-weight: 600; }
.qf-detail { font-size: .78rem; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================================
   SIDEBAR GROUPS — each group header folds its links (details/summary, so
   it works without JS; static/shell.js remembers the choice and keeps the
   current page's group open). One sidebar: the groups fold in place.
   ============================================================================ */
.nav details.nav-group > summary.group {
  display: flex; align-items: center; gap: .45rem; list-style: none; cursor: pointer; user-select: none;
  margin: .55rem 0 .15rem; padding: .36rem .7rem; border-radius: var(--radius-sm);
  transition: color .12s, background .12s;
}
.nav details.nav-group > summary.group::-webkit-details-marker { display: none; }
/* The chevron: points down when open, right when folded. */
.nav details.nav-group > summary.group::after {
  content: ""; margin-left: auto; flex: none; width: 6px; height: 6px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform .15s;
}
.nav details.nav-group:not([open]) > summary.group::after { transform: rotate(-45deg); }
.nav details.nav-group > summary.group:hover { color: #c6d2df; background: rgba(255,255,255,.05); }
.nav details.nav-group > summary.group:focus-visible { outline: 2px solid var(--brass); outline-offset: -2px; }
/* A folded group still shows what's waiting in it (the Approval Inbox count). */
.nav .group-count { font-size: .68rem; font-weight: 600; letter-spacing: 0; text-transform: none;
  background: rgba(255,255,255,.14); color: #dfe8f1; padding: .02rem .42rem; border-radius: var(--radius-pill); }
.nav details.nav-group[open] .group-count { display: none; }
@media (prefers-reduced-motion: reduce) { .nav details.nav-group > summary.group::after { transition: none; } }

/* ============================================================================
   Regulations reader (ADR-046)
   A reading surface: the official text on the left at a book's measure, with
   each paragraph at its depth and its designator hung beside it; the reader's
   own bookmarks, saved searches and notes in a column on the right.
   ============================================================================ */
.grid.reg-layout { grid-template-columns: minmax(0, 1fr) 21.5rem; gap: 1.5rem; align-items: start; }
.reg-main { min-width: 0; }
.reg-rail { display: grid; gap: 1.15rem; min-width: 0; }
@media (min-width: 1101px) {
  .reg-rail { position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; padding-bottom: 2px; }
}
@media (max-width: 1100px) { .grid.reg-layout { grid-template-columns: minmax(0, 1fr); } }

/* ---- the section's heading ---- */
.reg-head h1 { font-size: 1.62rem; line-height: 1.22; text-wrap: pretty; max-width: 46ch; }
.reg-head .reg-sec { font-family: var(--mono); font-weight: 700; color: var(--brass-600); white-space: nowrap; margin-right: .15em; letter-spacing: -.02em; }
.reg-head .sub .loco-id { color: var(--ink-soft); }
.btn.reg-mark .ic { width: 15px; height: 15px; }
.btn.reg-mark.on { color: var(--brass-600); border-color: color-mix(in srgb, var(--brass) 45%, var(--line)); }
.btn.reg-mark.on .ic { fill: currentColor; }
.note.row > span { min-width: 0; }

/* ---- the text ---- */
.reg-doc .reg-body {
  --step: 2.85rem;      /* one level of nesting */
  --gutter: 2.5rem;     /* where a designator hangs */
  padding: 1.7rem 1.9rem 1.5rem; font-size: 1rem; line-height: 1.68; color: var(--ink);
  font-variant-numeric: lining-nums; hanging-punctuation: first;
}
.reg-body ::selection { background: color-mix(in srgb, var(--brass) 32%, transparent); }
.reg-body p { margin: 0; max-width: 70ch; overflow-wrap: break-word; }
.reg-body a { color: var(--steel); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .16em; text-decoration-color: color-mix(in srgb, var(--steel) 45%, transparent); }
.reg-body a:hover { text-decoration-color: currentColor; }
.rp { display: grid; grid-template-columns: var(--gutter) minmax(0, 1fr); column-gap: .35rem; align-items: baseline;
  margin: 0 0 .62rem; padding-left: calc(var(--in, 0) * var(--step)); border-radius: 5px; scroll-margin-top: 104px; }
.rp:not(:has(> .rp-marks)) { grid-template-columns: minmax(0, 1fr); }
.rp.wide { --gutter: 4.5rem; }
.rp.multi { grid-template-columns: max-content minmax(0, 1fr); }
.rp.in0 { --in: 0; } .rp.in1 { --in: 1; } .rp.in2 { --in: 2; } .rp.in3 { --in: 3; } .rp.in4 { --in: 4; } .rp.in5 { --in: 5; }
/* a formula, table or figure sits under the text of the paragraph it belongs to */
.reg-body .in1:is(.rf, .reg-table-wrap, .reg-fig) { margin-left: var(--step); }
.reg-body .in2:is(.rf, .reg-table-wrap, .reg-fig) { margin-left: calc(2 * var(--step)); }
.reg-body :is(.in3, .in4, .in5):is(.rf, .reg-table-wrap, .reg-fig) { margin-left: calc(3 * var(--step)); }
/* a lettered paragraph opens a new thought: more air above it than within it */
.rp.in0:has(> .rp-marks) { margin-top: 1.15rem; }
.reg-body > .rp:first-child { margin-top: 0; }
.rp-marks { display: flex; gap: .3rem; }
.reg-body a.rp-mark { font-family: var(--mono); font-size: .84em; font-weight: 600; letter-spacing: -.02em; white-space: nowrap;
  color: var(--steel); text-decoration: none; border-radius: 3px; }
.reg-body a.rp-mark:hover { text-decoration: underline; text-underline-offset: .2em; }
.rp-lead { font-weight: 650; }
.reg-body dfn { font-style: italic; font-weight: 650; }
.rp:target { background: var(--brass-50); outline: .42rem solid var(--brass-50); }
.rp-saved { color: var(--brass-600); white-space: nowrap; }
.rp-saved .ic { width: 13px; height: 13px; fill: currentColor; vertical-align: -1px; }
.rp.is-note { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: .7rem .9rem; margin: 1rem 0; font-size: .93rem; line-height: 1.6; }
.rp.is-extract, .rf.is-extract { font-size: .94rem; color: var(--ink-soft); }
.reg-body .rf { font-family: var(--mono); font-size: .9rem; line-height: 1.6; margin-top: .1rem; margin-bottom: .55rem; color: var(--ink); }
.reg-body .rf.is-extract { font-family: var(--sans); font-size: .92rem; color: var(--ink-soft); margin-bottom: .3rem; }
.reg-body .rf.is-extract + :not(.rf) { margin-top: .8rem; }
.reg-h { font-size: 1.08rem; margin: 1.7rem 0 .6rem; }
.reg-body .reg-fig { font-size: .9rem; color: var(--ink-soft); background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: .7rem .9rem; margin-top: .9rem; margin-bottom: .9rem; }
.reg-body .reg-hist { font-size: .8rem; line-height: 1.5; color: var(--ink-faint); margin-top: 1.5rem; padding-top: .85rem; border-top: 1px solid var(--line-soft); max-width: none; }
.reg-table-wrap { overflow-x: auto; margin: 1rem 0 1.1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); scrollbar-width: thin; }
.reg-table { width: 100%; border-collapse: collapse; font-size: .9rem; line-height: 1.45; font-variant-numeric: tabular-nums lining-nums; }
.reg-table caption { caption-side: top; text-align: left; font-weight: 650; padding: .65rem .85rem; border-bottom: 1px solid var(--line); }
.reg-table th, .reg-table td { padding: .5rem .85rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
.reg-table thead th { background: var(--surface-2); font-size: .78rem; font-weight: 650; color: var(--ink-soft); border-bottom-color: var(--line); }
.reg-table tbody tr:last-child td { border-bottom: none; }
.reg-table td.num { text-align: right; white-space: nowrap; }

/* ---- before and after ---- */
.reg-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.15rem; }
.reg-pager a { display: flex; flex-direction: column; gap: .2rem; min-width: 0; padding: .75rem 1rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.reg-pager a:hover { border-color: color-mix(in srgb, var(--steel) 40%, var(--line)); box-shadow: var(--shadow); }
.reg-pager-next { text-align: right; grid-column: 2; }
.reg-pager-dir { font-size: .78rem; font-weight: 600; color: var(--ink-faint); }
.reg-pager-what { font-size: .9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reg-pager-what .loco-id { color: var(--brass-600); margin-right: .2rem; }

/* ---- in this section ---- */
.reg-outline { padding: .95rem 1.05rem 1rem; }
.reg-outline h3, .reg-shelf h3 { margin: 0 0 .55rem; font-size: .72rem; font-weight: 700; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--ink-faint); display: flex; align-items: center; gap: .45rem; }
.reg-outline ol { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.reg-outline a { display: grid; grid-template-columns: 1.9rem minmax(0, 1fr); gap: .25rem; padding: .3rem .4rem; margin: 0 -.4rem; border-radius: 5px; color: var(--ink); font-size: .86rem; line-height: 1.35; text-decoration: none; }
.reg-outline a:hover { background: var(--surface-2); }
.reg-outline a .loco-id { color: var(--steel); font-size: .8rem; }

/* ---- the reader's shelf: bookmarks, saved searches, notes ---- */
.reg-shelf { overflow: visible; }
.shelf-sec { padding: .95rem 1.05rem 1rem; }
.shelf-sec + .shelf-sec { border-top: 1px solid var(--line-soft); }
.shelf-n { font-size: .7rem; letter-spacing: 0; font-weight: 600; color: var(--ink-soft); background: var(--surface-2); border-radius: var(--radius-pill); padding: 0 .42rem; font-variant-numeric: tabular-nums; }
.shelf-list { list-style: none; margin: 0 -.4rem; padding: 0; display: grid; gap: .05rem; }
.shelf-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .15rem; border-radius: 6px; }
.shelf-list li:hover, .shelf-list li:focus-within { background: var(--surface-2); }
.shelf-list li.here { background: var(--brass-50); }
.shelf-list a { display: grid; gap: 0; min-width: 0; padding: .36rem .4rem; color: var(--ink); text-decoration: none; font-size: .86rem; line-height: 1.35; }
.shelf-list a .loco-id { font-size: .8rem; color: var(--steel); }
.shelf-list a:has(> .ic) { grid-template-columns: 15px minmax(0, 1fr); gap: .45rem; align-items: center; }
.shelf-list a > .ic { width: 15px; height: 15px; color: var(--ink-faint); }
.shelf-what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }
.shelf-list a:has(> .ic) .shelf-what { color: var(--ink); }
.shelf-list form { margin: 0; display: flex; }
.shelf-x { display: grid; place-items: center; width: 28px; height: 28px; margin-right: .15rem; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--ink-faint); cursor: pointer; }
.shelf-x .ic { width: 13px; height: 13px; }
.shelf-x:hover { color: var(--over); background: var(--over-bg); }
.shelf-x:focus-visible { outline: none; border-color: var(--steel); box-shadow: var(--ring); }
.shelf-empty { margin: 0; font-size: .84rem; line-height: 1.5; color: var(--ink-faint); }
.shelf-empty b { color: var(--ink-soft); font-weight: 600; }
/* ---- sticky notes: each note is a slip of coloured paper, and its text is
   its own editor. The same slip shows beside the text it is stuck to. ---- */
.c-brass { --note: var(--brass); --note-bg: var(--brass-50); }
.c-blue  { --note: var(--info);  --note-bg: var(--info-bg); }
.c-green { --note: var(--ok);    --note-bg: var(--ok-bg); }
.c-rose  { --note: var(--over);  --note-bg: var(--over-bg); }
.stickies { list-style: none; margin: .7rem 0 0; padding: 0; display: grid; gap: .55rem; }
.sticky { position: relative; display: block; background: var(--note-bg, var(--brass-50)); border: 1px solid color-mix(in srgb, var(--note, var(--brass)) 26%, transparent);
  border-radius: 3px 3px 9px 3px; box-shadow: 0 1px 1px rgba(16,32,48,.05), 0 5px 9px -7px rgba(16,32,48,.4); padding: .5rem .6rem .35rem; }
.sticky:focus-within { border-color: color-mix(in srgb, var(--note, var(--brass)) 60%, transparent); }
.sticky form, .shelf-list .sticky form, .shelf-list form.sticky { display: block; margin: 0; }
.stickies .sticky textarea { min-height: 1.35rem; }
.sticky textarea { display: block; width: 100%; min-height: 2.6rem; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; resize: none;
  field-sizing: content; font: inherit; font-size: .87rem; line-height: 1.5; color: var(--ink); caret-color: var(--note, var(--brass)); }
.sticky textarea:focus { outline: none; border: 0; box-shadow: none; }
.sticky textarea::placeholder { color: color-mix(in srgb, var(--ink) 55%, transparent); }
.sticky-at { display: block; margin: 0 1.6rem .2rem 0; font-size: .76rem; color: color-mix(in srgb, var(--note, var(--brass)) 70%, var(--ink)); text-decoration: none; }
.sticky-at:hover { text-decoration: underline; text-underline-offset: .16em; }
.sticky-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 1.5rem; margin-top: .2rem; }
.sticky .shelf-status { color: color-mix(in srgb, var(--ink) 62%, transparent); font-size: .72rem; }
.sticky-save { border: 0; background: none; padding: .1rem .2rem; font: inherit; font-size: .74rem; font-weight: 600; color: color-mix(in srgb, var(--note, var(--brass)) 70%, var(--ink)); cursor: pointer; border-radius: 4px; opacity: 0; }
.sticky:focus-within .sticky-save, .sticky-save:focus-visible { opacity: 1; }
.sticky-save:hover { text-decoration: underline; }
.sticky-remove { position: absolute; top: .2rem; right: .2rem; }
.sticky-remove .shelf-x { width: 24px; height: 24px; margin: 0; color: color-mix(in srgb, var(--ink) 50%, transparent); }
.sticky:has(.sticky-remove) textarea { padding-right: 1.4rem; }
.sticky:has(.sticky-at) textarea { padding-right: 0; }
/* the slip a new note is written on */
.sticky.new { border-style: dashed; box-shadow: none; padding-bottom: .5rem; }
.sticky.new:focus-within { border-style: solid; }
.sticky.new:has(input[value=blue]:checked)  { --note: var(--info); --note-bg: var(--info-bg); }
.sticky.new:has(input[value=green]:checked) { --note: var(--ok);   --note-bg: var(--ok-bg); }
.sticky.new:has(input[value=rose]:checked)  { --note: var(--over); --note-bg: var(--over-bg); }
.sticky-to { display: flex; align-items: center; gap: .45rem; margin: .45rem 0 0; font-size: .78rem; color: color-mix(in srgb, var(--ink) 70%, transparent); }
.sticky-to span { flex: none; }
.sticky-to select { flex: 1; min-width: 0; padding: .2rem .4rem; font-size: .8rem; background-color: var(--surface); }
.sticky-colors { display: inline-flex; gap: .3rem; }
.sticky-color { position: relative; width: 18px; height: 18px; border-radius: 50%; background: var(--note-bg); border: 1px solid color-mix(in srgb, var(--note) 55%, transparent); cursor: pointer; }
.sticky-color input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.sticky-color:has(input:checked) { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--note); }
.sticky-color:has(input:focus-visible) { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--note), var(--ring); }
/* under a bookmark: its notes, and the way to add one */
.shelf-list li.shelf-mark { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.shelf-list li.shelf-mark > form { margin-top: .25rem; }
.shelf-under { grid-column: 1 / -1; padding: 0 .4rem .35rem; }
.shelf-under .stickies { margin-top: .15rem; }
.shelf-list li.shelf-mark:hover, .shelf-list li.shelf-mark:focus-within { background: none; }
.shelf-list li.shelf-mark > a { border-radius: 6px; }
.shelf-list li.shelf-mark > a:hover { background: var(--surface-2); }
.sticky-add { margin-top: .1rem; }
.sticky-add > summary { display: inline-block; list-style: none; cursor: pointer; font-size: .76rem; font-weight: 600; color: var(--ink-faint); padding: .1rem 0; border-radius: 4px; }
.sticky-add > summary::-webkit-details-marker { display: none; }
.sticky-add > summary::before { content: "+ "; }
.sticky-add > summary:hover { color: var(--steel); }
.sticky-add[open] > summary { color: var(--ink-soft); }
.sticky-add[open] > summary::before { content: "− "; }
.sticky-add .sticky { margin-top: .3rem; }
/* a note beside the text it is stuck to */
.rp-note { grid-column: -2 / -1; max-width: 34rem; margin: .45rem 0 .3rem; padding: .5rem .7rem; display: flex; align-items: flex-start; gap: .7rem;
  background: var(--note-bg); border: 1px solid color-mix(in srgb, var(--note) 26%, transparent); border-radius: 3px 3px 9px 3px;
  box-shadow: 0 1px 1px rgba(16,32,48,.05), 0 5px 9px -7px rgba(16,32,48,.4); }
.reg-body .rp-note p { flex: 1; min-width: 0; max-width: none; font-size: .9rem; line-height: 1.5; white-space: pre-wrap; }
.reg-body .rp-note a { flex: none; font-size: .76rem; font-weight: 600; text-decoration: none; color: color-mix(in srgb, var(--note) 70%, var(--ink)); }
.reg-body .rp-note a:hover { text-decoration: underline; }
.reg-notes-top { margin: 0 0 1.1rem; display: grid; gap: .5rem; }
.reg-notes-top .rp-note { margin: 0; }
.sticky:target { box-shadow: 0 0 0 2px var(--note), var(--shadow); }
.shelf-status { font-size: .78rem; color: var(--ink-faint); min-width: 0; }
.shelf-status .ok { color: var(--ok); }
.shelf-status .over { color: var(--over); }
.shelf-foot { margin: 0; padding: .6rem 1.05rem; border-top: 1px solid var(--line-soft); background: var(--surface-2); font-size: .78rem; color: var(--ink-faint); border-radius: 0 0 var(--radius) var(--radius); }
.shelf-note { padding: .6rem 1.05rem; font-size: .84rem; border-bottom: 1px solid var(--line-soft); border-radius: var(--radius) var(--radius) 0 0; }
.shelf-note.ok { background: var(--ok-bg); color: var(--ok); }
.shelf-note.over { background: var(--over-bg); color: var(--over); }

/* ---- the library: search, parts, contents ---- */
.reg-search { display: flex; gap: .5rem; margin-bottom: 1.15rem; }
.reg-search-box { position: relative; flex: 1; min-width: 0; display: block; }
.reg-search-box > .ic { position: absolute; left: .85rem; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--ink-faint); pointer-events: none; }
.reg-search-box input { width: 100%; height: 2.75rem; padding-left: 2.5rem; font-size: 1rem; }
.reg-search .btn { height: 2.75rem; padding-inline: 1.1rem; }
.reg-parts { margin-bottom: 1rem; }
.reg-toc-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: .75rem; }
.reg-count { margin: 0; font-size: .88rem; color: var(--ink-soft); white-space: nowrap; }
.reg-jump { display: flex; flex-wrap: wrap; gap: .35rem; }
.reg-jump a { font-size: .8rem; padding: .16rem .6rem; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink-soft); text-decoration: none; }
.reg-jump a:hover { border-color: var(--steel); color: var(--steel); }
.reg-toc h2 { display: flex; align-items: center; gap: .5rem; margin: 0; padding: .6rem 1.15rem; background: var(--surface-2); border-bottom: 1px solid var(--line-soft);
  font-size: .76rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft); scroll-margin-top: 90px; }
.reg-toc section + section h2 { border-top: 1px solid var(--line); }
.reg-toc-n { font-weight: 600; letter-spacing: 0; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.reg-toc ul { list-style: none; margin: 0; padding: 0; }
.reg-toc li + li { border-top: 1px solid var(--line-soft); }
.reg-toc li a { display: grid; grid-template-columns: 5.6rem minmax(0, 1fr) auto auto; align-items: baseline; gap: .7rem; padding: .58rem 1.15rem; color: var(--ink); text-decoration: none; font-size: .93rem; }
.reg-toc li a:hover { background: var(--surface-2); }
.reg-toc li a:hover .reg-toc-what { text-decoration: underline; text-underline-offset: .16em; }
.reg-toc li a .loco-id { color: var(--steel); font-size: .86rem; }
.reg-flag { color: var(--brass-600); display: inline-flex; align-self: center; }
.reg-flag .ic { width: 14px; height: 14px; fill: currentColor; }
.reg-found { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: .8rem; }
.reg-found p { margin: 0; font-size: .92rem; color: var(--ink-soft); }
.reg-found q { color: var(--ink); font-weight: 600; }
.reg-found-actions { display: flex; align-items: center; gap: .4rem; }
.reg-found-actions .ic { width: 14px; height: 14px; }
.reg-results { list-style: none; margin: 0; padding: 0; }
.reg-results li + li { border-top: 1px solid var(--line-soft); }
.reg-results a { display: block; padding: .9rem 1.15rem; color: var(--ink); text-decoration: none; }
.reg-results a:hover { background: var(--surface-2); }
.reg-result-head { display: flex; align-items: baseline; gap: .6rem; }
.reg-result-head .loco-id { color: var(--steel); white-space: nowrap; }
.reg-result-head b { min-width: 0; }
.reg-result-head .badge { margin-left: auto; flex: none; }
.reg-snippet { display: block; margin-top: .35rem; font-size: .9rem; line-height: 1.55; color: var(--ink-soft); max-width: 78ch; }
[data-theme=dark] .reg-snippet mark { background: #3a2c10; }

@media (max-width: 640px) {
  .reg-doc .reg-body { --step: 1.15rem; --gutter: 2.1rem; padding: 1.15rem 1rem 1.1rem; }
  .rp.wide { --gutter: 3.6rem; }
  .reg-head { flex-direction: column; }
  .reg-head h1 { font-size: 1.35rem; }
  .reg-pager { grid-template-columns: 1fr; }
  .reg-pager-next { grid-column: 1; text-align: left; }
  .reg-toc li a { grid-template-columns: 4.9rem minmax(0, 1fr) auto; padding-inline: .9rem; }
  .reg-toc li a .badge { grid-column: 2; justify-self: start; }
  .reg-result-head { flex-wrap: wrap; }
}

/* ============================================================================
   Calendar: the Past due card (ADR-046)
   ============================================================================ */
.pd-list { list-style: none; margin: 0; padding: 0; }
.pd-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .4rem 1rem; padding: .5rem 1.15rem; }
.pd-list li + li { border-top: 1px solid var(--line-soft); }
.pd-list form { margin: 0; }
.pd-what { display: flex; align-items: baseline; gap: .55rem; min-width: 0; color: var(--ink); text-decoration: none; }
.pd-what:hover .pd-title { text-decoration: underline; text-underline-offset: .16em; }
.pd-title { font-weight: 600; font-size: .92rem; }
.pd-kind { font-size: .82rem; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pd-when { font-size: .84rem; color: var(--over); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pd-when b { font-weight: 600; margin-right: .3rem; }
.pd-list.is-dismissed { border-top: 1px dashed var(--line); background: var(--surface-2); }
.pd-list.is-dismissed .pd-title { font-weight: 500; color: var(--ink-soft); }
.pd-list.is-dismissed .pd-when { color: var(--ink-faint); }
.pd-note { padding-bottom: 0 !important; }
.past-due .card-head .tabn { margin-left: .2rem; vertical-align: 1px; }
.cal .card-head a.badge.over:hover { text-decoration: none; filter: brightness(.96); }
@media (max-width: 640px) {
  .pd-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .pd-what { grid-column: 1 / -1; flex-wrap: wrap; }
  .pd-kind { white-space: normal; }
}

[hidden] { display: none !important; }
/* a pending-amendment notice opens some sections: a line of its own, no rule above it */
.reg-body > .reg-hist:first-child { margin-top: 0; padding-top: 0; border-top: 0; margin-bottom: .9rem; }

/* ---- Toasts (static/shell.js): why a save was refused, over the form it
   came from. A refusal stays until dismissed or the next save. ---- */
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 90; display: flex; flex-direction: column; gap: .5rem; width: min(26rem, calc(100vw - 2rem)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: .6rem; padding: .75rem .8rem .75rem .95rem; border-radius: var(--radius-sm); border: 1px solid var(--line); border-left: 4px solid var(--over); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); font-size: .86rem; line-height: 1.45; animation: rc-rise .18s ease-out; }
.toast.ok { border-left-color: var(--ok); }
.toast-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-body b { display: block; margin-bottom: .1rem; color: var(--over); }
.toast.ok .toast-body b { color: var(--ok); }
.toast-x { flex: none; width: 28px; height: 28px; margin: -.3rem -.35rem 0 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-soft); font-size: 1.15rem; line-height: 1; cursor: pointer; }
.toast-x:hover { background: var(--surface-2); color: var(--ink); }
form[aria-busy="true"] button[type="submit"], form[aria-busy="true"] button:not([type]) { opacity: .6; cursor: progress; }
@media (max-width: 560px) { .toasts { left: 1rem; right: 1rem; width: auto; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ---- Field validation (static/forms.js): what's wrong with a field, under
   it, while the form is filled in. ---- */
.field-msg, label.field > span.field-msg { display: block; margin: .3rem 0 0; font-size: .78rem; line-height: 1.35; font-weight: 500; color: var(--over); }
.field-msg[hidden] { display: none; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--over); }
input[aria-invalid="true"]:focus, select[aria-invalid="true"]:focus, textarea[aria-invalid="true"]:focus { border-color: var(--over); box-shadow: 0 0 0 3px color-mix(in srgb, var(--over) 22%, transparent); }
.field-hint { display: block; margin-top: .3rem; font-size: .78rem; color: var(--ink-faint); }

/* Form 4: why a governed row can't be computed, where it's listed. */
.f4-why { margin-top: .2rem; font-size: .75rem; line-height: 1.35; color: var(--due); }
.f4-blocking { margin: .35rem 0 0; padding-left: 1.1rem; }
.f4-blocking li { margin: .15rem 0; }

/* A button that can't be used yet looks it (Certify with rows incomplete,
   Submit with no lines). */
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; filter: saturate(.6); }
