:root {
  --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;

  /* Colores oscuros por defecto */
  --bg-body: #0b0f17;
  --bg-card: #131b2a;
  --bg-card-secondary: #1a2438;
  --bg-card-header: #172133;
  --bg-input: #0d1422;
  --border-color: #24324a;
  --border-light: #2d3e5c;

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

  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: rgba(37, 99, 235, 0.15);
  --primary-gradient: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);

  --emerald-color: #10b981;
  --emerald-light: rgba(16, 185, 129, 0.15);
  --emerald-border: rgba(16, 185, 129, 0.35);

  --amber-color: #f59e0b;
  --amber-light: rgba(245, 158, 11, 0.15);

  --accent-color: #06b6d4;
  --accent-light: rgba(6, 182, 212, 0.15);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);

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

[data-theme="light"] {
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-secondary: #f1f5f9;
  --bg-card-header: #f8fafc;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-light: #cbd5e1;

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

  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: rgba(37, 99, 235, 0.08);
  --primary-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);

  --emerald-color: #059669;
  --emerald-light: rgba(5, 150, 105, 0.1);
  --emerald-border: rgba(5, 150, 105, 0.3);

  --amber-color: #d97706;
  --amber-light: rgba(217, 119, 6, 0.1);

  --accent-color: #0891b2;
  --accent-light: rgba(8, 145, 178, 0.1);

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

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

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

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

/* Contenedor canónico */
.main-wrapper.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
  width: 100%;
}

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

/* Hero y cabecera de la herramienta */
.tool-hero {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.tool-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-gradient);
}

.hero-badge-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.badge-official {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary-color);
  border: 1px solid var(--border-light);
}

.badge-year {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--emerald-light);
  color: var(--emerald-color);
  border: 1px solid var(--emerald-border);
}

.hero-title {
  font-size: 1.85rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

.hero-desc {
  font-size: 1rem;
  color: var(--text-muted);
  margin: 0;
  max-width: 850px;
}

/* Navegación por pestañas */
.tool-nav-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

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

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

.tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: var(--primary-light);
}

/* Paneles de contenido */
.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); }
}

/* Rejilla de configuración / entradas */
.simulator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .simulator-grid {
    grid-template-columns: 1fr;
  }
}

.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

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

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.card-icon-box {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  color: var(--primary-color);
}

.card-icon-box.emerald {
  background: var(--emerald-light);
  color: var(--emerald-color);
}

.card-icon-box.amber {
  background: var(--amber-light);
  color: var(--amber-color);
}

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

.card-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: var(--bg-card-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

/* Campos de formulario y controles */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.45rem;
}

.label-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.input-with-affix {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  height: 44px;
}

.input-with-affix:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.input-field {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 1rem;
  padding: 0 0.85rem;
  outline: none;
}

.input-affix {
  padding: 0 0.85rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--bg-card-secondary);
  height: 100%;
  display: flex;
  align-items: center;
  border-left: 1px solid var(--border-color);
  user-select: none;
}

select.select-field {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 40px 0 0.85rem;
  background-color: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.92rem;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-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;
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  transition: border-color 0.2s;
}

select.select-field::picker-icon {
  display: none;
}

select.select-field:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Sliders */
.range-wrapper {
  margin-top: 0.5rem;
}

.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--border-color);
  outline: none;
  cursor: pointer;
  transition: background 0.2s;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  border: 2px solid var(--bg-card);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s, background 0.2s;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: var(--primary-hover);
}

.range-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  border: 2px solid var(--bg-card);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Radio chips y opciones conmutables */
.chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.5rem;
}

.chip-label {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem;
  min-height: 40px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.chip-label:hover {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.chip-label input[type="radio"],
.chip-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip-label.active {
  background: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
  font-weight: 600;
}

/* Caja de alerta / nota legal en formulario */
.info-callout {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  border: 1px solid rgba(37, 99, 235, 0.25);
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-top: 1rem;
  line-height: 1.45;
}

.info-callout.warning {
  background: var(--amber-light);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--text-main);
}

.info-callout svg {
  flex-shrink: 0;
  margin-top: 2px;
}

/* Banner de resultado y devolución */
.result-hero-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.result-hero-box.has-refund {
  border-color: var(--emerald-border);
  background: linear-gradient(180deg, var(--bg-card) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.result-hero-box.has-refund::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.result-hero-box.no-refund::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #94a3b8 0%, #64748b 100%);
}

.result-main-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  align-items: center;
}

@media (max-width: 860px) {
  .result-main-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

.result-kpi-main {
  display: flex;
  flex-direction: column;
}

.result-badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.75rem;
  width: fit-content;
}

.result-badge-status.success {
  background: var(--emerald-light);
  color: var(--emerald-color);
  border: 1px solid var(--emerald-border);
}

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

.result-figure {
  font-family: var(--font-mono);
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--emerald-color);
  margin-bottom: 0.35rem;
}

