/* ─────────────────────────────────────────────────────────────────────────
   FWM Performance Dashboard - Design System
   Light institutional theme. FWM brand colors. Semantic tokens.
   ───────────────────────────────────────────────────────────────────────── */

/* ── Tokens ──────────────────────────────────────────────────────────────── */

:root {
  /* Brand - Primary */
  --brand:          #00b1ca;
  --brand-dark:     #008598;
  --brand-dim:      rgba(0, 177, 202, 0.08);
  --brand-mid:      rgba(0, 177, 202, 0.15);
  --brand-border:   rgba(0, 177, 202, 0.25);

  /* Brand - Secondary
     GOLD RULE: #5e2e85 is EARNED, never decorative.
     Only apply via .card--gold-earned when KPI exceeds benchmark by 15%+. */
  --gold:             #5e2e85;
  --gold-dark:        #42205d;
  --gold-dim:         rgba(94, 46, 133, 0.15);
  --gold-earned-glow: rgba(94, 46, 133, 0.25);

  /* Card states */
  --stale-amber:      #d4930d;
  --stale-amber-dim:  rgba(212, 147, 13, 0.12);

  /* Channel colors */
  --google:           #1A6099;
  --google-dim:       rgba(26, 96, 153, 0.08);
  --google-border:    rgba(26, 96, 153, 0.22);

  --meta:             #00b1ca;       /* Mavroon for Meta */
  --meta-dim:         rgba(0, 177, 202, 0.08);
  --meta-border:      rgba(0, 177, 202, 0.22);

  --dsp:              #FF871A;       /* Monument Sunset */
  --dsp-dark:         #c45e00;       /* darkened for text on light bg */
  --dsp-dim:          rgba(255, 135, 26, 0.10);
  --dsp-border:       rgba(255, 135, 26, 0.28);

  /* Surfaces - Light theme */
  --bg:            #f4f5f7;
  --surface:       #ffffff;
  --surface-2:     #f8f8fa;
  --surface-3:     #f0f1f4;
  --surface-4:     #e8e9ee;

  /* Borders */
  --border:        #e1e3ea;
  --border-subtle: #eaecf0;
  --border-strong: #c8cad4;

  /* Text */
  --text:           #1a1a24;
  --text-secondary: #4a4a5e;
  --text-muted:     #7a7a92;
  --text-disabled:  #b0b0c4;

  /* Semantic status */
  --danger:         #c0392b;
  --danger-dim:     rgba(192, 57, 43, 0.08);

  /* Shadows - lighter for light theme */
  --shadow-xs:   0 1px 3px rgba(0, 0, 0, 0.07);
  --shadow-sm:   0 2px 6px rgba(0, 0, 0, 0.08);
  --shadow-md:   0 4px 16px rgba(0, 0, 0, 0.10);
  --shadow-lg:   0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-lift: 0 10px 36px rgba(0, 0, 0, 0.13);

  /* Shape */
  --radius:    14px;
  --radius-sm: 9px;
  --radius-xs: 6px;

  /* Type */
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", "Fira Code", "Cascadia Code", monospace;

  /* Typography scale */
  --text-hero:         48px;
  --text-primary-kpi:  36px;
  --text-secondary-kpi: 22px;
  --text-body:         14px;
  --text-caption:      12px;
  --text-micro:        10px;

  /* Motion */
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --wipe-ease:   cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 120ms;
  --duration-base: 200ms;
  --duration-slow: 300ms;
  --wipe-duration: 200ms;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */

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

/* ── Base ────────────────────────────────────────────────────────────────── */

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Utility helpers */
.hidden         { display: none !important; }
.subtle         { color: var(--text-muted); font-size: 12px; letter-spacing: 0.01em; }
.error          { color: var(--danger); font-size: 13px; margin-top: 16px; }
.u-num          { font-variant-numeric: tabular-nums; }

/* ── Login ───────────────────────────────────────────────────────────────── */

.login-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 12%, rgba(0, 177, 202, 0.07) 0%, transparent 45%),
    radial-gradient(circle at 80% 88%, rgba(94, 46, 133, 0.04) 0%, transparent 50%),
    var(--bg);
  position: relative;
}

/* Subtle noise to break flat surface - sits behind the card */
.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence baseFrequency='0.85'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.login-screen > * { position: relative; z-index: 1; }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 44px 36px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  position: relative;
  box-shadow:
    0 1px 2px rgba(26, 26, 36, 0.04),
    0 12px 32px rgba(26, 26, 36, 0.08),
    0 32px 80px rgba(0, 177, 202, 0.06);
}

/* Mavroon accent rendered as an inset top bar with rounded corners */
.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--brand);
  border-radius: 20px 20px 0 0;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 32px;
}

.login-brand img.brand-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  margin-bottom: 16px;
  opacity: 0.95;
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.15;
}

.login-sub {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-top: 2px;
}

.brand-logo {
  max-height: 80px;
  width: auto;
  object-fit: contain;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 36px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-btn {
  background: var(--brand);
  color: #fff;
  border: 0;
  padding: 13px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition:
    background var(--duration-base) var(--ease-in-out),
    transform 120ms ease,
    box-shadow var(--duration-base) var(--ease-in-out);
  margin-top: 4px;
}
.login-btn:hover { background: var(--brand-dark); box-shadow: 0 6px 18px rgba(0, 177, 202, 0.25); }
.login-btn:active { transform: translateY(1px); }
.login-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.login-error {
  color: var(--pause);
  font-size: 12px;
  min-height: 16px;
  margin-top: 2px;
  text-align: left;
}

.login-back {
  display: inline-block;
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color var(--duration-base) var(--ease-in-out);
}
.login-back:hover { color: var(--brand); }

/* ── Form controls ───────────────────────────────────────────────────────── */

input[type="password"],
input[type="date"],
select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 13px 16px;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition:
    border-color var(--duration-base) var(--ease-in-out),
    box-shadow var(--duration-base) var(--ease-in-out);
  width: 100%;
}
input:hover { border-color: var(--text-disabled); }
input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-dim);
}

