/* ==========================================================================
   Comprobador de distintivo ambiental DGT y restricciones ZBE
   Fijate Tools - Hoja de estilos canónica
   ========================================================================== */

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

  /* Paleta base oscura Midnight Slate */
  --bg-page: #0b0f17;
  --bg-card: #111827;
  --bg-surface: #1e293b;
  --bg-surface-hover: #283548;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-focus: #3b82f6;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #cbd5e1;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-rgb: 59, 130, 246;

  /* Colores oficiales de etiquetas DGT */
  --badge-zero: #0072ce;
  --badge-eco-green: #00a651;
  --badge-eco-blue: #0072ce;
  --badge-c: #009640;
  --badge-b: #ffd100;
  --badge-a: #64748b;

  /* Estados semafóricos ZBE */
  --status-allowed-bg: rgba(16, 185, 129, 0.12);
  --status-allowed-border: #10b981;
  --status-allowed-text: #34d399;

  --status-warning-bg: rgba(245, 158, 11, 0.12);
  --status-warning-border: #f59e0b;
  --status-warning-text: #fbbf24;

  --status-prohibited-bg: rgba(239, 68, 68, 0.12);
  --status-prohibited-border: #ef4444;
  --status-prohibited-text: #f87171;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);
}

[data-theme="light"],
body.light-theme {
  --bg-page: #f1f5f9;
  --bg-card: #ffffff;
  --bg-surface: #f8fafc;
  --bg-surface-hover: #e2e8f0;
  --border-color: rgba(15, 23, 42, 0.1);
  --border-color-focus: #2563eb;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #1e293b;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;

  --status-allowed-bg: rgba(16, 185, 129, 0.15);
  --status-allowed-border: #059669;
  --status-allowed-text: #065f46;

  --status-warning-bg: rgba(245, 158, 11, 0.15);
  --status-warning-border: #d97706;
  --status-warning-text: #92400e;

  --status-prohibited-bg: rgba(239, 68, 68, 0.15);
  --status-prohibited-border: #dc2626;
  --status-prohibited-text: #991b1b;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.12);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4, h5, h6,
.brand-title,
.section-title,
.panel-card-title,
.modal-title,
.print-section-title {
  font-family: var(--font-heading);
  letter-spacing: -0.015em;
  font-weight: 700;
}

.mono,
.badge-main-tag,
.timeline-year,
.spec-value.mono,
.light-badge-mono {
  font-family: var(--font-mono);
}

/* Layout y envoltorios */
.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
  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;
  max-width: 100%;
}

.card-main {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  margin-top: 1.25rem;
}

/* Presets rápidos */
.quick-presets-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.presets-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.presets-scroll {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-preset {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-light);
  padding: 0.4rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

.btn-preset:hover {
  background: var(--bg-surface-hover);
  border-color: var(--primary);
  color: var(--text-main);
}

.btn-preset.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 600;
}

/* Grid de workspace en dos columnas */
.tool-workspace-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.75rem;
  align-items: stretch;
}

.tool-col-form,
.tool-col-result {
  min-width: 0;
}

.panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.panel-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.8125rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.panel-card-title {
  font-size: 1.125rem;
  color: var(--text-main);
}

/* Formularios accesibles y controles táctiles */
.vehicle-form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

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

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

.form-label-with-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.year-val-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--primary);
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Tabs de tipo de vehículo */
.vehicle-type-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  background: var(--bg-card);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.6rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-height: 48px;
  justify-content: center;
  transition: all 0.15s ease;
  text-align: center;
}

.tab-btn svg {
  flex-shrink: 0;
}

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

.tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

/* Desplegables <select> canónicos */
.select-wrapper {
  position: relative;
  width: 100%;
}

.form-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  height: 44px;
  padding: 0 40px 0 0.85rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-main);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-select:focus {
  border-color: var(--border-color-focus);
}

.form-select option {
  background-color: var(--bg-card);
  color: var(--text-main);
  padding: 0.5rem;
}

.select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

