/* ============================================
   CALLEJEAR.COM — Design System
   ============================================
   Fonts: Fraunces (display/títulos) + DM Sans (body)
   Approach: Mobile-first, CSS custom properties
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Colors */
  --ink: #1a1a2e;
  --ink-soft: #4a4a5e;
  --ink-muted: #707083;
  --surface: #fafaf8;
  --surface-warm: #f5f3ee;
  --surface-card: #ffffff;
  --accent: #2d6a4f;
  --accent-light: #40916c;
  --accent-bg: #d8f3dc;
  --accent-bg-soft: #edf6f0;
  --border: #e8e6e1;
  --border-soft: #f0eee9;
  --red: #c1121f;
  --red-bg: #fdf0f0;
  --blue: #1d3557;
  --blue-bg: #e8f0f8;
  --amber: #e09f3e;
  --amber-bg: #fdf6e8;
  --purple: #6c47a0;
  --purple-bg: #f0eaf8;
  --cyan: #0891b2;
  --cyan-bg: #ecfeff;
  --orange: #ea580c;
  --orange-bg: #fff7ed;
  --teal: #0d9488;
  --teal-bg: #f0fdfa;
  --rose: #e11d48;
  --rose-bg: #fff1f2;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.06);
  --shadow: 0 4px 16px rgba(0,0,0,.06), 0 1px 4px rgba(0,0,0,.04);

  /* Spacing */
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;

  /* Typography */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--surface);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--accent-light); text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
}

h1 { font-size: 2rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.5rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
h4 { font-size: 1.05rem; margin-bottom: 0.4rem; }

p { margin-bottom: 1rem; color: var(--ink-soft); }

.text-muted { color: var(--ink-muted); }
.text-accent { color: var(--accent); }
.text-red { color: var(--red); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.8rem; }
.text-center { text-align: center; }

/* --- Layout --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr 320px;
  }
}

.content-area { min-width: 0; }
.sidebar { position: sticky; top: 1.5rem; }

/* --- Header --- */
.site-header {
  background: var(--surface-card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.logo:hover { color: var(--ink); text-decoration: none; }
.logo-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

.header-search {
  flex: 1;
  max-width: 400px;
}

.search-input {
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.search-input::placeholder { color: var(--ink-muted); }

.header-nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
}
.header-nav a { color: var(--ink-soft); }
.header-nav a:hover { color: var(--accent); text-decoration: none; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 4px;
}
.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

@media (max-width: 768px) {
  .header-search { display: none; }
  .header-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface-card);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.75rem 1.25rem;
    gap: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  }
  .header-nav.is-open { display: flex; }
  .header-nav a {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
  }
  .header-nav a:last-child { border-bottom: none; }
  .nav-toggle { display: flex; }
  .site-header { position: relative; }
}

/* --- Breadcrumb --- */
.breadcrumb {
  padding: 0.75rem 0;
  font-size: 0.85rem;
  color: var(--ink-muted);
}
.breadcrumb a { color: var(--ink-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep {
  margin: 0 0.4rem;
  color: var(--border);
}

/* --- Hero Section --- */
.hero {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: 2.25rem;
  font-weight: 900;
  margin-bottom: 0.3rem;
  letter-spacing: -0.02em;
}
.h1-geo {
  font-weight: 400;
  font-size: 0.6em;
  color: var(--ink-muted);
}
.hero-subtitle {
  font-size: 1.05rem;
  color: var(--ink-muted);
  margin-bottom: 1.25rem;
}
.hero-subtitle a { color: var(--ink-soft); }
.hero-subtitle a:hover { color: var(--accent); }

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-change {
  font-size: 0.8rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.stat-change.positive { color: var(--accent); }
.stat-change.negative { color: var(--red); }

/* --- Tags / Badges --- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--surface-warm);
  color: var(--ink-soft);
  border: 1px solid var(--border-soft);
}
.tag-accent { background: var(--accent-bg-soft); color: var(--accent); border-color: var(--accent-bg); }
.tag-blue { background: var(--blue-bg); color: var(--blue); }
.tag-amber { background: var(--amber-bg); color: var(--amber); }
.tag-red { background: var(--red-bg); color: var(--red); }
.tag-purple { background: var(--purple-bg); color: var(--purple); }
.tag-cyan { background: var(--cyan-bg); color: var(--cyan); }
.tag-orange { background: var(--orange-bg); color: var(--orange); }
.tag-teal { background: var(--teal-bg); color: var(--teal); }
.tag-rose { background: var(--rose-bg); color: var(--rose); }
.tag-default { background: var(--bg-muted, #f3f4f6); color: var(--text-muted); }

/* Equipamientos grid */
.equip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; }
.equip-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem; border-radius: 8px; background: var(--bg-muted, #f9fafb); }
.equip-icon { font-size: 1.3rem; }
.equip-info { display: flex; flex-direction: column; }
.equip-label { font-weight: 500; font-size: 0.85rem; }
.equip-detail { font-size: 0.75rem; color: var(--text-muted); }

/* Pendiente */
.pendiente-info { display: flex; flex-direction: column; gap: 1rem; }
.pendiente-main { display: flex; align-items: center; gap: 0.5rem; font-size: 1.1rem; font-weight: 600; }
.pendiente-icon { font-size: 1.4rem; }
.pendiente-stats { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.stat-mini { display: flex; flex-direction: column; align-items: center; }
.stat-mini .stat-value { font-size: 1.2rem; font-weight: 700; color: var(--ink); }
.stat-mini .stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

/* --- Cards --- */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-soft);
}
.card-icon { font-size: 1.2rem; }
.card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}
.card-source {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--ink-muted);
}
/* Quality Gate 2 — badge datos parciales + score unavailable */
.badge-partial {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: #fff3e0;
  color: #e65100;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid #ffcc80;
  vertical-align: middle;
  margin-right: 2px;
}
.score-unavailable {
  font-style: italic;
  color: var(--ink-muted);
}

/* --- Data Grid (key-value pairs) --- */
.data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.data-item { display: flex; flex-direction: column; }
.data-label {
  font-size: 0.8rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.15rem;
}
.data-value {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
}
.data-value.small { font-size: 1rem; }

/* --- Tables --- */
.table-wrapper { overflow-x: auto; margin: 0 -0.5rem; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
thead th {
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--border);
}
tbody td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-soft);
  color: var(--ink-soft);
}
tbody tr:hover { background: var(--surface-warm); }

