:root {
  color-scheme: light;
  --bg: #f3eee8;
  --bg-deep: #e7e0d8;
  --surface: #f3eee8;
  --surface-2: #e8e1d8;
  --sidebar: #f3eee8;
  --border: #ddd4c8;
  --line: rgba(28, 20, 18, .12);
  --ink: #1c1412;
  --ink-2: #4e433c;
  --muted: #7a6e66;
  --grid: #e4dcd2;
  --axis: #cfc4b8;
  --brand: #e1251b;
  --brand-ink: #c81f16;
  --brand-soft: #f8e4df;
  --brand-tint: #fbf3f0;
  --up: #1d6fd1;
  --up-ink: #1859a8;
  --neutral-cell: #ece7e1;
  --shadow: none;
  --hero-ink: #f6f1ea;
  --hero-dim: rgba(246, 241, 234, .72);
  --seg-bg: rgba(28, 20, 18, .04);
  --s-fotocasa: #2a78d6;
  --s-pisoscom: #eb6834;
  --s-habitaclia: #1baf7a;
  --s-idealista: #eda100;
  --d-n4: #a50f15; --d-n3: #d7301f; --d-n2: #f0705a; --d-n1: #fbb4a5;
  --d-0: #eeeef0;
  --d-p1: #b7d3f6; --d-p2: #6da7ec; --d-p3: #2a78d6; --d-p4: #184f95;
  --q1: #fde2df; --q2: #f9b3aa; --q3: #f2766a; --q4: #e1251b; --q5: #a3150e;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #110e0c;
  --bg-deep: #1a1411;
  --surface: #110e0c;
  --surface-2: #241c18;
  --sidebar: #110e0c;
  --border: #3a302a;
  --line: rgba(246, 241, 234, .14);
  --ink: #f6f1ea;
  --ink-2: #d9cfc4;
  --muted: #b3a79c;
  --grid: #2c241f;
  --axis: #4a3e36;
  --brand: #ff5d4d;
  --brand-ink: #ffb0a4;
  --brand-soft: #3a221e;
  --brand-tint: #2a1a17;
  --up: #7eb6ff;
  --up-ink: #b7d4ff;
  --neutral-cell: #3a332e;
  --shadow: none;
  --seg-bg: rgba(246, 241, 234, .05);
  --s-fotocasa: #3987e5; --s-pisoscom: #d95926; --s-habitaclia: #199e70; --s-idealista: #c98500;
  --d-n4: #ff8a7a; --d-n3: #e8574a; --d-n2: #b33a2f; --d-n1: #6e2a24;
  --d-0: #38332f;
  --d-p1: #1f3d63; --d-p2: #255a9a; --d-p3: #3987e5; --d-p4: #86b6ef;
  --q1: #3a1d1b; --q2: #6e2a24; --q3: #b33a2f; --q4: #e8574a; --q5: #ff8a7a;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
a { color: inherit; }
button, select, input { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--brand) 35%, transparent); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.view[hidden] { display: none !important; }

.sheet { min-height: 100vh; position: relative; }

