/* ===========================
   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 components {
/* ===================================================================
   tracker.css  -  Tracker-specific components only
   Base layout, tokens, typography, .card, .kpi, .btn, nav, cookies
   are all inherited from shell.css (bundled before this file).
   This file adds ONLY what is unique to the tracker interface.
=================================================================== */

/* ---------- main.shell width override for full-width tracker ---------- */
main.shell {
  max-width: 1240px;
  gap: var(--space-4);
}

/* ---------- Stack layout: consistent vertical rhythm ---------- */
.stack {
  display: grid;
  gap: var(--space-4);
}

/* ---------- Smooth transitions on interactive elements ---------- */
.card,
.kpi,
.pill,
button,
input,
select {
  transition: box-shadow .2s ease, border-color .2s ease, background-color .2s ease, transform .2s ease, color .2s ease;
}

@media (hover:hover) {
  .kpi:hover {
    transform: translateY(-2px)
  }
}

/* ---------- Tracker status badge (matches site badge style) ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  background: var(--status-fresh-bg);
  color: var(--status-fresh-text);
  border: 1px solid var(--status-fresh-border);
}

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

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

.badge.comparability-badge {
  letter-spacing: 0.02em;
  text-transform: none;
}

.badge.comparability-high {
  background: var(--status-fresh-bg);
  color: var(--status-fresh-text);
  border-color: var(--status-fresh-border);
}

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

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

.method {
  font-size: var(--text-sm);
  color: var(--muted);
  margin: 0;
}

.page-header-card {
  padding: var(--space-5) var(--space-6);
  box-shadow: none;
}

.page-header-title {
  font-family: var(--font-body);
  font-size: clamp(1.3rem, 2.4vw, 1.75rem);
  font-weight: 700;
  margin: 0 0 6px 0;
  letter-spacing: -.01em;
}

.page-header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.page-meta-text {
  margin: 0;
  font-size: var(--text-base);
}

.page-header-badge {
  margin-left: auto;
}

.smart-insights-panel {
  margin-bottom: var(--space-4);
  display: none;
  border: 1px solid var(--accent);
  background: var(--surface-2);
  padding: var(--space-4) var(--space-5);
}

.smart-insights-title {
  font-size: 1.15rem;
  margin: 0 0 6px 0;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.smart-insights-icon {
  font-size: 1.4rem;
}

.smart-insights-confidence {
  margin: 0 0 12px 0;
  font-size: var(--text-sm);
}

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

.smart-insights-offer {
  background: var(--good-soft-bg);
  border: 1px solid var(--good-soft-border);
  border-radius: var(--radius-control);
  padding: 12px;
  color: var(--good-soft-text);
}

.smart-insights-offer-title {
  margin: 0 0 8px 0;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.smart-insights-offer-list {
  margin: 0;
  padding-left: 20px;
  font-size: var(--text-base);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.smart-insights-offer-link {
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

.smart-insights-offer-link:hover {
  text-decoration: underline;
}

.smart-insights-offer-metric {
  font-size: var(--text-sm);
  opacity: .85;
}

.smart-insights-note {
  margin: 8px 0 0 0;
  font-size: var(--text-xs);
  opacity: .9;
}

/* The tracker JS writes .label / .value / .sub inside .kpi divs */
.kpi .label {
  font-size: var(--text-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
}

.kpi .value {
  font-size: clamp(1.4rem, 2.8vw, 2rem);
  line-height: 1.1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

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

.kpi-card {
  background: var(--panel);
  border-radius: var(--radius-card);
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

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

.kpi-label {
  font-size: var(--text-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.kpi-val {
  font-size: clamp(1.5rem, 2.8vw, 2.2rem);
  line-height: 1.05;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  margin: 2px 0;
  letter-spacing: -0.02em;
}

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

.kpi-val.var-up {
  color: var(--danger);
}

.kpi-val.var-down {
  color: var(--ok);
}

.kpi-val.var-flat {
  color: var(--warn);
}

/* ---------- Helper / quick-guide bar ---------- */
.helper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-top: 12px;
  padding-bottom: 12px;
}

/* ---------- Active-filter pills ---------- */
.pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  color: var(--text);
  font-size: var(--text-xs);
}

.pill-info {
  font-weight: 700
}

.pill-action {
  cursor: pointer;
  transition: all .16s ease;
}

.pill-action:hover {
  border-color: var(--line-strong);
  background: var(--panel-soft);
}

.pill-action span {
  font-weight: 700;
  color: var(--muted);
}

/* ---------- Premium / empty panels ---------- */
.premium-list li {
  margin: 6px 0
}

.insight-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--panel);
  padding: 12px 14px;
}

.insight-card h3 {
  margin: 0 0 8px 0;
  font-size: var(--text-base);
}

.insight-card ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  font-size: var(--text-base);
}