.table-number {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
}

/* --- Chart placeholder (inline SVG charts) --- */
.chart-container {
  width: 100%;
  min-height: 200px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1rem 0;
}

.bar-chart { width: 100%; }
.bar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.bar-label {
  min-width: 80px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: right;
}
.bar-track {
  flex: 1;
  height: 24px;
  background: var(--surface);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}
.bar-fill.accent { background: var(--accent); }
.bar-fill.blue { background: var(--blue); }
.bar-fill.amber { background: var(--amber); }
.bar-fill.red { background: var(--red); }
.bar-fill.purple { background: var(--purple); }

.bar-value {
  min-width: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

/* --- Pyramid Chart --- */
.pyramid {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pyramid-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.4rem;
  align-items: center;
}
.pyramid-bar-left {
  display: flex;
  justify-content: flex-end;
}
.pyramid-bar-right {
  display: flex;
  justify-content: flex-start;
}
.pyramid-bar {
  height: 18px;
  border-radius: 3px;
  min-width: 2px;
  transition: width 0.4s ease;
}
.pyramid-bar.male { background: var(--blue); }
.pyramid-bar.female { background: var(--red); opacity: 0.7; }
.pyramid-label {
  font-size: 0.75rem;
  color: var(--ink-muted);
  text-align: center;
  white-space: nowrap;
  min-width: 40px;
}

/* --- POI List --- */
.poi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.75rem;
}

.poi-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  transition: border-color 0.15s;
}
.poi-item:hover { border-color: var(--accent-bg); }
.poi-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 0.1rem; }
.poi-info { min-width: 0; }
.poi-name { font-weight: 600; font-size: 0.9rem; color: var(--ink); }
.poi-detail { font-size: 0.8rem; color: var(--ink-muted); }
.poi-distance { font-size: 0.75rem; color: var(--accent); }

