:root,
[data-theme="dark"] {
  --bg-stage: #0c0d10;
  --bg-topbar: #111216;
  --bg-sidebar: #14151a;
  --bg-surface: #1b1d24;
  --bg-elevated: #232630;
  --bg-hover: #2a2e3a;
  --bg-glass: rgba(18, 19, 24, 0.80);
  --bg-glass-strong: rgba(20, 22, 28, 0.94);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-active: rgba(255, 255, 255, 0.30);

  --text-primary: #f4f4f6;
  --text-secondary: #a1a6b3;
  --text-muted: #707584;

  --accent: #6378ff;
  --accent-hover: #788bff;
  --accent-fg: #ffffff;
  --accent-soft: rgba(99, 120, 255, 0.14);
  --accent-border: rgba(99, 120, 255, 0.44);

  --good: #34d399;
  --good-soft: rgba(52, 211, 153, 0.12);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.14);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.13);

  --vignette: radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0) 52%, rgba(0, 0, 0, 0.28) 100%);
  --grid-line: rgba(255, 255, 255, 0.12);
  --tour-scrim: rgba(4, 5, 8, 0.72);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.58);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.44);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
}

[data-theme="light"] {
  --bg-stage: #ecedf1;
  --bg-topbar: #ffffff;
  --bg-sidebar: #f7f8fa;
  --bg-surface: #ffffff;
  --bg-elevated: #edeff4;
  --bg-hover: #e3e6ee;
  --bg-glass: rgba(255, 255, 255, 0.84);
  --bg-glass-strong: rgba(255, 255, 255, 0.96);

  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);
  --border-active: rgba(15, 23, 42, 0.30);

  --text-primary: #111318;
  --text-secondary: #4a5160;
  --text-muted: #767e90;

  --accent: #3b5bdb;
  --accent-hover: #364fc7;
  --accent-fg: #ffffff;
  --accent-soft: rgba(59, 91, 219, 0.10);
  --accent-border: rgba(59, 91, 219, 0.38);

  --good: #16a34a;
  --good-soft: rgba(22, 163, 74, 0.11);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, 0.12);
  --bad: #dc2626;
  --bad-soft: rgba(220, 38, 38, 0.11);

  --vignette: radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0) 54%, rgba(15, 23, 42, 0.075) 100%);
  --grid-line: rgba(15, 23, 42, 0.14);
  --tour-scrim: rgba(15, 23, 42, 0.56);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.16);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.11);
}

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

html, body {
  height: 100%;
  background: var(--bg-stage);
  color: var(--text-primary);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.48;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 17px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-active);
}

/* ==================== TOP BAR ==================== */
.topbar {
  height: 52px;
  padding: 0 18px;
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  cursor: help;
}

.brand-emblem {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-copy h1 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--text-primary);
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Segmented Tabs */
.tabs {
  display: inline-flex;
  align-items: center;
  background: var(--bg-stage);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 3px;
  gap: 3px;
}

.tab-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 5px 14px;
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18), inset 0 0 0 1px var(--border-subtle);
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.top-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.top-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.top-btn.icon-only {
  width: 30px;
  padding: 0;
  justify-content: center;
}

.top-btn.accent-subtle {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 600;
}

.top-btn.accent-subtle:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.cmdk-trigger kbd {
  height: 16px;
  font-size: 10px;
}

/* ==================== TAB 1: WORKSPACE ==================== */
.workspace {
  display: none;
  height: calc(100vh - 52px);
  overflow: hidden;
  --sidebar-w: 344px;
}

.workspace.active {
  display: grid;
  grid-template-columns: 1fr 5px var(--sidebar-w);
}

.workspace.active.sidebar-collapsed {
  grid-template-columns: 1fr 0 0;
}

.workspace.sidebar-collapsed .sidebar-resizer,
.workspace.sidebar-collapsed .sidebar {
  width: 0;
  min-width: 0;
  border: none;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.viewport-stage {
  position: relative;
  background: var(--bg-stage);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-width: 0;
}

.viewport-stage.blueprint-bg {
  background: #14161c;
}

.stage-vignette {
  position: absolute;
  inset: 0;
  background: var(--vignette);
  pointer-events: none;
  z-index: 1;
}

#viewport {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  cursor: grab;
  touch-action: none;
  position: relative;
  z-index: 0;
}

