/* ===== Design system refresh (2026-08-09) =====
   Modern-SaaS-dashboard pass (Linear/Stripe/Vercel-style polish) over
   the existing dark theme -- richer contrast between bg/panel layers,
   a proper elevation scale (shadow tokens) instead of borders doing
   all the separation work, softer/larger corner radii, an accent that
   reads as a real brand color (with a hover/active ramp) rather than a
   flat single blue, and consistent transition timing so hover/active
   states feel considered rather than instant. Deliberately keeps every
   existing CSS variable name (--bg/--panel/--text/etc.) so none of the
   ~20 page-specific stylesheets/inline styles that reference them need
   to change -- this is a token-value change, not a token-schema
   change. */
:root {
  --bg: #0b0d12;
  --panel: #12151d;
  --panel2: #1a1e29;
  --panel3: #232838;
  --border: #262b3a;
  --border-strong: #333a4d;
  --text: #eef0f4;
  --muted: #8b93a6;
  --muted-2: #5f6779;
  --accent: #5b8cff;
  --accent-hover: #6f9aff;
  --accent-active: #4a78e6;
  --accent-soft: rgba(91,140,255,.12);
  --green: #3fd97f;
  --red: #f85149;
  --amber: #e3a53a;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.24);
  --shadow: 0 4px 16px rgba(0,0,0,.28);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.4);
  --ease: cubic-bezier(.4,0,.2,1);
  --transition-fast: 120ms var(--ease);
  --transition: 180ms var(--ease);
}

/* DASH-CONSOLE-FORENSIC-AUDIT-001 Dark + Light themes (2026-08-17,
   revised same day -- Night replaced with Light per explicit
   correction). :root above IS the Dark theme (the existing default,
   unchanged) -- Light is a second token block overriding the SAME
   variable names via [data-theme="light"] on <html>, not a duplicate
   component system. A real light palette (white/near-white surfaces,
   dark text, deepened accent/status colors for contrast on white), not
   just an inverted dark theme. */
:root[data-theme="light"] {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel2: #eef0f3;
  --panel3: #e2e5ea;
  --border: #dde1e7;
  --border-strong: #c5cbd3;
  --text: #1a1d24;
  --muted: #5f6779;
  --muted-2: #8b93a6;
  --accent: #3b6fe0;
  --accent-hover: #578dff;
  --accent-active: #2f5bc4;
  --accent-soft: rgba(59,111,224,.10);
  --green: #1f9d55;
  --red: #d92d20;
  --amber: #b7791f;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
/* DASH-CONSOLE-FORENSIC-AUDIT-001 responsive fix (2026-08-17): defense-
   in-depth safety net -- body already has overflow:hidden (below), but
   real headless Chromium at 375px still found document.documentElement
   itself 8px wider than the viewport (a help-tooltip disclosure panel's
   own content width, unrelated to this pass's own changes). Explicit
   here rather than relying on it being an accidental side effect of
   body's own rule. */
html { overflow-x: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Inter, Roboto, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* App-shell layout: header row (fixed height) + a flex row filling the
     rest of the viewport (.shell-body, holding sidebar + main). Only
     main scrolls -- see .shell-body main below. Matches the fixed-shell/
     independently-scrolling-workspace pattern of claude.ai/ChatGPT/
     Linear/GitHub/Cursor, not a sticky-position approximation of it. */
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--accent-hover); }

/* Slim, theme-matched scrollbars -- default browser scrollbars are the
   single biggest "this doesn't look like a real product" tell on a
   dark UI. Firefox + WebKit both covered. */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius); border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
header.topbar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 56px;
  flex-shrink: 0;
  box-sizing: border-box;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 100;
  /* No position:sticky/fixed needed -- the app-shell (html/body height:100%,
     body overflow:hidden, see below) means the header is simply never
     inside any scrolling context, the same structural approach
     claude.ai/ChatGPT/Linear use rather than a sticky-position trick. */
}
.shell-sidebar-toggle {
  background: none; border: 1px solid var(--border); color: var(--muted);
  width: 30px; height: 30px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 15px; line-height: 1; flex-shrink: 0; margin-right: 4px;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}
.shell-sidebar-toggle:hover { color: var(--text); border-color: var(--accent); background: var(--panel2); }
header.topbar .brand {
  font-weight: 700;
  letter-spacing: -.01em;
  margin-right: 24px;
  color: var(--text);
}
.nav-status {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  background: var(--panel2);
  border: 1px solid var(--border);
  padding: 4px 11px;
  border-radius: 999px;
  margin-right: 16px;
  white-space: nowrap;
}

