/* =========================================================
   Simulador de créditos · Manos Abiertas
   Minimalista: base neutra, azul marino y verde del logo como acentos
   ========================================================= */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f6f9;
  --surface-3: #e5e9f0;
  --line: #e8ecf1;
  --text: #0f1b2d;
  --muted: #66728a;
  --accent: #0b3a7a;        /* azul marino del logo */
  --accent-ink: #ffffff;
  --accent-soft: #eaf0f8;
  --green: #1f7a2e;         /* verde del logo */
  --green-soft: #eaf4ec;
  --danger: #c93c3c;
  --focus: #0b3a7a;
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, .04);
  --shadow-md: 0 8px 28px rgba(15, 27, 45, .06);
  --shadow-lg: 0 24px 60px rgba(15, 27, 45, .16);
  --r-pill: 999px;
  --r-lg: 24px;
  --r-md: 18px;
  --ease: cubic-bezier(.22, .9, .24, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1120; --surface: #0f182a; --surface-2: #16213a; --surface-3: #22304c;
    --line: #1c2840; --text: #e7ecf4; --muted: #8b97ad;
    --accent: #8db2ea; --accent-ink: #0a1120; --accent-soft: #15233f;
    --green: #78c486; --green-soft: #12261b; --danger: #f07a7a; --focus: #8db2ea;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow-md: 0 8px 28px rgba(0, 0, 0, .3); --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1120; --surface: #0f182a; --surface-2: #16213a; --surface-3: #22304c;
  --line: #1c2840; --text: #e7ecf4; --muted: #8b97ad;
  --accent: #8db2ea; --accent-ink: #0a1120; --accent-soft: #15233f;
  --green: #78c486; --green-soft: #12261b; --danger: #f07a7a; --focus: #8db2ea;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow-md: 0 8px 28px rgba(0, 0, 0, .3); --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
  overflow-x: hidden;
  transition: background-color .5s var(--ease), color .5s var(--ease);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* Transición suave al cambiar de tema */
.theme-anim *, .theme-anim *::before, .theme-anim *::after {
  transition: background-color .5s var(--ease), border-color .5s var(--ease), color .5s var(--ease), box-shadow .5s var(--ease) !important;
}

.app { max-width: 1080px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 16px 0; }

/* ---------- Encabezado ---------- */
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 0 24px; }
.logo { flex: none; display: block; width: 48px; height: 48px; border-radius: 50%; transition: transform .4s var(--ease-spring); }
.logo:hover { transform: rotate(-8deg) scale(1.04); }
.logo img { display: block; width: 100%; height: 100%; }
.icon-btn {
  position: relative; flex: none;
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: var(--surface-2); color: var(--text);
  transition: transform .25s var(--ease), background .25s var(--ease);
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { transition: transform .5s var(--ease), opacity .3s var(--ease); }
#themeToggle svg { position: absolute; }
#themeToggle .i-sun { opacity: 0; transform: rotate(-90deg) scale(.6); }
:root[data-theme="dark"] #themeToggle .i-sun { opacity: 1; transform: none; }
:root[data-theme="dark"] #themeToggle .i-moon { opacity: 0; transform: rotate(90deg) scale(.6); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #themeToggle .i-sun { opacity: 1; transform: none; }
  :root:not([data-theme="light"]) #themeToggle .i-moon { opacity: 0; transform: rotate(90deg) scale(.6); }
}
.topbar-title {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  border: 0; background: none; padding: 6px 4px;
  font-size: clamp(19px, 3.2vw, 24px); font-weight: 600; text-align: left;
}
.topbar-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-title .chev { flex: none; color: var(--muted); transition: transform .35s var(--ease); }
.topbar-title:hover .chev { transform: translateY(2px); }
.badge-count {
  position: absolute; top: -3px; right: -3px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill);
  background: var(--green); color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center;
  animation: pop .5s var(--ease-spring);
}

/* ---------- Formulario ---------- */
.form-wrap { background: var(--surface); border-radius: var(--r-lg); padding: 8px; border: 1px solid var(--line); box-shadow: var(--shadow-md); }
.search-pill {
  display: flex; align-items: center; gap: 14px;
  height: 60px; padding: 0 22px; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--muted);
  transition: box-shadow .3s var(--ease), background .3s var(--ease);
}
.search-pill:focus-within { background: var(--surface); box-shadow: 0 0 0 1.5px var(--accent) inset; color: var(--accent); }
.search-pill input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 19px; font-weight: 500; color: var(--text); }
.search-pill input::placeholder { color: var(--muted); }

