/* ==========================================================================
   ESTILOS CANÓNICOS - ACCIDENTES EN TRANSPORTE PÚBLICO EN ESPAÑA
   Tipografías corporativas: Inter, Outfit, JetBrains Mono
   Paleta: Dark-First Midnight Slate corporativo
   ========================================================================== */

:root,
[data-theme="dark"] {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --bg-body: #0b0f17;
  --bg-card: #111827;
  --bg-card-subtle: #1a2234;
  --bg-card-hover: #1f293d;
  --bg-input: #0f172a;
  --border-color: #1e293b;
  --border-focus: #38bdf8;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-blue: #38bdf8;
  --accent-blue-hover: #0284c7;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;

  --badge-bg: rgba(56, 189, 248, 0.12);
  --badge-text: #38bdf8;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -4px rgba(0, 0, 0, 0.6);
}

[data-theme="light"] {
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-card-hover: #e2e8f0;
  --bg-input: #ffffff;
  --border-color: #cbd5e1;
  --border-focus: #0284c7;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --accent-blue: #0284c7;
  --accent-blue-hover: #0369a1;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  --accent-purple: #9333ea;

  --badge-bg: rgba(2, 132, 199, 0.1);
  --badge-text: #0284c7;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   RESET Y LAYOUT CANÓNICO
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-main);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  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-main);
  font-weight: 700;
  line-height: 1.25;
  margin-top: 0;
}

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

.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%;
}

/* ==========================================================================
   ENCABEZADO DE HERRAMIENTA & PESTAÑAS
   ========================================================================== */
.tool-intro {
  margin-bottom: 2rem;
}

.tool-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background-color: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.tool-title {
  font-size: 1.85rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
}

@media (min-width: 768px) {
  .tool-title {
    font-size: 2.25rem;
  }
}

.tool-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 880px;
  margin-bottom: 1.5rem;
}

/* Selector de pestañas */
.tab-navigation {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  border-radius: 6px 6px 0 0;
}

.tab-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-card-subtle);
}

.tab-btn.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
  background-color: var(--bg-card-subtle);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.25s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   KPIS HERO (TARJETAS DE RESUMEN)
   ========================================================================== */
.hero-kpis {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (min-width: 640px) {
  .hero-kpis {
    grid-template-columns: repeat(3, 1fr);
  }
}

.kpi-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.kpi-card.kpi-primary {
  border-color: rgba(56, 189, 248, 0.4);
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(56, 189, 248, 0.08) 100%);
}

.kpi-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.kpi-primary .kpi-value {
  color: var(--accent-blue);
}

.kpi-subtext {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ==========================================================================
   FORMULARIOS Y PANELES INTERACTIVOS
   ========================================================================== */
.card-panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.panel-title {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .form-grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.form-control {
  width: 100%;
  height: 42px;
  padding: 0.5rem 0.85rem;
  font-family: var(--font-main);
  font-size: 0.95rem;
  color: var(--text-main);
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

select.form-control {
  cursor: pointer;
  padding-right: 36px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

textarea.form-control {
  height: auto;
  min-height: 90px;
  resize: vertical;
}

/* Píldoras de casos precargados */
.preset-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.85rem 1rem;
  background-color: var(--bg-card-subtle);
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.preset-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-preset-caso {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-preset-caso:hover {
  background-color: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-blue);
}

/* ==========================================================================
   DESGLOSE LIQUIDATIVO DE INDEMNIZACIONES
   ========================================================================== */
.breakdown-box {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.92rem;
}

[data-theme="light"] .breakdown-row {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

.breakdown-row:last-child {
  border-bottom: none;
}

.breakdown-row.total-row {
  margin-top: 0.5rem;
  padding-top: 0.85rem;
  border-top: 2px solid var(--border-color);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-blue);
}

.breakdown-val {
  font-family: var(--font-mono);
  font-weight: 600;
}

.legal-notice-box {
  background-color: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-top: 1.5rem;
  font-size: 0.88rem;
  color: var(--text-main);
}

.legal-notice-box strong {
  color: var(--accent-emerald);
}

/* ==========================================================================
   ASISTENTE Y GENERADOR DE ESCRITO (PESTAÑA 2)
   ========================================================================== */
.operador-card {
  display: none;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-blue);
  border-radius: 8px;
  padding: 1rem;
  margin-top: 0.75rem;
  font-size: 0.88rem;
}

.operador-info-badge {
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--text-main);
}

.operador-info-text {
  margin: 0.2rem 0;
  color: var(--text-muted);
}

.operador-info-consejo {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border-color);
  color: var(--accent-amber);
}

/* Alerta CCTV 30 días */
.cctv-alert {
  display: none;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  margin-top: 1rem;
  font-size: 0.88rem;
  line-height: 1.45;
}

.cctv-info {
  background-color: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--text-main);
}