.result-figure.neutral {
  color: var(--text-muted);
}

.result-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.result-details-text {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* Indicador visual de umbral (termómetro / barra) */
.threshold-meter-card {
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.meter-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 0.5rem;
}

.meter-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

.meter-val {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.meter-bar-track {
  width: 100%;
  height: 12px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-color);
}

.meter-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--primary-color);
}

.meter-bar-fill.exceeded {
  background: linear-gradient(90deg, #2563eb 0%, #10b981 100%);
}

.meter-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #f59e0b;
  z-index: 2;
}

.meter-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Rejilla de métricas secundarias (KPIs) */
.kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.kpi-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

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

/* Tabla de desglose euro a euro */
.table-responsive-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  background: var(--bg-card);
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.breakdown-table th,
.breakdown-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.breakdown-table th {
  background: var(--bg-card-secondary);
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

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

.breakdown-table tr.highlight-row {
  background: var(--primary-light);
  font-weight: 600;
}

.breakdown-table tr.success-row {
  background: var(--emerald-light);
  font-weight: 700;
}

.breakdown-table td.num {
  text-align: right;
  font-family: var(--font-mono);
}

/* Comparador de escenarios */
.scenarios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.scenario-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, border-color 0.2s;
}

.scenario-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
}

.scenario-card.recommended {
  border-color: var(--emerald-border);
  background: linear-gradient(180deg, var(--bg-card) 0%, rgba(16, 185, 129, 0.04) 100%);
}

.scenario-badge-top {
  position: absolute;
  top: -10px;
  right: 16px;
  background: var(--emerald-color);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
}

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

.scenario-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  min-height: 42px;
}

.scenario-cost-box {
  background: var(--bg-card-secondary);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

.scenario-cost-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

.scenario-cost-val {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
}

.scenario-details-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.scenario-details-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.scenario-details-list svg {
  flex-shrink: 0;
  margin-top: 3px;
}

/* Guía de derechos y prestaciones */
.rights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 860px) {
  .rights-grid {
    grid-template-columns: 1fr;
  }
}

.right-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

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

.right-icon-box {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  color: var(--primary-color);
  flex-shrink: 0;
}

.right-title {
  font-size: 1.1rem;
  margin: 0;
}

.right-short {
  font-size: 0.88rem;
  color: var(--primary-color);
  font-weight: 600;
  margin: 0 0 0.85rem;
}

.right-content-p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0 0 0.75rem;
}

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

/* Botón de acción para generar informe */
.action-bar-hero {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.btn-generate-report {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  background: var(--primary-gradient);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.2s;
  min-height: 40px;
}

.btn-generate-report:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-generate-report:active {
  transform: translateY(0);
}

/* Modales accesibles (anti-alert) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  position: relative;
  transform: scale(0.96);
  transition: transform 0.2s;
}

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

.modal-close-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

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

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

.report-modal-title {
  font-size: 1.4rem;
  margin: 0 0 0.25rem;
}

.report-modal-date {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.report-summary-box {
  background: var(--bg-card-secondary);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.report-item-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.88rem;
  border-bottom: 1px dashed var(--border-color);
}

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

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

.report-item-val.highlight {
  color: var(--emerald-color);
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn-secondary {
  padding: 0.65rem 1.15rem;
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 40px;
}

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

/* Acordeón FAQ y Guía SEO */
.faq-accordion-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.faq-section-title {
  font-size: 1.35rem;
  margin: 0 0 1.25rem;
}

.faq-item {
  border-bottom: 1px solid var(--border-color);
}

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

.faq-trigger {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s;
}

.faq-trigger:hover {
  color: var(--primary-color);
}

.faq-trigger-icon {
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

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

.faq-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.faq-item.open .faq-body {
  max-height: 500px;
}

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

/* Estilos de impresión */
@media print {
  body {
    background: #ffffff;
    color: #000000;
  }
  .app-header,
  .tool-ad-sidebar,
  .tools-ad-banner-section,
  .tool-nav-tabs,
  .action-bar-hero,
  .faq-accordion-section,
  .related-tools-section,
  .fijate-footer {
    display: none !important;
  }
  .tool-with-sidebar {
    display: block !important;
  }
  .simulator-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .calc-card,
  .result-hero-box,
  .threshold-meter-card,
  .kpi-card {
    border: 1px solid #cccccc !important;
    background: #ffffff !important;
    box-shadow: none !important;
    color: #000000 !important;
  }
  .result-figure {
    color: #059669 !important;
  }
}