/* --- Transport Badges --- */
.transport-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.transport-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
}
.transport-badge.bus { background: #e3f2fd; color: #1565c0; }
.transport-badge.metro { background: #fce4ec; color: #c62828; }
.transport-badge.tram { background: #e8f5e9; color: #2e7d32; }
.transport-badge.train { background: #fff3e0; color: #e65100; }

/* --- Street List --- */
.street-list {
  columns: 2;
  column-gap: 1.5rem;
  list-style: none;
}
.street-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-soft);
  break-inside: avoid;
}
.street-list a { color: var(--ink-soft); font-size: 0.9rem; }
.street-list a:hover { color: var(--accent); }
.street-cp {
  float: right;
  font-size: 0.8rem;
  color: var(--ink-muted);
  font-family: var(--font-mono);
}

@media (min-width: 768px) {
  .street-list { columns: 3; }
}

/* --- Sidebar Cards --- */
.sidebar-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.sidebar-card h4 {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-soft);
}

.sidebar-list {
  list-style: none;
}
.sidebar-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border-soft);
}
.sidebar-list li:last-child { border-bottom: none; }
.sidebar-list a {
  font-size: 0.9rem;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
}
.sidebar-list a:hover { color: var(--accent); }
.sidebar-list .list-meta {
  font-size: 0.8rem;
  color: var(--ink-muted);
}
.sidebar-list .list-note {
  padding: 0 0 0.25rem;
  border: none;
}
.sidebar-list .list-note small {
  font-size: 0.7rem;
  color: var(--ink-muted);
  font-style: italic;
}

