:root {
  color-scheme: dark;
  --bg: #05070d;
  --body-bg:
    radial-gradient(circle at top right, rgba(255, 221, 0, 0.16), transparent 26%),
    radial-gradient(circle at top left, rgba(120, 185, 255, 0.12), transparent 30%),
    linear-gradient(180deg, #05070d 0%, #090d18 38%, #05070d 100%);
  --panel: rgba(11, 15, 26, 0.92);
  --panel-strong: #0f1523;
  --surface: linear-gradient(180deg, rgba(16, 22, 37, 0.95) 0%, rgba(11, 15, 26, 0.96) 100%);
  --card: rgba(255, 255, 255, 0.035);
  --control-bg: #121a2b;
  --control-border: rgba(255, 255, 255, 0.14);
  --hover-bg: rgba(255, 255, 255, 0.03);
  --track-bg: rgba(255, 255, 255, 0.06);
  --gridline: rgba(255, 255, 255, 0.18);
  --row-border: rgba(255, 255, 255, 0.06);
  --table-head: #111828;
  --secondary-btn: rgba(255, 255, 255, 0.06);
  --text: #eef2ff;
  --muted: #a4adc2;
  --border: rgba(255, 255, 255, 0.08);
  --brand: #ffdd00;
  --brand-ink: #ffdd00;
  --brand-soft: rgba(255, 221, 0, 0.12);
  --button-ink: #05070d;
  --positive: #6ff2c3;
  --positive-fade: rgba(111, 242, 195, 0.45);
  --positive-soft: rgba(111, 242, 195, 0.14);
  --negative: #ff8d7a;
  --negative-fade: rgba(255, 141, 122, 0.45);
  --negative-soft: rgba(255, 141, 122, 0.14);
  --neutral: #78b9ff;
  --series-1: #ffdd00;
  --series-2: #78b9ff;
  --series-3: #6ff2c3;
  --series-4: #ff8d7a;
  --series-5: #b08cff;
  --series-6: #ffb86b;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --shadow-strong: 0 30px 70px rgba(0, 0, 0, 0.44);
  --brand-glow: 0 14px 28px rgba(255, 221, 0, 0.2);
  --backdrop: rgba(2, 4, 10, 0.62);
  --topbar-bg: rgba(5, 7, 13, 0.78);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

/* Light theme: follows the OS unless the viewer picked a theme with the toggle. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
  color-scheme: light;
  --bg: #f4f6fb;
  --body-bg:
    radial-gradient(circle at top right, rgba(255, 221, 0, 0.22), transparent 28%),
    radial-gradient(circle at top left, rgba(47, 111, 214, 0.08), transparent 30%),
    linear-gradient(180deg, #f7f8fc 0%, #eef1f7 100%);
  --panel: rgba(255, 255, 255, 0.96);
  --panel-strong: #ffffff;
  --surface: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  --card: #f6f8fc;
  --control-bg: #ffffff;
  --control-border: #cfd6e4;
  --hover-bg: rgba(15, 23, 42, 0.04);
  --track-bg: #e8ecf3;
  --gridline: rgba(15, 23, 42, 0.22);
  --row-border: #e6eaf1;
  --table-head: #f1f4f9;
  --secondary-btn: #e9edf5;
  --text: #0f172a;
  --muted: #55607a;
  --border: #dfe4ee;
  --brand: #f5c800;
  --brand-ink: #7a5d00;
  --brand-soft: rgba(245, 200, 0, 0.2);
  --button-ink: #0f172a;
  --positive: #0b8a5c;
  --positive-fade: rgba(11, 138, 92, 0.4);
  --positive-soft: rgba(11, 138, 92, 0.12);
  --negative: #c43d27;
  --negative-fade: rgba(196, 61, 39, 0.4);
  --negative-soft: rgba(196, 61, 39, 0.1);
  --neutral: #2f6fd6;
  --series-1: #e0b000;
  --series-2: #2f6fd6;
  --series-3: #0b8a5c;
  --series-4: #d9533c;
  --series-5: #7b55d6;
  --series-6: #d97a12;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  --shadow-strong: 0 20px 48px rgba(15, 23, 42, 0.12);
  --brand-glow: 0 10px 22px rgba(245, 200, 0, 0.3);
  --backdrop: rgba(15, 23, 42, 0.32);
  --topbar-bg: rgba(247, 248, 252, 0.85);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fb;
  --body-bg:
    radial-gradient(circle at top right, rgba(255, 221, 0, 0.22), transparent 28%),
    radial-gradient(circle at top left, rgba(47, 111, 214, 0.08), transparent 30%),
    linear-gradient(180deg, #f7f8fc 0%, #eef1f7 100%);
  --panel: rgba(255, 255, 255, 0.96);
  --panel-strong: #ffffff;
  --surface: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  --card: #f6f8fc;
  --control-bg: #ffffff;
  --control-border: #cfd6e4;
  --hover-bg: rgba(15, 23, 42, 0.04);
  --track-bg: #e8ecf3;
  --gridline: rgba(15, 23, 42, 0.22);
  --row-border: #e6eaf1;
  --table-head: #f1f4f9;
  --secondary-btn: #e9edf5;
  --text: #0f172a;
  --muted: #55607a;
  --border: #dfe4ee;
  --brand: #f5c800;
  --brand-ink: #7a5d00;
  --brand-soft: rgba(245, 200, 0, 0.2);
  --button-ink: #0f172a;
  --positive: #0b8a5c;
  --positive-fade: rgba(11, 138, 92, 0.4);
  --positive-soft: rgba(11, 138, 92, 0.12);
  --negative: #c43d27;
  --negative-fade: rgba(196, 61, 39, 0.4);
  --negative-soft: rgba(196, 61, 39, 0.1);
  --neutral: #2f6fd6;
  --series-1: #e0b000;
  --series-2: #2f6fd6;
  --series-3: #0b8a5c;
  --series-4: #d9533c;
  --series-5: #7b55d6;
  --series-6: #d97a12;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  --shadow-strong: 0 20px 48px rgba(15, 23, 42, 0.12);
  --brand-glow: 0 10px 22px rgba(245, 200, 0, 0.3);
  --backdrop: rgba(15, 23, 42, 0.32);
  --topbar-bg: rgba(247, 248, 252, 0.85);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #05070d;
  --body-bg:
    radial-gradient(circle at top right, rgba(255, 221, 0, 0.16), transparent 26%),
    radial-gradient(circle at top left, rgba(120, 185, 255, 0.12), transparent 30%),
    linear-gradient(180deg, #05070d 0%, #090d18 38%, #05070d 100%);
  --panel: rgba(11, 15, 26, 0.92);
  --panel-strong: #0f1523;
  --surface: linear-gradient(180deg, rgba(16, 22, 37, 0.95) 0%, rgba(11, 15, 26, 0.96) 100%);
  --card: rgba(255, 255, 255, 0.035);
  --control-bg: #121a2b;
  --control-border: rgba(255, 255, 255, 0.14);
  --hover-bg: rgba(255, 255, 255, 0.03);
  --track-bg: rgba(255, 255, 255, 0.06);
  --gridline: rgba(255, 255, 255, 0.18);
  --row-border: rgba(255, 255, 255, 0.06);
  --table-head: #111828;
  --secondary-btn: rgba(255, 255, 255, 0.06);
  --text: #eef2ff;
  --muted: #a4adc2;
  --border: rgba(255, 255, 255, 0.08);
  --brand: #ffdd00;
  --brand-ink: #ffdd00;
  --brand-soft: rgba(255, 221, 0, 0.12);
  --button-ink: #05070d;
  --positive: #6ff2c3;
  --positive-fade: rgba(111, 242, 195, 0.45);
  --positive-soft: rgba(111, 242, 195, 0.14);
  --negative: #ff8d7a;
  --negative-fade: rgba(255, 141, 122, 0.45);
  --negative-soft: rgba(255, 141, 122, 0.14);
  --neutral: #78b9ff;
  --series-1: #ffdd00;
  --series-2: #78b9ff;
  --series-3: #6ff2c3;
  --series-4: #ff8d7a;
  --series-5: #b08cff;
  --series-6: #ffb86b;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --shadow-strong: 0 30px 70px rgba(0, 0, 0, 0.44);
  --brand-glow: 0 14px 28px rgba(255, 221, 0, 0.2);
  --backdrop: rgba(2, 4, 10, 0.62);
  --topbar-bg: rgba(5, 7, 13, 0.78);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", sans-serif;
  background-color: var(--bg);
  background-image: var(--body-bg);
  background-attachment: fixed;
  color: var(--text);
  transition: background-color 200ms ease, color 200ms ease;
}

button,
select {
  font: inherit;
}

.app-shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px 32px 32px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 10px;
  color: var(--brand-ink);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.4rem, 4vw, 4.1rem);
  line-height: 1.02;
  max-width: 780px;
}

h2 {
  font-size: 1.35rem;
  margin-top: 4px;
}

h3 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.hero-copy {
  margin-top: 14px;
  max-width: 780px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 290px;
}

.timestamp-card,
.panel-surface,
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.timestamp-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
}

.timestamp-label,
.panel-muted,
.legend-list small,
.watchlist small,
.footer-note,
th,
td {
  color: var(--muted);
}

.timestamp-card strong {
  font-size: 1.1rem;
}

.button-row {
  display: flex;
  gap: 10px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  color: var(--button-ink);
  background: linear-gradient(135deg, #ffdd00 0%, #ffc700 100%);
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
  box-shadow: var(--brand-glow);
}

button:hover {
  transform: translateY(-1px);
}

.button-secondary {
  background: var(--secondary-btn);
  color: var(--text);
  box-shadow: none;
}

.rules-strip,
.kpi-grid,
.dashboard-grid,
.filters-panel {
  margin-bottom: 22px;
}

.rules-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.rule-card,
.insight-card,
.watch-card,
.scoreboard-card,
.donut-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.rule-card {
  padding: 18px;
}

.rule-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--brand-ink);
}

.rule-card p {
  color: var(--muted);
  line-height: 1.55;
}

.panel-surface {
  border-radius: var(--radius-xl);
  padding: 22px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.panel-heading--compact {
  margin-bottom: 12px;
}

.filters-grid,
.kpi-grid,
.dashboard-grid,
.scoreboard-grid,
.donut-grid,
.insight-list,
.watchlist {
  display: grid;
  gap: 16px;
}

.filters-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

label {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

label span {
  font-size: 0.92rem;
  color: var(--muted);
}

select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 14px;
  border: 1px solid var(--control-border);
  background-color: var(--control-bg);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  color: var(--text);
  padding: 14px 40px 14px 16px;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

select:hover {
  border-color: var(--muted);
}

select:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* Native dropdown lists ignore inherited colors; style options explicitly. */
select option {
  background-color: var(--control-bg);
  color: var(--text);
}

select.is-active {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

.kpi-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.kpi-card {
  border-radius: var(--radius-lg);
  padding: 20px;
}

.kpi-label {
  display: block;
  color: var(--muted);
  font-size: 0.95rem;
}

.kpi-value {
  display: block;
  margin-top: 14px;
  font-size: clamp(2rem, 3vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.kpi-subtext {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.dashboard-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.dashboard-grid--triple > * {
  grid-column: span 4;
}

.landing-strip {
  margin-top: 4px;
}

.landing-strip > .panel-surface {
  min-height: 620px;
  padding: 18px 20px 20px;
  border-radius: 30px;
}

.landing-strip .panel-heading {
  display: grid;
  grid-template-columns: minmax(190px, 1.05fr) minmax(170px, 1fr);
  column-gap: 22px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.landing-strip .panel-heading > div {
  min-width: 0;
  max-width: none;
}

.landing-strip .panel-heading h2 {
  font-size: clamp(1.9rem, 2.15vw, 2.35rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  max-width: 12ch;
}

.landing-strip .panel-muted {
  max-width: none;
  font-size: 0.98rem;
  line-height: 1.42;
}

.landing-strip .panel-kicker {
  margin-bottom: 10px;
}

.landing-strip .bar-list {
  gap: 16px;
}

.landing-strip .bar-item {
  gap: 6px;
}

.landing-strip .bar-item-top {
  align-items: flex-start;
}

.landing-strip .bar-item-top strong {
  font-size: 0.96rem;
}

.landing-strip .bar-meta {
  font-size: 0.9rem;
}

.landing-strip .bar-track {
  margin-top: 2px;
}

.dashboard-grid--split > *:first-child,
.panel-surface--wide {
  grid-column: span 8;
}

.dashboard-grid--split > *:last-child {
  grid-column: span 4;
}

.dashboard-grid > .panel-surface--full {
  grid-column: 1 / -1;
}

.bar-list {
  display: grid;
  gap: 14px;
}

.bar-item {
  display: grid;
  gap: 8px;
}

.bar-item-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: baseline;
}

.bar-item-top strong {
  font-size: 0.98rem;
}

.bar-meta {
  color: var(--muted);
  font-size: 0.87rem;
}

.bar-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--track-bg);
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
}

.bar-fill.positive {
  background: linear-gradient(90deg, var(--positive-fade) 0%, var(--positive) 100%);
}

.bar-fill.negative {
  background: linear-gradient(90deg, var(--negative-fade) 0%, var(--negative) 100%);
}

.donut-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.donut-card {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  align-items: start;
  gap: 16px;
  padding: 16px;
  min-width: 0;
}

.donut-card > div:last-child {
  width: 100%;
}

.donut-card h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.legend-list li {
  font-size: 0.88rem;
}

.legend-list strong {
  white-space: nowrap;
}

.legend-swatch--missing {
  background: var(--negative-soft);
  border: 1px dashed var(--negative);
}

.trend-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 24px;
  align-items: center;
}

.trend-legend-note {
  color: var(--muted);
}

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

.trend-hit {
  fill: transparent;
  cursor: pointer;
}

.trend-day:hover .trend-hit {
  fill: var(--hover-bg);
}

.trend-day.is-dim {
  opacity: 0.35;
}

.trend-bar {
  fill: var(--neutral);
}

.trend-bar-missing {
  fill: var(--negative-soft);
  stroke: var(--negative);
  stroke-dasharray: 3 3;
}

.trend-count {
  fill: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-anchor: middle;
}

.trend-count-missing {
  fill: var(--negative);
}

.trend-axis-label {
  fill: var(--muted);
  font-size: 12px;
  text-anchor: middle;
}

.trend-axis-label.is-selected {
  fill: var(--brand-ink);
  font-weight: 700;
}

.trend-axis-note {
  fill: var(--muted);
  font-size: 11px;
}

.trend-zero {
  stroke: var(--gridline);
  stroke-dasharray: 4 4;
}

.trend-line {
  fill: none;
  stroke: var(--series-1);
  stroke-width: 2.5;
  stroke-linejoin: round;
}

.trend-dot {
  stroke: var(--panel-strong);
  stroke-width: 2;
}

.trend-dot.positive {
  fill: var(--series-1);
}

.trend-dot.negative {
  fill: var(--negative);
}

.trend-gap-label {
  font-size: 12px;
  font-weight: 700;
}

.trend-gap-label.positive {
  fill: var(--brand-ink);
}

.trend-gap-label.negative {
  fill: var(--negative);
}

.donut-wrap {
  position: relative;
  width: 124px;
  height: 124px;
}

.donut {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(var(--brand) 0 100%);
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background: var(--panel-strong);
  border: 1px solid var(--border);
}

.legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.legend-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.legend-key {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.scoreboard-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.dashboard-grid--halves > * {
  grid-column: span 6;
}

.scoreboard-card {
  padding: 16px;
}

.scoreboard-top,
.scoreboard-bottom,
.watch-card,
.insight-card {
  display: grid;
  gap: 10px;
}

.scoreboard-top {
  margin-bottom: 10px;
}

.scoreboard-bottom {
  margin-top: 12px;
}

.scoreboard-card p,
.insight-card p,
.watch-card p {
  color: var(--muted);
  line-height: 1.55;
}

.scoreboard-kpi {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.92rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chip.good {
  background: var(--positive-soft);
  color: var(--positive);
}

.chip.watch {
  background: var(--brand-soft);
  color: var(--brand-ink);
}

.chip.risk {
  background: var(--negative-soft);
  color: var(--negative);
}

.insight-list,
.watchlist {
  grid-template-columns: 1fr;
}

.insight-card,
.watch-card {
  padding: 16px;
}

.insight-card strong,
.watch-card strong {
  font-size: 0.98rem;
}

.section-separator {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

.table-shell {
  overflow: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1180px;
}

th,
td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--row-border);
}

th {
  position: sticky;
  top: 0;
  background: var(--table-head);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

td {
  color: var(--text);
  font-size: 0.92rem;
}

td.muted {
  color: var(--muted);
}

.positive-text {
  color: var(--positive);
}

.negative-text {
  color: var(--negative);
}

.footer-note {
  margin-top: 12px;
  font-size: 0.94rem;
  line-height: 1.6;
  text-align: center;
}

body.presenter-mode .app-shell {
  max-width: 1660px;
  padding: 28px;
}

body.presenter-mode .hero {
  margin-bottom: 28px;
}

body.presenter-mode .kpi-value {
  font-size: clamp(2.5rem, 3.8vw, 3.4rem);
}

body.presenter-mode .panel-surface,
body.presenter-mode .kpi-card,
body.presenter-mode .timestamp-card {
  box-shadow: var(--shadow-strong);
}

body.presenter-mode h2 {
  font-size: 1.5rem;
}

@media (max-width: 1440px) {
  .scoreboard-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1280px) {
  .hero,
  .panel-heading,
  .donut-card {
    flex-direction: column;
  }

  .kpi-grid,
  .scoreboard-grid,
  .filters-grid,
  .rules-strip,
  .donut-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid--triple > *,
  .dashboard-grid--split > *,
  .dashboard-grid--halves > *,
  .panel-surface--wide {
    grid-column: span 12;
  }

  .trend-layout {
    grid-template-columns: 1fr;
  }

  .landing-strip > .panel-surface {
    min-height: auto;
  }

  .landing-strip .panel-heading {
    grid-template-columns: 1fr;
    row-gap: 12px;
  }

  .landing-strip .panel-heading > div,
  .landing-strip .panel-muted {
    max-width: none;
  }
}

@media (max-width: 780px) {
  .app-shell {
    padding: 18px;
  }

  .button-row,
  .hero-actions {
    width: 100%;
  }

  .button-row {
    flex-direction: column;
  }

  .kpi-grid,
  .scoreboard-grid,
  .filters-grid,
  .rules-strip,
  .donut-grid {
    grid-template-columns: 1fr;
  }

  .donut-card {
    grid-template-columns: 1fr;
  }

  .landing-strip .panel-surface {
    padding: 18px;
  }
}

.nowrap {
  white-space: nowrap;
}


/* ------------------------------------------------------------ Mix view */
.mix-stack {
  display: grid;
  gap: 12px;
}

.mix-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
}

.mix-card .donut-wrap {
  width: 96px;
  height: 96px;
}

.mix-card .donut::after {
  inset: 14px;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  z-index: 1;
  pointer-events: none;
}

.donut-center strong {
  font-size: 1.15rem;
  line-height: 1;
}

.donut-center span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mix-body {
  min-width: 0;
}

.mix-body h3 {
  margin: 0 0 6px;
  font-size: 0.9rem;
}

.legend-list--interactive {
  gap: 2px;
}

.legend-list--interactive li {
  display: block;
}

.legend-button {
  width: 100%;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto 48px;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  margin: 0 -8px;
  width: calc(100% + 16px);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  font-weight: 500;
  font-size: 0.86rem;
  text-align: left;
}

.legend-button:hover {
  transform: none;
  background: var(--hover-bg);
}

.legend-button .legend-swatch {
  width: 10px;
  height: 10px;
}

.legend-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-count {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.legend-share {
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.legend-empty {
  color: var(--muted);
  font-size: 0.86rem;
}

/* ------------------------------------------------------------ Clickable affordances */
.is-clickable {
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.bar-item.is-clickable {
  padding: 8px 10px;
  margin: -8px -10px;
  border-radius: 12px;
}

.bar-item.is-clickable:hover,
tr.is-clickable:hover td {
  background: var(--hover-bg);
}

.scoreboard-card.is-clickable:hover,
.kpi-card.is-clickable:hover {
  border-color: var(--brand);
}

.is-clickable:focus-visible,
.legend-button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.bar-value {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.drill-chevron {
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  transition: transform 150ms ease, color 150ms ease;
}

.is-clickable:hover .drill-chevron {
  color: var(--brand-ink);
  transform: translateX(2px);
}

/* ------------------------------------------------------------ Drill-down panel */
body.drill-open {
  overflow: hidden;
}

.drill-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  opacity: 0;
  transition: opacity 200ms ease;
  z-index: 40;
}

.drill-backdrop.is-open {
  opacity: 1;
}

.drill-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(920px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--panel-strong);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-strong);
  transform: translateX(100%);
  transition: transform 200ms ease;
  z-index: 50;
}

.drill-panel.is-open {
  transform: translateX(0);
}

.drill-panel[hidden],
.drill-backdrop[hidden] {
  display: none;
}

.drill-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--border);
}

.drill-heading {
  min-width: 0;
}

.drill-heading h2 {
  font-size: 1.6rem;
  margin: 2px 0 6px;
  overflow-wrap: anywhere;
}

.drill-back {
  margin-bottom: 12px;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.drill-back[hidden] {
  display: none;
}

.drill-close {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
}

.drill-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 28px 32px;
  display: grid;
  gap: 22px;
  align-content: start;
}

.drill-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.drill-stat {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  display: grid;
  gap: 6px;
}

.drill-stat span {
  color: var(--muted);
  font-size: 0.82rem;
}

.drill-stat strong {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.drill-actions {
  display: flex;
  justify-content: flex-start;
}

.drill-section {
  display: grid;
  gap: 10px;
}

.drill-section h3 {
  margin: 0;
  font-size: 1rem;
}

.drill-section .bar-list {
  gap: 14px;
  margin-top: 6px;
}

.drill-days {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.drill-days li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 64px;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--row-border);
  font-size: 0.9rem;
}

.drill-days strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.drill-table table {
  min-width: 1040px;
}

.drill-table th,
.drill-table td {
  padding: 10px 12px;
  font-size: 0.84rem;
}

.drill-table .chip {
  padding: 4px 8px;
  font-size: 0.68rem;
}

.drill-comment {
  min-width: 220px;
  color: var(--muted);
}

.drill-empty {
  padding: 24px 0;
}

.muted {
  color: var(--muted);
}

@media (max-width: 1280px) and (min-width: 781px) {
  .mix-stack {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .mix-card {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 12px;
  }

  .mix-body {
    width: 100%;
  }

  .drill-header,
  .drill-body {
    padding-left: 18px;
    padding-right: 18px;
  }

  .drill-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* ------------------------------------------------------------ Top navigation */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar-inner {
  max-width: 1480px;
  margin: 0 auto;
  padding: 10px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

body.presenter-mode .topbar-inner {
  max-width: 1660px;
  padding-left: 28px;
  padding-right: 28px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand);
  color: #05070d;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.brand-text {
  display: grid;
  line-height: 1.2;
  min-width: 0;
}

.brand-text strong {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text small {
  color: var(--muted);
  font-size: 0.75rem;
}

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

.icon-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  box-shadow: none;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.icon-button:hover {
  transform: none;
  border-color: var(--brand);
}

.icon-button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.icon-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.icon-button:disabled:hover {
  border-color: var(--border);
}

.icon-button.is-on {
  background: var(--brand);
  border-color: var(--brand);
  color: #05070d;
}

.icon-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand);
  color: #05070d;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.icon-badge[hidden] {
  display: none;
}

/* Theme icon: show the target mode's icon. */
.icon-button .icon-moon,
.icon-button[data-mode="light"] .icon-sun {
  display: none;
}

.icon-button[data-mode="light"] .icon-moon {
  display: block;
}

/* Tooltips */
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 120ms ease, transform 120ms ease;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 780px) {
  .topbar-inner {
    padding: 10px 18px;
  }

  .brand-text small {
    display: none;
  }
}


/* ------------------------------------------------------------ Top bar date filter */
.date-filter {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
}

.date-filter > svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
  z-index: 1;
}

.date-filter select {
  width: auto;
  min-width: 180px;
  height: 40px;
  padding: 0 36px 0 38px;
  border-radius: 12px;
  border-color: var(--border);
  background-color: var(--card);
  font-size: 0.88rem;
  font-weight: 600;
}

.date-filter select.is-active {
  border-color: var(--brand);
}

.date-filter select.is-active ~ svg,
.date-filter:has(select.is-active) > svg {
  color: var(--brand-ink);
}

.topbar-divider {
  width: 1px;
  height: 24px;
  margin: 0 4px;
  background: var(--border);
}

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

@media (max-width: 780px) {
  .topbar-actions {
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
  }

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

  .date-filter select {
    width: 100%;
    min-width: 0;
    font-size: 0.82rem;
    padding-right: 30px;
  }

  .topbar-divider {
    display: none;
  }

  .topbar-actions {
    gap: 6px;
  }
}

@media (max-width: 480px) {
  .topbar-brand {
    display: none;
  }
}


/* ------------------------------------------------------------ Date range picker */
.date-picker {
  position: relative;
}

.date-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  box-shadow: none;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}

.date-trigger:hover {
  transform: none;
  border-color: var(--muted);
}

.date-trigger:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.date-trigger svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex-shrink: 0;
}

.date-trigger .date-chevron {
  width: 14px;
  height: 14px;
  transition: transform 150ms ease;
}

.date-trigger[aria-expanded="true"] .date-chevron {
  transform: rotate(180deg);
}

.date-trigger.is-active {
  border-color: var(--brand);
}

.date-trigger.is-active svg:first-child {
  color: var(--brand-ink);
}

.date-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 35;
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  box-shadow: var(--shadow-strong);
  overflow: hidden;
}

