/* PRESS v1 — engineering graphics for personal infrastructure
   press.gldn.workers.dev/v1/press.css
   See COMPONENT-CATALOG.md for the class vocabulary. */

@font-face {
  font-family: "JetBrains Mono";
  src: url("https://press.gldn.workers.dev/v1/fonts/jetbrains-mono-regular.woff2") format("woff2");
  font-weight: 400 700;   /* variable woff2; range covers regular + bold */
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   TOKENS
   ============================================================ */
:root {
  /* Type */
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: InterVariable, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-base: 14px;
  --line-base: 1.5;
  --line-tight: 1.25;
  --size-heading: 1rem;

  /* Surfaces */
  --bg: #fff;
  --bg-soft: #fafafa;
  --bg-muted: #f5f5f5;

  /* Text */
  --text: #000;
  --text-2: #555;
  --muted: #999;

  /* Rules */
  --rule: #c9c9c9;
  --rule-soft: #dcdcdc;
  --rule-faint: #e5e5e5;

  /* Brand + link — Insignia Blue + NASA Meatball */
  --accent: #003B5C;   /* Insignia Blue · FED 15044 */
  --link:   #0B3D91;   /* NASA Meatball Blue */

  /* Semantic — ANSI Z535 / aerospace conventions */
  --positive: #00843D; /* Safety Green */
  --negative: #C8102E; /* Safety Red */
  --warn:     #E25600; /* Safety Orange */
  --info:     #0B3D91; /* NASA Meatball Blue */

  /* Spacing — 4px grid at 14px base */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;

  /* Border */
  --border: 0.1rem;
  --border-color: var(--text);
  --border-soft: var(--rule);
  --radius: 0;
  --radius-pill: 9999px;

  /* Shadow — 2×2 offset, no blur */
  --shadow: 2px 2px var(--rule-soft);
  --shadow-inset: inset 2px 2px var(--rule-soft);
  --shadow-strong: 2px 2px var(--rule);

  /* Layout */
  --max-content: 60rem;
  --max-wide: 80rem;
  --max-prose: 36rem;

  /* Transition */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur-fast: 100ms;
  --dur: 200ms;

  /* Z */
  --z-base: 0;
  --z-raised: 10;
  --z-overlay: 100;
  --z-dialog: 1000;
  --z-toast: 10000;

  /* ----------------------------------------------------------
     PIGMENT CATALOG — two parallel 16-hue sets.
     --earth-* : historical / muted earth pigments.
     --cad-*   : modern / saturated cadmium-era pigments.
     Same hue positions in each set so projects can swap between
     them by changing the prefix.
     ---------------------------------------------------------- */

  /* Earth (muted) */
  --earth-vermilion:    #a8443a;
  --earth-venetian:     #9c4030;
  --earth-burnt-sienna: #8b4f2e;
  --earth-raw-sienna:   #b87a3d;
  --earth-ochre:        #c89a3a;
  --earth-naples:       #d6bd7a;
  --earth-olive:        #7a7c3e;
  --earth-sap:          #5a7440;
  --earth-terre-verte:  #6b8266;
  --earth-viridian:     #3d6b5a;
  --earth-prussian:     #1f3a52;
  --earth-slate:        #5a6470;
  --earth-payne:        #3d4a55;
  --earth-mauve:        #8a6878;
  --earth-umber:        #6e4a2d;
  --earth-ivory-black:  #262220;

  /* Cadmium (bright) */
  --cad-vermilion:  #e34a2c;
  --cad-red:        #d72027;
  --cad-orange:     #e76f00;
  --cad-yellow:     #f5b800;
  --cad-lemon:      #f0d61f;
  --cad-sap:        #6aa324;
  --cad-emerald:    #16b56b;
  --cad-viridian:   #0ba17a;
  --cad-turquoise:  #0eb5a8;
  --cad-cerulean:   #0083c4;
  --cad-cobalt:     #1d5fcc;
  --cad-ultramarine:#2a3aa6;
  --cad-violet:     #5e2c91;
  --cad-magenta:    #c0257d;
  --cad-rose:       #e3447b;
  --cad-coral:      #ee6655;

  /* ----------------------------------------------------------
     AEROSPACE PIGMENTS — named, absolute, never re-themed.
     Drawn from FED-STD-595, NASA brand, ANSI Z535, ARINC 661.
     Use for accents, callouts, brand-anchoring moments.
     ---------------------------------------------------------- */
  --international-orange: #FF4F00;
  --aviation-orange:      #C0362C;  /* FED 12197 */
  --nasa-worm:            #FC3D21;
  --nasa-meatball:        #0B3D91;
  --insignia-blue:        #003B5C;  /* FED 15044 */
  --insignia-red:         #B71D1C;  /* FED 11136 */
  --caution-amber:        #FFB000;
  --nvg-green:            #00C84B;
  --cockpit-black:        #0F0F0F;
  --safety-yellow:        #FFD800;
  --safety-blue:          #0033A0;  /* ANSI Z535 */
  --safety-green:         #00843D;
}

/* ============================================================
   COCKPIT DARK MODE — ARINC 661-flavored.
   Applied by system preference (prefers-color-scheme: dark) or
   explicit opt-in via :root[data-theme="dark"]. Force light
   with :root[data-theme="light"] to override the system.
   ============================================================ */

:root[data-theme="dark"],
:root[data-theme="cockpit"] {
  --bg:         #0F0F0F;
  --bg-soft:    #1A1A1A;
  --bg-muted:   #222222;
  --text:       #D8D8D8;
  --text-2:     #9A9A9A;
  --muted:      #6A6A6A;
  --rule:       #2A2A2A;
  --rule-soft:  #1F1F1F;
  --rule-faint: #181818;
  --shadow:        2px 2px #1F1F1F;
  --shadow-inset:  inset 2px 2px #1F1F1F;
  --shadow-strong: 2px 2px #2A2A2A;
  --accent:   #7CB7FF;   /* aviation sky blue — info / links */
  --link:     #7CB7FF;
  --positive: #00C84B;   /* aviation green — NVG-compatible */
  --negative: #FF2820;   /* warning red */
  --warn:     #FFB000;   /* caution amber */
  --info:     #7CB7FF;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:         #0F0F0F;
    --bg-soft:    #1A1A1A;
    --bg-muted:   #222222;
    --text:       #D8D8D8;
    --text-2:     #9A9A9A;
    --muted:      #6A6A6A;
    --rule:       #2A2A2A;
    --rule-soft:  #1F1F1F;
    --rule-faint: #181818;
    --shadow:        2px 2px #1F1F1F;
    --shadow-inset:  inset 2px 2px #1F1F1F;
    --shadow-strong: 2px 2px #2A2A2A;
    --accent:   #7CB7FF;
    --link:     #7CB7FF;
    --positive: #00C84B;
    --negative: #FF2820;
    --warn:     #FFB000;
    --info:     #7CB7FF;
  }
}

/* Dark mode: tone down the offset shadow on light-surface components */
:root[data-theme="dark"] .ledger,
:root[data-theme="dark"] .product-edit,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .readout,
:root[data-theme="dark"] .dispatch,
:root[data-theme="dark"] .action-card,
:root[data-theme="dark"] .frame { background: var(--bg-soft); }

/* ============================================================
   BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: var(--font-base);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: var(--line-base);
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "tnum", "zero", "ss01";
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-size: var(--size-heading);
  font-weight: 700;
  line-height: var(--line-tight);
}
h3 { text-decoration: underline; text-decoration-thickness: var(--border); text-underline-offset: 0.25em; }

p { margin: 0 0 var(--space-3); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 2px; }

hr {
  border: 0;
  border-top: var(--border) solid var(--rule);
  margin: var(--space-5) 0;
}

code, kbd, samp { font-family: var(--font-mono); }

img, svg, video { max-width: 100%; height: auto; display: block; }

::selection { background: var(--text); color: var(--bg); }

@view-transition { navigation: auto; }

/* ============================================================
   PAGE STRUCTURE
   ============================================================ */

/* .bridge — page header. Items flow left-aligned by default (logo, nav).
   Mark the first right-aligned element with .bridge-end; margin-left: auto
   pushes it and any following siblings to the right (account, theme, etc.). */
.bridge {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border) solid var(--text);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bridge > * { margin: 0; }
.bridge > .bridge-end { margin-left: auto; }

/* .deck — main content container */
.deck {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
}
.deck.wide { max-width: var(--max-wide); }
.deck.prose { max-width: var(--max-prose); font-family: var(--font-sans); }

