/**
 * Calculadora de consumo y fuga de agua en el hogar
 * Estilos visuales corporativos (Fijate Tools)
 */

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

  /* Paleta corporativa clara */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --border-card: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-heading: #1e293b;

  /* Acentos hídricos */
  --primary-blue: #0284c7;
  --primary-blue-hover: #0369a1;
  --primary-blue-light: #e0f2fe;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-indigo: #6366f1;

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

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
}

[data-theme="dark"] {
  --bg-app: #0b0f17;
  --bg-card: #151d2c;
  --bg-card-subtle: #1e293b;
  --border-card: #283548;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-heading: #f8fafc;

  --primary-blue: #38bdf8;
  --primary-blue-hover: #0ea5e9;
  --primary-blue-light: rgba(56, 189, 248, 0.12);
  --accent-cyan: #22d3ee;
  --accent-emerald: #34d399;
  --accent-amber: #fbbf24;
  --accent-rose: #fb7185;
  --accent-indigo: #818cf8;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.5);
}

/* Reset y estructura canónica */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

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

/* Layout y contención */
.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 principal */
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

/* Barra de pestañas / módulos */
.calc-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-card);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 40px;
}

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

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

/* Selector superior de personas */
.people-selector-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.people-info {
  display: flex;
  flex-direction: column;
}

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

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

.people-chips {
  display: flex;
  gap: 0.4rem;
}

.chip-person {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  color: var(--text-heading);
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.chip-person.active {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
}

/* Rejilla de bloques de hábitos de consumo */
.audit-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

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

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

.card-header-clean {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-card);
  padding-bottom: 0.75rem;
}

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

.card-icon-tag.blue { background: rgba(2, 132, 199, 0.12); color: var(--primary-blue); }
.card-icon-tag.cyan { background: rgba(6, 182, 212, 0.12); color: var(--accent-cyan); }
.card-icon-tag.indigo { background: rgba(99, 102, 241, 0.12); color: var(--accent-indigo); }
.card-icon-tag.green { background: rgba(16, 185, 129, 0.12); color: var(--accent-emerald); }

.card-heading {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-heading);
}

.card-caption {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Grupos de formularios, sliders y selects */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

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

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

.val-pill {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  color: var(--primary-blue);
}

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

.form-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border-card);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  margin: 0.4rem 0;
}

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

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

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

.form-select,
.form-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 40px;
  height: 40px;
  padding: 0 0.85rem;
  font-family: var(--font-main);
  font-size: 0.875rem;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  background-color: var(--bg-card-subtle);
  color: var(--text-main);
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-select {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  padding-right: 40px;
  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.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;
  appearance: none;
  -webkit-appearance: none;
}

.form-select:focus,
.form-input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

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

.info-tip-box {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(2, 132, 199, 0.08);
  border-left: 3px solid var(--primary-blue);
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.info-tip-box svg {
  flex-shrink: 0;
  color: var(--primary-blue);
  margin-top: 2px;
}

/* Dashboard de resultados de auditoría */
.results-dashboard {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dash-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-heading);
}

/* Tarjeta semáforo INE */
.ine-benchmark-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .ine-benchmark-card {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1.5rem;
    align-items: center;
  }
}

.ine-metric {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border-card);
  padding-bottom: 0.75rem;
}

@media (min-width: 768px) {
  .ine-metric {
    border-bottom: none;
    border-right: 1px solid var(--border-card);
    padding-bottom: 0;
    padding-right: 1.25rem;
  }
}

.ine-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.ine-val {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--primary-blue);
}

.ine-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ine-status-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ine-badge-pill {
  align-self: flex-start;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

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

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

.ine-comparison-text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.45;
}

.ine-meter-bar {
  position: relative;
  width: 100%;
  height: 12px;
  background: var(--border-card);
  border-radius: var(--radius-pill);
  margin-top: 1rem;
}

.ine-fill-bar {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent-emerald) 0%, var(--accent-amber) 65%, var(--accent-rose) 100%);
  transition: width 0.4s ease;
}

.ine-target-marker {
  position: absolute;
  top: -8px;
  bottom: -8px;
  width: 2px;
  background: #0f172a;
  z-index: 2;
}

[data-theme="dark"] .ine-target-marker {
  background: #ffffff;
}

.marker-tag {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
  background: var(--text-heading);
  color: var(--bg-card);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

/* Rejilla de 4 KPIs de volumen */
.kpi-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 900px) {
  .kpi-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .kpi-summary-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.kpi-stat-card.highlight {
  border-color: var(--primary-blue);
  background: var(--primary-blue-light);
}

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

.kpi-num {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-heading);
}

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

/* Desglose porcentual apilado */
.breakdown-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.breakdown-heading {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-heading);
}

.breakdown-bar-stacked {
  display: flex;
  width: 100%;
  height: 20px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--border-card);
}

.breakdown-segment {
  height: 100%;
  transition: width 0.3s ease;
}

.seg-shower { background-color: var(--primary-blue); }
.seg-toilet { background-color: var(--accent-cyan); }
.seg-washing { background-color: var(--accent-indigo); }
.seg-dishes { background-color: var(--accent-amber); }
.seg-garden { background-color: var(--accent-emerald); }

.breakdown-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  font-size: 0.8rem;
}

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

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.report-actions-row {
  display: flex;
  justify-content: flex-end;
}

/* Botones principales */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-md);
  background: var(--primary-blue);
  color: #ffffff;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
}