.insight-card a {
  color: var(--link);
  text-decoration: none;
}

.insight-card a:hover {
  text-decoration: underline;
}

/* ---------- Filters panel ---------- */
details.filters {
  position: relative;
  z-index: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}

details.filters>summary {
  cursor: pointer;
  list-style: none;
  padding: 13px 18px;
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--chart-label);
  letter-spacing: .005em;
  display: flex;
  align-items: center;
  gap: 8px;
}

details.filters>summary::-webkit-details-marker {
  display: none
}

details.filters>summary::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--chart-axis);
  border-bottom: 2px solid var(--chart-axis);
  transform: rotate(-45deg);
  margin-top: -1px;
  transition: transform .18s ease;
}

details.filters[open]>summary::before {
  transform: rotate(45deg);
}

details.filters[open]>.filters-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-end;
  padding: var(--space-4);
  background: var(--bg);
  border-bottom-left-radius: var(--radius-card);
  border-bottom-right-radius: var(--radius-card);
  border-top: 1px solid var(--line);
}

.filter-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  flex: 1;
  min-width: 120px;
}

.filter-field.field-search {
  min-width: 200px;
  flex: 1.5;
}

.filter-field.field-select {
  min-width: 130px;
}

.filter-field.field-quick {
  min-width: 280px;
  flex: 2;
}

.filter-field.field-mode {
  min-width: 150px;
}

.filter-field.filter-actions {
  flex-basis: 100%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 4px;
}


label {
  display: block;
  font-size: var(--text-xs);
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 700;
}

input,
select,
button {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.filters-grid input,
.filters-grid select {
  background: var(--panel-soft);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-control);
  padding: 7px 10px;
  font-size: var(--text-base);
  transition: border-color .18s ease, box-shadow .18s ease;
}

.filters-grid input:focus,
.filters-grid select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus);
  outline: none;
  background: var(--panel);
}

input,
select {
  box-shadow: none;
  height: 38px;
  box-sizing: border-box;
}

input:hover,
select:hover {
  border-color: var(--line-strong);
}

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

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

button {
  cursor: pointer;
  font-weight: 600;
  transition: all .16s ease;
}

button:active {
  transform: translateY(1px)
}

button:disabled {
  cursor: not-allowed;
  opacity: .55
}

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

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

button.ghost {
  background: transparent;
  border-color: var(--line);
}

button.ghost:hover {
  background: var(--panel-soft);
  border-color: var(--line-strong);
}

button.soft {
  background: var(--panel-soft);
  border-color: var(--line);
  color: var(--text);
}

button.soft:hover {
  background: var(--hover-soft)
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-wrap input {
  flex: 1
}

.search-wrap button {
  width: auto;
  min-width: 92px
}

.switchers {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.switchers button {
  width: auto;
  padding: 0 12px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.switchers button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.inline-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  box-sizing: border-box;
}

.inline-toggle input {
  width: auto;
  accent-color: var(--primary);
}

#sel {
  min-height: 126px
}

#sel option {
  padding: 2px 4px
}

