/* ==========================================================================
   Calculadora de Inversión Periódica (DCA) en Criptomonedas - Fijate Tools
   Estilos CSS Prémium con Glassmorphism, Midnight Slate y diseño responsivo
   ========================================================================== */

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

  /* Paleta Tema Oscuro (Por defecto) */
  --bg-main: #080c14;
  --bg-surface: #0e1526;
  --bg-card: #131d33;
  --bg-card-glass: rgba(19, 29, 51, 0.8);
  --bg-input: #1a2744;
  --bg-hover: #223359;
  
  --border-color: rgba(255, 255, 255, 0.09);
  --border-active: #ff8507;
  
  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  --accent: #ff8507;
  --accent-hover: #ff9b2e;
  --accent-glow: rgba(255, 133, 7, 0.25);
  
  --btc-gold: #f7931a;
  --eth-blue: #627eea;
  --sol-purple: #9945ff;
  --bnb-yellow: #f3ba2f;
  --cyan: #00e5ff;
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.3);
  
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.3);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  color-scheme: dark;
}

[data-theme="light"] {
  --bg-main: #f4f6fa;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-glass: rgba(255, 255, 255, 0.9);
  --bg-input: #f1f5f9;
  --bg-hover: #e2e8f0;
  
  --border-color: rgba(0, 0, 0, 0.08);
  --border-active: #ff8507;
  
  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.12);
  
  color-scheme: light;
}

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

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
}

.num-mono, .metric-value, .ticker-price, .calc-result, .table-mono {
  font-family: var(--font-mono);
}

/* Select option fix */
select option, .form-select option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

/* Contenedor principal centrado */
.main-wrapper {
  width: 100% !important;
  max-width: 1320px !important;
  margin: 0 auto !important;
  padding: 16px 20px 48px;
  box-sizing: border-box;
}

.tool-with-sidebar {
  display: flex;
  gap: 24px;
  width: 100%;
  align-items: flex-start;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Sidebar de publicidad vertical adhesiva */
.tool-ad-sidebar {
  width: 300px;
  flex-shrink: 0;
  height: auto;
  align-self: stretch;
}

.ad-sticky-box {
  position: sticky;
  top: 85px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ad-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-align: center;
}

.ad-unit-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: center;
}

/* Publicidad horizontal */
.tools-ad-banner-section {
  width: 100%;
  margin: 8px 0;
}