input[type="date"] {
  color-scheme: light;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

button {
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-in-out),
    opacity var(--duration-fast) var(--ease-in-out),
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-in-out);
  will-change: transform;
}

button:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 177, 202, 0.22);
}

button:active {
  transform: translateY(0);
  background: var(--brand);
}

/* Ghost variant - logout, secondary actions */
.ghost-btn {
  background: transparent;
  color: rgba(255, 255, 255, 0.80);
  border: 1px solid rgba(255, 255, 255, 0.30);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: var(--radius-sm);
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.50);
  transform: none;
  box-shadow: none;
}

/* ── Dashboard shell ─────────────────────────────────────────────────────── */

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding-bottom: 64px;
}

/* Focus accessibility */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.header :focus-visible {
  outline-color: rgba(255, 255, 255, 0.75);
}

/* ── Header ──────────────────────────────────────────────────────────────── */

/* Full-bleed Mavroon bar across the entire viewport width */
.header {
  background: var(--brand);
  color: #fff;
  /* Break out of any parent padding to span full viewport */
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding: 0 clamp(16px, 4vw, 64px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 64px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Constrain header inner content to dashboard max-width */
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1368px;  /* 1440 - 2*36 */
  margin: 0 auto;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Header logo - full-color FWM crest sits on a white badge so it reads
   clearly against the dark mavroon header. */
.header-logo {
  height: 30px;
  width: auto;
  object-fit: contain;
  background: #fff;
  padding: 5px 10px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.header-titleblock {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

/* Header descriptor - plain label, no pill */
.header-descriptor {
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  line-height: 1;
}

/* "powered by TRAFFIK" line */
.header-poweredby {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: #000;               /* "powered by" in black */
  line-height: 1;
}

.traffik-wordmark {
  color: #fff;               /* TRAFFIK in white */
  font-weight: 800;
  letter-spacing: 0.08em;
}

#last-updated {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.01em;
}

/* ── Content wrapper (below header) ─────────────────────────────────────── */

/* All sections below the header get side padding and max-width centering */
.dashboard > *:not(.header) {
  max-width: 1440px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 36px;
  padding-right: 36px;
  box-sizing: border-box;
}

/* ── Date controls row ───────────────────────────────────────────────────── */

.controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 8px;
}

/* Preset pill group */
.preset-group {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.preset {
  background: transparent;
  color: var(--text-muted);
  padding: 6px 13px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition:
    color var(--duration-fast) var(--ease-in-out),
    background var(--duration-fast) var(--ease-in-out);
}

.preset:hover {
  color: var(--text-secondary);
  background: var(--surface-3);
  transform: none;
  box-shadow: none;
  opacity: 1;
}

.preset.active {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-xs);
  transform: none;
  opacity: 1;
}

.preset.active:hover {
  background: var(--brand-dark);
}

/* Custom date range */
.custom-range {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px 10px 3px 6px;
}

.custom-range input {
  padding: 5px 8px;
  font-size: 12px;
  background: transparent;
  border: none;
  box-shadow: none;
  width: auto;
  color: var(--text);
}

.custom-range input:focus {
  box-shadow: none;
  border-color: transparent;
}

.custom-range button {
  padding: 5px 13px;
  font-size: 12px;
  border-radius: 6px;
  transform: none;
}

.custom-range button:hover {
  transform: none;
}

/* ── View navigation ─────────────────────────────────────────────────────── */

.view-nav {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: 12px;
  padding: 4px;
  gap: 2px;
  align-self: flex-start;
  box-shadow: var(--shadow-sm);
}

.view-nav-btn {
  background: transparent;
  color: var(--text-muted);
  padding: 10px 24px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition:
    color var(--duration-base) var(--ease-out),
    background var(--duration-base) var(--ease-out);
}

.view-nav-btn:hover {
  color: var(--text-secondary);
  background: var(--surface-3);
}

.view-nav-btn.active {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 177, 202, 0.20);
}

.view-nav-btn.active:hover {
  background: var(--brand-dark);
}

/* ── Exec Overview ───────────────────────────────────────────────────────── */

.exec-overview {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.exec-hero {
  text-align: center;
}

.exec-hero .card {
  padding: 36px 32px;
  border-top: 4px solid var(--brand);
}

.exec-hero .card-value {
  font-size: var(--text-hero);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--brand);
}

.exec-hero .card-label {
  font-size: var(--text-caption);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.exec-hero .card-details {
  margin-top: 8px;
  font-size: var(--text-caption);
  color: var(--text-muted);
}

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

.exec-kpi-grid .card {
  text-align: center;
  padding: 24px 16px;
}

.exec-kpi-grid .card-value {
  font-size: var(--text-secondary-kpi);
  font-weight: 700;
}

.exec-kpi-grid .card-label {
  font-size: var(--text-micro);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.exec-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.exec-charts .chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px 16px;
  box-shadow: var(--shadow-xs);
}

.chart-card-title {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.chart-card-sub {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.chart-wrap {
  position: relative;
  height: 240px;
}

@media (max-width: 720px) {
  .exec-charts {
    grid-template-columns: 1fr;
  }
}

.exec-channels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.exec-channel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
}

.exec-channel-card .channel-name {
  font-size: var(--text-micro);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.exec-channel-card .channel-name.google { color: var(--google); }
.exec-channel-card .channel-name.meta-ads { color: var(--meta); }
.exec-channel-card .channel-name.dsp { color: var(--dsp-dark); }

.exec-channel-metrics {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exec-channel-metric {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: var(--text-caption);
}

.exec-channel-metric .label {
  color: var(--text-muted);
}

.exec-channel-metric .value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* ── Industry Benchmarks ──────────────────────────────────────────────────── */

.benchmark-charts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.benchmark-chart-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px 16px;
  box-shadow: var(--shadow-xs);
}

.benchmark-chart-card .chart-card-title {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.benchmark-chart-card .chart-card-sub {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.benchmark-chart-card .chart-wrap {
  position: relative;
  height: 190px;
}

.benchmark-verdict {
  align-self: flex-start;
  margin-top: 12px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}

.benchmark-verdict.v-good { background: var(--gold-dim); color: var(--gold-dark); }
.benchmark-verdict.v-bad { background: rgba(74, 74, 94, 0.10); color: var(--text-secondary); }
.benchmark-verdict.v-neutral { background: rgba(120, 120, 146, 0.12); color: var(--text-muted); }

@media (max-width: 720px) {
  .benchmark-charts {
    grid-template-columns: 1fr;
  }
}

.benchmarks-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-xs);
}

.benchmarks-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.benchmarks-subtitle {
  font-size: var(--text-caption);
  color: var(--text-muted);
  margin-bottom: 24px;
}

.benchmarks-table {
  width: 100%;
  border-collapse: collapse;
}

.benchmarks-table thead tr {
  background: var(--brand);
  color: #fff;
}

.benchmarks-table thead th {
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  border: none;
}

.benchmarks-table thead th.num {
  text-align: right;
}

.benchmarks-table tbody td {
  padding: 16px 20px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text);
}

.benchmarks-table tbody td.num {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

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

.benchmark-gold {
  color: var(--gold-dark) !important;
  font-weight: 800 !important;
}

.ga4-callout {
  margin-top: 12px;
  font-size: var(--text-caption);
  color: var(--text-muted);
  font-style: italic;
  grid-column: 1 / -1;
}

.ga4-history-callout {
  grid-column: 1 / -1;
  margin-top: 12px;
  padding: 12px 16px;
  background: rgba(212, 136, 0, 0.08);
  border: 1px solid rgba(212, 136, 0, 0.25);
  border-left: 3px solid #d48800;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.5;
}
.ga4-history-callout strong {
  color: var(--text);
  font-weight: 700;
}

/* ── Data freshness footer (page bottom) ─────────────────────────────────── */

.data-freshness-footer {
  margin-top: 32px;
  padding: 14px 18px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}
.data-freshness-footer:empty { display: none; }

.freshness-footer-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.7;
}

.freshness-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.freshness-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: default;
  transition: border-color 0.15s ease;
}
.freshness-pill:hover {
  border-color: var(--border);
}

.freshness-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.freshness-pill-dot.freshness-dot--fresh   { background: #1d8f4a; }
.freshness-pill-dot.freshness-dot--current { background: #d48800; }
.freshness-pill-dot.freshness-dot--stale   { background: #c0392b; }

.freshness-pill-label {
  font-weight: 600;
  color: var(--text);
}

.freshness-pill-time {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.benchmarks-callout {
  margin-top: 20px;
  font-size: var(--text-caption);
  color: var(--text-muted);
  font-style: italic;
}

/* ── Higher-Ed News (under Industry Benchmarks) ───────────────────────────── */

.news-section {
  margin-top: 24px;
}

.news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-xs);
}

.news-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.news-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.news-refresh-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: 999px;
}

.news-subtitle {
  font-size: var(--text-caption);
  color: var(--text-muted);
  margin: 0 0 20px;
  line-height: 1.5;
}

.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.news-item {
  padding: 18px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.news-item:first-child {
  padding-top: 4px;
}

.news-item:last-child {
  border-bottom: none;
  padding-bottom: 4px;
}

.news-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.news-source {
  color: var(--brand);
  font-weight: 700;
  letter-spacing: 0.2px;
}

.news-dot {
  color: var(--text-muted);
  opacity: 0.5;
}

.news-item-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  line-height: 1.4;
  margin-bottom: 6px;
  transition: color 0.15s ease;
}

.news-item-title:hover,
.news-item-title:focus {
  color: var(--brand);
  text-decoration: underline;
}

.news-item-summary {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0 0 8px;
}

.news-item-rationale {
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
  margin: 0 0 10px;
  padding: 10px 14px;
  background: rgba(0, 133, 152, 0.04);
  border-left: 3px solid var(--brand);
  border-radius: 4px;
}

.news-rationale-label {
  display: inline;
  font-weight: 700;
  color: var(--brand);
  margin-right: 6px;
  text-transform: none;
  letter-spacing: 0;
}

.news-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.news-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  padding: 3px 9px;
  border-radius: 999px;
}

.news-callout {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-caption);
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.5;
}

/* ── Channel tabs ────────────────────────────────────────────────────────── */

.channel-tabs {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 4px;
  gap: 2px;
  align-self: flex-start;
  box-shadow: var(--shadow-xs);
  margin-bottom: 4px;
}

.channel-tab {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition:
    color var(--duration-base) var(--ease-out),
    background var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out);
  will-change: background, color;
}