/* ---------- Mast ---------- */
.mast {
  position: absolute;
  z-index: 30;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 30px 100px;
  color: var(--hero-ink);
  background: linear-gradient(to bottom, rgba(8, 6, 5, .62), rgba(8, 6, 5, 0));
  transition: background .3s ease, color .3s ease, box-shadow .3s ease;
}
.mast.is-solid,
body:not(.on-overview) .mast {
  position: relative;
  color: var(--ink);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 var(--line);
}
.brand {
  display: flex; align-items: center;
  text-decoration: none;
  flex: none;
  line-height: 0;
  background: none;
}
.brand img {
  display: block;
  height: 24px;
  width: auto;
  max-width: min(200px, 48vw);
}
.nav { display: flex; align-items: center; gap: 16px; min-width: 0; }
.nav a {
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  opacity: .72;
  padding: 4px 0;
  transition: opacity .25s ease, color .25s ease;
}
.nav a:hover, .nav a.active { opacity: 1; }
.nav a.active { color: var(--brand-ink); }
body.on-overview .mast:not(.is-solid) .nav a.active { color: #ffb0a4; }
.mast-meta { margin-left: auto; display: flex; align-items: center; gap: 14px; min-width: 0; }
.live-meta { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: inherit; opacity: .88; font-variant-numeric: tabular-nums; }
#updateInfo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #3dbe86; flex: none; }
.dot.stale { background: #e0a43a; }
.dot.down { background: var(--muted); }
.back-home {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
  font-size: 13px;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.back-home:hover { color: var(--brand-ink); border-color: var(--brand); }
.back-home[hidden] { display: none !important; }

#searchSlotMast:empty { display: none; }
#searchSlotMast:not(:empty) { flex: 1 1 220px; }

.search {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(246, 241, 234, .4);
  max-width: 440px;
}
.search-hits {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 4px);
  z-index: 6;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 6px 0;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
  max-height: 240px;
  overflow: auto;
}
.search-hits[hidden] { display: none !important; }
.search-hits button {
  display: block;
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  padding: 8px 12px;
  cursor: pointer;
  color: inherit;
  font-size: 14px;
}
.search-hits button:hover { background: var(--surface-2); }
.search svg { width: 16px; height: 16px; flex: none; opacity: .75; }
.search input {
  border: 0; outline: 0; background: none; width: 100%;
  font-size: 14.5px; color: var(--hero-ink);
}
.search input::placeholder { color: rgba(246, 241, 234, .62); }
.mast .search { border-bottom-color: var(--line); max-width: none; }
.mast .search input { color: var(--ink); }
.mast .search input::placeholder { color: var(--muted); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 70svh;
  padding: 108px 6vw 36px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: var(--hero-ink);
  overflow: hidden;
  scroll-margin-top: 0;
}
.hero-photo {
  position: absolute; inset: 0;
  background: url("assets/hero.jpg") center 58% / cover no-repeat;
  filter: saturate(.8) contrast(1.05) brightness(.62) sepia(.42);
  transform: scale(1.04);
}
.hero-shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(100deg, rgba(10, 7, 6, .9) 0%, rgba(10, 7, 6, .62) 46%, rgba(10, 7, 6, .28) 100%),
    linear-gradient(180deg, rgba(10, 7, 6, .55) 0%, rgba(10, 7, 6, .08) 30%, rgba(10, 7, 6, .2) 58%, rgba(10, 7, 6, .82) 100%);
}
.hero-fade {
  position: absolute; left: 0; right: 0; bottom: 0; height: 140px;
  background: linear-gradient(to bottom, transparent, var(--bg));
}
.hero-grid { position: relative; z-index: 1; }
.hero-grid {
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, .85fr);
  gap: 28px 48px;
  align-items: end;
}
.eyebrow, .kicker {
  margin: 0 0 12px;
  color: var(--brand-ink);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hero .eyebrow { color: #ffb0a4; }
.pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 0 var(--brand);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 55%, transparent); }
  70% { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.hero h1 {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 800;
  font-size: clamp(48px, 6.2vw, 92px);
  line-height: .96;
  letter-spacing: -.02em;
  margin: 0 0 18px;
  text-wrap: balance;
}
.hero h1 em { font-style: italic; color: #ffb0a4; }
.lead, .deck { margin: 0; color: var(--ink-2); font-size: 16.5px; max-width: 46ch; }
.hero .lead { color: var(--hero-dim); font-size: 17px; max-width: 38ch; }
.hero-copy .search { margin-top: 26px; }
.hero-figure { text-align: right; }
.hero-number {
  font-size: clamp(56px, 8vw, 108px);
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: .9;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.hero-delta-unit {
  margin: 10px 0 22px;
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 650;
  letter-spacing: -.01em;
  color: var(--hero-ink);
}
.figure-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--hero-dim);
}
.hero-stock {
  font-size: clamp(28px, 3.2vw, 42px);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.down-c { color: var(--brand-ink); }
.up-c { color: var(--up-ink); }
.flat-c { color: var(--ink-2); }
.hero-figure .down-c { color: #ffb0a4; }
.hero-figure .up-c { color: #b7d4ff; }
.hero-figure .flat-c { color: var(--hero-dim); }

/* ---------- Section progress ---------- */
.sp {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
}
.sp.is-on {
  opacity: 1;
  transform: translateX(-50%);
  pointer-events: auto;
}
.sp[hidden] { display: none !important; }
.sp-card {
  min-width: 168px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
  overflow: hidden;
  transition: border-radius .28s ease;
}
.sp.is-open .sp-card { border-radius: 22px; }
.sp-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 0;
  opacity: 0;
  padding: 0 8px;
  overflow: hidden;
  transition: max-height .32s ease, opacity .22s ease, padding .28s ease;
}
.sp.is-open .sp-list {
  max-height: 280px;
  opacity: 1;
  padding: 10px 8px 4px;
  overflow-y: auto;
}
.sp-list button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.sp-list button:hover { color: var(--ink); }
.sp-list button.on {
  background: color-mix(in srgb, var(--ink) 9%, transparent);
  color: var(--ink);
}
.sp-list button::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.sp-list button.on::before { background: var(--ink); }
.sp-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: none;
  padding: 8px 16px 8px 10px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 650;
  font-size: 14px;
}
.sp-ring {
  width: 22px;
  height: 22px;
  flex: none;
  transform: rotate(-90deg);
  stroke-width: 2;
}
.sp-ring-track { stroke: var(--line); }
.sp-ring-fill {
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset .28s ease-out;
}
.band-colophon { padding-bottom: 40px; }

.band-pins { padding-top: 72px; padding-bottom: 24px; }
.band-pins .band-head {
  position: relative;
  z-index: 4;
}
.band-pins .deck,
#territorio .deck,
#cortes .deck,
#portales-banda .deck,
#flujo .deck,
#metodo .deck { max-width: none; }
.pin-drop-host {
  width: 100%;
  min-height: min(520px, 70svh);
  height: min(560px, 72svh);
  margin-top: 8px;
  overflow: hidden;
  position: relative;
  z-index: 1;
  pointer-events: none;
}

/* ---------- Bands ---------- */
.band { padding: 84px 6vw; scroll-margin-top: 16px; }
.band-inner { max-width: 1120px; margin: 0 auto; }
.band-wide { max-width: 1200px; }
.band-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 32px;
}
.band h2, .appendix h2, .block h2 {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 800;
  font-size: clamp(34px, 4.4vw, 58px);
  line-height: .98;
  letter-spacing: -.02em;
  margin: 0 0 12px;
  text-wrap: balance;
}
.hint { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.deck-tight { font-size: 14px; margin-bottom: 8px; }

.cuts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 32px;
  border-top: 1px solid var(--line);
}
.cut { padding: 22px 20px 8px 0; border-left: 1px solid var(--line); min-width: 0; }
.cut:first-child { border-left: 0; }
.cut + .cut { padding-left: 20px; }
.cut-label { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.cut-abs {
  margin-top: 8px;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cut-unit { margin-top: 4px; font-size: 13px; color: var(--ink-2); }
.cut-pct, .cut-since { font-size: 12.5px; color: var(--muted); }
.cut-spark { height: 36px; margin-top: 8px; }
.cut-spark svg { width: 100%; height: 36px; display: block; }

.seg {
  position: relative;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--seg-bg);
  flex: none;
  overflow: hidden;
}
.seg button {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 13px;
  transition: color .25s ease;
}
.seg button.on { color: var(--brand-ink); }
.seg button:hover { color: var(--ink); }
.seg-glider {
  position: absolute;
  left: 4px; top: 4px;
  border-radius: 999px;
  background: var(--brand-soft);
  transition: left .28s ease, top .28s ease, width .28s ease, height .28s ease;
  z-index: 0;
  pointer-events: none;
}

.bento {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  grid-template-areas: "rank map";
  align-items: start;
  gap: 28px 56px;
  margin-top: 36px;
}
.tile-rank { grid-area: rank; }
.tile-map { grid-area: map; }
.rank-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: -.02em;
  font-weight: 700;
}
.rank-head #rankRest { font-weight: 700; }
.rank-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  color: inherit;
  font: inherit;
  font-weight: 800;
  letter-spacing: -.02em;
  border-bottom: 1px dashed color-mix(in srgb, var(--ink) 28%, transparent);
  transition: color .25s ease, border-color .25s ease;
}
.rank-switch:hover { color: var(--brand-ink); border-bottom-color: var(--brand); }
.rank-switch svg {
  width: 18px;
  height: 18px;
  flex: none;
  transition: transform .35s ease;
}
.rank-switch.is-city svg { transform: rotate(180deg); }
.deck-switch {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  margin: 0 1px;
  font: inherit;
  font-weight: 650;
  letter-spacing: inherit;
  color: inherit;
  vertical-align: baseline;
  position: relative;
  z-index: 5;
  pointer-events: auto;
  cursor: pointer;
}
.deck-switch svg {
  width: 15px;
  height: 15px;
  align-self: center;
}
.rank-table { min-height: 1px; }
.rank-table.is-swap .rank-list { animation: rankSwap .4s ease-out both; }
@keyframes rankSwap {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.tile h3 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: -.02em;
}
.tile-links { margin: 14px 0 0; font-size: 14px; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.tile-links a {
  color: var(--brand-ink);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--brand) 45%, transparent);
  transition: border-color .25s ease, color .25s ease;
}
.tile-links a:hover { border-bottom-color: var(--brand-ink); }

