/* ============================================================
   ZEROWATT DIGITAL BRAIN — Design System
   SEIL Nellore Phase-2 · 660 MW Supercritical
   ============================================================ */

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* === SELF-HOSTED FONTS (no CDN — renders on the firewalled / air-gapped SEIL network) ===
   woff2 files live in /static/fonts/. Replaces the Google Fonts CDN links that were
   unreachable on the SEIL network (icons fell back to their ligature names as text). */
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/static/fonts/inter-variable.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono'; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url('/static/fonts/jetbrains-mono-variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Material Symbols Outlined'; font-style: normal; font-weight: 100 700; font-display: block;
  src: url('/static/fonts/material-symbols-outlined.woff2') format('woff2');
}

/* === ICON FONT SHIM ===
   The templates use the class `.material-icons-outlined` everywhere, but we now load
   the maintained "Material Symbols Outlined" superset (see base.html). Map the legacy
   class onto that font so every legacy ligature still resolves AND newer glyphs
   (vital_signs, monitor_heart, join_inner, monitoring) render instead of breaking the
   layout. Per-element font-size rules elsewhere still win over the 24px default. */
.material-icons-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal; font-style: normal; font-size: 24px; line-height: 1;
  letter-spacing: normal; text-transform: none; display: inline-block;
  white-space: nowrap; word-wrap: normal; direction: ltr;
  -webkit-font-feature-settings: 'liga'; -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* === TOKENS ===
   "Engineered Precision" modern design system. Token VALUES restyled (every
   name kept so the ~31 templates that reference var(--…) keep resolving); new
   tokens added (--accent*, --surface, --on-* status text, faint tints). One
   disciplined accent (deep technical blue) owns all interactive surfaces; tiles
   float by shadow not borders; status colour is rationed to genuine severity. */
:root {
  /* Surface — cool near-white canvas; white panels separate by a crisp 1px
     border (HMI-light re-skin, aligned to the SEIL wall-mockup palette). */
  --bg: #E8EDF3;
  --card: #FFFFFF;
  --surface: #FFFFFF;
  --card-hover: #F8FBFE;
  --surface-raised: #F1F5FA;    /* panel/card header strip */
  --surface-sunken: #EEF3F9;    /* table header strip */

  /* Text — mockup ink ramp */
  --text-primary: #16202E;
  --text-secondary: #52617A;
  --text-tertiary: #8794A8;
  --text-inverse: #FFFFFF;

  /* Borders — visible hairlines (panels are bordered, not shadow-only) */
  --border: #CCD5E0;
  --border-light: #DCE3EC;
  --border-strong: #B9C4D2;

  /* Brand == the single accent (HMI deep blue) */
  --brand: #1761C4;
  --brand-dark: #114E9E;
  --brand-light: #E7F0FB;
  --accent: #1761C4;
  --accent-dark: #114E9E;
  --accent-light: #E7F0FB;

  /* Status hues — mockup palette */
  --green: #1F9D57;
  --green-bg: #E7F6ED;
  --green-light: #F2FAF6;
  --amber: #D08400;
  --amber-bg: #FDF3DF;
  --amber-light: #FCF7EC;
  --red: #D23B3B;
  --red-bg: #FCE9E9;
  --red-light: #FCF1F1;
  --orange: #D9590C;
  --orange-bg: #FBE7D8;
  --orange-light: #FCF4EE;
  --purple: #6E47D6;
  --purple-bg: #EEE9FB;
  --purple-light: #F7F4FE;
  --teal: #0C8AA6;
  --teal-bg: #DBF0F4;
  --blue: #1761C4;             /* == accent so blue actions stop competing */
  --blue-bg: #E7F0FB;
  --blue-light: #F4F8FE;
  --blue-dark: #114E9E;

  /* On-tint status TEXT — each verified >= 4.5:1 on its faint wash above */
  --on-green: #146B3C;
  --on-amber: #8A5600;
  --on-red: #A12A2A;
  --on-orange: #9A3F08;
  --on-purple: #5232A8;
  --on-blue: #114E9E;
  --on-teal: #0A5E72;

  /* Layout */
  --sidebar-width: 240px;
  --topbar-height: 60px;
  --sidebar-bg: #0B1220;
  --sidebar-hover: #141C2E;
  --sidebar-active: rgba(29,111,224,.16);

  /* Shape — softer, modern radii ladder */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadow — soft, neutral, layered (one border OR one shadow per surface) */
  --shadow-sm: 0 1px 2px rgba(14,23,38,.05);
  --shadow: 0 1px 3px rgba(14,23,38,.06), 0 1px 2px rgba(14,23,38,.04);
  --shadow-md: 0 4px 12px -2px rgba(14,23,38,.08), 0 2px 6px -2px rgba(14,23,38,.05);
  --shadow-lg: 0 12px 28px -6px rgba(14,23,38,.12), 0 6px 12px -6px rgba(14,23,38,.06);

  /* Motion */
  --t: .15s cubic-bezier(.2,.6,.2,1);

  /* Type */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

/* === BASE === */
html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  min-height: 100vh;
  line-height: 1.5;
}

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #2D7BE8, #1559BE);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
}
.sidebar-logo-text { font-size: 15px; font-weight: 800; color: #FFFFFF; letter-spacing: .3px; }
.sidebar-plant { font-size: 10px; color: #64748B; padding: 8px 20px; line-height: 1.4; border-bottom: 1px solid rgba(255,255,255,.04); }

/* Unit Toggle */
.sidebar-unit { padding: 12px 20px; }
.unit-toggle { display: flex; background: rgba(255,255,255,.06); border-radius: 10px; padding: 3px; gap: 3px; }
.unit-btn {
  flex: 1;
  padding: 8px 0;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #94A2B8;
  cursor: pointer;
  border: none;
  background: none;
  border-radius: 7px;
  transition: background var(--t), color var(--t);
  letter-spacing: .5px;
}
.unit-btn:hover { color: #C9D3E3; }
.unit-btn.active { background: var(--accent); color: #FFFFFF; box-shadow: 0 1px 2px rgba(0,0,0,.25); }

/* Nav Sections */
.sidebar-section {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: rgba(148,162,184,.55);
  padding: 20px 20px 6px;
  text-transform: uppercase;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 9px;
  /* tightened 11 Jun 2026 review — full tab list must fit without scrolling */
  padding: 5.5px 14px;
  margin: 1px 8px;
  border-radius: 8px;
  color: #94A2B8;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.sidebar-item:hover { background: var(--sidebar-hover); color: #C9D3E3; }
.sidebar-item.active {
  background: var(--sidebar-active);
  color: #FFFFFF;
  font-weight: 600;
}
.sidebar-item .material-icons-outlined { font-size: 18px; opacity: .7; }
.sidebar-item.active .material-icons-outlined { opacity: 1; }

/* === MAIN CONTENT === */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top Bar — frosted glass, sticky */
.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
/* Solid fallback for browsers without backdrop-filter support */
@supports not (backdrop-filter: blur(1px)) {
  .topbar { background: #FFFFFF; }
}
.topbar-title { font-size: 14px; font-weight: 700; letter-spacing: -.1px; color: var(--text-primary); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: .3px;
}
.topbar-time { font-size: 11px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }

/* === PAGE CONTAINER === */
.page-container { padding: 24px; flex: 1; }

/* Page Header */
.page-header { margin-bottom: 22px; }
.page-header h1 { font-size: 26px; font-weight: 800; color: var(--text-primary); letter-spacing: -.4px; line-height: 1.2; }
.page-header .subtitle { font-size: 13.5px; color: var(--text-secondary); margin-top: 5px; padding-left: 13px; }

/* === GRIDS === */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.grid-8 { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; }
.gap-sm { gap: 10px; }
.gap-xs { gap: 6px; }
.mb-sm { margin-bottom: 12px; }
.mb { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }

/* === CARDS === */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 15px; font-weight: 700; letter-spacing: -.1px; }
.card-body { padding: 20px; }
.card-body-flush { padding: 0; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border-light); background: var(--surface-raised); }

/* Card variants — intentional severity headers: a single 3px top edge */
.card-accent { border-top: 3px solid var(--accent); }
.card-ok { border-top: 3px solid var(--green); }
.card-warn { border-top: 3px solid var(--amber); }
.card-danger { border-top: 3px solid var(--red); }
.card-alert-left { border-left: 3px solid var(--red); }

/* === KPI STRIP === */
.kpi-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; margin-bottom: 20px; }
/* NEUTRAL tile — no coloured top stripe; floats by shadow. State lives in a
   small status dot / coloured value, set by the .green/.amber/... modifiers. */
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 4px solid var(--border-strong);   /* mockup tile: status top-edge */
  border-radius: var(--radius-sm);
  padding: 14px 18px 16px;
  box-shadow: var(--shadow-sm);
  min-height: 96px;
}
/* Status now reads as a coloured TOP EDGE (mockup tile), plus the dot/value tint. */
.kpi-card.green  { border-top-color: var(--green); }
.kpi-card.amber  { border-top-color: var(--amber); }
.kpi-card.red    { border-top-color: var(--red); }
.kpi-card.purple { border-top-color: var(--purple); }
.kpi-card.teal   { border-top-color: var(--teal); }
.kpi-card.green .kpi-dot { background: var(--green); }
.kpi-card.amber .kpi-dot { background: var(--amber); }
.kpi-card.red .kpi-dot { background: var(--red); }
.kpi-card.purple .kpi-dot { background: var(--purple); }
.kpi-card.teal .kpi-dot { background: var(--teal); }
.kpi-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--accent); }
.kpi-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: var(--text-tertiary);
  font-weight: 700;
  margin-bottom: 8px;
}
.kpi-value { font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -.8px; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.kpi-unit { font-size: 15px; font-weight: 700; color: var(--text-secondary); }
.kpi-status { font-size: 10px; margin-top: 6px; font-weight: 600; }
.kpi-status.ok { color: var(--green); }
.kpi-status.warn { color: var(--amber); }
.kpi-status.bad { color: var(--red); }

/* === METRIC CARDS === */
.metric-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.metric-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.metric-label { font-size: 10.5px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .6px; }
.metric-value { font-size: 27px; font-weight: 700; letter-spacing: -.6px; color: var(--text-primary); margin: 4px 0; font-variant-numeric: tabular-nums; }
.metric-sub { font-size: 11px; color: var(--text-tertiary); }

/* === STAT ROW === */
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.stat-row:last-child { border-bottom: none; }
.stat-label { color: var(--text-secondary); }
.stat-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-value.ok { color: var(--green); }
.stat-value.warn { color: var(--amber); }
.stat-value.bad { color: var(--red); }

/* === BADGE === */
.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: .3px;
  line-height: 1.3;
}
.badge-green { background: var(--green-bg); color: var(--on-green); }
.badge-amber { background: var(--amber-bg); color: var(--on-amber); }
.badge-red { background: var(--red-bg); color: var(--on-red); }
.badge-blue { background: var(--blue-bg); color: var(--on-blue); }
.badge-purple { background: var(--purple-bg); color: var(--on-purple); }
.badge-live { background: var(--green); color: white; }
.badge-alert { background: var(--red); color: white; animation: pulse-badge 2s infinite; }
@keyframes pulse-badge { 0%,100% { box-shadow: 0 0 4px rgba(214,51,51,.25); } 50% { box-shadow: 0 0 10px rgba(214,51,51,.35); } }