/* Global Factory control (2026-08-07) -- moved off Live Factory into the
   shared shell so Start/Pause/Resume/Stop/Emergency Stop are reachable
   from any page, same dropdown-on-click / close-on-outside-click pattern
   the notification bell already established. */
.shell-factory-control { position: relative; margin-right: 16px; display: flex; align-items: center; gap: 8px; }
.factory-status-btn {
  font-size: 12px; font-weight: 500; color: var(--text); background: var(--panel2); border: 1px solid var(--border);
  padding: 4px 11px; border-radius: 999px; white-space: nowrap; cursor: pointer; font-family: inherit;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.factory-status-btn:hover { border-color: var(--border-strong); background: var(--panel3); }
/* 2026-08-10: Start/Stop, Pause/Resume, Restart as always-visible icon
   buttons directly in the top bar -- same "directly clickable, not
   hidden behind an extra click" affordance as the notification bell
   next to it, per explicit operator request. Emergency Stop stays out
   of this row on purpose (still reachable from the dropdown only). */
.shell-factory-actions { display: flex; align-items: center; gap: 4px; }
.factory-action-icon {
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; line-height: 1; color: var(--text); background: var(--panel2); border: 1px solid var(--border);
  border-radius: 999px; cursor: pointer; font-family: inherit; padding: 0;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.factory-action-icon:hover:not(:disabled) { border-color: var(--border-strong); background: var(--panel3); }
.factory-action-icon:disabled { opacity: .35; cursor: default; }
.factory-dropdown {
  position: absolute; top: 100%; left: 0; margin-top: 8px; width: 280px;
  background: var(--panel2); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); z-index: 50; font-size: 13px; padding: 12px;
  animation: dropdown-in .16s var(--ease);
}
@keyframes dropdown-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .factory-dropdown, .notif-dropdown { animation: none; } }
.factory-dropdown .fd-summary { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.factory-dropdown .fd-restart-progress { font-size: 12px; color: var(--accent, #4a90d9); margin-bottom: 10px; }
.factory-dropdown .fd-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.factory-dropdown .fd-actions .btn { font-size: 12px; padding: 5px 10px; }
.factory-dropdown .fd-viewonly { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); cursor: pointer; margin-bottom: 10px; }
.factory-dropdown .fd-links { border-top: 1px solid var(--border); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.factory-dropdown .fd-links a { font-size: 12px; }
/* DASH-CONTROL-CENTER-IMPL-001 (2026-08-17): fleet dispatch section in
   the same top-menu dropdown, visually separated from local Factory
   controls above it -- same fd-summary/fd-actions look, own top border. */
.factory-dropdown .fd-fleet-section { border-top: 1px solid var(--border); padding-top: 8px; margin-bottom: 10px; }
.factory-dropdown .fd-fleet-section .fd-summary { margin-bottom: 6px; }
.factory-dropdown .fd-fleet-section .fd-actions { margin-bottom: 0; }

/* Notification Center bell (Phase 26.1 Sprint 3) */
.shell-bell { position: relative; margin-right: 16px; cursor: pointer; font-size: 18px; user-select: none; }
.shell-bell .notif-badge {
  position: absolute; top: -6px; right: -8px; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1; padding: 2px 5px; border-radius: 10px;
  min-width: 14px; text-align: center;
}
.notif-dropdown {
  position: absolute; top: 100%; right: 0; margin-top: 8px; width: 320px;
  background: var(--panel2); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); z-index: 50; font-size: 13px;
  animation: dropdown-in .16s var(--ease);
}
.notif-dropdown .notif-item {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 12px;
  border-bottom: 1px solid var(--border); cursor: pointer; text-align: left;
}
.notif-dropdown .notif-item:last-child { border-bottom: none; }
.notif-dropdown .notif-item:hover { background: var(--panel2); }
.notif-dropdown .notif-title { font-weight: 600; }
.notif-dropdown .notif-time { color: var(--muted); font-size: 11px; }
.notif-dropdown .notif-empty { padding: 14px 12px; color: var(--muted); text-align: center; }
.notif-dropdown .notif-footer {
  padding: 8px 12px; text-align: center; border-top: 1px solid var(--border);
}
.notif-dropdown .notif-footer a { font-size: 12px; }
.notif-unread-row { font-weight: 600; }
.notif-unread-row td:first-child { color: var(--red); }
header.topbar nav a {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition-fast), color var(--transition-fast);
}
header.topbar nav a:hover { background: var(--panel2); color: var(--text); }
header.topbar nav a.active { background: var(--accent-soft); color: var(--accent); }
main { padding: 18px 24px; max-width: 1400px; margin: 0 auto; }
.breadcrumb {
  font-size: 12px; color: var(--muted); margin: 0 0 10px;
  display: flex; align-items: center; gap: 6px;
}
.breadcrumb .bc-sep { color: var(--border); }
.breadcrumb .bc-current { color: var(--text); font-weight: 600; }

/* ===== App Shell (Operations Console V1, 2026-07-24) =====
   Sidebar + header shell, injected at runtime by app.js:injectShell()
   from one canonical NAV_ITEMS list -- replaces the old per-page
   hardcoded header.topbar <nav> (13x duplicated). Still a full page
   load per nav click (no client-side router) -- see
   docs/IRA_FOS_OPERATIONS_CONSOLE_V1_ARCHITECTURE.md. */
/* App-shell body row: sidebar + workspace, filling the viewport below
   the header. min-height:0 is required on the flex chain (this + main)
   for overflow-y:auto to actually contain scrolling instead of growing
   with content -- the one non-obvious flexbox rule this layout depends
   on. */
.shell-body { display: flex; align-items: stretch; flex: 1; min-height: 0; }
.shell-sidebar {
  flex-shrink: 0; width: 220px; height: 100%; overflow-y: auto;
  background: var(--panel); border-right: 1px solid var(--border);
  padding: 14px 10px;
  transition: width .15s var(--ease), padding .15s var(--ease);
}
.shell-sidebar.collapsed { width: 0; padding-left: 0; padding-right: 0; overflow: hidden; border-right: none; }
.shell-sidebar nav { display: flex; flex-direction: column; gap: 2px; white-space: nowrap; }
.shell-sidebar nav a {
  padding: 8px 12px; border-radius: var(--radius-sm); color: var(--muted); font-size: 13px; font-weight: 500;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.shell-sidebar nav a:hover { background: var(--panel2); color: var(--text); }
.shell-sidebar nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.shell-body main { flex: 1; min-width: 0; min-height: 0; height: 100%; overflow-y: auto; }
@media (max-width: 900px) {
  /* Narrow viewport: sidebar overlays instead of pushing, so the
     workspace never gets squeezed below a usable width. */
  .shell-sidebar:not(.collapsed) {
    position: fixed; top: 52px; bottom: 0; left: 0; z-index: 200;
    box-shadow: 4px 0 16px rgba(0,0,0,.4);
  }
}

/* DASH-CONSOLE-FORENSIC-AUDIT-001 responsive fix (2026-08-17): the
   header row (sidebar toggle + brand + search + factory control +
   notif bell + theme toggle) doesn't wrap and was overflowing the
   viewport at mobile widths -- real headless Chromium confirmed the
   header's own factory-status-btn was the widest element, pushing
   document.documentElement.scrollWidth past clientWidth (pre-existing,
   confirmed present on companies.html before this pass touched
   anything there; this pass's own new theme-toggle button added a
   little more width to an already-tight row). Search is UI-only today
   (no backend yet, per its own existing code comment) -- hiding it
   below 640px is a real width reduction with zero functional loss;
   the theme toggle collapses to its emoji only, dropping the "Dark"/
   "Night" text label. Desktop/laptop/tablet (>=640px) are unaffected. */
@media (max-width: 640px) {
  .shell-search { display: none; }
  #themeToggle { padding-left: 8px; padding-right: 8px; }
  #themeToggle .theme-toggle-label { display: none; }
}

.shell-search { flex: 1; max-width: 420px; margin: 0 16px; position: relative; }
.shell-search input {
  width: 100%; padding: 6px 9px 6px 30px; font-size: 13px;
}
.shell-search .shell-search-icon {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 13px; pointer-events: none;
}
.shell-search .shell-search-kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--muted); background: var(--panel);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px;
  pointer-events: none;
}

