/* Product UI v2
   Brand-aligned presentation layer. Behavior hooks remain in the existing markup. */

:root {
  --bg: #f3f5f2;
  --bg-accent: #f3f5f2;
  --surface: #ffffff;
  --surface-2: #f8faf8;
  --surface-inset: #edf1ee;
  --border: #d8ddd9;
  --border-strong: #abb4ae;
  --ink: #101512;
  --ink-2: #3f4943;
  --ink-3: #6d7771;
  --ink-4: #929b95;
  --accent: #0c64c0;
  --accent-2: #084c92;
  --accent-ink: #084f99;
  --accent-wash: #deecfa;
  --accent-line: #b7d5f1;
  --pos: #168365;
  --pos-wash: #dff3e9;
  --warn: #946a08;
  --warn-wash: #f8eccb;
  --neg: #b44735;
  --neg-wash: #fae5df;
  --inverse-surface: #101512;
  --inverse-ink: #edf2ee;
  --c1: #0c64c0;
  --c2: #168365;
  --c3: #7656b1;
  --c4: #b98712;
  --c5: #df654b;
  --c6: #64736b;
  --shadow-card: 0 1px 2px rgba(16, 21, 18, .05);
  --shadow-pop: 0 18px 45px rgba(16, 21, 18, .15);
  --r-sm: 5px;
  --r-md: 7px;
  --r-lg: 8px;
  --serif: Georgia, "Times New Roman", serif;
}

:root[data-theme="dark"] {
  --bg: #0f1411;
  --bg-accent: #0f1411;
  --surface: #151c18;
  --surface-2: #19211c;
  --surface-inset: #202a24;
  --border: #2d3932;
  --border-strong: #46564c;
  --ink: #edf2ee;
  --ink-2: #c0cac3;
  --ink-3: #8f9c94;
  --ink-4: #6f7c74;
  --accent: #65a9ea;
  --accent-2: #8bc0ef;
  --accent-ink: #9ac8f1;
  --accent-wash: #172f45;
  --accent-line: #275172;
  --pos: #61b995;
  --pos-wash: #173529;
  --warn: #e1b757;
  --warn-wash: #3a3018;
  --neg: #ec8e7a;
  --neg-wash: #3c211c;
}

body {
  background: var(--bg);
  letter-spacing: 0;
}

body * { letter-spacing: 0; }

/* Shared application shell */
.app { grid-template-columns: 232px minmax(0, 1fr); }
.side {
  background: var(--surface);
  border-right-color: var(--border);
  z-index: 12;
}
.side .brand {
  min-height: 64px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.side .brand .glyph {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--inverse-surface);
  color: var(--inverse-ink);
  box-shadow: none;
}
.side .brand .wm {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
}
.side .brand .pn { font-size: 14px; font-weight: 680; }
.nav-group { padding: 12px 10px 2px; }
.nav-label {
  padding: 7px 8px 6px;
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
}
.nav-item {
  min-height: 34px;
  gap: 9px;
  padding: 7px 9px;
  border-radius: 5px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 560;
}
.nav-item svg { width: 15px; height: 15px; }
.nav-item.active { background: var(--accent-wash); color: var(--accent-ink); }
.nav-item.active::before { left: -10px; top: 6px; bottom: 6px; width: 3px; }
.nav-lock { margin-left: auto; color: var(--ink-4); font-family: var(--mono); font-size: 8px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.side-foot { min-height: 56px; padding: 10px 12px; }
.topbar {
  min-height: 56px;
  padding: 10px 24px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom-color: var(--border);
  backdrop-filter: blur(14px);
}
.topbar .crumb { color: var(--ink-3); }
.canvas {
  max-width: 1360px;
  gap: 20px;
  padding: 24px 28px 56px;
}
.dash-canvas { max-width: 1360px; }
.main, .canvas, .layout, .stack, .card, .tab-content,
#strategyContent, #analyticsContent, #contextContent, #qaContent { min-width: 0; }

.btn, .icon-btn, .input, .select, textarea.input {
  border-radius: 5px;
  box-shadow: none;
}
.btn { font-weight: 620; }
.btn.primary { box-shadow: none; }
.btn.danger { background: transparent; border-color: transparent; }
.btn.danger:hover { border-color: color-mix(in srgb, var(--neg) 35%, var(--border)); }

/* Public demo mutation locks. The wrapper owns the tooltip because disabled
   controls do not consistently receive pointer or keyboard events. */
.locked-action {
  position: relative;
  display: inline-flex;
  flex: none;
  cursor: not-allowed;
  outline: none;
}
.locked-action::after {
  content: attr(data-lock-tip);
  position: absolute;
  z-index: 40;
  left: 50%;
  bottom: calc(100% + 9px);
  width: max-content;
  max-width: min(260px, 76vw);
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow-md);
  font-size: 11.5px;
  font-weight: 560;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity .14s ease, transform .14s ease;
}
.locked-action:hover::after,
.locked-action:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}
.locked-action:focus-visible {
  border-radius: 5px;
  box-shadow: 0 0 0 2px var(--accent-line);
}
.locked-action .demo-locked-btn:disabled {
  opacity: .62;
  pointer-events: none;
}
.locked-action-topbar::after {
  left: auto;
  right: 0;
  transform: translateY(4px);
}
.locked-action-topbar:hover::after,
.locked-action-topbar:focus-visible::after { transform: translateY(0); }
.card, .tile, .section-card, .report-panel {
  border-radius: 8px;
  box-shadow: var(--shadow-card);
}
.eyebrow, .section-eyebrow, .module-bar-label, .strategy-section-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
}
.pill { border-radius: 999px; }
.tag, .chip { border-radius: 4px; }

