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

  /* Colores temáticos solares (Modo oscuro por defecto) */
  --bg-app: #0b0f17;
  --bg-card: #131b26;
  --bg-card-hover: #1a2536;
  --bg-card-subtle: #0f1622;
  --border-color: #233044;
  --border-color-focus: #f59e0b;

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

  --solar-amber: #f59e0b;
  --solar-amber-light: #fbbf24;
  --solar-amber-glow: rgba(245, 158, 11, 0.18);

  --solar-green: #10b981;
  --solar-green-light: #34d399;
  --solar-green-glow: rgba(16, 185, 129, 0.18);

  --solar-blue: #0ea5e9;
  --solar-blue-light: #38bdf8;
  --solar-blue-glow: rgba(14, 165, 233, 0.18);

  --solar-red: #ef4444;
  --solar-purple: #8b5cf6;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 25px rgba(245, 158, 11, 0.25);
}

/* Adaptación para Tema Claro */
[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-card-subtle: #f8fafc;
  --border-color: #e2e8f0;
  --border-color-focus: #d97706;

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

  --solar-amber: #d97706;
  --solar-amber-light: #f59e0b;
  --solar-amber-glow: rgba(217, 119, 6, 0.15);

  --solar-green: #059669;
  --solar-green-light: #10b981;
  --solar-green-glow: rgba(5, 150, 105, 0.15);

  --solar-blue: #0284c7;
  --solar-blue-light: #0ea5e9;
  --solar-blue-glow: rgba(2, 132, 199, 0.15);

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.06);
  --shadow-glow: 0 0 25px rgba(217, 119, 6, 0.18);
}

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

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

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

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

/* Botón de informe técnico en cabecera */
.btn-action-report {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--solar-amber), #ea580c);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-height: 38px;
}

.btn-action-report:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

/* Layout principal */
.main-wrapper.tool-layout {
  max-width: 1240px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
  box-sizing: border-box;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-sizing: border-box;
}

/* Migas de pan canónicas */
.tool-breadcrumbs {
  margin-bottom: 0.25rem;
}

.tool-breadcrumbs-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
  font-size: 0.825rem;
  color: var(--text-dim);
}

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

.tool-breadcrumbs-link:hover {
  color: var(--solar-amber);
}

.tool-breadcrumbs-current {
  color: var(--text-main);
  font-weight: 500;
}

