/* ============================================================
   29N · Comparador electoral
   Diseño editorial, claro/oscuro, responsive y sin dependencias.
   ============================================================ */

:root {
  --bg: #f7f4ee;
  --bg-soft: #efeae0;
  --surface: #fffdf8;
  --surface-2: #f3eee4;
  --ink: #171614;
  --ink-soft: #2c2925;
  --muted: #6d675d;
  --muted-2: #918a7e;
  --line: #ddd5c7;
  --line-strong: #c6bcab;
  --accent: #c8341f;
  --accent-soft: #f7ddd6;
  --accent-ink: #8e2112;
  --teal: #0f4c5c;
  --amber: #f0b429;
  --amber-soft: #fff2cf;
  --ok: #2f6b4f;
  --shadow-sm: 0 1px 2px rgba(23, 22, 20, .05), 0 4px 14px rgba(23, 22, 20, .04);
  --shadow-md: 0 2px 6px rgba(23, 22, 20, .06), 0 18px 44px rgba(23, 22, 20, .10);
  --radius: 16px;
  --radius-sm: 10px;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --heat-0: #ece6da;
  --heat-1: #f7d9d2;
  --heat-2: #efb4a7;
  --heat-3: #e2856e;
  --heat-4: #d2563b;
  --heat-5: #b72e18;
  --header-h: 68px;
}

[data-theme="dark"] {
  --bg: #141311;
  --bg-soft: #1a1815;
  --surface: #1e1b17;
  --surface-2: #26221d;
  --ink: #f4efe5;
  --ink-soft: #ddd6c9;
  --muted: #a9a195;
  --muted-2: #7f786d;
  --line: #36312a;
  --line-strong: #4a443a;
  --accent: #ff6f55;
  --accent-soft: #3a211b;
  --accent-ink: #ffa48f;
  --teal: #7fd1c7;
  --amber: #f4c04f;
  --amber-soft: #2c2515;
  --ok: #7fc7a1;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .2);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .35), 0 18px 44px rgba(0, 0, 0, .35);

  --heat-0: #26221d;
  --heat-1: #3d2620;
  --heat-2: #5b2d22;
  --heat-3: #7e3a29;
  --heat-4: #a94731;
  --heat-5: #d95b40;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(circle at 88% 8%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 34%),
    radial-gradient(circle at 8% 44%, color-mix(in srgb, var(--teal) 7%, transparent), transparent 38%),
    repeating-linear-gradient(0deg, transparent 0 79px, color-mix(in srgb, var(--line) 28%, transparent) 79px 80px);
  opacity: .9;
}

img, svg { max-width: 100%; }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }

::selection { background: var(--accent); color: #fff; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 3px;
  border-radius: 4px;
}

.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-link {
  position: fixed; top: 10px; left: 10px; z-index: 999;
  transform: translateY(-150%);
  background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }

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

.icon {
  width: 1.15em; height: 1.15em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- Cabecera ---------- */

.site-header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  min-height: var(--header-h);
  display: flex; align-items: center; gap: 24px;
}

.brand {
  display: inline-flex; align-items: center; gap: 12px;
  text-decoration: none; flex: none;
}

.brand-mark {
  width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
  font-family: var(--display); font-size: 20px; font-weight: 700;
  letter-spacing: -.06em; line-height: 1;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bg) 12%, transparent);
}
.brand-mark span { color: var(--accent); }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: .95rem; letter-spacing: -.01em; }
.brand-text span { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

.main-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }

.nav-link {
  display: inline-flex; align-items: center; gap: 7px;
  background: transparent; border: 0; color: var(--muted);
  padding: 8px 12px; border-radius: 999px;
  font-size: .86rem; font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.is-active { background: var(--ink); color: var(--bg); }
.nav-link .icon { width: 1em; height: 1em; }

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

.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); border-radius: 10px;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.icon-btn:active { transform: scale(.96); }
.icon-btn.small { width: 34px; height: 34px; border-radius: 8px; }

.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* ---------- Héroe ---------- */

.hero { padding: 58px 0 38px; }

.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .65fr);
  gap: 48px; align-items: center;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 18px; color: var(--accent);
  font-size: .76rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
}
.eyebrow .icon { width: 1.1em; height: 1.1em; }

.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  70% { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.hero h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.9rem, 6.4vw, 5.6rem);
  font-weight: 600; line-height: .94; letter-spacing: -.045em;
  text-wrap: balance;
}
.hero h1 em { color: var(--accent); font-style: italic; font-weight: 500; }

.lead {
  max-width: 62ch; margin: 24px 0 0;
  color: var(--muted); font-size: clamp(1rem, 1.4vw, 1.18rem);
  line-height: 1.6;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.hero-hint { margin: 14px 0 0; color: var(--muted); font-size: .82rem; max-width: 58ch; }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 18px; border-radius: 10px;
  border: 1px solid transparent;
  font-size: .92rem; font-weight: 700; text-decoration: none;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--ink); color: var(--bg); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--ink-soft); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--surface); border-color: var(--ink); }

.stat-row {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0; margin: 36px 0 0; padding: 20px 0 0;
  border-top: 1px solid var(--line);
}
.stat-row > div { padding-right: 18px; }
.stat-row dt {
  font-size: .68rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: .12em; font-weight: 700;
}
.stat-row dd {
  margin: 4px 0 0; font-family: var(--display);
  font-size: clamp(1.5rem, 2.6vw, 2.15rem); line-height: 1;
}

.countdown-card {
  position: relative; overflow: hidden;
  background: #1b1916; color: #f4efe5;
  border-radius: 18px; padding: 30px 30px 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, .08);
}
.countdown-card::before,
.countdown-card::after {
  content: ""; position: absolute; width: 26px; height: 26px;
  background: var(--bg); border-radius: 50%; top: 52%;
}
.countdown-card::before { left: -13px; }
.countdown-card::after { right: -13px; }