.field-meta {
  margin-top: 2px;
  font-size: var(--text-xs);
  color: var(--muted);
}

.filter-actions {
  justify-content: flex-end;
  gap: 8px;
}

.filter-actions .switchers {
  width: 100%
}

.btn-inline {
  width: auto;
  min-height: 38px;
}

.copy-status {
  min-height: 16px;
  text-align: left;
}

.copy-status.error {
  color: var(--danger)
}

/* ---------- Chart panels ---------- */
.chart-panel {
  padding: 0;
  overflow: hidden;
  border-left: 3px solid var(--accent-soft);
  transition: border-left-color .2s ease;
}

.chart-panel[open] {
  border-left-color: var(--accent);
}

.chart-panel>summary {
  cursor: pointer;
  list-style: none;
  padding: 13px 18px;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid transparent;
}

.chart-panel>summary::-webkit-details-marker {
  display: none
}

.chart-panel>summary::after {
  content: ">";
  font-size: var(--text-sm);
  color: var(--muted);
  transition: transform .16s ease;
}

.chart-panel[open]>summary {
  background: linear-gradient(90deg, var(--panel-soft) 0%, var(--panel) 100%);
  border-bottom-color: var(--line);
}

.chart-panel[open]>summary::after {
  transform: rotate(90deg);
}

.chart-panel-body {
  display: grid;
  gap: 16px;
  padding: 16px 18px 20px;
}

.main-chart-grid {
  grid-template-columns: 280px minmax(0, 1fr);
  gap: var(--space-5);
  align-items: stretch;
  margin-top: var(--space-3);
}

.main-chart-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.main-chart-label {
  font-weight: 600;
  font-size: var(--text-md);
  text-transform: none;
  letter-spacing: normal;
  margin: 0;
}

.main-chart-help {
  font-size: var(--text-sm);
  margin: 0;
}

.quick-select-wrap {
  margin-top: 4px;
  margin-bottom: 4px;
}

.quick-select-label {
  font-size: var(--text-sm);
  font-weight: 500;
  display: block;
  margin-bottom: 6px;
  text-transform: none;
  letter-spacing: normal;
  color: var(--muted);
}

.quick-select-switchers {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.quick-select-btn {
  flex: 1;
  min-height: 34px;
  padding: 4px 2px;
  font-size: var(--text-xs);
}

.main-chart-select {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  font-size: var(--text-base);
  padding: 6px;
}

.selection-meta {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--link);
}

.btn-export-social {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-export-icon {
  font-size: 1.1rem;
}

.main-chart-wrapper {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 480px;
}

.main-chart-canvas {
  flex-grow: 1;
  min-height: 400px;
}

.chart {
  border-radius: var(--radius-control);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  position: relative;
  min-height: 260px;
  display: block;
  width: 100%;
}

.chart.small {
  min-height: 240px
}

.chart canvas {
  border-radius: var(--radius-card);
  width: 100%;
  height: 360px;
  display: block;
}

.chart-empty {
  color: var(--muted);
  font-size: var(--text-base);
  padding: 48px;
  text-align: center;
  width: 100%;
}

/* ---------- Chart legend ---------- */
.legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--muted);
}

.legend .item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-control);
  background: var(--panel-soft);
  line-height: 1.4;
}

.legend .item .dot {
  margin-top: 3px;
  min-width: 10px
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-pill);
  display: inline-block;
}

/* ---------- Band toolbar (for chart selectors) ---------- */
.band-toolbar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.band-select-wrap {
  min-width: 200px;
  flex: 1;
}

.macro-note {
  border: 1px solid var(--warn-soft-border);
  background: var(--warn-soft-bg);
  color: var(--warn-soft-text);
  border-radius: var(--radius-card);
  padding: 8px 12px;
  font-size: var(--text-sm);
  line-height: 1.4;
}