.date-popover[hidden] {
  display: none;
}

.date-presets {
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 12px 8px;
  min-width: 140px;
  border-right: 1px solid var(--border);
  background: var(--card);
}

.date-preset {
  padding: 8px 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  font-weight: 500;
  font-size: 0.86rem;
  text-align: left;
}

.date-preset:hover {
  transform: none;
  background: var(--hover-bg);
}

.date-preset.is-active {
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 700;
}

.date-calendar {
  width: 296px;
  padding: 14px 16px 12px;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cal-header strong {
  font-size: 0.95rem;
}

.cal-nav {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  box-shadow: none;
}

.cal-nav svg {
  width: 16px;
  height: 16px;
}

.cal-nav:hover {
  transform: none;
  background: var(--hover-bg);
}

.cal-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px 0;
}

.cal-weekday {
  padding: 4px 0 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
}

.cal-day {
  position: relative;
  height: 36px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  font-weight: 500;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

.cal-day:hover:not(:disabled) {
  transform: none;
  background: var(--hover-bg);
  border-radius: 8px;
}

.cal-day:disabled {
  color: var(--muted);
  opacity: 0.4;
  cursor: default;
}

.cal-day.has-data::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--neutral);
}

.cal-day.is-today {
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cal-day.is-in-range {
  background: var(--brand-soft);
}

.cal-day.is-start {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.cal-day.is-end {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

.cal-day.is-start,
.cal-day.is-end,
.cal-day.is-start:hover,
.cal-day.is-end:hover {
  background: var(--brand);
  color: #05070d;
  font-weight: 700;
}

.cal-day.is-start.has-data::after,
.cal-day.is-end.has-data::after {
  background: #05070d;
}

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

.cal-hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

@media (max-width: 780px) {
  .date-picker {
    position: static;
    flex: 1;
    min-width: 0;
  }

  .date-trigger {
    width: 100%;
    min-width: 0;
  }

  .date-trigger span {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .date-popover {
    position: fixed;
    top: 64px;
    left: 12px;
    right: 12px;
    flex-direction: column;
  }

  .date-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .date-preset {
    padding: 6px 10px;
    border: 1px solid var(--border);
  }

  .date-calendar {
    width: auto;
  }
}


/* ------------------------------------------------------------ Executive summary */
.summary {
  margin-bottom: 22px;
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 18px;
}

.summary-headline {
  max-width: 900px;
  font-size: clamp(1.25rem, 1.8vw, 1.6rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.summary-basis {
  max-width: 380px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
  text-align: right;
}

.verdict-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.verdict-card {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-top: 4px solid var(--muted);
  border-radius: var(--radius-md);
  background: var(--card);
}

.verdict-card--good {
  border-top-color: var(--positive);
}

.verdict-card--watch {
  border-top-color: var(--brand);
}

.verdict-card--risk {
  border-top-color: var(--negative);
}

.verdict-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.verdict-title {
  font-weight: 700;
  font-size: 0.92rem;
}

.verdict-top .chip {
  padding: 5px 10px;
  font-size: 0.68rem;
  white-space: nowrap;
}

.verdict-metric {
  display: grid;
  gap: 2px;
}

.verdict-metric strong {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.verdict-metric span {
  color: var(--muted);
  font-size: 0.8rem;
}

.verdict-body {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.55;
}

.verdict-action {
  display: grid;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--row-border);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
}

.verdict-action span {
  color: var(--brand-ink);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.verdict-card.is-clickable:hover {
  border-color: var(--brand);
  border-top-color: var(--negative);
}

/* ------------------------------------------------------------ Diverging bars */
.bar-axis {
  display: flex;
  justify-content: space-between;
  margin-bottom: -4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.bar-track--diverging::before {
  content: "";
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: var(--muted);
  opacity: 0.7;
  z-index: 1;
}

.bar-track--diverging .bar-fill {
  inset: 0 auto;
}

.bar-track--diverging .bar-fill.positive {
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, var(--positive-fade) 0%, var(--positive) 100%);
}

.bar-track--diverging .bar-fill.negative {
  border-radius: 999px 0 0 999px;
  background: linear-gradient(270deg, var(--negative-fade) 0%, var(--negative) 100%);
}

.bar-track--diverging {
  overflow: visible;
}

@media (max-width: 1280px) {
  .verdict-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .summary-basis {
    text-align: left;
    max-width: none;
  }
}

@media (max-width: 780px) {
  .verdict-grid {
    grid-template-columns: 1fr;
  }
}


/* ------------------------------------------------------------ Trend chart (detailed) */
.trend-layout {
  align-items: start;
  grid-template-columns: minmax(0, 1fr) 300px;
}

.trend-chart {
  position: relative;
}

.trend-panel-title {
  fill: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.trend-panel-sub {
  fill: var(--muted);
  font-weight: 500;
}

.trend-tick {
  fill: var(--muted);
  font-size: 11px;
  text-anchor: end;
  font-variant-numeric: tabular-nums;
}

.trend-grid {
  stroke: var(--row-border);
}

.trend-baseline {
  stroke: var(--gridline);
}

.trend-zero {
  stroke: var(--muted);
  stroke-dasharray: 5 4;
  opacity: 0.8;
}

.trend-zone {
  font-size: 11px;
  font-weight: 700;
  text-anchor: end;
}

.trend-zone--good {
  fill: var(--positive);
}

.trend-zone--bad {
  fill: var(--negative);
}

.trend-day {
  cursor: pointer;
  outline: none;
}

.trend-day:focus-visible .trend-hit {
  stroke: var(--brand);
  stroke-width: 2;
}

.trend-day.is-selected .trend-hit {
  fill: var(--brand-soft);
}

.trend-count {
  font-size: 13px;
}

.trend-count-missing {
  font-size: 11px;
  font-weight: 600;
}

.trend-gap-label {
  font-size: 13px;
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--panel-strong);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.trend-axis-label {
  font-size: 12.5px;
}

.trend-tooltip {
  position: absolute;
  top: 0;
  z-index: 5;
  width: 360px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-strong);
  transform: translateX(-50%);
  pointer-events: none;
}

.trend-tooltip.is-left {
  transform: translateX(calc(-100% - 40px));
}

.trend-tooltip.is-right {
  transform: translateX(40px);
}

.trend-tooltip[hidden] {
  display: none;
}

.tt-title {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.trend-tooltip dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 14px;
  margin: 0;
  font-size: 0.82rem;
}

.trend-tooltip dt {
  color: var(--muted);
  white-space: nowrap;
}

.trend-tooltip dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tt-hint {
  display: block;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--row-border);
  color: var(--muted);
  font-size: 0.75rem;
}

.trend-guide {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
}

.trend-guide h3 {
  margin: 0 0 12px;
  font-size: 0.9rem;
}

.trend-definitions {
  display: grid;
  gap: 14px;
  margin: 0;
}

.trend-def dt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.86rem;
}

.trend-def dt strong {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.trend-def dd {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.legend-swatch--line {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--series-1);
}

.trend-takeaway {
  margin-top: 16px;
  padding: 14px 16px;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: var(--card);
  font-size: 0.92rem;
  line-height: 1.6;
}

.trend-takeaway-label {
  margin-right: 6px;
  color: var(--brand-ink);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@media (max-width: 1280px) {
  .trend-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .trend-chart {
    overflow-x: auto;
  }

  .trend-chart svg {
    min-width: 640px;
  }

  .trend-tooltip {
    position: fixed;
    top: auto;
    bottom: 12px;
    left: 12px !important;
    right: 12px;
    width: auto;
    transform: none !important;
  }
}


/* ------------------------------------------------------------ Export menu */
.export-menu {
  position: relative;
}

.export-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 35;
  width: 340px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  box-shadow: var(--shadow-strong);
}

.export-popover[hidden] {
  display: none;
}

.export-heading {
  padding: 6px 10px 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.export-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  font-weight: 500;
  text-align: left;
}

.export-option:hover:not(:disabled),
.export-option:focus-visible {
  transform: none;
  background: var(--hover-bg);
  outline: none;
}

.export-option:disabled {
  cursor: progress;
}

.export-option svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--brand-ink);
}

.export-text {
  display: grid;
  gap: 2px;
}

.export-text strong {
  font-size: 0.88rem;
}

.export-text small {
  color: var(--muted);
  font-size: 0.76rem;
}

.export-note {
  margin-top: 6px;
  padding: 8px 10px 4px;
  border-top: 1px solid var(--row-border);
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.drill-actions {
  flex-wrap: wrap;
  gap: 10px;
}

.drill-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.drill-download svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 780px) {
  .export-menu {
    position: static;
  }

  .export-popover {
    position: fixed;
    top: 64px;
    left: 12px;
    right: 12px;
    width: auto;
  }
}
