/* Mijoro runtime theme system.
 * CSS custom properties mirror the shared theme catalog and design tokens so
 * the selected theme can swap at the document root without per-component rewrites. */

:root {
  --ui-color-scheme: dark;
  --bg-base: #0d0f14;
  --bg-surface: #12141c;
  --bg-elevated: #1a1d25;
  --bg-overlay: #0e1018;
  --bg-hover: #ffffff0a;
  --bg-active: #ffffff10;

  --text-primary: #e8ebf0;
  --text-secondary: #c8cdd5;
  --text-muted: #8b92a0;
  --text-faint: #4b5263;
  --text-disabled: #2d3040;

  --brand-primary: #2563eb;
  --brand-primary-hover: #1d4ed8;
  --brand-primary-muted: #2563eb20;
  --brand-accent: #7c3aed;
  --brand-accent-muted: #7c3aed20;
  --brand-gradient-start: #2563eb;
  --brand-gradient-end: #7c3aed;
  --brand-gradient-shadow: rgba(124, 58, 237, 0.15);

  --status-success: #10b981;
  --status-success-muted: #10b98120;
  --status-warning: #f59e0b;
  --status-warning-muted: #f59e0b20;
  --status-danger: #ef4444;
  --status-danger-muted: #ef444420;
  --status-info: #3b82f6;
  --status-info-muted: #3b82f620;

  --stage-intake: #60a5fa;
  --stage-interview: #a78bfa;
  --stage-research: #22d3ee;
  --stage-competitors: #fb923c;
  --stage-boardroom: #4ade80;
  --stage-nexus: #f87171;

  --border: #1e2130;
  --border-hover: #2e3248;
  --border-subtle: #1a1d28;

  /* Semantic surface aliases used by Initiatives and other card-based layouts */
  --surface-base: var(--bg-surface);
  --surface-raised: var(--bg-elevated);
  --surface-sunken: var(--bg-base);
  --bg-inset: #0a0c10;

  /* Shorthand brand alias and on-accent text */
  --brand: var(--brand-primary);
  --accent: var(--brand-primary);
  --text-on-accent: #ffffff;
  --theme-pill-bg: rgba(37, 99, 235, 0.1);
  --theme-pill-border: rgba(96, 165, 250, 0.22);
  --theme-panel-border: rgba(96, 165, 250, 0.18);
  --theme-panel-glow: rgba(37, 99, 235, 0.14);
  --theme-scrim: rgba(3, 7, 18, 0.56);
  --theme-hero-sheen:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.16), transparent 34%),
    linear-gradient(160deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.82));

  --rail-w: 0px;
  --sidebar-w: 240px;
  --sidebar-collapsed-w: 52px;
  --topbar-h: 46px;
  --assist-w: 320px;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 12px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

html[data-theme="ergonomic-sweet-spot"] {
  --ui-color-scheme: light;
  --bg-base: #fdf6e3;
  --bg-surface: #fffaf0;
  --bg-elevated: #ffffff;
  --bg-overlay: #f1ead7;
  --bg-hover: #2a241b0c;
  --bg-active: #2a241b14;

  --text-primary: #2a241b;
  --text-secondary: #3b342b;
  --text-muted: #6b6257;
  --text-faint: #9d9285;
  --text-disabled: #cbc0b3;

  --brand-primary: #245c7c;
  --brand-primary-hover: #1c4964;
  --brand-primary-muted: #245c7c16;
  --brand-accent: #8a5a44;
  --brand-accent-muted: #8a5a4416;
  --brand-gradient-start: #245c7c;
  --brand-gradient-end: #8a5a44;
  --brand-gradient-shadow: rgba(138, 90, 68, 0.16);

  --status-success: #2d6a4f;
  --status-success-muted: #2d6a4f18;
  --status-warning: #9b6700;
  --status-warning-muted: #9b670018;
  --status-danger: #a63a2a;
  --status-danger-muted: #a63a2a16;
  --status-info: #245c7c;
  --status-info-muted: #245c7c16;

  --border: #ddd2c1;
  --border-hover: #b7aa97;
  --border-subtle: #ece2d4;
  --surface-base: var(--bg-surface);
  --surface-raised: var(--bg-elevated);
  --surface-sunken: #f4ecdc;
  --bg-inset: #efe6d6;

  --text-on-accent: #fffdf8;
  --theme-pill-bg: rgba(36, 92, 124, 0.08);
  --theme-pill-border: rgba(36, 92, 124, 0.18);
  --theme-panel-border: rgba(138, 90, 68, 0.18);
  --theme-panel-glow: rgba(138, 90, 68, 0.12);
  --theme-scrim: rgba(42, 36, 27, 0.24);
  --theme-hero-sheen:
    radial-gradient(circle at top right, rgba(138, 90, 68, 0.12), transparent 32%),
    linear-gradient(160deg, rgba(255, 250, 240, 0.98), rgba(244, 236, 220, 0.92));
}

html[data-theme="solarized"] {
  --ui-color-scheme: light;
  --bg-base: #fdf6e3;
  --bg-surface: #f5efdc;
  --bg-elevated: #fffdf6;
  --bg-overlay: #eee8d5;
  --bg-hover: #0736420d;
  --bg-active: #07364216;

  --text-primary: #073642;
  --text-secondary: #586e75;
  --text-muted: #657b83;
  --text-faint: #93a1a1;
  --text-disabled: #b5c0c2;

  --brand-primary: #006d77;
  --brand-primary-hover: #00545c;
  --brand-primary-muted: #006d7716;
  --brand-accent: #586e75;
  --brand-accent-muted: #586e7516;
  --brand-gradient-start: #006d77;
  --brand-gradient-end: #586e75;
  --brand-gradient-shadow: rgba(88, 110, 117, 0.15);

  --status-success: #6c8d00;
  --status-success-muted: #6c8d0018;
  --status-warning: #8b5e00;
  --status-warning-muted: #8b5e0018;
  --status-danger: #b02f2f;
  --status-danger-muted: #b02f2f16;
  --status-info: #006d77;
  --status-info-muted: #006d7716;

  --border: #d7d0bf;
  --border-hover: #b8b0a2;
  --border-subtle: #e8e1cf;
  --surface-base: var(--bg-surface);
  --surface-raised: var(--bg-elevated);
  --surface-sunken: #efe8d6;
  --bg-inset: #ebe3d0;

  --text-on-accent: #fdf6e3;
  --theme-pill-bg: rgba(0, 109, 119, 0.08);
  --theme-pill-border: rgba(0, 109, 119, 0.18);
  --theme-panel-border: rgba(88, 110, 117, 0.18);
  --theme-panel-glow: rgba(88, 110, 117, 0.12);
  --theme-scrim: rgba(7, 54, 66, 0.24);
  --theme-hero-sheen:
    radial-gradient(circle at top right, rgba(38, 139, 210, 0.12), transparent 34%),
    linear-gradient(160deg, rgba(253, 246, 227, 0.98), rgba(238, 232, 213, 0.9));
}

