/* Parkhu desk — light default (logo kit), optional dark theme */

:root,
[data-theme="light"] {
  --bg: #f7f8fc;
  --bg-glow: radial-gradient(900px 480px at 8% -8%, rgba(124, 58, 237, 0.14) 0%, transparent 55%),
    radial-gradient(800px 420px at 92% 0%, rgba(34, 211, 238, 0.16) 0%, transparent 50%),
    radial-gradient(700px 400px at 50% 100%, rgba(37, 99, 235, 0.08) 0%, transparent 55%),
    #f7f8fc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --ink: #0b1220;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #2563eb;
  --accent-glow: rgba(37, 99, 235, 0.28);
  --good: #16a34a;
  --good-dim: rgba(22, 163, 74, 0.12);
  --warn: #d97706;
  --warn-dim: rgba(217, 119, 6, 0.12);
  --bad: #dc2626;
  --bad-dim: rgba(220, 38, 38, 0.1);
  --radius: 16px;
  --pad: 1rem;
  --max: 1280px;
  /* Institutional stack: Geist UI + Geist Mono numbers + IBM Plex fallback */
  --font: "Geist", "IBM Plex Sans", system-ui, sans-serif;
  --font-table: "IBM Plex Sans", "Geist", system-ui, sans-serif;
  --mono: "Geist Mono", "IBM Plex Sans", ui-monospace, monospace;
  --fs-title: 2.125rem; /* 34 — dashboard */
  --fs-section: 1.5rem; /* 24 — section */
  --fs-card: 1.125rem; /* 18 — card title */
  --fs-body: 0.9375rem; /* 15 */
  --fs-table: 0.875rem; /* 14 */
  --fs-small: 0.8125rem; /* 13 */
  --fs-metric: 1.75rem; /* 28 — KPI */
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --chart-bg: rgba(248, 250, 252, 0.9);
  --kpi-tip-bg: rgba(37, 99, 235, 0.08);
  --kpi-tip-border: rgba(37, 99, 235, 0.22);
  --guide-pop: #ffffff;
  --select-option-bg: #ffffff;
}

[data-theme="dark"] {
  --bg: #07090f;
  --bg-glow: radial-gradient(1200px 600px at 15% -10%, #1a2744 0%, transparent 55%),
    radial-gradient(900px 500px at 90% 0%, #12261f 0%, transparent 50%),
    #07090f;
  --surface: rgba(18, 22, 34, 0.92);
  --surface-2: rgba(28, 34, 50, 0.8);
  --ink: #f2f4f8;
  --muted: #8b93a7;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.45);
  --good: #22c55e;
  --good-dim: rgba(34, 197, 94, 0.15);
  --warn: #f59e0b;
  --warn-dim: rgba(245, 158, 11, 0.14);
  --bad: #ef4444;
  --bad-dim: rgba(239, 68, 68, 0.14);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --chart-bg: rgba(0, 0, 0, 0.25);
  --kpi-tip-bg: rgba(59, 130, 246, 0.12);
  --kpi-tip-border: rgba(59, 130, 246, 0.35);
  --guide-pop: #121624;
  --select-option-bg: #121624;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

html {
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: clip;
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.011em;
  color: var(--ink);
  background: var(--bg-glow);
  transition: background 0.2s ease, color 0.2s ease;
  font-feature-settings: "ss01" on, "cv11" on;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.shell {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem var(--pad) 2.5rem;
  box-sizing: border-box;
  overflow-x: clip;
}

/* —— Top bar —— */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.25rem;
  margin-bottom: 1.25rem;
}

.brand-block {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex: 0 0 auto;
  color: inherit;
}

.brand-logo {
  display: none;
  height: auto;
  width: auto;
  filter: drop-shadow(0 0 16px rgba(59, 130, 246, 0.35));
}

/* Mobile: mark only */
.brand-logo--mark {
  display: block;
  width: 36px;
  height: 36px;
}

/* Tablet / mid: compact lockup */
@media (min-width: 560px) {
  .brand-logo--mark {
    display: none;
  }
  .brand-logo--compact {
    display: block;
    width: min(150px, 36vw);
    height: auto;
  }
}

/* Desktop: full lockup */
@media (min-width: 900px) {
  .brand-logo--compact {
    display: none;
  }
  .brand-logo--full {
    display: block;
    width: min(190px, 22vw);
    height: auto;
  }
}

.brand-block:hover .brand-logo,
.brand-block:focus-visible .brand-logo {
  filter: drop-shadow(0 0 20px rgba(34, 211, 238, 0.4));
}

.brand-block:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 8px;
}

.nav {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.nav::-webkit-scrollbar {
  display: none;
}

.nav a {
  flex: 0 0 auto;
  text-decoration: none;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--ink);
  background: var(--surface-2);
}

.nav a.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent-glow);
}