.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.field { display: flex; flex-direction: column; gap: 2px; padding: 12px 18px; border-radius: var(--r-md); background: var(--surface-2); transition: box-shadow .3s var(--ease), background .3s var(--ease); }
.field.reason { grid-column: 1 / -1; }
.field.reason .field-input input { font-weight: 500; font-size: 17px; }
.field:focus-within { background: var(--surface); box-shadow: 0 0 0 1.5px var(--accent) inset; }
.field.invalid, .search-pill.invalid { box-shadow: 0 0 0 1.5px var(--danger) inset; animation: shake .45s var(--ease); }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field-label .opt { font-weight: 500; opacity: .8; }
.field-input { display: flex; align-items: baseline; gap: 6px; }
.field-input em { font-style: normal; color: var(--muted); font-weight: 600; }
.field-input input { flex: 1; min-width: 0; width: 100%; border: 0; outline: 0; background: none; font-size: 20px; font-weight: 700; padding: 2px 0; }
.field-input input::placeholder { color: color-mix(in srgb, var(--muted) 50%, transparent); }
.field-input select {
  border: 0; outline: 0; background: var(--surface); border-radius: var(--r-pill);
  padding: 4px 10px; font-size: 13px; font-weight: 700; color: var(--text);
  box-shadow: 0 0 0 1px var(--line); align-self: center;
}

/* Desplegable de bancos */
.select-pill { position: relative; }
.select-pill select {
  flex: 1; min-width: 0; height: 100%;
  border: 0; outline: 0; background: none; appearance: none; -webkit-appearance: none;
  font-size: 19px; font-weight: 600; color: var(--text); cursor: pointer; padding-right: 28px;
}
.select-pill select:invalid { color: var(--muted); font-weight: 500; }
.select-pill select option { color: var(--text); background: var(--surface); }
.select-pill .chev { position: absolute; right: 22px; pointer-events: none; color: var(--muted); }
.other-bank { margin-top: 8px; animation: rise .35s var(--ease) both; }

/* Sistema de amortización */
.fields .system { grid-column: 1 / -1; }
.fields.uvr .system { grid-column: span 2; }
.field .select-plain { appearance: none; -webkit-appearance: none; cursor: pointer; text-overflow: ellipsis; }
.system-help, .rate-note { grid-column: 1 / -1; margin: 2px 6px 4px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.system-help strong { color: var(--text); font-weight: 600; }
.rate-note { color: var(--danger); font-weight: 600; animation: rise .35s var(--ease) both; }
.inflation { animation: rise .35s var(--ease) both; }

.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 10px 4px 2px; }
.form-error { flex: 1; margin: 0 0 0 12px; color: var(--danger); font-size: 14px; font-weight: 600; min-height: 1em; opacity: 0; transform: translateY(4px); transition: opacity .3s var(--ease), transform .3s var(--ease); }
.form-error.show { opacity: 1; transform: none; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 50px; padding: 0 22px; border: 0; border-radius: var(--r-pill);
  font-size: 16px; font-weight: 700; white-space: nowrap;
  transition: transform .25s var(--ease), background .25s var(--ease), opacity .25s, color .25s;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.soft:hover { background: color-mix(in srgb, var(--accent-soft) 80%, var(--accent)); }
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.small { height: 40px; padding: 0 16px; font-size: 14px; }
.btn.ghost.confirm, .btn.danger.confirm { background: var(--danger); color: #fff; }
.btn.danger { background: var(--surface); color: var(--danger); }

/* ---------- Scroller horizontal ---------- */
.scroller {
  display: flex; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scrollbar-width: none;
  margin: 0 -16px; padding: 4px 16px 14px;
}
.scroller::-webkit-scrollbar { display: none; }

/* ---------- Banner ---------- */
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin-top: 20px; padding: 28px 32px; min-height: 140px;
  border-radius: var(--r-lg);
  background: var(--accent-soft); color: var(--accent);
}
.banner-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.banner-copy h3 { font-size: clamp(24px, 4vw, 34px); font-weight: 800; line-height: 1.1; color: var(--text); }
.banner-copy h3 span { color: var(--green); }
.banner-copy p { margin: 0; font-weight: 500; font-size: 16px; color: var(--muted); }
.banner-badge {
  flex: none; width: 84px; height: 84px; border-radius: 50%;
  background: var(--surface); color: var(--c, var(--accent));
  display: grid; place-items: center; text-align: center;
  font-weight: 800; font-size: 24px; letter-spacing: -.03em;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--c, var(--accent)) 14%, transparent);
  animation: float 6s ease-in-out infinite;
}
.banner-badge img { width: 58px; height: 58px; }
.banner-badge small { display: block; font-size: 10px; font-weight: 700; color: var(--muted); letter-spacing: 0; margin-top: -2px; }
.banner-enter { animation: bannerIn .6s var(--ease) both; }

