/* ===========================
   tokens.css — Single Source of Truth for all CSS custom properties.
   All design system variables are defined here ONCE.
   shell.css and tracker.css must NOT redefine :root variables.
   Dark mode overrides live in .dark-theme (shell.css).
   =========================== */

@layer reset, tokens, base, components, utilities, overrides;

@layer tokens {
  :root {
    /* Color palette — Light mode: cool professional finance/tech */
    --bg: #f8fafc;
    --panel: #ffffff;
    --panel-soft: #f0f2f5;
    --line: #e2e5ea;
    --line-strong: #c8cdd6;
    --border: var(--line);
    --border-subtle: #e8eaed;
    --border-hover: #9aa0ad;
    --text: #111827;
    --muted: #64748b;

    /* Brand / primary — vibrant blue (authority) */
    --primary: #1e40af;
    --primary-strong: #1e3a8a;
    --brand: var(--primary);
    --link: #1e40af;
    --link-hover: #1e3a8a;
    --on-primary: #ffffff;
    --focus: rgba(30, 64, 175, .3);

    /* Accent — amber */
    --accent: #a16207;
    --accent-soft: rgba(161, 98, 7, 0.12);
    --accent-strong: #854d0e;

    /* Semantic colors */
    --ok: #166534;
    --good: var(--ok);
    --warn: #b45309;
    --danger: #991b1b;
    --bad: var(--danger);
    --pos: var(--ok);
    --neg: var(--danger);
    --surface: var(--panel);
    --surface-2: #f0f2f5;
    --indigo: #6366f1;

    /* Status badges */
    --status-fresh-bg: rgba(22, 101, 52, 0.08);
    --status-fresh-border: rgba(22, 101, 52, 0.25);
    --status-fresh-text: #14532d;
    --status-partial-bg: rgba(180, 83, 9, 0.08);
    --status-partial-border: rgba(180, 83, 9, 0.25);
    --status-partial-text: #78350f;
    --status-stale-bg: rgba(153, 27, 27, 0.08);
    --status-stale-border: rgba(153, 27, 27, 0.25);
    --status-stale-text: #7f1d1d;

    /* Semantic soft colors */
    --good-soft-bg: rgba(22, 101, 52, 0.08);
    --good-soft-border: rgba(22, 101, 52, 0.2);
    --good-soft-text: #14532d;
    --warn-soft-bg: rgba(180, 83, 9, 0.08);
    --warn-soft-border: rgba(180, 83, 9, 0.2);
    --warn-soft-text: #78350f;
    --warn-soft-strong: #b45309;
    --warn-soft-muted: #92400e;
    --info-soft-bg: rgba(30, 64, 175, 0.06);
    --info-soft-border: rgba(30, 64, 175, 0.2);
    --info-soft-text: #1e40af;
    --offer-bg: rgba(22, 101, 52, 0.06);
    --offer-hover: rgba(22, 101, 52, 0.12);

    /* Theme chip */
    --theme-chip-bg: rgba(30, 64, 175, 0.08);
    --theme-chip-border: rgba(30, 64, 175, 0.2);
    --theme-chip-text: #1e40af;

    /* Topbar / interactive */
    --topbar-bg: rgba(15, 36, 64, 0.98);
    --topbar-text: rgba(240, 242, 245, 0.75);
    --topbar-text-hover: #ffffff;
    --topbar-active: var(--accent);
    --hover-soft: rgba(30, 64, 175, 0.04);
    --row-hover-tint: rgba(30, 64, 175, 0.04);

    /* Chart tokens */
    --chart-grid: #e2e5ea;
    --chart-grid-soft: #eef0f3;
    --chart-axis: #6b7280;
    --chart-label: #4b5563;
    --chart-crosshair: #9aa0ad;
    --chart-marker-stroke: #ffffff;

    /* Radius */
    --radius-card: 12px;
    --radius-control: 8px;
    --radius-sm: 6px;
    --radius-pill: 999px;

    /* Shadow — crisp, precise, professional */
    --shadow-xs: 0 1px 2px rgba(17, 24, 39, 0.05);
    --shadow-sm: 0 1px 3px rgba(17, 24, 39, 0.08), 0 4px 12px rgba(17, 24, 39, 0.04);
    --shadow-md: 0 4px 8px -2px rgba(17, 24, 39, 0.10), 0 2px 4px -1px rgba(17, 24, 39, 0.06);
    --shadow-lg: 0 12px 24px -6px rgba(17, 24, 39, 0.14), 0 4px 8px -2px rgba(17, 24, 39, 0.08);

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* Typography */
    --font-display: "Instrument Serif", "Georgia", "Times New Roman", serif;
    --font-body: "Inter", "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
    --font-mono: "JetBrains Mono", "Consolas", "Monaco", monospace;

    /* Font weights */
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Type scale */
    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.875rem;
    --text-md: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
  }
}

