/* Papa Steve's Master Dashboard — Operator Prototype
   Style: Porcelain light theme (Steve, 2026-07-07: "dark theme is depressing"
   -- same cool-navy hue family and semantic multi-hue grammar as Onyx, on
   white surfaces; the Onyx dark values live in git history).
   Token shim: --ps-* tokens drive all --color-* tokens via HSL composition. */

:root, [data-theme="light"], [data-theme="dark"] {
  color-scheme: light;
  /* --ps-* token layer (HSL triplets) — Paper theme (2026-07-12):
     warm off-white paper ground, ink text, green-deep primary, and a
     colored flavor-inspired chart palette. Steve's asks: color separation
     between domains + charts must carry color, not monotone. */
  --ps-background: 45 40% 98%;    /* paper #FCFBF8 */
  --ps-foreground: 40 14% 12%;    /* ink #24211B */
  --ps-border: 40 14% 12%;        /* hairline base — used with alpha */
  --ps-card: 0 0% 100%;           /* raised card #FFFFFF */
  --ps-card-2: 42 37% 93%;        /* band/inset #F4F0E7 */
  --ps-card-border: 40 14% 12%;   /* divider base — used with alpha */
  --ps-primary: 93 53% 31%;       /* green-deep #4C7A26 */
  --ps-primary-foreground: 0 0% 100%;
  --ps-muted: 42 37% 93%;         /* band as muted surface */
  --ps-muted-foreground: 39 12% 33%; /* muted text #5E574A (darkened for readability) */
  --ps-faint: 40 11% 47%;         /* faint #857D6C (darkened for readability) */
  --ps-accent: 38 42% 91%;        /* kraft-soft neutral accent surface */
  --ps-status-success: 91 47% 44%;  /* #6FA53C */
  --ps-status-warning: 37 61% 43%;  /* caramel #B07D2B */
  --ps-status-error: 6 63% 46%;     /* #C0392B */
  --ps-status-info: 216 38% 47%;    /* blueberry #4A6FA5 */
  --ps-purple: 267 30% 50%;         /* plum #7D5BA6 */
  --ps-pink: 348 43% 50%;           /* cherry #B5485D */
  --ps-kraft: 37 30% 58%;           /* kraft accent #B49B73 */

  /* Surfaces — Film Tracker warm dark */
  --color-bg: hsl(var(--ps-background));
  --color-surface: hsl(var(--ps-card));
  --color-surface-2: hsl(var(--ps-card-2));
  --color-surface-offset: hsl(var(--ps-muted));
  --color-surface-elevated: hsl(var(--ps-card-2));
  --color-divider: hsl(var(--ps-card-border) / 0.08);
  --color-border: hsl(var(--ps-border) / 0.10);
  --color-border-strong: hsl(var(--ps-border) / 0.18);

  /* Text */
  --color-text: hsl(var(--ps-foreground));
  --color-text-muted: hsl(var(--ps-muted-foreground));
  --color-text-faint: hsl(var(--ps-faint));
  --color-text-inverse: hsl(var(--ps-primary-foreground));

  /* Primary (green-deep) */
  --color-primary: hsl(var(--ps-primary));
  --color-primary-hover: hsl(93 53% 25%);
  --color-primary-soft: hsl(84 43% 93%);   /* #EFF5E6 */
  /* Secondary data-series accent (plum) — charts only, never buttons:
     keeps the dual-chart sessions line and gradient tails distinguishable
     from the green primary series (multi-hue grammar). */
  --color-accent: hsl(var(--ps-purple));
  /* Kraft secondary accent — chips, highlights, Supply-Chain section bar. */
  --color-kraft: hsl(var(--ps-kraft));
  --color-kraft-soft: hsl(38 42% 91%);      /* #F2EBDF */

  /* States */
  --color-success: hsl(var(--ps-status-success));
  --color-success-soft: hsl(84 43% 93%);    /* soft green */
  --color-warning: hsl(var(--ps-status-warning));
  --color-warning-soft: hsl(41 64% 92%);    /* #F8F0DF */
  --color-error: hsl(var(--ps-status-error));
  --color-error-soft: hsl(11 63% 95%);      /* #FAECE9 */
  --color-info: hsl(var(--ps-status-info));
  --color-info-soft: hsl(212 45% 94%);      /* #EAF0F7 */

  /* Legacy aliases — some pages (index.html cost/QB tiles, marketing planner)
     reference the older short token names. These were never defined in the
     Porcelain palette, so those uses silently fell back to hardcoded dark-era
     hexes (or rendered uncolored). Alias them to the real semantic tokens so
     every consumer heals without hunting each inline call site. */
  --color-warn: var(--color-warning);
  --color-ok: var(--color-success);
  --color-positive: var(--color-success);
  --color-text-subtle: var(--color-text-muted);
  /* --border was an undefined short alias (post-performance, film-tracker, …)
     that fell back to the old dark #2a2f3a — a dark divider on the light theme. */
  --border: var(--color-border);

  /* Data viz palette — flavor-inspired, all tested legible on paper ground */
  --chart-1: hsl(91 47% 44%);    /* green #6FA53C */
  --chart-2: hsl(216 38% 47%);   /* blueberry #4A6FA5 */
  --chart-3: hsl(348 43% 50%);   /* cherry #B5485D */
  --chart-4: hsl(37 61% 43%);    /* caramel #B07D2B */
  --chart-5: hsl(30 36% 35%);    /* mocha #7B5B3A */
  --chart-6: hsl(267 30% 50%);   /* plum #7D5BA6 */

  /* Shadows — paper (soft, warm ink) */
  --shadow-sm: 0 1px 2px rgba(36, 33, 27, 0.05);
  --shadow-md: 0 1px 2px rgba(36, 33, 27, 0.05), 0 6px 20px rgba(36, 33, 27, 0.07);
  --shadow-lg: 0 2px 6px rgba(36, 33, 27, 0.06), 0 12px 32px rgba(36, 33, 27, 0.10);

  /* Radius — paper cards read at 12px */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;

  /* Type */
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 17px;
  --text-xl: 22px;
  --text-2xl: 28px;
  --text-3xl: 36px;

  /* Spacing — 4px base */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;

  /* Layout */
  --sidebar-w: 232px;
  --header-h: 52px;
  --transition: 160ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Paper theme fonts (2026-07-12): Avenir Next body + Avenir Next Condensed
     display, matching the approved paper prototype. Avenir ships on macOS/iOS;
     Arial Narrow covers the condensed display fallback on Windows. */
  --font-body: "Avenir Next", Avenir, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: "Avenir Next Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
}