#viewport:active {
  cursor: grabbing;
}

.viewport-stage.light-drag-active #viewport {
  cursor: crosshair;
}

/* Rule of Thirds Grid */
.stage-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.stage-grid .grid-v,
.stage-grid .grid-h {
  position: absolute;
  background: var(--grid-line);
}
.stage-grid .grid-v { top: 0; bottom: 0; width: 1px; }
.stage-grid .grid-v.v1 { left: 33.3333%; }
.stage-grid .grid-v.v2 { left: 66.6667%; }
.stage-grid .grid-h { left: 0; right: 0; height: 1px; }
.stage-grid .grid-h.h1 { top: 33.3333%; }
.stage-grid .grid-h.h2 { top: 66.6667%; }

/* Live 3D X-Ray Split Curtain */
.xray-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}

.xray-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--xray, 50%);
  width: 2px;
  margin-left: -1px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(99, 120, 255, 0.45);
  pointer-events: auto;
  cursor: ew-resize;
}

.xray-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-glass-strong);
  border: 1.5px solid var(--accent);
  color: var(--text-primary);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-md);
}

.xray-badge {
  position: absolute;
  bottom: 108px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 5px;
  border-radius: 7px;
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-primary);
}

.xray-badge.left { left: 18px; }
.xray-badge.right { right: 18px; }

.xb-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.xb-tag.accent {
  background: var(--accent);
  color: var(--accent-fg);
}

.xray-pass-picker {
  position: absolute;
  top: 56px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 999px;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  white-space: nowrap;
}

.xpp-title {
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 6px;
}

.xpp-btn {
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  padding: 4px 9px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.xpp-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.xpp-btn.active {
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}

/* Drag and Drop Overlay */
.drop-overlay {
  position: absolute;
  inset: 14px;
  border-radius: var(--radius-lg);
  border: 2px dashed var(--accent);
  background: var(--bg-glass-strong);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 28;
  pointer-events: none;
}

.drop-card {
  text-align: center;
  color: var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.drop-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.drop-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Top-left Compact Telemetry */
.hud-top-left {
  position: absolute;
  top: 16px;
  left: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  z-index: 12;
}

.telemetry-bar {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 9px 5px 12px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-md);
}

.tb-item {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: 11.5px;
}

.tb-item .k { color: var(--text-muted); }
.tb-item .v { color: var(--text-primary); font-weight: 600; }

.tb-sep {
  width: 1px;
  height: 11px;
  background: var(--border-strong);
}

.quality-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: help;
}

.q-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.q-dot.crisp { background: var(--good); }
.q-dot.draft { background: var(--warn); }

.stats-more-btn {
  border: none;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 2px 8px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.stats-more-btn:hover,
.stats-more-btn[aria-expanded="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.stats-detail {
  background: var(--bg-glass-strong);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sd-grid {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 6px 18px;
}

.sd-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11.5px;
}
.sd-item span { color: var(--text-muted); }
.sd-item strong { color: var(--text-primary); font-weight: 600; }

.sparkline-block {
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
}

.sparkline-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.sparkline-head strong {
  color: var(--accent);
  font-weight: 600;
}

/* Transient Light HUD */
.light-hud {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(12px);
  border: 1px solid var(--warn);
  color: var(--warn);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  z-index: 15;
  box-shadow: var(--shadow-md);
}

/* Top-right Stage Collapse Toggle */
.stage-float-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
  z-index: 12;
  box-shadow: var(--shadow-md);
}

.stage-float-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* Bottom-left Interactive 3D Axis Gizmo */
.axis-gizmo {
  position: absolute;
  bottom: 18px;
  left: 18px;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  display: grid;
  place-items: center;
  z-index: 12;
  box-shadow: var(--shadow-md);
  user-select: none;
}

.axis-pole {
  cursor: pointer;
  transition: opacity 0.12s ease;
}

.axis-pole:hover circle {
  stroke: var(--text-primary);
  stroke-width: 1.5;
}

/* Bottom-center Action Dock */
.action-dock {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 5px;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  z-index: 12;
}

.dock-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dock-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dock-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--accent-border);
}