.countdown-label {
  margin: 0; font-size: .7rem; text-transform: uppercase;
  letter-spacing: .18em; color: #bdb4a6;
}
.countdown-number {
  margin: 8px 0 0; font-family: var(--display);
  font-size: clamp(4.6rem, 8vw, 7rem); line-height: .82;
  letter-spacing: -.06em; color: #f4efe5;
}
.countdown-number::after { content: ""; }
.countdown-unit {
  margin: 10px 0 0; font-size: .95rem; color: #d8cfc1;
}
.countdown-date {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 22px; padding-top: 16px;
  border-top: 1px dashed rgba(255, 255, 255, .22);
  font-family: var(--mono); font-size: .82rem; letter-spacing: .06em;
  color: #f4efe5;
}
.countdown-date span:last-child { color: var(--amber); }
.countdown-note { margin: 14px 0 0; font-size: .74rem; color: #bdb4a6; }

/* ---------- Aviso ---------- */

.notice {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 18px 20px;
  background: var(--amber-soft);
  border: 1px solid color-mix(in srgb, var(--amber) 38%, var(--line));
  border-left: 4px solid var(--amber);
  border-radius: 12px;
  color: var(--ink);
}
.notice-icon { width: 22px; height: 22px; color: var(--accent-ink); margin-top: 2px; }
.notice strong { display: block; font-size: .98rem; }
.notice p { margin: 5px 0 0; color: var(--muted); font-size: .9rem; }
.notice a { color: var(--accent-ink); font-weight: 700; text-underline-offset: 2px; }

/* ---------- Panel de control ---------- */

.app-shell { padding: 30px 0 70px; scroll-margin-top: 90px; }

.control-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px 16px;
  box-shadow: var(--shadow-sm);
}

.control-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 18px; margin-bottom: 14px;
}
.control-head h2 {
  margin: 0; font-family: var(--display);
  font-size: 1.2rem; letter-spacing: -.02em;
}
.control-head p { margin: 3px 0 0; color: var(--muted); font-size: .82rem; }
.control-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.selection-count {
  font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  padding: 5px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}
.selection-count.is-max { background: var(--accent-soft); color: var(--accent-ink); }

.text-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; padding: 4px 2px;
  color: var(--muted); font-size: .82rem; font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--muted) 40%, transparent);
}
.text-btn:hover { color: var(--accent); text-decoration-color: currentColor; }
.text-btn.strong { color: var(--ink); text-decoration: none; font-size: .84rem; }
.text-btn.strong .icon { transition: transform .15s ease; }
.text-btn.strong:hover .icon { transform: translateX(3px); color: var(--accent); }

.party-picker {
  display: flex; flex-wrap: wrap; gap: 8px;
}

.party-chip {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 11px 7px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  transition: border-color .15s ease, background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.party-chip:hover { border-color: var(--line-strong); background: var(--surface-2); }
.party-chip.is-active {
  border-color: var(--party);
  background: color-mix(in srgb, var(--party) 9%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--party) 22%, transparent);
}
.party-chip:active { transform: scale(.98); }

.party-dot {
  width: 9px; height: 9px; border-radius: 50%;
  flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--party, var(--muted)) 16%, transparent);
}
.party-chip-text { display: flex; align-items: baseline; gap: 7px; line-height: 1; }
.party-chip-text strong { font-size: .82rem; letter-spacing: .01em; }
.party-chip-text span { font-size: .7rem; color: var(--muted); }
.chip-check {
  display: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--party); color: #fff; margin-left: 1px;
}
.chip-check .icon { width: 10px; height: 10px; stroke-width: 3; margin: auto; display: block; }
.party-chip.is-active .chip-check { display: grid; place-items: center; }

/* ---------- Barra de vistas ---------- */

.toolbar {
  position: sticky; top: var(--header-h); z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; padding: 14px 0;
  margin: 18px 0 8px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.view-tabs {
  display: inline-flex; gap: 3px; padding: 4px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; max-width: 100%; overflow-x: auto;
  scrollbar-width: none;
}
.view-tabs::-webkit-scrollbar { display: none; }
.tab-extra { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted);
  font-size: .8rem; font-weight: 700;
  transition: background .15s ease, color .15s ease;
}
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab.is-active { background: var(--ink); color: var(--bg); }
.tab .icon { width: 1em; height: 1em; }

.theme-current {
  display: flex; align-items: center; gap: 10px;
  min-width: 0; text-align: right;
}
.tc-icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent-ink);
}
.theme-current strong { display: block; font-size: .84rem; line-height: 1.2; }
.theme-current small {
  display: block; color: var(--muted); font-size: .72rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 34ch;
}

/* ---------- Espacio de trabajo ---------- */

.workspace {
  display: grid; grid-template-columns: 214px minmax(0, 1fr);
  gap: 30px; align-items: start; padding-top: 16px;
  min-width: 0; width: 100%; max-width: 100%; overflow: hidden;
}
.view-root { min-width: 0; width: 100%; max-width: 100%; overflow: hidden; }
.card-grid { min-width: 0; width: 100%; max-width: 100%; }
.workspace.no-rail { grid-template-columns: minmax(0, 1fr); }

.theme-rail {
  position: sticky; top: calc(var(--header-h) + 82px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow-sm);
}
.rail-label {
  margin: 4px 8px 8px; font-size: .64rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .16em; color: var(--muted-2);
}
.rail-list { display: flex; flex-direction: column; gap: 2px; }
.rail-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 8px 9px;
  background: transparent; border: 0; border-radius: 9px;
  color: var(--muted); text-align: left;
  font-size: .82rem; font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.rail-item:hover { background: var(--surface-2); color: var(--ink); }
.rail-item.is-active { background: var(--ink); color: var(--bg); }
.rail-item .icon { width: 1.05em; height: 1.05em; opacity: .9; }
.rail-name { flex: 1; }
.rail-count {
  font-size: .64rem; font-weight: 800; font-variant-numeric: tabular-nums;
  min-width: 18px; text-align: center; padding: 2px 4px;
  border-radius: 5px; background: var(--surface-2); color: var(--muted);
}
.rail-item.is-active .rail-count {
  background: color-mix(in srgb, var(--bg) 14%, transparent);
  color: var(--bg);
}

.view-root { min-width: 0; }

/* ---------- Cabecera de vista ---------- */

