:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #475569;
  --line: #e2e8f0;
  --night: #0b1020;
  --night-2: #111827;
  --magenta: #ff2e88;
  --magenta-ink: #be185d;
  --cyan: #22d3ee;
  --green: #22c55e;
  --yellow: #facc15;
  --orange: #fb923c;
  --gray: #94a3b8;
  --red: #ef4444;
  --radius: 16px;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --display: "Arial Black", "Archivo Black", "Helvetica Neue", system-ui, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

img, svg { max-width: 100%; }

button, input { font: inherit; }

button { cursor: pointer; }

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  transform: translateY(-180%);
  transition: transform 160ms ease;
}

.skip:focus { transform: translateY(0); }

.wrap {
  width: min(1160px, calc(100% - 48px));
  margin-inline: auto;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--magenta-ink);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  padding: 42px 0 112px;
  background:
    radial-gradient(900px 420px at 82% -10%, rgba(255, 46, 136, 0.28), transparent 62%),
    radial-gradient(700px 360px at 8% 110%, rgba(34, 211, 238, 0.22), transparent 60%),
    var(--night);
  color: #f8fafc;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent 82%);
  pointer-events: none;
}

.hero-inner { position: relative; z-index: 1; }

.topline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 52px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.wordmark { color: #f8fafc; }
.cut { color: #94a3b8; }

.hero h1 {
  max-width: 820px;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(3.2rem, 8.5vw, 6.7rem);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.hero h1::after {
  content: "";
  display: inline-block;
  width: 0.18em;
  height: 0.18em;
  margin-left: 0.12em;
  border-radius: 50%;
  background: var(--magenta);
  vertical-align: 0.2em;
}

.dek {
  max-width: 620px;
  margin: 24px 0 0;
  color: #cbd5e1;
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--magenta);
  color: #0b1020;
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.btn:hover { transform: translateY(-1px); background: #ff5aa2; }

.btn-ghost {
  background: rgba(248, 250, 252, 0.06);
  border-color: rgba(248, 250, 252, 0.22);
  color: #f8fafc;
}

.btn-ghost:hover { background: rgba(248, 250, 252, 0.12); }

/* KPIs */
.kpis {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: -64px;
}

.kpi {
  display: flex;
  flex-direction: column;
  min-height: 164px;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--green);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.09);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.kpi:nth-child(2) { border-top-color: var(--green); }
.kpi:nth-child(3) { border-top-color: var(--cyan); }
.kpi:nth-child(4) { border-top-color: var(--magenta); }

.kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 44px rgba(15, 23, 42, 0.13);
}

.kpi-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kpi strong {
  display: block;
  font-family: var(--display);
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.kpi-label {
  margin-top: 8px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.3;
}

.kpi-source {
  margin-top: auto;
  padding-top: 14px;
  color: #64748b;
  font-size: 0.7rem;
  line-height: 1.3;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: var(--gray);
}

.dot-oficial { background: var(--green); }
.dot-secundaria { background: var(--yellow); }
.dot-estimacion { background: var(--orange); }
.dot-sin-dato { background: var(--gray); }
.dot-rumor { background: var(--red); }

/* Sections */
main > section { padding: 42px 0; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding-top: 18px;
  align-items: start;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chart-card { padding: 22px; }

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

.card h2,
.section-head h2,
.method-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.chart-dek {
  max-width: 58ch;
  margin: 10px 0 18px;
  color: var(--muted);
  font-size: 0.88rem;
}

.segmented {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f1f5f9;
}

.seg {
  min-height: 32px;
  padding: 5px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.seg.is-active {
  background: var(--night);
  color: #f8fafc;
}

.chart {
  position: relative;
  width: 100%;
  min-height: 300px;
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart .grid-line { stroke: #e2e8f0; stroke-width: 1; }
.chart .axis-label { fill: #64748b; font-family: var(--font); }
.chart .panel-label { fill: var(--ink); font-weight: 800; font-family: var(--font); }
.chart .peak-label { fill: var(--ink); font-weight: 800; font-family: var(--font); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.chart .peak-sub { fill: #64748b; font-family: var(--font); }
.chart .launch-line { stroke: var(--magenta); stroke-width: 1.2; stroke-dasharray: 4 4; opacity: 0.65; }
.chart .launch-label { fill: var(--magenta-ink); font-weight: 800; font-family: var(--font); }
.chart .wave-line { stroke: #94a3b8; stroke-width: 1; stroke-dasharray: 3 5; opacity: 0.55; }
.chart .wave-label { fill: #64748b; font-weight: 700; font-family: var(--font); }
.chart .hover-line { stroke: #0f172a; stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.5; }
.chart .hover-dot { fill: var(--surface); stroke-width: 2; }
.chart .hover-en { stroke: var(--magenta); }
.chart .hover-es { stroke: #0891b2; }

.chart-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 150px;
  max-width: min(320px, calc(100vw - 24px));
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
  color: var(--ink);
  font-size: 0.74rem;
  line-height: 1.4;
  pointer-events: none;
  transform: translate(-50%, 0);
}

.chart-tooltip strong { display: block; margin-bottom: 3px; }
.chart-tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; }
.chart-tooltip .tt-en { color: var(--magenta-ink); }
.chart-tooltip .tt-es { color: #0e7490; }
.chart-tooltip .tt-note { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--line); color: #64748b; font-size: 0.66rem; }

.chart-tooltip.is-fixed {
  position: fixed;
  transform: none;
}

.chart-readout {
  min-height: 1.4em;
  margin: 10px 0 0;
  color: #64748b;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.wave-notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.wave {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.68rem;
}

.wave-date {
  color: var(--magenta-ink);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.wave strong { color: var(--ink); font-size: 0.72rem; }

.data-table {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.data-table summary {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.data-table summary:hover { color: var(--ink); }

.table-wrap { overflow-x: auto; margin-top: 10px; }

.data-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.74rem;
}

.data-table th,
.data-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.source {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: #64748b;
  font-size: 0.7rem;
  line-height: 1.45;
}

.chart-total {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

/* YouTube bars */
.bars { display: grid; gap: 4px; margin-top: 4px; }

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(90px, 1.6fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid #eef2f7;
  color: inherit;
  text-decoration: none;
}

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

.bar-meta { min-width: 0; }

.bar-title {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-channel {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 0.66rem;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #f1f5f9;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--magenta), var(--cyan));
  transition: width 700ms cubic-bezier(0.22, 1, 0.36, 1);
}

.bar-fill.top { background: linear-gradient(90deg, #be185d, var(--magenta)); }

.bar-row:hover .bar-title { color: #be185d; }

.bar-value {
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* Claims */
.claims-section { padding-top: 54px; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 20px;
}

.section-dek {
  max-width: 480px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: right;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.search { flex: 1 1 260px; }

.search input {
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.85rem;
}

.search input::placeholder { color: #94a3b8; }

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

.chip {
  min-height: 36px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.chip:hover { border-color: #cbd5e1; color: var(--ink); }

.chip.is-active {
  border-color: var(--night);
  background: var(--night);
  color: #f8fafc;
}

.clear {
  min-height: 36px;
  padding: 6px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #be185d;
  font-size: 0.72rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.clear:hover:not(:disabled) { background: #fff1f7; }
.clear:disabled { color: #94a3b8; cursor: default; text-decoration: none; }

.count {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.claims-list { display: grid; gap: 8px; }

.claim {
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gray);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.claim[data-status="oficial"] { border-left-color: var(--green); }
.claim[data-status="secundaria"] { border-left-color: var(--yellow); }
.claim[data-status="estimacion"] { border-left-color: var(--orange); }
.claim[data-status="sin_dato"] { border-left-color: var(--gray); }

.claim:hover { border-color: #cbd5e1; }
.claim.is-open { box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08); }

.claim-toggle {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 13px 14px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.claim-id {
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.claim-main { min-width: 0; }

.claim-value {
  display: block;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.claim-title {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.claim-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  white-space: nowrap;
}

.claim-detail {
  display: none;
  padding: 0 14px 16px 68px;
  border-top: 1px solid #eef2f7;
}

.claim.is-open .claim-detail { display: block; }

.claim-detail p { margin: 14px 0 0; color: var(--muted); font-size: 0.82rem; }
.claim-detail .limit { color: var(--ink); }
.claim-detail .limit strong { color: #be185d; }

.claim-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 10px;
  color: #64748b;
  font-size: 0.72rem;
}

.claim-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.btn-small {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
  text-decoration: none;
}

.btn-small:hover { border-color: #cbd5e1; background: #f8fafc; }

.btn-small.primary {
  border-color: var(--night);
  background: var(--night);
  color: #f8fafc;
}

.btn-small.primary:hover { background: #1e293b; }

.btn-small.is-copied {
  border-color: var(--green);
  background: #f0fdf4;
  color: #166534;
}

.btn-small.is-disabled {
  border-style: dashed;
  color: #94a3b8;
  cursor: default;
}

.claim-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.claim-url {
  margin-top: 8px;
  color: #64748b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.66rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.copy-fallback {
  margin-top: 12px;
  padding: 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.copy-fallback p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.72rem;
}

.copy-fallback textarea {
  width: 100%;
  min-height: 88px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.74rem;
  line-height: 1.45;
  resize: vertical;
}

.data-table tr.is-peak th,
.data-table tr.is-peak td { background: #fff7fb; }

.data-table tr.is-peak th::after {
  content: " · pico";
  color: var(--magenta-ink);
  font-size: 0.56rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.notice {
  padding: 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.empty {
  padding: 28px 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

/* Missing */
.missing-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.missing-item {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.missing-tag {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--magenta-ink);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.missing-item h3 {
  margin: 0 0 7px;
  font-size: 0.92rem;
  line-height: 1.2;
}

.missing-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

/* Method */
.method-card {
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.method-head { max-width: 760px; }

.method-dek {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.method-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(260px, 0.85fr);
  gap: 36px;
  margin-top: 26px;
}

.method-body p {
  margin: 0 0 13px;
  color: #334155;
  font-size: 0.86rem;
  line-height: 1.62;
}

.method-body strong { color: var(--ink); }
.method-body a { color: #be185d; text-underline-offset: 2px; overflow-wrap: anywhere; }

.legend {
  align-self: start;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.legend h3 {
  margin: 0 0 12px;
  font-size: 0.92rem;
}

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

.legend li {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 9px;
  align-items: start;
}

.legend .dot { margin-top: 5px; }
.legend strong { display: block; font-size: 0.78rem; }
.legend p { margin: 2px 0 0; color: var(--muted); font-size: 0.7rem; line-height: 1.4; }

.cite-box {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.cite-box strong { display: block; font-size: 0.74rem; }
.cite-box p { margin: 6px 0 0; color: var(--muted); font-size: 0.7rem; line-height: 1.45; }

/* Footer */
.footer {
  margin-top: 30px;
  padding: 34px 0;
  background: var(--night);
  color: #cbd5e1;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px 32px;
  align-items: start;
}

.footer-mark {
  margin: 0 0 6px;
  color: #f8fafc;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.footer-note {
  margin: 0;
  color: #94a3b8;
  font-size: 0.72rem;
  line-height: 1.5;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: flex-end;
}

.footer-links a {
  color: #e2e8f0;
  font-size: 0.72rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(226, 232, 240, 0.3);
}

.footer-links a:hover { border-color: var(--cyan); }

/* Responsive */
@media (max-width: 980px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .missing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .method-grid { grid-template-columns: 1fr; gap: 24px; }
  .section-head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .section-dek { text-align: left; }
}

@media (max-width: 640px) {
  .wrap { width: calc(100% - 32px); }

  .hero { padding: 28px 0 54px; }
  .topline { margin-bottom: 34px; font-size: 0.64rem; }
  .hero h1 { font-size: clamp(2.8rem, 15vw, 4.2rem); }
  .dek { margin-top: 18px; font-size: 1rem; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .btn { width: 100%; }

  .kpis {
    grid-template-columns: 1fr;
    margin-top: 0;
    padding-top: 16px;
  }
  .kpi { min-height: 138px; }

  main > section { padding: 34px 0; }
  .grid-2 { padding-top: 8px; }
  .chart-card { padding: 17px; }
  .card-head { flex-direction: column; gap: 10px; }
  .segmented { width: 100%; }
  .seg { flex: 1; }

  .controls { align-items: stretch; }
  .search { flex-basis: 100%; }
  .chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .chip { flex: 0 0 auto; }
  .clear { text-align: left; padding-left: 2px; }
  .count { margin-left: auto; }
  .wave-notes { grid-template-columns: 1fr; }

  .claim-toggle {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
    padding: 12px;
  }
  .claim-status { grid-column: 2; justify-self: start; }
  .claim-detail { padding: 0 12px 14px 50px; }

  .bar-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .bar-value { grid-column: 2; grid-row: 1; }

  .missing-grid { grid-template-columns: 1fr; }
  .method-card { padding: 20px; }
  .method-body p { font-size: 0.84rem; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-links { justify-content: flex-start; }
}

/* ------------------------------------------------------------------ */
/* Híbrido 1.2 — boot, skyline, ecualizador, ruta y fichas             */
/* ------------------------------------------------------------------ */

.boot { display: none; }

.js .boot {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(760px 420px at 78% 8%, rgba(255, 46, 136, 0.24), transparent 62%),
    radial-gradient(700px 420px at 12% 100%, rgba(34, 211, 238, 0.18), transparent 64%),
    var(--night);
  color: #f8fafc;
  transition: opacity 420ms ease, visibility 420ms ease;
}

.js .boot.is-done,
.js.boot-done .boot {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.js.boot-done .boot { display: none; }

.boot-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(120% 100% at 50% 40%, #000 30%, transparent 82%);
}

.boot::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 4px);
  pointer-events: none;
}

.boot-inner {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100% - 48px));
  animation: boot-rise 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.boot-mark {
  margin: 0;
  color: #94a3b8;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.boot-title {
  margin: 14px 0 34px;
  font-family: var(--display);
  font-size: clamp(2.6rem, 9vw, 4.4rem);
  font-weight: 900;
  line-height: 0.88;
  letter-spacing: -0.05em;
}

.boot-meter {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.24);
}

.boot-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--magenta), var(--cyan));
  box-shadow: 0 0 18px rgba(255, 46, 136, 0.65);
  transition: width 280ms ease;
}

.boot-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  color: #94a3b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
}

.boot-tip {
  min-height: 2.9em;
  margin: 26px 0 0;
  color: #cbd5e1;
  font-size: 0.84rem;
  line-height: 1.5;
}

.boot-cut {
  margin: 18px 0 0;
  color: #64748b;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

@keyframes boot-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Pulso */

.card-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.pulse-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--gray);
}

.pulse-badge.is-live {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.pulse-badge.is-live .pulse-dot {
  background: var(--green);
  animation: pulse-dot 2s ease-out infinite;
}

.pulse-badge.is-snapshot {
  border-color: #a5f3fc;
  background: #ecfeff;
  color: #0e7490;
}

.pulse-badge.is-snapshot .pulse-dot { background: var(--cyan); }

.pulse-badge.is-off { color: #64748b; }

.pulse-note {
  margin: 10px 0 0;
  color: #64748b;
  font-size: 0.68rem;
  line-height: 1.45;
}

@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Skyline */

.chart-sky .sky-bar {
  fill: #0f172a;
  opacity: 0.93;
}

.chart-sky .sky-bar.is-peak { fill: #111827; }

.chart-sky .sky-window {
  fill: var(--cyan);
  opacity: 0.62;
}

.chart-sky .sky-window.alt {
  fill: var(--magenta);
  opacity: 0.72;
}

.chart-sky .series-halo {
  fill: none;
  stroke: #ffffff;
  stroke-width: 4.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
}

.chart-sky .series {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-sky .series-en {
  stroke: var(--magenta);
  filter: drop-shadow(0 0 3px rgba(255, 46, 136, 0.65));
}

.chart-sky .series-es {
  stroke: #0891b2;
  filter: drop-shadow(0 0 3px rgba(8, 145, 178, 0.55));
}

.js .chart-sky .series {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw-line 1.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.js .chart-sky .series-halo {
  opacity: 0;
  animation: fade-in 420ms ease 900ms forwards;
}

.chart-sky .peak-halo {
  fill: none;
  stroke: var(--magenta);
  stroke-width: 1.2;
  opacity: 0.7;
  transform-box: fill-box;
  transform-origin: center;
  animation: halo 2.6s ease-out infinite;
}

.chart-sky .peak-halo.is-es { stroke: #0891b2; }

@keyframes draw-line { to { stroke-dashoffset: 0; } }
@keyframes fade-in { to { opacity: 0.85; } }
@keyframes halo {
  0% { opacity: 0.65; transform: scale(0.55); }
  70% { opacity: 0; transform: scale(2); }
  100% { opacity: 0; transform: scale(2); }
}

/* Ecualizador */

.eq {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  margin: 8px 0 6px;
  padding-top: 8px;
}

.eq-col {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 5px;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: center;
  text-decoration: none;
}

.eq-value {
  color: var(--ink);
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.eq-track {
  display: flex;
  align-items: flex-end;
  height: 168px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px 8px 3px 3px;
  background:
    repeating-linear-gradient(0deg, rgba(148, 163, 184, 0.14) 0 2px, transparent 2px 9px),
    #f8fafc;
}

.eq-fill {
  width: 100%;
  height: 0;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--cyan), var(--magenta));
  box-shadow: 0 -6px 18px rgba(255, 46, 136, 0.22);
  transition: height 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

.eq-col.is-top .eq-fill { background: linear-gradient(180deg, #ff5aa2, #be185d); }

.eq-col:hover .eq-fill,
.eq-col:focus-visible .eq-fill { filter: brightness(1.1); }

.eq-col:hover .eq-label { color: var(--magenta-ink); }

.eq-label {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 0.63rem;
  font-weight: 800;
  line-height: 1.2;
}

.eq-sub {
  display: block;
  margin-top: 1px;
  color: #64748b;
  font-size: 0.56rem;
  line-height: 1.25;
}

/* Ruta TTWO */

.route-section { padding-top: 6px; }

.route-tag {
  flex: 0 0 auto;
  padding: 4px 9px;
  border: 1px dashed #cbd5e1;
  border-radius: 999px;
  color: #64748b;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.route svg { display: block; width: 100%; height: auto; overflow: visible; }

.route .route-grid { stroke: #e2e8f0; stroke-width: 1; }

.route .route-axis {
  fill: #64748b;
  font-family: var(--font);
  font-size: 10px;
}

.route .route-label {
  fill: var(--ink);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 800;
}

.route .road-band {
  fill: none;
  stroke: #0f172a;
  stroke-width: 9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.route .road-dash {
  fill: none;
  stroke: var(--yellow);
  stroke-width: 1.2;
  stroke-dasharray: 6 7;
  opacity: 0.72;
}

.route .route-line {
  fill: none;
  stroke: var(--magenta);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 3px rgba(255, 46, 136, 0.5));
}

.route .car-body { fill: var(--cyan); }
.route .car-cabin { fill: #0b1020; }
.route .car-wheel { fill: #0b1020; stroke: #e2e8f0; stroke-width: 1; }
.route .car-glow { fill: var(--magenta); opacity: 0.55; }

.route .hover-marker { fill: #ffffff; stroke: var(--magenta); stroke-width: 2; }

.route-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.route-stat {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
}

.route-stat span {
  display: block;
  color: #64748b;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.route-stat strong {
  display: block;
  margin-top: 2px;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

/* Fichas de caso */

.claim-id { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.claim-file {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.61rem;
  letter-spacing: 0.01em;
}

.claim:hover .claim-file { color: var(--magenta-ink); }

.claim-status {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.59rem;
}

/* Responsive del híbrido */

@media (max-width: 980px) {
  .eq-track { height: 200px; }
}

@media (max-width: 640px) {
  .card-tools { width: 100%; align-items: stretch; }
  .pulse-badge { align-self: flex-start; }
  .boot-title { margin-bottom: 26px; }
  .eq { gap: 5px; }
  .eq-track { height: 150px; }
  .eq-value { font-size: 0.68rem; }
  .eq-label { font-size: 0.56rem; }
  .eq-sub { display: none; }
  .route-tag { align-self: flex-start; }
  .route-stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.2s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.2s !important;
  }
  .js .boot { display: none; }
  .js .chart-sky .series { stroke-dashoffset: 0 !important; animation: none !important; }
  .js .chart-sky .series-halo { opacity: 0.85 !important; animation: none !important; }
  .chart-sky .peak-halo { animation: none !important; opacity: 0.35; }
  .pulse-badge.is-live .pulse-dot { animation: none !important; }
  .eq-fill { transition: none !important; }
}