.dock-btn.warn-active {
  background: var(--warn-soft);
  color: var(--warn);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.45);
}

.dock-btn.primary {
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}

.dock-btn.primary:hover {
  background: var(--accent-hover);
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 13px;
  z-index: 25;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==================== SIDEBAR RESIZER & INSPECTOR ==================== */
.sidebar-resizer {
  width: 5px;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border-subtle);
  cursor: col-resize;
  position: relative;
  transition: background 0.15s ease;
}

.sidebar-resizer::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 1px;
  transform: translateY(-50%);
  width: 3px;
  height: 32px;
  border-radius: 999px;
  background: var(--border-subtle);
  transition: background 0.15s ease, height 0.15s ease;
}

.sidebar-resizer:hover,
.sidebar-resizer.resizing {
  background: var(--accent-soft);
}

.sidebar-resizer:hover::after,
.sidebar-resizer.resizing::after {
  background: var(--accent);
  height: 48px;
}

.sidebar,
.lab-sidebar {
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border-subtle);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar {
  border-left: none;
}

.panel-section {
  padding: 14px 17px;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-section:last-child {
  border-bottom: none;
}

.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.sec-head h2 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.sec-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.link-btn {
  border: none;
  background: transparent;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.link-btn:hover {
  text-decoration: underline;
}

/* Quick Demo Chips */
.demo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.demo-chip {
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--sans);
  transition: all 0.15s ease;
}

.demo-chip:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

.demo-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.dc-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.demo-chip.active .dc-title {
  color: var(--accent);
}

.dc-sub {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Custom Select */
.select-input {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--bg-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888f9e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 30px 8px 10px;
  font-family: var(--sans);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.select-input::picker-icon {
  display: none;
}

.select-input:hover {
  background-color: var(--bg-elevated);
  border-color: var(--border-strong);
}

.select-input:focus {
  border-color: var(--accent);
}

/* Compact 1-Row Quick Metric Strip */
.quick-metric-strip {
  margin-top: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}

.qm-pill {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.qm-pill.good {
  background: var(--good-soft);
  border-color: transparent;
  color: var(--good);
  font-weight: 600;
}

.qm-pill.bad {
  background: var(--bad-soft);
  border-color: transparent;
  color: var(--bad);
  font-weight: 600;
}

.qm-pill.warn {
  background: var(--warn-soft);
  border-color: transparent;
  color: var(--warn);
  font-weight: 600;
}

.scene-caption {
  margin-top: 9px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* Local Upload Button */
.upload-wrap {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.upload-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-border);
  color: var(--text-primary);
}

.upload-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* Display Mode Pills */
.mode-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mode-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.mode-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.mode-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}

.mode-desc {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Accordion Details */
.acc-details > summary { list-style: none; }
.acc-details > summary::-webkit-details-marker { display: none; }

.acc-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  padding: 2px 0;
}

.acc-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.acc-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.acc-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.acc-chevron {
  color: var(--text-muted);
  transition: transform 0.18s ease;
}

.acc-details[open] .acc-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.acc-body {
  margin-top: 12px;
}

/* Stage & Camera Controls */
.stage-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sub-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

.cam-preset-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.mini-pill {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 5px 4px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: all 0.14s ease;
}

.mini-pill:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-border);
  color: var(--text-primary);
}

.seg-pair {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  background: var(--bg-stage);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}

.seg-opt {
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  padding: 5px 6px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.seg-opt.active {
  background: var(--bg-surface);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}

.tiny-hint {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-muted);
}

.compact-top {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

/* Custom Pill Toggle Switches */
.switch-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.sr-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.sr-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
}

.sr-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

.switch {
  position: relative;
  width: 34px;
  height: 18px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.slider-track {
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.slider-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: transform 0.16s ease, background 0.16s ease;
}

.switch input:checked + .slider-track {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input:checked + .slider-track::after {
  transform: translateX(16px);
  background: #ffffff;
}

/* Custom Hairline Sliders with Cobalt Fill */
.slider-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.slider-row {
  display: grid;
  grid-template-columns: 74px 1fr 44px;
  align-items: center;
  gap: 10px;
}

.slider-row label {
  font-size: 12px;
  color: var(--text-secondary);
}

.slider-row .val {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text-primary);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--pct, 50%),
    var(--border-strong) var(--pct, 50%),
    var(--border-strong) 100%
  );
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.16);
}