.view-head { margin: 4px 0 22px; }
.view-head .eyebrow { margin-bottom: 10px; color: var(--muted); }
.view-head-row {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 20px; flex-wrap: wrap;
}
.view-head h2 {
  margin: 0; font-family: var(--display);
  font-size: clamp(2rem, 2.9vw, 2.8rem);
  line-height: 1; letter-spacing: -.04em;
}
.view-question {
  margin: 7px 0 0; font-family: var(--display);
  font-style: italic; font-size: 1.08rem; color: var(--accent);
}
.view-intro { margin: 14px 0 0; color: var(--muted); font-size: .92rem; max-width: 70ch; }
.view-count {
  flex: none; padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: .74rem; font-weight: 700;
  white-space: nowrap;
}
.view-footnote {
  display: flex; gap: 8px; align-items: flex-start;
  margin: 18px 0 0; color: var(--muted); font-size: .78rem;
}
.view-footnote .icon { margin-top: .15em; color: var(--accent); }

/* ---------- Tarjetas ---------- */

.card-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px; align-items: stretch;
}
.card-grid.count-1 { grid-template-columns: minmax(0, 760px); }
.card-grid.count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-grid.count-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card-grid.count-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-grid.count-5, .card-grid.count-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 1180px) {
  .card-grid.count-3, .card-grid.count-5, .card-grid.count-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .card-grid.count-1, .card-grid.count-2, .card-grid.count-3,
  .card-grid.count-4, .card-grid.count-5, .card-grid.count-6 { grid-template-columns: 1fr; }
}

.party-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 20px 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  animation: fadeUp .35s ease both;
}
.party-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.party-card.is-empty { opacity: .88; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-stripe { position: absolute; inset: 0 0 auto; height: 4px; background: var(--party); }

.card-head { display: flex; align-items: flex-start; gap: 11px; margin-top: 4px; }
.avatar {
  width: 42px; height: 42px; border-radius: 11px;
  display: grid; place-items: center; flex: none;
  font-family: var(--sans); font-weight: 800; font-size: .72rem;
  letter-spacing: -.02em; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}
.avatar.sm { width: 32px; height: 32px; border-radius: 8px; font-size: .6rem; }
.avatar.xs { width: 22px; height: 22px; border-radius: 6px; font-size: .5rem; }
.avatar.lg { width: 58px; height: 58px; border-radius: 14px; font-size: .95rem; }

.card-party { min-width: 0; flex: 1; }
.card-party h3 {
  margin: 0; font-size: .98rem; line-height: 1.2; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis;
}
.card-party p { margin: 3px 0 0; color: var(--muted); font-size: .72rem; }

.base-badge {
  flex: none; padding: 4px 7px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--muted); font-family: var(--mono);
  font-size: .62rem; font-weight: 700; letter-spacing: .02em;
  white-space: nowrap;
}
.base-badge.tiny { font-size: .58rem; padding: 3px 5px; }

.card-summary {
  margin: 15px 0 0; font-size: .9rem; line-height: 1.55;
  color: var(--ink-soft); border: 0; background: none; padding: 0;
  text-align: left; width: 100%; cursor: pointer; font: inherit;
  display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical;
  overflow: hidden; text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--ink-soft) 25%, transparent);
  text-underline-offset: 3px;
}
.card-summary:hover { text-decoration-color: var(--accent); color: var(--accent-ink); }

.card-points {
  margin: 13px 0 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 6px;
}
.card-points li {
  position: relative; padding-left: 14px;
  font-size: .8rem; line-height: 1.45; color: var(--muted);
}
.card-points li::before {
  content: ""; position: absolute; left: 0; top: .52em;
  width: 5px; height: 5px; border-radius: 1px;
  background: var(--party);
}

.figure-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }
.figure {
  display: inline-flex; align-items: center;
  padding: 4px 8px; border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  color: var(--accent-ink); font-family: var(--mono);
  font-size: .68rem; font-weight: 700;
}

.tag-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 13px; }
.tag {
  display: inline-flex; align-items: center;
  padding: 3px 7px; border-radius: 5px;
  background: var(--surface-2); color: var(--muted);
  font-size: .64rem; font-weight: 700; letter-spacing: .02em;
  white-space: nowrap;
}
.tag-muted { opacity: .7; font-style: italic; }

.card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: auto; padding-top: 14px; border-top: 1px dashed var(--line);
}
.card-foot .text-btn { padding-top: 14px; margin-top: -14px; }
.source-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--muted); font-size: .7rem; font-weight: 700;
  text-decoration: none; white-space: nowrap;
}
.source-link:hover { color: var(--accent); }
.source-link .icon { width: .95em; height: .95em; }

/* ---------- Estado vacío ---------- */

.empty-state {
  display: grid; place-items: center; text-align: center;
  padding: 70px 24px; background: var(--surface);
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
}
.empty-mark {
  width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink);
  margin-bottom: 14px;
}
.empty-mark .icon { width: 26px; height: 26px; }
.empty-state h3 { margin: 0; font-family: var(--display); font-size: 1.4rem; }
.empty-state p { margin: 6px 0 18px; color: var(--muted); max-width: 48ch; font-size: .9rem; }

/* ---------- Tabla ---------- */