/* .colophon — page footer */
.colophon {
  border-top: var(--border) solid var(--rule);
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-6);
  font-size: 0.85rem;
  color: var(--text-2);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: space-between;
}

/* .heading — section heading */
.heading {
  font-size: var(--size-heading);
  font-weight: 700;
  margin: 0 0 var(--space-3);
  line-height: var(--line-tight);
}
.heading.underlined { text-decoration: underline; text-decoration-thickness: var(--border); text-underline-offset: 0.25em; }

/* .section — vertical section */
.section { margin: 0 0 var(--space-6); }
.section:last-child { margin-bottom: 0; }

/* .callsign — page/document identifier */
.callsign {
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* .eyebrow — small uppercase context line above titles.
   <span class="eyebrow">store.tinycrate.net · live</span><h1>Orders</h1> */
.eyebrow, .page-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  margin-bottom: var(--space-1);
  display: block;
}

/* .nav / .nav-list — top navigation bar */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-soft);
  border-bottom: var(--border) solid var(--rule);
  font-size: 0.9rem;
}
.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: var(--space-4);
  align-items: center;
}
.nav-list a { color: var(--text); text-decoration: none; }
.nav-list a:hover { text-decoration: underline; }
.nav-list a[aria-current="page"] { font-weight: 700; text-decoration: underline; }
.nav-logo { display: inline-block; max-height: 30px; width: auto; vertical-align: middle; }

/* .crumbs — breadcrumbs */
.crumbs {
  font-size: 0.85rem;
  color: var(--text-2);
  margin: 0 0 var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
}
.crumbs > * + *::before {
  content: "/";
  color: var(--muted);
  margin-right: var(--space-2);
}
.crumbs a { color: var(--text-2); }
.crumbs > [aria-current] { color: var(--text); font-weight: 700; }

/* .pager — previous/next navigation OR numbered pagination */
.pager {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  margin: var(--space-5) 0;
  padding-top: var(--space-3);
  border-top: var(--border) solid var(--rule);
  font-size: 0.9rem;
}
.pager > * { flex: 0 1 auto; }
.pager .prev::before { content: "← "; color: var(--muted); }
.pager .next::after  { content: " →"; color: var(--muted); }

/* Numbered variant: .pager.numbered with .page items */
.pager.numbered {
  justify-content: center;
  gap: var(--space-1);
  padding-top: var(--space-3);
}
.pager.numbered .page {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  border: var(--border) solid var(--rule);
  background: var(--bg);
  color: var(--text-2);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  min-width: 2rem;
  text-align: center;
}
.pager.numbered .page:hover { background: var(--bg-soft); color: var(--text); border-color: var(--text); }
.pager.numbered .page.active,
.pager.numbered .page[aria-current="page"] {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  font-weight: 700;
}
.pager.numbered .ellipsis { padding: 0 var(--space-1); color: var(--muted); }

/* ============================================================
   RECORDS
   ============================================================ */

/* .ledger — instrument-panel table.
   Single shape, two uses:
     (a) Data table  — <thead><tr><th>col</th>…  +  <tbody><tr><td>cell</td>…
     (b) Key/value   — <tbody><tr><th>label</th><td>value</td></tr>…
   Signature: 4px gray left-bar on tbody label cells, dashed-then-solid row rules,
   tight 3×6 padding, 2×2 shadow, top-aligned, tabular numerics. */
.ledger {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg);
  box-shadow: var(--shadow);
  font-variant-numeric: tabular-nums;
}
.ledger .ledger { box-shadow: none; }                  /* nestable */

.ledger caption {
  text-align: left;
  font-weight: 600;
  font-size: 1rem;
  padding: var(--space-2) var(--space-1) var(--space-1);
}

/* All cells: tight padding, top-aligned, sentence case */
.ledger th, .ledger td {
  padding: 3px 6px;
  text-align: left;
  vertical-align: top;
  color: var(--text);
}

/* Header row */
.ledger thead th {
  font-weight: 500;
  background: var(--bg);
}
.ledger thead th:first-child {
  padding-left: 6px;
  border-left: 4px solid var(--rule);
}

/* Label column (tbody th) — the signature 4px accent bar + 1px right rule */
.ledger tbody th {
  font-weight: 600;
  background: var(--bg);
  border-left: 4px solid var(--rule);
  border-right: var(--border) solid var(--rule);
}

/* Numerics: right-align by default in column position past the first, or via .numeric */
.ledger thead th + th,
.ledger tbody td + td { text-align: right; }
.ledger .numeric { text-align: right; font-variant-numeric: tabular-nums; }
.ledger .left    { text-align: left; }

/* Row separators: dashed below header / before first body row, solid between body rows, solid bottom */
.ledger thead tr th             { border-top: var(--border) dashed var(--rule-soft); }
.ledger tbody tr:first-child th,
.ledger tbody tr:first-child td { border-top: var(--border) dashed var(--rule-soft); }
.ledger tbody tr + tr th,
.ledger tbody tr + tr td        { border-top: var(--border) solid var(--rule-soft); }
.ledger tbody tr:last-child th,
.ledger tbody tr:last-child td  { border-bottom: var(--border) solid var(--rule-soft); }

/* Cell modifiers */
.ledger td.positive, .ledger td.pos { color: var(--positive); }
.ledger td.negative, .ledger td.neg { color: var(--negative); }
.ledger td.bold,     .ledger td.b   { font-weight: 600; }

/* Row modifiers — subtle tint marks status across the whole row.
   Status wins over .striped (set on both td and th to override per-cell stripe bg). */
.ledger tbody tr.active   td, .ledger tbody tr.active   th { background: color-mix(in srgb, var(--accent)   8%, transparent); }
.ledger tbody tr.positive td, .ledger tbody tr.positive th { background: color-mix(in srgb, var(--positive) 8%, transparent); }
.ledger tbody tr.negative td, .ledger tbody tr.negative th { background: color-mix(in srgb, var(--negative) 8%, transparent); }

/* Form-context label cells: tiny mono caps "spreadsheet" treatment */
form .ledger tbody th {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
}
form .ledger tbody th h4 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}

/* Dirty-state accent — yellow bar when the enclosing form is dirty */
form[data-dirty="true"] .ledger tbody th,
form[data-dirty="true"] .ledger thead th:first-child {
  border-left-color: var(--warn);
}

/* .entry — explicit row class */
.entry { border-bottom: var(--border) solid var(--rule-faint); }

/* .ledger.sticky — header pins to top during scroll. Wrap in a scrolling container. */
.ledger.sticky thead th {
  position: sticky;
  top: 0;
  z-index: var(--z-raised);
  background: var(--bg);
}

/* .ledger.striped — alternating row background for very long readouts. */
.ledger.striped tbody tr:nth-child(even) td,
.ledger.striped tbody tr:nth-child(even) th { background: var(--bg-soft); }

/* .ledger.cols — pin the label column to a fixed width so separate stacked
   ledgers align their value columns flush; labels wider than the column
   truncate with an ellipsis. Override --label-w per page. */