/* ==================== TAB 2: SPLIT-CURTAIN LAB ==================== */
.lab-workspace {
  display: none;
  height: calc(100vh - 52px);
  overflow: hidden;
}

.lab-workspace.active {
  display: grid;
  grid-template-columns: 1fr 384px;
}

.curtain-stage-wrap {
  background: var(--bg-stage);
  padding: 20px 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  overflow: hidden;
}

.curtain-stage {
  position: relative;
  width: min(100%, calc(100vh - 122px));
  aspect-ratio: 1 / 1;
  max-height: calc(100vh - 122px);
  background: #181c24;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  user-select: none;
  cursor: ew-resize;
  box-shadow: var(--shadow-lg);
}

.curtain-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.curtain-img.left {
  clip-path: inset(0 calc(100% - var(--split)) 0 0);
}

.curtain-label {
  position: absolute;
  top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 6px;
  border-radius: 7px;
  background: rgba(14, 15, 20, 0.82);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11.5px;
  font-weight: 500;
  color: #f4f4f6;
  pointer-events: none;
}

.curtain-label.left { left: 14px; }
.curtain-label.right { right: 14px; }

.tag-a,
.tag-b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
}

.tag-a {
  background: #f4f4f6;
  color: #111318;
}

.tag-b {
  background: var(--accent);
  color: #ffffff;
}

.curtain-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--split);
  width: 1.5px;
  background: rgba(255, 255, 255, 0.88);
  pointer-events: none;
}

.curtain-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(18, 20, 26, 0.92);
  backdrop-filter: blur(8px);
  border: 1.5px solid var(--accent);
  color: #f4f4f6;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
}