/* === ZEROWATT BRAIN INSIGHT (the AI insight panel: hero metric · headline · cause-chain chips · action pill) === */
.brain-insight {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(14,23,38,.06), 0 8px 24px -8px rgba(29,111,224,.18);
  overflow: hidden;
}
.brain-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  background: linear-gradient(90deg, var(--accent-light), transparent 70%);
  border-bottom: 1px solid var(--border-light);
}
.brain-head > .material-icons-outlined { font-size: 18px; color: var(--accent-dark); }
.brain-title { font-size: 15px; font-weight: 700; color: var(--text-primary); letter-spacing: -.1px; }
.brain-live {
  font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px;
  color: var(--on-green); background: var(--green-bg);
  padding: 2px 7px; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 4px;
}
.brain-live::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); animation: pulse-badge 2s infinite;
}
.brain-meta {
  margin-left: auto; font-size: 11px; color: var(--text-tertiary);
  font-weight: 600; display: inline-flex; align-items: center; gap: 5px;
}

.brain-grid { display: flex; flex-direction: column; }
.brain-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-left: 3px solid var(--text-tertiary);
  border-bottom: 1px solid var(--border-light);
}
.brain-row:last-child { border-bottom: none; }
.brain-row.sev-HIGH { border-left-color: var(--red); }
.brain-row.sev-MED  { border-left-color: var(--amber); }
.brain-row.sev-INFO { border-left-color: var(--accent); }

.brain-metric { text-align: center; }
.brain-metric .num {
  font-size: 30px; font-weight: 700; line-height: 1;
  letter-spacing: -.8px; font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.brain-row.sev-HIGH .brain-metric .num { color: var(--red); }
.brain-row.sev-MED  .brain-metric .num { color: var(--amber); }
.brain-row.sev-INFO .brain-metric .num { color: var(--accent); }
.brain-metric .unit {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .4px; color: var(--text-tertiary); margin-top: 3px;
}

.brain-mid { min-width: 0; }
.brain-headline { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 7px; }
.brain-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.brain-chip {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  background: var(--surface-raised); border: 1px solid var(--border);
  padding: 3px 9px; border-radius: 8px; white-space: nowrap;
}
.brain-arrow { color: var(--text-tertiary); font-size: 12px; }

.brain-act {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--accent-dark);
  background: var(--accent-light);
  padding: 8px 14px; border-radius: 999px; white-space: nowrap;
}
.brain-act > .material-icons-outlined { font-size: 15px; }

/* Stack each insight row on narrow viewports so nothing collapses to raw text */
@media (max-width: 720px) {
  .brain-row { grid-template-columns: 1fr; gap: 8px; }
  .brain-metric { text-align: left; display: flex; align-items: baseline; gap: 8px; }
  .brain-metric .unit { margin-top: 0; }
  .brain-act { justify-self: start; }
}

/* === PARAM TILE === */
.param-tile {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.param-tile-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-tertiary); font-weight: 600; margin-bottom: 4px; }
.param-tile-value { font-size: 22px; font-weight: 700; line-height: 1; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.param-tile-unit { font-size: 10px; color: var(--text-tertiary); }
.param-tile-design { font-size: 10px; color: var(--text-tertiary); margin-top: 4px; display: flex; justify-content: space-between; }
.param-tile-delta { font-weight: 700; }
.delta-ok { color: var(--green); }
.delta-warn { color: var(--amber); }
.delta-bad { color: var(--red); }

/* Status dot in param tile */
.param-tile-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-left: 6px; }

/* === CHART CONTAINER === */
.chart-container { position: relative; width: 100%; }
.chart-sm { height: 200px; }
.chart-md { height: 320px; }
.chart-lg { height: 450px; }
.chart-xl { height: 560px; }
.chart-full { height: calc(100vh - 240px); min-height: 400px; }

/* === PROCESS FLOW SVG === */
.process-svg-container { overflow-x: auto; padding: 10px 0; }
.process-svg-container svg { min-width: 1200px; }

