/* Asistente Modelo 720, 721 y Ley Beckham */
: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;
  --accent: #38bdf8;
  --accent-strong: #0284c7;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.14);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.14);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 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;
  --accent: #0284c7;
  --accent-strong: #0369a1;
  --accent-soft: rgba(2, 132, 199, 0.1);
  --emerald: #059669;
  --emerald-soft: rgba(5, 150, 105, 0.1);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, 0.1);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 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%; }

.tax-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-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(--accent-soft); color: var(--accent); border: 1px solid rgba(56, 189, 248, 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); }

.module-tabs { display: flex; gap: 0.55rem; flex-wrap: wrap; margin-top: 1.1rem; }
.mod-tab {
  min-height: 42px; padding: 0.55rem 1.05rem; border-radius: 10px;
  border: 1px solid var(--border-color); background: var(--bg-surface-2); color: var(--text-muted);
  font-weight: 600; font-size: 0.9rem; cursor: pointer; font-family: var(--font-main);
}
.mod-tab.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.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.45rem; font-size: 1.2rem; font-weight: 700; }
.section-sub { margin: 0; font-size: 0.88rem; color: var(--text-muted); line-height: 1.45; }

.btn-primary {
  min-height: 42px; padding: 0.55rem 1.05rem; border-radius: 10px; border: none;
  background: var(--accent-strong); color: #ffffff; font-weight: 600; font-size: 0.9rem; cursor: pointer;
}
.quick-examples { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.9rem; font-size: 0.82rem; color: var(--text-muted); }
.chip-btn {
  min-height: 36px; padding: 0.35rem 0.75rem; border-radius: 999px;
  border: 1px solid var(--border-color); background: var(--bg-surface-2); color: var(--text-main);
  font-size: 0.8rem; cursor: pointer; font-weight: 600;
}
.chip-btn:hover { border-color: var(--accent); color: var(--accent); }

.asset-list { display: flex; flex-direction: column; gap: 0.7rem; }
.asset-row {
  display: grid; grid-template-columns: 1.5fr 1.3fr 1fr 1fr auto; gap: 0.7rem; align-items: end;
  background: var(--bg-surface-2); border: 1px solid var(--border-color); border-radius: 12px; padding: 0.85rem;
}
.asset-row.crypto-row { grid-template-columns: 1.5fr 1.1fr 1.1fr auto; }
.field label { display: block; font-size: 0.77rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.28rem; }
.field input, .field select, .hist-extra input {
  width: 100%; max-width: 100%; min-width: 0; min-height: 40px; padding: 0.45rem 0.75rem;
  border-radius: 9px; border: 1px solid var(--border-color);
  background-color: var(--bg-input); color: var(--text-main); font-size: 0.88rem; 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); }

.btn-del {
  min-width: 40px; min-height: 40px; border-radius: 9px;
  border: 1px solid var(--border-color); background: var(--bg-input); color: var(--text-muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-del:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

.sub-heading { margin: 1.25rem 0 0.7rem; font-size: 1rem; }
.blocks-history-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.85rem; }
.hist-box {
  background: var(--bg-surface-2); border: 1px solid var(--border-color);
  border-radius: 12px; padding: 0.95rem;
}
.hist-box h4 { margin: 0 0 0.55rem; font-size: 0.94rem; }
.check-line { display: flex; align-items: center; gap: 0.5rem; font-size: 0.84rem; cursor: pointer; margin: 0.35rem 0; }
.check-line input { accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; }
.hist-extra { margin-top: 0.55rem; display: flex; flex-direction: column; gap: 0.45rem; }
.hist-extra label { font-size: 0.78rem; color: var(--text-muted); }

.verdict-cards-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.95rem; margin-top: 1.15rem; }
.block-verdict {
  border-radius: 13px; padding: 1rem; border: 1px solid var(--border-color); background: var(--bg-surface-2);
}
.block-verdict.obligado { border-color: var(--warn); background: var(--warn-soft); }
.block-verdict.exento { border-color: var(--emerald); background: var(--emerald-soft); }
.bv-badge {
  display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  padding: 0.22rem 0.55rem; border-radius: 999px; margin-bottom: 0.45rem; background: var(--bg-surface);
}
.block-verdict h4 { margin: 0 0 0.35rem; font-size: 1rem; }
.block-verdict .bv-sum { font-family: var(--font-mono); font-size: 1.25rem; font-weight: 800; margin-bottom: 0.45rem; }
.block-verdict p { margin: 0; font-size: 0.83rem; line-height: 1.48; }

.info-strip {
  padding: 0.85rem 1rem; border-radius: 11px; margin-bottom: 1rem;
  background: var(--accent-soft); border: 1px solid var(--accent); font-size: 0.87rem; line-height: 1.5;
}

.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.95rem; }
.compare-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.result-card {
  background: var(--bg-surface-2); border: 1px solid var(--border-color);
  border-radius: 14px; padding: 1.15rem;
}
.beck-card { border-top: 3px solid var(--emerald); }
.irpf-card { border-top: 3px solid var(--accent); }
.rc-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.45rem;
  background: var(--emerald-soft); color: var(--emerald);
}
.irpf-card .rc-tag { background: var(--accent-soft); color: var(--accent); }
.result-card h3 { margin: 0 0 0.35rem; font-size: 1.1rem; }
.big-num { font-size: 1.65rem; font-weight: 800; margin-bottom: 0.75rem; }
.rc-rows { display: flex; flex-direction: column; gap: 0.45rem; }
.rc-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.5rem 0.7rem; font-size: 0.83rem;
}
.rc-rows span { color: var(--text-muted); }
.positive { color: var(--emerald); }
.warn-txt { color: var(--warn); }

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

.chart-wrap { width: 100%; }
#beck-chart { width: 100%; height: 290px; display: block; border-radius: 12px; background: var(--bg-surface-2); border: 1px solid var(--border-color); }

.checklist-box {
  margin-top: 1.1rem; background: var(--bg-surface-2); border: 1px solid var(--border-color);
  border-radius: 12px; padding: 1rem 1.15rem;
}
.checklist-box h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.checklist-box ul { margin: 0; padding-left: 1.2rem; font-size: 0.88rem; line-height: 1.6; color: var(--text-muted); }

.faq-list { display: flex; flex-direction: column; gap: 0.65rem; margin-top: 0.8rem; }
.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) {
  .blocks-history-grid, .verdict-cards-3, .form-grid-3 { grid-template-columns: 1fr; }
  .asset-row, .asset-row.crypto-row { grid-template-columns: repeat(2, 1fr); }
  .compare-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .asset-row, .asset-row.crypto-row { grid-template-columns: 1fr; }
  .btn-primary, .mod-tab { width: 100%; }
}