@layer reset {

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

@layer base {

  html,
  body {
    margin: 0;
    padding: 0;
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.5;
  }

  html {
    font-size: 16px;
    scroll-behavior: smooth;
  }

  body {
    background:
      radial-gradient(ellipse 900px 400px at 5% -10%, rgba(161, 98, 7, 0.06) 0%, transparent 65%),
      radial-gradient(ellipse 700px 300px at 95% 110%, rgba(30, 64, 175, 0.05) 0%, transparent 65%),
      var(--bg);
  }

  a {
    color: var(--primary);
    text-decoration: none;
  }

  a:hover {
    text-decoration: underline;
  }

  button,
  [role="button"],
  summary,
  select {
    cursor: pointer;
  }

  button,
  input,
  select,
  textarea {
    font: inherit;
  }

  :focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
  }

  input:focus,
  select:focus,
  textarea:focus {
    outline: 2px solid var(--focus);
    outline-offset: 1px;
    border-color: var(--primary);
  }

  @media (prefers-reduced-motion: reduce) {
    * {
      animation: none !important;
      transition: none !important;
      scroll-behavior: auto !important;
    }
  }
}

@layer components {
/* ===================================================================
   shell.css — Layout, typography, and shell-page components.
   All CSS custom properties (tokens) are defined in tokens.css.
   Dark-mode overrides for shell pages live in .dark-theme below.
   =================================================================== */

img, picture, video {
  max-width: 100%;
  display: block;
}

html {
  color-scheme: light;
}

main.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .22s ease, border-color .22s ease;
}

@media (hover:hover) {
  .card:not(.topbar):hover {
    box-shadow: var(--shadow-md);
    border-color: var(--line-strong);
  }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 12px;
  padding-bottom: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
}

.brand {
  color: var(--accent);
  font-family: var(--font-body);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.01em;
  font-size: 1.25rem;
}

.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: var(--radius-control);
  background: transparent;
  color: rgba(240, 238, 233, 0.7);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: all .18s ease;
  border-bottom: 2px solid transparent;
}

.nav a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.nav a.active {
  color: #ffffff;
  border-bottom-color: var(--accent);
  background: transparent;
}

h1 {
  margin: 0 0 8px 0;
  letter-spacing: -.01em;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: clamp(1.4rem, 2.7vw, 1.9rem);
  line-height: 1.2;
}

h2 {
  margin: 0 0 8px 0;
  letter-spacing: -.01em;
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--theme-chip-border);
  background: var(--theme-chip-bg);
  color: var(--theme-chip-text);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

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

.hero-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, .9fr);
  align-items: start;
}

.hero-stack {
  display: grid;
  gap: 10px;
}

.metric-strip {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.metric-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 14px;
  background: var(--panel);
  display: grid;
  gap: 6px;
}

.metric-tile strong {
  font-size: var(--text-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
}

.metric-tile span {
  font-size: 1.08rem;
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: var(--radius-control);
  text-decoration: none;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .18s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

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

.btn-secondary {
  background: var(--panel);
  border-color: var(--line);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-xs);
}

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

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

.kpi {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-content: center;
  min-height: 112px;
  box-shadow: var(--shadow-sm);
}

.kpi strong {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}

.kpi span {
  margin: 0;
  font-size: 1.875rem;
  line-height: 1.1;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.kpi-note {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--muted);
}

.list-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.list-tools input {
  min-height: 40px;
  min-width: 230px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 8px 12px;
  font: inherit;
  color: var(--text);
  background: var(--panel);
}

.list-tools input:focus {
  border-color: var(--primary);
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-list a {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  text-decoration: none;
  color: var(--text);
  background: var(--panel);
  transition: all .18s ease;
}

.history-list a:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.history-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: var(--text-sm);
  color: var(--muted);
}

.history-month {
  padding: 0;
  overflow: hidden;
}

.history-month-summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  user-select: none;
}

.history-month-summary strong {
  font-size: var(--text-md);
  font-weight: 700;
}