/* SVG pipe classes */
.pipe-steam { stroke: #F59E0B; stroke-width: 2.5; fill: none; }
.pipe-water { stroke: #3B82F6; stroke-width: 2.5; fill: none; }
.pipe-coal { stroke: #374151; stroke-width: 3; fill: none; }
.pipe-flue { stroke: #9CA3AF; stroke-width: 2; fill: none; stroke-dasharray: 5 3; }
.pipe-cw { stroke: #06B6D4; stroke-width: 2.5; fill: none; }
.pipe-electric { stroke: var(--purple); stroke-width: 2.5; fill: none; }

/* === HEAT BALANCE BLOCK === */
.hb-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  position: relative;
  cursor: pointer;
  transition: box-shadow var(--t), transform var(--t);
}
.hb-block:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
/* Findings recipe: faint whisper-wash + thin coloured top-edge (not full border) */
.hb-block.penalty { border-top: 3px solid var(--red); background: var(--red-light); }
.hb-block.loss { border-top: 3px solid var(--amber); background: var(--amber-light); }
.hb-block.ok { border-top: 3px solid var(--green); background: var(--green-light); }
.hb-block-name { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text-tertiary); }
.hb-block-value { font-size: 22px; font-weight: 700; letter-spacing: -.5px; margin: 4px 0; font-variant-numeric: tabular-nums; }
.hb-block-sub { font-size: 11px; color: var(--text-secondary); }
.hb-penalty-badge {
  position: absolute;
  top: 12px;
  right: 14px;
  text-align: right;
}
.hb-penalty-number { font-size: 18px; font-weight: 700; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.hb-penalty-detail { font-size: 9px; color: var(--text-secondary); }
.hb-connector { text-align: center; padding: 4px 0; color: var(--border-strong); font-size: 16px; }

/* === CONTROL ROOM === */
.cr-status-bar { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 20px; }
/* NEUTRAL tile — no coloured top stripe; state via a dot / coloured value */
.cr-status-item {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 14px;
  text-align: center;
}
.cr-status-item .cr-status-dot { background: var(--green); }
.cr-status-item.warn .cr-status-dot { background: var(--amber); }
.cr-status-item.crit .cr-status-dot { background: var(--red); }
.cr-status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.cr-status-value { font-size: 22px; font-weight: 700; letter-spacing: -.5px; margin: 4px 0; font-variant-numeric: tabular-nums; }
.cr-status-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-tertiary); font-weight: 600; }
.cr-status-sub { font-size: 9px; color: var(--text-tertiary); }

/* Alert Feed */
.cr-alert {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  border-left: 3px solid var(--border);
  margin-bottom: 10px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: box-shadow var(--t), transform var(--t);
  animation: slideIn .3s ease;
}
.cr-alert:hover { box-shadow: var(--shadow-md); }
.cr-alert.sev-critical { border-left-color: var(--red); background: var(--red-light); }
.cr-alert.sev-high { border-left-color: var(--orange); background: var(--orange-light); }
.cr-alert.sev-medium { border-left-color: var(--amber); background: var(--amber-light); }
.cr-alert-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cr-alert-body { flex: 1; min-width: 0; }
.cr-alert-title { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.cr-alert-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.6; }
.cr-alert-actions { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-light); }
.cr-action-item {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 3px;
}
.cr-action-item .material-icons-outlined { font-size: 14px; }
.cr-alert-meta { display: flex; gap: 8px; margin-top: 6px; font-size: 10px; color: var(--text-tertiary); align-items: center; }
.cr-alert-value {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  text-align: right;
  min-width: 90px;
}

@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulseDot 1.5s infinite;
}
@keyframes pulseDot { 0%,100% { opacity: 1; box-shadow: 0 0 3px currentColor; } 50% { opacity: .6; box-shadow: 0 0 10px currentColor; } }

/* === FINDINGS === */
.finding-filters { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.filter-btn:hover { background: var(--surface-raised); color: var(--text-primary); border-color: var(--border-strong); }
.filter-btn.active { background: var(--accent); color: #FFFFFF; border-color: var(--accent); }

.finding-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-left: 3px solid var(--border);
  overflow: hidden;
  margin-bottom: 10px;
  transition: box-shadow var(--t);
}
.finding-card:hover { box-shadow: var(--shadow-md); }
.finding-card.sev-Critical { border-left-color: var(--red); }
.finding-card.sev-High { border-left-color: var(--orange); }
.finding-card.sev-Medium { border-left-color: var(--amber); }

.finding-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 8px;
  cursor: pointer;
  gap: 14px;
}
.finding-header-left { display: flex; align-items: flex-start; gap: 10px; flex: 1; }
.finding-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.finding-dot.Critical { background: var(--red); }
.finding-dot.High { background: var(--orange); }
.finding-dot.Medium { background: var(--amber); }
.finding-title { font-size: 14px; font-weight: 700; letter-spacing: -.1px; }
.finding-impact { font-size: 14px; font-weight: 700; color: var(--red); white-space: nowrap; font-variant-numeric: tabular-nums; }
.expand-icon { color: var(--text-tertiary); transition: transform .2s; cursor: pointer; }
.finding-card.expanded .expand-icon { transform: rotate(180deg); }
.finding-tags { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }
.finding-tag {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-raised);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.finding-tag.unit { background: var(--blue-bg); color: var(--on-blue); }
.finding-tag.sev-Critical { background: var(--red-bg); color: var(--on-red); }
.finding-tag.sev-High { background: var(--orange-bg); color: var(--on-orange); }
.finding-tag.sev-Medium { background: var(--amber-bg); color: var(--on-amber); }
.finding-summary { font-size: 12px; color: var(--text-secondary); padding: 0 18px 12px 38px; line-height: 1.6; }
.finding-details { display: none; padding: 0 18px 18px; border-top: 1px solid var(--border); margin-top: 4px; }
.finding-card.expanded .finding-details { display: block; padding-top: 16px; }
.finding-card.expanded .finding-summary { display: none; }

/* Finding detail sections */
.finding-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 16px; }
.finding-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-light);
}
.finding-row { font-size: 12px; margin-bottom: 6px; line-height: 1.6; }
.finding-label { font-weight: 600; color: var(--text-secondary); }
.finding-actual { color: var(--red); font-weight: 700; }
.finding-deviation { color: var(--orange); font-weight: 700; }

/* Evidence */
.evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
  background: var(--surface-raised);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 12px;
}
.evidence-key { font-size: 10px; color: var(--text-tertiary); font-weight: 500; text-transform: capitalize; }
.evidence-val { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Comments & rebuttals */
.seil-comment {
  background: var(--amber-light);
  border: 1px solid var(--amber-bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
}
.seil-comment-label { font-size: 10px; font-weight: 700; color: var(--on-amber); margin-bottom: 4px; display: flex; align-items: center; gap: 5px; }
.seil-comment-text { font-size: 12px; color: var(--text-secondary); line-height: 1.6; }
.zw-rebuttal {
  background: var(--blue-light);
  border: 1px solid var(--blue-bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 12px;
}
.zw-rebuttal-label { font-size: 10px; font-weight: 700; color: var(--on-blue); margin-bottom: 4px; display: flex; align-items: center; gap: 5px; }
.zw-rebuttal-text { font-size: 12px; color: var(--text-secondary); line-height: 1.7; }

/* Actions */
.action-list { margin-bottom: 12px; }
.action-item {
  font-size: 12px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 4px;
  color: var(--accent);
  font-weight: 600;
}
.action-item .material-icons-outlined { font-size: 14px; margin-top: 2px; flex-shrink: 0; }

/* Feedback */
.feedback-section { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.feedback-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; display: flex; align-items: center; gap: 5px; }
.feedback-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font);
  resize: vertical;
  min-height: 60px;
  outline: none;
  transition: border-color .15s;
}
.feedback-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.feedback-btn {
  margin-top: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background var(--t);
}
.feedback-btn:hover { background: var(--accent-dark); }

/* Finding charts */
.finding-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.finding-chart-box {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  position: relative;
}
.finding-chart-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-tertiary); margin-bottom: 8px; }

/* === MILL CARDS === */
.mill-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.mill-card {
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
  background: var(--card);
  text-align: center;
  transition: box-shadow var(--t), transform var(--t);
}
.mill-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
/* Faint washes + thin coloured top-edge (not a full coloured border) */
.mill-card.severe { background: var(--red-light); border-top: 3px solid var(--red); }
.mill-card.moderate { background: var(--amber-light); border-top: 3px solid var(--amber); }
.mill-card.healthy { background: var(--green-light); border-top: 3px solid var(--green); }
.mill-card.standby { background: var(--surface-raised); border-color: var(--border); }
.mill-name { font-size: 18px; font-weight: 700; letter-spacing: -.1px; }
.mill-badge { font-size: 9px; font-weight: 700; text-transform: uppercase; padding: 2px 8px; border-radius: 8px; display: inline-block; margin-top: 4px; }
.mill-temp { font-size: 30px; font-weight: 700; letter-spacing: -.8px; margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.mill-detail { font-size: 11px; color: var(--text-secondary); margin: 2px 0; }
.mill-warning { background: var(--amber-bg); border: 1px solid var(--amber-bg); border-radius: var(--radius-sm); padding: 6px 8px; font-size: 10px; color: var(--on-amber); margin-top: 8px; text-align: left; }

/* === TREND CARDS === */
.trend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.trend-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  overflow: hidden;
}
.trend-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.trend-title { font-size: 14px; font-weight: 700; letter-spacing: -.1px; }
.trend-delta { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.trend-info { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

/* === TRIP TABLE === */
.trip-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.trip-table th {
  background: var(--surface-raised);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.trip-table td { padding: 8px 12px; border-bottom: 1px solid var(--border-light); }
.trip-table tr.pre-trip { background: var(--amber-light); }
.trip-table tr.trip-event { background: var(--red-light); font-weight: 700; }
.trip-table tr.post-trip { color: var(--text-tertiary); }

/* === EQUIPMENT HEALTH === */
.equip-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.equip-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  border-top: 3px solid var(--border);
  transition: box-shadow var(--t), transform var(--t);
}
.equip-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.equip-card.critical { border-top-color: var(--red); }
.equip-card.warning { border-top-color: var(--amber); }
.equip-card.ok { border-top-color: var(--green); }
.equip-name { font-size: 14px; font-weight: 700; letter-spacing: -.1px; margin-bottom: 4px; }
.equip-status { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 12px; }
.equip-detail { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }

/* === SAFETY === */
.safety-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.safety-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  border-left: 3px solid var(--border);
}
.safety-card.severe { border-left-color: var(--red); background: var(--red-light); }
.safety-card.high { border-left-color: var(--orange); background: var(--orange-light); }
.safety-card.medium { border-left-color: var(--amber); background: var(--amber-light); }

/* === CYCLING === */
.cycle-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.cycle-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  text-align: center;
}
.cycle-value { font-size: 30px; font-weight: 700; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.cycle-label { font-size: 10.5px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .6px; font-weight: 600; margin-top: 4px; }

/* === HB TABLE === */
.hb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hb-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: .6px;
}
.hb-table td { padding: 10px 14px; border-bottom: 1px solid var(--border-light); font-variant-numeric: tabular-nums; }
.hb-table .val { text-align: right; font-weight: 600; }
.hb-table tr.hb-total { font-weight: 800; background: var(--amber-light); border-top: 2px solid var(--amber); }