/* (legacy data-theme="dark" block removed — Film Tracker tokens now apply to both light and dark via :root) */

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font: inherit; color: inherit; }

/* ------- App shell ------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  height: 100dvh;
}

/* Sidebar */
.sidebar {
  grid-row: 1 / -1;
  background: var(--color-surface-2);
  border-right: 1px solid var(--color-divider);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--s-4);
  border-bottom: 1px solid var(--color-divider);
}

.brand-logo {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--color-primary);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-text .name { font-weight: 700; font-size: 13px; letter-spacing: -0.01em; }
.brand-text .sub  { font-size: 10px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.nav {
  flex: 1;
  padding: var(--s-3) var(--s-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
  padding: var(--s-3) var(--s-3) var(--s-1);
  font-weight: 600;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--color-text);
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.nav a:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

.nav a.active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: 600;
}

/* Hover must win over .active. Both selectors otherwise tie on specificity
   (0,2,1) and .active, declared later, swallows the hover band — so the
   current page's nav row (e.g. Shopify on shopify.html, EDI on edi.html)
   gave no hover feedback while every other row did. This guarantees an
   identical full-row band + ink text on hover for every nav item. */
.nav a.active:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

.nav a svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke-width: 1.8;
}

/* Sidebar pills: quiet blue chips (Onyx grammar — like its PCIe/pstate
   chips), not amber shouting; danger counts keep the red semantic. */
.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-soft);
  color: var(--color-primary);
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  min-width: 18px;
  text-align: center;
}

.nav-badge.danger { background: var(--color-error); color: hsl(0 0% 100%); }

.sidebar-footer {
  padding: var(--s-3);
  border-top: 1px solid var(--color-divider);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-kraft), var(--color-primary));
  color: white;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 11px;
  flex-shrink: 0;
}

