/**
 * Fijate Tools - Calculadora de captación de agua de lluvia y depósito
 * Estilos canónicos, tema claro y oscuro, controles táctiles y gráficos responsivos.
 */

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

  /* Colores tema claro */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-sub: #f1f5f9;
  --bg-input: #ffffff;
  --bg-ground: #e2e8f0;
  --bg-tank-body: #f8fafc;
  
  --border-color: #e2e8f0;
  --border-focus: #0284c7;

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

  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: rgba(2, 132, 199, 0.1);

  --accent-emerald: #10b981;
  --accent-emerald-light: rgba(16, 185, 129, 0.12);
  --accent-amber: #f59e0b;
  --accent-amber-light: rgba(245, 158, 11, 0.12);
  --accent-purple: #8b5cf6;
  --accent-purple-light: rgba(139, 92, 246, 0.12);

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.03);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

[data-theme="dark"], body.dark-mode {
  --bg-page: #0b0f17;
  --bg-card: #131b26;
  --bg-card-sub: #1a2433;
  --bg-input: #1a2433;
  --bg-ground: #1e293b;
  --bg-tank-body: #0f172a;

  --border-color: #243042;
  --border-focus: #38bdf8;

  --text-main: #f1f5f9;
  --text-muted: #cbd5e1;
  --text-dim: #94a3b8;

  --primary: #38bdf8;
  --primary-hover: #0284c7;
  --primary-light: rgba(56, 189, 248, 0.15);

  --accent-emerald: #34d399;
  --accent-emerald-light: rgba(52, 211, 153, 0.15);
  --accent-amber: #fbbf24;
  --accent-amber-light: rgba(251, 191, 36, 0.15);
  --accent-purple: #a78bfa;
  --accent-purple-light: rgba(167, 139, 250, 0.15);

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

/* Reset y estructura global */
* {
  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;
  -webkit-font-smoothing: antialiased;
}

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

/* Suite navigation strip */
.suite-nav-strip {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0.6rem 1rem;
}

.suite-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.suite-nav-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
}

.suite-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.suite-link-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  background: var(--bg-card-sub);
  white-space: nowrap;
  transition: all 0.2s ease;
}

.suite-link-item:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.suite-link-item.active {
  color: #ffffff;
  background: var(--primary);
  font-weight: 600;
}

/* Layout con sidebar publicitaria */
.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%;
}

/* Tarjeta de introducción técnica */
.tool-intro-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.intro-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  margin-bottom: 0.75rem;
}

.intro-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

.intro-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Tarjeta del formulario de cálculo */
.calculator-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
  overflow: hidden;
}

.calculator-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card-sub);
}

.calc-header-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.calculator-body {
  padding: 1.5rem;
}

.calc-section {
  padding-bottom: 1.75rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-color);
}