.top-meta {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  min-width: 0;
}

.date-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.55rem 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.date-filter select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238b93a7' d='M1 1l5 5 5-5'/%3E%3C/svg%3E")
    no-repeat right 0.15rem center;
  color: var(--ink);
  font: inherit;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.15rem 1.1rem 0.15rem 0.15rem;
  min-width: 8.5rem;
  cursor: pointer;
}

.date-filter select:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.date-filter select option {
  background: var(--select-option-bg);
  color: var(--ink);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow);
  flex: 0 0 auto;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
}

html[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

html[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

.meta-tools {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.date-note {
  margin: 0;
  font-size: 0.72rem;
  color: var(--warn);
  max-width: 280px;
  text-align: right;
}

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  white-space: nowrap;
}

.badge.bull {
  background: var(--good-dim);
  color: var(--good);
  border-color: rgba(34, 197, 94, 0.35);
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.2);
}
.badge.bear {
  background: var(--bad-dim);
  color: var(--bad);
  border-color: rgba(239, 68, 68, 0.35);
}
.badge.neutral {
  background: var(--warn-dim);
  color: var(--warn);
  border-color: rgba(245, 158, 11, 0.35);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.meta strong {
  color: var(--ink);
  font-weight: 600;
}

/* —— KPI cards —— */
.kpi-row {
  margin-bottom: 0.85rem;
}

.kpi {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.kpi .cell {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.05rem 1.1rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}

.kpi .cell::after {
  content: "";
  position: absolute;
  right: 0.75rem;
  bottom: 0.65rem;
  width: 42%;
  height: 28px;
  opacity: 0.55;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--accent) 55%, transparent)
  );
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 24'%3E%3Cpath fill='none' stroke='white' stroke-width='2' d='M0 18 L12 14 L24 16 L36 8 L48 12 L60 4 L80 10'/%3E%3C/svg%3E");
  mask-size: 100% 100%;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 24'%3E%3Cpath fill='none' stroke='white' stroke-width='2' d='M0 18 L12 14 L24 16 L36 8 L48 12 L60 4 L80 10'/%3E%3C/svg%3E");
  -webkit-mask-size: 100% 100%;
  pointer-events: none;
}

.kpi .cell.tone-bull::after {
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--good) 70%, transparent));
}
.kpi .cell.tone-bear::after {
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--bad) 70%, transparent));
}
.kpi .cell.tone-warn::after {
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--warn) 70%, transparent));
}

.kpi .cell:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.kpi .cell:focus-visible,
.kpi .cell.active {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 24px var(--accent-glow);
}

.kpi .cell span {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi .cell b {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--mono);
  font-size: var(--fs-metric);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.kpi .cell b.bull {
  color: var(--good);
  text-shadow: 0 0 18px rgba(34, 197, 94, 0.35);
}
.kpi .cell b.bear {
  color: var(--bad);
  text-shadow: 0 0 18px rgba(239, 68, 68, 0.35);
}
.kpi .cell b.warn {
  color: var(--warn);
}

.kpi-tip {
  margin: 0.75rem 0 0;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: var(--kpi-tip-bg);
  border: 1px solid var(--kpi-tip-border);
  font-size: 0.88rem;
  color: var(--ink);
  line-height: 1.4;
}

/* —— Status ribbon —— */
.status-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.status-ribbon .pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--muted);
}

.status-ribbon .pill b {
  color: var(--ink);
  font-weight: 600;
}