/* --- Precapta widget (pisos potenciales) --- */
.precapta-widget {
  background: linear-gradient(145deg, #0B1120, #0F172A);
  border: 1px solid #1E3050;
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  color: #F1F5F9;
}
.precapta-widget h4 {
  color: #F1F5F9;
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
  font-size: 0.92rem;
}
.precapta-header {
  padding: 1.25rem 1.25rem 0;
}
.precapta-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.precapta-badge-live {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: rgba(34, 197, 94, 0.15);
  color: #22C55E;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  border: 1px solid rgba(34, 197, 94, 0.3);
  animation: pulse-live 2s infinite;
}
@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.precapta-subtitle {
  font-size: 0.78rem;
  color: #94A3B8;
  margin: 0.25rem 0 0;
}

/* Loading skeleton */
.precapta-loading { padding: 1rem 1.25rem; }
.precapta-skeleton {
  height: 2.5rem;
  background: linear-gradient(90deg, #1E293B 25%, #253349 50%, #1E293B 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}
.precapta-skeleton-sm { height: 1rem; width: 60%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Hero number */
.precapta-data { padding: 0.75rem 1.25rem 0; }
.precapta-hero-num {
  text-align: center;
  padding: 0.5rem 0 0.75rem;
  border-bottom: 1px solid rgba(30, 48, 80, 0.6);
  margin-bottom: 0.75rem;
}
.precapta-big {
  font-family: 'Fraunces', serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: #F97316;
  line-height: 1;
  display: block;
}
.precapta-big-label {
  font-size: 0.78rem;
  color: #94A3B8;
  display: block;
  margin-top: 0.3rem;
}
.precapta-total-context {
  font-size: 0.7rem;
  color: #64748B;
  display: block;
  margin-top: 0.2rem;
}

/* Blurred preview rows */
.precapta-preview { margin-bottom: 0.75rem; }
.precapta-preview-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  background: rgba(30, 41, 59, 0.6);
  border-radius: 8px;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
}
.precapta-preview-icon { font-size: 0.9rem; flex-shrink: 0; }
.precapta-preview-addr {
  flex: 1;
  color: #CBD5E1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.precapta-preview-score {
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  flex-shrink: 0;
}
.precapta-score-high {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
}
.precapta-score-med {
  background: rgba(249, 115, 22, 0.15);
  color: #F97316;
}
.precapta-row-blurred {
  opacity: 0.35;
  filter: blur(2px);
  pointer-events: none;
}
.precapta-preview-locked {
  text-align: center;
  padding: 0.4rem 0 0.1rem;
  font-size: 0.8rem;
  color: #64748B;
}
.precapta-lock { margin-right: 0.3rem; }

/* Includes list */
.precapta-includes {
  background: rgba(30, 41, 59, 0.4);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.5rem;
}
.precapta-includes-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: #94A3B8;
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.precapta-includes-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.78rem;
  color: #CBD5E1;
}
.precapta-includes-list li {
  padding: 0.2rem 0;
}

/* No-data state */
.precapta-nodata {
  text-align: center;
  padding: 0.5rem 0;
}
.precapta-nodata-icon { font-size: 1.5rem; display: block; margin-bottom: 0.3rem; }
.precapta-nodata p { font-size: 0.82rem; color: #94A3B8; margin: 0 0 0.2rem; }
.precapta-nodata-sub { font-size: 0.75rem; color: #64748B; }

/* Error state */
.precapta-error { padding: 1rem 1.25rem; }
.precapta-error-text {
  font-size: 0.82rem;
  color: #64748B;
  text-align: center;
  margin: 0;
}

/* Divider */
.precapta-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, #1E3050, transparent);
  margin: 0.75rem 1.25rem;
}

/* CTA — link to report */
.precapta-lead { padding: 0 1.25rem 0.75rem; }
.precapta-cta {
  background: #F97316;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(249, 115, 22, 0.25);
  width: 100%;
  box-sizing: border-box;
}
.precapta-cta:hover {
  background: #EA580C;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.35);
  color: #fff;
}
.precapta-cta:active { transform: translateY(0); }
.precapta-arrow { font-size: 1.1rem; transition: transform 0.2s; }
.precapta-cta:hover .precapta-arrow { transform: translateX(3px); }

.precapta-social-proof {
  font-size: 0.7rem;
  color: #64748B;
  text-align: center;
  margin: 0.5rem 0 0;
}
.precapta-check {
  color: #22C55E;
  font-weight: 700;
  margin-right: 0.2rem;
}

/* Powered by */
.precapta-powered {
  display: block;
  text-align: center;
  font-size: 0.65rem;
  color: #475569;
  text-decoration: none;
  padding: 0.6rem 1.25rem;
  border-top: 1px solid #1E3050;
  transition: color 0.2s;
}
.precapta-powered:hover { color: #F97316; }
.precapta-powered strong {
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* --- Alquiler referencia sidebar --- */
.alquiler-ref-card { border-left: 3px solid var(--teal); }
.alquiler-precio-hero {
  text-align: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 0.75rem;
}
.alquiler-big {
  font-family: 'Fraunces', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--teal);
}
.alquiler-label {
  font-size: 0.8rem;
  color: var(--ink-muted);
  display: block;
}
.alquiler-calc-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-soft);
}
.alquiler-calc-row:last-child { border-bottom: none; }
.alquiler-amount {
  font-weight: 600;
  color: var(--ink);
}
.alquiler-avg {
  background: var(--teal-bg);
  margin: 0.25rem -0.5rem 0;
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  border-bottom: none;
}
.alquiler-meta {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--ink-muted);
  display: flex;
  justify-content: space-between;
}

/* --- ZBE sidebar --- */
.zbe-card { border-left: 3px solid var(--danger, #c0392b); }
.zbe-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.zbe-badge {
  background: var(--danger, #c0392b);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  letter-spacing: 0.05em;
}
.zbe-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
}
.zbe-restriccion {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin: 0 0 0.4rem;
}
.zbe-info {
  font-size: 0.75rem;
  color: var(--ink-muted);
  padding-top: 0.4rem;
  border-top: 1px solid var(--border-soft);
}

/* --- Map Container --- */
.map-container {
  width: 100%;
  height: 300px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-warm);
  border: 1px solid var(--border);
  position: relative;
}
.map-container iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
.map-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 0.9rem;
  color: var(--ink-muted);
}

/* --- Ad Slots --- */
.ad-slot {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  min-height: 250px;
  overflow: hidden;
}

/* --- Footer --- */
.site-footer {
  background: var(--ink);
  color: #a0a0b4;
  padding: 2.5rem 0 1.5rem;
  margin-top: 3rem;
  font-size: 0.85rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-col h4 {
  color: #ffffff;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}
.footer-col a {
  color: #a0a0b4;
  display: block;
  padding: 0.2rem 0;
}
.footer-col a:hover { color: #ffffff; text-decoration: none; }
.footer-sources {
  border-top: 1px solid #2a2a3e;
  padding-top: 1rem;
  margin-top: 1.5rem;
  text-align: center;
}
.footer-sources h4 { color: #c0c0d0; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.footer-sources a { color: #8a8aa0; font-size: 0.8rem; }
.footer-sources a:hover { color: #fff; }

/* ── Comparativa tables ── */
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.compare-table th { text-align: center; padding: 0.6rem 0.75rem; border-bottom: 2px solid var(--border); font-weight: 600; }
.compare-table th:first-child { text-align: left; width: 35%; }
.compare-table td { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border); text-align: center; }
.compare-table .compare-label { text-align: left; color: var(--ink-soft); font-weight: 500; }
.compare-table .compare-winner { color: var(--accent); font-weight: 600; }
.compare-veredicto { margin-top: 0.75rem; padding: 0.6rem 0.85rem; background: var(--surface-alt, #f0f0f0); border-radius: 0.5rem; font-size: 0.88rem; color: var(--ink-soft); line-height: 1.5; }

.footer-bottom {
  border-top: 1px solid #2a2a3e;
  padding-top: 1rem;
  text-align: center;
  color: #6a6a80;
  font-size: 0.8rem;
}

/* --- SEO Content Block --- */
.seo-content {
  padding: 1.5rem;
  background: var(--surface-warm);
  border-radius: var(--radius);
  margin: 1.5rem 0;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--ink-soft);
}
.seo-content h2 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}
.seo-content p { margin-bottom: 0.75rem; }

/* --- FAQ visible section --- */
.faq-list { display: flex; flex-direction: column; }
.faq-item { border-bottom: 1px solid var(--border-soft); }
.faq-item:last-child { border-bottom: none; }
.faq-question {
  padding: .875rem 0;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-question::-webkit-details-marker { display: none; }
.faq-question::after { content: '▸'; font-size: 1.1rem; color: var(--ink-muted); transition: transform .2s; }
.faq-item[open] .faq-question::after { content: '▾'; }
.faq-answer { padding: 0 0 1rem 0; color: var(--ink-soft); line-height: 1.7; }
.faq-answer p { margin: 0; }

/* --- Municipio Grid (for province pages) --- */
.municipio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.municipio-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.municipio-card:hover {
  border-color: var(--accent-bg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}
.municipio-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}
.municipio-card h3 a { color: var(--ink); }
.municipio-card h3 a:hover { color: var(--accent); text-decoration: none; }
.municipio-meta {
  font-size: 0.85rem;
  color: var(--ink-muted);
}
.municipio-stats {
  display: flex;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
}
.municipio-stats .stat {
  display: flex;
  flex-direction: column;
}
.municipio-stats .stat-num {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
}

/* --- Herramientas Links --- */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.tool-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.85rem;
  color: var(--ink-soft);
  border: 1px solid var(--border-soft);
  transition: all 0.15s;
}
.tool-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.tool-icon { font-size: 1rem; }

/* --- Coordinates Display --- */
.coords {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-muted);
  background: var(--surface);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
}

/* --- Utilities --- */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none; }

/* --- QoL Meters --- */
.qol-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 600px) {
  .qol-grid { grid-template-columns: 1fr; }
}

.qol-item {
  padding: 0.75rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
}
.qol-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.qol-icon { font-size: 1.1rem; }
.qol-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
  flex: 1;
}
.qol-score {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
}
.qol-score small {
  font-weight: 400;
  font-size: 0.78rem;
  opacity: 0.7;
}
.qol-source {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.7rem;
  color: var(--ink-muted);
}
.qol-meter {
  height: 8px;
  background: var(--border-soft);
  border-radius: 4px;
  overflow: hidden;
}
.qol-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.6s ease;
}
/* QoL method details */
.qol-method {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-soft);
}
.qol-method summary {
  font-size: 0.8rem;
  color: var(--ink-muted);
  cursor: pointer;
}
.qol-method p {
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-top: 0.5rem;
}