.ledger.cols { table-layout: fixed; }
.ledger.cols th:first-child,
.ledger.cols td:first-child {
  width: var(--label-w, 6rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* .balance — totals row */
.balance td, .balance th {
  border-top: var(--border) solid var(--text);
  font-weight: 700;
  background: var(--bg-soft);
}

/* .manifest — list of items */
.manifest {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: var(--border) solid var(--text);
  border-bottom: var(--border) solid var(--text);
}
.manifest > li {
  padding: var(--space-2) var(--space-3);
  border-bottom: var(--border) solid var(--rule-faint);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}
.manifest > li:last-child { border-bottom: 0; }

/* .docket — schedule list */
.docket {
  list-style: none;
  margin: 0;
  padding: 0;
}
.docket > li {
  display: grid;
  grid-template-columns: minmax(6rem, auto) 1fr;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: var(--border) dotted var(--rule);
}
.docket > li:last-child { border-bottom: 0; }
.docket time {
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}

/* ============================================================
   STATUS AND ALERTS
   ============================================================ */

/* .signal — inline alert with left-border severity */
.signal {
  padding: var(--space-2) var(--space-3);
  border-left: 4px solid var(--rule);
  background: var(--bg-soft);
  font-size: 0.9rem;
}
.signal.urgent   { border-left-color: var(--negative); background: color-mix(in srgb, var(--negative) 6%, var(--bg)); }
.signal.priority { border-left-color: var(--warn);     background: color-mix(in srgb, var(--warn) 6%, var(--bg)); }
.signal.routine  { border-left-color: var(--rule);     color: var(--text-2); }
.signal.info     { border-left-color: var(--info);     background: color-mix(in srgb, var(--info) 6%, var(--bg)); }
.signal.positive { border-left-color: var(--positive); background: color-mix(in srgb, var(--positive) 6%, var(--bg)); }
/* Severity aliases — legacy high/medium/low vocabulary. DEPRECATED in v1, removed in v2.
   Prefer .urgent / .priority / .routine (see COMPONENT-CATALOG.md "Class naming rules"). */
.signal.high   { border-left-color: var(--negative); background: color-mix(in srgb, var(--negative) 6%, var(--bg)); }
.signal.medium { border-left-color: var(--warn);     background: color-mix(in srgb, var(--warn) 6%, var(--bg)); }
.signal.low    { border-left-color: var(--rule);     color: var(--text-2); }

/* .dispatch — banner notice with right-border stripe */
.dispatch {
  padding: var(--space-3) var(--space-4);
  border: var(--border) solid var(--text);
  border-right-width: 6px;
  border-right-color: var(--accent);
  background: var(--bg);
  box-shadow: var(--shadow);
}
.dispatch.urgent   { border-right-color: var(--negative); }
.dispatch.priority { border-right-color: var(--warn); }
.dispatch.positive { border-right-color: var(--positive); }

/* .status — single-line state */
.status {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
}
.status::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  background: var(--muted);
  display: inline-block;
}
.status.positive::before { background: var(--positive); }
.status.negative::before { background: var(--negative); }
.status.priority::before { background: var(--warn); }

/* .condition — operational state badge */
.condition {
  display: inline-block;
  padding: 0 var(--space-2);
  border: var(--border) solid var(--text);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.condition.nominal  { background: color-mix(in srgb, var(--positive) 12%, var(--bg)); }
.condition.degraded { background: color-mix(in srgb, var(--warn) 12%, var(--bg)); }
.condition.offline  { background: color-mix(in srgb, var(--negative) 12%, var(--bg)); color: var(--negative); }

/* ============================================================
   FORMS
   ============================================================ */

/* .form */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* .field — label + input + help/error */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.field > label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.field > .help { font-size: 0.85rem; color: var(--text-2); }

/* .input */
.input,
input[type="text"].input, input[type="email"].input, input[type="password"].input,
input[type="number"].input, input[type="search"].input, input[type="url"].input,
input[type="tel"].input, input[type="date"].input, input[type="time"].input,
textarea.input, select.input {
  font: inherit;
  font-family: var(--font-mono);
  padding: var(--space-2) var(--space-3);
  border: var(--border) solid var(--text);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-inset);
  width: 100%;
}
.input:focus, .input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.input[aria-invalid="true"] {
  border-color: var(--negative);
  background: color-mix(in srgb, var(--negative) 4%, var(--bg));
}
.input:disabled { background: var(--bg-muted); color: var(--text-2); cursor: not-allowed; }
textarea.input { min-height: 6em; resize: vertical; }

/* .search — input with leading magnifier + trailing clear button.
   <div class="search"><input class="input" type="search" placeholder="Search…"><button class="search-clear" type="button" aria-label="clear">×</button></div> */
.search {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  width: 100%;
}
.search > .input {
  padding-left: calc(var(--space-3) + 1rem);
  padding-right: calc(var(--space-3) + 1rem);
}
.search::before {
  content: "";
  position: absolute;
  left: var(--space-3);
  top: 50%;
  width: 12px; height: 12px;
  transform: translateY(-50%);
  background: var(--text-2);
  -webkit-mask: radial-gradient(circle 4px at 4px 4px, transparent 95%, #000 96%) no-repeat, linear-gradient(45deg, transparent 60%, #000 60%, #000 75%, transparent 75%) no-repeat;
  -webkit-mask-position: 0 0, 6px 6px;
  mask: radial-gradient(circle 4px at 4px 4px, transparent 95%, #000 96%) no-repeat, linear-gradient(45deg, transparent 60%, #000 60%, #000 75%, transparent 75%) no-repeat;
  mask-position: 0 0, 6px 6px;
  pointer-events: none;
}
.search-clear {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  appearance: none;
  background: transparent;
  border: 0;
  font-size: 1rem;
  cursor: pointer;
  color: var(--muted);
  display: none;
  padding: 0 var(--space-1);
}
.search-clear:hover { color: var(--text); }
.search[data-has-value="true"] .search-clear { display: block; }

/* .switch — checkbox styled as a toggle switch.
   <label class="switch"><input type="checkbox" name="active"><span>Active</span></label> */
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: 0.9rem;
}
.switch > input[type="checkbox"] {
  appearance: none;
  width: 2.2rem;
  height: 1.1rem;
  background: var(--bg-muted);
  border: var(--border) solid var(--text);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--dur-fast) var(--ease);
}
.switch > input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 1px; left: 1px;
  width: calc(1.1rem - 4px);
  height: calc(1.1rem - 4px);
  background: var(--text);
  transition: transform var(--dur) var(--ease);
}
.switch > input[type="checkbox"]:checked { background: var(--positive); }
.switch > input[type="checkbox"]:checked::after { transform: translateX(1.1rem); background: var(--bg); }
.switch > input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* .fieldset — grouped form controls */
.fieldset {
  border: var(--border) solid var(--rule);
  padding: var(--space-3) var(--space-4) var(--space-4);
  margin: 0;
}
.fieldset > legend {
  padding: 0 var(--space-2);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* .input.currency — money input. Strip spinner, right-align, tabular nums.
   Pair with data-cents (press.js) for cents-as-source-of-truth tracking. */
.input.currency {
  text-align: right;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.input.currency::-webkit-outer-spin-button,
.input.currency::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* .input-group — input with leading/trailing addon (currency, suffix, etc.) */
.input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
}
.input-group > .input { border-radius: 0; flex: 1 1 auto; min-width: 0; }
.input-group > .input-addon {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-3);
  background: var(--bg-muted);
  border: var(--border) solid var(--text);
  color: var(--text-2);
  font-size: 0.9rem;
  white-space: nowrap;
}
.input-group > .input-addon + .input { border-left: 0; }
.input-group > .input + .input-addon { border-left: 0; }

/* .button */
.button {
  font: inherit;
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: var(--space-2) var(--space-4);
  border: var(--border) solid var(--text);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease);
  text-decoration: none;
  display: inline-block;
}
.button:hover {
  background: var(--text);
  color: var(--bg);
}
.button:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}
.button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.button:disabled, .button[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}
.button[aria-busy="true"] { opacity: 0.6; cursor: progress; }