/* === FORMS === */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-item label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; }
.form-item input, .form-item select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color .15s;
}
.form-item input:focus, .form-item select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.form-hint { font-size: 10px; color: var(--text-tertiary); margin-top: 3px; }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background .12s, box-shadow .12s, transform .12s;
  font-family: var(--font);
}
/* Primary == the single accent, with a restrained accent glow */
.btn-primary { background: var(--accent); color: white; box-shadow: 0 1px 2px rgba(14,23,38,.10), 0 4px 12px -4px rgba(29,111,224,.30); }
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--surface-sunken); color: var(--text-primary); }
.btn-accent { background: var(--accent); color: white; box-shadow: 0 1px 2px rgba(14,23,38,.10), 0 4px 12px -4px rgba(29,111,224,.30); }
.btn-accent:hover { background: var(--accent-dark); transform: translateY(-1px); }

/* Global focus-visible ring for a11y — accent outline + faint accent halo, no transition */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* === FOOTER === */
.footer {
  text-align: center;
  font-size: 10px;
  color: var(--text-tertiary);
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--card);
}

/* === UTILITIES === */
.text-ok { color: var(--green); }
.text-warn { color: var(--amber); }
.text-bad { color: var(--red); }
.text-muted { color: var(--text-tertiary); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 10px; }
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-black { font-weight: 700; }
.tabular { font-variant-numeric: tabular-nums; }
.uppercase { text-transform: uppercase; letter-spacing: .5px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* === RESPONSIVE === */
@media (max-width: 1440px) {
  .kpi-strip { grid-template-columns: repeat(4, 1fr); }
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1280px) {
  .sidebar { width: 200px; }
  .main-content { margin-left: 200px; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .equip-grid { grid-template-columns: 1fr 1fr; }
  .mill-grid { grid-template-columns: repeat(4, 1fr); }
  .kpi-strip { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1024px) {
  .sidebar { width: 64px; overflow: hidden; }
  .sidebar-item span:last-child { display: none; }
  .sidebar-logo-text { display: none; }
  .sidebar-plant { display: none; }
  .sidebar-section { padding: 12px 8px 4px; font-size: 0; }
  .sidebar-item { padding: 10px; justify-content: center; }
  .sidebar-unit { padding: 8px; }
  .unit-btn { font-size: 10px; }
  .main-content { margin-left: 64px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .equip-grid, .safety-grid { grid-template-columns: 1fr; }
  .trend-grid { grid-template-columns: 1fr; }
  .finding-detail-grid { grid-template-columns: 1fr; }
  .finding-charts { grid-template-columns: 1fr; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); position: fixed; z-index: 200; width: 240px; }
  .main-content { margin-left: 0; }
  .page-container { padding: 12px; }
  .kpi-strip { grid-template-columns: 1fr 1fr; gap: 6px; }
  .mill-grid { grid-template-columns: 1fr 1fr; }
  .cr-status-bar { grid-template-columns: repeat(3, 1fr); }
  .cycle-grid { grid-template-columns: 1fr 1fr; }
}

/* Control room large display mode */
@media (min-width: 2560px) {
  :root { font-size: 16px; }
  .kpi-value { font-size: 34px; }
  .metric-value { font-size: 36px; }
  .cr-status-value { font-size: 28px; }
  .cr-alert-title { font-size: 18px; }
  .cr-alert-value { font-size: 24px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .pulse-dot, .badge-alert { animation: none; }
  * { transition-duration: 0s !important; }
}

/* === FEATURE: Finding Status Workflow === */
.finding-status-group { display: flex; gap: 4px; margin-left: auto; margin-right: 14px; }
.finding-status-btn {
  font-size: 9px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-tertiary);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: .3px;
  transition: background .12s, color .12s, border-color .12s;
}
.finding-status-btn:hover { border-color: var(--text-secondary); color: var(--text-secondary); }
.finding-status-btn.status-active-open { background: var(--red-bg); color: var(--on-red); border-color: var(--red-bg); }
.finding-status-btn.status-active-acknowledged { background: var(--amber-bg); color: var(--on-amber); border-color: var(--amber-bg); }
.finding-status-btn.status-active-in-progress { background: var(--blue-bg); color: var(--on-blue); border-color: var(--blue-bg); }
.finding-status-btn.status-active-resolved { background: var(--green-bg); color: var(--on-green); border-color: var(--green-bg); }
.finding-status-pill {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-left: 5px;
}
.finding-status-pill.status-open { background: var(--red-bg); color: var(--on-red); }
.finding-status-pill.status-acknowledged { background: var(--amber-bg); color: var(--on-amber); }
.finding-status-pill.status-in-progress { background: var(--blue-bg); color: var(--on-blue); }
.finding-status-pill.status-resolved { background: var(--green-bg); color: var(--on-green); }

/* === FEATURE: Comment Threads === */
.comment-thread { border-top: 1px solid var(--border-light); padding-top: 12px; margin-top: 12px; }
.comment-thread-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px;
  color: var(--text-tertiary); margin-bottom: 10px; display: flex; align-items: center; gap: 5px;
}
.comment-item {
  background: var(--surface-raised); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px;
}
.comment-item.comment-digital-brain { background: var(--blue-light); border-color: var(--blue-bg); }
.comment-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-author { font-size: 11px; font-weight: 700; color: var(--text-primary); }
.comment-role { font-size: 9px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--surface-sunken); color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .3px; }
.comment-date { font-size: 10px; color: var(--text-tertiary); margin-left: auto; }
.comment-text { font-size: 12px; color: var(--text-secondary); line-height: 1.6; }
.comment-add { margin-top: 8px; }
.comment-add textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12px; font-family: var(--font); resize: vertical; min-height: 50px; outline: none;
}
.comment-add textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.comment-add-btn {
  margin-top: 6px; padding: 6px 14px; border-radius: var(--radius-sm); border: none;
  background: var(--accent); color: white; font-size: 11px; font-weight: 600;
  cursor: pointer; transition: background var(--t);
}
.comment-add-btn:hover { background: var(--accent-dark); }

/* === FEATURE: Alert Acknowledgment === */
.cr-alert.ack-dimmed { opacity: 0.55; }
.cr-alert .ack-bar { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.cr-alert .ack-btn {
  font-size: 10px; font-weight: 700; padding: 5px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--card); cursor: pointer; transition: all .12s;
}
.cr-alert .ack-btn:hover { border-color: var(--text-secondary); }
.cr-alert .ack-btn-primary { background: var(--green); color: white; border-color: var(--green); }
.cr-alert .ack-btn-primary:hover { background: #047857; }
.cr-alert .ack-btn-snooze { background: var(--amber-bg); color: var(--on-amber); border-color: var(--amber-bg); }
.cr-alert .ack-btn-snooze:hover { background: var(--amber-bg); }
.cr-alert .ack-status { font-size: 10px; color: var(--green); font-weight: 600; }

/* === FEATURE: Export Buttons === */
.card-export-btn {
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--card); cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; transition: all .12s; color: var(--text-tertiary);
}
.card-export-btn:hover { background: var(--surface-raised); color: var(--text-primary); border-color: var(--text-tertiary); }

