/**
 * Calculadora de clase social y percentil de ingresos
 * Estilos canónicos Midnight Slate con diseño responsivo táctil y tematización clara/oscura
 */

:root {
  --bg-primary: #0b0f17;
  --bg-secondary: #121824;
  --bg-card: #182030;
  --bg-card-hover: #1f293d;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #3b82f6;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-orange: #f97316;
  --accent-rose: #f43f5e;
  --accent-purple: #8b5cf6;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 24px rgba(59, 130, 246, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border-color: rgba(0, 0, 0, 0.09);
  --border-focus: #2563eb;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 24px rgba(37, 99, 235, 0.1);
}

/* Reset y estructura base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* Contenedor principal con sidebar */
.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
}

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

.tool-main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Migas de pan */
.tool-breadcrumbs {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tool-breadcrumbs-list {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  flex-wrap: wrap;
}

.tool-breadcrumbs-item:not(:last-child)::after {
  content: "/";
  margin-left: 0.5rem;
  color: var(--text-muted);
}

.tool-breadcrumbs-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.tool-breadcrumbs-link:hover {
  color: var(--accent-blue);
}

/* Banner de autoactualización oficial */
.sync-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.sync-status-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.sync-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 2s infinite;
  flex-shrink: 0;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.sync-badge-year {
  font-family: var(--font-mono);
  background: rgba(16, 185, 129, 0.18);
  color: var(--accent-emerald);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
}

.btn-sync-refresh {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.btn-sync-refresh:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--accent-blue);
}

/* Tarjeta principal de la calculadora */
.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Selector de modo dual */
.mode-switch-wrapper {
  display: flex;
  background: var(--bg-secondary);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 0.35rem;
}

.mode-tab-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 44px;
}

.mode-tab-btn.active {
  background: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.35);
}

.mode-tab-btn:not(.active):hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.badge-official {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-sans);
}

/* Grupos de formulario */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.input-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-block-full {
  grid-column: 1 / -1;
}

.input-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.input-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

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

.input-unit-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 0.75rem;
  min-height: 44px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-unit-wrapper:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-field {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 600;
  outline: none;
  padding: 0.5rem 0;
}

.input-unit-suffix {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  padding-left: 0.5rem;
  user-select: none;
}

/* Controles de conteo (+ / -) para adultos y menores */
.counter-box {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  min-height: 44px;
  overflow: hidden;
}

.btn-counter {
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.btn-counter:hover {
  background: var(--bg-card-hover);
  color: var(--accent-blue);
}

.btn-counter:active {
  background: rgba(59, 130, 246, 0.15);
}

.counter-value {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Desplegables select canónicos */
.select-styled {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  min-height: 44px;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 40px 0 1rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  appearance: 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='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.select-styled:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

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

/* Sliders de rango táctiles */
.range-slider-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.custom-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

.custom-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, background 0.15s ease;
}

.custom-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: #2563eb;
}

.custom-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

.range-marks {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* Píldora de unidades de consumo */
.uc-pill-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.uc-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.15);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

/* ==========================================================================
   PANEL DE RESULTADOS
   ========================================================================== */
.results-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Tarjeta Hero del Diagnóstico */
.hero-diagnosis-box {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.hero-diagnosis-box::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: var(--badge-color, var(--accent-emerald));
  box-shadow: 0 0 12px var(--badge-color, var(--accent-emerald));
}

.diagnosis-icon-wrapper {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  color: var(--badge-color, var(--accent-emerald));
}

.diagnosis-text-group {
  flex: 1;
}

.diagnosis-class-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--badge-color, var(--accent-emerald));
  margin-bottom: 0.25rem;
}

.diagnosis-title {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 0.4rem;
}