.button.commit { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.button.commit:hover { background: var(--text); border-color: var(--text); }
/* Commit button is accent-colored; the default accent focus ring would vanish.
   Use a contrasting inner ring instead. */
.button.commit:focus-visible { outline-color: var(--bg); outline-offset: -4px; }

.button.revoke { color: var(--negative); border-color: var(--negative); }
.button.revoke:hover { background: var(--negative); color: var(--bg); }

.button.secondary { background: var(--bg-soft); color: var(--text-2); border-color: var(--rule); box-shadow: none; }
.button.secondary:hover { background: var(--bg-muted); color: var(--text); border-color: var(--text); }

.button.sm { padding: 1px var(--space-2); font-size: 0.75rem; }
.button.lg { padding: var(--space-3) var(--space-5); font-size: 1rem; }

/* ============================================================
   LAYOUT PRIMITIVES
   ============================================================ */

/* .stack */
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.stack.tight { gap: var(--space-2); }
.stack.loose { gap: var(--space-5); }

/* .cluster */
.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

/* .grid */
.grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

/* .frame */
.frame {
  padding: var(--space-4);
  border: var(--border) solid var(--text);
  background: var(--bg);
}

/* .sidebar */
.sidebar {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: minmax(12rem, 16rem) 1fr;
}
@media (max-width: 48rem) {
  .sidebar { grid-template-columns: 1fr; }
}

/* ============================================================
   VALUES AND EMPHASIS
   ============================================================ */

.credit   { color: var(--positive); font-variant-numeric: tabular-nums; }
.debit    { color: var(--negative); font-variant-numeric: tabular-nums; }
.positive { color: var(--positive); }
.negative { color: var(--negative); }
.numeric  { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted    { color: var(--muted); }
.data     {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.85rem;
  color: var(--text-2);
}
.code {
  font-family: var(--font-mono);
  background: var(--bg-muted);
  padding: 0 0.3em;
  border: var(--border) solid var(--rule-faint);
}

/* ============================================================
   COMPONENTS
   ============================================================ */

/* .panel */
.panel {
  border: var(--border) solid var(--text);
  background: var(--bg);
  box-shadow: var(--shadow);
  padding: var(--space-4);
}
.panel > .heading:first-child {
  margin: calc(var(--space-4) * -1) calc(var(--space-4) * -1) var(--space-3);
  padding: var(--space-2) var(--space-4);
  border-bottom: var(--border) solid var(--text);
  background: var(--bg-soft);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* .tag — static label */
.tag {
  display: inline-block;
  padding: 0 var(--space-2);
  border: var(--border) solid var(--rule);
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  background: var(--bg-soft);
  color: var(--text-2);
  line-height: 1.6;
}
.tag.numeric { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tag.dark { background: var(--text); color: var(--bg); border-color: var(--text); }
.tag.positive { color: var(--positive); border-color: var(--positive); }
.tag.negative { color: var(--negative); border-color: var(--negative); }
.tag.priority { color: var(--warn);     border-color: var(--warn); }
.tag.info     { color: var(--info);     border-color: var(--info); }

/* .chip — interactive label (removable, form-friendly).
   Differs from .tag by being clickable, having a remove affordance,
   and living inside .chip-list groups. */
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border: var(--border) solid var(--text);
  background: var(--bg);
  font-size: 0.85rem;
  line-height: 1.3;
  cursor: default;
}
.chip > button {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  padding: 0 0 0 var(--space-1);
  color: var(--text-2);
  line-height: 1;
}
.chip > button:hover { color: var(--negative); }
.chip.active { background: var(--text); color: var(--bg); }

/* .handle — grip affordance for sortable rows / items.
   Combine with [data-sortable] [data-handle=".handle"] on the list. */
.handle {
  cursor: grab;
  user-select: none;
  color: var(--muted);
  padding: 0 var(--space-2);
  font-family: var(--font-mono);
  line-height: 1;
}
.handle::before { content: "\2807"; }   /* ⠇ braille handle glyph */
.handle:active { cursor: grabbing; }
.handle:hover { color: var(--text-2); }

/* .action-card — clickable nav tile (dashboard quick-action grid).
   <a href="…" class="action-card"><strong>New post</strong><span>Write content</span></a> */
.action-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  border: var(--border) solid var(--text);
  background: var(--bg);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease);
}
.action-card:hover { background: var(--bg-soft); transform: translate(-1px, -1px); box-shadow: 3px 3px var(--rule); }
.action-card:active { transform: translate(2px, 2px); box-shadow: none; }
.action-card strong { font-weight: 700; font-size: 1rem; }
.action-card span   { font-size: 0.85rem; color: var(--text-2); }

/* .readout — KPI tile. Big value, small label above.
   <div class="readout"><span class="readout-label">today</span><span class="readout-value">12.3 kWh</span></div> */
.readout {
  border: var(--border) solid var(--text);
  background: var(--bg);
  box-shadow: var(--shadow);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}
.readout-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  font-weight: 600;
}
.readout-value {
  font-size: 1.4rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.readout-unit { font-size: 0.85rem; color: var(--text-2); margin-left: var(--space-1); }
.readout.positive .readout-value { color: var(--positive); }
.readout.negative .readout-value { color: var(--negative); }
.readout.tight .readout-value { font-size: 1.45rem; line-height: 1; }
.readout.tight .readout-label { font-size: 0.7rem; }

/* .toast */
#toasts {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: var(--z-toast);
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: var(--bg);
  padding: var(--space-2) var(--space-4);
  border: var(--border) solid var(--text);
  box-shadow: var(--shadow-strong);
  pointer-events: auto;
  font-size: 0.9rem;
  min-width: 12rem;
}

/* .gauge — progress / fill bar
   Fill color is overridable inline: <div class="gauge" style="--fill: #0063e5">
   Track color is overridable too: --track. */
.gauge {
  --fill: var(--text-2);
  --track: var(--bg-muted);
  height: 0.5rem;
  border: var(--border) solid var(--text);
  background: var(--track);
  position: relative;
  overflow: hidden;
}
.gauge > .fill {
  height: 100%;
  background: var(--fill);
  transition: width var(--dur) var(--ease);
}
.gauge.positive { --fill: var(--positive); }
.gauge.negative { --fill: var(--negative); }
.gauge.complete { --fill: var(--positive); }
.gauge.accent   { --fill: var(--accent); }
.gauge.thin     { height: 6px; }

/* .gauge.arc — semicircular arc gauge. Renders an inline SVG via press.js.
   <div class="gauge arc" style="--value: 65; --fill: var(--cad-emerald)"></div>
   --value: 0..100. --thickness: stroke width in viewBox units (default 10). */
.gauge.arc, .gauge.dial {
  --value: 0;
  --track: var(--bg-muted);
  --fill: var(--text-2);
  display: inline-block;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  height: auto;
  vertical-align: middle;
}
.gauge.arc  { width: 7rem; aspect-ratio: 100 / 70; }
.gauge.dial { width: 4rem;  aspect-ratio: 1 / 1; }
.gauge.arc > svg, .gauge.dial > svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.gauge.arc .track, .gauge.dial .track {
  fill: none;
  stroke: var(--track);
}
.gauge.arc .fill, .gauge.dial .fill {
  /* `.fill` here is an SVG element, not the bar's child div — scope wins via specificity. */
  fill: none;
  stroke: var(--fill);
  stroke-linecap: butt;
  transition: stroke-dasharray var(--dur) var(--ease);
}
.gauge.arc .tick, .gauge.dial .tick {
  stroke: var(--text-2);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
  opacity: 0.85;
}
.gauge.arc .tick.major, .gauge.dial .tick.major {
  stroke: var(--text);
  stroke-width: 2;
  opacity: 1;
}
.gauge.arc .needle, .gauge.dial .needle {
  stroke: var(--text);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
}
.gauge.arc .pivot, .gauge.dial .pivot {
  fill: var(--text);
}
.gauge.arc .label {
  fill: var(--text);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 18px;
  text-anchor: middle;
  dominant-baseline: middle;
}
.gauge.dial .label {
  fill: var(--text);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 22px;
  text-anchor: middle;
  dominant-baseline: middle;
}
.gauge.arc .label-unit, .gauge.dial .label-unit {
  fill: var(--text-2);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  text-anchor: middle;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.gauge.dial .label-unit { font-size: 9px; }

/* .tally — labeled bar row. Three direct children:
   <div class="tally">
     <span class="tally-label">category</span>
     <div class="gauge" style="--fill: var(--cad-cobalt)"><div class="fill" style="width: 60%"></div></div>
     <span class="tally-amt">$1,234.56</span>
   </div> */
.tally {
  display: grid;
  grid-template-columns: minmax(6rem, 12rem) 1fr auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: var(--border) solid var(--rule-faint);
}
.tally:last-child { border-bottom: 0; }
.tally-label {
  font-weight: 600;
  line-height: var(--line-tight);
}
.tally-amt {
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  font-size: 0.9rem;
  text-align: right;
  white-space: nowrap;
}
/* Legacy: .tally-value wrapping gauge + amt (kept for backwards-compat). */
.tally > .tally-value {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  grid-column: span 2;
}

/* .empty */
.empty {
  padding: var(--space-6);
  text-align: center;
  color: var(--text-2);
  border: var(--border) dashed var(--rule);
}

/* .skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--bg-muted) 0%, var(--rule-faint) 50%, var(--bg-muted) 100%);
  background-size: 200% 100%;
  animation: skeleton 1.2s linear infinite;
  color: transparent;
  border-radius: 0;
}
@keyframes skeleton { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* .dot — small status indicator. Standalone primitive (used inline, in lists, in nav).
   <span class="dot positive"></span> nominal */
.dot {
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  background: var(--muted);
  vertical-align: 0.05em;
  margin-right: var(--space-1);
  flex-shrink: 0;
}
.dot.positive { background: var(--positive); }
.dot.negative { background: var(--negative); }
.dot.priority { background: var(--warn); }
.dot.info     { background: var(--info); }
.dot.pulse {
  position: relative;
}
.dot.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  background: inherit;
  opacity: 0.6;
  animation: dot-pulse 1.5s ease-out infinite;
}
@keyframes dot-pulse { to { transform: scale(2.2); opacity: 0; } }

/* .avatar — initials circle (or image). Default 32px, .sm (20px), .lg (48px). */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: var(--bg-muted);
  color: var(--text-2);
  border: var(--border) solid var(--rule);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 20px; height: 20px; font-size: 0.65rem; }