.grid { display: grid; gap: 10px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  /* DASH-CONSOLE-FORENSIC-AUDIT-001 responsive fix (2026-08-17): a wide
     table inside a .card was pushing the WHOLE PAGE wider than the
     viewport at mobile widths (confirmed pre-existing on companies.html/
     campaign_queue.html/pocs.html, not something this pass introduced --
     real headless Chromium at 375px showed document.scrollWidth >
     clientWidth). The table itself now scrolls within its own card
     instead of the page scrolling horizontally -- desktop/laptop/tablet
     are visually unchanged (no room ever needed to open up there). */
  max-width: 100%;
  overflow-x: auto;
}
.card h3 { margin: 0 0 3px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.card .value { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.card .sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
a.stat, .card.interactive { cursor: pointer; }
a.stat:hover, .card.interactive:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }

/* Research & Knowledge reading experience (2026-07-28) -- presentation
   only, operates directly on the rendered Markdown. No new storage, no
   metadata, no search index: a sticky in-page TOC (derived from the same
   headings already rendered), collapsible sections, table rendering,
   and typography/print polish. */
.research-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: start;
}
.research-sidebar {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
}
.research-toc-title { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.research-toc {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.research-toc a {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 4px;
  border-left: 2px solid transparent;
}
.research-toc a:hover { color: var(--text); background: var(--panel); }
.research-toc a.active { color: var(--accent); border-left-color: var(--accent); background: var(--panel); }

.research-content { scroll-behavior: smooth; max-width: 780px; }
.research-content h2 { font-size: 20px; margin: 0 0 12px; }
.research-content h3 { font-size: 15px; margin: 0; display: inline; }
.research-content h4, .research-content h5, .research-content h6 { font-size: 13px; margin: 14px 0 6px; color: var(--muted); }
.research-content p { line-height: 1.6; margin: 0 0 10px; color: var(--text); }
.research-content ul, .research-content ol { line-height: 1.6; margin: 0 0 10px; padding-left: 22px; }
.research-content li { margin-bottom: 3px; }
.research-content blockquote {
  margin: 0 0 10px;
  padding: 6px 12px;
  border-left: 3px solid var(--accent);
  background: var(--panel);
  color: var(--muted);
  border-radius: 0 4px 4px 0;
}
.research-content code {
  background: var(--panel2);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}

/* Collapsible sections -- one per "## " heading. Solves "one long
   scrolling document" directly, not just navigation within it. */
.research-section {
  border-top: 1px solid var(--border);
  padding: 16px 0;
}
.research-section:first-of-type { border-top: none; padding-top: 0; }
.research-section > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.research-section > summary::-webkit-details-marker { display: none; }
.research-section > summary::before {
  content: "\25B8"; /* small right-pointing triangle, rotates when open */
  color: var(--muted);
  font-size: 12px;
  transition: transform .12s ease;
  flex-shrink: 0;
}
.research-section[open] > summary::before { transform: rotate(90deg); }
.research-section-body { margin-top: 12px; }

.research-worker-row, .research-decision-row {
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.research-worker-row:last-child, .research-decision-row:last-child { border-bottom: none; }
.research-worker-row code { font-size: 12px; }

.research-table { border-collapse: collapse; width: 100%; margin: 0 0 12px; font-size: 12.5px; }
.research-table th, .research-table td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
}
.research-table th { background: var(--panel2); font-weight: 600; }
.research-table tr:nth-child(even) td { background: var(--panel); }

@media print {
  header.topbar, .shell-sidebar, .shell-sidebar-toggle, .research-sidebar,
  #btnExpandAllResearch, #btnCollapseAllResearch, #btnRefreshResearch { display: none !important; }
  .research-layout { grid-template-columns: 1fr; }
  .research-section { break-inside: avoid; }
}

@media (max-width: 900px) {
  .research-layout { grid-template-columns: 1fr; }
  .research-sidebar { position: static; max-height: none; }
}

.section-title { font-size: 14px; font-weight: 700; margin: 16px 0 8px; }
/* DASH-CONSOLE-FORENSIC-AUDIT-001 inline-style cleanup (2026-08-17):
   the two highest-frequency inline styles found (47 + 19 occurrences
   across all 21 pages) were both compensating for the SAME missing
   default -- the first section-title on a page needs no top margin,
   and its immediately-following .sub subtitle needs pulling up to sit
   close under it. Real CSS defaults here eliminate the need for every
   future page to repeat either override inline. */
/* main > .section-title:first-child only matches BEFORE the shell's
   own JS runs -- injectShell() (app.js) inserts a .breadcrumb div as
   main's true first child at runtime on every real page load, which
   would otherwise silently break this rule post-render (caught live:
   companies.html/index.html/etc. computed 16px, not 0px, until this
   selector was added). */
main > .section-title:first-child,
main > .breadcrumb + .section-title,
.tabs + .section-title { margin-top: 0; }
.section-title + .sub { margin: -4px 0 14px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr { transition: background var(--transition-fast); }
tr:hover td { background: var(--panel2); }

.btn {
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  margin-right: 8px;
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}
.btn:hover { border-color: var(--border-strong); background: var(--panel3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(91,140,255,.28); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.primary:active { background: var(--accent-active); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover { filter: brightness(1.08); }
.btn.danger-outline { background: transparent; border-color: var(--red); color: var(--red); }
.btn.danger-outline:hover { background: rgba(248,81,73,.12); }
.btn.warn { background: var(--amber); border-color: var(--amber); color: #16130a; }
.btn.warn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn:disabled:hover { border-color: var(--border); background: var(--panel2); }
.btn.small { padding: 4px 9px; font-size: 12px; border-radius: 6px; }

.mc-header { font-size: 18px; font-weight: 700; margin-bottom: 14px; }
.mc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.mc-grid label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 4px; }
.mc-value { font-size: 20px; font-weight: 600; }
@media (max-width: 900px) { .mc-grid { grid-template-columns: 1fr 1fr; } }

.stat-row { display: flex; gap: 20px; margin-top: 6px; flex-wrap: wrap; }
.stat-value { font-size: 22px; font-weight: 700; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
a.stat { padding: 4px 6px; margin: -4px -6px; border-radius: 6px; }
a.stat:hover { background: var(--panel2); }
a.stat:hover .stat-value { color: var(--accent); }

.card.coming-soon { opacity: .55; }
.card.coming-soon h4 { margin: 0 0 6px; }

.profile-card.active { border-color: var(--green); }
.profile-traits { margin: 8px 0; padding-left: 18px; font-size: 12px; color: var(--muted); }
.profile-traits li { margin-bottom: 2px; }
.tag-soon { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; background: rgba(139,148,163,.15); color: var(--muted); margin-left: 8px; }

.collapse-toggle { background: none; border: 1px solid var(--border); color: var(--muted); padding: 4px 10px;
  border-radius: 6px; cursor: pointer; font-size: 12px; }

.saved-filters { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.saved-filters .btn {
  font-size: 11px; padding: 3px 9px; margin-right: 0; border-radius: 12px;
  background: var(--panel); color: var(--muted);
}
.saved-filters .btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.stats-strip {
  font-size: 11px; color: var(--muted); margin: 6px 0; white-space: nowrap;
  overflow-x: auto; padding-bottom: 2px;
}
.stats-strip b { color: var(--text); }

.pagination { display: flex; align-items: center; gap: 4px; }
.pagination .page-num { background: none; border: 1px solid var(--border); color: var(--muted);
  padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.pagination .page-num.active { background: var(--accent); border-color: var(--accent); color: #fff; }

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sortable .sort-indicator { color: var(--accent); margin-left: 3px; }

.problem-card { border-left: 3px solid var(--border); }
.problem-card.sev-bad { border-left-color: var(--red); }
.problem-card.sev-warn { border-left-color: var(--amber); }
.problem-card.sev-idle { border-left-color: var(--border); opacity: .85; }
.problem-card .value { font-size: 24px; }
.problem-card .btn { margin-top: 8px; }

.bulk-bar { display: flex; flex-direction: column; align-items: stretch; gap: 8px; background: var(--panel2);
  border: 1px solid var(--accent); border-radius: var(--radius); padding: 10px 12px; margin-top: 10px; }
.bulk-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bulk-actions .btn { flex: 1; min-width: 110px; font-size: 12px; padding: 6px 8px; }

/* Single-row variant for full-width pages (Queue Explorer) -- the
   stacked .bulk-bar above exists for the master-detail left pane's
   narrow width (Companies/Hiring POCs), where stacking is genuinely
   needed, not stylistic; a full-width page has room for one line. */
.bulk-bar.bulk-bar-inline {
  flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; padding: 8px 12px;
}
.bulk-bar-inline .bulk-actions { flex: 0 0 auto; }
.bulk-bar-inline .bulk-actions .btn { flex: 0 0 auto; min-width: 0; }
.bulk-bar-inline #bulkSelectAll, .bulk-bar-inline #bulkClear { padding: 5px 10px; font-size: 12px; }

/* Left pane = find/select (search, filters, saved filters, stats,
   columns, bulk actions, list). Right pane = pure workspace for the
   selected record. Roughly 40/60 by default; draggable via
   initResizableSplit() in app.js, width persisted per-operator. */
.md-split { display: flex; align-items: stretch; gap: 0; min-height: 60vh; }
.md-list {
  width: 35%; min-width: 300px; max-width: 900px; flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px 0 0 8px;
  max-height: 86vh; padding: 10px;
}
.md-list-controls { flex-shrink: 0; }
.md-list-scroll { flex: 1; overflow-y: auto; margin-top: 6px; border-top: 1px solid var(--border); padding-top: 4px; }
.md-list table { font-size: 13px; }
.md-list tr[data-id] { cursor: pointer; }
.md-list tr[data-id].active td { background: rgba(79,140,255,.14); }
.md-list .pagination { flex-shrink: 0; padding-top: 10px; }
.md-resizer {
  width: 8px; flex-shrink: 0; cursor: col-resize; background: var(--border);
  border-radius: 2px; margin: 0 4px; transition: background .15s;
}
.md-resizer:hover, .md-resizer:active { background: var(--accent); }
.md-detail {
  flex: 1; min-width: 320px; max-height: 84vh; overflow-y: auto;
  border-radius: 0 8px 8px 0;
}
.md-detail-toggle { flex-shrink: 0; white-space: nowrap; }
.md-split.md-detail-collapsed .md-list { width: 100% !important; border-radius: var(--radius); }
.md-split.md-detail-collapsed .md-resizer,
.md-split.md-detail-collapsed .md-detail { display: none; }

.detail-link-row { cursor: pointer; }
.detail-link-row:hover td { background: var(--panel2); color: var(--accent); }

@media (max-width: 1000px) {
  .md-split { flex-direction: column; }
  .md-list { width: 100% !important; max-width: none; max-height: 340px; border-radius: var(--radius); }
  .md-resizer { display: none; }
  .md-detail { border-radius: var(--radius); }
}

.detail-header { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.detail-header h2 { margin: 0 0 6px; font-size: 22px; }
.detail-badges { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.detail-website { font-size: 13px; }

.actions-panel { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 4px; }
.actions-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.actions-group-label { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); width: 100%; margin-top: 4px; }
.actions-group-label:first-child { margin-top: 0; }
.actions-panel .btn { margin-right: 0; padding: 5px 10px; font-size: 12px; }

.pipeline-status { display: flex; flex-wrap: wrap; gap: 14px; background: var(--panel2); border-radius: var(--radius); padding: 7px 12px; }
.pipeline-step { font-size: 12px; display: flex; align-items: center; gap: 5px; }

.meter-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; }
.meter label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); display: block; margin-bottom: 4px; }
.meter .meter-value { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.meter-bar { height: 6px; border-radius: 3px; background: var(--panel2); overflow: hidden; }
.meter-bar-fill { height: 100%; border-radius: 3px; background: var(--accent); }
.meter-bar-fill.warn { background: var(--amber); }
.meter-bar-fill.bad { background: var(--red); }
.meter .na { color: var(--muted); font-size: 13px; }
@media (max-width: 900px) { .meter-row { grid-template-columns: repeat(2, 1fr); } }

.help { display: inline-block; position: relative; margin-left: 6px; vertical-align: middle; }
.help summary { list-style: none; cursor: pointer; color: var(--muted); font-size: 13px;
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; }
.help summary::-webkit-details-marker { display: none; }
.help summary:hover { color: var(--accent); border-color: var(--accent); }
.help[open] summary { color: var(--accent); border-color: var(--accent); }
.help-body {
  position: absolute; top: 22px; left: 0; z-index: 50; width: 320px;
  background: var(--panel3); border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 12px 14px; font-size: 12px; font-weight: 400; line-height: 1.5; color: var(--text);
  box-shadow: var(--shadow-lg);
}
.help-body dt { color: var(--accent); font-weight: 600; margin-top: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.help-body dt:first-child { margin-top: 0; }
.help-body dd { margin: 2px 0 0; color: var(--muted); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .01em; }
.badge.ok { background: rgba(63,185,80,.15); color: var(--green); }
.badge.warn { background: rgba(210,153,34,.15); color: var(--amber); }
.badge.bad { background: rgba(248,81,73,.15); color: var(--red); }
.badge.idle { background: rgba(139,148,163,.15); color: var(--muted); }

/* Factory Control Center gauge lights -- a small panel-indicator LED next
   to each station's name, same three-state read as its status badge (ok/
   warn/idle-or-off) so the two never disagree, just two views of one
   value. Running stations get a soft glow + slow pulse; stopped/disabled
   stations are simply unlit, like a real panel light with no current
   through it. */
.gauge-light {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 8px; vertical-align: middle;
  background: var(--muted); opacity: .35; box-shadow: none;
}
.gauge-light.ok {
  background: var(--green); opacity: 1;
  box-shadow: 0 0 6px 1px rgba(63,185,80,.65);
  animation: gauge-pulse 2.2s ease-in-out infinite;
}
.gauge-light.warn {
  background: var(--amber); opacity: 1;
  box-shadow: 0 0 5px 1px rgba(210,153,34,.55);
}
.gauge-light.bad {
  background: var(--red); opacity: 1;
  box-shadow: 0 0 5px 1px rgba(248,81,73,.55);
}
@keyframes gauge-pulse {
  0%, 100% { box-shadow: 0 0 6px 1px rgba(63,185,80,.65); }
  50% { box-shadow: 0 0 10px 3px rgba(63,185,80,.85); }
}
@media (prefers-reduced-motion: reduce) {
  .gauge-light.ok { animation: none; }
}
.stage-name { display: flex; align-items: center; }

/* ===== Factory Floor Mode (IRA V1.0, 2026-07-22) =====
   Presentation-only: every value below comes from the same /api/status,
   /api/settings, /api/system responses the old table/card layout already
   read. No new endpoints, no new fields, no polling change. */

.factory-banner {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 16px;
}
.factory-banner .fb-top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.factory-banner .fb-title {
  font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.factory-banner .fb-state { font-size: 22px; font-weight: 700; }
.factory-banner .fb-sub { font-size: 13px; color: var(--muted); margin-left: auto; }

/* Factory Supervision warning banner (FOC-OPS-001A, 2026-07-26) -- only
   rendered when it's telling the operator something, never a permanent
   fixture, so no ".sev-ok" variant exists on purpose. */
.factory-banner-warning {
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; font-size: 13.5px;
  border: 1px solid var(--border);
}
.factory-banner-warning.sev-bad { background: rgba(248,81,73,.1); border-color: var(--red); color: var(--red); }
.factory-banner-warning.sev-warn { background: rgba(210,153,34,.1); border-color: var(--amber); color: var(--amber); }
.factory-banner-warning.sev-info { background: var(--panel); color: var(--muted); }
.fb-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 14px;
}
@media (max-width: 900px) { .fb-grid { grid-template-columns: 1fr 1fr; } }
.fb-item label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 3px; }
.fb-item .fb-value { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; }

/* Big Today's Production counters -- statusCard()'s existing markup,
   just a larger type-scale variant applied via this class. */
.card.counter .value { font-size: 34px; }
.card.counter h3 { font-size: 12px; }

/* Station Floor: one full-width card per station, stacked, with a short
   conveyor connector between consecutive cards -- a single vertical line
   reads correctly at any viewport width, where a wrapping grid would
   break the "flowing from one to the next" idea between rows. */
.station-floor { display: flex; flex-direction: column; }
.station-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px;
}
.station-card.is-running { border-color: rgba(63,185,80,.45); }
.sc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.sc-num { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); }
.sc-title { font-size: 15px; font-weight: 700; letter-spacing: .01em; }
.sc-badge { margin-left: auto; }
.sc-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 12px;
}
@media (max-width: 900px) { .sc-grid { grid-template-columns: repeat(2, 1fr); } }
.sc-item label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 3px; }
.sc-item .sc-value { font-size: 14.5px; font-weight: 600; }
.sc-power { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.sc-current { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.sc-current b { color: var(--text); font-weight: 600; }
.sc-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sc-controls .btn { margin-right: 0; }
.sc-controls input[type="number"] { width: 52px; }
.sc-controls .sc-workers-label { font-size: 11px; color: var(--muted); margin-right: -2px; }

.conveyor { display: flex; justify-content: center; padding: 2px 0; }
.conveyor .belt-seg {
  width: 3px; height: 22px; background: var(--border); position: relative;
}
.conveyor .belt-seg.flowing {
  background: repeating-linear-gradient(to bottom, var(--green) 0 6px, transparent 6px 11px);
  animation: belt-flow 0.6s linear infinite;
}
.conveyor .belt-seg.paused {
  background: repeating-linear-gradient(to bottom, var(--amber) 0 6px, transparent 6px 11px);
}
@keyframes belt-flow { to { background-position: 0 11px; } }
@media (prefers-reduced-motion: reduce) { .conveyor .belt-seg.flowing { animation: none; } }

/* Safety Panel -- reuses the last Factory Readiness Self-Test result
   (status().lastSelfTest, already returned by /api/status) plus the
   Environment check it already performs. No live re-poll of these --
   labeled "as of last start" so it's never presented as more current
   than it is. */
.safety-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 900px) { .safety-grid { grid-template-columns: 1fr; } }
.safety-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
}
.safety-item .gauge-light { margin-right: 0; }
.safety-item .si-detail { color: var(--muted); font-size: 11px; margin-left: auto; text-align: right; }

input, select, textarea {
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { width: 100%; min-height: 120px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.field { margin-bottom: 10px; }

pre.log {
  background: #0a0d12;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  max-height: 420px;
  overflow-y: auto;
  font-family: Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
.tabs { display: flex; gap: 4px; margin-bottom: 14px; }
.tabs button { background: none; border: none; color: var(--muted); padding: 8px 14px; cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
/* Cross-page sub-tabs (Factory workspace, 2026-07-24) -- same .tabs look,
   but real page links (Factory is still 4 separate .html files, no
   fragment-swapping) rather than in-page JS-toggled buttons. */
.tabs a { padding: 8px 14px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 13px; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* In-page tab panels (Discovery, 2026-07-25) -- same .tabs button look
   already defined for §1's future-work case, now real: buttons switch
   which .tab-panel is visible on the same page, no navigation. */
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.muted { color: var(--muted); }
.pagination { display: flex; gap: 8px; align-items: center; margin-top: 10px; }

.filter-row { display: flex; gap: 8px; margin-top: 8px; }
.filter-row select, .filter-row input { flex: 1; min-width: 0; }

/* Filter bar cleanup (2026-07-31) -- one compact toolbar row instead of
   several stacked filter blocks (search/sort/checkboxes/advanced/saved
   all visible at once). Workflow checkboxes and Advanced Filters now
   live inside the "Filters" popover; Saved Filters chips live inside
   their own popover -- both reuse the exact same absolute-positioned
   card pattern #columnChooser already established on this page. */
.filter-toolbar { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.filter-toolbar select, .filter-toolbar input[type="text"] { flex: 1; min-width: 120px; }
.filter-popover-wrap { position: relative; flex-shrink: 0; }
.filter-popover {
  position: absolute; top: 100%; margin-top: 4px; z-index: 50;
  min-width: 300px; max-width: 380px; left: 0;
}
.filter-count-badge {
  display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 11px; line-height: 18px;
}
.toolbar-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

/* LinkedIn-style always-visible filter dropdowns/pills (2026-07-31) --
   each filter is its own control in the toolbar, showing its current
   value, instead of grouped behind one popover. */
.filter-select { flex: 0 0 auto; width: auto; min-width: 150px; }
.filter-pill { flex: 0 0 auto; }
.filter-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.filter-checkboxes {
  display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px;
  padding: 8px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.filter-checkboxes label {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--text); margin-bottom: 0; cursor: pointer; white-space: nowrap;
}
.filter-checkboxes input[type="checkbox"] { margin: 0; }
details#advancedFilters { margin-top: 8px; }
details#advancedFilters summary {
  cursor: pointer; font-size: 12px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; padding: 4px 0;
}
details#advancedFilters summary:hover { color: var(--text); }

/* Generalized Progressive Disclosure (2026-07-25, Operator Task Model) --
   same look as the ID-scoped rule above (companies.html/pocs.html's
   Advanced Filters, first use of this pattern), now a reusable class so
   Discovery/Factory/Queue Explorer's Basic/Advanced split doesn't
   reinvent it. Collapsed by default every load -- what's "advanced" on
   a page is a constant, not a per-operator preference to persist. */
details.advanced { margin: 12px 0 4px; }
details.advanced summary {
  cursor: pointer; font-size: 12px; color: var(--muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; padding: 6px 0;
}
details.advanced summary:hover { color: var(--text); }
details.advanced .advanced-body { margin-top: 8px; }
details.advanced[open] summary { color: var(--accent); }
.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--panel3);
  border: 1px solid var(--border-strong); padding: 11px 18px; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500;
  animation: toast-in .22s var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ===== Factory Intake (2026-07-22) =====
   Live validation summary + decide-at-the-end action buttons -- replaces
   the old Priority radio group + Submit button pattern. */
.intake-summary { margin-top: 12px; }
.intake-summary .is-row {
  display: flex; justify-content: space-between; font-size: 12.5px;
  padding: 3px 0; border-bottom: 1px solid var(--border);
}
.intake-summary .is-row:last-child { border-bottom: none; }
.intake-summary .is-label { color: var(--muted); }
.intake-summary .is-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.intake-summary .is-value.zero { color: var(--muted); font-weight: 400; }
.intake-summary .is-value.warn { color: var(--amber); }
.intake-summary .is-value.bad { color: var(--red); }

.intake-actions { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.intake-actions .btn-intake {
  border: none; border-radius: 6px; padding: 10px 14px; cursor: pointer;
  text-align: left; color: #fff; font-size: 13px; font-weight: 700;
}
.intake-actions .btn-intake .ia-sub { display: block; font-size: 11px; font-weight: 400; opacity: .85; margin-top: 2px; }
.intake-actions .btn-intake:disabled { opacity: .35; cursor: not-allowed; }
.intake-actions .btn-queue { background: var(--accent); }
.intake-actions .btn-runnow { background: var(--green); }

/* Timeline Card (2026-07-25) -- shared by Factory's Live Timeline and
   Companies' per-company Event Timeline. Was inline-styled only on
   factory_live.html; moved here once a second real consumer needed it
   (handbook Rule 2, extend don't fork). */
.live-timeline { max-height: 480px; overflow-y: auto; }
.live-event { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.live-event:last-child { border-bottom: none; }
.live-event .t { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