html[data-theme="soft-dark"] {
  --ui-color-scheme: dark;
  --bg-base: #121212;
  --bg-surface: #1a1b1f;
  --bg-elevated: #23252a;
  --bg-overlay: #18191d;
  --bg-hover: #ffffff0a;
  --bg-active: #ffffff12;

  --text-primary: #e0e0e0;
  --text-secondary: #d0d0d0;
  --text-muted: #a4a7ab;
  --text-faint: #6c7074;
  --text-disabled: #43474c;

  --brand-primary: #4170b5;
  --brand-primary-hover: #365f9a;
  --brand-primary-muted: #4170b520;
  --brand-accent: #5b4bb7;
  --brand-accent-muted: #5b4bb720;
  --brand-gradient-start: #4170b5;
  --brand-gradient-end: #5b4bb7;
  --brand-gradient-shadow: rgba(91, 75, 183, 0.18);

  --status-success: #52b788;
  --status-success-muted: #52b78820;
  --status-warning: #d8a657;
  --status-warning-muted: #d8a65720;
  --status-danger: #d96c75;
  --status-danger-muted: #d96c7520;
  --status-info: #5dade2;
  --status-info-muted: #5dade220;

  --border: #2d3036;
  --border-hover: #3c4048;
  --border-subtle: #25272c;
  --surface-base: var(--bg-surface);
  --surface-raised: var(--bg-elevated);
  --surface-sunken: #101114;
  --bg-inset: #0d0e11;

  --text-on-accent: #f7f8fa;
  --theme-pill-bg: rgba(65, 112, 181, 0.12);
  --theme-pill-border: rgba(124, 149, 214, 0.18);
  --theme-panel-border: rgba(124, 149, 214, 0.18);
  --theme-panel-glow: rgba(91, 75, 183, 0.14);
  --theme-scrim: rgba(0, 0, 0, 0.56);
  --theme-hero-sheen:
    radial-gradient(circle at top right, rgba(91, 75, 183, 0.18), transparent 34%),
    linear-gradient(160deg, rgba(24, 25, 29, 0.98), rgba(18, 18, 18, 0.92));
}

html[data-theme="max-contrast"] {
  --ui-color-scheme: light;
  --bg-base: #ffffff;
  --bg-surface: #ffffff;
  --bg-elevated: #f7f7f7;
  --bg-overlay: #ededed;
  --bg-hover: #00000008;
  --bg-active: #00000012;

  --text-primary: #000000;
  --text-secondary: #111111;
  --text-muted: #333333;
  --text-faint: #666666;
  --text-disabled: #a3a3a3;

  --brand-primary: #000000;
  --brand-primary-hover: #1d1d1d;
  --brand-primary-muted: #00000010;
  --brand-accent: #1a1a1a;
  --brand-accent-muted: #1a1a1a10;
  --brand-gradient-start: #000000;
  --brand-gradient-end: #1a1a1a;
  --brand-gradient-shadow: rgba(0, 0, 0, 0.18);

  --status-success: #005f2a;
  --status-success-muted: #005f2a14;
  --status-warning: #7a4d00;
  --status-warning-muted: #7a4d0014;
  --status-danger: #8a0000;
  --status-danger-muted: #8a000014;
  --status-info: #000000;
  --status-info-muted: #00000010;

  --border: #000000;
  --border-hover: #000000;
  --border-subtle: #b5b5b5;
  --surface-base: var(--bg-surface);
  --surface-raised: var(--bg-elevated);
  --surface-sunken: #f2f2f2;
  --bg-inset: #efefef;

  --text-on-accent: #ffffff;
  --theme-pill-bg: rgba(0, 0, 0, 0.06);
  --theme-pill-border: rgba(0, 0, 0, 0.18);
  --theme-panel-border: rgba(0, 0, 0, 0.18);
  --theme-panel-glow: rgba(0, 0, 0, 0.08);
  --theme-scrim: rgba(0, 0, 0, 0.14);
  --theme-hero-sheen:
    linear-gradient(160deg, rgba(255, 255, 255, 0.99), rgba(245, 245, 245, 0.94));
}

html[data-theme="uswds-gov"] {
  --ui-color-scheme: light;
  --bg-base: #f7f9fb;
  --bg-surface: #ffffff;
  --bg-elevated: #eef3f8;
  --bg-overlay: #e4ebf2;
  --bg-hover: #1b1b1b0c;
  --bg-active: #1b1b1b14;

  --text-primary: #1b1b1b;
  --text-secondary: #2e2e2e;
  --text-muted: #565c65;
  --text-faint: #71767a;
  --text-disabled: #c2c7ce;

  --brand-primary: #005ea2;
  --brand-primary-hover: #1a4480;
  --brand-primary-muted: #005ea214;
  --brand-accent: #162e51;
  --brand-accent-muted: #162e5112;
  --brand-gradient-start: #005ea2;
  --brand-gradient-end: #162e51;
  --brand-gradient-shadow: rgba(22, 46, 81, 0.16);

  --status-success: #008817;
  --status-success-muted: #00881716;
  --status-warning: #775540;
  --status-warning-muted: #77554016;
  --status-danger: #b50909;
  --status-danger-muted: #b5090914;
  --status-info: #005ea2;
  --status-info-muted: #005ea214;

  --border: #c9ced6;
  --border-hover: #8b95a1;
  --border-subtle: #dde3ea;
  --surface-base: var(--bg-surface);
  --surface-raised: var(--bg-elevated);
  --surface-sunken: #f2f5f8;
  --bg-inset: #eaf0f5;

  --text-on-accent: #ffffff;
  --theme-pill-bg: rgba(0, 94, 162, 0.08);
  --theme-pill-border: rgba(0, 94, 162, 0.18);
  --theme-panel-border: rgba(22, 46, 81, 0.16);
  --theme-panel-glow: rgba(22, 46, 81, 0.1);
  --theme-scrim: rgba(27, 27, 27, 0.2);
  --theme-hero-sheen:
    radial-gradient(circle at top right, rgba(0, 94, 162, 0.12), transparent 34%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(238, 243, 248, 0.94));
}

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

html {
  color-scheme: var(--ui-color-scheme);
}

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

::selection {
  background: var(--brand-primary-muted);
  color: var(--text-primary);
}