.btn-primary:hover {
  background: var(--primary-blue-hover);
  transform: translateY(-1px);
}

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

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

/* PANEL 2: FUGAS Y AVERÍAS */
.panel-intro-card {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.alert-warning-tint {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: var(--text-main);
}

.intro-icon {
  flex-shrink: 0;
  color: var(--accent-amber);
  margin-top: 2px;
}

.intro-title {
  margin: 0 0 0.35rem;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-heading);
}

.intro-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.leaks-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

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

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

.leak-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-card);
  padding-bottom: 0.75rem;
}

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

.leak-icon-box.danger { background: rgba(244, 63, 94, 0.12); color: var(--accent-rose); }
.leak-icon-box.warning { background: rgba(245, 158, 11, 0.12); color: var(--accent-amber); }

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

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

.drip-presets-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.btn-mini-chip {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-mini-chip:hover,
.btn-mini-chip.active {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
  background: var(--primary-blue-light);
}

.leak-impact-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
}

.impact-metric {
  display: flex;
  flex-direction: column;
}

.impact-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.impact-num {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-heading);
}

.impact-cost {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent-rose);
}

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

.leak-diagnostic-guide {
  font-size: 0.8rem;
  line-height: 1.45;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  border-left: 3px solid var(--accent-amber);
}

.guide-title {
  display: block;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 0.25rem;
}

.total-leaks-banner {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.total-leaks-text {
  display: flex;
  flex-direction: column;
}

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

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

.total-leaks-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.stat-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
}

.stat-pill.danger {
  border-color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.08);
}

.stat-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.stat-val {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-heading);
}

.stat-pill.danger .stat-val {
  color: var(--accent-rose);
}

/* PANEL 3: PROTOCOLO NOCTURNO */
.protocol-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.protocol-header {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.protocol-step-badge {
  align-self: flex-start;
  padding: 0.2rem 0.6rem;
  background: var(--primary-blue-light);
  color: var(--primary-blue);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
}

.protocol-heading {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-heading);
}

.protocol-lead {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

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

@media (max-width: 900px) {
  .protocol-steps-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .protocol-steps-grid {
    grid-template-columns: 1fr;
  }
}

.step-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-blue);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
}

.step-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-heading);
}

.step-desc {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.meter-calc-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.meter-calc-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-heading);
}

.meter-inputs-row {
  display: grid;
  grid-template-columns: 1fr 1fr 140px;
  gap: 1rem;
}

@media (max-width: 768px) {
  .meter-inputs-row {
    grid-template-columns: 1fr;
  }
}

.meter-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.meter-input-wrapper .form-input {
  padding-right: 50px;
}

.meter-input-wrapper .unit-tag,
.input-unit-wrapper .unit-tag {
  position: absolute;
  right: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  pointer-events: none;
}

.input-unit-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-unit-wrapper .form-input {
  padding-right: 65px;
}

.meter-actions-row {
  display: flex;
  justify-content: flex-start;
}

.meter-result-card {
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  animation: fadeIn 0.3s ease;
}

.meter-result-card.ok {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
}

.meter-result-card.alert {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.3);
}

/* PANEL 4: FACTURA Y TRAMOS */
.bill-settings-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.settings-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-heading);
}

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

.bill-controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .bill-controls-grid {
    grid-template-columns: 1fr;
  }
}

.blocks-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.table-title {
  margin: 0 0 0.75rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-heading);
}

.table-responsive {
  overflow-x: auto;
}

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

.blocks-table th {
  padding: 0.6rem 0.8rem;
  border-bottom: 2px solid var(--border-card);
  color: var(--text-muted);
  font-weight: 600;
}

.blocks-table td {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--border-card);
  color: var(--text-main);
}

.block-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

.block-tag.tier1 { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.block-tag.tier2 { background: rgba(2, 132, 199, 0.15); color: var(--primary-blue); }
.block-tag.tier3 { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }

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

@media (max-width: 768px) {
  .bill-projection-grid {
    grid-template-columns: 1fr;
  }
}

.projection-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.projection-card.highlight {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.08);
}

.proj-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.proj-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-heading);
}

.proj-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

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

.custom-modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScale 0.2s ease-out;
}

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

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

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

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

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.6;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-card);
  background: var(--bg-card-subtle);
}

/* Guía SEO y FAQ */
.tool-seo-guide {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.75rem;
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.seo-guide-content h2 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
}

.seo-guide-content h2:first-child {
  margin-top: 0;
}

.seo-guide-content p {
  color: var(--text-main);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.seo-guide-content ul {
  padding-left: 1.25rem;
  margin-bottom: 1.25rem;
  color: var(--text-main);
  line-height: 1.65;
}

.seo-faq-accordion {
  margin-top: 2rem;
  border-top: 1px solid var(--border-card);
  padding-top: 1.5rem;
}

.seo-faq-item {
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  background: var(--bg-card-subtle);
  overflow: hidden;
  transition: all 0.2s ease;
}

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

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

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

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

.seo-faq-answer {
  padding: 0 1.25rem 1rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.seo-faq-answer p {
  margin: 0;
}

/* Animaciones */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* Adaptación responsive */
@media (max-width: 640px) {
  .tool-card {
    padding: 1rem;
  }

  .calc-tabs-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .tab-btn {
    justify-content: center;
    font-size: 0.8rem;
    padding: 0.5rem;
  }

  .btn-primary, .btn-secondary {
    width: 100%;
  }

  .report-actions-row {
    width: 100%;
  }
}
