/**
 * Mapa de fallas tectónicas activas y sismicidad histórica de España (IGME / QAFI)
 * Estilos corporativos canónicos, tema claro/oscuro y diseño responsivo
 */

:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Tema claro corporativo */
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-card-hover: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --border-subtle: #cbd5e1;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-subtle: rgba(37, 99, 235, 0.1);
  --accent: #dc2626;

  /* Colores geológicos sismorresistentes */
  --slip-high: #ef4444;
  --slip-med: #f97316;
  --slip-low: #10b981;
  --slip-unknown: #64748b;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

[data-theme="dark"] {
  --bg-body: #0b0f17;
  --bg-card: #151d2c;
  --bg-card-subtle: #1c2638;
  --bg-card-hover: #243248;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #243248;
  --border-subtle: #334460;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-subtle: rgba(59, 130, 246, 0.15);
  --accent: #ef4444;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* Reset y contención estructural canónica */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  margin-top: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}

p {
  margin-top: 0;
  margin-bottom: 1rem;
}

.text-mono {
  font-family: var(--font-mono);
}

/* Layout institucional y sidebar canónica */
.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

/* 1. Tarjeta Hero Intro */
.faults-hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.hero-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.badge-source {
  display: inline-block;
  background: var(--primary-subtle);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-headline {
  font-size: 1.45rem;
  line-height: 1.25;
  margin: 0;
}

.hero-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin: 0;
}

.hero-kpis {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}

.kpi-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.85rem;
  text-align: center;
  min-width: 82px;
}

.kpi-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.kpi-lbl {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.2rem;
}

/* 2. Barra de búsqueda y localización */
.search-parcel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.search-inputs-grid {
  display: flex;
  gap: 1.25rem;
  align-items: flex-end;
}

.search-field-box {
  flex: 1 1 0%;
  min-width: 0;
  position: relative;
}

.search-instructions-box {
  flex: 1 1 0%;
  min-width: 0;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.input-action-group {
  display: flex;
  gap: 0.5rem;
}

.form-control {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  height: 42px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.95rem;
  padding: 0 0.85rem;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-subtle);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 42px;
  padding: 0 1.25rem;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-card-subtle);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
}

.btn-icon-only {
  width: 42px;
  padding: 0;
  flex-shrink: 0;
}

.btn-sm {
  height: 36px;
  padding: 0 0.85rem;
  font-size: 0.82rem;
}

.text-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.text-hint svg {
  flex-shrink: 0;
  color: var(--primary);
}

/* Autocompletado desplegable */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  margin-top: 0.25rem;
  max-height: 250px;
  overflow-y: auto;
}

.autocomplete-item {
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border-color);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background: var(--bg-card-hover);
}

.autocomplete-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--primary-subtle);
  color: var(--primary);
}

/* 3. Chips de regiones rápidas */
.quick-regions-section {
  margin-bottom: 1rem;
}

.section-micro-title {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.45rem;
}

.quick-regions-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg-card-hover);
}