.avatar.lg { width: 48px; height: 48px; font-size: 1rem; }

/* .kbd — explicit keycap rendering (also auto-applied to <kbd> tag) */
kbd, .kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8em;
  padding: 0 var(--space-1);
  background: var(--bg);
  border: var(--border) solid var(--rule);
  border-bottom-width: 2px;
  color: var(--text);
  line-height: 1.4;
  vertical-align: 0.05em;
}

/* .diff — before/after change display.
   <div class="diff">
     <div class="diff-before">old value</div>
     <div class="diff-after">new value</div>
   </div>
   or inline: <span class="diff-removed">old</span><span class="diff-added">new</span> */
.diff {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-1);
  border: var(--border) solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
.diff-before, .diff-after {
  padding: var(--space-2) var(--space-3);
}
.diff-before { background: color-mix(in srgb, var(--negative) 6%, var(--bg)); color: var(--negative); }
.diff-after  { background: color-mix(in srgb, var(--positive) 6%, var(--bg)); color: var(--positive); }
.diff-before::before { content: "− "; color: var(--negative); font-weight: 700; }
.diff-after::before  { content: "+ "; color: var(--positive); font-weight: 700; }

.diff-removed { background: color-mix(in srgb, var(--negative) 12%, var(--bg)); color: var(--negative); text-decoration: line-through; padding: 0 var(--space-1); }
.diff-added   { background: color-mix(in srgb, var(--positive) 12%, var(--bg)); color: var(--positive); padding: 0 var(--space-1); }

/* .spark — tiny inline SVG sparkline container */
.spark {
  display: inline-block;
  width: 6rem;
  height: 1.2rem;
  vertical-align: middle;
}
.spark svg { width: 100%; height: 100%; display: block; overflow: visible; }
.spark path, .spark polyline { fill: none; stroke: var(--text); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.spark.positive path, .spark.positive polyline { stroke: var(--positive); }
.spark.negative path, .spark.negative polyline { stroke: var(--negative); }

/* Global progress bar — top-of-page indicator during HTMX requests */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: var(--accent);
  width: 0;
  z-index: var(--z-toast);
  transition: width 200ms var(--ease), opacity 200ms var(--ease);
  pointer-events: none;
}
.progress-bar.active { opacity: 1; }
.progress-bar.done   { opacity: 0; }

/* .dirty-banner — sticky "unsaved changes" notice.
   Shown only when an ancestor form has data-dirty="true" (handled by press.js).
   <form data-guard data-dirty="false">
     <div class="dirty-banner">Unsaved changes</div>
     …
   </form> */
.dirty-banner {
  position: sticky;
  top: 0;
  z-index: var(--z-raised);
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: var(--warn);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: var(--border) solid var(--text);
}
[data-dirty="true"] .dirty-banner,
[data-dirty="true"] > .dirty-banner { display: flex; }

/* .tabs / .tab / .tab-panel — tabbed view (paired with data-tab behavior) */
.tabs {
  display: flex;
  border-bottom: var(--border) solid var(--rule);
  margin-bottom: var(--space-4);
  gap: var(--space-1);
}
.tab {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: var(--space-2) var(--space-3);
  font: inherit;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); background: var(--bg-soft); }
.tab.active, .tab[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tab-panel { display: none; }
.tab-panel.active, .tab-panel[aria-hidden="false"] { display: block; }

/* .help-text / .help — small caption text under fields or near controls */
.help-text, .help {
  font-size: 0.85rem;
  color: var(--text-2);
  margin-top: var(--space-1);
  display: block;
}

/* .notice — inline message near a form/control. Borderless, just colored text.
   Variants: .positive, .negative, .priority. Use .signal for boxed alerts. */
.notice {
  font-size: 0.9rem;
  color: var(--text-2);
  display: block;
}
.notice.positive { color: var(--positive); font-weight: 500; }
.notice.negative { color: var(--negative); font-weight: 500; }
.notice.priority { color: var(--warn);     font-weight: 500; }

/* .alert — alias of .signal (tinycrate legacy). Same shape, different name. */
.alert { padding: var(--space-2) var(--space-3); border-left: 4px solid var(--rule); background: var(--bg-soft); font-size: 0.9rem; }
.alert.urgent   { border-left-color: var(--negative); background: color-mix(in srgb, var(--negative) 6%, var(--bg)); }
.alert.priority { border-left-color: var(--warn);     background: color-mix(in srgb, var(--warn) 6%, var(--bg)); }
.alert.routine  { border-left-color: var(--rule);     color: var(--text-2); }

/* .steps / .step — wizard/stepper. <ol class="steps"><li class="step"><span class="step-number">1</span>Customer</li>…</ol> */
.steps {
  list-style: none;
  margin: 0 0 var(--space-4);
  padding: 0;
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
}
.step {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.9rem;
  color: var(--text-2);
}
.step + .step::before {
  content: "→";
  color: var(--muted);
  margin-right: var(--space-2);
}
.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem; height: 1.4rem;
  border: var(--border) solid var(--rule);
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
}
.step.active { color: var(--text); font-weight: 600; }
.step.active .step-number { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.step.done   { color: var(--text-2); }
.step.done .step-number { background: var(--positive); color: var(--bg); border-color: var(--positive); }

/* .menu — popover menu (paired with data-menu behavior).
   <button data-menu="my-menu" class="button">⋯</button>
   <div class="menu" id="my-menu"><a href="…">Edit</a><a href="…">Delete</a></div> */
.menu {
  display: none;
  position: absolute;
  z-index: var(--z-overlay);
  background: var(--bg);
  border: var(--border) solid var(--text);
  box-shadow: var(--shadow-strong);
  min-width: 10rem;
  padding: var(--space-1) 0;
  font-size: 0.9rem;
}
.menu.open { display: block; }
.menu a, .menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-1) var(--space-3);
  color: var(--text);
  text-decoration: none;
  background: transparent;
  border: 0;
  font: inherit;
  cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--bg-soft); }
.menu hr { margin: var(--space-1) 0; border: 0; border-top: var(--border) solid var(--rule-faint); }
.menu .revoke { color: var(--negative); }

/* .thumb — constrained image with border. Composes for product/variant/media.
   Sizes: default 80px, .sm (40px), .lg (160px). Modifier: .empty (placeholder). */
.thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border: var(--border) solid var(--rule);
  background: var(--bg-soft);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.sm { width: 40px; height: 40px; }