.macro-details {
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--panel);
}

.macro-details summary {
  cursor: pointer;
  list-style: none;
  padding: 8px 12px;
  font-size: var(--text-sm);
  color: var(--muted);
  font-weight: 600;
}

.macro-details summary::-webkit-details-marker {
  display: none
}

.macro-details>div {
  padding: 0 12px 12px;
  font-size: var(--text-sm);
}

/* ---------- Data table ---------- */
.table-section {
  padding: var(--space-5);
}

.table-section-main {
  width: 100%;
  margin-bottom: 24px;
}

.tracker-loading {
  padding: 40px;
  text-align: center;
  margin-bottom: 24px;
}

.table-toolbar {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

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

.table-actions label {
  margin: 0
}


.table-actions .page-size {
  width: auto;
  min-width: 88px;
}

.table-view-switchers {
  margin-left: auto;
  margin-right: 16px;
}

.page-info {
  min-width: 92px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 6px 8px;
  background: var(--panel-soft);
  font-size: var(--text-sm);
}

.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 72vh;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 720px;
}

th,
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  font-size: var(--text-base);
  vertical-align: middle;
}

th {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--primary);
  border-bottom: 2px solid var(--primary-strong);
  font-weight: 700;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--primary);
  box-shadow: 0 2px 0 var(--primary-strong);
}

td:first-child,
th:first-child {
  text-align: left;
}

tbody tr {
  background: transparent
}