/* Control de año con slider y input */
.year-control-wrap {
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.form-range {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  height: 8px;
  border-radius: 4px;
  background: var(--bg-card);
  outline: none;
  cursor: pointer;
  accent-color: var(--primary);
}

.input-year-number-wrap {
  width: 86px;
  flex-shrink: 0;
}

.form-input {
  width: 100%;
  height: 42px;
  padding: 0 0.5rem;
  text-align: center;
  font-size: 0.9375rem;
  color: var(--text-main);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
}

.form-input:focus {
  border-color: var(--border-color-focus);
}

/* Checkbox personalizado */
.advanced-euro-toggle-wrap {
  padding-top: 0.35rem;
}

.checkbox-container {
  display: flex;
  align-items: center;
  position: relative;
  cursor: pointer;
  user-select: none;
  gap: 0.65rem;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  height: 20px;
  width: 20px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.checkbox-container input:checked ~ .checkmark {
  background-color: var(--primary);
  border-color: var(--primary);
}

.checkmark::after {
  content: "";
  display: none;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.checkbox-container input:checked ~ .checkmark::after {
  display: block;
}

.checkbox-text {
  font-size: 0.8125rem;
  color: var(--text-light);
  line-height: 1.35;
}

.conditional-box {
  background: var(--bg-card);
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-color);
}

/* Columna de resultado e insignia DGT */
.result-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.badge-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem 0;
}

.badge-display-box {
  width: 170px;
  height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.35));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.badge-display-box:hover {
  transform: scale(1.04) rotate(-1deg);
}

/* SVG Insignia Styles */
.dgt-badge-svg {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
}

.badge-summary-info {
  width: 100%;
}

.badge-main-tag {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.badge-sub-tag {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.12);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  margin-bottom: 0.75rem;
}

.badge-summary-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Caja de alerta crítica de autorización previa ZBE */
.zero-eco-warning-box {
  margin: 1rem 0;
  padding: 0.95rem 1.15rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid #f59e0b;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  text-align: left;
}

.warning-box-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #f59e0b;
  font-size: 0.875rem;
  font-weight: 700;
}

[data-theme="light"] .warning-box-header,
body.light-theme .warning-box-header {
  color: #b45309;
}

.warning-box-text {
  font-size: 0.8125rem;
  color: var(--text-light);
  line-height: 1.45;
}

.warning-box-text strong {
  color: var(--text-main);
}

/* Ficha técnica */
.tech-specs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin: 1.25rem 0;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.spec-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.spec-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.spec-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Botones de acción */
.result-actions-row {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: auto;
}

.btn-action-primary,
.btn-action-secondary {
  width: 100%;
  min-height: 42px;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
}

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

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

.btn-action-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-light);
}

.btn-action-secondary:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}

/* ==========================================================================
   SECCIÓN 2: MATRIZ DE RESTRICCIONES ZBE
   ========================================================================== */
.zbe-matrix-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.section-heading-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.35rem;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.section-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.city-selector-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.city-pill-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-light);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 38px;
}

.city-pill-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}

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

.city-details-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.city-traffic-lights-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.traffic-light-item {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 1.15rem;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.light-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  width: fit-content;
  margin-bottom: 0.25rem;
}

.light-bulb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.light-indicator.red {
  background: var(--status-prohibited-bg);
  color: var(--status-prohibited-text);
  border: 1px solid var(--status-prohibited-border);
}
.light-indicator.red .light-bulb {
  background-color: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
}

.light-indicator.yellow {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
  border: 1px solid var(--status-warning-border);
}
.light-indicator.yellow .light-bulb {
  background-color: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.7);
}

.light-indicator.green {
  background: var(--status-allowed-bg);
  color: var(--status-allowed-text);
  border: 1px solid var(--status-allowed-border);
}
.light-indicator.green .light-bulb {
  background-color: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
}