a { color: var(--brand-primary); text-decoration: none; }
a:hover { color: var(--brand-primary-hover); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* Focus-visible outlines for keyboard navigation (premium accessibility) */
:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

button:focus-visible, a:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Contenteditable focus glow for the chat input */
[contenteditable="true"]:focus {
  border-color: var(--brand-primary) !important;
  box-shadow: 0 0 0 3px var(--brand-primary-muted);
}

/* Textarea focus glow */
textarea:focus {
  border-color: var(--brand-primary) !important;
  box-shadow: 0 0 0 3px var(--brand-primary-muted);
}

/* Interactive card hover — subtle lift effect */
button[style*="bg-surface"]:hover,
div[style*="bg-surface"]:hover {
  border-color: var(--border-hover);
}

/* Skip-to-content accessibility link — see also expanded rule below */

/* Navigation link hover */
nav a:hover {
  background: var(--bg-hover) !important;
}

/* Utility classes */
.text-primary { color: var(--text-primary); }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-success { color: var(--status-success); }
.text-warning { color: var(--status-warning); }
.text-danger { color: var(--status-danger); }

.label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

/* Rendered markdown content (boardroom reports, etc.) */
.markdown-content h1 { font-size: 20px; font-weight: 700; color: var(--text-primary); margin: 24px 0 12px; line-height: 1.3; }
.markdown-content h2 { font-size: 16px; font-weight: 600; color: var(--text-primary); margin: 20px 0 10px; line-height: 1.3; }
.markdown-content h3 { font-size: 14px; font-weight: 600; color: var(--text-primary); margin: 16px 0 8px; line-height: 1.3; }
.markdown-content h4 { font-size: 13px; font-weight: 600; color: var(--text-primary); margin: 14px 0 6px; }
.markdown-content h5, .markdown-content h6 { font-size: 12px; font-weight: 600; color: var(--text-muted); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: 0.3px; }
.markdown-content p { margin: 0 0 12px; }
.markdown-content ul, .markdown-content ol { margin: 0 0 12px; padding-left: 24px; }
.markdown-content li { margin-bottom: 4px; }
.markdown-content li > ul, .markdown-content li > ol { margin-top: 4px; margin-bottom: 0; }
.markdown-content strong { font-weight: 600; color: var(--text-primary); }
.markdown-content em { font-style: italic; }
.markdown-content a { color: var(--brand-primary); text-decoration: underline; text-underline-offset: 2px; }
.markdown-content a:hover { color: var(--brand-primary-hover); }
.markdown-content code { font-family: var(--font-mono); font-size: 0.9em; background: var(--bg-elevated); padding: 1px 5px; border-radius: 3px; color: #e0a5fa; }
.markdown-content pre { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 6px; padding: 12px 16px; overflow-x: auto; margin: 0 0 12px; }
.markdown-content pre code { background: transparent; padding: 0; color: var(--text-secondary); font-size: 11px; }
.markdown-content blockquote { border-left: 3px solid var(--brand-accent); padding: 8px 16px; margin: 0 0 12px; background: var(--bg-elevated); border-radius: 0 6px 6px 0; color: var(--text-muted); font-style: italic; }
.markdown-content hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.markdown-content table { width: 100%; border-collapse: collapse; margin: 0 0 12px; font-size: 12px; }
.markdown-content th { text-align: left; padding: 8px 12px; background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-primary); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; }
.markdown-content td { padding: 8px 12px; border: 1px solid var(--border); }
.markdown-content tbody tr:nth-child(even) td { background: var(--bg-elevated); }
.markdown-content img { max-width: 100%; border-radius: 6px; }
.markdown-content h1:first-child, .markdown-content h2:first-child, .markdown-content h3:first-child { margin-top: 0; }

/* ── Dossier content styling ───────────────────────────────────── */

.dossier-content h1 { font-size: 22px; font-weight: 700; color: var(--text-primary); margin: 32px 0 14px; line-height: 1.25; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.dossier-content h2 { font-size: 17px; font-weight: 600; color: var(--text-primary); margin: 28px 0 12px; line-height: 1.3; }
.dossier-content h3 { font-size: 14px; font-weight: 600; color: var(--stage-intake); margin: 20px 0 8px; line-height: 1.3; }
.dossier-content h4 { font-size: 13px; font-weight: 600; color: var(--text-primary); margin: 16px 0 6px; }
.dossier-content h2:first-child { margin-top: 0; }
.dossier-content p { margin: 0 0 14px; line-height: 1.8; }
.dossier-content ul, .dossier-content ol { margin: 0 0 14px; padding-left: 24px; }
.dossier-content li { margin-bottom: 6px; line-height: 1.7; }
.dossier-content li > ul, .dossier-content li > ol { margin-top: 6px; margin-bottom: 0; }
.dossier-content strong { font-weight: 600; color: var(--text-primary); }
.dossier-content em { font-style: italic; color: var(--text-muted); }
.dossier-content a { color: var(--brand-primary); text-decoration: underline; text-underline-offset: 2px; }
.dossier-content a:hover { color: var(--brand-primary-hover); }
.dossier-content code { font-family: var(--font-mono); font-size: 0.88em; background: var(--bg-elevated); padding: 2px 6px; border-radius: 4px; color: #e0a5fa; }
.dossier-content pre { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 8px; padding: 14px 18px; overflow-x: auto; margin: 0 0 14px; }
.dossier-content pre code { background: transparent; padding: 0; color: var(--text-secondary); font-size: 11px; }
.dossier-content blockquote {
  border-left: 3px solid var(--brand-accent);
  padding: 12px 20px;
  margin: 16px 0;
  background: var(--bg-elevated);
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
  font-style: italic;
  font-size: 12.5px;
  line-height: 1.7;
}
.dossier-content hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.dossier-content table { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 12px; }
.dossier-content th { text-align: left; padding: 10px 14px; background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-primary); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; }
.dossier-content td { padding: 10px 14px; border: 1px solid var(--border); }
.dossier-content img { max-width: 100%; border-radius: 8px; }

/* Shimmer animation for loading skeletons */
@keyframes shimmer {
  0% { opacity: 0.5; }
  50% { opacity: 0.2; }
  100% { opacity: 0.5; }
}

/* Fade in animation */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Pulse animation for streaming indicators */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Autopilot active — pulsing glow effect on the stop button */
@keyframes autopilot-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    opacity: 1;
  }
  50% {
    box-shadow: 0 0 8px 4px rgba(239, 68, 68, 0.25);
    opacity: 0.85;
  }
}

/* Skeleton loading animation */
@keyframes skeleton-pulse {
  0% { opacity: 0.6; }
  50% { opacity: 0.3; }
  100% { opacity: 0.6; }
}

/* Spinner rotation */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Typing indicator dot pulse */
@keyframes typing-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.1); }
}

/* Toast slide-in from right */
@keyframes toast-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Pipeline stepper active pulse */
@keyframes stepper-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
}