.channel-tab:hover {
  color: var(--text-secondary);
  background: var(--surface-3);
  transform: none;
  box-shadow: none;
  opacity: 1;
}

/* Active state: all channels use Mavroon */
.channel-tab.active {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-xs);
  transform: none;
  opacity: 1;
}

.channel-tab.active:hover {
  background: var(--brand-dark);
}

/* Channel-specific active colors */
.channel-tab[data-channel="google_ads"].active {
  background: var(--google);
}
.channel-tab[data-channel="google_ads"].active:hover {
  background: #155080;
}
.channel-tab[data-channel="dsp"].active {
  background: var(--dsp);
  color: var(--text);
}
.channel-tab[data-channel="dsp"].active:hover {
  background: var(--dsp-dark);
  color: #fff;
}

/* ── Campaign type filter ────────────────────────────────────────────────── */

.campaign-type-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0;
}

.campaign-type-filter select {
  padding: 7px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  width: auto;
}

/* ── Summary cards ───────────────────────────────────────────────────────── */

.totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 24px 26px 20px;
  transition:
    transform var(--duration-slow) var(--ease-out),
    box-shadow var(--duration-slow) var(--ease-out);
  will-change: transform;
  box-shadow: var(--shadow-xs);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Card top-border color variants */
.card-overall {
  border-top-color: var(--brand);
}