.status-ribbon .pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.status-ribbon .pill.bull .dot {
  background: var(--good);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}
.status-ribbon .pill.bear .dot {
  background: var(--bad);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}
.status-ribbon .pill.pause {
  border-color: rgba(239, 68, 68, 0.45);
  color: var(--bad);
}
.status-ribbon .pill.pause .dot {
  background: var(--bad);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}
.status-ribbon .pill.kill-ok .dot {
  background: var(--good);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

/* —— Desk grid —— */
.desk {
  display: grid;
  gap: 0.9rem;
  min-width: 0;
  width: 100%;
}

.main-col,
.side-col {
  display: grid;
  gap: 0.9rem;
  align-content: start;
  min-width: 0;
  max-width: 100%;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1.2rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.panel.hero {
  border-color: rgba(59, 130, 246, 0.22);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.panel h2 {
  margin: 0;
  font-size: var(--fs-section);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.panel-sub,
.hint-mini {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: var(--fs-small);
  font-weight: 500;
}

.tip-card p {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.tip-card p:first-of-type {
  margin-top: 0.55rem;
}

.guide {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}

.guide summary {
  list-style: none;
  cursor: pointer;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  user-select: none;
  white-space: nowrap;
}

.guide summary::-webkit-details-marker {
  display: none;
}

.guide[open] {
  border-radius: 12px;
  position: relative;
  z-index: 2;
}

.guide-body {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  width: min(320px, 82vw);
  padding: 0.75rem 0.85rem;
  font-size: 0.82rem;
  color: var(--ink);
  background: var(--guide-pop);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.guide-body p {
  margin: 0.45rem 0 0;
}

.guide-body p:first-child {
  margin-top: 0;
}

.guide-body ul {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}

.panel-head {
  position: relative;
}

.stat-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin: 0.75rem 0;
}

.stat {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
}

.stat dt {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat dd {
  margin: 0.2rem 0 0;
  font-family: var(--mono);
  font-size: var(--fs-table);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stat dd.bull {
  color: var(--good);
}
.stat dd.bear {
  color: var(--bad);
}

.chart-grid {
  display: grid;
  gap: 0.75rem;
}

.chart-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 220px;
  margin: 0.4rem 0 0.5rem;
  padding: 0.5rem;
  border-radius: 12px;
  background: var(--chart-bg);
  border: 1px solid var(--line);
  overflow: hidden;
  box-sizing: border-box;
}

.chart-wrap canvas {
  max-width: 100% !important;
}

.chart-wrap.tall {
  height: min(48vh, 380px);
  min-height: 280px;
}

#funnel.panel {
  overflow: visible;
}

.funnel-viz {
  display: grid;
  gap: 0.55rem;
  margin: 0.15rem 0 0.85rem;
  min-width: 0;
  overflow: visible;
}

.funnel-stage {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
}

.funnel-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.funnel-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  min-width: 0;
  overflow-wrap: anywhere;
}

.funnel-track {
  display: flex;
  justify-content: center;
  width: 100%;
  min-width: 0;
}

.funnel-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 1.85rem;
  min-width: 2.5rem;
  max-width: 100%;
  padding: 0.3rem 0.55rem;
  border-radius: 0.55rem;
  background: color-mix(in srgb, var(--accent) 55%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  box-sizing: border-box;
  transition: width 0.25s ease;
}

.funnel-stage.tight .funnel-bar {
  background: color-mix(in srgb, var(--warn) 42%, transparent);
  border-color: color-mix(in srgb, var(--warn) 45%, var(--line));
}

.funnel-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
  text-align: center;
}

.funnel-tip {
  position: relative;
  flex: 0 0 auto;
}

.funnel-tip-btn {
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.funnel-tip-btn:hover,
.funnel-tip-btn:focus-visible,
.funnel-tip.is-open .funnel-tip-btn {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.funnel-tip-pop {
  display: none;
  position: absolute;
  z-index: 40;
  top: calc(100% + 0.35rem);
  left: 0;
  width: min(20.5rem, calc(100vw - 2.5rem));
  padding: 0.7rem 0.8rem;
  border-radius: 0.65rem;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  color: var(--ink);
}

.funnel-tip.flip .funnel-tip-pop {
  top: auto;
  bottom: calc(100% + 0.35rem);
}

.funnel-tip.is-open .funnel-tip-pop {
  display: grid;
  gap: 0.4rem;
}

.funnel-tip-pop p {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
}

.funnel-tip-pop strong {
  color: var(--ink);
  font-weight: 700;
}

.funnel-expand {
  margin: 0.1rem 0 0.15rem;
  border-radius: 0.45rem;
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  padding: 0.15rem 0.55rem 0.25rem;
}

.funnel-expand summary {
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.25rem 0;
  list-style: none;
}

.funnel-expand summary::-webkit-details-marker {
  display: none;
}

.funnel-expand summary::before {
  content: "▸ ";
  color: var(--accent);
}

.funnel-expand[open] summary::before {
  content: "▾ ";
}

.funnel-expand-body {
  display: grid;
  gap: 0.35rem;
  padding: 0.15rem 0 0.4rem;
}

.funnel-expand-body h4 {
  margin: 0.35rem 0 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.funnel-chip-note {
  margin: 0 0 0.2rem;
  font-size: 0.7rem;
  color: var(--muted);
}

.funnel-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.funnel-sym-chip {
  padding: 0.15rem 0.4rem;
}

.funnel-sym-chip .sym-link {
  font-size: 0.72rem;
}

.survivors-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.75rem;
}

.survivors-filter {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.survivors-filter:hover,
.survivors-filter.active {
  border-color: var(--accent);
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
}

.survivors-body {
  overflow-x: auto;
}

.survivors-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.survivors-table th,
.survivors-table td {
  text-align: left;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.survivors-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}

.survivors-reason {
  color: var(--muted);
  max-width: 22rem;
}

.status-pill {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: lowercase;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.status-pill.status-idea {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

.status-pill.status-watchlist {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--warn) 45%, var(--line));
  background: color-mix(in srgb, var(--warn) 20%, transparent);
}

.status-pill.status-rejected {
  color: var(--muted);
}

.drops {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
}

.chip b {
  color: var(--ink);
}

.chip.hot {
  background: var(--warn-dim);
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--warn);
}

.chip.hot b {
  color: var(--warn);
}

.cards {
  display: grid;
  gap: 0.55rem;
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  background: var(--surface-2);
}

.card .title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.card .title strong,
.card .title .sym-link strong {
  font-size: var(--fs-card);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sym-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.2em;
  border-radius: 4px;
}

.sym-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.sym-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sym-ext {
  font-size: 0.75em;
  font-weight: 600;
  opacity: 0.55;
  line-height: 1;
}

.sym-link:hover .sym-ext,
.sym-link:focus-visible .sym-ext {
  opacity: 1;
}

.ai-review {
  margin-top: 0.65rem;
  border-top: 1px solid var(--line);
  padding-top: 0.45rem;
  font-size: var(--fs-small);
}

.ai-review summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
}

.ai-review summary::-webkit-details-marker {
  display: none;
}

.ai-review-thesis {
  margin: 0.45rem 0 0.35rem;
  color: var(--ink);
  line-height: 1.45;
}

.ai-review-meta {
  margin: 0.25rem 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.news-list {
  margin: 0;
  padding: 0 0 0 1.1rem;
  display: grid;
  gap: 0.75rem;
}

.news-item {
  padding-left: 0.15rem;
}

.news-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}

.impact-pill {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: var(--warn-dim);
  color: var(--warn);
}

.impact-pill.high {
  background: var(--bad-dim);
  color: var(--bad);
}

.impact-pill.low {
  background: var(--good-dim);
  color: var(--good);
}

.news-headline {
  margin: 0;
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.35;
}

.news-why {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}

.stock-reviews {
  display: grid;
  gap: 0.5rem;
}

.card .sub {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.45rem;
}

.card .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem 0.75rem;
  font-family: var(--font-table);
  font-size: var(--fs-table);
  font-variant-numeric: tabular-nums;
}

.card .row span {
  color: var(--muted);
  font-weight: 500;
}

.card .row b {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--ink);
}

.band {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.band.buy {
  background: var(--good-dim);
  color: var(--good);
  border-color: rgba(34, 197, 94, 0.35);
}
.band.watch {
  background: var(--warn-dim);
  color: var(--warn);
  border-color: rgba(245, 158, 11, 0.35);
}

.action-strip {
  margin: 0.5rem 0 0.65rem;
  display: grid;
  gap: 0.45rem;
}

.action-strip .item {
  background: var(--warn-dim);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-left: 3px solid var(--warn);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font-size: 0.88rem;
}

.action-strip.compact .item {
  font-size: 0.8rem;
  padding: 0.55rem 0.65rem;
}

.action-strip .empty,
.empty {
  color: var(--muted);
  font-style: italic;
  margin: 0.35rem 0;
  font-size: 0.88rem;
}

/* Gauge */
.gauge {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0.75rem auto 0.5rem;
}

.gauge svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gauge-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 10;
}

.gauge-arc {
  fill: none;
  stroke: var(--good);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.55));
  transition: stroke-dashoffset 0.6s ease;
}