/* Modal slide-up entrance */
@keyframes modal-enter {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Interactive element styles ────────────────────────────────── */

/* Hover states for clickable cards and rows */
[data-clickable]:hover,
.run-row:hover,
a[style*="grid"]:hover {
    background: var(--bg-hover, rgba(255,255,255,0.04)) !important;
}

/* Focus-visible outlines for keyboard navigation */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--brand-primary, #2563eb);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Buttons: hover state */
button:not(:disabled):hover {
    filter: brightness(1.08);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Entity cards: border color change + subtle shadow on hover */
.entity-card:hover {
    border-color: var(--border-hover, #2a2d3a) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* MCTS tree nodes: border highlight on hover */
.mcts-node:hover {
    border-color: var(--border-hover, #2a2d3a) !important;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
}

/* Clickable links in tables/lists: underline on hover */
.file-link:hover {
    text-decoration: underline !important;
    color: var(--brand-primary) !important;
}

/* Interview row links: background highlight on hover */
.interview-link:hover {
    background: var(--bg-hover, rgba(255, 255, 255, 0.04)) !important;
}

/* Related entity chips: border highlight on hover */
.entity-chip:hover {
    border-color: var(--border-hover, #2a2d3a) !important;
    background: var(--bg-hover, rgba(255, 255, 255, 0.04)) !important;
}

/* Debate trigger button: glow on hover */
.debate-trigger:not(:disabled):hover {
    filter: brightness(1.12);
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.3);
}

/* Navigation back links: color shift on hover */
.nav-back:hover {
    color: var(--text-secondary) !important;
}

/* Sidebar search trigger: highlight on hover */
aside[aria-label="Sidebar navigation"] button[style*="text-align: left"]:hover {
    border-color: var(--border-hover) !important;
    background: var(--bg-active) !important;
}

/* Sidebar navigation links: proper hover state */
aside[aria-label="Sidebar navigation"] a[data-active="false"]:hover {
    background: var(--bg-hover) !important;
    color: var(--text-secondary) !important;
}
aside[aria-label="Sidebar navigation"] a[data-active="true"]:hover {
    background: rgba(37, 99, 235, 0.12) !important;
}

/* ── Skip-to-content link ──────────────────────────────────────── */

.skip-to-content {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: 10000;
    background: var(--brand-primary, #2563eb);
    color: #ffffff;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 0 0 6px 0;
    text-decoration: none;
}

.skip-to-content:focus {
    position: fixed;
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    overflow: visible;
}

/* ── Responsive breakpoints ────────────────────────────────────── */

/* Mobile overlay backdrop for sidebar */
.sidebar-backdrop {
    display: none;
}
@media (max-width: 1024px) {
    :root {
        --rail-w: 0px;
    }
    #main-content {
        padding: 16px 14px 24px !important;
    }
    /* Sidebar becomes a slide-over overlay */
    aside[aria-label="Sidebar navigation"] {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: var(--sidebar-w) !important;
        max-width: calc(100vw - 48px) !important;
        z-index: 1000 !important;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.6) !important;
        transform: translateX(0);
        transition: transform 0.2s ease, box-shadow 0.2s ease !important;
        /* Override the variable so it expands to 280px when open */
        --sidebar-w: 280px;
        transform: translateX(calc(-1 * var(--sidebar-w) - 24px));
        pointer-events: none;
    }
    aside[aria-label="Sidebar navigation"][data-mobile-open="true"] {
        transform: translateX(0);
        pointer-events: auto;
    }
    /* Semi-transparent backdrop behind the sidebar */
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 999;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(2px);
        animation: fadeIn 0.2s ease;
    }
    .sidebar-backdrop[data-closed] {
        display: none;
    }
}

/* Mobile: collapse assist panel too */
@media (max-width: 768px) {
    :root {
        --rail-w: 0px;
        --assist-w: 100%;
    }
    aside[aria-label="Sidebar navigation"] {
        --sidebar-w: 260px;
    }
    /* Preserve the component-driven mobile Assist card layout. */
    aside[data-assist-panel] {
        z-index: 1001 !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   Advisor + Assist workspace refinement
   ═══════════════════════════════════════════════════════════════════════ */

.advisor-workspace {
    position: relative;
    min-height: 0;
}

.advisor-workspace::before {
    content: "";
    position: absolute;
    inset: -20px -12px auto;
    height: 180px;
    pointer-events: none;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 44%),
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.10), transparent 36%);
    opacity: 0.9;
}

.advisor-toolbar {
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
}

.advisor-toolbar__title {
    letter-spacing: -0.03em;
}

.advisor-toolbar__subtitle {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border: 1px solid rgba(96, 165, 250, 0.16);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.68);
    color: #b9c5d8 !important;
}

.advisor-toolbar__button {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.advisor-toolbar__sessions-button {
    max-width: 100%;
}

.advisor-body {
    min-height: 0;
    align-items: stretch;
}

.advisor-session-rail {
    padding: 10px;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.84), rgba(10, 14, 22, 0.92));
    border: 1px solid rgba(58, 74, 106, 0.64);
    border-radius: 16px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.03),
        0 22px 44px rgba(2, 6, 23, 0.24);
}

.advisor-session-search {
    background: rgba(5, 10, 18, 0.72) !important;
    border-color: rgba(58, 74, 106, 0.8) !important;
    border-radius: 12px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.advisor-session-list {
    padding-top: 2px;
}

.advisor-session-card {
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.advisor-session-card:hover {
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.03),
        0 12px 28px rgba(2, 6, 23, 0.22);
}

.advisor-session-card[data-selected="true"] {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 18px 36px rgba(37, 99, 235, 0.12) !important;
}

.advisor-chat-shell {
    position: relative;
    min-height: 0;
    background:
        linear-gradient(180deg, rgba(17, 24, 39, 0.96), rgba(8, 12, 20, 0.98)) !important;
    border-color: rgba(58, 74, 106, 0.64) !important;
    border-radius: 18px !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.03),
        0 28px 60px rgba(2, 6, 23, 0.3);
}

.advisor-chat-view__header {
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(13, 18, 30, 0.78));
    backdrop-filter: blur(16px);
}

.advisor-chat-view__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.advisor-chat-view__meta-chip,
.advisor-session-card__chip {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid rgba(58, 74, 106, 0.64);
    background: rgba(9, 13, 21, 0.82);
    color: var(--text-secondary);
    font-size: 10px;
    line-height: 1;
}

.advisor-chat-view__meta-chip--company,
.advisor-session-card__chip--company {
    border-color: rgba(96, 165, 250, 0.22);
    background: rgba(37, 99, 235, 0.1);
    color: #d8e7ff;
}

.advisor-chat-view__meta-chip--starred {
    border-color: rgba(245, 158, 11, 0.24);
    background: rgba(120, 53, 15, 0.28);
    color: #f8d79d;
}

.advisor-session-card__chip--source {
    color: #9cc3ff;
}

.advisor-chat-view__source {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border: 1px solid rgba(96, 165, 250, 0.18);
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #b9d4ff !important;
}

.advisor-handoff-banner {
    backdrop-filter: blur(12px);
}

.advisor-tool-status {
    border-bottom-color: rgba(58, 74, 106, 0.48) !important;
    background: rgba(9, 15, 26, 0.86) !important;
    color: #c9d2e2 !important;
}

.advisor-follow-ups {
    background: linear-gradient(180deg, rgba(13, 18, 30, 0.4), rgba(7, 10, 17, 0.78));
}

.advisor-follow-ups__chip:hover {
    background: rgba(37, 99, 235, 0.14) !important;
    border-color: rgba(96, 165, 250, 0.36) !important;
    transform: translateY(-1px);
}

.advisor-context-panel__backdrop {
    position: fixed;
    inset: 0;
    z-index: 1008;
    border: none;
    background: rgba(2, 6, 23, 0.62);
    backdrop-filter: blur(4px);
}

.advisor-context-panel {
    background:
        linear-gradient(180deg, rgba(16, 23, 38, 0.98), rgba(9, 12, 20, 0.99)) !important;
    border-left-color: rgba(58, 74, 106, 0.7) !important;
    box-shadow:
        -18px 0 42px rgba(2, 6, 23, 0.28),
        inset 1px 0 0 rgba(255, 255, 255, 0.03);
}

.assist-panel {
    background: var(--theme-hero-sheen), var(--bg-overlay) !important;
    border: 1px solid var(--theme-panel-border) !important;
    box-shadow:
        -24px 0 48px var(--theme-panel-glow),
        inset 1px 0 0 var(--bg-hover);
    backdrop-filter: blur(18px);
}

.assist-panel__header {
    background: linear-gradient(180deg, var(--bg-overlay), transparent);
}

.assist-panel__control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--theme-panel-border);
    border-radius: 10px;
    background: var(--bg-hover);
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.assist-panel__control:hover {
    transform: translateY(-1px);
    border-color: var(--theme-pill-border);
    background: var(--brand-primary-muted);
}

.assist-panel__restore {
    position: fixed;
    right: 16px;
    top: calc(var(--topbar-h) + 88px);
    z-index: 1999;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--theme-panel-border);
    border-radius: 16px;
    background: var(--bg-overlay);
    color: var(--text-primary);
    box-shadow: 0 18px 38px var(--theme-panel-glow);
    backdrop-filter: blur(16px);
    cursor: pointer;
}