/* Top bar */
.topbar {
  grid-column: 2;
  display: flex;
  align-items: center;
  padding: 0 var(--s-5);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
  gap: var(--s-5);
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-muted);
}
.crumbs .sep { color: var(--color-text-faint); }
.crumbs .current { color: var(--color-text); font-weight: 600; }

.search {
  flex: 1;
  max-width: 360px;
  position: relative;
}
.search input {
  width: 100%;
  height: 30px;
  padding: 0 10px 0 30px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--color-text);
  caret-color: var(--color-text);
}
.search input::placeholder { color: var(--color-text-faint); }
.search input:focus { outline: 2px solid var(--color-primary); outline-offset: -1px; border-color: var(--color-primary); }
.search input::selection { background: var(--color-primary-soft); color: var(--color-text); }
.search svg {
  position: absolute;
  left: 9px;
  top: 7px;
  width: 14px;
  height: 14px;
  color: var(--color-text-faint);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  color: var(--color-text-muted);
  transition: var(--transition);
}
.icon-btn:hover { background: var(--color-surface-offset); color: var(--color-text); }
.icon-btn svg { width: 16px; height: 16px; stroke-width: 1.8; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--color-success-soft);
  color: var(--color-success);
}
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Main */
.main {
  grid-column: 2;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--s-5) var(--s-6) var(--s-12);
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: var(--s-5);
  gap: var(--s-4);
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.15;
}
.page-header .subtitle {
  margin-top: 3px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.page-actions {
  display: flex;
  gap: var(--s-2);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  color: var(--color-text);
}
.btn:hover { background: var(--color-surface-offset); border-color: var(--color-border-strong); }
.btn svg { width: 13px; height: 13px; }
.btn.primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}
.btn.primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }

/* KPI tiles */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}

.kpi {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
  overflow: hidden;
}

.kpi-label {
  font-size: 11px;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.kpi-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums lining-nums;
}

.kpi-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
}
.delta.up { color: var(--color-success); background: var(--color-success-soft); }
.delta.down { color: var(--color-error); background: var(--color-error-soft); }
.delta.flat { color: var(--color-text-muted); background: var(--color-surface-offset); }

.kpi-sparkline {
  position: absolute;
  right: 12px;
  top: 14px;
  width: 60px;
  height: 22px;
  overflow: hidden;
}
/* The canvas buffer is sized by JS from a rect measured at load; if that
   happens before styles apply, the buffer is huge. CSS-clamp the element so
   the drawing always renders inside the 60x22 wrapper regardless. */
.kpi-sparkline canvas { width: 100% !important; height: 100% !important; display: block; }

/* Grid layouts */
.row {
  display: grid;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}
.row.r-2 { grid-template-columns: 2fr 1fr; }
.row.r-3 { grid-template-columns: 1fr 1fr 1fr; }
.row.r-eq2 { grid-template-columns: 1fr 1fr; }

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--color-divider);
}
.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-subtle {
  font-size: 11px;
  color: var(--color-text-muted);
}

.card-body { padding: var(--s-4); }
.card-body.tight { padding: 0; }