.table-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.dense-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.dense-table th, .dense-table td {
  padding: 14px 12px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.dense-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); color: var(--muted);
  font-size: .66rem; text-transform: uppercase; letter-spacing: .1em;
  border-bottom: 1px solid var(--line-strong);
}
.dense-table tbody tr:last-child th,
.dense-table tbody tr:last-child td { border-bottom: 0; }
.dense-table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.pt-cell { width: 190px; min-width: 170px; }
.pt-inline { display: inline-flex; align-items: center; gap: 9px; }
.pt-inline span:last-child { display: flex; flex-direction: column; line-height: 1.2; }
.pt-inline strong { font-size: .84rem; }
.pt-inline small { color: var(--muted); font-size: .68rem; font-weight: 500; }
.table-summary { margin: 0; color: var(--ink-soft); line-height: 1.5; }
.mini-list { margin: 0; padding-left: 15px; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.mini-list li { margin-bottom: 4px; }
.mini-list li:last-child { margin-bottom: 0; }
.row-action { width: 48px; text-align: right !important; }
.muted { color: var(--muted-2); }

/* ---------- Mapa de calor ---------- */

.map-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
}
.map-scroll { overflow-x: auto; }
.heatmap { width: 100%; border-collapse: separate; border-spacing: 4px; }
.heatmap th, .heatmap td { padding: 0; }
.heatmap thead th { font-weight: 700; }
.heat-th {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 4px 2px; color: var(--muted);
  font-size: .6rem; line-height: 1.1; text-align: center;
  min-width: 58px;
}
.heat-th .icon { width: 1.15em; height: 1.15em; }
.heat-corner {
  text-align: left; font-size: .62rem; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted-2);
  padding-left: 6px !important; min-width: 150px;
}
.heat-party { text-align: left; padding-right: 8px !important; min-width: 150px; }
.heat-cell {
  width: 100%; min-width: 52px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 7px;
  color: var(--ink); font-family: var(--mono);
  font-size: .8rem; font-weight: 800;
  transition: transform .12s ease, box-shadow .12s ease;
}
.heat-cell:hover { transform: scale(1.06); box-shadow: 0 0 0 2px var(--ink); z-index: 2; position: relative; }
.heat-cell.is-empty { color: var(--muted-2); font-weight: 500; }
.heat-0 { background: var(--heat-0); color: var(--muted-2); }
.heat-1 { background: var(--heat-1); }
.heat-2 { background: var(--heat-2); }
.heat-3 { background: var(--heat-3); color: #fff; }
.heat-4 { background: var(--heat-4); color: #fff; }
.heat-5 { background: var(--heat-5); color: #fff; }
.heat-coverage-head { font-size: .58rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); padding-left: 8px !important; }
.heat-coverage { padding-left: 10px !important; font-size: .76rem; color: var(--muted); white-space: nowrap; }
.heat-coverage strong { color: var(--ink); font-size: .9rem; }
.heat-legend {
  display: flex; align-items: center; justify-content: flex-end; gap: 5px;
  margin-top: 16px; color: var(--muted); font-size: .66rem;
}
.legend-swatch {
  width: 22px; height: 16px; border-radius: 4px;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: .58rem; font-weight: 700;
}

/* ---------- Documentos ---------- */

.docs-section { margin-top: 30px; }
.section-head { display: flex; align-items: baseline; gap: 10px; }
.section-head h3 {
  margin: 0; font-family: var(--display);
  font-size: 1.35rem; letter-spacing: -.02em;
}
.section-count {
  padding: 3px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  font-size: .66rem; font-weight: 800;
}
.section-note { margin: 6px 0 14px; color: var(--muted); font-size: .84rem; max-width: 78ch; }

.docs-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}
.doc-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 16px;
  border-top: 3px solid var(--party);
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease;
}
.doc-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.doc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.doc-year {
  font-family: var(--mono); font-size: .7rem; font-weight: 800;
  color: var(--accent-ink); background: var(--accent-soft);
  padding: 3px 6px; border-radius: 5px;
}
.doc-year.small { font-size: .6rem; padding: 2px 5px; }
.doc-kind { color: var(--muted); font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.doc-card h3 {
  margin: 10px 0 6px; font-size: .95rem; line-height: 1.3;
}
.doc-party { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--muted); font-size: .74rem; font-weight: 700; }
.doc-note { margin: 8px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.45; flex: 1; }
.doc-meta { margin: 10px 0 0; font-family: var(--mono); font-size: .66rem; color: var(--muted-2); }
.doc-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }

/* ---------- Método ---------- */

.method-head { max-width: 900px; }
.method-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.method-block {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 21px;
  box-shadow: var(--shadow-sm);
}
.method-warning {
  background: var(--amber-soft);
  border-color: color-mix(in srgb, var(--amber) 40%, var(--line));
}
.method-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--accent);
  margin-bottom: 12px;
}
.method-warning .method-icon { background: color-mix(in srgb, var(--amber) 25%, var(--surface)); }
.method-block h3 { margin: 0 0 8px; font-family: var(--display); font-size: 1.2rem; }
.method-block p { margin: 0 0 9px; color: var(--muted); font-size: .88rem; }
.method-block p:last-child { margin-bottom: 0; }
.method-block ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: .86rem; }
.method-block li { margin-bottom: 5px; }
.method-block li strong { color: var(--ink); }
.method-block code { font-family: var(--mono); font-size: .8em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.method-block a { color: var(--accent-ink); font-weight: 700; }

.method-status { margin-top: 30px; }
.method-status .table-card { margin-top: 14px; }
.status-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.status-table th, .status-table td { padding: 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.status-table thead th { background: var(--surface-2); color: var(--muted); font-size: .64rem; text-transform: uppercase; letter-spacing: .1em; }
.status-table tbody tr:last-child th, .status-table tbody tr:last-child td { border-bottom: 0; }
.status-pill {
  display: inline-block; padding: 3px 8px; border-radius: 5px;
  background: var(--surface-2); color: var(--ink);
  font-size: .68rem; font-weight: 700;
}
.status-pill.soft { background: color-mix(in srgb, var(--teal) 10%, var(--surface)); color: var(--teal); }
.status-pill.is-empty { background: var(--accent-soft); color: var(--accent-ink); }
.method-note { margin: 5px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.4; }
.has-2026 { color: var(--ok); font-weight: 800; }

.method-sources { margin-top: 30px; }
.source-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 2px; }
.source-list li {
  display: grid; grid-template-columns: minmax(260px, .9fr) 1.4fr;
  gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line);
  font-size: .84rem;
}
.source-list a { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; text-decoration: none; color: var(--accent-ink); }
.source-list a:hover { text-decoration: underline; }
.source-list span { color: var(--muted); }
.method-foot { margin-top: 18px; color: var(--muted-2); font-size: .76rem; }

/* ---------- Modal ---------- */