td.num {
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row-main td {
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.row-main td:first-child {
  font-weight: 600;
  color: var(--text);
}

.row-main:hover td {
  background: linear-gradient(90deg, var(--row-hover-tint) 0%, transparent 100%);
}

.row-main.row-offer td {
  background: var(--offer-bg, #f0fdf4);
}

.row-main.row-offer:hover td {
  background: var(--offer-hover, #dcfce7);
}

.dark-theme .row-main.row-offer td {
  background: var(--offer-bg);
}

.dark-theme .row-main.row-offer:hover td {
  background: var(--offer-hover);
}

.row-main.expandable {
  cursor: pointer
}

.row-main.expandable:hover td {
  background: var(--theme-chip-bg)
}

.row-main.expandable:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.row-main.is-expanded .row-chevron {
  color: var(--primary);
  font-weight: 700;
}

.row-candidate td {
  font-size: var(--text-sm);
  color: var(--text);
  background: transparent;
  border-bottom: 1px dashed var(--line);
}

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

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

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

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

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

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

.dark-theme .macro-note {
  border-color: var(--warn-soft-border);
  background: var(--warn-soft-bg);
  color: var(--warn-soft-text);
}

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

.row-candidate td:first-child {
  padding-left: 20px
}

.product-cell {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.product-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.product-copy a {
  display: inline-block;
  max-width: 440px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  color: var(--link);
}

.row-chevron {
  width: 16px;
  min-width: 16px;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.2;
  padding-top: 2px;
}

.row-meta {
  font-size: var(--text-xs);
  color: var(--muted);
}

.candidate-tier {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--muted);
}

.row-candidate.tier-mid .candidate-tier {
  border-color: var(--theme-chip-border);
  color: var(--primary);
  background: var(--theme-chip-bg);
}

.row-candidate.tier-high .candidate-tier {
  border-color: var(--warn-soft-border);
  color: var(--warn-soft-text);
  background: var(--warn-soft-bg);
}

/* ---------- Cookie banner (tracker overrides shell defaults) ---------- */
.cookie-banner {
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-width: 520px;
  margin: 0 auto;
}

.cookie-grid {
  flex-direction: row;
  justify-content: space-between;
}

/* ---------- Mobile onboarding toast ---------- */
.onboarding-mobile {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 90px;
  z-index: 54;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 12px 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .22);
  display: grid;
  gap: 8px;
}

.onboarding-mobile[hidden] {
  display: none
}

.onboarding-title {
  font-size: var(--text-base);
  font-weight: 700;
}

.onboarding-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.onboarding-actions button {
  width: auto;
  min-height: 32px;
  border: 1px solid var(--line-strong);
  background: var(--panel-soft);
  color: var(--text);
  border-radius: var(--radius-control);
  padding: 7px 12px;
}

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

/* ============================================================
   RESPONSIVE
============================================================ */

@media (min-width:761px) {
  .onboarding-mobile {
    display: none !important
  }
}

@media (max-width:1100px) {
  .kpis {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

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

  .filter-field,
  .filter-field.span-3,
  .filter-field.span-4,
  .filter-field.span-6 {
    grid-column: span 2;
  }

  .filter-field.span-6 {
    grid-column: span 6
  }
}

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

  .card {
    padding: 18px
  }

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

  .main-chart-wrapper {
    min-height: 360px;
  }
}

@media (max-width:760px) {
  main.shell {
    padding: 12px
  }

  .card {
    padding: 16px
  }

  .kpis {
    grid-template-columns: repeat(2, minmax(110px, 1fr))
  }

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

  .filter-field,
  .filter-field.span-3,
  .filter-field.span-4,
  .filter-field.span-6 {
    grid-column: span 1;
    min-height: auto;
  }

  .table-section {
    padding: 14px
  }

  .table-wrap {
    max-height: none
  }

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

  .search-wrap button {
    width: auto;
    align-self: flex-start;
    min-width: 92px;
  }

  .switchers button {
    width: auto;
    flex: 1;
    min-width: 0;
  }

  .table-view-switchers {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
  }

  .quick-select-btn {
    min-height: 32px;
  }

  .main-chart-help {
    font-size: var(--text-sm);
  }

  .main-chart-wrapper {
    min-height: 340px;
  }

  .main-chart-canvas {
    min-height: 300px;
  }

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

  table {
    min-width: 0;
    width: 100%;
    margin-top: 10px;
  }

  /* Table Cards */
  thead {
    display: none;
  }

  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tr.row-main,
  tr.row-candidate {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    margin-bottom: 12px;
    padding: 12px;
    box-shadow: var(--shadow-sm);
  }

  tr.row-candidate {
    margin-top: -8px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: none;
    box-shadow: none;
    background: var(--panel-soft);
  }

  td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--line-soft);
  }

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

  td:last-child {
    border-bottom: none;
  }

  td::before {
    content: attr(data-label);
    font-size: var(--text-xs);
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    text-align: left;
    margin-right: 16px;
  }

  td[data-label="Producto"] {
    flex-direction: column;
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
    margin-bottom: 6px;
  }

  td[data-label="Producto"]::before {
    display: none;
  }

  .product-cell {
    max-width: 100%;
    width: 100%;
    justify-content: space-between;
    flex-direction: row-reverse;
  }

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

  .onboarding-mobile {
    left: 8px;
    right: 8px;
    bottom: 80px;
  }

  .nav a {
    flex: 1 1 calc(33.333% - 8px);
    justify-content: center;
    min-height: 40px;
    font-size: var(--text-sm);
  }
}

/* ============================================================
   PRODUCT DETAIL PAGE COMPONENTS
============================================================ */

/* Link in tracker table pointing to /tracker/{id}/ */
a.product-detail-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

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

/* External link icon beside product name */
a.product-ext-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 5px;
  color: var(--muted);
  font-size: var(--text-xs);
  text-decoration: none;
  vertical-align: middle;
  opacity: .7;
  transition: opacity .15s ease;
}

a.product-ext-link:hover {
  opacity: 1
}

/* Breadcrumb navigation */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: var(--text-sm);
  color: var(--muted);
  margin-bottom: 4px;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--link-hover)
}

.breadcrumb-sep {
  color: var(--line-strong);
  font-size: var(--text-xs);
}