.assist-panel__restore[data-mobile="true"] {
    top: auto;
    right: 14px;
    bottom: 14px;
}

.assist-panel__restore-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--status-success);
    box-shadow: 0 0 0 4px var(--status-success-muted);
    flex-shrink: 0;
}

.assist-panel__restore-dot[data-thinking="true"] {
    background: var(--brand-primary);
    box-shadow: 0 0 0 4px var(--brand-primary-muted);
    animation: pulse 1.8s ease-in-out infinite;
}

.assist-panel__restore-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
}

.assist-panel__restore-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.assist-panel__restore-meta {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.35;
}

.assist-panel__messages {
    background:
        radial-gradient(circle at top, var(--theme-pill-bg), transparent 42%),
        linear-gradient(180deg, var(--bg-hover), transparent 28%);
}

.assist-panel__bubble {
    border: 1px solid var(--border);
    box-shadow:
        inset 0 1px 0 var(--bg-hover),
        0 10px 26px var(--theme-panel-glow);
}

.assist-panel__bubble--user {
    border-color: var(--theme-pill-border) !important;
    background: var(--brand-primary-muted) !important;
}

.assist-panel__bubble--system {
    border-color: var(--border-hover) !important;
    background: var(--bg-surface) !important;
}

.assist-panel__status {
    border: 1px solid var(--border-hover);
    box-shadow: inset 0 1px 0 var(--bg-hover);
}

.assist-panel__composer {
    background: linear-gradient(180deg, transparent, var(--bg-overlay));
}

.assist-panel__handoff {
    padding: 10px;
    border: 1px solid var(--theme-pill-border);
    border-radius: 14px;
    background: var(--bg-hover);
}

.assist-panel__handoff-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.assist-panel__handoff-pill {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid var(--theme-pill-border);
    background: var(--theme-pill-bg);
    color: var(--text-primary);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.assist-panel__handoff-pill--scope {
    border-color: var(--status-success);
    background: var(--status-success-muted);
    color: var(--status-success);
}

.assist-panel__handoff-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--theme-pill-border);
    background: var(--theme-pill-bg);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.assist-panel__handoff-button:disabled {
    cursor: not-allowed;
    opacity: 0.72;
}

.assist-panel__handoff-button:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: var(--theme-pill-border) !important;
    background: var(--brand-primary-muted) !important;
}

.assist-panel__handoff-copy {
    max-width: 34ch;
}

.assist-panel__composer-row textarea {
    background: var(--bg-elevated) !important;
    border-color: var(--theme-panel-border) !important;
    border-radius: 12px !important;
    color: var(--text-primary) !important;
}

.assist-panel__send {
    box-shadow: 0 14px 30px var(--theme-panel-glow);
}

.input-assist {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--theme-panel-border);
    border-radius: 16px;
    background: var(--theme-hero-sheen), var(--bg-overlay);
    box-shadow: inset 0 1px 0 var(--bg-hover);
}

.input-assist--compact {
    padding: 9px 10px;
}

.input-assist__header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.input-assist__eyebrow-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.input-assist__eyebrow {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--theme-pill-bg);
    border: 1px solid var(--theme-pill-border);
    color: var(--brand-primary);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.input-assist__eyebrow-copy {
    max-width: 42ch;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.45;
}

.input-assist--compact[data-body-open="false"] .input-assist__eyebrow-copy {
    display: none;
}

