/* Comparador fiscal fondos indexados vs ETFs y acciones */
:root,
[data-theme="dark"] {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --bg-page: #0b0f17;
  --bg-surface: #131b2e;
  --bg-surface-2: #192338;
  --bg-input: #0f1626;
  --border-color: #26334d;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.14);
  --blue: #38bdf8;
  --blue-soft: rgba(56, 189, 248, 0.14);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg-page: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-2: #f8fafc;
  --bg-input: #ffffff;
  --border-color: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #475569;
  --emerald: #059669;
  --emerald-soft: rgba(5, 150, 105, 0.1);
  --blue: #0284c7;
  --blue-soft: rgba(2, 132, 199, 0.1);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.1);
  --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.08);
  color-scheme: light;
}

[data-theme="dark"] .app-header { background: #131b2e !important; border-bottom: 1px solid #1e293b !important; }
[data-theme="dark"] .brand-title { color: #f8fafc !important; }
[data-theme="light"] .app-header { background: #ffffff !important; border-bottom: 1px solid #cbd5e1 !important; }
[data-theme="light"] .brand-title { color: #0f172a !important; }

*, *::before, *::after { box-sizing: border-box; }

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

h1, h2, h3, h4, h5, h6, .brand-title, .section-title { font-family: var(--font-heading); }
.mono, code { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.tool-layout { max-width: 1200px; width: 100%; margin: 1.5rem auto 3rem; padding: 0 1rem; flex: 1 0 auto; }
.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%; }

.inv-card {
  background: var(--bg-surface); border: 1px solid var(--border-color);
  border-radius: 16px; padding: 1.4rem; box-shadow: var(--shadow-card); margin-bottom: 1.5rem;
}

.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.hero-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.hero-pill {
  padding: 0.3rem 0.7rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600;
  background: var(--emerald-soft); color: var(--emerald); border: 1px solid rgba(16, 185, 129, 0.28);
}
.hero-title { margin: 0 0 0.5rem; font-size: 1.4rem; font-weight: 700; line-height: 1.28; }
.hero-desc { margin: 0; font-size: 0.94rem; line-height: 1.55; color: var(--text-muted); max-width: 72ch; }
.preset-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.btn-secondary {
  min-height: 40px; padding: 0.5rem 0.95rem; border-radius: 10px;
  background: var(--bg-surface-2); color: var(--text-main); border: 1px solid var(--border-color);
  font-weight: 600; font-size: 0.86rem; cursor: pointer; font-family: var(--font-main);
}
.btn-secondary:hover { border-color: var(--emerald); color: var(--emerald); }

.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.section-title { margin: 0 0 0.85rem; font-size: 1.2rem; font-weight: 700; }
.section-head .section-title { margin-bottom: 0; }
.section-sub { margin: 0.25rem 0 0; font-size: 0.88rem; color: var(--text-muted); }

.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.95rem; }
.field label { display: block; font-size: 0.79rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.3rem; }
.field input, .field select {
  width: 100%; max-width: 100%; min-width: 0; min-height: 42px; padding: 0.5rem 0.8rem;
  border-radius: 10px; border: 1px solid var(--border-color);
  background-color: var(--bg-input); color: var(--text-main);
  font-size: 0.9rem; font-family: var(--font-main);
}
.field select {
  padding-right: 40px; color-scheme: dark light; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2394a3b8' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center;
}
.field select option { background-color: var(--bg-surface); color: var(--text-main); }

.compare-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.veh-card {
  background: var(--bg-surface-2); border: 1px solid var(--border-color);
  border-radius: 14px; padding: 1.1rem;
}
.veh-card.fund { border-top: 3px solid var(--emerald); }
.veh-card.etf-acc { border-top: 3px solid var(--blue); }
.veh-card.etf-dist { border-top: 3px solid var(--amber); }

.veh-tag {
  display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  padding: 0.22rem 0.58rem; border-radius: 999px; margin-bottom: 0.5rem;
}
.fund .veh-tag { background: var(--emerald-soft); color: var(--emerald); }
.etf-acc .veh-tag { background: var(--blue-soft); color: var(--blue); }
.etf-dist .veh-tag { background: var(--amber-soft); color: var(--amber); }
.veh-card h3 { margin: 0 0 0.45rem; font-size: 1.08rem; }
.veh-main { font-size: 1.55rem; font-weight: 800; margin-bottom: 0.85rem; }
.fund .veh-main { color: var(--emerald); }
.etf-acc .veh-main { color: var(--blue); }
.etf-dist .veh-main { color: var(--amber); }

.veh-rows { display: flex; flex-direction: column; gap: 0.45rem; }
.veh-rows > div {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  background: var(--bg-surface); border: 1px solid var(--border-color);
  border-radius: 9px; padding: 0.48rem 0.68rem; font-size: 0.8rem;
}
.veh-rows span { color: var(--text-muted); }
.positive { color: var(--emerald); }
.warn-txt { color: var(--amber); }

.kpi-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.85rem; margin-top: 1rem; }
.kpi-box { background: var(--bg-surface-2); border: 1px solid var(--border-color); border-radius: 12px; padding: 0.85rem 1rem; }
.kpi-box span { display: block; font-size: 0.77rem; color: var(--text-muted); margin-bottom: 0.2rem; }
.kpi-box strong { font-size: 1.08rem; }

.verdict-banner {
  margin-top: 1rem; padding: 1rem 1.15rem; border-radius: 12px;
  background: var(--emerald-soft); border: 1px solid var(--emerald);
  font-size: 0.92rem; line-height: 1.55;
}

.legend-inline { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.83rem; color: var(--text-muted); }
.leg-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot-fund { background: #10b981; }
.dot-etfa { background: #38bdf8; }
.dot-etfd { background: #f59e0b; }

.chart-wrap { position: relative; width: 100%; margin: 0.5rem 0 1.2rem; }
#inv-chart { width: 100%; height: 320px; display: block; border-radius: 12px; background: var(--bg-surface-2); border: 1px solid var(--border-color); }
.chart-tooltip {
  position: absolute; pointer-events: none; z-index: 10;
  background: var(--bg-surface); border: 1px solid var(--border-color);
  border-radius: 10px; padding: 0.55rem 0.75rem; font-size: 0.8rem;
  box-shadow: var(--shadow-card); min-width: 210px;
}

.table-responsive { overflow-x: auto; border: 1px solid var(--border-color); border-radius: 12px; max-height: 400px; overflow-y: auto; }
.inv-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.inv-table th, .inv-table td { padding: 0.65rem 0.8rem; border-bottom: 1px solid var(--border-color); text-align: left; white-space: nowrap; }
.inv-table thead th { position: sticky; top: 0; background: var(--bg-surface-2); color: var(--text-muted); font-weight: 700; z-index: 1; }
.inv-table td.num, .inv-table th.num { text-align: right; font-family: var(--font-mono); }

.faq-list { display: flex; flex-direction: column; gap: 0.65rem; }
.faq-item { border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-surface-2); overflow: hidden; }
.faq-item summary { padding: 0.85rem 1rem; font-weight: 600; cursor: pointer; list-style: none; color: var(--text-main); }
.faq-item p { margin: 0; padding: 0 1rem 0.95rem; font-size: 0.9rem; line-height: 1.55; color: var(--text-muted); }

@media (max-width: 960px) {
  .form-grid-3, .compare-3, .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .compare-3 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .form-grid-3, .kpi-strip { grid-template-columns: 1fr; }
  .btn-secondary { width: 100%; }
}

@media print {
  .app-header, .tools-ad-banner-section, .tool-ad-sidebar, .tools-related-section, .fijate-footer, .no-print {
    display: none !important;
  }
  body { background: #ffffff !important; color: #0f172a !important; }
  .inv-card { box-shadow: none !important; border: 1px solid #cbd5e1 !important; background: #ffffff !important; color: #0f172a !important; break-inside: avoid; }
  .table-responsive { max-height: none !important; overflow: visible !important; }
}