/* Product header card */
.product-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-header h1 {
  font-size: clamp(1.2rem, 2.5vw, 1.7rem);
  margin: 0;
  line-height: 1.25;
}

.product-header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: var(--text-sm);
  color: var(--muted);
}

/* Product stat KPI cards (on detail page) */
.product-stats {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.product-stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.product-stat .stat-label {
  font-size: var(--text-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}

.product-stat .stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.product-stat .stat-value.pos {
  color: var(--danger)
}

.product-stat .stat-value.neg {
  color: var(--ok)
}

.product-stat .stat-sub {
  font-size: var(--text-xs);
  color: var(--muted);
}

/* Terna comparison table for low/mid/high variants */
.terna-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

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

.terna-table th {
  font-size: var(--text-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--panel-soft);
  font-weight: 600;
}

.terna-table tr:last-child td {
  border-bottom: none
}

.terna-table tbody tr:hover td {
  background: var(--panel-soft)
}

.terna-tier {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.terna-tier.low {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  color: var(--muted);
}

.terna-tier.mid {
  background: var(--theme-chip-bg);
  border: 1px solid var(--theme-chip-border);
  color: var(--primary);
}

.terna-tier.high {
  background: var(--warn-soft-bg);
  border: 1px solid var(--warn-soft-border);
  color: var(--warn-soft-text);
}

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: var(--text-base);
  font-weight: 500;
  transition: color .15s ease;
}

.back-link:hover {
  color: var(--link-hover)
}

/* No data placeholder on detail page */
.detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  flex-direction: column;
  gap: 10px;
  color: var(--muted);
  font-size: var(--text-base);
}

@media (max-width:760px) {
  .product-stats {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .terna-table th:nth-child(4),
  .terna-table td:nth-child(4) {
    display: none;
  }
}

/* ---------- Quick filter buttons ---------- */
.quick-fn {
  background: var(--panel-soft);
  border: 1.5px solid var(--line);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--chart-label);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.quick-fn:hover,
.quick-fn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

/* -- Main data table: sharper, cleaner rows -- */
.tracker-table {
  border-collapse: separate;
  border-spacing: 0;
}

.tracker-table thead th {
  background: var(--primary);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  padding: 10px 14px;
  border-bottom: 2px solid var(--primary-strong);
  position: sticky;
  top: 0;
  z-index: 2;
}

.tracker-table tbody tr {
  border-bottom: 1px solid var(--line);
  transition: background .14s ease;
}

.tracker-table tbody tr:hover {
  background: linear-gradient(90deg, var(--row-hover-tint) 0%, transparent 100%);
}

.tracker-table tbody tr.expanded {
  background: var(--surface-2);
}

.tracker-table td {
  padding: 11px 14px;
  font-size: var(--text-base);
  vertical-align: middle;
}

/* Product name: bolder */
.tracker-table .col-name {
  font-weight: 600;
  color: var(--text);
}

/* Price column: monospaced and accent */
.tracker-table .col-price {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

/* -- Var badges: pill indicator style -- */
/* Variation badges — pill style, scoped to table/list contexts only */
td .var-up,
.kpi-list-row .var-up {
  color: var(--danger);
  font-weight: 700;
  background: rgba(153, 27, 27, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}

td .var-down,
.kpi-list-row .var-down {
  color: var(--ok);
  font-weight: 700;
  background: rgba(22, 101, 52, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}

td .var-flat,
.kpi-list-row .var-flat {
  color: var(--warn);
  font-weight: 700;
  background: rgba(180, 83, 9, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}

/* -- Selection meta counter -- */
#selection-meta {
  display: inline-flex;
  align-items: center;
  background: var(--info-soft-bg);
  color: var(--info-soft-text);
  border: 1px solid var(--info-soft-border);
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  letter-spacing: .02em;
  min-width: 100px;
  justify-content: center;
}

/* -- Product selector scrollbar -- */
#sel {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

/* -- Page header accent line -- */
.page-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 8px;
}

/* -- Macro status badge: refined -- */
#macro-status {
  font-size: var(--text-xs);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--info-soft-bg);
  color: var(--info-soft-text);
  border: 1px solid var(--info-soft-border);
  font-weight: 600;
}

/* -- Band-select toolbar -- */
.band-toolbar {
  gap: 12px;
}

.band-select-wrap select {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel-soft);
  padding: 6px 10px;
  font-size: var(--text-base);
  transition: border-color .18s ease;
}

.band-select-wrap select:focus {
  border-color: var(--primary);
  outline: none;
}

/* -- "Como usar" cards: glassy look on dark hover -- */
details.card>div>div {
  transition: box-shadow .22s ease, transform .22s ease;
}

@media (hover:hover) {
  details.card>div>div:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
  }
}