/* ---------- Bloques ---------- */
.block { margin-top: 48px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.block-head h2 { font-size: clamp(24px, 4vw, 32px); font-weight: 700; }

/* ---------- Pills ---------- */
.pills { gap: 8px; padding-bottom: 16px; }
.pill {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 15px; font-weight: 600;
  transition: background .3s var(--ease), color .3s var(--ease), border-color .3s, transform .25s var(--ease);
}
.pill:hover { border-color: var(--surface-3); background: var(--surface-2); }
.pill:active { transform: scale(.95); }
.pill.icon-only { width: 44px; padding: 0; justify-content: center; cursor: default; color: var(--muted); }
.pill.icon-only:hover { background: var(--surface); border-color: var(--line); }
.pill[aria-checked="true"], .pill[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pill .dot { width: 9px; height: 9px; border-radius: 50%; }
.pill[aria-selected="true"] .dot, .pill[aria-checked="true"] .dot { box-shadow: 0 0 0 2px var(--accent-ink); }

/* ---------- Tarjetas de oferta ---------- */
.cards { gap: 16px; padding-bottom: 20px; min-height: 230px; }
.card {
  position: relative; flex: none; scroll-snap-align: start; width: 280px;
  border-radius: var(--r-lg); cursor: pointer;
  transition: transform .35s var(--ease);
}
.card:hover { transform: translateY(-3px); }
.card-media {
  position: relative; height: 128px; border-radius: var(--r-lg);
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c) 14%, var(--line));
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease);
}
.card:hover .card-media { box-shadow: var(--shadow-md); }
.card.editing .card-media { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent); }
.avatar {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--c); color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 21px; letter-spacing: -.03em;
  transition: transform .5s var(--ease-spring);
}
.card:hover .avatar { transform: scale(1.06); }
.tags { position: absolute; left: 12px; top: 12px; right: 52px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--surface); color: var(--text);
  font-weight: 700; font-size: 12px; box-shadow: var(--shadow-sm);
}
.tag.good { background: var(--green); color: #fff; }
.card-remove {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: var(--surface); color: var(--muted);
  display: grid; place-items: center; box-shadow: var(--shadow-sm);
  opacity: 0; transform: scale(.8);
  transition: opacity .25s var(--ease), transform .3s var(--ease-spring), color .2s;
}
.card-remove:hover { color: var(--danger); }
.card:hover .card-remove, .card:focus-within .card-remove { opacity: 1; transform: none; }
@media (hover: none) { .card-remove { opacity: 1; transform: none; } }
.card-body { padding: 12px 6px 0; }
.card-body h3 { font-size: 20px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-reason { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.card-meta { display: flex; align-items: center; gap: 8px; font-size: 16px; margin-top: 4px; }
.card-meta.muted { font-size: 14px; margin-top: 2px; }
.card-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); opacity: .6; }
.card-meta strong { font-weight: 700; }

.empty-card {
  flex: 1; min-width: 260px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  padding: 32px 20px; border: 1.5px dashed var(--surface-3); border-radius: var(--r-lg); color: var(--muted);
}
.empty-card img { width: 44px; height: 44px; opacity: .9; }
.empty-card strong { color: var(--text); font-size: 18px; }

/* ---------- Tablas ---------- */
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 14px 18px; text-align: left; white-space: nowrap; }
th { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface); position: sticky; top: 0; z-index: 1; border-bottom: 1px solid var(--line); }
td { border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; }
tbody tr { transition: background .25s var(--ease); }
tbody tr:hover { background: var(--surface-2); }
.bank-cell { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.bank-cell .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.reason-cell { color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
tr.is-best td { background: var(--green-soft); }
tr.is-best .bank-cell::after { content: "Mejor"; font-size: 11px; font-weight: 800; color: #fff; background: var(--green); padding: 2px 8px; border-radius: var(--r-pill); }
.delta { font-weight: 700; color: var(--muted); }
.delta.zero { color: var(--green); }
.empty-note { margin: 0; padding: 28px; text-align: center; color: var(--muted); }
.amort-scroll { max-height: 440px; }
.amort td:first-child { color: var(--muted); font-weight: 600; }
.amort tfoot td { font-weight: 800; position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); }

.uvr-col { display: none; }
table.has-uvr .uvr-col { display: table-cell; }
.card-system { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 6px; }
.sub-line { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }

/* Composición de la cuota */
.split { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.split-stats { display: flex; flex-direction: column; gap: 10px; }
.split-stat { padding: 16px 18px; border-radius: var(--r-md); background: var(--surface-2); }
.split-stat .lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.split-stat .bar { display: flex; height: 8px; border-radius: 6px; overflow: hidden; margin: 10px 0 8px; background: var(--surface-3); }
.split-stat .bar i { display: block; height: 100%; transition: width .8s var(--ease); }
.split-stat .bar .bi { background: var(--accent); }
.split-stat .bar .bc { background: var(--green); }
.split-stat .vals { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }
.split-stat .vals .vi { color: var(--accent); }
.split-stat .vals .vc { color: var(--green); }
.split .chart-card { margin: 0; }

/* Cómo se calcula */
.method { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.method summary { list-style: none; cursor: pointer; padding: 22px 24px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.method summary::-webkit-details-marker { display: none; }
.method summary h2 { font-size: clamp(20px, 3vw, 24px); font-weight: 700; }
.method summary h2::after { content: "+"; margin-left: 10px; color: var(--muted); font-weight: 500; display: inline-block; transition: transform .35s var(--ease); }
.method[open] summary h2::after { transform: rotate(45deg); }
.method-body { padding: 0 24px 22px; max-width: 760px; animation: rise .4s var(--ease) both; }
.method-body p { margin: 0 0 12px; line-height: 1.6; }
.method-body code { font-family: inherit; font-weight: 700; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.method-links a { color: var(--accent); font-weight: 600; }

/* ---------- Gráficos ---------- */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart-card { margin: 0; padding: 20px 20px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card figcaption { font-weight: 700; font-size: 16px; margin-bottom: 10px; }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 320px; }

/* ---------- Abonos a capital ---------- */
.block-sub { margin: -6px 0 16px; color: var(--muted); max-width: 640px; }
.extra-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 8px; }
.extra-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.select-plain { flex: 1; width: 100%; border: 0 !important; outline: 0; background: none !important; box-shadow: none !important; padding: 2px 0 !important; font-size: 18px !important; font-weight: 700; color: var(--text); }
.lumps { padding: 14px 10px 6px; display: flex; flex-direction: column; gap: 8px; }
.lumps > .field-label { padding-left: 8px; }
.lump-add { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }
.lump-add .btn { height: auto; min-height: 50px; }
#extraError { margin: 0 8px; }
.lump-list { list-style: none; margin: 0; padding: 0 2px; display: flex; flex-wrap: wrap; gap: 8px; }
.lump-list li {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 6px 6px 14px; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px;
  animation: rise .35s var(--ease) both;
}
.lump-list li span { color: var(--text); font-weight: 600; }
.lump-list button { width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--surface); color: var(--muted); display: grid; place-items: center; transition: color .2s, transform .2s var(--ease); }
.lump-list button:hover { color: var(--danger); transform: scale(1.08); }

.scenarios { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.scenario {
  position: relative; padding: 20px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color .4s var(--ease), box-shadow .4s var(--ease), transform .35s var(--ease);
}
.scenario.win { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.scenario .s-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.scenario h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.scenario h3 i { width: 10px; height: 10px; border-radius: 50%; background: var(--sc); }
.scenario .s-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.scenario .s-big { font-size: clamp(22px, 3vw, 28px); font-weight: 800; letter-spacing: -.02em; margin: 2px 0 12px; }
.scenario dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; font-size: 14px; }
.scenario dt { color: var(--muted); }
.scenario dd { margin: 0; text-align: right; font-weight: 700; }
.scenario .save { color: var(--green); }
.verdict {
  margin: 14px 0 18px; padding: 16px 20px; border-radius: var(--r-md);
  background: var(--green-soft); color: var(--text); font-size: 15px; line-height: 1.5;
}
.verdict.neutral { background: var(--surface-2); color: var(--muted); }
.verdict strong { color: var(--green); }
.extra-view { margin-top: 18px; }
#extraBlock .chart-card { margin-top: 0; }

/* ---------- Barra de acciones ---------- */
.spacer { height: 130px; }
.actionbar {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex; gap: 8px; padding: 8px; border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  z-index: 20; animation: barIn .8s .3s var(--ease) both;
  max-width: calc(100vw - 32px);
}

/* ---------- Panel guardados ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(8, 14, 28, .4); z-index: 40; opacity: 0; transition: opacity .35s var(--ease); }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; z-index: 41; top: 12px; right: 12px; bottom: 12px;
  width: min(420px, calc(100vw - 24px));
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  padding: 20px; display: flex; flex-direction: column;
  transform: translateX(110%); transition: transform .5s var(--ease);
}
.sheet.open { transform: none; }
.sheet-grip { display: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h2 { font-size: 22px; font-weight: 700; }
.saved-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.saved-item { padding: 16px; border-radius: var(--r-md); background: var(--surface-2); animation: rise .45s var(--ease) both; }
.saved-item h3 { font-size: 17px; font-weight: 700; }
.saved-item .meta { font-size: 13px; color: var(--muted); margin: 2px 0 10px; }
.saved-item .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: var(--r-pill); background: var(--surface); }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.saved-item .row { display: flex; gap: 8px; }
.saved-item .row .btn { flex: 1; }

/* ---------- Modal ---------- */
.modal { border: 0; padding: 0; border-radius: var(--r-lg); width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.modal[open] { animation: modalIn .45s var(--ease) both; }
.modal::backdrop { background: rgba(8, 14, 28, .4); animation: fade .3s var(--ease) both; }
.modal form { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.modal h2 { font-size: 22px; }
.modal p { margin: -6px 0 0; font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-radius: var(--r-pill);
  background: var(--text); color: var(--bg); font-weight: 600; font-size: 15px;
  box-shadow: var(--shadow-lg); animation: toastIn .45s var(--ease-spring) both;
}
.toast .ic { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.toast.warn .ic { background: var(--danger); }
.toast.out { animation: toastOut .35s var(--ease) both; }

/* ---------- Revelado al hacer scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Keyframes ---------- */
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes bannerIn { from { opacity: 0; transform: translateY(8px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes barIn { from { opacity: 0; transform: translate(-50%, 30px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes barInM { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-12px) scale(.95); } }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .fields { grid-template-columns: 1fr 1fr; }
  .fields .field:first-child { grid-column: 1 / -1; }
  .charts { grid-template-columns: 1fr; }
  .scenarios { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .split-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .split-stat { padding: 12px; }
  .fields.uvr .system { grid-column: 1 / -1; }
  .fields .inflation { grid-column: 1 / -1; }
  .extra-grid { grid-template-columns: 1fr 1fr; }
  .extra-grid .field:first-child { grid-column: 1 / -1; }
  .lump-add { grid-template-columns: 90px minmax(0, 1fr); }
  .lump-add .btn { grid-column: 1 / -1; }
  #extraBlock .block-head { flex-wrap: wrap; align-items: center; }
  .banner { padding: 24px; }
  .card { width: 260px; }
  .form-actions { flex-wrap: wrap; }
  .form-error { flex-basis: 100%; margin: 0 8px 4px; }
  .form-actions .btn.primary { flex: 1; }
  .sheet { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 82vh; border-radius: var(--r-lg) var(--r-lg) 0 0; transform: translateY(105%); padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .sheet.open { transform: none; }
  .sheet-grip { display: block; width: 44px; height: 5px; border-radius: 4px; background: var(--surface-3); margin: -8px auto 12px; }
  .actionbar { left: 16px; right: 16px; transform: none; animation-name: barInM; }
  .actionbar .btn { flex: 1; padding: 0 12px; }
}
@media (max-width: 420px) {
  .actionbar .btn span { display: none; }
  .actionbar .btn.primary span { display: inline; }
  .search-pill { height: 56px; }
  .search-pill input, .field-input input { font-size: 18px; }
  .banner-badge { width: 64px; height: 64px; font-size: 19px; }
  .banner-badge img { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