.chip-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* 4. Barra de controles y filtros */
.map-controls-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: center;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.control-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.form-select {
  height: 38px;
  background-color: var(--bg-card-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 40px 0 0.75rem;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.form-select option {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

.toggles-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.toggle-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.toggle-checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* 5. Visor Cartográfico */
.map-container-section {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
}

.map-viewport {
  width: 100%;
  height: 600px;
  background: #111827;
}

/* Leyenda flotante en el mapa */
.map-legend-overlay {
  position: absolute;
  bottom: 15px;
  right: 15px;
  z-index: 500;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.95rem;
  color: #f8fafc;
  font-size: 0.78rem;
  max-width: 250px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.legend-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0 0 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.legend-color-line {
  display: inline-block;
  width: 22px;
  height: 3.5px;
  border-radius: 2px;
  flex-shrink: 0;
}

.line-red { background-color: var(--slip-high); }
.line-orange { background-color: var(--slip-med); }
.line-green { background-color: var(--slip-low); }
.line-dashed {
  background: repeating-linear-gradient(90deg, #94a3b8, #94a3b8 4px, transparent 4px, transparent 8px);
}

.legend-color-point {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.point-quake {
  background-color: #f59e0b;
  border: 2px solid #ffffff;
  box-shadow: 0 0 6px #f59e0b;
}

/* 6. Panel de Evaluación de Seguridad Sismorresistente */
.safety-report-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  scroll-margin-top: 2rem;
}

.report-header-banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
}

.badge-report-pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  background: var(--primary-subtle);
  color: var(--primary);
  margin-bottom: 0.3rem;
}

.report-title {
  font-size: 1.35rem;
  line-height: 1.25;
  margin: 0 0 0.25rem;
}

.report-coords {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Cuadrícula de KPIs del informe */
.report-kpis-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.rep-kpi-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.rep-kpi-lbl {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.25rem;
}

.rep-kpi-val {
  display: block;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
}

.rep-kpi-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Alertas de proximidad */
.proximity-alert-box {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  border: 1px solid transparent;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #b91c1c;
}
[data-theme="dark"] .alert-danger {
  color: #fca5a5;
}

.alert-warning {
  background: rgba(249, 115, 22, 0.1);
  border-color: rgba(249, 115, 22, 0.3);
  color: #c2410c;
}
[data-theme="dark"] .alert-warning {
  color: #fdba74;
}

.alert-info {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #1d4ed8;
}
[data-theme="dark"] .alert-info {
  color: #93c5fd;
}

.alert-ok {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: #047857;
}
[data-theme="dark"] .alert-ok {
  color: #6ee7b7;
}

.alert-icon-col {
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.alert-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  color: inherit;
}

.alert-desc {
  font-size: 0.88rem;
  margin: 0;
  color: inherit;
  opacity: 0.92;
}

/* Ficha técnica de la falla */
.report-details-box,
.recommendations-box,
.nearby-history-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.25rem;
}

.details-heading {
  font-size: 1.05rem;
  margin: 0 0 0.85rem;
  color: var(--text-primary);
}

.fault-specs-table-container {
  overflow-x: auto;
}

.fault-specs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.fault-specs-table th,
.fault-specs-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

.fault-specs-table tr:last-child th,
.fault-specs-table tr:last-child td {
  border-bottom: none;
}

.fault-specs-table th {
  color: var(--text-secondary);
  font-weight: 600;
  width: 32%;
}

.fault-specs-table td {
  color: var(--text-primary);
  font-weight: 500;
}

/* Lista de prescripciones técnicas */
.recommendations-list {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.recommendations-list li {
  margin-bottom: 0.5rem;
}

.recommendations-list li:last-child {
  margin-bottom: 0;
}

/* Tarjetas de sismos históricos cercanos */
.history-cards-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
}

.history-mini-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.history-quake-mag {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 800;
  color: #d97706;
}

.history-quake-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.history-quake-place {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: var(--text-primary);
}

.history-quake-dist {
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.history-quake-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

.report-footer-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  border-top: 1px solid var(--border-color);
  padding-top: 0.85rem;
}

/* 7. Acordeón divulgativo FAQ */
.seo-accordion-section {
  margin-top: 2rem;
  margin-bottom: 2.5rem;
}

.seo-section-title {
  font-size: 1.3rem;
  margin-bottom: 1.25rem;
}

.faq-details {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.faq-details:hover {
  border-color: var(--border-subtle);
}

.faq-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  list-style: none;
  color: var(--text-primary);
}

.faq-summary::-webkit-details-marker {
  display: none;
}

.summary-arrow {
  flex-shrink: 0;
  transition: transform 0.2s ease;
  color: var(--text-muted);
}

.faq-details[open] .summary-arrow {
  transform: rotate(180deg);
  color: var(--primary);
}

.faq-content {
  padding: 0 1.25rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.faq-content p:last-child {
  margin-bottom: 0;
}

.faq-content ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.faq-content li {
  margin-bottom: 0.4rem;
}

/* 8. Modal accesible */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1.15rem;
  margin: 0;
}

.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.btn-close-modal:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.25rem;
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 0.85rem 1.25rem;
  background: var(--bg-card-subtle);
  border-top: 1px solid var(--border-color);
}

/* 9. Estilos de Popups de Leaflet */
.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-md) !important;
  font-family: var(--font-main) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 0.85rem 1rem !important;
  line-height: 1.5 !important;
  font-size: 0.85rem !important;
}

.leaflet-popup-tip {
  background: var(--bg-card) !important;
}

.popup-fault-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: var(--text-primary);
}

.popup-fault-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.popup-fault-row {
  margin-bottom: 0.25rem;
  color: var(--text-secondary);
}

.popup-fault-row strong {
  color: var(--text-primary);
}

/* 10. Adaptación responsiva (Mobile & Tablet) */
@media (max-width: 1024px) {
  .report-kpis-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .hero-header-row {
    flex-direction: column;
    gap: 0.75rem;
  }

  .hero-kpis {
    width: 100%;
    justify-content: space-between;
  }

  .kpi-box {
    flex: 1 1 0%;
    min-width: 0;
  }

  .search-inputs-grid {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .controls-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .control-group {
    flex-direction: column;
    align-items: stretch;
  }

  .form-select {
    width: 100%;
  }

  .map-viewport {
    height: 440px;
  }

  .map-legend-overlay {
    bottom: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
  }

  .legend-items {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .report-kpis-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .report-header-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .btn {
    width: 100%;
  }

  .fault-specs-table th {
    width: 40%;
  }
}

/* 11. Hoja de estilos de impresión oficial A4 */
@media print {
  body {
    background: #ffffff !important;
    color: #0f172a !important;
  }

  .app-header,
  .fijate-footer,
  .tools-ad-banner-section,
  .tool-ad-sidebar,
  .search-parcel-card,
  .quick-regions-section,
  .map-controls-card,
  .report-actions-top,
  .seo-accordion-section,
  .affiliate-showcase-section,
  .related-tools-section {
    display: none !important;
  }

  .tool-layout {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .map-container-section {
    height: 300px !important;
    page-break-after: avoid;
  }

  .safety-report-card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .rep-kpi-card,
  .report-details-box,
  .recommendations-box,
  .nearby-history-box {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
  }

  .rep-kpi-val, .rep-kpi-lbl, .details-heading, .alert-title, .alert-desc {
    color: #0f172a !important;
  }
}