.cctv-warning {
  background-color: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.cctv-danger {
  background-color: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fda4af;
}

/* Salida del escrito y botones */
.escrito-output-box {
  margin-top: 2rem;
}

.escrito-textarea {
  width: 100%;
  height: 380px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  padding: 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  box-sizing: border-box;
  white-space: pre-wrap;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 44px;
  padding: 0 1.5rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  background-color: var(--accent-blue);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 44px;
  padding: 0 1.25rem;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

/* ==========================================================================
   OBSERVATORIO Y MAPA HISTÓRICO / TIEMPO REAL (PESTAÑA 3)
   ========================================================================== */
/* Barra de estado en directo DGT 3.0 */
.obs-live-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.obs-live-indicator {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.85rem;
}

.live-pulse-dot {
  width: 10px;
  height: 10px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: livePulse 2s infinite ease-in-out;
}

@keyframes livePulse {
  0% {
    transform: scale(0.95);
    opacity: 0.7;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }

  70% {
    transform: scale(1.15);
    opacity: 1;
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }

  100% {
    transform: scale(0.95);
    opacity: 0.7;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.obs-live-status-text {
  font-weight: 600;
  color: var(--text-main);
}

.obs-live-timestamp {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  background-color: var(--bg-card);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.btn-live-refresh {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-live-refresh:hover {
  background-color: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-blue);
}

.btn-live-refresh.loading svg {
  animation: rotateSpin 1s linear infinite;
}

@keyframes rotateSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Conmutador de modo del observatorio */
.obs-mode-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.obs-mode-tab {
  flex: 1 1 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-muted);
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.obs-mode-tab:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-main);
}

.obs-mode-tab.active {
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(56, 189, 248, 0.1) 100%);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.15);
}

/* Filtros de modo y de tiempo real */
.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.map-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.map-filter-btn,
.map-filter-rt-btn {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.map-filter-btn:hover,
.map-filter-rt-btn:hover {
  color: var(--text-main);
  border-color: var(--accent-blue);
}

.map-filter-btn.active,
.map-filter-rt-btn.active {
  background-color: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-blue);
}

.mapa-wrapper {
  width: 100%;
  height: 520px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
  position: relative;
  z-index: 1;
}

@media (max-width: 768px) {
  .mapa-wrapper {
    height: 400px;
  }
}

#mapa-siniestros {
  width: 100%;
  height: 100%;
}

/* Pines de Leaflet */
.custom-map-pin {
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-pin-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.map-pin-badge:hover {
  transform: scale(1.18);
}

.map-pin-emoji {
  font-size: 16px;
}

/* Popup de Leaflet */
.custom-leaflet-popup .leaflet-popup-content-wrapper {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 0.4rem;
}

.custom-leaflet-popup .leaflet-popup-tip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.map-popup-card {
  font-family: var(--font-main);
  font-size: 0.85rem;
  line-height: 1.45;
}

.map-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-blue);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.map-popup-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  margin: 0.25rem 0 0.5rem 0;
  color: var(--text-main);
}

.map-popup-meta {
  margin: 0.2rem 0;
  color: var(--text-muted);
}

.map-popup-text {
  margin: 0.5rem 0;
}

.map-popup-cause {
  background-color: var(--bg-card-subtle);
  border-left: 3px solid var(--accent-rose);
  padding: 0.5rem;
  border-radius: 4px;
  margin: 0.5rem 0;
  font-size: 0.8rem;
}