/* Reports: a scannable intelligence index */
.route-reports .canvas { gap: 14px; }
.route-reports .metrics {
  border-radius: 8px;
  box-shadow: none;
  background: var(--inverse-surface);
  border-color: var(--inverse-surface);
  color: var(--inverse-ink);
}
.route-reports .metric { min-height: 62px; padding: 12px 18px; border-color: rgba(255,255,255,.14); }
.route-reports .metric { min-width: 0; }
.route-reports .metric .ml { color: rgba(255,255,255,.62); font-family: var(--mono); font-size: 9px; text-transform: uppercase; }
.route-reports .metric .mv { font-family: var(--serif); font-size: 23px; font-weight: 400; }
.route-reports .metric .mv.accent { color: #9dccfa; }
.route-reports .sec { margin: 10px 0 0; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.route-reports .sec h2 { font-size: 14px; }
.route-reports .reports { display: flex; flex-direction: column; gap: 0; }
.route-reports .report {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) minmax(330px, 1fr) 24px;
  align-items: center;
  min-height: 82px;
  gap: 24px;
  padding: 14px 16px;
  border-width: 0 0 1px;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.route-reports .report:first-child { border-top: 1px solid var(--border); }
.route-reports .report:hover { transform: none; background: var(--surface); box-shadow: none; border-color: var(--border); }
.route-reports .report.selected { background: var(--accent-wash); box-shadow: inset 3px 0 var(--accent); }
.route-reports .report::after { display: none; }
.route-reports .report-head { min-width: 0; }
.route-reports .mono-av { width: 36px; height: 36px; border-radius: 6px; box-shadow: none; }
.route-reports .report-title { font-size: 14px; }
.route-reports .report-stats { justify-content: flex-start; gap: 32px; }
.route-reports .rstat { min-width: 58px; }
.route-reports .rstat b { font-size: 14px; }
.route-reports .report-arrow { position: static; opacity: 1; transform: none; justify-self: end; color: var(--ink-4); }
.route-reports .report-check { top: 50%; right: 49px; transform: translateY(-50%); opacity: .45; }
.route-reports .report:hover .report-check { opacity: 1; }
.route-reports .selbar { border-radius: 8px; }
.route-reports .source-count { flex: none; padding-right: 36px; color: var(--ink-3); font-size: 11px; white-space: nowrap; }
.route-reports .source-count b { color: var(--ink); font-variant-numeric: tabular-nums; }
.route-reports .reports.view-card {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.route-reports .reports.view-card .report {
  display: flex;
  min-height: 210px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.route-reports .reports.view-card .report:first-child { border-top: 1px solid var(--border); }
.route-reports .reports.view-card .report:hover { border-color: var(--border-strong); background: var(--surface-2); }
.route-reports .reports.view-card .report-head { align-items: flex-start; }
.route-reports .reports.view-card .source-count { position: absolute; left: 18px; bottom: 16px; padding: 0; }
.route-reports .reports.view-card .report-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.route-reports .reports.view-card .rstat:first-child { display: none; }
.route-reports .reports.view-card .rstat b { font-size: 16px; }
.route-reports .reports.view-card .report-arrow { position: absolute; right: 18px; bottom: 17px; }
.route-reports .reports.view-card .report-check { top: 18px; right: 18px; transform: none; }

/* Company workspace: the company is the parent; platforms are its sources. */
.route-competitor .competitor-canvas { max-width: 1240px; gap: 24px; }
.route-competitor .competitor-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 6px 0 22px;
  border-bottom: 1px solid var(--border);
}
.route-competitor .competitor-identity { display: flex; align-items: center; gap: 16px; min-width: 0; }
.route-competitor .competitor-avatar { width: 52px; height: 52px; display: grid; place-items: center; flex: none; border-radius: 7px; background: var(--inverse-surface); color: var(--inverse-ink); font-family: var(--serif); font-size: 20px; }
.route-competitor .competitor-identity h1 { margin: 3px 0 2px; font-family: var(--serif); font-size: 32px; font-weight: 400; line-height: 1.1; }
.route-competitor .competitor-identity p { color: var(--ink-3); font-size: 12px; }
.route-competitor .competitor-summary { display: flex; gap: 0; flex: none; }
.route-competitor .competitor-summary > div { min-width: 112px; padding: 0 18px; border-left: 1px solid var(--border); }
.route-competitor .competitor-summary strong { display: block; color: var(--ink); font-family: var(--serif); font-size: 23px; font-weight: 400; }
.route-competitor .competitor-summary span { display: block; margin-top: 2px; color: var(--ink-3); font-size: 10px; }
.route-competitor .platform-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.route-competitor .platform-card {
  min-height: 290px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}
.route-competitor .platform-card-wide { grid-column: 1 / -1; min-height: 220px; display: grid; grid-template-columns: 140px minmax(0, 1fr) 250px; align-items: center; }
.route-competitor .platform-card.is-active { border-color: var(--accent-line); box-shadow: inset 0 3px var(--accent); transition: border-color .15s, background .15s; }
.route-competitor .platform-card.is-active:hover { border-color: var(--accent); background: var(--surface-2); }
.route-competitor .platform-card.is-locked { background: var(--surface-2); }
.route-competitor .platform-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.route-competitor .platform-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--border-strong); border-radius: 5px; background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 750; }
.route-competitor .platform-mark.linkedin { background: #0a66c2; border-color: #0a66c2; color: #fff; font-family: Georgia, serif; font-size: 18px; }
.route-competitor .platform-mark.meta { color: var(--c3); }
.route-competitor .platform-mark.google { color: var(--c5); }
.route-competitor .platform-mark.cross { width: 46px; color: var(--ink-2); font-family: var(--mono); font-size: 9px; letter-spacing: .08em; }
.route-competitor .platform-status { padding: 4px 7px; border-radius: 3px; font-family: var(--mono); font-size: 9px; text-transform: uppercase; }
.route-competitor .platform-status.live { background: var(--pos-wash); color: var(--pos); }
.route-competitor .platform-status.future { background: var(--surface-inset); color: var(--ink-3); }
.route-competitor .platform-card h2 { margin: 5px 0 8px; font-family: var(--serif); font-size: 24px; font-weight: 400; }
.route-competitor .platform-card p:not(.eyebrow) { max-width: 52ch; color: var(--ink-2); font-size: 13px; line-height: 1.55; }
.route-competitor .platform-metrics { display: flex; gap: 22px; color: var(--ink-3); font-size: 11px; }
.route-competitor .platform-metrics b { color: var(--ink); font-size: 14px; }
.route-competitor .platform-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--ink-3); font-size: 11px; }
.route-competitor .open-label { color: var(--accent-ink); font-weight: 650; white-space: nowrap; }
.route-competitor .lock-label { color: var(--ink-4); font-family: var(--mono); font-size: 9px; text-transform: uppercase; }