.history-month-summary::-webkit-details-marker {
  display: none
}

.history-month-summary::after {
  content: "›";
  color: var(--muted);
  font-size: 1.1rem;
  transition: transform .16s ease;
  flex-shrink: 0;
}

.history-month[open] .history-month-summary::after {
  transform: rotate(90deg)
}

.history-month .history-list {
  padding: 0 16px 12px 16px;
}

.history-month .meta-line {
  padding: 0 16px 14px 16px;
  margin: 0;
}

.badge-mini {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--status-fresh-border);
  background: var(--status-fresh-bg);
  color: var(--status-fresh-text);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.badge-mini.partial {
  border-color: var(--status-partial-border);
  background: var(--status-partial-bg);
  color: var(--status-partial-text);
}

.badge-mini.stale {
  border-color: var(--status-stale-border);
  background: var(--status-stale-bg);
  color: var(--status-stale-text);
}

.meta-line {
  font-size: var(--text-sm);
  color: var(--muted);
}

.btn-sm {
  font-size: .9rem;
}

.num-strong {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.meta-compact {
  font-size: var(--text-sm);
}

.api-code-block {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  overflow-x: auto;
  font-size: var(--text-sm);
  line-height: 1.6;
}

.mt-sm {
  margin-top: 12px;
}

ul.clean {
  margin: 0;
  padding-left: 18px;
}

ul.clean li {
  margin: 6px 0
}

.cookie-banner {
  position: fixed;
  right: 24px;
  bottom: 24px;
  left: auto;
  max-width: 360px;
  z-index: 9999;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--panel);
  color: var(--text);
  padding: 20px;
  box-shadow: var(--shadow-lg);
}

.cookie-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cookie-text {
  font-size: .86rem;
  color: var(--muted);
  max-width: 760px;
}

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

.cookie-actions button {
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  min-height: 34px;
  padding: 7px 11px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.cookie-actions button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.history-card {
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
  gap: 10px;
  text-decoration: none;
  min-height: 120px;
}

.history-card:hover {
  text-decoration: none;
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.history-card-date {
  font-weight: 600;
  color: var(--text);
  font-size: var(--text-base);
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.history-card-body {
  flex: 1;
}

.history-card-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.history-card-val {
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.history-card-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
}

.history-card-btn {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
  transition: color 0.15s ease;
}

.history-card:hover .history-card-btn {
  color: var(--primary);
}

.theme-toggle-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}

.content-narrow {
  max-width: 650px;
  line-height: 1.7;
}

.content-narrow.contact {
  max-width: 500px;
  line-height: 1.6;
}

.content-muted-spaced {
  margin-bottom: 24px;
}

.callout-warning {
  background: var(--warn-soft-bg);
  border-left: 4px solid var(--warn-soft-border);
  padding: var(--space-4);
  margin: var(--space-6) 0;
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
}

.callout-warning strong {
  color: var(--warn-soft-strong);
  display: block;
  margin-bottom: 8px;
}

.callout-warning p {
  color: var(--warn-soft-muted);
  margin: 0;
  font-size: var(--text-md);
}

.btn-inline-compact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
}

.btn-inline-compact+.btn-inline-compact {
  margin-left: 8px;
}

.contact-card {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: var(--space-6);
  text-align: center;
  margin-bottom: 32px;
}

.contact-card-title {
  margin: 0 0 16px 0;
  font-weight: 600;
}

.contact-card .btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
}

.faq-item {
  margin-bottom: var(--space-3);
  padding: var(--space-3);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
}

.faq-item summary {
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}

.faq-item p {
  margin-top: 12px;
  margin-bottom: 0;
  font-size: var(--text-base);
}

.home-summary-card {
  margin-top: 24px;
}

.home-summary-title {
  font-size: 1.25rem;
  margin-bottom: 16px;
}

.home-how-card {
  margin-top: 4px;
}

.home-how-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
}

.home-how-note {
  margin: 14px 0 0 0;
}

.home-how-intro {
  margin: 0 0 16px 0;
}

.home-how-subtitle {
  margin: 20px 0 12px 0;
  font-size: 1.02rem;
}

.home-how-sections {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.home-how-section {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: var(--space-3);
  background: var(--panel-soft);
}

.home-how-section h4 {
  margin: 0 0 8px 0;
  font-size: var(--text-md);
}

.home-how-section p {
  margin: 0;
  font-size: var(--text-base);
}

.cba-page {
  display: grid;
  gap: 20px;
}

.cba-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cba-toc a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
}