.input-assist__header-actions {
    display: inline-flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

.input-assist__status {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 10px;
    line-height: 1;
    color: var(--text-secondary);
    border: 1px solid var(--theme-panel-border);
    background: var(--bg-hover);
}

.input-assist__status[data-generated="true"] {
    color: var(--brand-primary);
    border-color: var(--theme-pill-border);
    background: var(--theme-pill-bg);
}

.input-assist__status[data-generated="false"] {
    color: var(--status-warning);
    border-color: var(--status-warning);
    background: var(--status-warning-muted);
}

.input-assist__status[data-generated="pending"] {
    color: var(--text-secondary);
    border-color: var(--theme-panel-border);
}

.input-assist__toggle {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid var(--theme-panel-border);
    background: var(--bg-hover);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.input-assist__toggle:hover {
    border-color: var(--theme-pill-border);
    background: var(--brand-primary-muted);
    color: var(--text-secondary);
}

.input-assist__toolbar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.input-assist__button {
    flex: 1 1 0;
    min-width: 0;
    padding: 7px 10px;
    border-radius: 10px;
    border: 1px solid var(--theme-panel-border);
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.input-assist__button[data-active="true"] {
    color: var(--brand-primary);
    border-color: var(--theme-pill-border);
    background: var(--theme-pill-bg);
}

.input-assist__button:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: var(--theme-pill-border);
    background: var(--brand-primary-muted);
}

.input-assist__panel,
.input-assist__suggestion {
    border: 1px solid var(--theme-panel-border);
    border-radius: 12px;
    background: var(--bg-surface);
    box-shadow: inset 0 1px 0 var(--bg-hover);
}

.input-assist__panel {
    padding: 12px 14px;
}

.input-assist__panel--empty {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.6;
}

.input-assist__stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-assist__suggestion {
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
    transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.input-assist__suggestion:hover {
    transform: translateY(-1px);
    border-color: var(--theme-pill-border);
    background: var(--bg-elevated);
}

.input-assist__suggestion-topic {
    display: block;
    margin-bottom: 4px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
}

.input-assist__suggestion-rationale,
.input-assist__guidance {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.6;
}

.input-assist__apply {
    margin-top: 12px;
    padding: 8px 12px;
    border: 1px solid var(--theme-pill-border);
    border-radius: 10px;
    background: var(--theme-pill-bg);
    color: var(--brand-primary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.input-assist__apply:hover {
    background: var(--brand-primary-muted);
    border-color: var(--theme-pill-border);
}

.advisor-toolbar__sessions-button,
.advisor-mobile-sessions-backdrop,
.advisor-mobile-sessions-drawer,
.advisor-context-panel__backdrop {
    display: none;
}

@media (max-width: 1024px) {
    .advisor-workspace {
        height: calc(100dvh - 78px) !important;
        gap: 12px !important;
    }

    .advisor-toolbar {
        flex-wrap: wrap;
    }

    .advisor-toolbar__sessions-button {
        display: inline-flex !important;
        max-width: 100%;
    }

    .advisor-body {
        overflow: visible !important;
    }

    .advisor-body > .advisor-session-rail {
        display: none !important;
    }

    .advisor-chat-shell {
        min-height: min(68dvh, 760px);
    }

    .advisor-context-panel__backdrop {
        display: block;
    }

    .advisor-context-panel {
        position: fixed !important;
        top: var(--topbar-h);
        right: 0;
        bottom: 0;
        width: min(360px, 88vw) !important;
        z-index: 1009;
        border-radius: 18px 0 0 18px !important;
    }

    .advisor-mobile-sessions-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1006;
        border: none;
        background: rgba(2, 6, 23, 0.66);
        backdrop-filter: blur(6px);
    }

    .advisor-mobile-sessions-drawer {
        display: block;
        position: fixed;
        left: 14px;
        right: 14px;
        bottom: 14px;
        z-index: 1007;
        max-height: min(62dvh, 540px);
    }

    .advisor-mobile-sessions-drawer .advisor-session-rail {
        width: 100% !important;
        max-height: min(62dvh, 540px);
        padding: 12px;
        border-radius: 20px;
    }
}

@media (max-width: 768px) {
    .advisor-workspace {
        height: auto !important;
        min-height: calc(100dvh - 78px);
    }

    .advisor-toolbar {
        gap: 8px !important;
    }

    .advisor-toolbar__subtitle {
        order: 3;
        width: 100%;
    }

    .advisor-body {
        gap: 0 !important;
    }

    .advisor-session-card {
        border-radius: 12px !important;
    }

    .advisor-chat-view__header {
        flex-wrap: wrap;
        align-items: flex-start !important;
    }

    .advisor-chat-view__source {
        order: 3;
    }

    .advisor-chat-view__meta {
        gap: 4px;
    }

    .advisor-follow-ups {
        padding-bottom: 12px !important;
    }

    .advisor-mobile-sessions-drawer {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }

    .advisor-mobile-sessions-drawer .advisor-session-rail {
        padding: 10px;
    }

    .assist-panel {
        box-shadow: none;
    }

    .assist-panel__restore {
        right: 12px;
        bottom: 12px;
    }

    .assist-panel__handoff-copy {
        max-width: none;
    }

    .input-assist {
        padding: 10px;
        border-radius: 12px;
    }

    .input-assist__header {
        flex-direction: column;
    }

    .input-assist__header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .input-assist__status {
        align-self: flex-start;
    }

    .input-assist__button {
        flex: 1 1 calc(50% - 6px);
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   Splash page
   ═══════════════════════════════════════════════════════════════════════ */

.splash {
    position: relative;
    min-height: 100dvh;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
    background: var(--bg-base);
}

.splash-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.splash-tagline {
    position: absolute;
    bottom: 30%;
    left: 0;
    right: 0;
    z-index: 1;
    text-align: center;
    font-size: clamp(0.72rem, 0.65rem + 0.3vw, 0.85rem);
    font-weight: 400;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--text-faint);
    animation: splash-cta-in 1.8s cubic-bezier(0.2, 0, 0, 1) 0.5s both;
}

.splash-cta {
    position: absolute;
    bottom: 22%;
    left: 0;
    right: 0;
    z-index: 1;
    display: flex;
    justify-content: center;
    gap: 16px;
    animation: splash-cta-in 1.5s cubic-bezier(0.2, 0, 0, 1) 0.8s both;
}

@keyframes splash-cta-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.splash-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: clamp(0.64rem, 0.6rem + 0.2vw, 0.72rem);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-family: var(--font-mono);
    font-weight: 600;
    padding: 12px 32px;
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: color 250ms ease-out, background 250ms ease-out,
                border-color 250ms ease-out, box-shadow 250ms ease-out,
                transform 150ms ease-out;
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.splash-link:active { transform: scale(0.97); }

.splash-link-ghost {
    color: var(--text-muted);
    border: 1px solid var(--border);
    background: transparent;
}
.splash-link-ghost:hover {
    color: var(--text-primary);
    border-color: var(--text-faint);
    background: rgba(255,255,255,0.04);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.04);
}

.splash-link-solid {
    color: #fff;
    border: 1px solid var(--brand-primary);
    background: var(--brand-primary);
    box-shadow: 0 0 30px rgba(37,99,235,0.2);
}
.splash-link-solid:hover {
    background: var(--brand-primary-hover);
    border-color: var(--brand-primary-hover);
    box-shadow: 0 0 40px rgba(37,99,235,0.3);
    color: #fff;
}

.splash-mobile-title {
    display: none;
}

@media (max-width: 767px) {
    .splash-mobile-title {
        display: block;
        position: absolute;
        top: 30%;
        left: 0; right: 0;
        z-index: 1;
        text-align: center;
        font-family: var(--font-mono);
        font-size: clamp(2.5rem, 12vw, 5rem);
        font-weight: 800;
        letter-spacing: 0.35em;
        color: var(--brand-primary);
        text-shadow:
            0 0 40px rgba(37,99,235,0.4),
            0 0 80px rgba(37,99,235,0.15);
        animation: splash-title-in 2s cubic-bezier(0.2, 0, 0, 1) 0.3s both;
        pointer-events: none;
        user-select: none;
    }
    @keyframes splash-title-in {
        from { opacity: 0; letter-spacing: 0.6em; filter: blur(8px); }
        to   { opacity: 1; letter-spacing: 0.35em; filter: blur(0); }
    }
    .splash-tagline { bottom: 36%; font-size: 0.6rem; letter-spacing: 0.15em; }
    .splash-cta { bottom: 28%; flex-direction: column; align-items: center; }
}

/* ═══════════════════════════════════════════════════════════════════════
   Auth pages (login / signup)
   ═══════════════════════════════════════════════════════════════════════ */

.auth {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
    padding: 24px;
}

.auth-panel {
    width: min(440px, 100%);
    padding: 36px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
}

.auth-back {
    display: inline-block;
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 24px;
}
.auth-back:hover { color: var(--text-primary); }

.auth-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.auth-footer {
    font-size: 12px;
    color: var(--text-faint);
    text-align: center;
    margin-top: 20px;
}
.auth-footer a { color: var(--brand-primary); }
.auth-footer a:hover { color: var(--brand-primary-hover); }

.auth-error {
    font-size: 13px;
    color: var(--status-danger);
    text-align: center;
    margin-top: 16px;
    padding: 10px 14px;
    background: var(--status-danger-muted);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-md);
    line-height: 1.4;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.auth-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
    box-sizing: border-box;
}
.auth-input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px var(--brand-primary-muted);
}

.auth-submit {
    width: 100%;
    margin-top: 12px;
    padding: 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--brand-primary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}
.auth-submit:hover:not(:disabled) { background: var(--brand-primary-hover); }
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-inline-error {
    margin-top: 10px;
    font-size: 13px;
    color: var(--status-danger);
}

.auth-hint {
    margin-top: 14px;
    font-size: 11px;
    color: var(--text-faint);
    text-align: center;
    line-height: 1.5;
}

.auth-secondary-link {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-faint);
    text-align: center;
}

.auth-secondary-link a {
    color: var(--brand-primary);
}

.auth-secondary-link a:hover {
    color: var(--brand-primary-hover);
}

/* ═══════════════════════════════════════════════════════════════════════
   Accessibility: reduced-motion preference
   ═══════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   High-contrast mode support
   ═══════════════════════════════════════════════════════════════════════ */

@media (forced-colors: active) {
    :root {
        --bg-base: Canvas;
        --bg-surface: Canvas;
        --bg-elevated: Canvas;
        --text-primary: CanvasText;
        --text-secondary: CanvasText;
        --text-muted: GrayText;
        --brand-primary: LinkText;
        --border: CanvasText;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   Utility classes for common patterns (reduces inline style duplication)
   ═══════════════════════════════════════════════════════════════════════ */

/* Layout utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-xs { gap: 4px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 12px; }
.gap-lg { gap: 16px; }
.gap-xl { gap: 20px; }

/* Typography utilities */
.text-xs { font-size: 10px; }
.text-sm { font-size: 11px; }
.text-base { font-size: 12px; }
.text-md { font-size: 13px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 22px; }
.text-2xl { font-size: 28px; }
.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-mono { font-family: var(--font-mono); }
.uppercase { text-transform: uppercase; letter-spacing: 0.8px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Background utilities */
.bg-base { background: var(--bg-base); }
.bg-surface { background: var(--bg-surface); }
.bg-elevated { background: var(--bg-elevated); }

/* Border utilities */
.border { border: 1px solid var(--border); }
.border-hover:hover { border-color: var(--border-hover); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }

/* Spacing utilities */
.p-sm { padding: 8px; }
.p-md { padding: 12px; }
.p-lg { padding: 16px; }
.px-sm { padding-left: 8px; padding-right: 8px; }
.px-md { padding-left: 12px; padding-right: 12px; }
.px-lg { padding-left: 16px; padding-right: 16px; }
.py-sm { padding-top: 8px; padding-bottom: 8px; }
.py-md { padding-top: 12px; padding-bottom: 12px; }

/* Status colors */
.bg-success-muted { background: var(--status-success-muted); }
.bg-warning-muted { background: var(--status-warning-muted); }
.bg-danger-muted { background: var(--status-danger-muted); }
.bg-info-muted { background: var(--status-info-muted); }

/* Card — base surface container */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
/* Only lift cards that are interactive (links, clickable rows) */
.card[data-clickable]:hover,
a.card:hover,
.card.card-interactive:hover {
    border-color: var(--border-hover);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Elevated card — higher depth background, hover only on interactive elements */
.card-elevated {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
/* Only lift elevated cards that are interactive (links, clickable rows) */
.card-elevated[data-clickable]:hover,
a.card-elevated:hover,
.card-elevated.card-interactive:hover {
    border-color: var(--border-hover);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Inset card — sunken below surface, for nested content areas */
.card-inset {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

/* Runtime theme menu */
.theme-menu-anchor {
    position: relative;
    z-index: 12;
    display: flex;
}

.theme-menu-trigger {
    display: grid;
    gap: 2px;
    min-width: 136px;
    padding: 6px 12px;
    background: var(--theme-pill-bg);
    color: var(--text-primary);
    border: 1px solid var(--theme-pill-border);
    border-radius: 14px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.theme-menu-trigger:hover {
    transform: translateY(-1px);
    border-color: var(--brand-primary);
    box-shadow: 0 12px 24px var(--theme-panel-glow);
}
.theme-menu-trigger__eyebrow {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.theme-menu-trigger__label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
}

.theme-menu-scrim {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: var(--theme-scrim);
    border: none;
    cursor: pointer;
}

.theme-menu-panel {
    position: fixed;
    top: calc(var(--topbar-h) + 14px);
    left: clamp(12px, 2vw, 24px);
    right: clamp(12px, 2vw, 24px);
    z-index: 41;
    max-height: calc(100dvh - 88px);
    overflow: auto;
    display: grid;
    gap: 18px;
    padding: 20px;
    border-radius: 28px;
    border: 1px solid var(--theme-panel-border);
    background: var(--theme-hero-sheen), var(--bg-surface);
    backdrop-filter: blur(18px);
    box-shadow: 0 34px 80px var(--theme-panel-glow), 0 16px 36px rgba(0, 0, 0, 0.16);
}

.theme-menu-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}
.theme-menu-panel__heading {
    display: grid;
    gap: 8px;
    max-width: 620px;
}
.theme-menu-panel__eyebrow,
.theme-settings__eyebrow,
.theme-menu-featured__label,
.theme-settings__summary-label,
.theme-option-card__rank,
.theme-option-card__category {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.theme-menu-panel__heading h2,
.theme-settings__lead h2 {
    margin: 0;
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.05;
    color: var(--text-primary);
}
.theme-menu-panel__heading p,
.theme-settings__lead p,
.theme-settings__summary p {
    margin: 0;
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-muted);
}
.theme-menu-panel__close {
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
}

.theme-menu-featured,
.theme-settings__lead,
.theme-settings__summary {
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: 24px;
    border: 1px solid var(--theme-panel-border);
    background: linear-gradient(180deg, var(--bg-surface), var(--bg-elevated));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.theme-menu-featured {
    grid-template-columns: minmax(0, 1.25fr) minmax(220px, 0.75fr);
    align-items: center;
}
.theme-menu-featured__copy,
.theme-settings__summary {
    display: grid;
    gap: 6px;
}
.theme-menu-featured__copy strong,
.theme-settings__summary strong {
    font-size: 18px;
    line-height: 1.1;
    color: var(--text-primary);
}
.theme-menu-featured__copy span:not(.theme-menu-featured__label),
.theme-settings__summary span:not(.theme-settings__summary-label) {
    font-size: 11px;
    color: var(--text-secondary);
}
.theme-menu-featured__copy p {
    margin: 0;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-muted);
}
.theme-menu-featured__stats,
.theme-option-card__metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.theme-chip {
    display: grid;
    gap: 4px;
    min-width: 108px;
    padding: 10px 12px;
    border-radius: 16px;
    border: 1px solid var(--theme-pill-border);
    background: var(--theme-pill-bg);
}
.theme-chip span {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.theme-chip strong {
    font-size: 11px;
    color: var(--text-primary);
}

.theme-settings {
    display: grid;
    gap: 18px;
}
.theme-settings__hero {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
    gap: 16px;
}

.theme-menu-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.theme-menu-grid--settings {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.theme-option-card {
    display: grid;
    gap: 14px;
    width: 100%;
    padding: 14px;
    text-align: left;
    font-family: inherit;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--bg-surface), var(--bg-elevated));
    color: var(--text-secondary);
    cursor: pointer;
    transition:
        transform 0.16s ease,
        border-color 0.16s ease,
        box-shadow 0.16s ease,
        background 0.16s ease;
}
.theme-option-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.12);
}
.theme-option-card[data-active="true"] {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 1px var(--theme-panel-border), 0 18px 40px rgba(0, 0, 0, 0.12);
}

.theme-option-card__preview {
    display: grid;
    gap: 10px;
    min-height: 112px;
    padding: 12px;
    border-radius: 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.theme-option-card__preview-top {
    display: flex;
    align-items: center;
    gap: 6px;
}
.theme-option-card__preview-dot,
.theme-option-card__preview-spacer {
    display: inline-flex;
    height: 8px;
    border-radius: 999px;
}
.theme-option-card__preview-dot {
    width: 8px;
}
.theme-option-card__preview-spacer {
    flex: 1;
}
.theme-option-card__preview-panel {
    display: grid;
    gap: 8px;
    padding: 10px;
    border-radius: 14px;
}
.theme-option-card__preview-line {
    height: 7px;
    border-radius: 999px;
}
.theme-option-card__preview-line--strong {
    width: 64%;
}
.theme-option-card__preview-line:not(.theme-option-card__preview-line--strong) {
    width: 88%;
}
.theme-option-card__preview-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.theme-option-card__preview-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 18px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 700;
}

.theme-option-card__body {
    display: grid;
    gap: 8px;
}
.theme-option-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.theme-option-card__header strong {
    display: block;
    margin-top: 4px;
    font-size: 15px;
    line-height: 1.15;
    color: var(--text-primary);
}
.theme-option-card__state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid var(--theme-pill-border);
    background: var(--theme-pill-bg);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
}
.theme-option-card[data-active="true"] .theme-option-card__state {
    border-color: var(--brand-primary);
    background: var(--brand-primary-muted);
    color: var(--brand-primary);
}
.theme-option-card__description,
.theme-option-card__rationale {
    margin: 0;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-muted);
}
.theme-option-card__rationale {
    font-size: 11px;
}

/* Badge base */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 500;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sidebar navigation link — proper hover without inline styles */
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: background 0.12s ease, color 0.12s ease;
}
.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}
.nav-link[data-active="true"] {
    background: var(--brand-primary-muted);
    color: var(--text-primary);
    font-weight: 500;
}

/* Responsive grid helpers */
.grid-1 { display: grid; grid-template-columns: 1fr; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }

@media (max-width: 1200px) {
    .grid-5 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .theme-menu-grid--settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-5 { grid-template-columns: repeat(2, 1fr); }
    .theme-menu-featured,
    .theme-settings__hero,
    .theme-menu-grid,
    .theme-menu-grid--settings {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
    .theme-menu-trigger {
        min-width: 116px;
        padding: 6px 10px;
    }
    .theme-menu-panel {
        top: calc(var(--topbar-h) + 8px);
        padding: 16px;
        border-radius: 22px;
    }
    .theme-menu-panel__header {
        flex-direction: column;
    }
}

/* Scrollable region with fading edges */
.scroll-fade {
    overflow-y: auto;
    mask-image: linear-gradient(to bottom, transparent 0%, black 2%, black 98%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 2%, black 98%, transparent 100%);
}

/* ── Button variants ───────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
    white-space: nowrap;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--brand-primary);
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background: var(--brand-primary-hover);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    color: var(--text-secondary);
}

.btn-danger {
    background: var(--status-danger);
    color: #fff;
}
.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

/* ── Input styling ────────────────────────────────────────────── */

.input {
    width: 100%;
    padding: 8px 12px;
    font-size: 12px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.input::placeholder {
    color: var(--text-faint);
}

/* ── Table row hover ──────────────────────────────────────────── */

.table-row {
    display: grid;
    align-items: center;
    padding: 8px 12px;
    transition: background 0.1s ease;
}
.table-row:hover {
    background: var(--bg-hover);
}

/* ── Status dot indicator ─────────────────────────────────────── */

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-dot-success { background: var(--status-success); }
.status-dot-warning { background: var(--status-warning); }
.status-dot-danger { background: var(--status-danger); }
.status-dot-info { background: var(--status-info); }
.status-dot-pulse { animation: pulse 2s infinite; }

/* ── Empty state placeholder ──────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 40px 24px;
    color: var(--text-muted);
    font-size: 13px;
}
.empty-state-compact {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-muted);
    font-size: 12px;
}

/* ── Metric value (hero numbers) ─────────────────────────────── */

.metric-value {
    font-size: 22px;
    font-weight: 300;
    color: var(--text-primary);
    line-height: 1;
}
.metric-value-lg {
    font-size: 28px;
    font-weight: 300;
    color: var(--text-primary);
    line-height: 1;
}

/* ── Metric card grid ────────────────────────────────────────── */

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}
@media (max-width: 768px) {
    .metric-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 480px) {
    .metric-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Detail row (label: value pair) ──────────────────────────── */

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 12px;
    padding: 4px 0;
}
.detail-row .detail-label {
    color: var(--text-muted);
    flex-shrink: 0;
}
.detail-row .detail-value {
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
}

/* ── Action bar (button row) ─────────────────────────────────── */

.action-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}
.action-bar-end {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px 0;
}

/* ── Section header (title + action) ─────────────────────────── */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.section-header .section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Command Center main grid ──────────────────────────────── */

.cc-main-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 12px;
}
@media (max-width: 1200px) {
    .cc-main-grid {
        grid-template-columns: 1fr 320px;
    }
}
@media (max-width: 1024px) {
    .cc-main-grid {
        grid-template-columns: 1fr;
    }
}

/* Responsive override for 6-column data tables (deliverables, etc.) */
@media (max-width: 1024px) {
    .table-grid-6 {
        grid-template-columns: 1fr 120px 90px 80px 80px 36px !important;
        font-size: 11px;
    }
}
@media (max-width: 768px) {
    .table-grid-6 {
        grid-template-columns: 1fr 80px 36px !important;
    }
    .table-grid-6 .hide-mobile {
        display: none !important;
    }
}

/* Select input styling — matches .input for consistency */
.select {
    width: auto;
    min-width: 120px;
    padding: 6px 10px;
    font-size: 11px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238b92a0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 26px;
}
.select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ── Compact KPI card for dashboard metric rows ─────────── */

.kpi-card {
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.kpi-card .kpi-value {
    font-size: 22px;
    font-weight: 300;
    color: var(--text-primary);
    line-height: 1.1;
}
.kpi-card .kpi-label {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    line-height: 1;
}
.kpi-card .kpi-sub {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}
.kpi-card--alert {
    border-left: 3px solid var(--status-danger);
    background: var(--status-danger-muted);
}
.kpi-card--alert .kpi-value {
    color: var(--status-danger);
}

/* ── Signal card (command center feed) ──────────────────── */

.signal-card {
    display: flex;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    transition: background 0.1s ease;
}
.signal-card:hover {
    background: var(--bg-active);
}
.signal-card .signal-bar {
    width: 4px;
    min-height: 100%;
    border-radius: 2px;
    flex-shrink: 0;
    align-self: stretch;
}

/* ── Page content density ───────────────────────────────── */

.page-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}
.page-content-narrow {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 900px;
    width: 100%;
}
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.page-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}
.page-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