/* === FEATURE: Custom Trend Builder === */
.trend-builder-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.trend-builder-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.trend-builder-header h3 { font-size: 15px; font-weight: 700; letter-spacing: -.1px; }
.trend-builder-body { padding: 16px 20px; }
.param-multi-select { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.param-chip {
  font-size: 11px; font-weight: 600; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card); cursor: pointer;
  transition: background .12s, color .12s, border-color .12s; user-select: none;
}
.param-chip:hover { border-color: var(--accent); color: var(--accent); }
.param-chip.selected { background: var(--accent); color: white; border-color: var(--accent); }

/* === FEATURE: Coal Quality Input Form === */
.coal-form-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; align-items: end; }
.coal-form-grid .form-item label { font-size: 11px; }
.coal-form-grid .form-item input { padding: 7px 10px; font-size: 12px; }
.coal-entries-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 12px; }
.coal-entries-table th {
  text-align: left; padding: 8px 10px; background: var(--surface-raised);
  border-bottom: 1px solid var(--border); font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; color: var(--text-secondary); letter-spacing: .6px;
}
.coal-entries-table td { padding: 8px 10px; border-bottom: 1px solid var(--border-light); font-variant-numeric: tabular-nums; }
.coal-entries-table tr:hover { background: var(--surface-raised); }

/* ============================================================
   DESIGN LANGUAGE — SHARED COMPONENTS (Foundation pass)
   ------------------------------------------------------------
   Every signature component named in DESIGN_LANGUAGE.md, promoted from the
   reference pages (wastage / hmbd / process / shift) into the global system so
   per-page agents can just use the class — no new design language, only the
   tokens above. Definitions are verbatim from the reference pages so any page
   already shipping a scoped copy stays pixel-identical. The Zerowatt Brain
   insight panel (.brain-*) lives in its own block above and is not repeated.
   ============================================================ */

/* === PROVENANCE: simulated chip + steady-state as-of stamp (§2.10) === */
.sim-chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 9px; font-weight: 700;
  letter-spacing: .4px; text-transform: uppercase; padding: 2px 8px; border-radius: 999px;
  background: var(--purple-bg); color: var(--on-purple); vertical-align: middle; margin-left: 8px;
}
.asof-stamp {
  display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 600;
  color: var(--text-tertiary); padding: 2px 9px; border-radius: 20px; vertical-align: middle;
  background: var(--surface-raised); border: 1px solid var(--border); margin-left: 6px;
}
.asof-stamp .material-icons-outlined { font-size: 12px; color: var(--text-tertiary); }
.asof-stamp b { color: var(--text-secondary); font-weight: 700; }

/* === HONEST THREE-WAY SPLIT HEADER — controllable / structural / context (§2.2) === */
.split-grid { display: grid; grid-template-columns: 1.1fr 1.1fr 1fr; gap: 14px; }
.split-card {
  border-radius: var(--radius); padding: 18px 20px; background: var(--card);
  border: 1px solid var(--border); border-top: 4px solid var(--border-strong);
  display: flex; flex-direction: column; gap: 4px;
}
.split-card.recover { border-top-color: var(--red); background: var(--red-light); }
.split-card.struct  { border-top-color: var(--purple); background: var(--purple-light); }
.split-card.context { border-top-color: var(--text-tertiary); background: var(--surface-raised); }
.split-tag {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  display: inline-flex; align-items: center; gap: 5px;
}
.split-card.recover .split-tag { color: var(--red); }
.split-card.struct  .split-tag { color: var(--on-purple); }
.split-card.context .split-tag { color: var(--text-secondary); }
.split-kcal { font-size: 30px; font-weight: 700; line-height: 1; letter-spacing: -.8px;
  color: var(--text-primary); font-variant-numeric: tabular-nums; margin-top: 4px; }
.split-kcal .u { font-size: 12px; font-weight: 600; color: var(--text-tertiary); }
.split-rs { font-size: 13px; font-weight: 800; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.split-desc { font-size: 11px; color: var(--text-tertiary); line-height: 1.5; margin-top: 2px; }

/* === CAUSAL CHAIN STRIP — symptom -> mechanism -> tag -> fix (§2.3) === */
.chain { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; margin-bottom: 14px; }
.chain-step {
  flex: 1; min-width: 130px; background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 11px; position: relative;
}
.chain-step + .chain-step { margin-left: 16px; }
.chain-step + .chain-step::before {
  content: '\2192'; position: absolute;
  left: -13px; top: 50%; transform: translateY(-50%); font-size: 14px; font-weight: 700;
  line-height: 1; color: var(--text-tertiary);
}
.chain-k { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text-tertiary); }
.chain-v { font-size: 12px; font-weight: 600; color: var(--text-primary); line-height: 1.45; margin-top: 3px; }
.chain-step.fix { background: var(--blue-light); border-color: var(--blue-bg); }
.chain-step.fix .chain-k { color: var(--accent-dark); }

/* === EXPANDABLE OPPORTUNITY / FINDING CARD — .opp-card (§2.4) === */
.opp-card {
  background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--border-strong);
  border-radius: var(--radius); margin-bottom: 12px; box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t);
}
.opp-card:hover { box-shadow: var(--shadow-md); }
.opp-card.cls-controllable { border-left-color: var(--red); }
.opp-card.cls-structural   { border-left-color: var(--purple); }
.opp-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; }
.opp-rank {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0; display: flex;
  align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
  background: var(--surface-sunken); color: var(--text-secondary); font-variant-numeric: tabular-nums;
}
.opp-card.cls-controllable .opp-rank { background: var(--red-bg); color: var(--on-red); }
.opp-card.cls-structural   .opp-rank { background: var(--purple-bg); color: var(--on-purple); }
.opp-main { flex: 1; min-width: 0; }
.opp-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.opp-headline { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin-top: 2px; }
.opp-tags { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; align-items: center; }
.opp-impact { text-align: right; flex-shrink: 0; }
.opp-impact .k { font-size: 18px; font-weight: 700; letter-spacing: -.3px; color: var(--red); font-variant-numeric: tabular-nums; line-height: 1.1; }
.opp-card.cls-structural .opp-impact .k { color: var(--purple); }
.opp-impact .ku { font-size: 10px; font-weight: 600; color: var(--text-tertiary); }
.opp-impact .rs { font-size: 11px; font-weight: 700; color: var(--text-secondary); margin-top: 3px; font-variant-numeric: tabular-nums; }
.opp-expand { color: var(--text-tertiary); transition: transform .2s; flex-shrink: 0; }
.opp-card.open .opp-expand { transform: rotate(180deg); }
.opp-body { display: none; padding: 0 18px 18px; border-top: 1px solid var(--border-light); }
.opp-card.open .opp-body { display: block; padding-top: 14px; }
.opp-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; }

/* Design-vs-target-vs-actual table inside an opp/finding card */
.dva-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dva-table td { padding: 5px 0; }
.dva-table .lbl { color: var(--text-tertiary); }
.dva-table .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Yellow "Root cause (SEIL note)" callout */
.root-note {
  background: var(--amber-light); border: 1px solid var(--amber-bg); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-top: 12px;
}
.root-note .rk { font-size: 10px; font-weight: 700; color: var(--on-amber); margin-bottom: 3px;
  display: flex; align-items: center; gap: 5px; text-transform: uppercase; letter-spacing: .4px; }
.root-note .rt { font-size: 12px; color: var(--text-secondary); line-height: 1.6; }

/* Evidence sparkline wrapper + trend arrow */
.spark-wrap { background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.spark-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-tertiary); margin-bottom: 4px; display: flex; align-items: center; justify-content: space-between; }
.trend-arrow { font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; gap: 2px; }
.trend-arrow.up   { color: var(--red); }
.trend-arrow.down { color: var(--green); }
.trend-arrow.flat { color: var(--text-tertiary); }