.more-btn {
  margin-top: 4px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--ink-2);
  font-weight: 650;
  cursor: pointer;
  transition: color .25s ease, border-color .25s ease;
}
.more-btn:hover { color: var(--brand-ink); border-bottom-color: var(--brand); }
.more-btn[hidden] { display: none; }

.rank-row {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) auto;
  column-gap: 12px;
  row-gap: 6px;
  padding: 11px 8px;
  border-top: 1px solid var(--line);
  border-radius: 8px;
  transition: background-color .25s ease;
}
.rank-row:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.rank-row.hl { background: var(--brand-soft); }
.rank-row.is-extra { display: none; }
.rank-i {
  grid-row: 1 / span 2;
  align-self: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.rank-i.top { color: var(--brand-ink); font-weight: 800; }
.rank-name { min-width: 0; }
.rank-name strong { display: block; font-size: 15px; letter-spacing: -.01em; }
.rank-name span { display: block; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.rank-delta {
  text-align: right;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.rank-delta small { font-size: 11px; font-weight: 650; margin-left: 3px; }
.rank-pct { display: block; margin-top: 4px; font-size: 11px; font-weight: 600; font-style: normal; color: var(--muted); }
.vbar-track {
  grid-column: 2 / span 2;
  height: 7px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}
.vbar-fill { height: 100%; border-radius: inherit; transform-origin: left center; }
.rank-list.enter .vbar-fill { animation: barIn .7s ease-out both; }
.rank-list.enter .rank-row:nth-child(2) .vbar-fill { animation-delay: .04s; }
.rank-list.enter .rank-row:nth-child(3) .vbar-fill { animation-delay: .08s; }
.rank-list.enter .rank-row:nth-child(4) .vbar-fill { animation-delay: .12s; }
.rank-list.enter .rank-row:nth-child(5) .vbar-fill { animation-delay: .16s; }
.rank-list.enter .rank-row:nth-child(6) .vbar-fill { animation-delay: .2s; }
.rank-list.enter .rank-row:nth-child(n + 7) .vbar-fill { animation-delay: .24s; }
@keyframes barIn { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.since-note { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }

.map-stage { position: relative; }
.map-full {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--ink);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: background .25s ease, color .25s ease;
}
.map-full:hover { color: var(--brand-ink); background: var(--brand-soft); }
.map-full svg { width: 18px; height: 18px; }

.map { position: relative; min-height: 460px; }
.map.big { min-height: 560px; }
.map svg path.prov { stroke: var(--bg); stroke-width: .7; cursor: pointer; transition: stroke .2s ease, stroke-width .2s ease; }
.map svg path.prov:hover, .map svg path.prov.hl { stroke: var(--ink); stroke-width: 1.6; }
.map svg path.borders { stroke: var(--bg); stroke-width: 1.6; fill: none; pointer-events: none; }
.map svg path.canary-box { stroke: var(--axis); stroke-width: 1; fill: none; }
.legend {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; color: var(--ink-2);
  position: absolute; left: 0; top: 0; z-index: 1;
  max-width: 46%;
  padding: 8px 10px 8px 0;
  background: linear-gradient(90deg, var(--bg) 70%, transparent);
}
.legend .row { display: flex; align-items: center; gap: 7px; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend .ttl { font-weight: 700; color: var(--ink); margin-bottom: 2px; }

/* ---------- Evolution ---------- */
.band-evolution { position: relative; padding-top: 96px; padding-bottom: 96px; }
.band-evolution .band-inner { position: relative; }
.chart-hero { min-height: 420px; margin-top: 12px; }
.chart { position: relative; min-height: 160px; }
.chart.tall { min-height: 360px; }
.empty-note {
  display: grid; place-items: center;
  min-height: 160px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 16px;
}

.share-bar {
  display: flex;
  height: 16px;
  gap: 3px;
  margin: 28px 0 8px;
}
.share-bar span { min-width: 6px; border-radius: 99px; }
.portal-list { margin-top: 8px; }
.portal-row {
  display: grid;
  grid-template-columns: minmax(108px, 170px) minmax(0, 1.1fr) auto auto;
  gap: 6px 18px;
  align-items: center;
  padding: 16px 8px;
  border-top: 1px solid var(--line);
  border-radius: 10px;
  transition: background-color .25s ease;
}
.portal-row:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.portal-count {
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.portal-count small, .portal-miss { display: block; margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.portal-delta {
  text-align: right;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.3;
  max-width: 16rem;
  font-variant-numeric: tabular-nums;
}
.portal-spark { width: 92px; }
.portal-spark svg { display: block; width: 100%; }
.portal-method, .portal-status { grid-column: 1 / -1; margin: 0; font-size: 12.5px; color: var(--muted); }
.chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 86px; padding: 5px 10px; border-radius: 999px;
  font-weight: 750; font-size: 13px; letter-spacing: -.01em;
}
.chip.outline { box-shadow: inset 0 0 0 1px var(--axis); }
.chip.off { opacity: .6; }
.na { color: var(--muted); font-weight: 600; }
.status-ok { color: var(--ink-2); }
.status-bad { color: var(--brand-ink); font-weight: 700; }

.flow-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 56px;
  margin-top: 28px;
}
.flow-label { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.flow-num {
  font-size: clamp(42px, 5vw, 72px);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: .95;
  color: var(--brand-ink);
  font-variant-numeric: tabular-nums;
  margin: 6px 0 8px;
}
.flow-num.up { color: var(--up-ink); }
.footnote { font-size: 13px; color: var(--muted); margin: 28px 0 0; }
.source-line {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.tile-map .source-line { margin-top: 10px; }
.band-evolution .footnote { margin-top: 8px; }

.site-foot {
  padding: 40px 6vw 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
}
body.on-overview .site-foot { padding-bottom: 128px; }
.foot-brand {
  display: block;
  line-height: 0;
  text-decoration: none;
  background: none;
}
.foot-brand img {
  display: block;
  height: 40px;
  width: auto;
  max-width: min(280px, 70vw);
}
.foot-tag {
  margin: 0;
  max-width: 52ch;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}
.foot-nav {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  font-size: 13px;
  font-weight: 650;
}
.foot-nav a { text-decoration: none; }
.foot-nav a:hover { color: var(--brand-ink); }

.band-colophon { padding-top: 20px; }
.follow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 36px;
  border-top: 1px solid var(--line);
}
.follow a {
  display: block;
  padding: 28px 28px 22px 0;
  text-decoration: none;
  color: inherit;
  border-left: 1px solid var(--line);
  min-width: 0;
}
.follow a:nth-child(odd) { border-left: 0; }
.follow a:nth-child(even) { padding-left: 28px; }
.follow a:nth-child(n + 3) { border-top: 1px solid var(--line); }
.follow strong {
  display: block;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 800;
  font-size: clamp(22px, 2.4vw, 30px);
  letter-spacing: -.02em;
  line-height: 1.1;
}
.follow span {
  display: block;
  margin-top: 8px;
  font-size: 14.5px;
  color: var(--muted);
  max-width: none;
}
.follow a:hover strong { color: var(--brand-ink); }
.downloads { display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 22px 0 8px; }
.btn {
  display: inline-block;
  padding: 8px 2px;
  color: var(--brand-ink);
  text-decoration: none;
  font-weight: 700;
  border-bottom: 1px solid color-mix(in srgb, var(--brand) 55%, transparent);
  transition: border-color .25s ease, color .25s ease;
}
.btn:hover { border-bottom-color: var(--brand-ink); }

/* ---------- Charts ---------- */
.chart svg, .map svg { display: block; width: 100%; overflow: visible; stroke: none; fill: none; }
.view:not([hidden]) .map { view-transition-name: spain-map; }
::view-transition-group(root),
::view-transition-old(root),
::view-transition-new(root),
::view-transition-group(spain-map),
::view-transition-old(spain-map),
::view-transition-new(spain-map) {
  animation-duration: .45s;
  animation-timing-function: ease;
}
.kpi-spark svg, .spark-cell svg, .cut-spark svg, .portal-spark svg { fill: none; }
.axis text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.axis path, .axis line { stroke: var(--axis); stroke-width: 1; }
.grid line { stroke: var(--grid); stroke-width: 1; }
.grid path { display: none; }
.series-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); margin: 8px 0; }
.series-legend span { display: inline-flex; align-items: center; gap: 6px; }
.series-legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.end-badge rect { fill: var(--brand); }
.end-badge text { fill: #fff; font-weight: 700; font-size: 12px; }
.crosshair { stroke: var(--axis); stroke-width: 1; }

.tooltip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-size: 12.5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
  min-width: 150px;
  font-variant-numeric: tabular-nums;
}
.tooltip .t { font-weight: 700; margin-bottom: 4px; }
.tooltip .r { display: flex; justify-content: space-between; gap: 14px; color: var(--ink-2); }
.tooltip .r b { color: var(--ink); font-weight: 700; }
.tooltip .r i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.cell-pct { display: block; font-size: 11px; font-weight: 600; color: var(--muted); }

/* ---------- Appendix ---------- */
.appendix { padding: 120px 6vw 80px; max-width: 1180px; margin: 0 auto; }
.block + .block { margin-top: 48px; }
.block-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px 24px; flex-wrap: wrap; margin-bottom: 12px;
}
.block-head h2 { margin-bottom: 0; }
#commFull, #provFull, #cityFull, #histTable, #portalFull { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
table.data th {
  font-size: 11.5px; font-weight: 650; color: var(--muted);
  text-align: left; padding: 8px 8px 10px; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.data th.num, table.data td.num { text-align: right; }
table.data td { padding: 9px 8px; border-top: 1px solid var(--grid); white-space: nowrap; }
table.data td.name { font-weight: 600; white-space: normal; }
table.data tr.hl td { background: var(--brand-tint); }
table.data th.sortable { cursor: pointer; user-select: none; transition: color .2s ease; }
table.data th.sortable:hover { color: var(--ink); }
.prose { max-width: 72ch; }
.prose h3 { margin: 28px 0 8px; font-size: 20px; }
.prose p, .prose li { font-size: 16px; color: var(--ink-2); }
.prose strong { color: var(--ink); }
.prose a { color: var(--brand-ink); }
.body { color: var(--ink-2); }

body.loading-data .mast::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--brand);
  transform-origin: left;
  animation: loadbar .9s ease-out infinite;
}
@keyframes loadbar {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-photo { animation: photoIn 1.4s ease-out both; }
  .hero-copy { animation: rise .7s ease-out both; }
  .hero-figure { animation: rise .85s ease-out .1s both; }
  .rank-list.is-open .rank-row.is-extra { animation: rise .35s ease-out; }
}
@keyframes photoIn { from { transform: scale(1.08); } to { transform: scale(1.02); } }
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pulse, .hero-photo, .hero-copy, .hero-figure, .vbar-fill, .seg-glider, .mast::after, .sp, .sp-list, .sp-ring-fill, .rank-table.is-swap .rank-list {
    animation: none !important;
    transition: none !important;
  }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}