.map-popup-lessons {
  background-color: var(--bg-card-subtle);
  border-left: 3px solid var(--accent-emerald);
  padding: 0.5rem;
  border-radius: 4px;
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

/* Fichas interactivas de siniestros sincronizadas con el mapa */
.siniestros-list-section {
  margin-top: 1.5rem;
  margin-bottom: 2.5rem;
}

.siniestros-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.siniestros-list-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  margin: 0;
  color: var(--text-main);
}

.siniestros-list-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--accent-blue);
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-weight: 600;
}

.siniestros-cards-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1rem;
}

@media (min-width: 640px) {
  .siniestros-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .siniestros-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.siniestro-item-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.siniestro-item-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: var(--shadow-md);
}

.siniestro-item-card.card-item-live {
  border-left: 3px solid var(--accent-rose);
}

.card-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.card-item-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.card-item-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.card-item-title {
  font-family: var(--font-heading);
  font-size: 0.98rem;
  margin: 0 0 0.5rem 0;
  color: var(--text-main);
  line-height: 1.35;
}

.card-item-location,
.card-item-victims {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.15rem 0;
}

.card-item-summary {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0.5rem 0;
  line-height: 1.45;
  flex-grow: 1;
}

.card-item-cause {
  background-color: var(--bg-card-subtle);
  border-left: 2px solid var(--accent-blue);
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.btn-focus-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  height: 36px;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-blue);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: auto;
}

.btn-focus-marker:hover {
  background-color: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-blue);
}

.empty-state-notice {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1.5rem;
  background-color: var(--bg-card-subtle);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  color: var(--text-muted);
}

.empty-state-notice svg {
  color: var(--accent-emerald);
  margin-bottom: 0.75rem;
}

/* Tarjetas de estadísticas comparativas */
.safety-stats-container {
  margin-top: 2.5rem;
}

.safety-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1rem;
}

@media (min-width: 640px) {
  .safety-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .safety-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.safety-stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.stat-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.stat-card-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
}

.stat-card-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  text-transform: uppercase;
}

.badge-safe {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

.badge-warning {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}

.badge-danger {
  background-color: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
}

.stat-card-rate {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.rate-number {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
}

.rate-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.2;
}

.stat-card-detail {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  margin-top: auto;
  padding-top: 0.5rem;
}

/* ==========================================================================
   ACORDEÓN DE CONTENIDO SEO Y PREGUNTAS FRECUENTES (FAQ)
   ========================================================================== */
.seo-guide-section {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.seo-guide-section h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.seo-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.seo-accordion details {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.seo-accordion details[open] {
  border-color: rgba(56, 189, 248, 0.4);
}

.seo-accordion summary {
  padding: 1rem 1.25rem;
  font-family: var(--font-heading);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.seo-accordion summary::after {
  content: '+';
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.seo-accordion details[open] summary::after {
  content: '−';
}

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

.accordion-body p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   SISTEMA DE MODAL ACCESIBLE (HTML/JS)
   ========================================================================== */
.accessible-modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.accessible-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.accessible-modal-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  max-width: 540px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  transform: scale(0.96);
  transition: transform 0.2s ease;
}

.accessible-modal-overlay.active .accessible-modal-box {
  transform: scale(1);
}

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

.modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
}

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

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

.modal-body {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ==========================================================================
   ESTILOS DE IMPRESIÓN (@media print)
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .app-header,
  .tools-ad-banner-section,
  .tool-ad-sidebar,
  .tab-navigation,
  .hero-kpis,
  .tool-intro,
  .seo-guide-section,
  .fijate-footer,
  .preset-bar,
  .btn-row,
  .card-panel,
  .accessible-modal-overlay {
    display: none !important;
  }

  .tool-layout,
  .tool-with-sidebar,
  .tool-main-content {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    display: block !important;
  }

  #tab-reclamacion {
    display: block !important;
  }

  .escrito-output-box {
    margin: 0 !important;
  }

  .escrito-textarea {
    border: none !important;
    background: transparent !important;
    color: #000000 !important;
    height: auto !important;
    padding: 0 !important;
    font-size: 11pt !important;
    line-height: 1.4 !important;
  }
}