.light-indicator.blue {
  background: rgba(var(--primary-rgb), 0.15);
  color: var(--primary);
  border: 1px solid var(--primary);
}
.light-badge-mono {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.light-title {
  font-size: 0.9375rem;
  color: var(--text-main);
  font-weight: 700;
}

.light-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Tabla de subzonas */
.city-subzones-table-wrap {
  margin-bottom: 1.25rem;
}

.subzones-title {
  font-size: 1rem;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.table-subzones,
.table-municipalities {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  text-align: left;
}

.table-subzones th,
.table-subzones td,
.table-municipalities th,
.table-municipalities td {
  padding: 0.75rem 0.95rem;
  border-bottom: 1px solid var(--border-color);
}

.table-subzones th,
.table-municipalities th {
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
}

.table-subzones tr:last-child td,
.table-municipalities tr:last-child td {
  border-bottom: none;
}

.table-subzones tr:hover,
.table-municipalities tr:hover {
  background: var(--bg-surface-hover);
}

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.red {
  background: var(--status-prohibited-bg);
  color: var(--status-prohibited-text);
  border: 1px solid var(--status-prohibited-border);
}

.status-badge.yellow {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
  border: 1px solid var(--status-warning-border);
}

.status-badge.green {
  background: var(--status-allowed-bg);
  color: var(--status-allowed-text);
  border: 1px solid var(--status-allowed-border);
}

.status-badge.gray {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.city-footer-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.meta-source-law {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.meta-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-meta-action {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-light);
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 34px;
}

.btn-meta-action:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
  border-color: var(--primary);
}

/* ==========================================================================
   SECCIÓN 3: EXPLORADOR DE MUNICIPIOS
   ========================================================================== */
.municipalities-explorer-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.explorer-filter-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}

.search-input-wrap {
  position: relative;
  flex: 1 1 260px;
  min-width: 240px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-field {
  width: 100%;
  height: 42px;
  padding: 0 36px 0 38px;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-main);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease;
}

.search-field:focus {
  border-color: var(--border-color-focus);
}

.btn-clear-search {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
}

.status-filter-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.status-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-light);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 36px;
}

.status-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}

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

.municipality-table-wrap {
  max-height: 420px;
  overflow-y: auto;
}

.pagination-info {
  margin-top: 0.65rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
}

/* ==========================================================================
   SECCIÓN 4: TIMELINE DE EVOLUCIÓN
   ========================================================================== */
.timeline-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.timeline-track {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.timeline-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.timeline-year {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-pill);
  width: fit-content;
}

.timeline-heading {
  font-size: 0.9375rem;
  color: var(--text-main);
  line-height: 1.35;
}