.curtain-caption {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.curtain-caption strong {
  color: var(--text-primary);
  font-weight: 600;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.preset-btn {
  text-align: left;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
  transition: all 0.14s ease;
}

.preset-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.preset-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}

.lab-note {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.compare-table th {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: right;
  padding: 0 0 8px 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.compare-table th:first-child { text-align: left; padding-left: 0; }

.compare-table td {
  padding: 7px 0 7px 6px;
  font-size: 12px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: right;
  color: var(--text-secondary);
}

.compare-table td:first-child { text-align: left; padding-left: 0; }
.compare-table tr:last-child td { border-bottom: none; }
.compare-table td.val-strong { color: var(--text-primary); font-weight: 600; }
.compare-table td.val-good { color: var(--good); font-weight: 600; }
.compare-table td.val-bad { color: var(--bad); font-weight: 600; }

.custom-pair-stack { display: flex; flex-direction: column; gap: 10px; }
.field-row { display: flex; flex-direction: column; gap: 4px; }
.field-row label { font-size: 11.5px; color: var(--text-muted); }

/* ==================== TAB 3: DATA & PERFORMANCE ANALYTICS ==================== */
.analytics-workspace {
  display: none;
  height: calc(100vh - 52px);
  overflow-y: auto;
  background: var(--bg-stage);
}

.analytics-workspace.active {
  display: block;
}

.analytics-inner {
  max-width: 1340px;
  margin: 0 auto;
  padding: 22px 28px 44px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.analytics-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.analytics-eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 4px;
}

.analytics-header h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.analytics-sub {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.filter-tabs {
  display: inline-flex;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 3px;
  gap: 3px;
}

.filter-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.filter-btn:hover { color: var(--text-primary); }
.filter-btn.active {
  background: var(--bg-surface);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16), inset 0 0 0 1px var(--border-subtle);
}

/* Hairline Metric Ribbon */
.metric-ribbon {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
}

.mr-cell {
  padding: 15px 18px;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mr-cell:last-child {
  border-right: none;
}

.mr-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.mr-val-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.mr-val {
  font-size: 25px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-primary);
}

.mr-delta {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.mr-delta.good { color: var(--good); }
.mr-delta.accent { color: var(--accent); }
.mr-delta.warn { color: var(--warn); }

.mr-bar {
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: var(--bg-elevated);
  overflow: hidden;
}

.mr-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.mr-bar.good > span { background: var(--good); }
.mr-bar.warn > span { background: var(--warn); }

.mr-foot {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Bento Cards & Layout */
.hero-bento {
  display: grid;
  grid-template-columns: minmax(0, 1.58fr) minmax(348px, 1fr);
  gap: 16px;
}

.subcharts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.bento-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 18px 20px;
}

.chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.chart-head h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.chart-head p {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11.5px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.lg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.lg-dot.baseline { background: var(--text-secondary); }
.lg-dot.remesh { background: var(--accent); }
.lg-dot.raw { background: var(--bad); }
.lg-dot.qem { background: var(--good); }

.chart-host {
  width: 100%;
  min-height: 240px;
}

.chart-host.tall {
  min-height: 300px;
}

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

.svg-clickable {
  cursor: pointer;
}

.scatter-pt {
  transition: opacity 0.16s ease;
}

.scatter-pt.dimmed {
  opacity: 0.22;
}

/* Variant Spotlight Card (Render Thumbnail + 5-Axis Radar) */
.spotlight-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

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

.spot-eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.spot-title {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.spot-pass-seg {
  display: inline-flex;
  background: var(--bg-stage);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}

.spot-pass-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 5px;
  padding: 3px 8px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.spot-pass-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}

.spot-visual {
  display: grid;
  grid-template-columns: 126px 1fr;
  gap: 12px;
  align-items: center;
}

.spot-thumb-frame {
  width: 126px;
  height: 126px;
  border-radius: 10px;
  background: #14161c;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  position: relative;
}

.spot-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.spot-radar-host {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spot-radar-host svg {
  width: 100%;
  max-width: 190px;
  height: auto;
  display: block;
}

.spot-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  padding: 9px 0;
  font-variant-numeric: tabular-nums;
}

.sm-cell {
  padding: 0 8px;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sm-cell:first-child { padding-left: 0; }
.sm-cell:last-child { border-right: none; padding-right: 0; }

.sm-k { font-size: 10.5px; color: var(--text-muted); }
.sm-v { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.sm-v.good { color: var(--good); }
.sm-v.bad { color: var(--bad); }

.spot-cta {
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--accent-fg);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease;
}

.spot-cta:hover {
  background: var(--accent-hover);
}

/* Precision Horizontal Track Charts */
.track-host {
  width: 100%;
}

.track-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.track-row {
  padding: 6px 9px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.14s ease;
}

.track-row:hover {
  background: var(--bg-elevated);
}

.track-row.active {
  background: var(--accent-soft);
}

.track-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  font-variant-numeric: tabular-nums;
}

.track-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.track-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.track-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.track-val.good { color: var(--good); }
.track-val.bad { color: var(--bad); }

.track-rail {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-elevated);
  overflow: hidden;
}

.track-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.track-fill.good { background: var(--good); }
.track-fill.bad { background: var(--bad); }
.track-fill.warn { background: var(--warn); }
.track-fill.neutral { background: var(--text-secondary); }

.track-empty {
  padding: 52px 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.65;
}

/* Thumbnail-Enriched Sortable Ledger Table */
.table-scroll {
  overflow-x: auto;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.ledger-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.ledger-table th:hover { color: var(--text-primary); }
.ledger-table th.num,
.ledger-table td.num { text-align: right; }
.ledger-table th.sort-active { color: var(--accent); }

.ledger-table td {
  padding: 9px 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  vertical-align: middle;
}

.ledger-table tbody tr {
  transition: background 0.12s ease;
}

.ledger-table tbody tr:hover {
  background: var(--bg-elevated);
}

.ledger-table tbody tr.active-row {
  background: var(--accent-soft);
}

.ledger-table tbody tr:last-child td {
  border-bottom: none;
}

.ledger-model {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.ledger-thumb {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #14161c;
  border: 1px solid var(--border-subtle);
  object-fit: cover;
  flex-shrink: 0;
}

.ledger-title {
  color: var(--text-primary);
  font-weight: 600;
}

.ledger-table td.good { color: var(--good); font-weight: 600; }
.ledger-table td.bad { color: var(--bad); font-weight: 600; }

.cell-meter-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.cell-meter {
  width: 48px;
  height: 3px;
  border-radius: 999px;
  background: var(--bg-elevated);
  overflow: hidden;
}

.cell-meter > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}
.cell-meter.good > span { background: var(--good); }
.cell-meter.bad > span { background: var(--bad); }

.method-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-elevated);
  color: var(--text-secondary);
}
.method-badge.qem { background: var(--good-soft); color: var(--good); }
.method-badge.remesh { background: var(--accent-soft); color: var(--accent); }
.method-badge.raw { background: var(--bad-soft); color: var(--bad); }

.row-view-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-stage);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 4px 9px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.row-view-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

/* Shared Tooltip */
.chart-tooltip {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  max-width: 260px;
  padding: 9px 11px;
  border-radius: var(--radius-md);
  background: var(--bg-glass-strong);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-primary);
}

.chart-tooltip .tt-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.chart-tooltip .tt-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 11.5px;
}
.chart-tooltip .tt-row strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ==================== SPOTLIGHT GUIDED TOUR ==================== */
.tour-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: auto;
}