/* --- Shadow (Sombra) Chart --- */
.sombra-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.sombra-badge {
  display: inline-flex;
  padding: 0.4rem 0.9rem;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
}
.sombra-muy_sombria { background: #d0e1f9; color: #1a3a5c; }
.sombra-sombria { background: #b8d4e3; color: #1d4e6e; }
.sombra-mixta { background: var(--amber-bg); color: #8a6d00; }
.sombra-soleada { background: #fff3cd; color: #856404; }
.sombra-muy_soleada { background: #ffe0b2; color: #e65100; }

.sombra-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100px;
  margin-top: 0.75rem;
  padding: 0 2px;
}
.sombra-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}
.sombra-bar-fill {
  width: 100%;
  background: linear-gradient(to top, var(--accent), var(--accent-light));
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: height 0.4s ease;
}
.sombra-bar-label {
  font-size: 0.65rem;
  color: var(--ink-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* --- Transport List (calle page) --- */
.transport-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.transport-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
}
.transport-icon {
  font-size: 1.2rem;
  width: 2rem;
  text-align: center;
  flex-shrink: 0;
}
.transport-info { flex: 1; min-width: 0; }
.transport-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.transport-lines {
  font-size: 0.78rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.transport-dist {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
  flex-shrink: 0;
}

/* --- Meteo Widget --- */
.meteo-widget {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.meteo-main {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}
.meteo-temp {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
.meteo-desc {
  font-size: 1rem;
  color: var(--ink-soft);
}
.meteo-details {
  display: flex;
  gap: 1rem;
}
.meteo-detail {
  font-size: 0.9rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

/* --- Air Quality Widget --- */
.aire-widget {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-soft);
}
.aire-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  border-radius: 100px;
  font-size: 0.85rem;
}
.tag-accent { background: var(--accent-bg-soft); color: var(--accent); }
.tag-amber { background: var(--amber-bg); color: #8a6d00; }
.tag-red { background: var(--red-bg); color: var(--red); }
.aire-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* --- Farmacia List --- */
.farmacia-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}
.farmacia-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
}
.farmacia-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.farmacia-info { min-width: 0; }
.farmacia-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  margin-bottom: 0.2rem;
}
.farmacia-detail {
  font-size: 0.8rem;
  color: var(--ink-muted);
  line-height: 1.5;
}

/* --- Ruido Widget --- */
.ruido-widget {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.ruido-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-weight: 600;
  font-size: 0.95rem;
  width: fit-content;
}
.ruido-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* --- Cobertura Digital --- */
.cobertura-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.cobertura-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.2rem 0.75rem;
  align-items: center;
}
.cobertura-bar {
  grid-column: 1 / -1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.cobertura-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}
.cobertura-fill-accent { background: var(--accent); }
.cobertura-fill-5g { background: #7c3aed; }
.cobertura-label {
  font-size: 0.85rem;
  color: var(--text-light);
}
.cobertura-value {
  font-size: 0.85rem;
  font-weight: 600;
  text-align: right;
}
.cobertura-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* --- Patrimonio cultural (BIC) --- */
.patrimonio-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.patrimonio-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-soft);
}
.patrimonio-item:last-child {
  border-bottom: none;
}
.patrimonio-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}
.patrimonio-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.patrimonio-name {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
}
.patrimonio-meta {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}
.patrimonio-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* --- Street Badges --- */
.street-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.street-badges .badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.75rem;
  background: var(--surface-warm);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* --- Flood Alert (SNCZI) --- */
.flood-alert {
  border-left: 4px solid var(--amber);
}
.flood-alert-red {
  border-left-color: var(--danger, #dc2626);
}
.flood-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.flood-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  width: fit-content;
}
.flood-badge.tag-red {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}
.flood-badge.tag-amber {
  background: rgba(217, 119, 6, 0.1);
  color: #d97706;
}
.flood-detail {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}
.flood-periods {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.flood-periods .tag-muted {
  opacity: 0.4;
}
.flood-score {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin: 0;
}

/* --- Noticias List --- */
.noticias-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.noticia-item {
  padding: 1rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  transition: border-color 0.15s;
}
.noticia-item:hover {
  border-color: var(--accent-bg);
}
.noticia-header {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.noticia-tipo-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.noticia-titulo {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  margin-bottom: 0;
}
.noticia-resumen {
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.noticia-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
}
.noticia-fecha {
  white-space: nowrap;
}
.noticia-fuente a {
  color: var(--ink-muted);
}
.noticia-fuente a:hover {
  color: var(--accent);
}

/* --- Reacciones (Capa 8A) --- */
.reacciones-bar {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.reaccion-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface);
  color: var(--ink-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.reaccion-btn:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
}
.reaccion-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}
.reaccion-count {
  font-size: 0.75rem;
  font-weight: 600;
}

/* --- Avisos ciudadanos (Capa 8B) --- */

.btn-sm {
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-white);
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s;
}
.btn-sm:hover { background: var(--accent-light, #f0f7f4); }

.btn-primary {
  font-size: 0.85rem;
  padding: 0.5rem 1.25rem;
  border-radius: 0.5rem;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  font-size: 0.85rem;
  padding: 0.5rem 1.25rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
}

.btn-xs {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-white);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-xs:hover { background: var(--accent-light, #f0f7f4); }
.btn-xs:disabled { opacity: 0.5; cursor: not-allowed; }

.aviso-form {
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}
.aviso-form-field {
  margin-bottom: 0.75rem;
}
.aviso-form-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}
.aviso-form-field select,
.aviso-form-field textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
}
.aviso-form-field select:focus,
.aviso-form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.1);
}
.aviso-char-count {
  display: block;
  text-align: right;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
.aviso-form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.aviso-feedback {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
}
.aviso-feedback-success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}
.aviso-feedback-error {
  background: #fce4ec;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

.avisos-list {
  margin-top: 0.75rem;
}
.aviso-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.aviso-item:last-child { border-bottom: none; }
.aviso-item-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.aviso-tipo-icon { font-size: 1.1rem; }
.aviso-tipo-label {
  font-weight: 500;
  font-size: 0.85rem;
  flex: 1;
}
.aviso-desc {
  font-size: 0.85rem;
  color: var(--text);
  margin: 0.25rem 0;
  line-height: 1.4;
}
.aviso-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.aviso-votos {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.btn-voto {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--surface);
  cursor: pointer;
  color: var(--ink-soft);
  transition: border-color 0.15s;
}
.btn-voto:hover { border-color: var(--accent); color: var(--accent); }
.aviso-tipo-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  background: var(--accent-bg);
  color: var(--accent);
  text-transform: capitalize;
}
.aviso-ok { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.aviso-err { background: #fce4ec; color: #c62828; border: 1px solid #ef9a9a; }

/* --- Error pages --- */

.error-page {
  text-align: center;
  padding: 4rem 1rem;
  max-width: 600px;
  margin: 0 auto;
}
.error-icon { font-size: 4rem; display: block; margin-bottom: 1rem; }
.error-code {
  font-family: var(--font-display);
  font-size: 5rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
  line-height: 1;
}
.error-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 0.5rem 0 1rem;
}
.error-text {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}
.error-actions { margin-bottom: 2.5rem; }
.error-suggestions h3 {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.error-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.error-links a {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 0.15s;
}
.error-links a:hover { background: var(--accent-light, #f0f7f4); }

/* --- Header Search Trigger --- */
.search-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: border-color 0.15s;
}
.search-trigger:hover { border-color: var(--accent); }
.search-trigger-icon { font-size: 0.85rem; }

/* --- Search Page --- */
.search-page { max-width: 800px; margin: 0 auto; }
.search-box {
  position: relative;
  margin-top: 1.5rem;
}
.search-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.5rem;
  font-size: 1.1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.search-input:focus {
  border-color: var(--accent);
  outline: none;
}
.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  pointer-events: none;
}
.search-hint {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}
.search-results { margin-top: 1rem; }
.results-title {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}
.results-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}
.result-item:hover { background: var(--bg-muted, #f3f4f6); }
.result-name { font-weight: 500; }
.result-meta { font-size: 0.8rem; color: var(--text-muted); }
.no-results {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}
.ccaa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}
.ccaa-item {
  display: flex;
  flex-direction: column;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.ccaa-item:hover { border-color: var(--accent); background: var(--accent-light, #f0f7f4); }
.ccaa-name { font-weight: 500; font-size: 0.9rem; }
.ccaa-count { font-size: 0.75rem; color: var(--text-muted); }
.provincia-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.4rem;
}
.provincia-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
  font-size: 0.85rem;
  transition: background 0.15s;
}
.provincia-item:hover { background: var(--bg-muted, #f3f4f6); }
.provincia-name { font-weight: 500; }
.provincia-count { font-size: 0.75rem; color: var(--text-muted); }

/* --- Subpage: Empleo --- */
.paro-bar { margin-top: 1rem; }
.paro-bar-track {
  height: 0.5rem;
  background: var(--bg-muted, #f3f4f6);
  border-radius: 4px;
  overflow: hidden;
}
.paro-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s;
}
.paro-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
.paro-bar-current { font-weight: 600; color: var(--accent); }

.ranking-badges { display: flex; gap: 1rem; flex-wrap: wrap; }
.ranking-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: var(--bg-muted, #f3f4f6);
  border-radius: 8px;
  min-width: 100px;
}
.ranking-position {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}
.ranking-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* --- Subpage: Vivienda --- */
.variacion-badge.variacion-neutral {
  background: var(--bg-muted, #f3f4f6);
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-top: 1rem;
}

/* --- Provincias Index --- */
.provincia-card {
  display: flex;
  flex-direction: column;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.provincia-card:hover { border-color: var(--accent); background: var(--accent-light, #f0f7f4); }
.provincia-card-name { font-weight: 600; font-size: 0.95rem; }
.provincia-card-stats {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* --- Calles Index --- */
.street-list-compact { columns: 2; column-gap: 1rem; }
@media (max-width: 640px) { .street-list-compact { columns: 1; } }
.letter-icon {
  font-weight: 700;
  font-size: 1.1rem;
  background: var(--accent);
  color: white;
  width: 1.6rem;
  height: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.letter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.letter-link {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  color: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.letter-link:hover { background: var(--accent); color: white; border-color: var(--accent); }

/* --- POI List v2 (categorized) --- */
.poi-list-v2 {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.poi-item-v2 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  transition: border-color 0.15s;
}
.poi-item-v2:hover { border-color: var(--accent-bg); }
.poi-icon-v2 {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.poi-icon-v2.health { background: var(--red-bg); }
.poi-icon-v2.pharmacy { background: #e8f5e9; }
.poi-icon-v2.education { background: var(--amber-bg); }
.poi-icon-v2.culture { background: var(--purple-bg); }
.poi-icon-v2.sport { background: var(--cyan-bg); }
.poi-icon-v2.commerce { background: var(--orange-bg); }
.poi-icon-v2.transport { background: var(--blue-bg); }
.poi-icon-v2.other { background: var(--surface-warm); }
.poi-info-v2 { flex: 1; min-width: 0; }
.poi-name-v2 {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.poi-type-v2 {
  font-size: 0.78rem;
  color: var(--ink-muted);
}
.poi-distance-v2 {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
  flex-shrink: 0;
  white-space: nowrap;
}
.poi-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: var(--accent-bg);
  color: var(--accent);
  margin-left: 0.4rem;
}

/* --- Catastro Decade Bars --- */
.decade-bars {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.decade-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.decade-label {
  min-width: 70px;
  font-size: 0.78rem;
  color: var(--ink-muted);
  text-align: right;
}
.decade-track {
  flex: 1;
  height: 18px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
}
.decade-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.5s ease;
}
.decade-fill.old { background: var(--amber); }
.decade-fill.mid { background: var(--blue); }
.decade-fill.new { background: var(--accent); }
.decade-count {
  min-width: 28px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
}

/* --- Map Info Strip --- */
.map-info-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-radius: 0 0 var(--radius) var(--radius);
  border: 1px solid var(--border);
  border-top: none;
  margin-top: -1px;
}
.map-info-item {
  display: flex;
  flex-direction: column;
}
.map-info-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}
.map-info-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

/* --- Leaflet Map override --- */
.leaflet-map {
  width: 100%;
  height: 350px;
  border-radius: var(--radius) var(--radius) 0 0;
  z-index: 1;
}

/* --- Tool Forms (Herramientas) --- */
.tool-form .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.tool-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.tool-form label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}
.tool-form input,
.tool-form select {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s;
}
.tool-form input:focus,
.tool-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45,106,79,0.1);
}
.tool-form .form-help {
  font-size: 0.75rem;
  color: var(--ink-faint);
  line-height: 1.3;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover {
  background: var(--accent-dark, #1b4332);
}
.tool-result {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--surface-warm, #f8f6f0);
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
}
.tool-result .data-value.highlight {
  color: var(--accent);
  font-size: 1.5rem;
}
.table-wrapper {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th,
.data-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
}
.data-table th {
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.data-table tbody tr:hover {
  background: var(--surface);
}
@media (max-width: 600px) {
  .tool-form .form-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Pirámide de Población --- */
.piramide { display: flex; flex-direction: column; gap: 2px; margin-top: 0.75rem; }
.piramide-row { display: flex; align-items: center; gap: 4px; min-height: 22px; }
.piramide-bar { flex: 1; position: relative; height: 20px; overflow: hidden; }
.piramide-bar.piramide-hombres { direction: rtl; }
.piramide-bar .piramide-fill {
  height: 100%;
  border-radius: 3px;
  min-width: 2px;
  transition: width 0.3s ease;
}
.piramide-hombres .piramide-fill { background: #4a90d9; }
.piramide-mujeres .piramide-fill { background: #e06b8b; }
.piramide-value {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  font-size: 0.65rem; color: var(--text-muted, #6b7280);
  white-space: nowrap; padding: 0 4px;
}
.piramide-hombres .piramide-value { right: 0; direction: ltr; }
.piramide-mujeres .piramide-value { left: auto; right: 4px; }
.piramide-label {
  width: 48px; text-align: center; flex-shrink: 0;
  font-size: 0.7rem; font-weight: 600; color: var(--text-secondary, #4b5563);
}
.piramide-legend {
  display: flex; gap: 1.5rem; justify-content: center;
  font-size: 0.8rem; color: var(--text-muted, #6b7280);
}

/* --- Print --- */
@media print {
  .site-header, .site-footer, .ad-slot, .sidebar { display: none; }
  .main-grid { grid-template-columns: 1fr; }
  body { background: white; }
}