.gauge-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.gauge-label b {
  font-family: var(--mono);
  font-size: var(--fs-metric);
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.gauge-label span {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.quality {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.quality li {
  margin: 0.35rem 0;
}

.cov {
  display: none;
}

.sentiment {
  margin-top: 0.75rem;
}

.sentiment .bar {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.sentiment .seg {
  height: 100%;
  min-width: 2px;
}

.sentiment .seg.bull {
  background: var(--good);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.45);
}
.sentiment .seg.neutral {
  background: #64748b;
}
.sentiment .seg.bear {
  background: var(--bad);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.sentiment .legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  margin-top: 0.65rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.sentiment .legend b {
  color: var(--ink);
  font-family: var(--mono);
}

.pulse-regions {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.pulse-region h3 {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.pulse-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.2rem;
}

.pulse-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.8rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--line);
}

.pulse-row:last-child {
  border-bottom: 0;
}

.pulse-name {
  color: var(--ink);
  font-weight: 500;
  min-width: 0;
}

.pulse-pct {
  font-family: var(--mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--muted);
}

.pulse-pct.bull {
  color: var(--good);
}

.pulse-pct.bear {
  color: var(--bad);
}

/* —— Groq enrichment —— */
.enrich-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.enrich-hero[hidden] {
  display: none !important;
}

.enrich-hero .stance-chip {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.enrich-hero .stance-chip.defensive {
  background: var(--warn-dim);
  color: var(--warn);
  border-color: rgba(217, 119, 6, 0.35);
}

.enrich-hero .stance-chip.selective_aggressive,
.enrich-hero .stance-chip.selective-aggressive {
  background: var(--good-dim);
  color: var(--good);
  border-color: rgba(22, 163, 74, 0.35);
}

.enrich-hero .stance-chip.neutral {
  color: var(--muted);
}

.enrich-hero .brief-line {
  flex: 1 1 220px;
  margin: 0;
  font-size: var(--fs-small);
  color: var(--ink);
  line-height: 1.4;
}

.enrich-hero .model-badge {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.enrich-hero .model-badge.fallback {
  color: var(--warn);
  border-color: rgba(217, 119, 6, 0.35);
}

.enrich-hero a.jump {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.enrich-panel .enrich-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.5rem 0 0.85rem;
}

.enrich-panel .focus-chip {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
}

.enrich-panel .market-brief {
  margin: 0 0 1rem;
  font-size: var(--fs-body);
  line-height: 1.5;
}

.enrich-table-wrap {
  width: 100%;
  max-width: 100%;
  margin: 0.5rem 0 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.enrich-table {
  width: 100%;
  min-width: 52rem;
  border-collapse: collapse;
  font-family: var(--font-table);
  font-size: var(--fs-table);
}

.enrich-table th,
.enrich-table td {
  text-align: left;
  padding: 0.55rem 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.enrich-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.enrich-table .mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.enrich-table .action {
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

.enrich-table td:first-child {
  white-space: nowrap;
}

.enrich-notes {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: var(--fs-small);
}

.enrich-notes li {
  margin: 0.3rem 0;
}

.claude-feed {
  margin-top: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 0.75rem 0.85rem;
}

.claude-feed summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent);
  list-style: none;
}

.claude-feed summary::-webkit-details-marker {
  display: none;
}

.claude-feed pre {
  margin: 0.65rem 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--ink);
}

.claude-feed .copy-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.claude-feed button {
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
}

.enrich-skip {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-small);
  font-style: italic;
}

.side-enrich .stance {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  margin-bottom: 0.45rem;
}

.side-enrich ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: var(--fs-small);
  color: var(--muted);
}

.side-enrich li {
  margin: 0.25rem 0;
}

/* Stack suggestion rows as cards below desk 2-col breakpoint — avoids mid-digit wrap. */
@media (max-width: 979px) {
  .enrich-table-wrap {
    overflow-x: visible;
  }

  .enrich-table {
    min-width: 0;
  }

  .enrich-table thead {
    display: none;
  }

  .enrich-table tr {
    display: block;
    margin-bottom: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.5rem 0.65rem;
    background: var(--surface-2);
  }

  .enrich-table td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    border: 0;
    padding: 0.3rem 0;
  }

  .enrich-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    flex: 0 0 auto;
  }

  .enrich-table .mono,
  .enrich-table .action,
  .enrich-table td:first-child {
    white-space: nowrap;
    text-align: right;
  }

  .enrich-table td.rationale {
    display: block;
    white-space: normal;
  }

  .enrich-table td.rationale::before {
    display: block;
    margin-bottom: 0.15rem;
  }
}

.foot {
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.foot a {
  color: var(--accent);
  font-weight: 600;
  word-break: break-word;
  text-decoration: none;
}

.foot a:hover {
  text-decoration: underline;
}

.note {
  margin-top: 0.45rem;
  font-size: 0.8rem;
  color: var(--muted);
}

@media (min-width: 640px) {
  .kpi {
    grid-template-columns: repeat(4, 1fr);
  }

  .stat-list {
    grid-template-columns: repeat(4, 1fr);
  }

  .chart-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 980px) {
  .shell {
    padding: 1.25rem 1.5rem 3rem;
  }

  .topbar {
    flex-wrap: nowrap;
  }

  .nav {
    flex: 1;
    justify-content: center;
    max-width: 640px;
    margin: 0 auto;
  }

  .desk {
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
  }

  .side-col {
    position: sticky;
    top: 0.75rem;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 0.75rem 0.75rem 2rem;
  }

  .topbar {
    gap: 0.65rem;
  }

  .top-meta {
    width: 100%;
    align-items: flex-start;
    margin-left: 0;
  }

  .meta-tools {
    width: 100%;
    justify-content: flex-start;
  }

  .meta {
    justify-content: flex-start;
  }

  .date-filter {
    flex: 1 1 auto;
    min-width: 0;
  }

  .date-filter select {
    min-width: 0;
    width: 100%;
    max-width: none;
  }

  .date-note {
    max-width: none;
    text-align: left;
  }

  .nav {
    width: 100%;
    order: 3;
  }

  .panel {
    padding: 0.9rem 0.85rem 1rem;
  }

  .panel-head {
    flex-wrap: wrap;
  }

  .panel h2 {
    font-size: 1.25rem;
  }

  .kpi .cell {
    padding: 0.85rem 0.8rem 0.95rem;
  }

  .kpi .cell b {
    font-size: 1.35rem;
  }

  .chart-wrap.tall {
    min-height: 220px;
    height: min(42vh, 300px);
  }

  .funnel-meta {
    white-space: normal;
    line-height: 1.25;
  }

  .funnel-tip-pop {
    left: auto;
    right: 0;
  }

  .status-ribbon {
    gap: 0.4rem;
  }

  .status-ribbon .pill {
    max-width: 100%;
  }

  .card .row {
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem 0.5rem;
  }

  .enrich-hero {
    gap: 0.55rem;
  }

  .enrich-hero .brief-line {
    flex: 1 1 100%;
  }
}