.calc-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.section-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  margin-bottom: 1.25rem;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.section-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Grids de formulario */
.form-grid-dual {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

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

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

.field-sublabel {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.field-hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* Desplegables con protección contra desbordamiento */
.field-select, .field-select-sm {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  height: 42px;
  min-height: 40px;
  padding: 0 40px 0 0.85rem;
  font-family: var(--font-main);
  font-size: 0.9rem;
  color: var(--text-main);
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  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='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field-select-sm {
  height: 38px;
  font-size: 0.84rem;
}

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

.field-select option, .field-select-sm option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

/* Inputs y wrappers con sufijo */
.input-with-suffix {
  display: flex;
  align-items: center;
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-input);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

.field-input, .field-input-sm {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  height: 42px;
  min-height: 40px;
  padding: 0 0.85rem;
  font-family: var(--font-main);
  font-size: 0.95rem;
  color: var(--text-main);
  background: transparent;
  border: none;
}

.field-input-sm {
  height: 38px;
  font-size: 0.88rem;
}

.field-input:focus, .field-input-sm:focus {
  outline: none;
}

.input-suffix {
  padding: 0 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  background-color: var(--bg-card-sub);
  height: 100%;
  display: flex;
  align-items: center;
  border-left: 1px solid var(--border-color);
  white-space: nowrap;
}

/* Sliders y presets de chips */
.slider-wrapper {
  margin-top: 0.5rem;
}

.field-slider {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.btn-chip {
  padding: 0.25rem 0.6rem;
  font-size: 0.76rem;
  font-weight: 500;
  border-radius: 9999px;
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

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

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

/* Indicador Ce */
.ce-indicator {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.6rem 0.85rem;
  background: var(--bg-card-sub);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
  margin-top: 0.4rem;
}

.ce-badge {
  font-size: 0.82rem;
  color: var(--text-main);
}

.ce-desc {
  font-size: 0.76rem;
  color: var(--text-dim);
}

/* Grid de usos de demanda */
.demanda-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.demanda-card {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: border-color 0.2s;
}

.demanda-card:hover {
  border-color: var(--primary);
}

.demanda-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.demanda-icon {
  font-size: 1.4rem;
}

.demanda-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.demanda-card-sub {
  font-size: 0.74rem;
  color: var(--text-dim);
}

.demanda-card-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Botones de acción general */
.btn-primary-action, .btn-secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 42px;
  min-height: 40px;
  padding: 0 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

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

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

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

.btn-secondary-action:hover {
  background: var(--bg-card-sub);
  border-color: var(--text-dim);
}

/* Panel de Resultados y KPIs */
.results-container {
  margin-bottom: 2.5rem;
}

.kpis-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 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.25rem;
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.kpi-blue::before { background: var(--primary); }
.kpi-amber::before { background: var(--accent-amber); }
.kpi-emerald::before { background: var(--accent-emerald); }
.kpi-purple::before { background: var(--accent-purple); }

.kpi-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-blue .kpi-icon-wrap { background: var(--primary-light); color: var(--primary); }
.kpi-amber .kpi-icon-wrap { background: var(--accent-amber-light); color: var(--accent-amber); }
.kpi-emerald .kpi-icon-wrap { background: var(--accent-emerald-light); color: var(--accent-emerald); }
.kpi-purple .kpi-icon-wrap { background: var(--accent-purple-light); color: var(--accent-purple); }

.kpi-content {
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 0.2rem;
}

.kpi-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Esquema SVG dinámico */
.diagram-section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

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

.diagram-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

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

.diagram-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  background: var(--accent-emerald-light);
  color: var(--accent-emerald);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.svg-diagram-wrapper {
  padding: 1rem;
  display: flex;
  justify-content: center;
  background: var(--bg-card);
}

.harvesting-svg-diagram {
  width: 100%;
  max-width: 840px;
  height: auto;
  display: block;
}

/* Animación de lluvia en SVG */
@keyframes rain-fall {
  0% { transform: translateY(-8px); }
  100% { transform: translateY(8px); }
}

.rain-animation {
  animation: rain-fall 0.8s linear infinite;
}

/* Gráfico de balance mensual Canvas */
.chart-section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  padding: 1.5rem;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.chart-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.chart-legend {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.chart-canvas-wrapper {
  width: 100%;
  overflow-x: auto;
  position: relative;
}

#canvas-harvesting-chart {
  width: 100%;
  max-width: 100%;
  height: 280px;
  display: block;
}

.chart-footer-insights {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card-sub);
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  border-left: 3px solid var(--accent-emerald);
}

/* Tabla de balance detallado */
.table-details-card {
  margin-bottom: 1.5rem;
}

.details-accordion {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.details-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  cursor: pointer;
  background: var(--bg-card-sub);
  list-style: none;
  user-select: none;
}

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

.summary-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.summary-arrow {
  font-size: 0.75rem;
  transition: transform 0.2s;
}

.details-accordion[open] .summary-arrow {
  transform: rotate(180deg);
}

.details-content {
  padding: 1rem;
  background: var(--bg-card);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table-harvesting {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: right;
}

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

.table-harvesting th:first-child, .table-harvesting td:first-child {
  text-align: left;
}

.table-harvesting th {
  background: var(--bg-card-sub);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.table-harvesting tbody tr:hover {
  background: var(--primary-light);
}

.table-harvesting tfoot tr {
  font-weight: 700;
  background: var(--bg-card-sub);
  color: var(--text-main);
}

/* Tarjeta de amortización y presupuesto */
.amortization-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.amortization-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

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

.amortization-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.amort-metric {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
}

.amort-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.amort-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
}

.amort-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.text-emerald { color: var(--accent-emerald) !important; }
.text-sky { color: var(--primary) !important; }

/* Botones de acción */
.action-buttons-wrap {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

/* Guía técnica SEO y acordeones */
.seo-guide-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2.5rem;
}

.seo-guide-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

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

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

.faq-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card-sub);
  overflow: hidden;
}

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

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

.faq-toggle-icon {
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--primary);
  transition: transform 0.2s;
}

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

.faq-answer {
  padding: 1rem 1.25rem 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
}

.faq-answer p {
  margin-bottom: 0.75rem;
}

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

.faq-answer ul, .faq-answer ol {
  padding-left: 1.35rem;
  margin-bottom: 0.75rem;
}

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

.formula-box {
  background: var(--bg-card-sub);
  border-left: 3px solid var(--primary);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin: 0.75rem 0;
  color: var(--text-main);
  overflow-x: auto;
}

/* Modales accesibles */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-pop 0.2s ease-out;
}

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card-sub);
}

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

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

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

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card-sub);
}

.btn-modal-cancel {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
  font-weight: 600;
}

.btn-modal-confirm {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--primary);
  border: none;
  color: #ffffff;
  cursor: pointer;
  font-weight: 600;
}

/* Modo impresión */
@media print {
  .app-header, .suite-nav-strip, .tools-ad-banner-section, .tool-ad-sidebar,
  .action-buttons-wrap, .fijate-footer, .preset-chips, .calc-header-actions,
  .affiliate-showcase-container, .related-tools-container {
    display: none !important;
  }

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

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

  .calculator-card, .diagram-section-card, .chart-section-card, .amortization-card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }
}

/* Responsividad en tablet y móvil */
@media (max-width: 1024px) {
  .kpis-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .demanda-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .amortization-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .form-grid-dual {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .demanda-grid {
    grid-template-columns: 1fr;
  }

  .kpis-grid {
    grid-template-columns: 1fr;
  }

  .amortization-grid {
    grid-template-columns: 1fr;
  }

  .chart-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .action-buttons-wrap {
    flex-direction: column;
  }

  .action-buttons-wrap button {
    width: 100%;
  }

  .field-input, .field-select, .btn-primary-action, .btn-secondary-action {
    width: 100%;
    min-height: 40px;
  }
}