/* Tarjeta principal contenedor */
.solar-tool-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.solar-section-config,
.solar-section-loads,
.solar-section-results,
.solar-section-visualizer,
.solar-section-financial,
.solar-section-faq {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Cabeceras de sección */
.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.section-header-row.flex-between {
  justify-content: space-between;
  align-items: flex-start;
}

.section-title {
  font-size: 1.25rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-title svg {
  color: var(--solar-amber);
}

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

.badge-status-solar {
  background: var(--solar-amber-glow);
  color: var(--solar-amber-light);
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

/* Selector de tipo de instalación */
.mode-selector-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.mode-card {
  background: var(--bg-card-subtle);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  text-align: left;
  transition: all 0.2s ease;
  min-height: 48px;
}

.mode-card:hover {
  border-color: rgba(245, 158, 11, 0.4);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.mode-card.active {
  border-color: var(--solar-amber);
  background: var(--solar-amber-glow);
  box-shadow: 0 0 0 1px var(--solar-amber);
}

.mode-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(245, 158, 11, 0.12);
  color: var(--solar-amber);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mode-card.active .mode-icon {
  background: var(--solar-amber);
  color: #ffffff;
}

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

.mode-desc {
  font-size: 0.775rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Cuadrícula de configuración (Ubicación, autonomía, régimen) */
.config-controls-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.form-group-solar {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  max-width: 100%;
}

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

.select-wrapper {
  position: relative;
  width: 100%;
}

.select-wrapper::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
}

.select-solar {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  height: 42px;
  padding: 0 2.2rem 0 0.85rem;
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

.select-solar:focus {
  border-color: var(--border-color-focus);
  box-shadow: 0 0 0 3px var(--solar-amber-glow);
}

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

[data-theme="light"] .select-solar option {
  background-color: #ffffff;
  color: #0f172a;
}

.input-solar {
  width: 100%;
  height: 42px;
  padding: 0 0.85rem;
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.input-solar:focus {
  border-color: var(--border-color-focus);
  box-shadow: 0 0 0 3px var(--solar-amber-glow);
}

/* Presets y pestañas de categorías */
.presets-btn-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.preset-label {
  font-size: 0.775rem;
  color: var(--text-dim);
  font-weight: 500;
  margin-right: 0.2rem;
}

.btn-preset {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.35rem 0.7rem;
  font-size: 0.775rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  min-height: 32px;
}

.btn-preset:hover {
  background: var(--bg-card-hover);
  color: var(--solar-amber);
  border-color: rgba(245, 158, 11, 0.4);
}

.btn-preset.active {
  background: var(--solar-amber-glow);
  color: var(--solar-amber-light);
  border-color: var(--solar-amber);
}

.btn-preset-clear {
  background: transparent;
  border: 1px dashed var(--text-dim);
  color: var(--text-dim);
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-preset-clear:hover {
  border-color: var(--solar-red);
  color: var(--solar-red);
}

.category-tabs-bar {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.cat-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}

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

.cat-tab.active {
  color: var(--solar-amber-light);
  background: var(--solar-amber-glow);
}

/* Cuadrícula interactiva de cargas */
.loads-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.load-card {
  background: var(--bg-card-subtle);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: all 0.2s ease;
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.load-card:hover {
  border-color: rgba(245, 158, 11, 0.35);
  background: var(--bg-card-hover);
}

.load-card.is-active {
  border-color: var(--solar-amber);
  background: rgba(245, 158, 11, 0.05);
  box-shadow: 0 4px 15px -3px rgba(245, 158, 11, 0.15);
}

.load-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.load-info-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1 1 0%;
  min-width: 0;
  overflow: hidden;
}

.load-icon {
  font-size: 1.35rem;
  width: 38px;
  height: 38px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.load-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 0%;
  overflow: hidden;
}

.load-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
}

.load-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Switch toggle moderno */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--solar-amber);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Controles de slider y unidades de la tarjeta */
.load-card-controls {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.control-row-qty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.775rem;
  color: var(--text-muted);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.qty-counter {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.btn-qty {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.15s;
}

.btn-qty:hover {
  border-color: var(--solar-amber);
  color: var(--solar-amber);
}

.qty-val {
  min-width: 22px;
  text-align: center;
  font-weight: 700;
  color: var(--text-main);
}

.control-row-slider {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.slider-hours-val {
  color: var(--solar-amber-light);
  font-weight: 600;
}

.solar-range-input {
  width: 100%;
  accent-color: var(--solar-amber);
  cursor: pointer;
  height: 5px;
}

.btn-remove-custom-load {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--solar-red);
  cursor: pointer;
  font-size: 1.1rem;
  opacity: 0.7;
}

.btn-remove-custom-load:hover {
  opacity: 1;
}

/* Barra flotante de demanda en vivo */
.live-demand-summary {
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 1rem;
  background: linear-gradient(135deg, var(--bg-card-subtle), var(--bg-card));
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.5rem;
  margin-top: 1.5rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.demand-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.2rem;
}

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

.demand-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--solar-amber-light);
  font-family: var(--font-mono);
}

.demand-value.highlight-surge {
  color: #fb923c;
}

/* Botón añadir custom */
.add-custom-bar {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.btn-add-custom {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card-subtle);
  border: 1.5px dashed var(--border-color);
  color: var(--text-main);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 40px;
}

.btn-add-custom:hover {
  border-color: var(--solar-amber);
  color: var(--solar-amber);
  background: var(--bg-card-hover);
}

/* 3. Dimensionamiento y resultados */
.panel-power-selector {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

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

.select-solar-inline {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

.dimensioning-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.component-card {
  background: var(--bg-card-subtle);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.component-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px -4px rgba(0, 0, 0, 0.35);
}

.comp-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.comp-badge-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-solar {
  background: var(--solar-amber-glow);
  color: var(--solar-amber-light);
}

.icon-battery {
  background: var(--solar-green-glow);
  color: var(--solar-green-light);
}

.icon-inverter {
  background: var(--solar-blue-glow);
  color: var(--solar-blue-light);
}

.icon-mppt {
  background: rgba(139, 92, 246, 0.18);
  color: #a78bfa;
}

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

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

.comp-main-metric {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.metric-number {
  font-family: var(--font-mono);
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.solar-panel-card .metric-number {
  color: var(--solar-amber-light);
}

.battery-card .metric-number {
  color: var(--solar-green-light);
}

.inverter-card .metric-number {
  color: var(--solar-blue-light);
}

.mppt-card .metric-number {
  color: #c4b5fd;
}

.metric-unit {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.comp-details-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.comp-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.comp-detail-row strong {
  color: var(--text-main);
}

.comp-detail-row .highlight-surge {
  color: #fb923c;
}

/* Botón contextual de afiliado en tarjetas de dimensionamiento */
.comp-affiliate-action {
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-color);
}

[data-theme="light"] .comp-affiliate-action {
  border-top-color: #e2e8f0;
}

.btn-affiliate-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  min-height: 40px;
  padding: 0.55rem 0.9rem;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  color: var(--solar-amber-light);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  text-align: center;
}

.btn-affiliate-card:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: var(--solar-amber);
  color: #ffffff;
  transform: translateY(-1px);
}

[data-theme="light"] .btn-affiliate-card {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

[data-theme="light"] .btn-affiliate-card:hover {
  background: #fde68a;
  border-color: #f59e0b;
  color: #78350f;
}

/* Callout para estaciones portátiles en consumos bajos */
.portable-station-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(234, 88, 12, 0.05));
  border: 1.5px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-lg);
}

.station-callout-icon {
  font-size: 2.2rem;
  line-height: 1;
  flex-shrink: 0;
}

.station-callout-info {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex: 1;
}

.station-callout-info strong {
  color: var(--solar-amber-light);
  font-size: 0.95rem;
}

[data-theme="light"] .station-callout-info strong {
  color: #b45309;
}

.btn-station-affiliate {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem;
  background: linear-gradient(135deg, var(--solar-amber), #ea580c);
  color: #ffffff;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 42px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-station-affiliate:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

/* Showcase de componentes y accesorios recomendados */
.affiliate-showcase-container {
  margin-top: 2rem;
  background: var(--bg-card-subtle);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
}

.affiliate-showcase-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.35rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

[data-theme="light"] .affiliate-showcase-header {
  border-bottom-color: #e2e8f0;
}

.affiliate-showcase-title {
  font-size: 1.15rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.affiliate-showcase-title svg {
  color: var(--solar-amber);
}

.affiliate-showcase-desc {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.amazon-prime-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  background: rgba(255, 153, 0, 0.12);
  border: 1px solid rgba(255, 153, 0, 0.35);
  border-radius: 20px;
  font-size: 0.775rem;
  font-weight: 700;
  color: #ff9900;
  white-space: nowrap;
  flex-shrink: 0;
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff9900;
  box-shadow: 0 0 6px rgba(255, 153, 0, 0.8);
}

/* Grid de productos recomendados */
.affiliate-products-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.aff-product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.aff-product-card:hover {
  transform: translateY(-2px);
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .aff-product-card:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.aff-card-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--solar-amber);
}

.aff-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.aff-card-meta {
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--solar-blue-light);
  font-family: var(--font-mono);
}

[data-theme="light"] .aff-card-meta {
  color: #0284c7;
}

.aff-card-desc {
  font-size: 0.785rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: auto;
}

.btn-aff-product {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-height: 40px;
  padding: 0.55rem 0.85rem;
  margin-top: 0.5rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-aff-product:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--solar-amber);
  color: var(--solar-amber-light);
}

[data-theme="light"] .btn-aff-product:hover {
  background: #fef3c7;
  color: #b45309;
}

/* Divulgación legal de Amazon */
.amazon-affiliate-disclosure {
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.775rem;
  color: var(--text-dim);
  line-height: 1.5;
}

[data-theme="light"] .amazon-affiliate-disclosure {
  border-top-color: #e2e8f0;
  color: #64748b;
}

/* Responsive móvil */
@media (max-width: 992px) {
  .affiliate-products-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .portable-station-callout {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.1rem;
  }

  .btn-station-affiliate {
    width: 100%;
    justify-content: center;
  }

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

  .affiliate-products-grid {
    grid-template-columns: 1fr;
  }
}

/* 4. Diagrama unifilar interactivo animado */
.unifilar-diagram-container {
  background: #080d14;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

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

.unifilar-badge {
  font-size: 0.775rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--solar-amber);
}

.unifilar-status-live {
  font-size: 0.8rem;
  color: var(--solar-green-light);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.unifilar-status-live::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--solar-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--solar-green);
  animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.unifilar-stage {
  position: relative;
  width: 100%;
  height: 220px;
}

#unifilar-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.node-box {
  position: absolute;
  width: 110px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.2rem;
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: border-color 0.2s;
}

.node-box:hover {
  border-color: var(--solar-amber);
}

.node-icon {
  font-size: 1.25rem;
}

.node-title {
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.2;
}

.node-val {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Posicionamiento de los nodos */
.node-panels {
  top: 15px;
  left: 5%;
  border-color: var(--solar-amber);
}

.node-mppt {
  top: 15px;
  left: 38%;
}

.node-battery {
  bottom: 15px;
  left: 38%;
  border-color: var(--solar-green);
}

.node-inverter {
  top: 15px;
  left: 70%;
  border-color: var(--solar-blue);
}

.node-loads {
  bottom: 15px;
  left: 70%;
}

.node-grid {
  top: 15px;
  right: 2%;
}

/* Gráficas 24h y Donut */
.chart-dual-container {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1.25rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.chart-card-box {
  background: var(--bg-card-subtle);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.chart-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.75rem;
  min-width: 0;
  max-width: 100%;
}

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

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

.chart-legend-custom {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.leg-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.leg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.leg-dot.color-solar { background: var(--solar-amber); }
.leg-dot.color-load { background: #38bdf8; }
.leg-dot.color-battery { background: var(--solar-green); }

.chart-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 250px;
  overflow: hidden;
}

.chart-canvas-wrap canvas {
  max-width: 100% !important;
}

.chart-canvas-wrap.donut-wrap {
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 5. Resumen de costes */
.cost-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.cost-kpi-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.cost-kpi-card.highlight-savings {
  border-color: rgba(16, 185, 129, 0.4);
  background: var(--solar-green-glow);
}

.cost-kpi-label {
  font-size: 0.775rem;
  color: var(--text-muted);
}

.cost-kpi-val {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
}

.highlight-savings .cost-kpi-val {
  color: var(--solar-green-light);
}

.cost-kpi-sub {
  font-size: 0.725rem;
  color: var(--text-dim);
}

/* Fórmulas y cajas SEO */
.formula-box-solar {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--solar-amber);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  margin: 0.85rem 0 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--solar-amber-light);
  overflow-x: auto;
  line-height: 1.5;
}

/* Modal personalizado */
.modal-backdrop {
  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: 10000;
  padding: 1rem;
}

.modal-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-xl);
  max-width: 480px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

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

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

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

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-row-solar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

.btn-modal-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}

.btn-modal-primary {
  background: var(--solar-amber);
  border: none;
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}

.btn-modal-primary:hover {
  background: #ea580c;
}

/* Toast de confirmación */
.solar-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1.5px solid var(--solar-amber);
  color: var(--text-main);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 10001;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: slide-toast 0.3s ease;
}

@keyframes slide-toast {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* RESPONSIVE DESIGN */
@media (max-width: 1024px) {
  .mode-selector-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .chart-dual-container {
    grid-template-columns: minmax(0, 1fr);
  }

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

@media (max-width: 768px) {
  .solar-tool-container {
    padding: 1.25rem 0.85rem;
    gap: 2rem;
  }

  .section-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .section-header-row.flex-between {
    flex-direction: column;
    align-items: stretch;
  }

  .presets-btn-group {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
  }

  .presets-btn-group .preset-label {
    width: 100%;
    margin-bottom: 0.2rem;
  }

  .presets-btn-group .btn-preset {
    flex: 1 1 calc(50% - 0.4rem);
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .presets-btn-group .btn-preset-clear {
    width: 100%;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.2rem;
  }

  .panel-power-selector {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
  }

  .select-solar-inline {
    width: 100%;
    height: 40px;
  }

  .mode-selector-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .config-controls-grid {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .loads-cards-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }

  .btn-qty {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
  }

  .live-demand-summary {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    gap: 0.85rem;
  }

  .demand-stat {
    align-items: flex-start;
  }

  .unifilar-diagram-container {
    padding: 1rem 0.65rem;
  }

  .unifilar-stage {
    height: 380px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .node-box {
    width: 96px;
    padding: 0.5rem 0.35rem;
  }

  .node-title {
    font-size: 0.68rem;
  }

  .node-val {
    font-size: 0.75rem;
  }

  /* Reorganización vertical contenida de nodos en móvil */
  .node-panels { top: 10px; left: 4%; }
  .node-mppt { top: 10px; right: 4%; left: auto; }
  .node-battery { top: 135px; right: 4%; left: auto; bottom: auto; }
  .node-inverter { top: 135px; left: 4%; }
  .node-loads { top: 260px; left: 4%; bottom: auto; }
  .node-grid { top: 260px; right: 4%; }

  .cost-summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .btn-text-desktop {
    display: none;
  }

  .btn-action-report {
    padding: 0.5rem;
  }

  .form-row-solar {
    grid-template-columns: 1fr;
  }
}

/* Pantallas estrechas (< 480px) */
@media (max-width: 480px) {
  .brand-subtitle {
    display: -webkit-box !important;
    -webkit-line-clamp: 1 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: normal !important;
  }

  .seo-table-wrapper {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Banner inteligente de enlace cruzado a Camper */
.camper-crosslink-card {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(16, 185, 129, 0.08));
  border: 1.5px solid rgba(14, 165, 233, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.4rem;
  margin-top: 1.25rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.camper-crosslink-card:hover {
  transform: translateY(-1px);
  border-color: rgba(14, 165, 233, 0.55);
}

.camper-crosslink-icon {
  font-size: 2.2rem;
  line-height: 1;
  flex-shrink: 0;
}

.camper-crosslink-content {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.camper-crosslink-content strong {
  color: var(--text-main);
  font-size: 0.95rem;
}

.camper-crosslink-btn {
  color: var(--solar-blue-light);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
  display: inline-block;
  margin-top: 0.2rem;
}

.camper-crosslink-btn:hover {
  color: #ffffff;
}

@media (max-width: 768px) {
  .camper-crosslink-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
  }
}

/* Estilos de Impresión Oficial (@media print) */
@media print {
  body {
    background: #ffffff !important;
    color: #0f172a !important;
  }

  .app-header,
  .tool-breadcrumbs,
  .tools-ad-banner-section,
  .tool-ad-sidebar,
  .fijate-footer,
  .category-tabs-bar,
  .presets-btn-group,
  .add-custom-bar,
  .btn-action-report,
  .modal-backdrop,
  .toggle-switch,
  .qty-counter,
  .solar-range-input,
  .btn-remove-custom-load,
  .unifilar-diagram-container,
  .camper-crosslink-card,
  .comp-affiliate-action,
  .portable-station-callout,
  .btn-aff-product,
  .amazon-prime-pill {
    display: none !important;
  }

  .solar-tool-container {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .dimensioning-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10mm !important;
  }

  .component-card {
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    break-inside: avoid;
  }

  .chart-canvas-wrap {
    height: 180px !important;
  }
}