.thumb.lg { width: 160px; height: 160px; }
.thumb.empty {
  background-image: linear-gradient(45deg, var(--bg-muted) 25%, transparent 25%, transparent 75%, var(--bg-muted) 75%),
                    linear-gradient(45deg, var(--bg-muted) 25%, transparent 25%, transparent 75%, var(--bg-muted) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 6px 6px;
  color: var(--muted);
  font-size: 0.75rem;
}
.thumb-grid {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
}

/* .qty — quantity stepper. <div class="qty"><button class="qty-dec">−</button><input class="qty-value" value="1"><button class="qty-inc">+</button></div> */
.qty {
  display: inline-flex;
  align-items: stretch;
  border: var(--border) solid var(--text);
  background: var(--bg);
  height: 2rem;
}
.qty-dec, .qty-inc {
  appearance: none;
  background: var(--bg-soft);
  border: 0;
  width: 2rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}
.qty-dec:hover, .qty-inc:hover { background: var(--text); color: var(--bg); }
.qty-value {
  width: 3rem;
  text-align: center;
  border: 0;
  border-left: var(--border) solid var(--rule);
  border-right: var(--border) solid var(--rule);
  background: var(--bg);
  font: inherit;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  appearance: textfield;
  -moz-appearance: textfield;
}
.qty-value::-webkit-outer-spin-button,
.qty-value::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-value:focus { outline: 2px solid var(--accent); outline-offset: -2px; }

/* .upload — file upload preview tile (paired with data-upload behavior).
   <label class="upload" data-upload="/upload-url" data-name="image">
     <input type="file" hidden>
     <span class="upload-preview"><img src="…"></span>  OR  <span class="upload-empty">Add image</span>
     <button type="button" class="upload-remove" aria-label="remove">×</button>
   </label> */
.upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border: var(--border) solid var(--rule);
  background: var(--bg-soft);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color var(--dur-fast) var(--ease);
}
.upload:hover { border-color: var(--text); }
.upload.lg { width: 160px; height: 80px; }
.upload-preview, .upload-empty {
  width: 100%; height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-empty {
  color: var(--text-2);
  font-size: 0.8rem;
  flex-direction: column;
  gap: var(--space-1);
  text-align: center;
  padding: var(--space-2);
}
.upload-empty::before { content: "+"; font-size: 1.4rem; font-weight: 600; color: var(--muted); }
.upload-remove {
  position: absolute;
  top: 2px; right: 2px;
  width: 18px; height: 18px;
  padding: 0;
  border: 0;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.upload:hover .upload-remove { opacity: 1; }

/* .drawer — non-modal side panel (paired with data-drawer behavior).
   <button data-drawer="settings">Open</button>
   <aside id="settings" class="drawer right">…</aside>
   Variants: .right (default), .left, .bottom. */
.drawer {
  position: fixed;
  background: var(--bg);
  color: var(--text);
  border: var(--border) solid var(--text);
  box-shadow: var(--shadow-strong);
  padding: var(--space-4);
  z-index: var(--z-overlay);
  visibility: hidden;
  overflow: auto;
  transition: transform var(--dur) var(--ease), visibility 0s linear var(--dur);
}
.drawer.right  { top: 0; right: 0; bottom: 0; width: min(24rem, 90vw); transform: translateX(100%); }
.drawer.left   { top: 0; left: 0;  bottom: 0; width: min(24rem, 90vw); transform: translateX(-100%); }
.drawer.bottom { left: 0; right: 0; bottom: 0; height: min(20rem, 80vh); transform: translateY(100%); }
.drawer.open {
  visibility: visible;
  transform: none;
  transition: transform var(--dur) var(--ease);
}

/* .terminal / .console — preformatted CRT-style scrollback.
   <pre class="terminal">…</pre> or <div class="console">…</div>
   Inline level spans: .log-info, .log-warn, .log-error, .log-ok, .prompt. */
.terminal, .console {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.45;
  background: var(--cockpit-black);
  color: #c8c8c8;
  padding: var(--space-3) var(--space-4);
  border: var(--border) solid var(--text);
  box-shadow: var(--shadow);
  overflow: auto;
  max-height: 24rem;
  white-space: pre;
  tab-size: 2;
  margin: 0;
}
.terminal .log-info,  .console .log-info  { color: #7CB7FF; }
.terminal .log-warn,  .console .log-warn  { color: var(--caution-amber); }
.terminal .log-error, .console .log-error { color: #FF6B5C; }
.terminal .log-ok,    .console .log-ok    { color: var(--nvg-green); }
.terminal .log-muted, .console .log-muted { color: #6A6A6A; }
.terminal .prompt::before, .console .prompt::before { content: "$ "; color: var(--nvg-green); }

/* .fold — clip long content with show-more toggle (paired with data-press init).
   <div class="fold">…long content…</div>
   Press injects a .fold-toggle button after the element when content overflows. */
.fold {
  max-height: 8em;
  overflow: hidden;
  position: relative;
  transition: max-height var(--dur) var(--ease);
}
.fold:not(.open)::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2.5em;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}
.fold.open { max-height: 80vh; overflow: auto; }
.fold-toggle {
  display: inline-block;
  margin-top: var(--space-2);
  font: inherit;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--link);
  text-decoration: underline;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.fold-toggle:hover { color: var(--text); }

/* .tree — file-tree / nested collapse using native <details>.
   <ul class="tree">
     <li><details open><summary>config/</summary>
       <ul><li>app.toml</li></ul>
     </details></li>
   </ul> */
.tree, .tree ul {
  list-style: none;
  margin: 0;
  padding-left: var(--space-4);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
}
.tree { padding-left: 0; }
.tree li { position: relative; }
.tree details > summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  user-select: none;
}
.tree details > summary::-webkit-details-marker { display: none; }
.tree details > summary::marker { content: ""; }
.tree details > summary::before {
  content: "▸";
  display: inline-block;
  width: 1ch;
  color: var(--muted);
  transition: transform var(--dur-fast) var(--ease);
}
.tree details[open] > summary::before { content: "▾"; }
.tree details > summary:hover { color: var(--link); }
.tree li.active { color: var(--accent); font-weight: 600; }

/* Sortable visual states (paired with SortableJS via press.js) */
.sortable-ghost { opacity: 0; }
.sortable-ghost td, .sortable-ghost th {
  background: var(--bg-soft) !important;
  background-image: radial-gradient(circle, var(--rule) 0.5px, transparent 0.5px) !important;
  background-size: 3px 3px !important;
  color: transparent !important;
}
.sortable-ghost td > *, .sortable-ghost th > * { visibility: hidden; }
.sortable-drag {
  background: var(--bg);
  box-shadow: var(--shadow-strong);
}

/* .divider */
.divider {
  border: 0;
  border-top: var(--border) solid var(--rule);
  margin: var(--space-4) 0;
}
.divider.dashed { border-top-style: dashed; }
.divider.dotted { border-top-style: dotted; }

/* ============================================================
   DIALOG (CONVENTIONS — #dialog target)
   ============================================================ */
dialog#dialog {
  border: var(--border) solid var(--text);
  background: var(--bg);
  color: var(--text);
  padding: 0;
  box-shadow: var(--shadow-strong);
  max-width: min(40rem, 90vw);
  width: 100%;
}
dialog#dialog::backdrop {
  background: color-mix(in srgb, var(--text) 40%, transparent);
}
dialog#dialog > .panel { box-shadow: none; border: 0; }

/* ============================================================
   HTMX INDICATORS
   ============================================================ */
[aria-busy="true"] { cursor: progress; }
.htmx-request.input, .htmx-request .input { opacity: 0.7; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline; }

/* ============================================================
   REDUCED MOTION
   Engineering documents already minimize animation; honor the
   user's preference and turn off the few remaining moves.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  @view-transition { navigation: none; }
  .dot.pulse::after { animation: none; opacity: 0; }
  .skeleton { background: var(--bg-muted); animation: none; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  body { background: #fff; color: #000; font-size: 10pt; }
  .button, #toasts, dialog#dialog, .progress-bar, .pager, .tabs,
  .menu, .more-actions-menu, .more-actions-dropdown, .nav,
  .tenant-nav, .upload-remove, [data-print-hide] { display: none !important; }
  .panel, .ledger, .product-edit, .dispatch, .readout, .action-card,
  .panel, .stat-card, .frame, .chart, .chart-svg { box-shadow: none !important; border-color: #000; }
  a { color: #000; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; color: #444; }
  .deck, .deck.wide { max-width: none; padding: 0; }
  .section, .panel { page-break-inside: avoid; }
  h1, h2, h3, .heading.underlined { page-break-after: avoid; }
  tr, .tally, .manifest > li, .docket > li { page-break-inside: avoid; }
  .gauge > .fill { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .colophon { border-top: 1px solid #000; }
}

/* ============================================================
   LEGACY ALIASES (v1 only — sunset in v2)
   See COMPONENT-CATALOG.md "Legacy aliases" table.
   ============================================================ */
/* .product-edit → .ledger — true alias, identical styling */
.product-edit { width: 100%; border-collapse: collapse; background: var(--bg); box-shadow: var(--shadow); font-variant-numeric: tabular-nums; }
.product-edit .product-edit { box-shadow: none; }
.product-edit th, .product-edit td { padding: 3px 6px; text-align: left; vertical-align: top; color: var(--text); }
.product-edit thead th { font-weight: 500; background: var(--bg); }
.product-edit thead th:first-child { border-left: 4px solid var(--rule); }
.product-edit tbody th { font-weight: 600; background: var(--bg); border-left: 4px solid var(--rule); border-right: var(--border) solid var(--rule); }
.product-edit thead th + th, .product-edit tbody td + td { text-align: right; }
.product-edit thead tr th,
.product-edit tbody tr:first-child th,
.product-edit tbody tr:first-child td { border-top: var(--border) dashed var(--rule-soft); }
.product-edit tbody tr + tr th, .product-edit tbody tr + tr td { border-top: var(--border) solid var(--rule-soft); }
.product-edit tbody tr:last-child th, .product-edit tbody tr:last-child td { border-bottom: var(--border) solid var(--rule-soft); }
.product-edit tbody td.pos { color: var(--positive); }
.product-edit tbody td.neg { color: var(--negative); }
.product-edit tbody td.b   { font-weight: 600; }
form .product-edit tbody th { font-family: var(--font-mono); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); }
form[data-dirty="true"] .product-edit tbody th,
form[data-dirty="true"] .product-edit thead th:first-child { border-left-color: var(--warn); }