/* Group divider + count badges between controllable and structural buckets */
.opp-group-hd {
  display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; padding-top: 4px;
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-tertiary);
}
.opp-group-hd:not(:first-child) { margin-top: 18px; border-top: 1px dashed var(--border-strong); padding-top: 14px; }
.opp-group-hd .ct { font-weight: 800; padding: 1px 8px; border-radius: 20px; font-size: 10px; }
.opp-group-hd.controllable .ct { background: var(--red-bg); color: var(--on-red); }
.opp-group-hd.structural   .ct { background: var(--purple-bg); color: var(--on-purple); }
.opp-group-hd .hint { font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--text-tertiary); }

/* === INTERLOCK / LIMITS LINE on every prescribed move (§2.10, Principle 6) === */
.limits-line {
  display: flex; align-items: flex-start; gap: 6px; margin-top: 7px; padding: 7px 9px;
  background: var(--green-light); border: 1px solid var(--green-bg); border-radius: var(--radius-sm);
  font-size: 11px; color: var(--on-green); line-height: 1.5;
}
.limits-line .material-icons-outlined { font-size: 13px; color: var(--green); flex-shrink: 0; margin-top: 1px; }
.limits-line .lim-sim { font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px;
  color: var(--on-purple); background: var(--purple-bg); padding: 0 5px; border-radius: 10px; margin-left: 4px; vertical-align: 1px; }

/* === LEGEND ROW for the waterfall / evidence charts (§2.6) === */
.legend-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: 11px; color: var(--text-secondary); margin-top: 8px; }
.legend-row .sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: middle; margin-right: 5px; }

/* === "RECOVER THIS" PRIORITIZED ACTION LIST (wastage) === */
.recover-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-light);
}
.recover-item:last-child { border-bottom: none; }
.recover-num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.recover-body { flex: 1; min-width: 0; }
.recover-what { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.recover-set { font-size: 12px; color: var(--text-secondary); margin-top: 3px; line-height: 1.5; }
.recover-meta { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; align-items: center; }
.recover-gain { text-align: right; flex-shrink: 0; }
.recover-gain .k { font-size: 15px; font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; line-height: 1; }
.recover-gain .ku { font-size: 9px; color: var(--text-tertiary); font-weight: 600; }
.recover-gain .rs { font-size: 11px; font-weight: 700; color: var(--text-secondary); margin-top: 2px; }

/* Effort / payback chip (low/med/high) */
.eff-chip { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; padding: 2px 7px; border-radius: 6px; }
.eff-chip.low  { background: var(--green-bg); color: var(--on-green); }
.eff-chip.med  { background: var(--amber-bg); color: var(--on-amber); }
.eff-chip.high { background: var(--red-bg); color: var(--on-red); }

/* === "MY NUMBER RIGHT NOW" — live controllable scoreboard tiles (wastage) === */
.mynum-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 14px; align-items: stretch; }
.mynum-card { border-radius: var(--radius); padding: 14px 18px; background: var(--card); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; }
.mynum-card.live { border-left: 3px solid var(--red); background: var(--red-light); }
.mynum-k { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text-tertiary); }
.mynum-v { font-size: 27px; font-weight: 700; line-height: 1; letter-spacing: -.6px; color: var(--text-primary); font-variant-numeric: tabular-nums; margin-top: 3px; }
.mynum-v .u { font-size: 11px; font-weight: 600; color: var(--text-tertiary); }
.mynum-sub { font-size: 11px; color: var(--text-secondary); margin-top: 2px; line-height: 1.5; }
.delta-pill { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 800; padding: 1px 7px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.delta-pill.worse { background: var(--red-bg); color: var(--on-red); }
.delta-pill.better { background: var(--green-bg); color: var(--on-green); }
.delta-pill.flat { background: var(--surface-sunken); color: var(--text-secondary); }

/* Radar / opportunity filter toolbar */
.radar-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; }
.radar-toolbar .grp { display: flex; align-items: center; gap: 6px; }
.radar-toolbar label { font-size: 10px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-tertiary); font-weight: 700; }

/* === WHAT/WHY/VERDICT REASONING CARDS — .why-card (§2.9, hmbd) === */
.why-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.why-card {
  background: var(--card); border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.why-card.is-operational { border-left-color: var(--red); }
.why-card.is-structural { border-left-color: var(--purple); }
.why-card.is-ok { border-left-color: var(--green); }
.why-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.why-name { font-size: 14px; font-weight: 700; letter-spacing: -.1px; color: var(--text-primary); }
.why-nums {
  display: flex; gap: 14px; padding: 8px 0; margin-bottom: 8px;
  border-top: 1px solid var(--border-light); border-bottom: 1px solid var(--border-light);
}
.why-num .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-tertiary); font-weight: 600; }
.why-num .v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.why-row { font-size: 12px; color: var(--text-secondary); line-height: 1.55; margin-top: 6px; }
.why-row b { color: var(--text-primary); font-weight: 700; }
.why-row .lab {
  display: inline-block; min-width: 52px; font-size: 9px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-tertiary); vertical-align: top;
}

/* === STATUS PILL inside deviation tables / why-cards — .st-pill (§2.10, hmbd) === */
.st-pill { font-size: 10px; font-weight: 700; padding: 2px 9px; border-radius: 999px; display: inline-block; }
.st-ok { background: var(--green-bg); color: var(--on-green); }
.st-warn { background: var(--amber-bg); color: var(--on-amber); }
.st-bad { background: var(--red-bg); color: var(--on-red); }

/* === CLASS TAG — operational / structural / uncontrollable — .cls-tag (§2.10, hmbd) === */
.cls-tag { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; padding: 2px 8px; border-radius: 999px; }
.cls-tag.op { background: var(--red-bg); color: var(--on-red); }
.cls-tag.struct { background: var(--purple-bg); color: var(--on-purple); }
.cls-tag.unc { background: var(--surface-sunken); color: var(--text-secondary); }

/* === HEAT-BALANCE ANCHOR TILES + LEGEND — .hb-anchor (hmbd) === */
.hb-anchor-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
/* NEUTRAL tile — brand top stripe removed; hairline-only, no shadow */
.hb-anchor {
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
}
.hb-anchor .a-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-tertiary); font-weight: 600; margin-bottom: 6px;
}
.hb-anchor .a-value {
  font-size: 22px; font-weight: 700; line-height: 1; letter-spacing: -.5px;
  color: var(--text-primary); font-variant-numeric: tabular-nums;
}
.hb-anchor .a-unit { font-size: 11px; font-weight: 600; color: var(--text-tertiary); margin-left: 3px; }
.hb-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 11px; color: var(--text-secondary); margin-top: 10px; }
.hb-legend span { display: inline-flex; align-items: center; gap: 6px; }
.hb-legend .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* === AUTO-WRITTEN NARRATIVE + NEXT-ACTION + STATUS PILL — (§2.8, shift) === */
.narrative p { font-size: 13.5px; line-height: 1.7; color: var(--text-secondary); margin: 0 0 10px; }
.narrative p:last-child { margin-bottom: 0; }
.narrative strong { color: var(--text-primary); font-weight: 700; }
.narrative .next-action,
.next-action {
  margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--blue-light); border-left: 3px solid var(--accent);
  font-size: 13px; color: var(--text-primary); line-height: 1.6;
}
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .5px; padding: 5px 12px; border-radius: 999px;
}
.status-pill.green { background: var(--green-bg); color: var(--on-green); }
.status-pill.amber { background: var(--amber-bg); color: var(--on-amber); }
.status-pill.red   { background: var(--red-bg); color: var(--on-red); }
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; }
.status-pill.green .dot { background: var(--green); }
.status-pill.amber .dot { background: var(--amber); }
.status-pill.red   .dot { background: var(--red); }

/* Shift toolbar / date input (shift) */
.shift-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 18px; }
.shift-bar .seg { display: flex; align-items: center; gap: 6px; }
.shift-bar label { font-size: 10px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-tertiary); font-weight: 700; }
.shift-date-input {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13px; font-weight: 600; color: var(--text-primary);
  background: var(--card); outline: none;
}
.shift-date-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