.card-google {
  border-top-color: var(--google);
}

/* card-meta-ads - Meta Ads uses Mavroon */
.card-meta-ads {
  border-top-color: var(--meta);
}

.card-dsp {
  border-top-color: var(--dsp);
}

/* Card content hierarchy */
.card-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-bottom: 12px;
}

.card-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Renamed from .card-meta - details row below the big number */
.card-details {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.card-details span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Secondary KPI rows - shown in single-channel expanded view */
.card-row {
  display: flex;
  gap: 12px 0;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  font-variant-numeric: tabular-nums;
}

.card-row span {
  flex: 1 1 auto;
  min-width: 90px;
  padding: 4px 0;
  color: var(--text-secondary);
}

.card-row span strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1px;
  letter-spacing: -0.01em;
}

/* ── GA4 sections ───────────────────────────────────────────────────────── */

.ga4-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ga4-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

/* GA4 Campaign Tabs */
.ga4-tabs {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  align-self: flex-start;
  box-shadow: var(--shadow-xs);
  flex-wrap: wrap;
}

.ga4-tab {
  background: transparent;
  color: var(--text-muted);
  padding: 7px 16px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition:
    color var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out);
}

.ga4-tab:hover {
  color: var(--text-secondary);
  background: var(--surface-3);
  transform: none;
  box-shadow: none;
  opacity: 1;
}

.ga4-tab.active {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 177, 202, 0.20);
}

/* GA4 Campaign Panel */
.ga4-campaign-panel {
  min-height: 120px;
}

.ga4-panel-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow-xs);
}
.ga4-panel-inner.ga4-grouped {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 18px;
}
.ga4-group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow-xs);
}
.ga4-group-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--brand-dim);
}

.ga4-primary-multi {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.ga4-primary-multi .ga4-primary-item {
  padding: 12px 0;
}
.ga4-primary-metric {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.ga4-primary-value {
  font-size: 40px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.ga4-primary-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 500;
}

.ga4-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.ga4-metric-card {
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.ga4-metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.ga4-metric-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* ── Drill-down sections ────────────────────────────────────────────────── */

.drilldown-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

/* Sub-tabs */
.drilldown-tabs {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  align-self: flex-start;
  box-shadow: var(--shadow-xs);
}

.drilldown-tab {
  background: transparent;
  color: var(--text-muted);
  padding: 7px 16px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition:
    color var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out);
}

.drilldown-tab:hover {
  color: var(--text-secondary);
  background: var(--surface-3);
  transform: none;
  box-shadow: none;
  opacity: 1;
}

.drilldown-tab.active {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 177, 202, 0.20);
}

/* Panels */
.drilldown-panel {
  display: none;
}

.drilldown-panel.active {
  display: block;
}

.drilldown-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* Fixed-height scrollable table */
.table-wrap-fixed {
  max-height: min(480px, 55vh);
  overflow-y: auto;
}

/* Table header with pagination */
.table-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Inline campaign filter inside a table header (Location / DMA tables) */
.location-filter {
  margin: 0;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition:
    color var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out);
}

.page-btn:hover {
  background: var(--surface-3);
  color: var(--text-secondary);
  transform: none;
  box-shadow: none;
}

.page-btn.active {
  background: var(--brand-dim);
  color: var(--brand);
  border-color: var(--brand-border);
  font-weight: 700;
}

.page-info {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
  .drilldown-tabs { width: 100%; display: flex; }
  .drilldown-tab { flex: 1; text-align: center; font-size: 11px; padding: 7px 8px; }
  .table-wrap-fixed { max-height: 360px; }
}

/* ── Campaign table ──────────────────────────────────────────────────────── */

.table-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.table-header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

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

.table-subtitle {
  padding: 10px 24px 0;
  margin: 0;
  line-height: 1.4;
}
.table-subtitle:empty {
  display: none;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

/* Campaign/drilldown tables need min-width for horizontal scroll */
#campaigns-table,
#location-table,
#keyword-table,
#search-term-table,
#impression-share-table {
  min-width: 900px;
}

/* Constrain campaign name column */
td:first-child,
th:first-child {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 16px;
}

/* Table head */
thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

th {
  text-align: left;
  padding: 13px 12px;
  background: var(--surface-4);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  cursor: default;
  user-select: none;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  transition: color var(--duration-fast) var(--ease-in-out);
}

th:first-child { padding-left: 24px; }
th:last-child  { padding-right: 24px; }

/* Only sortable headers look clickable (gate R7: 129 non-sortable headers had a pointer). */
th[data-sort] { cursor: pointer; }
th[data-sort]:hover { color: var(--text-secondary); }

th.sort-asc::after  { content: " \2191"; color: var(--brand); }
th.sort-desc::after { content: " \2193"; color: var(--brand); }

th.num,
td.num { text-align: right; }