.timeline-body {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ==========================================================================
   SECCIÓN 5: FAQS Y ACORDEÓN
   ========================================================================== */
.faq-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.faq-accordion {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.faq-item[open] {
  border-color: rgba(var(--primary-rgb), 0.4);
}

.faq-question {
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
  user-select: none;
}

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

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

.faq-item[open] .faq-icon {
  transform: rotate(180deg);
}

.faq-answer {
  padding: 0 1.25rem 1.15rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.faq-answer strong {
  color: var(--text-main);
}

/* ==========================================================================
   MODALES CANÓNICOS (.modal-overlay)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.modal-header-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(var(--primary-rgb), 0.15);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.125rem;
  color: var(--text-main);
}

.modal-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.btn-close-modal {
  position: absolute;
  right: 1.25rem;
  top: 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.75rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-light);
  line-height: 1.5;
}

.channels-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

.channel-card {
  display: flex;
  gap: 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  align-items: flex-start;
}

.channel-icon-wrap {
  color: var(--primary);
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.channel-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.15rem;
}

.channel-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.exceptions-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.exceptions-list li {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.exceptions-list strong {
  color: var(--text-main);
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
}

.appeal-points {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

.appeal-point-card h4 {
  font-size: 0.875rem;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.appeal-point-card p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.modal-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(245, 158, 11, 0.1);
  border-left: 3px solid #f59e0b;
  padding: 0.6rem 0.85rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

.btn-modal-dismiss {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}

/* ==========================================================================
   ESTRUCTURA DE IMPRESIÓN OFICIAL A4 (.print-sheet)
   ========================================================================== */
.print-sheet {
  display: none;
}

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .app-header,
  .tool-with-sidebar,
  .fijate-footer,
  .tools-ad-banner-section,
  .tool-ad-sidebar,
  .modal-overlay,
  .quick-presets-bar,
  .result-actions-row,
  .explorer-filter-controls,
  .pagination-info,
  .meta-buttons {
    display: none !important;
  }

  .print-sheet {
    display: block !important;
    width: 100% !important;
    max-width: 210mm !important;
    margin: 0 auto !important;
    padding: 10mm !important;
    font-family: var(--font-main) !important;
    color: #111827 !important;
    font-size: 9pt !important;
    line-height: 1.4 !important;
  }

  .print-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2pt solid #0f172a;
    padding-bottom: 6mm;
    margin-bottom: 6mm;
  }

  .print-brand h2 {
    font-size: 15pt !important;
    margin-bottom: 2pt;
    font-family: var(--font-heading);
  }

  .print-brand p {
    font-size: 9pt;
    color: #475569;
  }

  .print-date {
    display: flex;
    flex-direction: column;
    text-align: right;
    font-size: 8pt;
    color: #64748b;
  }

  .print-section {
    margin-bottom: 6mm;
  }

  .print-section-title {
    font-size: 11pt !important;
    font-weight: 700;
    margin-bottom: 3mm;
    border-bottom: 1pt solid #cbd5e1;
    padding-bottom: 1mm;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 8.5pt;
    margin-bottom: 4mm;
  }

  .print-table th,
  .print-table td {
    padding: 2mm 3mm;
    border: 0.5pt solid #cbd5e1;
    text-align: left;
  }

  .print-table th {
    background-color: #f1f5f9;
    font-weight: 700;
  }

  .print-verdict-box {
    background-color: #f8fafc;
    border: 1pt solid #cbd5e1;
    padding: 4mm;
    border-radius: 4px;
    margin-bottom: 4mm;
  }

  .print-verdict-name {
    font-size: 13pt;
    font-weight: 800;
    font-family: var(--font-heading);
    margin-bottom: 2mm;
  }

  .print-footer {
    margin-top: 8mm;
    border-top: 1pt solid #cbd5e1;
    padding-top: 4mm;
    font-size: 7.5pt;
    color: #64748b;
  }

  .print-signatures {
    display: flex;
    justify-content: space-between;
    margin-top: 8mm;
  }

  .sig-box {
    width: 45%;
    border-top: 1pt solid #94a3b8;
    padding-top: 2mm;
    text-align: center;
    font-size: 8pt;
  }
}

/* ==========================================================================
   RESPONSIVE DESIGN (MÓVIL Y TABLET)
   ========================================================================== */
@media (max-width: 992px) {
  .tool-workspace-grid {
    grid-template-columns: 1fr;
  }

  .city-traffic-lights-grid {
    grid-template-columns: 1fr;
  }

  .timeline-track {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .card-main {
    padding: 1.15rem;
  }

  .panel-card {
    padding: 1.15rem;
  }

  .vehicle-type-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tab-btn {
    padding: 0.4rem 0.2rem;
    font-size: 0.72rem;
    min-height: 44px;
  }

  .tab-btn svg {
    width: 16px;
    height: 16px;
  }

  .timeline-track {
    grid-template-columns: 1fr;
  }

  .tech-specs-grid {
    grid-template-columns: 1fr;
  }

  .city-selector-pills {
    width: 100%;
  }

  .city-pill-btn {
    flex: 1 1 auto;
    text-align: center;
    padding: 0.4rem 0.5rem;
  }

  .explorer-filter-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .status-filter-pills {
    width: 100%;
  }

  .status-btn {
    flex: 1 1 auto;
    text-align: center;
  }

  .city-footer-meta {
    flex-direction: column;
    align-items: stretch;
  }

  .meta-buttons {
    flex-direction: column;
  }

  .btn-meta-action {
    width: 100%;
    text-align: center;
  }
}