/* ---------- Grid View Styles ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.product-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: transparent;
  transition: background 0.3s ease;
}

.product-card.is-offer::before {
  background: var(--good);
}

html.dark-theme .product-card {
  background: var(--surface-2);
  border-color: var(--border-subtle);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(15, 23, 42, 0.12);
  border-color: var(--line-strong);
}

html.dark-theme .product-card:hover {
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.6);
  border-color: var(--border-hover);
}

/* Candidate toggle button inside card */
.product-card .toggle-candidates:hover {
  background: var(--surface-2) !important;
}

html.dark-theme .product-card .toggle-candidates:hover {
  background: var(--surface) !important;
}

.product-card .badge {
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  line-height: 1;
}

.offer-genuine {
  background: var(--theme-chip-bg);
  color: var(--theme-chip-text);
  border: 1px solid var(--theme-chip-border);
  font-size: var(--text-xs);
}

.offer-genuine.inline-start {
  margin-left: 8px;
}

.offer-genuine.inline-end {
  margin-right: 8px;
}

.row-trend-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.row-baseline {
  font-size: var(--text-xs);
}

.row-empty {
  grid-column: 1 / -1;
  padding: 20px;
  text-align: center;
}

.product-card-shell {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.product-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.product-card-copy {
  flex: 1;
}

.product-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.product-title-link {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

.product-title-link:hover {
  color: var(--link-hover);
}

.product-card-ext-link {
  margin-left: 6px;
}

.product-card-badges {
  margin-top: 6px;
}

.product-card-meta {
  font-size: var(--text-sm);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.product-card-meta-icon {
  opacity: 0.6;
  font-size: var(--text-sm);
}

.product-card-price-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: auto;
  padding-top: 8px;
}

.product-card-price-value {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.product-card-baseline {
  font-size: var(--text-xs);
  margin-top: 4px;
}

.product-card-trend-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.product-card-trend-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  min-width: 90px;
  justify-content: right;
}

.product-card-nominal {
  font-weight: 700;
  font-size: var(--text-md);
}

.product-card-real {
  font-size: var(--text-xs);
  font-weight: 600;
  padding-right: 2px;
}

.product-card-toggle {
  width: 100%;
  justify-content: center;
  font-size: var(--text-sm);
  padding: 6px;
  margin-top: 8px;
  border-radius: var(--radius-control);
  font-weight: 600;
  transition: background 0.2s, color 0.2s;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.candidate-list {
  background: var(--surface-2);
  border-radius: var(--radius-control);
  padding: 8px 12px;
  margin-top: 8px;
  border: 1px solid var(--border-subtle);
}

.candidate-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-sm);
  padding: 6px 0;
  border-top: 1px dashed var(--line);
}

.candidate-tier-label {
  color: var(--muted);
  text-transform: uppercase;
  font-size: var(--text-xs);
  font-weight: 700;
  width: 40px;
  letter-spacing: 0.05em;
}

.candidate-name {
  flex: 1;
  margin: 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.candidate-name a {
  color: var(--text);
  text-decoration: none;
}

.candidate-name a:hover {
  text-decoration: underline;
}

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

.candidate-link:hover {
  text-decoration: underline;
}

.candidate-price {
  font-variant-numeric: tabular-nums;
}

.spread-note {
  font-size: var(--text-sm);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 2px solid var(--border);
  border-left: 3px solid var(--line-strong);
  padding-left: 6px;
}

.spread-note.spread-high {
  border-left-color: var(--warn);
}

.spread-note.spread-low {
  border-left-color: var(--primary);
}

.spread-row {
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 2px solid var(--border);
}

.spread-row .spread-note {
  margin: 0;
  padding-top: 0;
  border-top: 0;
}

.kpi-list-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--line);
}