body.modal-open, body.search-open { overflow: hidden; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(12, 11, 10, .55);
  backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 34px 18px;
  overflow-y: auto;
  animation: fadeIn .18s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  position: relative; width: min(900px, 100%);
  margin: auto;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .35);
  overflow: hidden;
  animation: modalIn .24s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

.modal-stripe { height: 5px; background: var(--party); }
.modal-close { position: absolute; top: 14px; right: 14px; z-index: 2; background: var(--surface-2); }

.modal-head {
  display: flex; align-items: center; gap: 16px;
  padding: 26px 26px 0;
}
.modal-kicker {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0 0 4px; color: var(--accent);
  font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em;
}
.modal-kicker .icon { width: 1em; height: 1em; }
.modal-head h2 {
  margin: 0; font-family: var(--display);
  font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1; letter-spacing: -.03em;
}
.modal-sub { margin: 6px 0 0; color: var(--muted); font-size: .84rem; }
.modal-sub span { color: var(--ink); font-weight: 600; }

.modal-badges { display: flex; flex-wrap: wrap; gap: 6px; padding: 16px 26px 0; }

.modal-section { padding: 17px 26px; border-top: 1px solid var(--line); margin-top: 17px; }
.modal-section:first-of-type { margin-top: 18px; }
.modal-section h3 {
  margin: 0 0 8px; font-size: .68rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
}
.modal-summary { margin: 0; font-size: 1rem; line-height: 1.65; color: var(--ink-soft); }
.modal-ref {
  margin: 10px 0 0; font-size: .72rem; color: var(--muted);
  word-break: break-all; line-height: 1.4;
}
.modal-ref a { color: var(--accent-ink); text-underline-offset: 2px; }
.detail-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.detail-list li {
  position: relative; padding-left: 18px;
  font-size: .9rem; line-height: 1.55;
}
.detail-list li::before {
  content: ""; position: absolute; left: 0; top: .55em;
  width: 6px; height: 6px; border-radius: 1px; background: var(--party);
}
.modal-context {
  margin: 17px 26px 0; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface-2);
}
.modal-context summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; cursor: pointer;
  font-size: .78rem; font-weight: 800; color: var(--muted);
  list-style: none;
}
.modal-context summary::-webkit-details-marker { display: none; }
.modal-context summary .icon { transition: transform .15s ease; }
.modal-context[open] summary .icon { transform: rotate(90deg); }
.modal-context > div { padding: 0 14px 12px; }
.modal-context p { margin: 8px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.5; }

.modal-source { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.source-line { display: flex; align-items: flex-start; gap: 7px; margin: 0 0 10px; font-size: .82rem; }
.source-line .icon { margin-top: .18em; color: var(--accent); }
.source-line a { color: var(--ink); font-weight: 700; text-underline-offset: 2px; }
.modal-docs { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.modal-docs li { display: flex; align-items: center; gap: 8px; font-size: .78rem; }
.modal-docs a { flex: 1; color: var(--ink-soft); text-decoration: none; }
.modal-docs a:hover { color: var(--accent); text-decoration: underline; }
.doc-size { color: var(--muted-2); font-family: var(--mono); font-size: .64rem; white-space: nowrap; }
.modal-note { margin: 12px 0 0; color: var(--muted); font-size: .74rem; font-style: italic; }

.modal-foot {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 15px 26px; border-top: 1px solid var(--line);
  background: var(--surface);
}
.theme-step {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 11px;
  color: var(--ink); font-size: .76rem; font-weight: 700;
  transition: border-color .15s ease, background .15s ease;
}
.theme-step:hover { border-color: var(--ink); background: var(--surface-2); }
.theme-step span { display: flex; flex-direction: column; line-height: 1.2; }
.theme-step small { color: var(--muted); font-size: .6rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.theme-step.next { text-align: right; }

/* ---------- Buscador ---------- */

.search-backdrop {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(12, 11, 10, .55);
  backdrop-filter: blur(7px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 9vh 18px 24px;
  animation: fadeIn .16s ease both;
}
.search-panel {
  width: min(780px, 100%);
  background: var(--surface); border-radius: 18px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .35);
  overflow: hidden;
  animation: modalIn .22s cubic-bezier(.2, .8, .2, 1) both;
}
.search-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.search-bar > .icon { color: var(--muted); }
.search-bar input {
  flex: 1; min-width: 0; border: 0; background: transparent;
  color: var(--ink); font-size: 1.05rem; outline: none;
}
.search-bar input::placeholder { color: var(--muted-2); }
kbd {
  font-family: var(--mono); font-size: .62rem;
  padding: 2px 5px; border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 4px;
  background: var(--surface-2); color: var(--muted);
}
.search-bar kbd { flex: none; }
.search-hints {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: .7rem;
}
.hint-chip {
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); border-radius: 999px;
  padding: 3px 9px; font-size: .7rem; font-weight: 600;
}
.hint-chip:hover { border-color: var(--accent); color: var(--accent); }
.search-results { max-height: 52vh; overflow-y: auto; padding: 6px; }
.search-result {
  display: flex; flex-direction: column; gap: 4px;
  width: 100%; text-align: left; border: 0; background: transparent;
  padding: 10px 12px; border-radius: 9px; color: var(--ink);
}
.search-result:hover, .search-result.is-focused { background: var(--surface-2); }
.result-top { display: flex; align-items: center; gap: 7px; font-size: .72rem; }
.result-top strong { font-size: .76rem; }
.result-theme { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 700; }
.result-theme .icon { width: .95em; height: .95em; }
.result-base { margin-left: auto; font-family: var(--mono); font-size: .58rem; color: var(--muted-2); }
.result-text { color: var(--muted); font-size: .8rem; line-height: 1.45; }
.result-text mark { background: color-mix(in srgb, var(--amber) 55%, transparent); color: var(--ink); border-radius: 2px; padding: 0 1px; }
.search-empty { padding: 32px 18px; text-align: center; color: var(--muted); font-size: .84rem; }
.search-empty-title { margin: 0 0 6px; color: var(--ink); font-weight: 700; font-size: .92rem; }
.inline-link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.search-foot {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 16px; border-top: 1px solid var(--line);
  color: var(--muted-2); font-size: .64rem;
}
.search-foot kbd { margin-right: 2px; }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 200;
  transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 999px;
  font-size: .8rem; font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Pie ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 34px 0 44px;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; font-size: .8rem; color: var(--muted); }
.footer-brand { margin: 0 0 6px; font-family: var(--display); font-size: 1.1rem; color: var(--ink); }
.footer-title { margin: 0 0 6px; font-size: .64rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--muted-2); }
.site-footer p { margin: 4px 0; }
.site-footer a { color: var(--ink); text-underline-offset: 2px; }
.site-footer a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */

@media (max-width: 1120px) {
  .hero-grid { grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr); gap: 32px; }
  .workspace { grid-template-columns: 190px minmax(0, 1fr); gap: 22px; }
  .theme-current small { max-width: 26ch; }
}

@media (max-width: 980px) {
  .main-nav { display: none; }
  .tab-extra { display: inline-flex; }
  .header-actions { margin-left: auto; }
  .hero { padding-top: 40px; }
  .hero-grid { grid-template-columns: 1fr; }
  .countdown-card { max-width: 460px; }
  .method-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .wrap { width: min(100% - 32px, 1400px); }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .theme-rail {
    position: relative;
    top: auto;
    padding: 8px; border-radius: 12px;
    margin-bottom: 4px;
  }
  .theme-rail::after {
    content: "";
    position: absolute; top: 8px; right: 8px; bottom: 8px; width: 26px;
    pointer-events: none;
    background: linear-gradient(to right, transparent, var(--surface));
    border-radius: 0 10px 10px 0;
  }
  .rail-label { display: none; }
  .rail-list {
    flex-direction: row; overflow-x: auto; gap: 4px; scrollbar-width: thin;
    scroll-snap-type: x mandatory; padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }
  .rail-item { scroll-snap-align: start; }
  .rail-item { width: auto; flex: none; padding: 7px 10px; white-space: nowrap; }
  .rail-count { display: none; }
  .theme-rail::before {
    content: "Desliza para ver los 12 temas →";
    display: block; margin: 0 8px 8px;
    font-size: .66rem; font-weight: 700; color: var(--muted-2);
    letter-spacing: .04em;
  }
  .toolbar { flex-wrap: wrap; gap: 10px; }
  .theme-current { margin-left: auto; }
  .theme-current small { display: none; }
  .view-head-row { align-items: flex-start; }
  .dense-table thead { display: none; }
  .dense-table, .dense-table tbody, .dense-table tr, .dense-table th, .dense-table td { display: block; width: 100%; }
  .dense-table tr { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .dense-table tbody tr:last-child { border-bottom: 0; }
  .dense-table th, .dense-table td { padding: 4px 14px; border: 0; }
  .dense-table td[data-label]::before {
    content: attr(data-label); display: block;
    margin-bottom: 3px; color: var(--muted-2);
    font-size: .6rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em;
  }
  .pt-cell { width: auto; display: flex !important; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 8px !important; }
  .row-action { width: auto; text-align: left !important; padding-top: 8px !important; }
  .status-table thead { display: none; }
  .status-table, .status-table tbody, .status-table tr, .status-table th, .status-table td { display: block; width: 100%; }
  .status-table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .status-table th, .status-table td { padding: 4px 0; border: 0; }
  .status-table td[data-label]::before {
    content: attr(data-label) ": "; color: var(--muted-2);
    font-size: .64rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  }
  .source-list li { grid-template-columns: 1fr; gap: 3px; }
}

@media (max-width: 620px) {
  .wrap { width: calc(100% - 26px); }
  .header-inner { gap: 10px; }
  .brand-text span { display: none; }
  .brand-mark { width: 40px; height: 40px; border-radius: 10px; font-size: 18px; }
  .hero h1 { font-size: clamp(2.55rem, 12vw, 3.5rem); }
  .lead { font-size: .96rem; }
  .stat-row { grid-template-columns: repeat(2, 1fr); row-gap: 14px; }
  .countdown-card { padding: 24px; }
  .countdown-number { font-size: 5rem; }
  .control-panel { padding: 16px; }
  .control-head { flex-direction: column; gap: 8px; }
  .control-actions { width: 100%; }
  .selection-count { margin-right: auto; }
  .party-picker { gap: 6px; }
  .party-chip { padding: 6px 9px; }
  .party-chip-text span { display: none; }
  .toolbar { top: var(--header-h); }
  .view-tabs { width: 100%; justify-content: space-between; }
  .tab { flex: 1; justify-content: center; padding: 7px 8px; }
  .theme-current { display: none; }
  .card-grid { grid-template-columns: 1fr; }
  .view-head h2 { font-size: 2rem; }
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal { border-radius: 0; min-height: 100%; }
  .modal-head { padding: 22px 18px 0; gap: 12px; }
  .modal-badges, .modal-section, .modal-foot { padding-left: 18px; padding-right: 18px; }
  .modal-context { margin-left: 18px; margin-right: 18px; }
  .modal-close { top: 10px; right: 10px; }
  .search-backdrop { padding: 0; align-items: stretch; }
  .search-panel { border-radius: 0; min-height: 100%; }
  .search-results { max-height: calc(100vh - 190px); }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .heat-legend { justify-content: flex-start; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header, .hero-actions, .control-panel, .toolbar, .theme-rail, .site-footer, .view-footnote, .search-backdrop, .modal-backdrop { display: none !important; }
  body { background: #fff; color: #000; }
  body::before { display: none; }
  .wrap { width: 100%; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .party-card { break-inside: avoid; box-shadow: none; }
}


/* ---------- Modo familia ---------- */

.family-builder { margin-bottom: 24px; }
.family-builder .view-head { margin-bottom: 16px; }

.profile-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px; margin-top: 16px;
}
.profile-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); text-align: left;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.profile-chip:hover { border-color: var(--line-strong); background: var(--surface-2); }
.profile-chip.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}
.profile-chip .icon { width: 20px; height: 20px; color: var(--accent); flex: none; }
.profile-chip.is-active .icon { color: var(--accent-ink); }
.profile-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.profile-text strong { font-size: .84rem; }
.profile-text small { color: var(--muted); font-size: .7rem; }
.profile-chip .chip-check { display: none; }
.profile-chip.is-active .chip-check { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; }
.profile-chip.is-active .chip-check .icon { width: 10px; height: 10px; stroke-width: 3; }

.family-summary {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 14px; color: var(--muted); font-size: .82rem;
}
.family-summary .icon { margin-top: .15em; color: var(--accent); }
.family-summary.muted { color: var(--muted-2); font-style: italic; }

.family-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-top: 22px; }