.cba-toc a:hover {
  background: var(--hover-soft);
  text-decoration: none;
}

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

.cba-section h3 {
  margin: 0;
}

.cba-metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.cba-metric {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: var(--space-3);
  background: var(--panel-soft);
  display: grid;
  gap: 8px;
}

.cba-metric strong {
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.cba-metric span {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.cba-category-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.cba-category-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: var(--space-3);
  background: var(--panel-soft);
}

.cba-category-card h4 {
  margin: 0 0 6px 0;
  font-size: var(--text-md);
}

.cba-category-card p {
  margin: 0;
  font-size: var(--text-base);
}

.cba-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: auto;
  background: var(--panel);
}

.cba-table-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.cba-table-tools input,
.cba-table-tools select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel);
  color: var(--text);
  padding: 0 10px;
  font: inherit;
}

.cba-table-tools input {
  min-width: 250px;
}

.cba-table-tools select {
  min-width: 170px;
}

.cba-products-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.cba-table-caption {
  caption-side: top;
  text-align: left;
  padding: 12px;
  color: var(--muted);
  font-size: var(--text-base);
}

.cba-products-table th,
.cba-products-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  font-size: var(--text-base);
  vertical-align: top;
}

.cba-products-table th {
  background: var(--panel-soft);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

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

.cba-products-table tbody tr:hover {
  background: var(--hover-soft);
}

.cba-product-link {
  color: var(--text);
  text-decoration: none;
}

.cba-product-link:hover {
  color: var(--link);
  text-decoration: underline;
}

.cba-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}

.cba-status.con-dato {
  color: var(--status-fresh-text);
  background: var(--status-fresh-bg);
  border-color: var(--status-fresh-border);
}

.cba-status.sin-dato {
  color: var(--status-stale-text);
  background: var(--status-stale-bg);
  border-color: var(--status-stale-border);
}

.cba-chart {
  width: 100%;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 8px;
  background: var(--panel);
}

.cba-chart-empty {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.cba-helper-note {
  margin: 6px 0 0 0;
  font-size: var(--text-base);
}

/* ── Dashboard (homepage KPI panel) ── */
.dash-status-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.dash-highlight {
  background: var(--info-soft-bg);
  border: 1px solid var(--info-soft-border);
  border-left: 3px solid var(--primary);
  color: var(--info-soft-text);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-card);
  text-align: left;
  box-shadow: var(--shadow-xs);
}

.dash-highlight-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 10px 0;
  color: var(--primary);
  border-bottom: 1px solid var(--info-soft-border);
  padding-bottom: 8px;
}

.dash-highlight-list {
  margin: 0;
  padding-left: 18px;
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--text);
}

.dash-highlight-list li {
  margin-bottom: 6px;
}

.dash-highlight-list li:last-child {
  margin-bottom: 0;
}

.dash-status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  border: 1px solid var(--status-fresh-border);
  background: var(--status-fresh-bg);
  color: var(--status-fresh-text);
}

.dash-status-chip.stale {
  border-color: var(--status-stale-border);
  background: var(--status-stale-bg);
  color: var(--status-stale-text);
}

.dash-status-chip.partial {
  border-color: var(--status-partial-border);
  background: var(--status-partial-bg);
  color: var(--status-partial-text);
}

.dash-status-detail {
  font-size: var(--text-xs);
  color: var(--muted);
}

.dash-grid-main {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

.dash-grid-cba {
  display: grid;
  gap: 16px;
}

/* ── KPI Dash Cards ── */
.dash-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--line-strong);
  border-radius: var(--radius-card);
  padding: var(--space-6) 28px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  min-height: 144px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

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

/* KPI type accent colors via top border */
.kpi-primary  { border-top-color: var(--primary); }
.kpi-info     { border-top-color: var(--accent); }
.kpi-accent   { border-top-color: var(--indigo); }
.kpi-success  { border-top-color: var(--ok); }
.kpi-warn     { border-top-color: var(--warn); }
.kpi-danger   { border-top-color: var(--danger); }

/* KPI Wide Card — kept for backwards compat but no longer used as full-row span */
.dash-card-wide {
  grid-column: 1 / -1;
}