/* New report: one job configuration surface with a persistent summary */
.route-operation .canvas { max-width: 1260px; }
.route-operation .layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; }
.route-operation .layout > .stack:first-child > .card {
  border-radius: 8px;
  box-shadow: none;
}
.route-operation .card-section { padding: 22px 24px 24px 70px; position: relative; }
.route-operation .sec-title { margin-bottom: 18px; }
.route-operation .sec-title .n {
  position: absolute;
  left: 24px;
  top: 21px;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--accent-line);
  border-radius: 50%;
  background: var(--accent-wash);
  font-family: var(--mono);
}
.route-operation .sec-title h2 { font-size: 15px; }
.route-operation .card-section::before {
  content: "";
  position: absolute;
  left: 37px;
  top: 48px;
  bottom: -1px;
  width: 1px;
  background: var(--border);
}
.route-operation .card-section:last-child::before { display: none; }
.route-operation .country-picklist { border-radius: 6px; background: var(--surface-2); }
.route-operation .country-option span { border-radius: 4px; }
.route-operation .steps { gap: 0; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.route-operation .step { border: 0; border-radius: 0; border-bottom: 1px solid var(--border); background: var(--surface); }
.route-operation .step:last-child { border-bottom: 0; }
.route-operation .step.on { background: var(--accent-wash); }
.route-operation .layout > .stack:last-child { position: sticky; top: 80px; }
.route-operation .layout > .stack:last-child .card { box-shadow: none; border-top: 3px solid var(--green, var(--pos)); }
.route-operation .log { border-radius: 6px; }

/* Dashboard shell and common data surfaces */
.route-dashboard .tab-page { width: 100%; }
.route-dashboard .section-card { padding: 0; overflow: hidden; box-shadow: none; }
.route-dashboard .stats {
  gap: 0;
  margin: 0;
  border-bottom: 1px solid var(--border);
}
.route-dashboard .stat-card {
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  background: var(--surface);
  padding: 14px 16px;
}
.route-dashboard .stat-card:last-child { border-right: 0; }
.route-dashboard .stat-card .value { font-family: var(--serif); font-size: 26px; font-weight: 400; }
.route-dashboard .filters {
  position: sticky;
  top: 56px;
  z-index: 4;
  gap: 8px;
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(12px);
}
.route-dashboard .view-switcher { border-radius: 5px; }
.route-dashboard .ad-grid { gap: 0; }
.route-dashboard .ad-grid.view-list-mode .ad-card {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  background: var(--surface);
}
.route-dashboard .ad-grid.view-list-mode .ad-card:hover { transform: none; background: var(--surface-2); box-shadow: none; }
.route-dashboard .ad-grid.view-list-mode .ad-card-header { padding: 10px 16px; min-height: 58px; }
.route-dashboard .frequency-badge { border-radius: 4px; background: var(--neg-wash); color: var(--neg); }
.route-dashboard .facebook-ad-card { border-radius: 8px; box-shadow: none; }
.route-dashboard .facebook-ad-card:hover { transform: none; box-shadow: 0 8px 22px rgba(16,21,18,.10); }

/* Context: identity, observation and sources have distinct weight */
.route-dashboard #contextContent { gap: 0; }
.route-dashboard .ctx-briefing {
  border-radius: 8px 8px 0 0;
  box-shadow: none;
  border-bottom: 0;
  border-left: 4px solid var(--accent);
  padding: 22px 24px;
}
.route-dashboard .ctx-head .mono-av { border-radius: 6px; box-shadow: none; }
.route-dashboard .ctx-summary { font-size: 15px; max-width: 82ch; }
.route-dashboard .ctx-observed {
  border-radius: 0;
  box-shadow: none;
  background: var(--surface-2);
}
.route-dashboard .ctx-sources { border-radius: 0 0 8px 8px; box-shadow: none; }

/* Analytics: answer first, evidence second */
.route-dashboard #analyticsContent { gap: 18px; }
.route-dashboard .data-window { border-radius: 6px; box-shadow: none; }
.route-dashboard .scorecard { gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.route-dashboard .score-card {
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  min-height: 104px;
}
.route-dashboard .score-card:last-child { border-right: 0; }
.route-dashboard .score-card .score-value { font-family: var(--serif); font-weight: 400; }
.route-dashboard .module-bar {
  display: grid;
  grid-template-columns: auto repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  width: 100%;
  overflow: hidden;
}
.route-dashboard .module-bar-label { display: flex; align-items: center; padding: 0 14px; border-right: 1px solid var(--border); background: var(--surface-2); }
.route-dashboard .module-chip { min-height: 42px; justify-content: flex-start; gap: 8px; padding: 9px 13px; border: 0; border-right: 1px solid var(--border); border-bottom: 3px solid transparent; border-radius: 0; background: var(--surface); color: var(--ink-3); line-height: 1.25; }
.route-dashboard .module-chip:last-child { border-right: 0; }
.route-dashboard .module-chip:hover { background: var(--surface-2); }
.route-dashboard .module-chip.on { border-bottom-color: var(--accent); background: var(--surface); color: var(--ink); }
.route-dashboard .module-tick { width: 18px; height: 18px; flex: none; display: grid; place-items: center; border: 1px solid var(--border-strong); border-radius: 3px; background: var(--surface); }
.route-dashboard .module-chip.on .module-tick { border-color: var(--accent); background: var(--accent); color: #fff; }
.route-dashboard #analyticsContent .section-eyebrow { min-height: 16px; margin: 0 2px 10px; line-height: 1.45; }
.route-dashboard #analyticsSegments .seg-head { min-height: 34px; margin: 0 2px 10px; }
.route-dashboard #analyticsSegments .seg-head .section-eyebrow { min-height: 0; margin: 0; }
.route-dashboard #analyticsCrosscut,
.route-dashboard #analyticsContent > [data-module="message"],
.route-dashboard #analyticsContent > [data-module="winners"] { padding-top: 4px; }
.route-dashboard #analyticsContent > [data-module="message"] .report-grid-2 + .report-grid-2 { margin-top: 16px; }
.route-dashboard .module-toggle, .route-dashboard .module-btn {
  border-radius: 4px;
  box-shadow: none;
}
.route-dashboard .report-panel { box-shadow: none; border-radius: 8px; }
.route-dashboard .market-card { border-radius: 8px; box-shadow: none; }

/* Strategy: the decision surface carries the editorial brand */
.route-dashboard .strategy-report { gap: 22px; }
.route-dashboard .verdict-card {
  border-radius: 8px;
  border-top: 4px solid var(--accent);
  box-shadow: none;
  padding: 28px 28px 24px;
}
.route-dashboard .verdict-headline {
  max-width: 34ch;
  font-family: var(--serif);
  font-size: 29px;
  font-weight: 400;
  line-height: 1.17;
}
.route-dashboard .verdict-decision { max-width: 72ch; }
.route-dashboard .strategy-grid-3 { gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.route-dashboard .strategy-grid-3 > * {
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}
.route-dashboard .strategy-grid-3 > *:last-child { border-right: 0; }
.route-dashboard .strategy-module-nav {
  top: 56px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg) 95%, transparent);
  backdrop-filter: blur(12px);
}
.route-dashboard .strategy-module-nav a,
.route-dashboard .strategy-action-btn,
.route-dashboard .strategy-evidence-chip { border-radius: 4px; }
.route-dashboard .strategy-module-card,
.route-dashboard .strategy-report-section,
.route-dashboard .strategy-card,
.route-dashboard .strategy-memo-card,
.route-dashboard .strategy-brief-card,
.route-dashboard .strategy-insight-card,
.route-dashboard .strategy-opportunity-item,
.route-dashboard .strategy-metric,
.route-dashboard .strategy-kpi {
  border-radius: 8px;
  box-shadow: none;
  background: var(--surface);
}
.route-dashboard .strategy-implication { border-radius: 0 6px 6px 0; }

/* Quality check is a triage table, not a card gallery */
.route-dashboard .qa-subtabs { gap: 0; border-bottom: 1px solid var(--border); }
.route-dashboard .qa-subtab {
  padding: 8px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--ink-3);
}
.route-dashboard .qa-subtab.active { border-color: var(--accent); background: transparent; color: var(--accent-ink); }
.route-dashboard .qa-toolbar { position: sticky; top: 56px; z-index: 3; padding: 10px 0; background: var(--bg); }
.route-dashboard .qa-toolbar input,
.route-dashboard .qa-toolbar select { height: 34px; padding: 0 10px; border-radius: 5px; background: var(--surface); font-size: 13px; }
.route-dashboard .qa-table-wrap {
  border-color: var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
}
.route-dashboard .qa-table th,
.route-dashboard .qa-table td { border-bottom-color: var(--border); }
.route-dashboard .qa-table th { background: var(--surface-2); color: var(--ink-3); }
.route-dashboard .qa-table td { background: var(--surface); color: var(--ink-2); }
.route-dashboard .qa-table td strong,
.route-dashboard .qa-ad-title { color: var(--ink); }
.route-dashboard .qa-table tr:hover td { background: var(--surface-inset); }
.route-dashboard .qa-badge,
.route-dashboard .qa-source-links a {
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  background: var(--accent-wash);
  color: var(--accent-ink);
}
.route-dashboard .qa-source-links a:hover { border-color: var(--accent); background: var(--surface-inset); }
.route-dashboard .qa-review-note {
  border-color: color-mix(in srgb, var(--warn) 45%, var(--border));
  background: var(--warn-wash);
  color: var(--warn);
}

/* Analytics controls and heatmaps must retain contrast in either theme. */
.route-dashboard .seg-pivot {
  border-color: var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
}
.route-dashboard .seg-pivot-btn { border-radius: 3px; color: var(--ink-2); }
.route-dashboard .seg-pivot-btn:hover { background: var(--surface-inset); color: var(--ink); }
.route-dashboard .seg-pivot-btn.active { background: var(--accent); color: var(--surface-inset); box-shadow: none; }
.route-dashboard .heat-cell {
  border: 1px solid var(--border);
  background: var(--surface-inset);
  color: var(--ink-2);
}
.route-dashboard .heat-level-1 { border-color: var(--accent-line); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--ink); }
.route-dashboard .heat-level-2 { border-color: transparent; background: color-mix(in srgb, var(--accent) 32%, var(--surface)); color: var(--ink); }
.route-dashboard .heat-level-3 { border-color: transparent; background: color-mix(in srgb, var(--accent) 50%, var(--surface)); color: var(--ink); }
.route-dashboard .heat-level-4 { border-color: transparent; background: color-mix(in srgb, var(--accent) 72%, var(--surface)); color: var(--surface-inset); }
.route-dashboard .heat-level-5 { border-color: transparent; background: var(--accent-2); color: var(--surface-inset); }