/* Vertical events timeline (shift) */
.tl { position: relative; padding-left: 8px; }
.tl-item { position: relative; padding: 0 0 18px 30px; border-left: 2px solid var(--border); }
.tl-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl-dot {
  position: absolute; left: -8px; top: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--card); border: 3px solid var(--text-tertiary);
}
.tl-dot.high { border-color: var(--red); }
.tl-dot.medium { border-color: var(--amber); }
.tl-dot.low { border-color: var(--accent); }
.tl-item.critical { border-left-color: var(--red-bg); }
.tl-time { font-size: 12px; font-weight: 800; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.tl-equip { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-left: 8px; }
.tl-type { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.tl-note { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; line-height: 1.5; }
.tl-tags { display: flex; gap: 6px; margin-top: 6px; align-items: center; flex-wrap: wrap; }
.tag-auto { background: var(--green-bg); color: var(--on-green); font-size: 9px; font-weight: 700;
  padding: 2px 7px; border-radius: 6px; text-transform: uppercase; letter-spacing: .3px; }
.tag-manual { background: var(--amber-bg); color: var(--on-amber); font-size: 9px; font-weight: 700;
  padding: 2px 7px; border-radius: 6px; text-transform: uppercase; letter-spacing: .3px; }
.tl-link { font-size: 11px; font-weight: 700; color: var(--accent); text-decoration: none; }
.tl-link:hover { text-decoration: underline; }

/* Setpoint / SOP recommendation rows (shift) */
.sp-item { padding: 12px 0; border-bottom: 1px solid var(--border-light); }
.sp-item:last-child { border-bottom: none; }
.sp-head { display: flex; align-items: center; gap: 8px; }
.sp-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center;
  justify-content: center; background: var(--surface-raised); color: var(--text-secondary); flex-shrink: 0; }
.sp-what { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.sp-kind { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px;
  padding: 2px 7px; border-radius: 4px; }
.sp-kind.setpoint { background: var(--blue-bg); color: var(--on-blue); }
.sp-kind.sop { background: var(--purple-bg); color: var(--on-purple); }
.sp-row { font-size: 12px; color: var(--text-secondary); margin-top: 6px; line-height: 1.6; }
.sp-row .k { font-weight: 700; color: var(--text-tertiary); text-transform: uppercase;
  font-size: 10px; letter-spacing: .4px; margin-right: 6px; }
.sp-recover { font-weight: 800; color: var(--red); }

/* === PROCESS-FLOW DIAGRAM with penalty badges — .pf family (§2.7, process) === */
.pf { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; overflow-x: auto; }
.pf-title { text-align: center; font-size: 15px; font-weight: 700; letter-spacing: -.1px; color: var(--text-primary); margin-bottom: 20px; }
.pf-row { display: flex; align-items: center; justify-content: center; gap: 0; margin-bottom: 8px; flex-wrap: nowrap; min-width: 1100px; }
.pf-blk {
  min-width: 120px; max-width: 150px; border-radius: 10px; padding: 14px 12px;
  text-align: center; position: relative; cursor: pointer;
  border: 2px solid var(--border); background: var(--card);
  transition: all .15s; text-decoration: none; color: inherit; display: block;
}
.pf-blk:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.pf-blk.ok { border-color: var(--green); background: var(--green-light); }
.pf-blk.warn { border-color: var(--amber); background: var(--amber-light); }
.pf-blk.bad { border-color: var(--red); background: var(--red-light); }
.pf-blk.steam { border-color: #F59E0B; background: #FFFBEB; }
.pf-blk.turb { border-color: var(--accent); background: var(--blue-light); }
.pf-blk.elec { border-color: #7C3AED; background: var(--purple-light); }
.pf-blk.cool { border-color: #0891B2; background: var(--teal-bg); }
.pf-blk.water { border-color: #3B82F6; background: var(--blue-light); }
.pf-name { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text-tertiary); margin-bottom: 4px; }
.pf-val { font-size: 18px; font-weight: 700; letter-spacing: -.3px; line-height: 1.2; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.pf-sub { font-size: 9px; color: var(--text-tertiary); margin-top: 3px; }
.pf-penalty {
  position: absolute; top: -10px; right: -6px;
  background: var(--red); color: white;
  font-size: 9px; font-weight: 800; padding: 2px 6px;
  border-radius: 6px; white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.pf-penalty.warn { background: var(--amber); }
.pf-arr { display: flex; align-items: center; justify-content: center; width: 28px; flex-shrink: 0; color: var(--text-tertiary); font-size: 18px; }
.pf-down { text-align: center; color: var(--text-tertiary); font-size: 16px; padding: 4px 0; }
.pf-legend { display: flex; gap: 16px; justify-content: center; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pf-leg { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--text-secondary); }
.pf-leg-dot { width: 10px; height: 10px; border-radius: 3px; border: 2px solid; }
.pf-summary { display: flex; justify-content: center; gap: 24px; margin-bottom: 16px; }
.pf-sum-item { text-align: center; }
.pf-sum-val { font-size: 18px; font-weight: 700; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.pf-sum-label { font-size: 9px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }

/* === RESPONSIVE — shared components collapse gracefully (matches reference pages) === */
@media (max-width: 1100px) {
  .hb-anchor-grid { grid-template-columns: repeat(3, 1fr); }
  .why-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .split-grid { grid-template-columns: 1fr; }
  .mynum-grid { grid-template-columns: 1fr; }
  .opp-grid { grid-template-columns: 1fr; }
  .chain-step + .chain-step { margin-left: 0; margin-top: 24px; }
  .chain-step + .chain-step::before { content: 'arrow_downward'; left: 50%; top: -19px; transform: translateX(-50%); }
}
@media (max-width: 720px) {
  .hb-anchor-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===================================================================== */
/* === ADOPTION LAYER — role switcher, operator-authored finding card,  === */
/* === validation states, My-Catches, cross-links.                     === */
/* Reuses card / opp-card / finding-card / chain / dva-table / badge /  */
/* limits-line classes + tokens from above — NO new design language.    */
/* All colours/spacing/fonts resolve to existing CSS variables.          */
/* ===================================================================== */

/* --- Role switcher (topbar) — same data, role-emphasized lens (§5) --- */
.role-switch {
  display: inline-flex; align-items: center; gap: 1px;
  background: var(--surface-sunken); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 2px; margin-right: 4px;
}
.role-switch-label { font-size: 14px; color: var(--text-tertiary); padding: 0 4px; }
.role-btn {
  font-size: 11px; font-weight: 700; color: var(--text-secondary);
  padding: 3px 9px; border-radius: 4px; text-decoration: none; white-space: nowrap;
  transition: background .15s, color .15s;
}
.role-btn:hover { color: var(--text-primary); background: var(--surface); }
.role-btn.active { background: var(--accent); color: #fff; }

/* --- Cross-links ("everything trussed") — subtle, always click-through --- */
.zw-link {
  color: var(--accent-dark); text-decoration: none;
  border-bottom: 1px dashed var(--accent); font-weight: 600;
}
.zw-link:hover { color: var(--accent); border-bottom-style: solid; }
.zw-link-equipment { border-bottom-color: var(--accent); color: var(--accent-dark); }
.zw-link-equipment:hover { color: var(--accent); }

/* --- Operator-authored finding card (extends .opp-card) --- */
.op-finding { margin-bottom: 12px; }
.op-finding.open .opp-expand { transform: rotate(180deg); }
.op-finding .opp-body { display: none; }
.op-finding.open .opp-body { display: block; padding: 14px 18px 18px; border-top: 1px solid var(--border-light); }
.op-finding .opp-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* "Caught by the system" framing chip — blame-free, positive */
.op-caught-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  color: var(--on-green); background: var(--green-bg); padding: 2px 8px; border-radius: 999px;
}
.op-caught-chip .material-icons-outlined { font-size: 12px; }

/* ₹ rendered as POTENTIAL until validated — never the accusatory headline,
   but ALWAYS reachable (§5). */
.op-rs { display: flex; flex-direction: column; align-items: flex-end; }
.op-rs-state {
  font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px;
  margin-top: 1px;
}
.op-rs.is-potential .op-rs-state { color: var(--amber); }
.op-rs.is-validated { color: var(--green); }
.op-rs.is-validated .op-rs-state { color: var(--green); }

/* Physics-cause block — the cause is physics, never the person */
.op-physics {
  background: var(--blue-light); border: 1px solid var(--blue-bg);
  border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px;
}
.op-physics-k {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px;
  color: var(--accent-dark); margin-bottom: 4px;
}
.op-physics-k .material-icons-outlined { font-size: 14px; }
.op-physics-v { font-size: 12.5px; color: var(--text-secondary); line-height: 1.6; }

/* Collapsible drill-down — "how the system found this" (rule · evidence · data) */
.op-drill { margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.op-drill > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--text-primary);
  padding: 9px 12px; background: var(--surface-raised);
}
.op-drill > summary::-webkit-details-marker { display: none; }
.op-drill > summary .material-icons-outlined { font-size: 15px; color: var(--accent-dark); }
.op-drill[open] > summary { border-bottom: 1px solid var(--border); }
.op-drill-hint {
  margin-left: auto; font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; color: var(--text-tertiary);
}
.op-drill-body { padding: 14px 12px; }

/* Evidence sample block inside the drill-down */
.op-evidence { margin: 12px 0; }
.op-evidence-k {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-tertiary); margin-bottom: 6px;
}
.op-evidence-k .material-icons-outlined { font-size: 13px; }
.op-evidence-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px;
}
.op-evidence-grid > div {
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 8px; text-align: center;
}
.op-evidence-grid span {
  display: block; font-size: 9px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-tertiary); font-weight: 600;
}
.op-evidence-grid b { font-size: 13px; font-weight: 800; color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* Author-credit stamp — his name on the WIN, never the loss */
.op-credit {
  display: flex; align-items: flex-start; gap: 7px;
  background: var(--surface-raised); border: 1px solid var(--border);
  border-left: 3px solid var(--text-tertiary);
  border-radius: var(--radius-sm); padding: 9px 12px; margin-bottom: 12px;
  font-size: 12px; color: var(--text-secondary);
}
.op-credit.is-validated { border-left-color: var(--green); background: var(--green-light); }
.op-credit .material-icons-outlined { font-size: 16px; color: var(--text-tertiary); flex-shrink: 0; }
.op-credit.is-validated .material-icons-outlined { color: var(--green); }
.op-credit-txt b { color: var(--text-primary); }
.op-credit-note { display: block; margin-top: 2px; font-style: italic; color: var(--text-tertiary); }

/* Validation badges on the card head */
.vbadge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px;
  padding: 2px 8px; border-radius: 20px;
}
.vbadge .material-icons-outlined { font-size: 12px; }
.vbadge-validated { background: var(--green-bg); color: var(--on-green); }
.vbadge-investigate { background: var(--blue-bg); color: var(--on-blue); }
.vbadge-set_aside { background: var(--amber-bg); color: var(--on-amber); }
.vbadge-rejected { background: var(--surface-sunken); color: var(--text-secondary); }
.op-finding.vstate-validated { border-left-color: var(--green); }

/* Validation gate — action buttons; default verb (Validate) is the prominent one */
.op-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.op-act {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; font-family: inherit;
  padding: 7px 13px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-secondary);
  transition: background .15s, color .15s, border-color .15s;
}
.op-act .material-icons-outlined { font-size: 15px; }
.op-act:hover { border-color: var(--text-secondary); color: var(--text-primary); }
.op-act:disabled { opacity: .55; cursor: default; }
/* Default positive verb — filled green, the action we want most */
.op-act-validate { background: var(--green); border-color: var(--green); color: #fff; }
.op-act-validate:hover { background: #047857; border-color: #047857; color: #fff; }
.op-act-investigate:hover { border-color: var(--accent); color: var(--accent-dark); }
.op-act-setaside:hover { border-color: var(--amber); color: var(--on-amber); }
.op-act-reject:hover { border-color: var(--red); color: var(--on-red); }
.op-act-msg { font-size: 12px; font-weight: 700; margin-left: 4px; }
.op-act-msg.ok { color: var(--green); }
.op-act-msg.err { color: var(--red); }

/* My-Catches hero tally (operator's own wins — real hero, not PR) */
.mycatches {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px;
}
.mycatches-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; border-top: 4px solid var(--green);
}
.mycatches-card .mc-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-tertiary); font-weight: 600;
}
.mycatches-card .mc-value {
  font-size: 27px; font-weight: 700; line-height: 1; letter-spacing: -.6px;
  color: var(--text-primary); font-variant-numeric: tabular-nums; margin-top: 6px;
}
.mycatches-card .mc-sub { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

@media (max-width: 1024px) {
  .op-evidence-grid { grid-template-columns: repeat(3, 1fr); }
  .mycatches { grid-template-columns: repeat(2, 1fr); }
  .role-switch { flex-wrap: wrap; }
}

/* ===== ILLUSTRATIVE-DATA PROVENANCE (11 Jun 2026 — SEIL-share build) =====
   .syn = any element carrying a synthesized/illustrative value; .syn-chip = the
   violet marker. html.strict-real greys all .syn elements (the "real data only"
   toggle), so the visual delta is exactly what SEIL's data unlocks. */
.syn-chip { display:inline-block; font-size:9px; font-weight:800; letter-spacing:.4px;
  padding:1px 6px; border-radius:4px; margin-left:6px; vertical-align:1px;
  color:#5B21B6; background:#EDE9FE; text-transform:uppercase; }
.syn-chip.lg { font-size:11px; padding:2px 9px; }
html.strict-real .syn { opacity:.13; pointer-events:none; filter:grayscale(1); }
html.strict-real .syn-chip { opacity:.4; }

.syn-toggle { display:inline-flex; align-items:center; gap:6px; font-size:11px; font-weight:700;
  padding:4px 12px; border-radius:14px; border:1.5px solid #7C3AED; background:#F5F3FF;
  color:#5B21B6; cursor:pointer; margin-left:12px; }
.syn-toggle .dot { width:8px; height:8px; border-radius:50%; background:#7C3AED; }
.syn-toggle.strict { border-color:var(--border-strong); background:var(--surface-sunken);
  color:var(--text-secondary); }
.syn-toggle.strict .dot { background:#94A3B8; }
.syn-reg-link { font-size:10.5px; font-weight:600; color:#7C3AED; margin-left:8px; text-decoration:none; }
.syn-reg-link:hover { text-decoration:underline; }

/* print/PDF watermark whenever illustrative mode is on */
@media print {
  html:not(.strict-real) body::after {
    content: "Includes ILLUSTRATIVE values (violet chips) — seeded pending SEIL data; see the provenance register.";
    position: fixed; bottom: 8px; left: 0; right: 0; text-align: center;
    font-size: 10px; color: #7C3AED; opacity: .8;
  }
}

/* ===== REPORT PRINTING (11 Jun 2026) =====
   Every /report/* page gets a floating Print button (base.html); printing hides
   the app chrome so the report body prints clean on A4. */
.print-report-btn { position: fixed; right: 26px; bottom: 24px; z-index: 900;
  display: inline-flex; align-items: center; gap: 7px; padding: 11px 20px;
  border-radius: 24px; border: none; cursor: pointer; font-size: 13px; font-weight: 700;
  color: #fff; background: var(--brand); box-shadow: 0 6px 20px rgba(29,111,224,.35); }
.print-report-btn:hover { filter: brightness(1.08); }
.print-report-btn .material-icons-outlined { font-size: 18px; }

@media print {
  .sidebar, .topbar, .footer, .print-report-btn, .syn-toggle, .syn-reg-link,
  .de-actions, .lbl-reset { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-container { padding: 0 !important; max-width: 100% !important; }
  body { background: #fff !important; }
  .card { box-shadow: none !important; break-inside: avoid; }
}

/* print button when docked inside the period-selection bar */
.print-report-btn.inline { position: static; margin-left: auto; padding: 8px 16px;
  border-radius: 8px; box-shadow: none; align-self: flex-end; }

/* Ask the Brain — topbar tile (11 Jun 2026; replaces the floating bottom FAB) */
.ask-brain-tile { display:inline-flex; align-items:center; gap:6px; margin-left:12px;
  padding:6px 14px; border-radius:16px; border:none; cursor:pointer;
  font-size:11.5px; font-weight:700; color:#fff;
  background:linear-gradient(100deg,#1D6FE0,#6E47D6);
  box-shadow:0 2px 8px rgba(29,111,224,.3); }
.ask-brain-tile:hover { filter:brightness(1.1); }
/* hide the old floating launcher — the topbar tile is the only entry point */
.zwa-fab { display:none !important; }
@media print { .ask-brain-tile { display:none !important; } }

/* Diagnostics pages (Feedwater / Air-Heater / Combustion) — chart caption.
   Ported 30 Jun 2026; the one class those pages need that wasn't already here. */
.chart-note { font-size: 11px; color: var(--text-tertiary); margin-top: 10px; line-height: 1.6; }
.chart-note strong { color: var(--text-secondary); font-weight: 700; }