.dash-card-label {
  font-size: var(--text-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  z-index: 1;
  margin-bottom: 2px;
}

.dash-card-value {
  font-size: 2.5rem;
  line-height: 1.05;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  z-index: 1;
}

.dash-card-delta {
  font-size: var(--text-sm);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  z-index: 1;
}

.dash-card-note {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: 4px;
  z-index: 1;
  line-height: 1.4;
}

.dash-delta-up {
  color: var(--danger);
}

.dash-delta-down {
  color: var(--ok);
}

.dash-delta-neutral {
  color: var(--muted);
}

/* ── Categories table ── */
.dash-section-title {
  font-size: var(--text-base);
  font-weight: 700;
  margin: 0;
  text-align: left;
  padding: 18px 20px 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.dash-categories-card {
  overflow-x: auto;
  padding: 0;
}

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

.dash-cat-table th {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 700;
  background: var(--primary);
  padding: 10px 14px;
  text-align: left;
}

.dash-cat-table td {
  padding: 10px 14px;
  text-align: left;
  font-size: var(--text-base);
  border-bottom: 1px solid var(--line);
}

.dash-cat-table tbody tr:hover {
  background: var(--hover-soft);
}

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

/* ── Quick nav ── */
.dash-quick-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  padding: 4px 0;
}

/* ── Meta card ── */
.dash-meta-card {
  font-size: var(--text-xs);
  line-height: 1.6;
  text-align: left;
  color: var(--muted);
}

.dash-meta-card p {
  margin: 0 0 8px 0;
}

.dash-meta-card p:last-child {
  margin-bottom: 0;
}

.legal-links {
  text-align: center;
  border: none;
  background: transparent;
  box-shadow: none;
}

.legal-links a {
  color: var(--muted);
  margin: 0 8px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  main.shell {
    padding: 16px
  }

  .hero-grid {
    grid-template-columns: 1fr
  }

  .grid-2 {
    grid-template-columns: 1fr
  }

  .card {
    padding: 18px
  }

  .cba-products-table {
    min-width: 640px;
  }

  .cba-table-tools input {
    min-width: 220px;
  }

  .dash-grid-main {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  }

  .dash-card-value {
    font-size: 2rem;
  }
}

@media (max-width: 620px) {
  h1 {
    font-size: 1.28rem
  }

  .nav a {
    flex: 1 1 calc(50% - 6px);
    justify-content: center
  }

  .list-tools input {
    min-width: 100%
  }

  .cookie-banner {
    left: 8px;
    right: 8px;
    bottom: 8px
  }

  .home-how-section {
    padding: var(--space-3);
  }

  .cba-chart {
    min-height: 300px;
  }

  .cba-table-tools {
    align-items: stretch;
  }

  .cba-table-tools input,
  .cba-table-tools select,
  .cba-table-tools button {
    width: 100%;
  }

  .dash-grid-main,
  .dash-grid-cba,
  .history-grid,
  .cba-category-grid {
    grid-template-columns: 1fr;
  }

  .dash-card {
    min-height: 100px;
    padding: 16px;
  }

  .dash-card-value {
    font-size: 1.8rem;
  }

  .dash-card-wide {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .dash-quick-nav {
    flex-direction: column;
    gap: 8px;
  }

  .dash-quick-nav .btn {
    width: 100%;
    justify-content: center;
  }
}

/* === Dark theme token overrides === */
.dark-theme {
  --bg: #0f1419;
  --panel: #1a1f2e;
  --panel-soft: #151a26;
  --line: #252d3d;
  --line-strong: #2e3a4f;
  --border: var(--line);
  --border-subtle: #252d3d;
  --border-hover: #3a4d66;
  --text: #edeae4;
  --muted: #8a9bb0;
  --primary: #60a5fa;
  --primary-strong: #3b82f6;
  --link: #93c5fd;
  --link-hover: #bfdbfe;
  --on-primary: #0f1419;
  --focus: rgba(96, 165, 250, .3);
  --brand: var(--primary);
  --accent: #fbbf24;
  --accent-soft: rgba(251, 191, 36, 0.12);
  --accent-strong: #f59e0b;
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --good: var(--ok);
  --bad: var(--danger);
  --surface: var(--panel);
  --surface-2: #1e2740;
  --indigo: #818cf8;
  --chart-grid: #252d3d;
  --chart-grid-soft: #1a2133;
  --chart-axis: #64748b;
  --chart-label: #c4cdd6;
  --chart-crosshair: #8a9bb0;
  --chart-marker-stroke: #0f1419;
  --row-hover-tint: rgba(251, 191, 36, 0.06);
  --theme-chip-bg: rgba(96, 165, 250, 0.1);
  --theme-chip-border: rgba(96, 165, 250, 0.25);
  --theme-chip-text: #93c5fd;
  --warn-soft-bg: rgba(251, 191, 36, 0.1);
  --warn-soft-border: rgba(251, 191, 36, 0.3);
  --warn-soft-text: #fde68a;
  --warn-soft-strong: #fbbf24;
  --warn-soft-muted: #fde68a;
  --status-fresh-bg: rgba(74, 222, 128, 0.1);
  --status-fresh-border: rgba(74, 222, 128, 0.25);
  --status-fresh-text: #86efac;
  --status-partial-bg: rgba(251, 191, 36, 0.1);
  --status-partial-border: rgba(251, 191, 36, 0.25);
  --status-partial-text: #fde68a;
  --status-stale-bg: rgba(248, 113, 113, 0.1);
  --status-stale-border: rgba(248, 113, 113, 0.25);
  --status-stale-text: #fca5a5;
  --good-soft-bg: rgba(74, 222, 128, 0.1);
  --good-soft-border: rgba(74, 222, 128, 0.25);
  --good-soft-text: #86efac;
  --offer-bg: rgba(74, 222, 128, 0.08);
  --offer-hover: rgba(74, 222, 128, 0.15);
  --info-soft-bg: rgba(96, 165, 250, 0.08);
  --info-soft-border: rgba(96, 165, 250, 0.25);
  --info-soft-text: #93c5fd;
  --topbar-bg: rgba(15, 20, 30, 0.96);
  --topbar-text: rgba(237, 234, 228, 0.75);
  --topbar-text-hover: #edeae4;
  --topbar-active: #fbbf24;
  --hover-soft: rgba(255, 255, 255, 0.04);
}

.dark-theme {
  color-scheme: dark;
}

.dark-theme body {
  background:
    radial-gradient(ellipse 900px 320px at 5% -8%, rgba(251, 191, 36, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse 700px 280px at 95% 105%, rgba(96, 165, 250, 0.04) 0%, transparent 60%),
    var(--bg);
}

.dark-theme input,
.dark-theme select,
.dark-theme button.secondary,
.dark-theme button.ghost,
.dark-theme button.soft,
.dark-theme .pill {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line-strong);
}

.dark-theme .pill-action:hover,
.dark-theme .row-main:hover td,
.dark-theme .row-candidate td,
.dark-theme th {
  background: var(--line);
}

.dark-theme .row-main.expandable:hover td {
  background: var(--info-soft-bg);
}

.dark-theme .nav a {
  color: var(--topbar-text);
}

.dark-theme .nav a:hover {
  color: var(--topbar-text-hover);
  background: var(--hover-soft);
}

.dark-theme .nav a.active {
  color: var(--topbar-text-hover);
  border-bottom-color: var(--topbar-active);
}

.dark-theme .status-chip {
  background: var(--theme-chip-bg);
  border-color: var(--theme-chip-border);
  color: var(--theme-chip-text);
}

.dark-theme .badge-mini {
  background: var(--status-fresh-bg);
  border-color: var(--status-fresh-border);
  color: var(--status-fresh-text);
}

.dark-theme .badge-mini.partial {
  background: var(--status-partial-bg);
  border-color: var(--status-partial-border);
  color: var(--status-partial-text);
}

.dark-theme .badge-mini.stale {
  background: var(--status-stale-bg);
  border-color: var(--status-stale-border);
  color: var(--status-stale-text);
}

/* Dark theme dash-card overrides */
.dark-theme .dash-card {
  background: var(--panel);
}

.dark-theme .kpi-primary  { border-left-color: var(--primary); }
.dark-theme .kpi-info     { border-left-color: var(--accent); }
.dark-theme .kpi-accent   { border-left-color: var(--indigo); }
.dark-theme .kpi-success  { border-left-color: var(--ok); }
.dark-theme .kpi-warn     { border-left-color: var(--warn); }
.dark-theme .kpi-danger   { border-left-color: var(--danger); }

.dark-theme .dash-cat-table th {
  background: var(--info-soft-bg);
  color: var(--text);
}

.dark-theme .dash-highlight {
  border-left-color: var(--primary);
}
}

@layer utilities {
  .muted {
    color: var(--muted);
  }

  .sr {
    position: absolute;
    left: -9999px;
  }

  .num,
  .tabular {
    font-variant-numeric: tabular-nums;
  }
}