.hd { /* page header — closer to .bridge */
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border) solid var(--text);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ft { /* → .colophon */
  border-top: var(--border) solid var(--rule);
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-6);
  font-size: 0.85rem;
  color: var(--text-2);
}
.ht { /* → .callsign */
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.hl { /* → .heading */
  font-weight: 700;
  margin: 0 0 var(--space-3);
}
.c { /* → .deck */
  max-width: var(--max-content);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
}
.sep { /* → .divider */
  border: 0;
  border-top: var(--border) solid var(--rule);
  margin: var(--space-4) 0;
}
.nudge { /* → .signal */
  padding: var(--space-2) var(--space-3);
  border-left: 4px solid var(--rule);
  background: var(--bg-soft);
  font-size: 0.9rem;
}
.nudge.high   { border-left-color: var(--negative); background: color-mix(in srgb, var(--negative) 6%, var(--bg)); }
.nudge.medium { border-left-color: var(--warn);     background: color-mix(in srgb, var(--warn) 6%, var(--bg)); }
.nudge.low    { border-left-color: var(--rule);     color: var(--text-2); }
.section-hdr { /* → .heading */
  font-weight: 700;
  margin: 0 0 var(--space-3);
}
.pos { color: var(--positive); }
.neg { color: var(--negative); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.btn { /* → .button */
  font: inherit;
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: var(--space-2) var(--space-4);
  border: var(--border) solid var(--text);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { background: var(--text); color: var(--bg); }
.tag.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ============================================================
   UTILITIES — pragmatic, abbreviated names accepted for these.
   Use sparingly; prefer components and primitives first.
   ============================================================ */

/* Margins: mt-N (top), mb-N (bottom), m-N (all). N = 0..6 maps to --space-0..6 */
.m-0  { margin: 0; }
.m-1  { margin: var(--space-1); }
.m-2  { margin: var(--space-2); }
.m-3  { margin: var(--space-3); }
.m-4  { margin: var(--space-4); }
.m-5  { margin: var(--space-5); }
.m-6  { margin: var(--space-6); }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: var(--space-1); } .mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); } .mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); } .mt-6 { margin-top: var(--space-6); }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: var(--space-1); } .mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); } .mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); } .mb-6 { margin-bottom: var(--space-6); }
.mx-auto { margin-left: auto; margin-right: auto; }

/* Padding */
.p-0 { padding: 0; } .p-1 { padding: var(--space-1); } .p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); } .p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); } .p-6 { padding: var(--space-6); }

/* Text alignment */
.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* Display */
.hidden { display: none; }
.block  { display: block; }
.inline { display: inline; }
.flex   { display: flex; }

