:root {
  color-scheme: light;
  --bg: #f4f7fa;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --ink: #12202e;
  --ink-2: #4a5b6b;
  --ink-3: #6f7e8c;
  --line: #dbe3eb;
  --brand: #0f6fb5;
  --brand-ink: #ffffff;
  --brand-soft: #e3f0fa;
  --sun: #f6b40e;
  --user: #0f6fb5;
  --user-ink: #ffffff;
  --good: #0a7d43;
  --good-bg: #e6f5ec;
  --warn: #8a5a00;
  --warn-bg: #fff3d6;
  --bad: #b3261e;
  --bad-bg: #fde8e6;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 4px 16px rgba(16, 32, 48, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1418;
    --surface: #182027;
    --surface-2: #1f2932;
    --ink: #eef2f5;
    --ink-2: #b9c4cd;
    --ink-3: #8d9aa5;
    --line: #2c3842;
    --brand: #4aa3e8;
    --brand-ink: #071522;
    --brand-soft: #16304a;
    --user: #2b6ea6;
    --user-ink: #ffffff;
    --good: #4cc98a;
    --good-bg: #12301f;
    --warn: #f0c050;
    --warn-bg: #352a10;
    --bad: #ff8a80;
    --bad-bg: #3a1714;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1418; --surface: #182027; --surface-2: #1f2932; --ink: #eef2f5; --ink-2: #b9c4cd; --ink-3: #8d9aa5; --line: #2c3842;
  --brand: #4aa3e8; --brand-ink: #071522; --brand-soft: #16304a; --user: #2b6ea6; --user-ink: #fff;
  --good: #4cc98a; --good-bg: #12301f; --warn: #f0c050; --warn-bg: #352a10; --bad: #ff8a80; --bad-bg: #3a1714;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
button { font: inherit; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 20px; }
.logo b { color: var(--brand); }
.ghost { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--line); color: var(--ink-2); border-radius: 999px; padding: 6px 14px; }

main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 16px 16px 8px; }

.bienvenida { padding: 12px 0 8px; }
.bienvenida h1 { font-size: clamp(28px, 7vw, 40px); line-height: 1.1; margin: 8px 0 12px; letter-spacing: -.02em; }
.bienvenida h1 em { font-style: normal; color: var(--brand); }
.bienvenida p { color: var(--ink-2); margin: 0 0 8px; }
.bienvenida .sub { font-size: 14px; color: var(--ink-3); }
.arranque { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0; }
.arranque button {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; font-size: 24px; box-shadow: var(--shadow);
}
.arranque button span { font-size: 15px; font-weight: 600; display: flex; flex-direction: column; }
.arranque small { font-weight: 400; color: var(--ink-3); font-size: 13px; }
.arranque button:hover, .arranque button:focus-visible { border-color: var(--brand); outline: none; }
.dudas p { font-size: 14px; color: var(--ink-3); margin: 0 0 6px; }
.chip {
  background: var(--brand-soft); color: var(--brand); border: 0; border-radius: 999px;
  padding: 7px 14px; margin: 0 6px 8px 0; font-size: 14px; font-weight: 500;
}

#mensajes { display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 100%; }
.msg.usuario { align-self: flex-end; max-width: 85%; background: var(--user); color: var(--user-ink); padding: 10px 14px; border-radius: 18px 18px 4px 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.asistente .texto { background: var(--surface); border: 1px solid var(--line); border-radius: 4px 18px 18px 18px; padding: 12px 16px; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.texto p { margin: 0 0 10px; }
.texto p:last-child, .texto ul:last-child, .texto ol:last-child { margin-bottom: 0; }
.texto ul, .texto ol { margin: 0 0 10px; padding-left: 22px; }
.texto li { margin-bottom: 4px; }
.texto h3 { font-size: 16px; margin: 12px 0 6px; }
.opciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.opciones button { background: var(--surface); color: var(--brand); border: 1.5px solid var(--brand); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 15px; }
.opciones button:hover { background: var(--brand-soft); }
.opciones.usadas { display: none; }

.pensando { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 15px; padding: 6px 2px; }
.puntos { display: inline-flex; gap: 4px; }
.puntos i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); animation: rebote 1.2s infinite; }
.puntos i:nth-child(2) { animation-delay: .15s; }
.puntos i:nth-child(3) { animation-delay: .3s; }
@keyframes rebote { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .puntos i { animation: none; opacity: .7; } }
.error { background: var(--bad-bg); color: var(--bad); border-radius: 12px; padding: 10px 14px; }