/* Compare: wide evidence matrix */
.route-compare .canvas { max-width: 1440px; }
.route-compare #subhead {
  padding: 14px 16px;
  max-width: none !important;
  border-left: 3px solid var(--accent);
  background: var(--accent-wash);
  color: var(--ink-2) !important;
}
.route-compare #content { display: flex; flex-direction: column; gap: 18px; }
.route-compare #content > .card { overflow: hidden; background: var(--surface); color: var(--ink); box-shadow: none; }
.route-compare .panel-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--border); background: var(--surface); }
.route-compare .cmp th,
.route-compare .cmp td { border-bottom-color: var(--border); }
.route-compare .cmp td { background: var(--surface); color: var(--ink-2); }
.route-compare .cmp tbody tr:hover td { background: var(--surface-inset); }
.route-compare .cmp thead th { position: sticky; top: 56px; z-index: 2; background: var(--surface-2); color: var(--ink-3); }
.route-compare .cmp th:first-child,
.route-compare .cmp td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.route-compare .cmp thead th:first-child { z-index: 3; background: var(--surface-2); }
.route-compare .claim-text { font-family: var(--serif); font-size: 17px; line-height: 1.45; color: var(--ink); }

/* Prompts: a technical system workspace */
.prompt-locked { overflow: hidden; }
.prompt-locked > .app { visibility: hidden; }
.prompt-gate[hidden] { display: none; }
.prompt-gate { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; background: var(--inverse-surface); }
.prompt-gate-card { width: min(100%, 420px); padding: 30px; border: 1px solid var(--border-strong); border-top: 4px solid var(--accent); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-pop); }
.prompt-gate-icon { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 22px; border-radius: 6px; background: var(--accent-wash); color: var(--accent-ink); }
.prompt-gate-icon svg { width: 21px; height: 21px; }
.prompt-gate-card .eyebrow { margin-bottom: 8px; }
.prompt-gate-card h1 { margin: 0; font-size: 24px; line-height: 1.2; }
.prompt-gate-card > p:not(.eyebrow):not(.prompt-gate-error) { margin: 9px 0 22px; color: var(--ink-3); font-size: 13px; }
.prompt-gate-card .input { margin: 6px 0 0; }
.prompt-gate-error { min-height: 22px; margin: 5px 0 4px; color: var(--neg); font-size: 12px; }
.prompt-gate-card .btn { width: 100%; }
.prompt-gate-card > a { display: block; margin-top: 16px; color: var(--ink-3); font-size: 12px; text-align: center; }
.route-prompts .canvas { max-width: 1440px; }
.route-prompts .layout { grid-template-columns: 300px minmax(0, 1fr); gap: 20px; }
.route-prompts .layout > .stack:first-child { position: sticky; top: 80px; }
.route-prompts .layout > .stack > .card { box-shadow: none; }
.route-prompts .template-list { gap: 0; margin: 0 -24px -20px; }
.route-prompts .template-item {
  border-width: 1px 0 0;
  border-radius: 0;
  padding: 12px 24px;
  background: transparent;
}
.route-prompts .template-item.active { border-color: var(--border); box-shadow: inset 3px 0 var(--accent); background: var(--accent-wash); }
.route-prompts .editor-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.route-prompts .editor-body { padding: 16px 20px 20px; }
.route-prompts textarea#promptText { border-radius: 6px; min-height: 590px; }
.route-prompts .editor-actions { padding-top: 2px; flex-wrap: wrap; }