/* Table body */
tbody tr {
  border-top: 1px solid var(--border-subtle);
  transition: background var(--duration-fast) var(--ease-in-out);
}

/* Alternating row backgrounds */
tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.035);
}

tbody tr:hover {
  background: var(--brand-dim);
}

td {
  padding: 11px 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-size: 13px;
}

td:first-child {
  color: var(--text);
  font-weight: 500;
  padding-left: 24px;
}

td:last-child {
  padding-right: 24px;
}

td.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 56px 24px;
  white-space: normal;
  font-size: 13px;
}

/* ── Source badges ───────────────────────────────────────────────────────── */

.source-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.source-badge.google {
  background: var(--google-dim);
  color: var(--google);
  border: 1px solid var(--google-border);
}

.source-badge.meta-ads {
  background: var(--meta-dim);
  color: var(--meta);
  border: 1px solid var(--meta-border);
}

.source-badge.dsp {
  background: var(--dsp-dim);
  color: var(--dsp-dark);
  border: 1px solid var(--dsp-border);
}

/* ── Impression Share diagnosis pills ───────────────────────────────── */
.is-diagnosis {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.is-diag-optimized  { background: rgba(29, 143, 74, 0.12); color: #1d8f4a; }
.is-diag-healthy    { background: rgba(29, 143, 74, 0.12); color: #1d8f4a; }
.is-diag-budget     { background: rgba(212, 147, 13, 0.12); color: #c07d00; }
.is-diag-bid        { background: rgba(91, 109, 205, 0.12); color: #4a5cb8; }
.is-diag-quality    { background: rgba(192, 57, 43, 0.12); color: var(--danger); }
.is-diag-mixed      { background: rgba(212, 147, 13, 0.12); color: #c07d00; }
.is-diag-delivery   { background: rgba(192, 57, 43, 0.12); color: var(--danger); }
.is-diag-na         { background: var(--surface-3); color: var(--text-muted); }

/* ── Type badges ─────────────────────────────────────────────────────────── */

.type-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: var(--surface-3);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* Per-type colors - OKLCH brand-mental-model hues, locked envelope so only hue varies.
   Brain insight: 2026-05-11-typed-record-badges.md */
.type-badge.tb-pmax       { background: oklch(70% 0.16 290 / 0.18); color: oklch(45% 0.18 290); border-color: oklch(70% 0.16 290 / 0.35); }
.type-badge.tb-search     { background: oklch(70% 0.16 250 / 0.18); color: oklch(45% 0.18 250); border-color: oklch(70% 0.16 250 / 0.35); }
.type-badge.tb-video      { background: oklch(70% 0.16 25  / 0.18); color: oklch(45% 0.18 25);  border-color: oklch(70% 0.16 25  / 0.35); }
.type-badge.tb-display    { background: oklch(70% 0.16 150 / 0.18); color: oklch(45% 0.18 150); border-color: oklch(70% 0.16 150 / 0.35); }
.type-badge.tb-demand-gen { background: oklch(70% 0.16 195 / 0.18); color: oklch(45% 0.18 195); border-color: oklch(70% 0.16 195 / 0.35); }
.type-badge.tb-shopping   { background: oklch(70% 0.16 75  / 0.18); color: oklch(45% 0.18 75);  border-color: oklch(70% 0.16 75  / 0.35); }
.type-badge.tb-app        { background: oklch(70% 0.16 210 / 0.18); color: oklch(45% 0.18 210); border-color: oklch(70% 0.16 210 / 0.35); }
.type-badge.tb-smart      { background: oklch(70% 0.06 230 / 0.18); color: oklch(45% 0.06 230); border-color: oklch(70% 0.06 230 / 0.35); }
.type-badge.tb-meta-leads { background: oklch(70% 0.16 230 / 0.18); color: oklch(45% 0.18 230); border-color: oklch(70% 0.16 230 / 0.35); }
.type-badge.tb-ctv        { background: oklch(70% 0.16 320 / 0.18); color: oklch(45% 0.18 320); border-color: oklch(70% 0.16 320 / 0.35); }

/* ── Meta creative thumbnail column ──────────────────────────────────────── */

.creative-cell {
  width: 84px;
  padding: 6px;
}
.creative-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  display: block;
}
.creative-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
}
.meta-drilldown-panel {
  display: none;
}
.meta-drilldown-panel.active {
  display: block;
}

/* ── Scrollbar (webkit) ──────────────────────────────────────────────────── */

.table-wrap::-webkit-scrollbar {
  height: 5px;
}

.table-wrap::-webkit-scrollbar-track {
  background: var(--surface-2);
}

.table-wrap::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 10px;
}

.table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--text-disabled);
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Responsive: tablet ──────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .dashboard > *:not(.header) {
    padding-left: 24px;
    padding-right: 24px;
  }

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

/* ── Responsive: mobile ──────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .header {
    padding: 12px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    min-height: auto;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .dashboard > *:not(.header) {
    padding-left: 16px;
    padding-right: 16px;
  }

  .dashboard {
    gap: 14px;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .preset-group {
    width: 100%;
    /* 8 presets (7 short + "Prior CTD") can exceed the viewport at narrow
       widths even with flex:1 below, since white-space:nowrap on .preset
       gives each button a content-width floor flex can't shrink past.
       Same overflow-scroll treatment as .view-nav just below, so it
       degrades to a horizontal scroll instead of clipping/overlapping. */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .preset {
    flex: 1;
    text-align: center;
    padding: 7px 8px;
  }

  .view-nav {
    width: 100%;
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .view-nav-btn {
    flex-shrink: 0;
    text-align: center;
    padding: 8px 14px;
    font-size: 12px;
  }

  .channel-tabs {
    width: 100%;
    display: flex;
    align-self: auto;
  }

  .channel-tab {
    flex: 1;
    text-align: center;
    padding: 8px 10px;
    font-size: 12px;
    letter-spacing: 0;
  }

  .exec-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .exec-channels {
    grid-template-columns: 1fr;
  }

  .exec-hero .card-value {
    font-size: var(--text-primary-kpi);
  }

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

  .card-value {
    font-size: 26px;
  }

  .card {
    padding: 20px 20px 18px;
  }

  th:first-child,
  td:first-child {
    padding-left: 16px;
  }

  th:last-child,
  td:last-child {
    padding-right: 16px;
  }
}

/* ── Responsive: small mobile ────────────────────────────────────────────── */

@media (max-width: 480px) {
  .custom-range {
    flex-wrap: wrap;
    gap: 6px;
  }

  .custom-range input {
    flex: 1;
  }
}

.loc-cohort {
  padding: 8px 0;
}
.loc-cohort-title {
  padding: 14px 24px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  margin: 0;
}
.loc-cohort + .loc-cohort {
  border-top: 1px solid var(--border-subtle);
}

.loc-table tr.loc-row-subtotal {
  background: rgba(0, 133, 152, 0.03);
  font-weight: 600;
}
.loc-table tr.loc-row-subtotal td {
  border-top: 1px solid var(--border-subtle);
}

.yoy-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 100px;
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  vertical-align: middle;
}
.yoy-pill.yoy-up { background: rgba(29, 143, 74, 0.12); color: #1d8f4a; }
.yoy-pill.yoy-down { background: rgba(192, 57, 43, 0.12); color: #c0392b; }
.yoy-pill.yoy-flat { background: var(--surface-3); color: var(--text-muted); }

/* ── Per-campaign drilldown modal ─────────────────────────────────── */
.campaign-modal { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: stretch; justify-content: flex-end; }
.campaign-modal.hidden { display: none; }
.campaign-modal-overlay { position: absolute; inset: 0; background: rgba(15, 28, 39, 0.55); backdrop-filter: blur(4px); }
.campaign-modal-panel {
  position: relative; background: var(--surface, #fff); width: min(1080px, 95vw); max-width: 100%; height: 100vh; overflow-y: auto;
  box-shadow: var(--shadow-lift, 0 10px 36px rgba(0,0,0,0.18)); display: flex; flex-direction: column;
}
.campaign-modal-header {
  position: sticky; top: 0; background: var(--surface, #fff); border-bottom: 1px solid var(--border, #e1e3ea);
  padding: 18px 28px; display: flex; align-items: center; justify-content: space-between; z-index: 5;
}
.campaign-modal-eyebrow { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted, #7a7a92); font-weight: 700; }
.campaign-modal-title { font-size: 22px; font-weight: 700; margin: 4px 0 0; color: var(--text, #1a1a24); }
.campaign-modal-close {
  background: transparent; border: 1px solid var(--border, #e1e3ea); width: 36px; height: 36px; border-radius: 8px; font-size: 22px; line-height: 1;
  cursor: pointer; color: var(--text-secondary, #4a4a5e);
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.campaign-modal-close:hover { background: var(--surface-3, #f0f1f4); }
.campaign-modal-body { padding: 24px 28px 48px; }

.cm-section { margin-bottom: 32px; }
.cm-section-header {
  background: var(--brand, #00b1ca); color: #fff; padding: 10px 16px; border-radius: 8px 8px 0 0;
  display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 14px;
}
.cm-section-header .cm-section-sub { font-weight: 500; opacity: 0.85; font-size: 12px; }
.cm-section-body { background: var(--surface-2, #f8f8fa); border: 1px solid var(--border, #e1e3ea); border-top: none; border-radius: 0 0 8px 8px; padding: 20px; }

.cm-kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 16px; margin-bottom: 20px; }
.cm-kpi { background: var(--surface, #fff); padding: 12px 14px; border-radius: 8px; border: 1px solid var(--border-subtle, #eaecf0); }
.cm-kpi-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.cm-kpi-value { font-size: 22px; font-weight: 700; color: var(--text); margin-top: 4px; }

.cm-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.cm-card { background: var(--surface, #fff); border: 1px solid var(--border-subtle, #eaecf0); border-radius: 8px; padding: 16px; }
.cm-card-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 12px; }

.cm-chart { width: 100%; height: 220px; display: block; }
.cm-pie { width: 100%; height: 240px; display: block; }
.cm-pie-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12px; }
.cm-pie-legend-item { display: flex; align-items: center; gap: 6px; }
.cm-pie-legend-swatch { width: 10px; height: 10px; border-radius: 2px; }

.cm-bar-row { display: grid; grid-template-columns: 110px 1fr 60px; align-items: center; gap: 10px; padding: 4px 0; font-size: 12px; }
.cm-bar-track { background: var(--surface-3, #f0f1f4); height: 18px; border-radius: 3px; position: relative; overflow: hidden; }
.cm-bar-fill { background: var(--brand, #00b1ca); height: 100%; }
.cm-bar-val { text-align: right; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

.cm-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.cm-table th { text-align: left; padding: 8px; background: var(--surface-3, #f0f1f4); font-weight: 700; color: var(--text); border-bottom: 1px solid var(--border); }
.cm-table td { padding: 8px; border-bottom: 1px solid var(--border-subtle, #eaecf0); }
.cm-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

.cm-ads-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.cm-ad-card { background: var(--surface, #fff); border: 1px solid var(--border-subtle, #eaecf0); border-radius: 8px; overflow: hidden; }
.cm-ad-thumb { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-3, #f0f1f4); display: block; }
.cm-ad-meta { padding: 8px 10px; font-size: 11px; color: var(--text-secondary); }
.cm-ad-name { color: var(--text); font-weight: 600; font-size: 12px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

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

.cm-table-note { margin-bottom: 8px; line-height: 1.4; }

.campaign-row:hover { background: var(--surface-3, #f0f1f4); }

/* Scrollable cm-table for placements + ads */
.cm-table-scroll { max-height: 360px; overflow-y: auto; border: 1px solid var(--border-subtle, #eaecf0); border-radius: 6px; }
.cm-table-scroll--ads { max-height: 480px; }
.cm-table-scroll .cm-table thead th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-3, #f0f1f4);
  border-bottom: 1px solid var(--border, #e1e3ea);
}
.cm-table tr:hover { background: var(--surface-3, #f0f1f4); cursor: default; }

.cm-ads-table .cm-ads-thumb-col { width: 60px; }
.cm-ads-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; background: var(--surface-3, #f0f1f4); display: block; }
.cm-ads-thumb--placeholder { display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 14px; }
.cm-ads-name { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Chart-hit rects (consistent with the existing chart hover) */
.cm-chart .chart-hit { cursor: crosshair; }
.cm-chart .chart-hit:hover { fill: rgba(0, 177, 202, 0.04); }

/* ── Per-campaign tooltip (instant, JS-driven) ─────────────────── */
.cm-tooltip {
  position: fixed;
  z-index: 10000;
  background: #1a1a24;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
  white-space: pre-line;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transition: opacity 80ms ease;
  max-width: 280px;
}
.cm-tooltip.is-visible { opacity: 1; }
.cm-tooltip-title { font-weight: 700; margin-bottom: 4px; color: #fff; }
.cm-tooltip-row { color: rgba(255,255,255,0.85); }
.cm-tooltip-row strong { color: #fff; margin-left: 6px; }

[data-cm-tip] { cursor: help; }

/* Partial-day notice - shown when selected range ends on today's PT date */
.partial-day-notice {
  display: flex; align-items: center; gap: 10px;
  background: rgba(0, 177, 202, 0.07);
  border: 1px solid rgba(0, 177, 202, 0.18);
  color: var(--text, #1a1a24);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  margin-top: 10px;
}
.partial-day-notice.hidden { display: none; }
.partial-day-notice strong { color: var(--brand, #00b1ca); font-weight: 700; }
.partial-day-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--brand, #00b1ca); color: #fff; font-weight: 700; font-size: 11px;
  flex-shrink: 0;
}

/* Load-error notice - same box as .partial-day-notice above (shown by
   showLoadErrorBanner() in app.js), recolored with the existing --danger
   token (already used elsewhere) so a
   failed load reads as a genuine problem, not routine info. */
.load-error-notice {
  background: var(--danger-dim, rgba(192, 57, 43, 0.08));
  border-color: rgba(192, 57, 43, 0.28);
}
.load-error-notice strong { color: var(--danger, #c0392b); }
.load-error-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--danger, #c0392b); color: #fff; font-weight: 700; font-size: 11px;
  flex-shrink: 0;
}

/* ── Campaigns table: filter dropdown + clickable-row chevron (rollout) ── */
.table-header-right { display: flex; align-items: center; gap: 12px; }

.col-action { width: 46px; text-align: right; padding-right: 14px !important; }
.row-chevron {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-dim);
  color: var(--brand);
  transition: background .14s ease, color .14s ease, transform .14s ease, box-shadow .14s ease;
}
.campaign-row.is-clickable:hover { background: var(--brand-dim); }
.campaign-row.is-clickable:hover .row-chevron {
  background: var(--brand); color: #fff;
  transform: translateX(2px);
  box-shadow: 0 2px 6px rgba(0, 177, 202, 0.30);
}

/* Channel cards - Impressions + Clicks as the prominent pair, spend small below */
.card-metric-row {
  display: flex;
  align-items: stretch;
  gap: 22px;
  margin-bottom: 10px;
}
.card-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.card-metric + .card-metric {
  padding-left: 22px;
  border-left: 1px solid rgba(0, 0, 0, 0.14);
}
.card-metric-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.card-metric-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* ── Donations tab + web-donation KPIs ───────────────────── */
.exec-web-kpis { grid-template-columns: repeat(3, 1fr); margin-top: 14px; }
.exec-web-kpis:empty { display: none; }
.exec-web-kpis .exec-web-note { grid-column: 1 / -1; margin: 0; font-size: var(--text-caption); color: var(--text-muted); }
.exec-channel-inkind { border-style: dashed; }
.don-headline { grid-template-columns: repeat(2, 1fr); }
.don-web-kpis { grid-template-columns: repeat(4, 1fr); }
.don-headline .card-value, .don-web-kpis .card-value { font-size: var(--text-secondary-kpi); font-weight: 700; }
#donations-root > * + * { margin-top: 20px; }
#donations-root > .don-section-title { margin: 36px 0 -4px; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.don-trend { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px 16px; box-shadow: var(--shadow-xs); }
.don-trend .chart-wrap { height: 260px; }
/* Buckets table: readable names, campaigns as a quiet wrapped list */
#don-bucket-table td.don-name { white-space: nowrap; min-width: 220px; }
#don-bucket-table td.don-campaigns { white-space: normal; min-width: 300px; max-width: 560px; color: var(--text-muted); font-size: 13px; padding-top: 12px; padding-bottom: 12px; }
.don-camps { display: flex; flex-wrap: wrap; gap: 2px 14px; line-height: 1.45; }
.don-camp { display: inline-flex; align-items: center; gap: 5px; }
.don-more { color: var(--text-muted); font-style: normal; opacity: .75; }
/* Unmapped marker: a small quiet dot, not a red pill */
.don-flag { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); }
.don-total td { font-weight: 700; border-top: 2px solid var(--border); }
.don-unmapped { font-size: var(--text-caption); color: var(--text-muted); padding: 0 4px; }
.don-unmapped summary { cursor: pointer; list-style: none; }
.don-unmapped summary::before { content: "+ "; }
.don-unmapped[open] summary::before { content: "- "; }
.don-unmapped .benchmarks-callout { margin-top: 8px; }
.don-inapp .totals { grid-template-columns: repeat(2, 1fr); padding: 20px 24px 4px; }
.don-inapp .card { box-shadow: none; }
.don-inapp .card-details { flex-direction: column; gap: 2px; }
.don-panel-note { margin: 0; padding: 4px 24px 18px; font-size: var(--text-caption); color: var(--text-muted); }
#donations-root > .don-panel-note { padding: 0 4px; }
.don-web-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.don-web-grid > * + * { margin-top: 0; }
.don-web-table td:first-child { white-space: normal; word-break: break-word; }
.don-web-table td, .don-web-table th { padding-left: 10px; padding-right: 10px; }
.don-notes { padding: 4px 4px 8px; }
.don-notes-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.10em; color: var(--text-muted); margin: 0 0 8px; }
.don-notelist { margin: 0; padding-left: 18px; font-style: normal; line-height: 1.6; }
@media (max-width: 1100px) { .don-web-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .exec-web-kpis, .don-headline, .don-web-kpis { grid-template-columns: 1fr 1fr; }
  .don-headline { grid-template-columns: 1fr; }
  .don-inapp .totals { grid-template-columns: 1fr; }
  /* Buckets table stacks: name + figures on one line, campaigns underneath */
  #don-bucket-table thead { display: none; }
  #don-bucket-table, #don-bucket-table tbody, #don-bucket-table tfoot { display: block; }
  #don-bucket-table tr { display: grid; grid-template-columns: 1fr auto auto; column-gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
  #don-bucket-table td { padding: 0; white-space: normal; border: 0; }
  #don-bucket-table td:first-child { padding-left: 0; }
  #don-bucket-table td:last-child { padding-right: 0; }
  #don-bucket-table td.don-name { min-width: 0; white-space: normal; overflow-wrap: anywhere; font-weight: 600; overflow: visible; text-overflow: clip; max-width: none; }
  #don-bucket-table td.don-gifts::after { content: " " attr(data-unit); color: var(--text-muted); font-size: 11px; }
  #don-bucket-table td.don-campaigns { grid-column: 1 / -1; min-width: 0; max-width: none; padding: 6px 0 0; font-size: 12px; }
  #don-bucket-table tfoot td:empty { display: none; }
  #don-bucket-table tfoot tr { border-bottom: 0; border-top: 2px solid var(--border); }
  #don-bucket-table .don-total td { border-top: 0; }
}

/* Paid vs all donations */
.don-pva-kpis { grid-template-columns: repeat(2, 1fr); padding: 20px 24px 8px; }
.don-pva .card { box-shadow: none; }
.don-pva-kpis .card-value { font-size: var(--text-secondary-kpi); font-weight: 700; }
.don-pva .table-wrap { margin: 8px 0 0; }
.don-pva-chart { padding: 16px 24px 0; }
.don-pva-chart .chart-wrap { height: 220px; }
@media (max-width: 640px) { .don-pva-kpis { grid-template-columns: 1fr; padding: 16px 16px 4px; } .don-pva-chart { padding: 16px 16px 0; } }

/* ── Donations source-bucket drilldown (reuses .campaign-modal chrome) ── */
#don-bucket-table tbody tr.don-clickable { cursor: pointer; }
#don-bucket-table tbody tr.don-clickable:hover td,
#don-bucket-table tbody tr.don-clickable:focus-visible td { background: var(--surface-3, #f0f1f4); }
#don-bucket-table tbody tr.don-clickable:focus-visible { outline: 2px solid var(--brand, #00b1ca); outline-offset: -2px; }
.don-bucket-panel { max-height: 100vh; max-height: 100dvh; overflow-y: auto; overscroll-behavior: contain; }
.don-bucket-panel .campaign-modal-body { padding-bottom: 64px; }
.don-bucket-kpis { margin-bottom: 20px; }
.don-bucket-trend { margin-bottom: 24px; }
.don-bucket-trend-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.don-bucket-toggle { display: inline-flex; border: 1px solid var(--border, #e1e3ea); border-radius: 8px; overflow: hidden; }
.don-bucket-toggle button { background: transparent; border: 0; padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text-secondary, #4a4a5e); }
.don-bucket-toggle button.active { background: var(--brand, #00b1ca); color: #fff; }
.don-bucket-modal .table-wrap { overflow-x: auto; }
@media (max-width: 640px) {
  .don-bucket-panel { width: 100vw; }
  .don-bucket-panel .campaign-modal-header { padding: 14px 16px; }
  .don-bucket-panel .campaign-modal-body { padding: 16px 16px 64px; }
  .don-bucket-panel .campaign-modal-title { font-size: 18px; overflow-wrap: anywhere; }
  #don-bucket-code-table { width: 100%; min-width: 0; table-layout: auto; }
  #don-bucket-code-table th, #don-bucket-code-table td { padding: 9px 6px; white-space: normal; font-size: 12px; }
  #don-bucket-code-table th.num, #don-bucket-code-table td.num { white-space: nowrap; width: 1%; }
  #don-bucket-code-table td.don-name { white-space: normal; overflow-wrap: anywhere; min-width: 0; max-width: none; overflow: visible; text-overflow: clip; }
  .don-bucket-modal .table-wrap { overflow-x: visible; }
}