/* ── Stat badge (used in runs list, reports, etc.) ─────── */

.stat-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
}
.stat-badge .stat-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.stat-badge .stat-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.stat-badge .stat-label {
    font-size: 10px;
    color: var(--text-muted);
}

/* ── Back navigation link ──────────────────────────────── */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.12s ease;
}
.back-link:hover {
    color: var(--text-secondary);
}

/* ── Two-column detail layout ──────────────────────────── */

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 12px;
}
@media (max-width: 1024px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

/* Screen reader only — visually hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Tab bar (Nexus, Advisor, etc.) ───────────────────── */

.tab-bar {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
}
.tab-btn {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    font-family: inherit;
    border-bottom: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
    background: transparent;
    color: var(--text-muted);
}
.tab-btn:hover {
    color: var(--text-secondary);
}
.tab-btn--active {
    color: var(--stage-intake);
    border-bottom-color: var(--brand-primary);
}

/* ── Filter pill group (Initiatives, etc.) ────────────── */

.filter-bar {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
}
.filter-pill {
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid var(--border);
    cursor: pointer;
    font-family: inherit;
    border-radius: 6px;
    transition: all 0.15s ease;
    background: var(--bg-surface);
    color: var(--text-muted);
}
.filter-pill:hover {
    border-color: var(--border-hover);
    color: var(--text-secondary);
}
.filter-pill--active {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
}

/* ── Metric pill (compact inline metric badge) ────────── */

.metric-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}
.metric-pill .metric-pill-value {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

/* ── Medium-width page content (settings, uploads) ────── */

.page-content-md {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 960px;
    width: 100%;
}

/* ── Wide page content (deliverables hub, etc.) ────────── */

.page-content-wide {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 1000px;
    width: 100%;
}