/* Flex helpers (covers tinycrate's row-between, col-dense, etc.) */
.row-between { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.row-dense   { display: flex; gap: var(--space-2); align-items: center; }
.col-dense   { display: flex; flex-direction: column; gap: var(--space-2); }

/* Tinycrate legacy spacing aliases */
.mb4 { margin-bottom: var(--space-4); }

/* .hazard — industrial yellow/black diagonal stripe utility.
   Use on its own as a divider, or combined with .dispatch / .signal
   for high-severity callouts. */
.hazard {
  background-image: repeating-linear-gradient(
    45deg,
    var(--safety-yellow) 0,
    var(--safety-yellow) 10px,
    #000 10px,
    #000 20px
  );
  min-height: 12px;
}
.hazard-stripe {
  border-image: repeating-linear-gradient(
    45deg,
    var(--safety-yellow) 0,
    var(--safety-yellow) 6px,
    #000 6px,
    #000 12px
  ) 6;
}
.dispatch.hazard { background-image: none; border-right: 8px solid; border-right-color: transparent; border-image: repeating-linear-gradient(45deg, var(--safety-yellow) 0, var(--safety-yellow) 6px, #000 6px, #000 12px) 8; }
.signal.hazard   { border-left: 6px solid; border-left-color: transparent; border-image: repeating-linear-gradient(45deg, var(--safety-yellow) 0, var(--safety-yellow) 4px, #000 4px, #000 8px) 4; }

/* ── tinycrate aliases ─────────────────────────────────────── */
.dashboard-section { margin: 0 0 var(--space-6); }
.tenant-nav { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) var(--space-4); background: var(--bg-soft); border-bottom: var(--border) solid var(--rule); font-size: 0.9rem; }
.tenant-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--space-4); align-items: center; }
.navbar-logomark, .nav-logomark { display: inline-block; max-height: 30px; width: auto; vertical-align: middle; }

/* .table / .table-silver → .ledger */
.table, .table-silver { width: 100%; border-collapse: collapse; background: var(--bg); box-shadow: var(--shadow); font-variant-numeric: tabular-nums; }
.table th, .table td, .table-silver th, .table-silver td { padding: 3px 6px; text-align: left; vertical-align: top; }
.table thead th, .table-silver thead th { font-weight: 500; }
.table tbody tr + tr td, .table-silver tbody tr + tr td { border-top: var(--border) solid var(--rule-soft); }

/* .secondary on a bare <button> → button.secondary */
button.secondary { font: inherit; font-family: var(--font-mono); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: var(--space-2) var(--space-4); border: var(--border) solid var(--rule); background: var(--bg-soft); color: var(--text-2); cursor: pointer; }
button.secondary:hover { background: var(--bg-muted); color: var(--text); border-color: var(--text); }

/* .btn-small / .md-btn → .button.sm */
.btn-small, .md-btn { font: inherit; font-family: var(--font-mono); padding: 2px 8px; border: var(--border) solid var(--rule); background: var(--bg); color: var(--text); font-size: 0.75rem; cursor: pointer; line-height: 1.4; }
.btn-small:hover, .md-btn:hover { background: var(--bg-soft); border-color: var(--text); }
.md-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* .drag-handle → .handle */
.drag-handle { cursor: grab; user-select: none; color: var(--muted); padding: 0 var(--space-2); text-align: center; }
.drag-handle:hover { color: var(--text-2); }
.handle-column { width: 28px; text-align: center; color: var(--muted); }

/* .stat-card → .readout */
.stat-card { border: var(--border) solid var(--text); background: var(--bg); box-shadow: var(--shadow); padding: var(--space-3) var(--space-4); display: flex; flex-direction: column; gap: var(--space-1); }

/* .currency-input → .input.currency */
.currency-input { text-align: right; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.currency-input::-webkit-outer-spin-button, .currency-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.currency-symbol { color: var(--text-2); padding: 0 var(--space-2); }

/* .media-grid → .thumb-grid; .media-item → .thumb */
.media-grid { display: grid; gap: var(--space-2); grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
.media-item { display: inline-flex; align-items: center; justify-content: center; width: 80px; height: 80px; border: var(--border) solid var(--rule); background: var(--bg-soft); overflow: hidden; position: relative; }
.media-item img { width: 100%; height: 100%; object-fit: cover; }

/* .tag-chips / .collection-chips → .chip-list */
.tag-chips, .collection-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.chip--add { border-style: dashed; color: var(--text-2); cursor: pointer; }
.chip--form input { font: inherit; font-family: var(--font-mono); border: 0; background: transparent; outline: none; min-width: 4rem; }

/* .badge → .tag (with status modifiers) */
.badge { display: inline-block; padding: 0 var(--space-2); border: var(--border) solid var(--rule); border-radius: var(--radius-pill); font-size: 0.8rem; background: var(--bg-soft); color: var(--text-2); line-height: 1.6; }
.badge.badge-dark, .badge-dark { background: var(--text); color: var(--bg); border-color: var(--text); }
.badge.badge-blue, .badge-blue { color: var(--info); border-color: var(--info); }
.badge.badge-gray, .badge-gray { color: var(--text-2); border-color: var(--rule); }
.badge.badge-warning, .badge-warning { color: var(--warn); border-color: var(--warn); }
.badge.badge-positive, .badge-positive { color: var(--positive); border-color: var(--positive); }
.badge.badge-negative, .badge-negative { color: var(--negative); border-color: var(--negative); }

/* .error / .success — bare form messages */
.error { color: var(--negative); font-size: 0.9rem; }
.success { color: var(--positive); font-size: 0.9rem; }
.success-message { color: var(--positive); font-weight: 500; font-size: 0.9rem; }
.domain-success { color: var(--positive); font-weight: 500; }
.domain-error { color: var(--negative); font-weight: 500; }
.domain-warning { color: var(--warn); font-weight: 500; }

/* .container — generic content wrapper */
.container { max-width: var(--max-content); margin: 0 auto; padding: var(--space-4); }

/* Media-picker family → .upload primitive (kept as direct CSS for full compat) */
.media-picker, .media-picker-preview, .media-picker-empty {
  display: inline-flex; align-items: center; justify-content: center;
  width: 80px; height: 80px;
  border: var(--border) solid var(--rule); background: var(--bg-soft);
  cursor: pointer; position: relative; overflow: hidden;
  transition: border-color var(--dur-fast) var(--ease);
}
.media-picker:hover, .media-picker-preview:hover, .media-picker-empty:hover { border-color: var(--text); }
.media-picker--logo, .media-picker-preview--logo, .media-picker-empty--logo { width: 160px; height: 48px; }
.media-picker-preview img { width: 100%; height: 100%; object-fit: cover; }
.media-picker-empty { color: var(--text-2); font-size: 0.8rem; flex-direction: column; text-align: center; padding: var(--space-2); }
.media-picker-empty::before { content: "+"; font-size: 1.4rem; font-weight: 600; color: var(--muted); }
.media-picker-icon { color: var(--muted); }
.media-picker-label { font-size: 0.75rem; color: var(--text-2); font-weight: 500; }
.media-picker-row { display: flex; align-items: center; gap: var(--space-2); }
.media-picker-remove {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; padding: 0; border: 0;
  background: rgba(0,0,0,0.55); color: #fff;
  font-size: 12px; line-height: 18px; text-align: center;
  cursor: pointer; opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.media-picker:hover .media-picker-remove,
.media-picker-preview:hover .media-picker-remove { opacity: 1; }

/* .product-image / .variant-thumbnail / .no-image-* → .thumb variants */
.product-image { display: inline-flex; align-items: center; justify-content: center; width: 80px; height: 80px; border: var(--border) solid var(--rule); background: var(--bg-soft); overflow: hidden; }
.product-image img { width: 100%; height: 100%; object-fit: cover; }
.variant-thumbnail { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: var(--border) solid var(--rule); background: var(--bg-soft); overflow: hidden; }
.variant-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.no-image-placeholder, .no-image-small { display: inline-flex; align-items: center; justify-content: center; background-image: linear-gradient(45deg, var(--bg-muted) 25%, transparent 25%, transparent 75%, var(--bg-muted) 75%), linear-gradient(45deg, var(--bg-muted) 25%, transparent 25%, transparent 75%, var(--bg-muted) 75%); background-size: 12px 12px; background-position: 0 0, 6px 6px; color: var(--muted); font-size: 0.75rem; border: var(--border) solid var(--rule); }
.no-image-placeholder { width: 80px; height: 80px; }
.no-image-small { width: 40px; height: 40px; }

/* .sortable / .sortable-item — no-op (data-sortable wires JS; CSS classes are markers) */
.sortable { /* container marker */ }
.sortable-item { /* item marker */ }

/* .chart / .chart-svg / .chart-container — SVG chart wrapper */
.chart, .chart-svg, .chart-container {
  display: block;
  width: 100%;
  max-width: 100%;
  border: var(--border) solid var(--rule-faint);
  background: var(--bg);
  padding: var(--space-2);
}
.chart-svg svg, .chart svg { display: block; width: 100%; height: auto; }

/* .more-actions-menu, .more-actions-dropdown → .menu */
.more-actions-menu, .more-actions-dropdown {
  display: none; position: absolute; z-index: var(--z-overlay);
  background: var(--bg); border: var(--border) solid var(--text);
  box-shadow: var(--shadow-strong); min-width: 10rem;
  padding: var(--space-1) 0; font-size: 0.9rem;
}
.more-actions-menu.open, .more-actions-dropdown.open { display: block; }

/* .message → .notice (bare text feedback) */
.message { font-size: 0.9rem; color: var(--text-2); }
.message.error, .alert-danger { color: var(--negative); font-weight: 500; }
.message.success { color: var(--positive); font-weight: 500; }

/* ── ops-api aliases (in addition to ones above) ──────────── */
.status-bar { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); padding: var(--space-2) var(--space-4); border-bottom: var(--border) solid var(--rule); font-size: 0.85rem; color: var(--text-2); }
.loading { opacity: 0.6; pointer-events: none; cursor: progress; }
.info { color: var(--info); }  /* legacy .info utility */
.net { font-weight: 600; }     /* legacy net-total cell */
.severity { font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.8rem; }
.exclude-link { color: var(--text-2); text-decoration: line-through; }

/* .bar-inline / .bar-fill → .gauge / .fill */
.bar-inline {
  display: block;
  width: 100%;
  height: 4px;
  background: var(--bg-muted);
  margin-bottom: 3px;
  overflow: hidden;
  border: var(--border) solid var(--rule);
}
.bar-fill { display: block; height: 100%; background: var(--text-2); }

/* ── tinycrate aliases (batch 2 — from tenant.css retirement) ──────────
   The 7 tinycrate-specific classes still in use when tenant.css was
   removed. Everything else in tenant.css was already covered by the
   aliases above, or was dead CSS. Sunset with the rest in v2. */

/* .primary → primary action button (accent fill). tinycrate markup uses
   .primary; press's own primary is .button.commit. */
.primary {
  margin-top: 0.8rem;
  padding: 6px 18px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-weight: 600;
  cursor: pointer;
}
.primary:hover { background: color-mix(in srgb, var(--accent) 86%, #000); }

/* img.hero → storefront hero image */
img.hero { width: 100%; height: auto; border-radius: var(--radius); }

/* .accordion-expansion → expandable detail row inside a ledger/product-edit
   table (admin sortable accordion). */
.ledger tbody tr.accordion-expansion td,
.ledger tbody tr.accordion-expansion th,
.product-edit tbody tr.accordion-expansion td,
.product-edit tbody tr.accordion-expansion th { border-top: var(--border) dashed var(--rule-soft); }

/* .collection-posts-table → nested post table: no inner borders except
   solid separators between rows. */
.ledger .collection-posts-table tbody tr th,
.ledger .collection-posts-table tbody tr td,
.product-edit .collection-posts-table tbody tr th,
.product-edit .collection-posts-table tbody tr td { border-top: none; border-bottom: none; }
.ledger .collection-posts-table tbody tr + tr th,
.ledger .collection-posts-table tbody tr + tr td,
.product-edit .collection-posts-table tbody tr + tr th,
.product-edit .collection-posts-table tbody tr + tr td { border-top: var(--border) solid var(--rule-soft); }

/* .tab-content → simple show/hide tab panels (tinycrate's tab system) */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* .code-block → fenced code / preformatted block */
.code-block {
  background-color: var(--bg-muted);
  padding: var(--space-2);
  border-radius: var(--radius);
  margin: var(--space-2) 0;
  font-family: var(--font-mono);
}

/* .smart-no-drop → drag overlay marking an illegal drop target
   ("Action not allowed"). Created by tinycrate's admin sortable JS. */
.smart-no-drop {
  position: absolute;
  inset: 0;
  background-color: color-mix(in srgb, var(--negative) 8%, var(--bg));
  background-image: radial-gradient(circle, color-mix(in srgb, var(--negative) 30%, transparent) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
  border: 2px dashed color-mix(in srgb, var(--negative) 40%, transparent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--negative);
  font-size: 0.8em;
  font-weight: 700;
  pointer-events: none;
  z-index: var(--z-raised);
}

/* Form elements don't inherit font by default (UA styles). Make bare
   <input>/<button>/<select>/<textarea> use the page font like .input/.button do. */
input, button, select, textarea { font: inherit; }

/* Bare form fields inside ledger/product-edit tables. tinycrate uses bare
   <input>/<select>/<textarea> (no .input class) in its spreadsheet-style
   product tables, so give them the press input look here. */
.ledger input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
.ledger select,
.ledger textarea,
.product-edit input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
.product-edit select,
.product-edit textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-family: var(--font-mono);
  padding: var(--space-1) var(--space-2);
  border: var(--border) solid var(--text);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-inset);
}
.ledger input:focus, .ledger select:focus, .ledger textarea:focus,
.product-edit input:focus, .product-edit select:focus, .product-edit textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Links inside those tables */
.ledger a, .product-edit a { text-decoration: none; font-weight: 500; color: var(--link); }
.ledger a:hover, .product-edit a:hover { text-decoration: underline; }

/* Bare <input> inside an .input-group (tinycrate uses a bare input + addon,
   not .input). Declared after the rule above so it wins for grouped inputs. */
.input-group input:not([type="checkbox"]):not([type="radio"]) {
  border-radius: var(--radius) 0 0 var(--radius);
  border-right: 0;
  flex: 1 1 auto;
  min-width: 0;
}