.diagnosis-description {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Métricas en cuadrícula */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.metric-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.metric-number {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.metric-subtext {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Termómetro / Escala de estratos */
.scale-strata-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.scale-strata-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.section-subtitle {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.strata-bar-track {
  height: 24px;
  border-radius: var(--radius-full);
  display: flex;
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  position: relative;
}

.strata-segment {
  height: 100%;
  position: relative;
  transition: opacity 0.2s ease;
}

.strata-segment:hover {
  opacity: 0.85;
}

.strata-seg-1 { width: 10%; background: #ef4444; } /* Pobreza severa */
.strata-seg-2 { width: 15%; background: #f97316; } /* Riesgo pobreza */
.strata-seg-3 { width: 15%; background: #eab308; } /* Media-baja */
.strata-seg-4 { width: 35%; background: #10b981; } /* Media central */
.strata-seg-5 { width: 15%; background: #3b82f6; } /* Media-alta */
.strata-seg-6 { width: 10%; background: #8b5cf6; } /* Clase alta */

/* Marcador dinámico en la barra */
.strata-marker-pin {
  position: absolute;
  top: -8px;
  bottom: -8px;
  width: 4px;
  background: #ffffff;
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.9), 0 0 20px rgba(59, 130, 246, 0.5);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 5;
  transition: left 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.strata-labels-legend {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-muted);
}

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

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Gráfico de Campana de Distribución (Canvas 2D) */
.distribution-chart-box {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chart-container-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

#distribution-canvas {
  width: 100%;
  height: 240px;
  display: block;
}

.chart-helper-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

/* Tabla personalizada para tu hogar ("¿Cuánto necesitas para cambiar de clase?") */
.household-thresholds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.household-thresholds-table th,
.household-thresholds-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.household-thresholds-table th {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-secondary);
}

.household-thresholds-table tr:last-child td {
  border-bottom: none;
}

.household-thresholds-table tr.active-stratum {
  background: rgba(16, 185, 129, 0.1);
  font-weight: 600;
}

.household-thresholds-table tr.active-stratum td:first-child {
  position: relative;
}

.household-thresholds-table tr.active-stratum td:first-child::before {
  content: "▶";
  position: absolute;
  left: 0.25rem;
  color: var(--accent-emerald);
  font-size: 0.7rem;
}

.stratum-tag-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stratum-color-badge {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.table-amount-mono {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Comparador europeo */
.eu-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.eu-country-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: relative;
  overflow: hidden;
}

.eu-country-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.eu-flag {
  font-size: 1.25rem;
  line-height: 1;
}

.eu-country-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.eu-median-amount {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.eu-comparison-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  width: fit-content;
}

.eu-comparison-pill.above {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

.eu-comparison-pill.below {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-rose);
}

/* Barra de acciones de exportación */
.actions-footer-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.btn-action-primary {
  background: var(--accent-blue);
  color: #ffffff;
  border: none;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  transition: all 0.2s ease;
}

.btn-action-primary:hover {
  background: #2563eb;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-action-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.25rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  transition: all 0.2s ease;
}

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

/* Modales canónicos accesibles (sin window.alert) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 23, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: hidden;
}

.modal-backdrop.active .modal-box {
  transform: translateY(0) scale(1);
}

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

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background 0.2s ease;
}

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

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-body h4 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  font-size: 1.05rem;
}

.modal-body code {
  font-family: var(--font-mono);
  background: var(--bg-secondary);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  color: var(--accent-cyan);
}

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

/* Toast de notificación rápida */
.toast-notice {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  border: 1px solid var(--accent-emerald);
  color: var(--text-primary);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
}

.toast-notice.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Guía SEO / FAQ acordeón canónico */
.seo-guide-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.seo-guide-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.seo-guide-intro {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

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

.seo-faq-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.seo-faq-item[open] {
  border-color: rgba(59, 130, 246, 0.4);
}

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

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

.seo-faq-question::after {
  content: "+";
  font-family: var(--font-mono);
  font-size: 1.3rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.seo-faq-item[open] .seo-faq-question::after {
  transform: rotate(45deg);
  color: var(--accent-blue);
}

.seo-faq-answer {
  padding: 0 1.25rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
}

.seo-faq-answer p:not(:last-child) {
  margin-bottom: 0.75rem;
}

/* ==========================================================================
   RESPONSIVIDAD Y ADAPTACIÓN MÓVIL
   ========================================================================== */
@media (max-width: 768px) {
  .tool-layout {
    margin: 1rem auto 2rem;
    padding: 0 0.75rem;
  }

  .calc-card,
  .results-card,
  .seo-guide-section {
    padding: 1.25rem;
    gap: 1.25rem;
  }

  .hero-diagnosis-box {
    flex-direction: column;
    text-align: center;
    padding: 1.25rem;
  }

  .hero-diagnosis-box::before {
    left: 0;
    right: 0;
    top: 0;
    bottom: auto;
    width: 100%;
    height: 5px;
  }

  .actions-footer-bar {
    flex-direction: column;
  }

  .btn-action-primary,
  .btn-action-secondary {
    width: 100%;
    justify-content: center;
  }

  .household-thresholds-table th,
  .household-thresholds-table td {
    padding: 0.6rem 0.5rem;
    font-size: 0.8rem;
  }

  .household-thresholds-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}