@media (max-width: 980px) {
  .bento {
    grid-template-columns: 1fr;
    grid-template-areas: "rank" "map";
    gap: 32px;
  }
  .hero-grid { grid-template-columns: 1fr; min-height: 0; }
  .hero-figure { text-align: left; }
  .flow-grid { grid-template-columns: 1fr; }
  .cuts { grid-template-columns: 1fr 1fr; }
  .cut:nth-child(odd) { border-left: 0; padding-left: 0; }
  .cut:nth-child(3), .cut:nth-child(4) { border-top: 1px solid var(--line); }
}
@media (max-width: 820px) {
  .legend {
    position: static;
    max-width: none;
    flex-direction: row;
    flex-wrap: wrap;
    background: none;
    padding: 0 0 10px;
    gap: 4px 12px;
  }
  .legend .ttl { flex: 1 0 100%; }
  .mast,
  body.on-overview .mast,
  body.on-overview .mast:not(.is-solid) {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 16px 10px 22px;
  }
  body:not(.on-overview) .mast {
    position: relative;
    color: var(--ink);
    background: color-mix(in srgb, var(--bg) 96%, transparent);
    backdrop-filter: blur(16px);
    box-shadow: 0 1px 0 var(--line);
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .mast-meta { margin-left: auto; }
  body:not(.on-overview) .live-meta { display: none; }
  .live-meta { max-width: none; }
  #updateInfo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #searchSlotMast:not(:empty) {
    flex: 1 1 100%;
    order: 3;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  body:not(.on-overview) #searchSlotMast:not(:empty) .search { max-width: none; }
  .hero {
    min-height: 70svh;
    padding: 56px 20px 28px;
  }
  .band { padding: 56px 20px; scroll-margin-top: 16px; }
  .band-pins { padding-top: 40px; padding-bottom: 8px; }
  .pin-drop-host {
    min-height: 0;
    height: auto;
    aspect-ratio: 100 / 64;
    max-height: 280px;
  }
  .band-colophon { padding-bottom: 32px; }
  .site-foot { padding: 32px 20px 48px; }
  body.on-overview .site-foot { padding-bottom: 120px; }
  .appendix { padding: 28px 20px 56px; }
  .follow { grid-template-columns: 1fr; }
  .follow a,
  .follow a:nth-child(even) { border-left: 0; padding-left: 0; }
  .follow a + a { border-top: 1px solid var(--line); }
  .band-head, .block-head { flex-direction: column; align-items: flex-start; }
  .seg { width: 100%; }
  .seg button { flex: 1; padding: 8px 6px; text-align: center; }
  .portal-row { grid-template-columns: 1fr auto; }
  .portal-spark { grid-column: 1 / -1; width: 140px; }
  .hero h1 { font-size: clamp(42px, 12vw, 64px); }
  .map { min-height: 420px; }
  .chart-hero { min-height: 280px; }
}
@media (max-width: 420px) {
  .cuts { grid-template-columns: 1fr; }
  .cut, .cut + .cut, .cut:nth-child(3), .cut:nth-child(4) {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--line);
  }
  .cut:first-child { border-top: 0; }
}