/* Table */
.table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums lining-nums;
}
.table thead th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  padding: var(--s-2) var(--s-4);
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-divider);
  position: sticky;
  top: 0;
  z-index: 1;
}
.table tbody td {
  padding: 10px var(--s-4);
  border-bottom: 1px solid var(--color-divider);
}
.table tbody tr:hover { background: var(--color-surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
/* Numeric columns: header, sort button, and cells all right-align on the
   same edge (th.num was never aligned — every numeric header sat left of
   its own data), and figures stay tabular so digits line up vertically. */
.table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table thead th.num { text-align: right; }
.table thead th.num .th-sort { width: 100%; text-align: right; }
.table td.mono { font-family: var(--font-mono); font-size: 11px; }
/* Quiet placeholder for source-gap values ("—"): visible but subordinate,
   full story lives in the cell tooltip + the legend under the table. */
.table .metric-gap { color: var(--color-text-muted); opacity: .7; cursor: help; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 9px;
  border-radius: 999px;
}
.badge.ok { background: var(--color-success-soft); color: var(--color-success); }
.badge.warn { background: var(--color-warning-soft); color: var(--color-warning); }
.badge.err { background: var(--color-error-soft); color: var(--color-error); }
.badge.info { background: var(--color-info-soft); color: var(--color-info); }
.badge.neutral { background: var(--color-surface-offset); color: var(--color-text-muted); }
.badge .d { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* Tabular figures everywhere numbers carry meaning (paper-theme parity). */
.num { font-variant-numeric: tabular-nums; }

/* Chart container */
.chart-wrap {
  position: relative;
  padding: var(--s-4);
}
.chart-wrap canvas { max-width: 100%; }

/* Stat list (right-rail tiles) */
.statlist { display: flex; flex-direction: column; }
.statlist-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px var(--s-4);
  border-bottom: 1px solid var(--color-divider);
  font-size: 12px;
}
.statlist-row:last-child { border-bottom: 0; }
.statlist-row .lbl { color: var(--color-text-muted); }
.statlist-row .val { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Progress */
.progress {
  height: 6px;
  background: var(--color-surface-offset);
  border-radius: 100px;
  overflow: hidden;
  position: relative;
}
.progress .bar {
  height: 100%;
  background: var(--color-primary);
  border-radius: 100px;
  transition: width var(--transition);
}
.progress .bar.warn { background: var(--color-warning); }
.progress .bar.err { background: var(--color-error); }
.progress .bar.ok { background: var(--color-success); }

/* Source pill — for AI/Perplexity callouts */
.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 100px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: 600;
}

/* Footer / data freshness strip */
.freshness {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-4);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: var(--s-5);
}
.freshness .src {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.freshness .src .d {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-text-muted, #999);
}
.freshness .src .d.ok { background: var(--color-success, #10b981); }
.freshness .src .d.warn { background: var(--color-warning, #b45309); }
.freshness .src .d.err { background: var(--color-error, #dc2626); }

/* System Status Cards (replaces legacy .freshness rows) */
.ss-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md, 8px);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  transition: border-color 0.25s;
}
.ss-card.ss-up   { border-left: 3px solid var(--color-success, #10b981); }
.ss-card.ss-warn { border-left: 3px solid var(--color-warning, #f59e0b); }
.ss-card.ss-down { border-left: 3px solid var(--color-error, #dc2626); }
.ss-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-text-muted, #888);
  margin-bottom: 2px;
  transition: background 0.25s;
}
.ss-card.ss-up   .ss-indicator { background: var(--color-success, #10b981); box-shadow: 0 0 6px var(--color-success, #10b981); }
.ss-card.ss-warn .ss-indicator { background: var(--color-warning, #f59e0b); }
.ss-card.ss-down .ss-indicator { background: var(--color-error, #dc2626); box-shadow: 0 0 6px var(--color-error, #dc2626); }
.ss-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ss-detail {
  font-size: 10px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ss-card.ss-down .ss-detail { color: var(--color-error, #dc2626); font-weight: 600; }

/* Clickable KPI tile */
.kpi[onclick] {
  cursor: pointer;
}
.kpi[onclick]:hover {
  background: var(--color-surface-2);
  border-color: var(--color-primary);
}

/* Architecture diagram */
.arch-canvas {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--s-6);
  position: relative;
}

.arch-svg { width: 100%; height: auto; display: block; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  padding: var(--s-4);
  border-top: 1px solid var(--color-divider);
  margin-top: var(--s-4);
  font-size: 12px;
}
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-swatch { width: 14px; height: 14px; border-radius: 3px; }
.legend-line { width: 22px; height: 2px; }
.legend-line.dashed {
  background: repeating-linear-gradient(to right, var(--color-text-muted) 0 4px, transparent 4px 8px);
}

/* Detail callouts for arch page */
.arch-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
  margin-top: var(--s-5);
}
.arch-info-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--s-4);
}
.arch-info-card h3 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.arch-info-card p {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.55;
}
.arch-info-card ul {
  margin-top: 8px;
  padding-left: 16px;
  font-size: 12px;
  color: var(--color-text-muted);
}
.arch-info-card ul li { margin-bottom: 3px; }
.arch-info-card .tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.arch-info-card .tag.primary { background: var(--color-primary-soft); color: var(--color-primary); }
.arch-info-card .tag.amber { background: var(--color-warning-soft); color: var(--color-warning); }
.arch-info-card .tag.maroon { background: var(--color-error-soft); color: var(--color-error); }

/* Empty / placeholder pages */
.stub {
  padding: var(--s-12);
  text-align: center;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}
.stub h2 { font-size: 17px; margin-bottom: 8px; }
.stub p { color: var(--color-text-muted); font-size: 13px; max-width: 480px; margin: 0 auto; }

/* Inline mini chart cells inside tables */
.cell-spark { width: 80px; height: 18px; vertical-align: middle; }

/* Risk score */
.risk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.risk .dot { width: 8px; height: 8px; border-radius: 50%; }
.risk.low .dot { background: var(--color-success); }
.risk.med .dot { background: var(--color-warning); }
.risk.high .dot { background: var(--color-error); }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .row.r-2, .row.r-3, .row.r-eq2 { grid-template-columns: 1fr; }
}

/* Degraded-mode banner shown via #degraded-tag when one or more Airtable tiles fail.
   Per-tile stale flagging requires per-key error mapping; intentionally not applied here. */

/* ---------------- Todoist Operations tasks panel ---------------- */
.todoist-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 520px;
  overflow-y: auto;
}
.todoist-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 13px;
}
.td-task {
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.td-task-overdue {
  border-color: var(--color-error);
  background: var(--color-error-soft);
}
.td-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.td-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--color-text);
  text-decoration: none;
  flex: 1;
  line-height: 1.35;
}
.td-title:hover { text-decoration: underline; }
.td-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.td-desc {
  font-size: 12.5px;
  color: var(--color-text-muted);
  line-height: 1.45;
  white-space: pre-wrap;
}
.td-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 11.5px;
  flex-wrap: wrap;
}
.td-due {
  color: var(--color-text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.td-due-overdue {
  color: var(--color-error);
  font-weight: 600;
}
.td-labels {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.td-label {
  display: inline-block;
  padding: 2px 7px;
  font-size: 11px;
  border-radius: 10px;
  background: var(--color-info-soft);
  color: var(--color-info);
  border: 1px solid hsl(var(--ps-status-info) / 0.25);
}

/* ---------------- Paper-theme section-header domain accents ----------------
   Set the left accent-bar color per Overview domain (Steve's "color
   separation between things"). Applied alongside .ov-section in index.html;
   reusable on any page that adopts the same header treatment. */
.sec-prod       { --sec-accent-color: var(--color-primary); }  /* Production — green */
.sec-supply     { --sec-accent-color: var(--color-kraft); }    /* Supply Chain — kraft */
.sec-financial  { --sec-accent-color: var(--color-info); }     /* Financial — blueberry */
.sec-compliance { --sec-accent-color: var(--chart-3); }        /* Compliance — cherry */
.sec-marketing  { --sec-accent-color: var(--color-accent); }   /* Marketing — plum */

/* Role-gated elements hidden by auth-gate.js — collapse without layout shift */
.role-hidden {
  display: none !important;
}
/* Prevent CLS: body is hidden until auth resolves, so no flash of hidden rows */

/* --- Editorial register (2026-07-19) ---------------------------------------
   Steve: OPS pages read denser than the paper prototype. Same palette, lifted
   type/spacing register — scoped to body.paper-editorial so the Phone floor
   pages (which share this sheet) keep their compact scale and JetBrains mono. */
body.paper-editorial { line-height: 1.55; --font-mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace; }
body.paper-editorial .main { padding: 34px 46px 100px; }
body.paper-editorial .page-header { margin-bottom: 30px; }
body.paper-editorial .page-header h1 { font-size: 33px; letter-spacing: 0.015em; }
body.paper-editorial .page-header .subtitle { font-size: 14.5px; line-height: 1.55; max-width: 68ch; }
body.paper-editorial .card { border-radius: 14px; box-shadow: 0 1px 2px rgba(36, 33, 27, 0.04), 0 6px 22px rgba(36, 33, 27, 0.05); }
body.paper-editorial .card-body { padding: 20px 22px; }