.family-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 20px 16px;
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.family-card .card-stripe { position: absolute; inset: 0 0 auto; height: 4px; background: var(--party); }

.family-card-head { display: flex; align-items: center; gap: 11px; margin-top: 4px; margin-bottom: 14px; }
.family-card-head h3 { margin: 0; font-size: .98rem; }
.family-card-head p { margin: 3px 0 0; color: var(--muted); font-size: .72rem; }
.family-card-head .base-badge { margin-left: auto; }

.family-block { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.family-block:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.family-block h4 {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 8px; font-size: .74rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em; color: var(--accent-ink);
}
.family-block h4 .icon { width: 1em; height: 1em; }

.family-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.family-item {
  display: flex; flex-direction: column; gap: 4px;
  width: 100%; text-align: left; border: 1px solid var(--line);
  background: var(--surface-2); border-radius: 9px;
  padding: 10px 12px; color: var(--ink);
  transition: border-color .15s ease, background .15s ease;
}
.family-item:hover { border-color: var(--accent); background: var(--surface); }
.family-theme { display: flex; align-items: center; gap: 5px; font-size: .7rem; font-weight: 800; color: var(--accent-ink); text-transform: uppercase; letter-spacing: .06em; }
.family-theme .icon { width: 1em; height: 1em; }
.family-text { font-size: .82rem; line-height: 1.45; color: var(--ink-soft); }
.family-empty { color: var(--muted); font-size: .84rem; font-style: italic; margin: 12px 0 0; }

@media (max-width: 760px) {
  .profile-grid { grid-template-columns: 1fr; }
  .family-results { grid-template-columns: 1fr; }
}


/* ---------- Coherencia ---------- */

.coherencia-table .heat-th small { display: block; font-size: .55rem; color: var(--muted-2); font-weight: 500; text-transform: none; letter-spacing: 0; margin-top: 2px; }

.vote-pill {
  display: inline-block; padding: 4px 8px; border-radius: 6px;
  font-size: .68rem; font-weight: 700; text-transform: capitalize;
  white-space: nowrap;
}
.vote-yes { background: color-mix(in srgb, var(--ok) 18%, var(--surface)); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 35%, var(--line)); }
.vote-no { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent-ink); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); }
.vote-abstain { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.vote-pill.incoherent { box-shadow: 0 0 0 2px var(--accent); }

.coherence-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.coherence-list li { display: flex; align-items: center; gap: 8px; font-size: .8rem; }
.coherence-list li span:last-child { color: var(--muted); }
.coherence-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.coherence-notes li { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.coherence-notes li:last-child { padding-bottom: 0; border-bottom: 0; }
.coherence-notes strong { color: var(--ink); font-size: .8rem; }
.coh-ok { color: var(--ok); font-weight: 600; font-size: .72rem; }
.coh-warn { color: var(--accent-ink); font-weight: 700; font-size: .72rem; }
.coh-detail { color: var(--muted); font-size: .76rem; }
.vote-detail-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.vote-detail-body { padding-left: 4px; display: grid; gap: 2px; }
.vote-detail-row { font-size: .78rem; line-height: 1.4; }
.vote-detail-label { font-weight: 700; color: var(--ink); margin-right: 4px; }
.vote-detail-coh { margin-top: 2px; }

.party-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.party-summary-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; box-shadow: var(--shadow-sm); border-top: 3px solid var(--party); }
.party-summary-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.party-summary-head div { flex: 1; min-width: 0; }
.party-summary-head strong { font-size: .88rem; }
.party-summary-head small { display: block; color: var(--muted); font-size: .68rem; }
.party-summary-score { font-family: var(--mono); font-size: .72rem; font-weight: 800; padding: 3px 7px; border-radius: 5px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.party-summary-score.is-ok { background: color-mix(in srgb, var(--ok) 15%, var(--surface)); color: var(--ok); }
.party-summary-score.is-warn { background: var(--accent-soft); color: var(--accent-ink); }
.party-summary-ok { color: var(--ok); font-size: .82rem; font-weight: 600; margin: 0; }


/* ---------- Preguntas clave ---------- */

.pregunta-blocks { display: grid; gap: 12px; }

.pregunta-block {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}

.pregunta-block-head {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 16px 18px; background: transparent; border: 0;
  color: var(--ink); cursor: pointer; text-align: left;
  transition: background .15s ease;
}
.pregunta-block-head:hover { background: var(--surface-2); }
.pregunta-block.is-open .pregunta-block-head { background: var(--surface-2); }

.pregunta-block-num {
  font-family: var(--mono); font-size: .72rem; font-weight: 800;
  color: var(--accent); min-width: 24px;
}
.pregunta-block-title {
  flex: 1; font-family: var(--display); font-size: 1.05rem; font-weight: 600;
}
.pregunta-block-count {
  font-size: .72rem; color: var(--muted); font-weight: 600;
  padding: 3px 8px; background: var(--surface-2); border-radius: 999px;
}
.pregunta-block-chevron {
  color: var(--muted); transition: transform .2s ease;
}
.pregunta-block.is-open .pregunta-block-chevron { transform: rotate(90deg); }

.pregunta-block-intro {
  padding: 0 18px 14px; color: var(--muted); font-size: .82rem;
  line-height: 1.5; border-bottom: 1px solid var(--line);
}

.pregunta-list { padding: 8px 0; }

.pregunta-item {
  border-bottom: 1px solid var(--line);
}
.pregunta-item:last-child { border-bottom: 0; }

.pregunta-q {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  padding: 12px 18px; background: transparent; border: 0;
  color: var(--ink); cursor: pointer; text-align: left;
}
.pregunta-q:hover { background: var(--surface-2); }

.pregunta-q-num {
  font-family: var(--mono); font-size: .7rem; font-weight: 800;
  color: var(--muted); min-width: 28px; padding-top: 2px;
}
.pregunta-q-text {
  flex: 1; font-size: .88rem; line-height: 1.45; font-weight: 500;
}
.pregunta-q-chevron {
  color: var(--muted); transition: transform .2s ease; flex-shrink: 0;
  padding-top: 2px;
}
.pregunta-item.is-open .pregunta-q-chevron { transform: rotate(90deg); }

.pregunta-answers {
  padding: 8px 18px 16px 56px; display: grid; gap: 14px;
}

.pregunta-answer {
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 12px 14px; border-left: 3px solid var(--party);
}

.pregunta-answer-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.pregunta-answer-head strong { font-size: .84rem; }
.pregunta-answer-head small { color: var(--muted); font-size: .7rem; }

.pregunta-answer-text {
  font-size: .82rem; line-height: 1.5; margin: 0; color: var(--ink);
}

.pregunta-answer-label {
  font-size: .64rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); margin: 0 0 4px;
}

.pregunta-answer-source {
  font-size: .7rem; color: var(--muted); margin: 8px 0 0;
  display: flex; align-items: center; gap: 4px; word-break: break-all;
}
.pregunta-answer-source a { color: var(--accent-ink); text-decoration: underline; }

@media (max-width: 760px) {
  .pregunta-answers { padding-left: 18px; }
  .pregunta-block-head { padding: 12px 14px; }
  .pregunta-q { padding: 10px 14px; }
  .pregunta-answer { padding: 10px 12px; }
}

/* ---------- Encuestas ---------- */

.poll-switcher {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  margin-bottom: 14px;
}
.poll-switcher-label {
  font-size: .72rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted);
}
.poll-switcher-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.poll-source-btn {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: .8rem; font-weight: 700;
  cursor: pointer; transition: all .15s ease;
}
.poll-source-btn:hover { border-color: var(--accent); }
.poll-source-btn.is-active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