.kpi-empty {
  font-size: var(--text-sm);
}

.kpi-card-center {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.kpi-card-stat {
  padding: 12px 16px;
}

.kpi-title {
  margin-bottom: 8px;
  font-weight: 600;
}

.detail-table-wrap {
  border-radius: var(--radius-card);
  margin-top: 8px;
  overflow-x: auto;
}

.detail-extremes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.detail-extreme-card {
  background: var(--surface);
  padding: 12px 16px;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
}

.detail-extreme-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.detail-extreme-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
}

.detail-extreme-empty {
  font-size: var(--text-sm);
}

.stat-value-inline {
  display: flex;
  align-items: center;
}

.detail-gauge {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 12px 16px;
  background: var(--panel-soft);
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
}

.detail-gauge-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: var(--text-sm);
  color: var(--muted);
}

.detail-gauge-current {
  font-weight: 600;
  color: var(--text);
}

.detail-gauge-track {
  width: 100%;
  height: 8px;
  background: var(--chart-grid);
  border-radius: 4px;
  position: relative;
}

.detail-gauge-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 4px;
}

.detail-gauge-marker {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 16px;
  background: var(--text);
  border-radius: 2px;
  transform: translateX(-50%);
  box-shadow: 0 0 0 2px var(--panel);
}

.detail-macro-context {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 10px 14px;
  background: var(--info-soft-bg);
  border-left: 3px solid var(--info-soft-border);
  border-radius: 4px;
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-macro-icon {
  font-size: 1.1rem;
}

.detail-macro-title {
  display: block;
  margin-bottom: 2px;
}

.detail-macro-text {
  color: var(--muted);
}

.detail-vol-badge {
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
}

.detail-vol-badge.frozen {
  background: var(--theme-chip-bg);
  color: var(--theme-chip-text);
  border: 1px solid var(--theme-chip-border);
}

.detail-vol-badge.stable {
  background: var(--good-soft-bg);
  color: var(--good-soft-text);
  border: 1px solid var(--good-soft-border);
}

.detail-vol-badge.volatile {
  background: var(--warn-soft-bg);
  color: var(--warn-soft-text);
  border: 1px solid var(--warn-soft-border);
}

/* ---------- Dark Mode — tracker-specific overrides ---------- */
/* (nav/input/pill/button overrides live in shell.css) */
html.dark-theme .topbar {
  background: var(--topbar-bg);
}

html.dark-theme details.filters {
  background: var(--panel);
  border-color: var(--line);
}

html.dark-theme .tracker-table thead th,
html.dark-theme thead th {
  background: var(--info-soft-bg);
  border-bottom-color: var(--info-soft-border);
  color: var(--text);
}

/* ---------- AI commentary sections ---------- */
.dash-ai-highlight {
  margin: 0 0 var(--space-3) 0;
  font-size: var(--text-md);
}

.dash-ai-text {
  background: var(--panel);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-control);
  border-left: 4px solid var(--primary);
  margin-bottom: var(--space-3);
  line-height: 1.65;
}

.ai-insights-content {
  background: var(--panel);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-control);
  border-left: 4px solid var(--primary);
}

.ai-generated-note {
  font-size: var(--text-xs);
  margin-top: var(--space-2);
}
}

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

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

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