.tour-spotlight {
  position: fixed;
  border-radius: 12px;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 9999px var(--tour-scrim), 0 0 24px rgba(99, 120, 255, 0.35);
  transition: top 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              left 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              width 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              height 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.tour-card {
  position: fixed;
  width: 336px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 15px 16px;
  box-shadow: var(--shadow-lg);
  transition: top 0.26s cubic-bezier(0.22, 1, 0.36, 1),
              left 0.26s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 102;
}

.tc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.tc-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.icon-close-btn {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.icon-close-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.tc-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.tc-body {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.tc-kbd-drawer {
  margin-top: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  background: var(--bg-stage);
  border: 1px solid var(--border-subtle);
}

.tk-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

.tc-actions {
  margin-top: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tc-link {
  border: none;
  background: transparent;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}
.tc-link:hover { text-decoration: underline; }

.tc-nav {
  display: flex;
  gap: 6px;
}

.tc-btn {
  border-radius: 7px;
  padding: 5px 12px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}

.tc-btn.ghost {
  background: var(--bg-elevated);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}
.tc-btn.ghost:hover { color: var(--text-primary); }
.tc-btn.ghost:disabled { opacity: 0.4; cursor: default; }

.tc-btn.primary {
  background: var(--accent);
  color: var(--accent-fg);
}
.tc-btn.primary:hover { background: var(--accent-hover); }

/* ==================== COMMAND PALETTE (⌘K) ==================== */
.cmdk-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}

.cmdk-backdrop {
  position: fixed;
  inset: 0;
  background: var(--tour-scrim);
  backdrop-filter: blur(4px);
}

.cmdk-dialog {
  position: relative;
  width: min(560px, 92vw);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 111;
}

.cmdk-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.cmdk-input-row input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--sans);
  font-size: 13.5px;
  outline: none;
}

.cmdk-input-row input::placeholder {
  color: var(--text-muted);
}

.cmdk-list {
  max-height: 330px;
  overflow-y: auto;
  padding: 6px;
}

.cmdk-item {
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 7px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--sans);
  text-align: left;
  cursor: pointer;
}

.cmdk-item:hover,
.cmdk-item.active {
  background: var(--accent-soft);
}

.cmdk-item-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
}

.cmdk-item.active .cmdk-item-title {
  color: var(--accent);
  font-weight: 600;
}

.cmdk-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.cmdk-empty {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.cmdk-footer {
  padding: 7px 14px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1120px) {
  .hero-bento { grid-template-columns: 1fr; }
  .subcharts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .metric-ribbon { grid-template-columns: repeat(2, 1fr); }
  .mr-cell { border-bottom: 1px solid var(--border-subtle); }
  .mr-cell:nth-child(2n) { border-right: none; }
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr auto;
    height: auto;
    padding: 10px 14px;
  }
  .brand-sub,
  .cmdk-trigger span,
  .cmdk-trigger kbd {
    display: none;
  }
  .workspace.active,
  .lab-workspace.active {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .sidebar-resizer { display: none; }
  .viewport-stage { height: 62vh; }
  .curtain-stage { width: min(92vw, 560px); max-height: none; }
  .sidebar,
  .lab-sidebar {
    border-left: none;
    border-top: 1px solid var(--border-subtle);
  }
}