/* Tarjetas */
.bloques { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.card h4 { margin: 0 0 10px; font-size: 16px; }
.fuente { font-size: 12px; color: var(--ink-3); margin: 10px 0 0; }
.lista-prod { display: flex; flex-direction: column; gap: 10px; }
.prod { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface-2); }
.prod-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.prod-banco { font-weight: 700; }
.prod-nombre { font-size: 13px; color: var(--ink-2); }
.cft { text-align: right; white-space: nowrap; }
.cft b { display: block; font-size: 20px; line-height: 1.1; }
.cft span { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.badge { font-size: 12px; border-radius: 999px; padding: 2px 9px; background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.badge.neutro { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); }
.datos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin: 8px 0 0; font-size: 14px; }
.datos div { display: flex; flex-direction: column; }
.datos dt { color: var(--ink-3); font-size: 12px; }
.datos dd { margin: 0; font-weight: 600; }
.prod-acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn { border: 0; background: var(--brand); color: var(--brand-ink); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 14px; text-decoration: none; display: inline-block; }
.btn.sec { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.semaforo { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; border-radius: 8px; padding: 3px 8px; }
.semaforo.ok { background: var(--good-bg); color: var(--good); }
.semaforo.ojo { background: var(--warn-bg); color: var(--warn); }
.semaforo.mal { background: var(--bad-bg); color: var(--bad); }
.aviso { font-size: 13px; color: var(--warn); background: var(--warn-bg); border-radius: 8px; padding: 6px 10px; margin-top: 8px; }

.hero { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.hero small { color: var(--ink-2); font-size: 14px; }
.hero b { font-size: 34px; line-height: 1.1; letter-spacing: -.02em; }
.hero em { font-style: normal; color: var(--ink-3); font-size: 13px; }
.barras { margin: 6px 0 12px; }
.barra { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; background: var(--surface); }
.barra i { display: block; height: 100%; }
.barra i:first-child { border-radius: 7px 0 0 7px; }
.barra i:last-child { border-radius: 0 7px 7px 0; }
.leyenda { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda span::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.claves { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.claves li { display: flex; gap: 10px; font-size: 15px; }
.claves li > span:first-child { font-size: 18px; }

.grafico { position: relative; margin: 6px 0 4px; }
.grafico svg { width: 100%; height: auto; display: block; overflow: visible; }
.grafico .eje { stroke: var(--line); stroke-width: 1; }
.grafico .ref { stroke: var(--bad); stroke-width: 1.5; stroke-dasharray: 5 4; }
.grafico text { fill: var(--ink-3); font-size: 11px; }
.grafico .ref-label { fill: var(--bad); font-weight: 700; }
.grafico .linea { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.grafico .cursor { stroke: var(--ink-3); stroke-width: 1; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); border-radius: 8px; padding: 6px 10px; font-size: 12px; line-height: 1.4; white-space: nowrap; transform: translate(-50%, -110%); }
.escenarios { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.esc { border-left: 4px solid var(--c); background: var(--surface-2); border-radius: 0 10px 10px 0; padding: 8px 12px; font-size: 14px; }
.esc b { display: block; font-size: 15px; }
.esc p { margin: 4px 0 0; color: var(--ink-2); }

details.card summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 8px; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: "＋"; margin-left: auto; color: var(--brand); }
details.card[open] summary::after { content: "－"; }
details.card p { white-space: pre-line; color: var(--ink-2); margin: 10px 0 0; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.check:last-child { border-bottom: 0; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--brand); flex: none; }

.entrada {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 8px; align-items: flex-end;
  width: 100%; max-width: 760px; margin: 0 auto;
  padding: 10px 16px 6px;
  background: var(--bg);
}
.entrada textarea {
  flex: 1; resize: none; max-height: 160px; min-height: 48px;
  border: 1.5px solid var(--line); border-radius: 24px; padding: 12px 16px;
  font: inherit; background: var(--surface); color: var(--ink);
}
.entrada textarea:focus { outline: none; border-color: var(--brand); }
.entrada button { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--brand); color: var(--brand-ink); font-size: 18px; flex: none; }
.entrada button:disabled { opacity: .5; }
.pie { text-align: center; font-size: 12px; color: var(--ink-3); margin: 0 auto; padding: 0 16px calc(10px + env(safe-area-inset-bottom)); max-width: 760px; }
.pie a { color: var(--ink-2); }

/* Términos */
.terminos { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 16px 16px 32px; }
.terminos h1 { font-size: 26px; margin: 8px 0 4px; }
.terminos h2 { font-size: 18px; margin: 24px 0 8px; }
.terminos p, .terminos li { color: var(--ink-2); }
.terminos a { color: var(--brand); }

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

/* Modal "Antes de salir" (igual que desmultAR) */
.salida { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.salida-caja { position: relative; background: var(--surface); color: var(--ink); border-radius: 16px; padding: 24px 20px 18px; width: 100%; max-width: 420px; max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.salida-caja h2 { margin: 0 28px 14px 0; font-size: 1.15rem; }
.salida-caja ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.salida-caja li a { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.salida-caja li a:hover { background: var(--surface-2); }
.salida-caja img { border-radius: 10px; flex: none; object-fit: cover; background: var(--surface-2); }
.salida-caja b { display: block; }
.salida-caja small { color: var(--ink-3); }
.salida-x { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; font-size: 24px; line-height: 1; color: var(--ink-3); cursor: pointer; }
.salida-x:hover { background: var(--surface-2); }
.salida-mas { display: block; margin-top: 12px; text-align: center; color: var(--brand); font-weight: 600; text-decoration: none; }

/* Hover y foco de todos los botones */
.chip, .ghost, .btn, .opciones button, .arranque button, .entrada button, .salida-x, .salida-caja li a {
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
@media (hover: hover) {
  .chip:hover { background: var(--brand); color: var(--brand-ink); }
  .ghost:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
  .arranque button:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(15, 111, 181, .15); }
  .opciones button:hover { background: var(--brand); color: var(--brand-ink); }
  .btn:hover { filter: brightness(1.08); }
  .btn.sec:hover { background: var(--brand-soft); filter: none; }
  .entrada button:not(:disabled):hover { filter: brightness(1.1); transform: scale(1.05); }
  .pie a:hover, .terminos a:hover { color: var(--brand); }
}
.chip:focus-visible, .ghost:focus-visible, .btn:focus-visible, .opciones button:focus-visible, .entrada button:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
.chip:active, .opciones button:active, .arranque button:active, .btn:active { transform: scale(.97); }
@media (prefers-reduced-motion: reduce) {
  .chip, .ghost, .btn, .opciones button, .arranque button, .entrada button { transition: none; }
  .arranque button:hover, .entrada button:not(:disabled):hover { transform: none; }
}

/* ---------- Preguntas guiadas ---------- */
.arranque-t { margin: 18px 0 -8px !important; color: var(--ink) !important; }
.flujo { padding: 4px 0 24px; max-width: 560px; margin: 0 auto; }
.paso-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.atras { background: none; border: 0; color: var(--brand); font-weight: 600; padding: 8px 4px; font-size: 15px; }
.paso-n { font-size: 13px; color: var(--ink-3); text-align: right; }
.progreso { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.progreso i { display: block; height: 100%; background: var(--brand); border-radius: 3px; transition: width .3s ease; }
.pregunta { font-size: clamp(24px, 6vw, 30px); line-height: 1.15; letter-spacing: -.01em; margin: 28px 0 8px; }
.ayuda { color: var(--ink-2); margin: 0 0 20px; }
.respuesta { display: flex; flex-direction: column; gap: 12px; }
.moneda { display: inline-flex; align-self: flex-start; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 4px; }
.moneda button { border: 0; background: none; color: var(--ink-2); border-radius: 999px; padding: 8px 16px; font-weight: 600; font-size: 15px; }
.moneda button[aria-checked="true"] { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.plata { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 4px 16px; }
.plata:focus-within { border-color: var(--brand); }
.plata span { font-size: 24px; font-weight: 700; color: var(--ink-3); }
.plata input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font-family: inherit; font-size: 28px; font-weight: 700; line-height: 1.2; padding: 12px 0; }
.plata input::placeholder { color: var(--ink-3); font-weight: 400; opacity: .7; }
.conv { margin: -4px 0 0; color: var(--ink-2); font-size: 14px; min-height: 1.4em; }
.link { align-self: flex-start; background: none; border: 0; color: var(--brand); text-decoration: underline; padding: 4px 0; font-size: 15px; }
.btn.grande { padding: 14px 20px; font-size: 17px; border-radius: 14px; margin-top: 4px; }
.elegir { display: grid; gap: 10px; }
.elegir button { text-align: left; background: var(--surface); color: var(--ink); border: 2px solid var(--line); border-radius: 14px; padding: 16px 18px; font-size: 17px; font-weight: 600; display: flex; flex-direction: column; }
.elegir button small { font-weight: 400; color: var(--ink-3); font-size: 14px; }
.elegir button.sel { border-color: var(--brand); background: var(--brand-soft); }
.elegir.bancos { grid-template-columns: 1fr 1fr; }
.elegir.bancos button { padding: 14px; font-size: 16px; }
.elegir.bancos .otro { grid-column: 1 / -1; color: var(--ink-2); }
.error-paso { color: var(--bad); background: var(--bad-bg); border-radius: 10px; padding: 8px 12px; margin: 12px 0 0; font-size: 15px; }

/* ---------- Resultados ---------- */
.resultado { display: flex; flex-direction: column; gap: 12px; padding-bottom: 12px; }
.res-hero { padding: 20px; border: 2px solid var(--brand); }
.res-hero.no { border-color: var(--line); }
.res-hero > small { color: var(--ink-3); font-size: 14px; }
.res-hero h2 { font-size: clamp(22px, 5.5vw, 28px); line-height: 1.2; margin: 4px 0 8px; letter-spacing: -.01em; }
.res-hero h2 b { color: var(--brand); white-space: nowrap; }
.res-hero .cuota { font-size: 19px; margin: 0 0 6px; }
.res-hero p { margin: 0 0 8px; }
.res-hero ul { margin: 0 0 10px; padding-left: 20px; }
.mini { font-size: 14px; color: var(--ink-2); }
.res-hero .ghost, .res-hero .btn { margin-top: 6px; }
.sec-t { font-size: 20px; margin: 14px 0 0; }
.saber { display: grid; gap: 12px; }
.saber-card h4 { font-size: 17px; }
.sub-card { font-size: 15px; color: var(--ink-2); margin: 12px 0 0; }
.cuentas { display: flex; flex-direction: column; gap: 4px; margin: 0 0 10px; font-size: 15px; }
.cuentas div { display: flex; justify-content: space-between; gap: 10px; }
.cuentas span { color: var(--ink-2); }
.cuentas .total { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; font-size: 17px; }
.cuentas .total span { color: var(--ink); font-weight: 600; }
details.mas { margin-top: 8px; }
details.mas > summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 15px; list-style: none; padding: 4px 0; }
details.mas > summary::-webkit-details-marker { display: none; }
details.mas > summary::after { content: " ▾"; }
details.mas[open] > summary::after { content: " ▴"; }
details.mas ul { padding-left: 18px; margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
details.mas li { margin-bottom: 6px; }
.no-cal > summary { color: var(--ink-2); }
.semaforo { margin: 0; }

.controles { display: flex; flex-direction: column; gap: 8px; }
.grupo { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; position: relative; }
.grupo > span { font-size: 14px; color: var(--ink-3); margin-right: 2px; }
.grupo button:not(.i) { background: var(--surface); color: var(--ink-2); border: 1.5px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 600; }
.grupo button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.lista-bancos { display: flex; flex-direction: column; gap: 10px; }
.banco { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.banco header { display: flex; gap: 10px; align-items: center; }
.banco header b { font-size: 17px; display: block; }
.banco header small { color: var(--ink-3); font-size: 13px; }
.pos { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); font-size: 13px; font-weight: 700; display: grid; place-items: center; }
.badge.bien { background: var(--good-bg); color: var(--good); }
.nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 4px; }
.nums > div { display: flex; flex-direction: column; position: relative; min-width: 0; }
.nums small { color: var(--ink-3); font-size: 12px; line-height: 1.3; }
.nums b { font-size: 18px; line-height: 1.25; overflow-wrap: anywhere; }
.nums span { font-size: 12px; color: var(--ink-3); }
.pct-s { font-weight: 700; }
.pct-s.ok { color: var(--good) !important; }
.pct-s.ojo { color: var(--warn) !important; }
.pct-s.mal { color: var(--bad) !important; }
.vacio { color: var(--ink-3); text-align: center; padding: 20px 0; }
.i { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid currentColor; background: none; color: var(--brand); font: italic 700 11px/1 Georgia, serif; padding: 0; margin-left: 4px; vertical-align: 1px; }
.pop { position: absolute; z-index: 20; left: 0; top: 100%; margin-top: 6px; width: min(300px, 80vw); background: var(--ink); color: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.45; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); font-weight: 400; }
.nums > div:last-child .pop { left: auto; right: 0; }
.claves li { position: relative; }
.dudas-caso h3 { margin: 0 0 4px; font-size: 18px; }
.dudas-caso p { margin: 0 0 10px; color: var(--ink-2); }
@media (max-width: 480px) {
  .nums { grid-template-columns: 1fr 1fr; }
  .nums > div:last-child { grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: 6px; flex-wrap: wrap; }
  .nums > div:last-child .pop { left: 0; right: auto; }
}
@media (hover: hover) {
  .elegir button:hover { border-color: var(--brand); background: var(--brand-soft); }
  .moneda button:not([aria-checked="true"]):hover { color: var(--brand); }
  .grupo button:not(.i):not([aria-pressed="true"]):hover { border-color: var(--brand); color: var(--brand); }
  .atras:hover, .link:hover, details.mas > summary:hover { text-decoration: underline; }
  .i:hover { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
}
.elegir button, .moneda button, .grupo button { transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .15s ease; }
.elegir button:active { transform: scale(.98); }
.elegir button:focus-visible, .moneda button:focus-visible, .grupo button:focus-visible, .atras:focus-visible, .i:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }
.moneda-t { margin: 0 0 -4px; font-weight: 600; font-size: 15px; color: var(--ink-2); }
.ver-mas { align-self: center; margin-top: 4px; }
details.saber-card { padding: 0; }
details.saber-card > summary { list-style: none; cursor: pointer; display: flex; gap: 12px; align-items: center; padding: 14px 16px; }
details.saber-card > summary::-webkit-details-marker { display: none; }
details.saber-card > summary::after { content: "＋"; margin-left: auto; color: var(--brand); font-weight: 700; font-size: 18px; flex: none; }
details.saber-card[open] > summary::after { content: "－"; }
details.saber-card .ic { font-size: 24px; flex: none; }
details.saber-card .st { display: flex; flex-direction: column; min-width: 0; }
details.saber-card .st b { font-size: 16px; }
details.saber-card .st small { color: var(--ink-2); font-size: 14px; line-height: 1.35; }
details.saber-card .cuerpo { padding: 0 16px 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.saber { gap: 8px; }
.guia { margin: -4px 0 0; }
@media (hover: hover) { details.saber-card > summary:hover { background: var(--surface-2); border-radius: var(--radius); } }
details.saber-card .st small { font-weight: 400; }
.nota-banco { font-size: 14px; color: var(--ink-2); background: var(--surface-2); border-radius: 8px; padding: 8px 10px; margin: 8px 0 0; }
.ir-banco { display: inline-block; margin-top: 6px; color: var(--brand); font-weight: 600; font-size: 15px; text-decoration: none; }
@media (hover: hover) { .ir-banco:hover { text-decoration: underline; } }

/* ---------- Chat flotante (abajo a la derecha) ---------- */
.fab {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 40;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 999px;
  padding: 12px 18px; font-weight: 700; font-size: 15px;
  box-shadow: 0 6px 20px rgba(15, 111, 181, .35);
  transition: transform .15s ease, filter .15s ease;
}
@media (hover: hover) { .fab:hover { transform: translateY(-2px); filter: brightness(1.08); } }
.fab:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.panel {
  position: fixed; right: 16px; bottom: 16px; z-index: 50;
  width: 400px; height: min(620px, calc(100dvh - 96px));
  display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .22);
}
.panel[hidden] { display: none !important; }
.panel-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 12px 12px 16px; background: var(--brand); color: var(--brand-ink); }
.panel-top b { display: block; font-size: 16px; }
.panel-top small { display: block; font-size: 13px; opacity: .85; }
.panel-x { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: inherit; font-size: 26px; line-height: 1; }
.panel-x:hover { background: rgba(255, 255, 255, .18); }
.panel-cuerpo { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 14px 6px; }
.panel-vacio p { color: var(--ink-2); margin: 0 0 10px; }
.panel #mensajes { gap: 12px; }
.panel .msg.usuario { max-width: 90%; }
.panel .entrada { position: static; max-width: none; padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.panel .entrada textarea { min-height: 44px; padding: 10px 14px; }
.panel .entrada button { width: 44px; height: 44px; }
.panel .card { padding: 12px; }
.panel .datos { grid-template-columns: 1fr; }
main { padding-bottom: 88px; }
@media (max-width: 560px) {
  .panel { inset: 0; width: auto; height: 100dvh; border-radius: 0; border: 0; }
  body.chat-abierto { overflow: hidden; }
}

/* ---------- Pestañas del resultado ---------- */
.tabs { position: sticky; top: 57px; z-index: 4; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 14px; margin: 0 0 4px; }
.tabs button { border: 0; background: none; color: var(--ink-2); border-radius: 10px; padding: 10px 6px; font-weight: 700; font-size: 14px; line-height: 1.2; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.tabs .n { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 12px; }
@media (hover: hover) { .tabs button:not([aria-selected="true"]):hover { color: var(--brand); } .sig:hover { border-color: var(--brand); } }
.tab { display: flex; flex-direction: column; gap: 12px; }
.res-hero h2 { margin-top: 0; }
.cubre { color: var(--good); font-weight: 700; margin: -4px 0 10px !important; }
.siguientes { display: grid; gap: 8px; }
.sig { display: flex; align-items: center; gap: 12px; text-align: left; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--ink); box-shadow: var(--shadow); transition: border-color .15s ease; }
.sig > span:first-child { font-size: 24px; }
.sig b { display: block; font-size: 16px; }
.sig small { color: var(--ink-2); font-size: 14px; line-height: 1.35; display: block; }
.sig i { margin-left: auto; font-style: normal; font-size: 26px; color: var(--brand); }
.nums { grid-template-columns: 1fr 1fr !important; }
.nums > div:last-child { grid-column: auto !important; flex-direction: column !important; }
.datos dt .i { vertical-align: 0; }
.datos div { position: relative; }
.paso-t { font-size: clamp(22px, 5.5vw, 26px); line-height: 1.2; margin: 0 0 6px; letter-spacing: -.01em; }
.lead { font-size: 18px; margin: 0 0 12px; color: var(--ink); }
.saber-card .cuerpo { border-top: 1px solid var(--line); padding-top: 12px; }
.res-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.res-nav .btn.grande { margin: 0; flex: 1; max-width: 340px; margin-left: auto; }
.res-nav .btn.sec { padding: 12px 16px; font-size: 15px; }
#res-saltar { font-size: 14px; }
.ver-mas { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.btn.sec[data-editar] { display: inline-flex; align-items: center; gap: 6px; }
/* Pasos divididos: los anteriores se pueden tocar para volver */
.pasos { list-style: none; display: flex; gap: 6px; margin: 0 0 4px; padding: 0; }
.pasos li { flex: 1; min-width: 0; }
.pasos button { width: 100%; background: none; border: 0; padding: 4px 0; display: flex; flex-direction: column; gap: 6px; align-items: stretch; color: var(--ink-3); font-size: 12px; font-weight: 600; text-align: left; }
.pasos button:disabled { cursor: default; }
.pasos i { display: block; height: 6px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line); transition: background-color .15s ease; }
.pasos .hecho i { background: var(--brand); border-color: var(--brand); opacity: .55; }
.pasos .actual i { background: var(--brand); border-color: var(--brand); }
.pasos .actual button { color: var(--brand); }
.pasos span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (hover: hover) { .pasos button:not(:disabled):hover i { opacity: 1; } .pasos button:not(:disabled):hover { color: var(--brand); } }
.pasos button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.buscar { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px; color: var(--ink-3); }
.buscar:focus-within { border-color: var(--brand); }
.buscar input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font: inherit; padding: 11px 0; }
.pregunta-final { margin-top: 10px; }
/* Selector de banco con autocompletar */
.combo { position: relative; }
.combo .buscar { padding: 0 6px 0 12px; }
.combo-x, .combo-flecha { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--ink-3); padding: 0; }
.combo-x { font-size: 22px; line-height: 1; }
@media (hover: hover) { .combo-x:hover, .combo-flecha:hover { background: var(--surface-2); color: var(--ink); } }
.combo-lista { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; max-height: 300px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 32, 48, .16); }
.combo-lista li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px 12px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.combo-lista li small { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.combo-lista li b { color: var(--brand); }
.combo-lista li[aria-selected="true"] { background: var(--brand-soft); }
@media (hover: hover) { .combo-lista li[data-nombre]:hover { background: var(--surface-2); } }
.combo-lista .combo-vacio { color: var(--ink-3); cursor: default; }