.poll-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
}
.poll-source { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: .78rem; margin-bottom: 14px; }
.poll-source .icon { margin-top: .15em; color: var(--accent); flex-shrink: 0; }
.poll-source p { margin: 0; line-height: 1.45; }
.poll-source p + p { margin-top: 6px; }
.poll-source a { color: var(--accent-ink); font-weight: 700; text-decoration: underline; }
.poll-source-note { font-size: .74rem; color: var(--muted); }

.poll-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.poll-table th, .poll-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.poll-table thead th { background: var(--surface-2); color: var(--muted); font-size: .64rem; text-transform: uppercase; letter-spacing: .1em; }
.poll-table tbody tr:last-child td { border-bottom: 0; }

.poll-party { min-width: 150px; }
.poll-toggle {
  display: flex; align-items: center; gap: 9px; width: 100%;
  background: transparent; border: 0; padding: 0; color: var(--ink); text-align: left;
  cursor: pointer;
}
.poll-toggle .chip-check { display: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: #fff; margin-left: auto; flex-shrink: 0; }
.poll-toggle .chip-check .icon { width: 10px; height: 10px; stroke-width: 3; margin: auto; display: block; }
.poll-toggle.is-active .chip-check { display: grid; place-items: center; }
.poll-toggle span { display: flex; flex-direction: column; line-height: 1.2; }
.poll-toggle small { color: var(--muted); font-size: .68rem; font-weight: 500; }

.poll-bar-cell { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.poll-bar { flex: 1; height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.poll-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.poll-pct-wrap { display: flex; flex-direction: column; align-items: flex-end; min-width: 72px; line-height: 1.15; }
.poll-pct { font-family: var(--mono); font-size: .78rem; font-weight: 700; text-align: right; }
.poll-direct { font-family: var(--mono); font-size: .62rem; color: var(--muted); }

.poll-seats { text-align: center; font-size: .8rem; }
.poll-seats strong { font-size: 1rem; }
.poll-seats small { color: var(--muted); font-size: .65rem; margin-left: 3px; display: inline-block; }
.poll-compare { text-align: center; font-family: var(--mono); font-size: .74rem; color: var(--muted); }

.poll-change { text-align: center; font-family: var(--mono); font-size: .78rem; font-weight: 700; }
.poll-change.up { color: var(--ok); }
.poll-change.down { color: var(--accent-ink); }
.poll-change.flat { color: var(--muted); }

.group-card {
  margin-top: 20px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm);
}
.group-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.group-head h3 { margin: 0; font-family: var(--display); font-size: 1.2rem; }
.group-head p { margin: 4px 0 0; color: var(--muted); font-size: .82rem; }
.group-selected { display: flex; flex-wrap: wrap; gap: 8px; min-height: 36px; padding: 10px; background: var(--surface-2); border-radius: 10px; margin-bottom: 14px; }
.group-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-size: .76rem; font-weight: 600;
}
.group-chip strong { font-family: var(--mono); }
.group-result {
  display: flex; align-items: center; gap: 16px; padding: 16px;
  background: var(--surface-2); border-radius: 12px; border: 2px solid var(--line);
}
.group-result.has-majority { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, var(--surface)); }
.group-number { font-family: var(--display); font-size: 2.6rem; line-height: 1; min-width: 60px; text-align: center; }
.group-meta { display: flex; flex-direction: column; gap: 2px; }
.group-meta strong { font-size: .95rem; }
.group-meta span { color: var(--muted); font-size: .78rem; }
.group-bar { flex: 1; height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; min-width: 80px; }
.group-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.group-result.has-majority .group-bar span { background: var(--ok); }

@media (max-width: 760px) {
  .poll-table thead { display: none; }
  .poll-table, .poll-table tbody, .poll-table tr, .poll-table th, .poll-table td { display: block; width: 100%; }
  .poll-table tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .poll-table td { padding: 4px 10px; border: 0; }
  .poll-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--muted-2); font-size: .6rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
  .group-result { flex-wrap: wrap; }
  .group-bar { min-width: 100%; }
}