/* Responsive application shell */
@media (max-width: 1100px) {
  .app { grid-template-columns: 204px minmax(0, 1fr); }
  .canvas { padding-right: 20px; padding-left: 20px; }
  .route-dashboard .strategy-grid-3 { grid-template-columns: 1fr; }
  .route-dashboard .strategy-grid-3 > * { border-right: 0; border-bottom: 1px solid var(--border); }
  .route-dashboard .strategy-grid-3 > *:last-child { border-bottom: 0; }
}

@media (max-width: 900px) {
  .app { display: block; }
  .side {
    position: sticky;
    top: 0;
    height: auto;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .side .brand { min-width: 190px; border-bottom: 0; border-right: 1px solid var(--border); }
  .side .nav-group { display: flex; align-items: center; gap: 2px; padding: 8px; }
  .side .nav-label { display: none; }
  .side .nav-item { width: auto; white-space: nowrap; }
  .side .nav-item.active::before { left: 8px; right: 8px; top: auto; bottom: -8px; width: auto; height: 3px; }
  .side-foot { display: none; }
  .topbar { top: 64px; }
  .route-dashboard .filters,
  .route-dashboard .qa-toolbar,
  .route-dashboard .strategy-module-nav { top: 120px; }
  .route-operation .layout,
  .route-prompts .layout { grid-template-columns: 1fr; }
  .route-operation .layout > .stack:last-child,
  .route-prompts .layout > .stack:first-child { position: static; }
  .route-reports .report { grid-template-columns: minmax(220px, 1fr) minmax(300px, .8fr) 20px; }
  .route-competitor .competitor-head { align-items: flex-start; flex-direction: column; }
  .route-competitor .platform-grid { grid-template-columns: 1fr 1fr; }
  .route-competitor .platform-card-wide { grid-column: 1 / -1; grid-template-columns: 90px minmax(0, 1fr); }
  .route-competitor .platform-card-wide .platform-card-foot { grid-column: 1 / -1; width: 100%; }
  .route-dashboard .scorecard { grid-template-columns: repeat(2, 1fr); }
  .route-dashboard .module-bar { grid-template-columns: 1fr 1fr; }
  .route-dashboard .module-bar-label { grid-column: 1 / -1; min-height: 30px; border-right: 0; border-bottom: 1px solid var(--border); }
  .route-dashboard .module-chip:nth-of-type(2) { border-right: 0; }
  .route-dashboard .score-card { border-bottom: 1px solid var(--border); }
}

@media (max-width: 640px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .side { width: 100%; }
  .side .brand { min-width: 56px; width: 56px; padding: 12px; }
  .side .brand > div { display: none; }
  .topbar { top: 57px; padding: 8px 12px; min-height: 52px; }
  .topbar .crumb { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .canvas { padding: 16px 12px 40px; }
  .route-reports .topbar .crumb { display: none; }
  .route-reports .topbar .search { width: auto; max-width: none; min-width: 0; flex: 1; }
  .route-reports .topbar .btn.primary { width: 38px; padding: 0; font-size: 0; flex: none; }
  .route-reports .topbar .btn.primary svg { width: 16px; height: 16px; }
  .route-reports .metrics { display: grid; grid-template-columns: 1fr 1fr; }
  .route-reports .metric { border-bottom: 1px solid rgba(255,255,255,.14); }
  .route-reports .report { grid-template-columns: 1fr 20px; gap: 10px; }
  .route-reports .report-stats { grid-column: 1 / -1; padding-left: 48px; gap: 18px; }
  .route-reports .source-count { display: none; }
  .route-reports .reports.view-card { grid-template-columns: 1fr; }
  .route-reports .reports.view-card .source-count { display: block; }
  .route-reports .reports.view-card .report-stats { padding-left: 0; }
  .route-competitor .competitor-summary { width: 100%; overflow-x: auto; }
  .route-competitor .competitor-summary > div { min-width: 100px; padding: 0 12px; }
  .route-competitor .platform-grid { grid-template-columns: 1fr; }
  .route-competitor .platform-card-wide { grid-column: auto; display: flex; min-height: 290px; }
  .route-operation .card-section { padding: 20px 16px 22px 54px; }
  .route-operation .sec-title .n { left: 14px; top: 19px; }
  .route-operation .card-section::before { left: 27px; }
  .route-operation .fields, .route-operation .field, .route-operation .input,
  .route-operation .country-picklist, .route-operation .steps { min-width: 0; max-width: 100%; }
  .route-dashboard .stats { grid-template-columns: 1fr 1fr; }
  .route-dashboard .stat-card:nth-child(2) { border-right: 0; }
  .route-dashboard .stat-card:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .route-dashboard .filters,
  .route-dashboard .qa-toolbar,
  .route-dashboard .strategy-module-nav { position: static; }
  .route-dashboard .verdict-card { padding: 22px 18px; }
  .route-dashboard .verdict-headline { font-size: 24px; }
  .route-dashboard .ctx-observed-grid { grid-template-columns: 1fr; }
  .route-dashboard .scorecard { display: grid; grid-template-columns: 1fr; }
  .route-dashboard .score-card { border-right: 0; }
  .route-dashboard .module-bar { grid-template-columns: 1fr; }
  .route-dashboard .module-chip { border-right: 0; border-bottom: 1px solid var(--border); }
  .route-dashboard .module-chip.on { border-bottom-color: var(--border); box-shadow: inset 3px 0 var(--accent); }
  .route-dashboard .topbar .report-delete-btn { width: 34px; padding: 0; font-size: 0; }
  .route-dashboard .topbar #companyWorkspaceLink { width: 34px; padding: 0; font-size: 0; }
  .route-dashboard .topbar #companyWorkspaceLink svg { width: 15px; height: 15px; }
  .route-dashboard .angle-grid { grid-template-columns: minmax(0, 1fr); }
  .route-dashboard .angle-card, .route-dashboard .hero-test { min-width: 0; overflow: hidden; }
  .route-dashboard .verdict-top { align-items: flex-start; }
  .route-compare .cmp thead th { top: 109px; }
  .route-prompts .editor-actions .field-hint { flex-basis: 100%; }
}