.ad-banner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.ad-banner-card {
  width: 100%;
  min-height: 90px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ==========================================================================
   Hero de la herramienta
   ========================================================================== */
.tool-hero {
  background: linear-gradient(135deg, rgba(255, 133, 7, 0.08) 0%, rgba(247, 147, 26, 0.03) 50%, rgba(0, 229, 255, 0.03) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.tool-hero::after {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(247, 147, 26, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.tool-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 133, 7, 0.14);
  border: 1px solid rgba(255, 133, 7, 0.3);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

.tool-hero h2 {
  font-size: 26px;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.tool-hero p {
  color: var(--text-secondary);
  font-size: 14.5px;
  max-width: 860px;
  line-height: 1.6;
}

/* ==========================================================================
   Barra de cotizaciones en tiempo real (Live Ticker Bar)
   ========================================================================== */
.live-ticker-marquee-wrap {
  width: 100%;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ticker-live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: rgba(255, 133, 7, 0.15);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-glow 1.8s infinite;
}

@keyframes pulse-glow {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.ticker-items-scroll {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0;
  width: 100%;
}

.ticker-items-scroll::-webkit-scrollbar {
  display: none;
}

.ticker-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ticker-pill:hover, .ticker-pill.is-active {
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: translateY(-1px);
}

.ticker-crypto-name {
  font-weight: 700;
  font-size: 13px;
}

.ticker-price {
  font-size: 13px;
  font-weight: 600;
}

.ticker-change {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 4px;
}

.ticker-change.up {
  color: var(--success);
  background: var(--success-bg);
}

.ticker-change.down {
  color: var(--danger);
  background: var(--danger-bg);
}

/* ==========================================================================
   Panel de control y configuración del DCA
   ========================================================================== */
.dca-panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

.dca-card {
  background: var(--bg-card-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.card-title-row h3 {
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title-row .card-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* Grupos de campos */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-label .label-extra {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

/* Selector de criptoactivos en cuadrícula */
.crypto-grid-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

@media (max-width: 600px) {
  .crypto-grid-selector {
    grid-template-columns: repeat(3, 1fr);
  }
}

.crypto-btn-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 60px;
}

.crypto-btn-choice:hover {
  background: var(--bg-hover);
  border-color: rgba(255, 133, 7, 0.4);
}

.crypto-btn-choice.active {
  border-color: var(--accent);
  background: rgba(255, 133, 7, 0.12);
  box-shadow: 0 0 12px var(--accent-glow);
}

.crypto-btn-choice .choice-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
}

.crypto-btn-choice .choice-ticker {
  font-size: 13px;
  font-weight: 700;
}

.crypto-btn-choice .choice-name {
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Input con wrapper flex */
.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 ease, box-shadow 0.2s ease;
}

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

.input-with-affix input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  padding: 12px 14px;
  font-size: 16px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-main);
  min-height: 44px;
}

.input-with-affix .input-affix {
  padding: 0 14px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 15px;
  user-select: none;
}

/* Chips de valores predeterminados */
.presets-chips-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.preset-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 34px;
}

.preset-chip:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.preset-chip.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

/* Grupos de botones segmentados (Frecuencia y Período) */
.segmented-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

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

@media (max-width: 480px) {
  .segmented-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.segmented-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.segmented-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.segmented-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Rango de fechas personalizado */
.custom-dates-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.custom-dates-wrap input[type="date"] {
  width: 100%;
  min-width: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 13px;
  min-height: 40px;
}

/* Botón principal de recálculo */
.btn-calc-action {
  background: linear-gradient(135deg, var(--accent) 0%, #e66a00 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-heading);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 16px var(--accent-glow);
  transition: all 0.2s ease;
  min-height: 48px;
  width: 100%;
}

.btn-calc-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 133, 7, 0.4);
}

.btn-calc-action:active {
  transform: translateY(0);
}

/* ==========================================================================
   Tarjetas de resultados y métricas clave (KPIs)
   ========================================================================== */
.metrics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

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

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

.kpi-card {
  background: var(--bg-card-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-card.highlight {
  border-color: rgba(255, 133, 7, 0.4);
  background: linear-gradient(135deg, rgba(255, 133, 7, 0.08) 0%, var(--bg-card) 100%);
}

.kpi-card.highlight-profit {
  border-color: rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, var(--bg-card) 100%);
}

.kpi-card.highlight-loss {
  border-color: rgba(239, 68, 68, 0.4);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, var(--bg-card) 100%);
}

.kpi-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.kpi-subtext {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.kpi-badge.profit {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.kpi-badge.loss {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

/* ==========================================================================
   Gráfica interactiva de evolución temporal
   ========================================================================== */
.chart-section-card {
  background: var(--bg-card-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chart-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.chart-header-bar h3 {
  font-size: 18px;
}

.chart-modes-nav {
  display: flex;
  gap: 6px;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.chart-mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chart-mode-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.chart-legend-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.legend-dot.portfolio { background: #10b981; }
.legend-dot.invested { background: #ff8507; }
.legend-dot.lumpsum { background: #3b82f6; }
.legend-dot.price { background: #f7931a; }

/* Contenedor del canvas gráfico */
.canvas-chart-container {
  position: relative;
  width: 100%;
  height: 380px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

#dca_main_chart {
  width: 100%;
  height: 100%;
  display: block;
}

/* Tooltip interactivo flotante */
.chart-tooltip-floating {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  z-index: 10;
  display: none;
  backdrop-filter: blur(8px);
  min-width: 170px;
}

.tooltip-date {
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 4px;
  margin-bottom: 6px;
}

.tooltip-metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 3px;
}

.tooltip-metric-label {
  color: var(--text-muted);
}

.tooltip-metric-val {
  font-weight: 700;
  font-family: var(--font-mono);
}

/* ==========================================================================
   Comparativa de estrategias: DCA vs Lump Sum vs Cuenta de ahorro
   ========================================================================== */
.strategy-battle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

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

.strategy-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.strategy-card.winner {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.1);
}

.strategy-badge-top {
  position: absolute;
  top: -10px;
  right: 16px;
  background: var(--success);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}

.strategy-name {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.strategy-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.strategy-metrics-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.strategy-metric-item {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.strategy-metric-item .val {
  font-weight: 700;
  font-family: var(--font-mono);
}

/* ==========================================================================
   Pestañas de la aplicación (Simulador, Tabla, Metas, Fiscalidad)
   ========================================================================== */
.dca-tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.dca-tabs-nav::-webkit-scrollbar {
  display: none;
}

.dca-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  min-height: 42px;
}

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

.dca-tab-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.dca-tab-panel {
  display: none;
  flex-direction: column;
  gap: 24px;
}

.dca-tab-panel.active {
  display: flex;
}

/* ==========================================================================
   Tabla de desglose de compras históricas
   ========================================================================== */
.table-card {
  background: var(--bg-card-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.table-search-input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-main);
  font-size: 13px;
  min-width: 220px;
}

.table-actions-row {
  display: flex;
  gap: 8px;
}

.btn-table-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 38px;
}

.btn-table-action:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.table-responsive-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.dca-purchases-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.dca-purchases-table th {
  background: var(--bg-surface);
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.dca-purchases-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  white-space: nowrap;
}

.dca-purchases-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.table-pagination-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

.pagination-buttons {
  display: flex;
  gap: 6px;
}

.btn-page {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   Simulador de objetivos futuros (Meta patrimonial)
   ========================================================================== */
.goals-planner-card {
  background: var(--bg-card-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.scenarios-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

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

.scenario-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scenario-card.conservative { border-top: 3px solid #3b82f6; }
.scenario-card.moderate { border-top: 3px solid #10b981; }
.scenario-card.optimistic { border-top: 3px solid #f7931a; }

.scenario-card h4 {
  font-size: 15px;
}

.scenario-monthly-req {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
}

/* ==========================================================================
   Guía educativa y Fiscalidad en España (IRPF y FIFO)
   ========================================================================== */
.educational-guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 800px) {
  .educational-guide-grid {
    grid-template-columns: 1fr;
  }
}

.edu-card {
  background: var(--bg-card-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.edu-card h4 {
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.edu-card p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.edu-card ul {
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 13.5px;
  line-height: 1.6;
}

.tax-warning-box {
  background: rgba(247, 147, 26, 0.08);
  border: 1px solid rgba(247, 147, 26, 0.3);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==========================================================================
   Modales interactivos y Toast
   ========================================================================== */
.dca-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.dca-modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.dca-modal-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

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

.dca-modal-header h3 {
  font-size: 18px;
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

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

.dca-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.share-link-box {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.share-link-box input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  padding: 12px 14px;
  color: var(--text-main);
  font-size: 13px;
  font-family: var(--font-mono);
}

.btn-copy-share {
  background: var(--accent);
  color: #ffffff;
  border: none;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

/* Toast de notificación */
.dca-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 24px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

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

/* Spinner de carga */
.dca-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
}

.dca-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 133, 7, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Modo Impresión
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .app-header, .fijate-footer, .tool-ad-sidebar, .tools-ad-banner-section, .dca-tabs-nav, .table-toolbar, .btn-calc-action, .presets-chips-row {
    display: none !important;
  }
  .tool-with-sidebar {
    display: block !important;
  }
  .dca-card, .kpi-card, .chart-section-card, .table-card {
    border: 1px solid #cccccc !important;
    background: #ffffff !important;
    box-shadow: none !important;
  }
}
