/* Clara by Vorka · estilos
   Identidad: papel claro y tinta verde jade, números grandes y tranquilos. De la familia Vorka toma la V y el trazo diagonal
   (≈28°) que marca la pestaña activa. Sin degradados ni adornos: una acción principal por pantalla. */
:root {
  --bg: #f5f4ef; --card: #ffffff; --bg-2: #eeece5; --bg-3: #e3e0d7;
  --fg: #16201d; --fg-2: #5b6662; --fg-3: #8d9692; --line: #e4e1d8;
  --accent: #0d5c4f; --accent-2: #0a4a40; --accent-soft: #e1efe9; --accent-fg: #ffffff; --accent-txt: #0d5c4f;
  --warn: #9a6400; --warn-soft: #fbf1dc; --bad: #b8402d; --bad-soft: #fbe9e5; --good: #23784b; --good-soft: #e3f3e9;
  --scrim: rgba(22, 32, 29, .45); --shadow: 0 1px 2px rgba(20, 40, 34, .05), 0 6px 18px rgba(20, 40, 34, .06);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --r: 18px; --tab-h: 64px; --skew: -28deg;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1211; --card: #151c1a; --bg-2: #1b2421; --bg-3: #26312d;
    --fg: #edf2ef; --fg-2: #a3b0ab; --fg-3: #6f7c77; --line: #24302c;
    --accent: #3fa98c; --accent-2: #6cc7ab; --accent-soft: #17302a; --accent-fg: #06120f; --accent-txt: #6cc7ab;
    --warn: #e2ad4d; --warn-soft: #2d2512; --bad: #ef8a76; --bad-soft: #33201c; --good: #64c48f; --good-soft: #15291e;
    --scrim: rgba(0, 0, 0, .6); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1211; --card: #151c1a; --bg-2: #1b2421; --bg-3: #26312d;
  --fg: #edf2ef; --fg-2: #a3b0ab; --fg-3: #6f7c77; --line: #24302c;
  --accent: #3fa98c; --accent-2: #6cc7ab; --accent-soft: #17302a; --accent-fg: #06120f; --accent-txt: #6cc7ab;
  --warn: #e2ad4d; --warn-soft: #2d2512; --bad: #ef8a76; --bad-soft: #33201c; --good: #64c48f; --good-soft: #15291e;
  --scrim: rgba(0, 0, 0, .6); color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; min-height: 100vh; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--accent-txt); }
svg { display: block; flex: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
h1, h2, h3 { margin: 0; letter-spacing: -.015em; line-height: 1.2; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- estructura ---------- */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg); }
.marca { display: flex; align-items: center; gap: 8px; font-weight: 750; font-size: 18px; letter-spacing: -.02em; }
.marca .v { width: 22px; height: 22px; color: var(--accent); }
.marca small { font-weight: 500; font-size: 12px; color: var(--fg-3); }
.top .der { margin-left: auto; display: flex; gap: 4px; }
main { max-width: 560px; margin: 0 auto; padding: 4px 16px calc(var(--tab-h) + 96px + env(safe-area-inset-bottom)); }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--line); }
.nav a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--fg-3); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--accent-txt); }
.nav a[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 26px; height: 4px; background: var(--accent); transform: skewX(var(--skew)); border-radius: 0 0 2px 2px; }

/* ---------- piezas ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.pila { display: grid; gap: 12px; }
.fila { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fila > .crece, .it > .crece { flex: 1; min-width: 0; }
.mini { font-size: 13px; color: var(--fg-2); }
.tenue { color: var(--fg-3); }
.etq { font-size: 13px; font-weight: 650; color: var(--fg-2); letter-spacing: .01em; }
.titulo { font-size: 22px; font-weight: 750; margin: 8px 0 14px; }
.sub { font-size: 17px; font-weight: 700; margin: 22px 2px 10px; }
.cortar { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; background: var(--bg-2); color: var(--fg-2); }
.chip.aviso { background: var(--warn-soft); color: var(--warn); }
.chip.malo { background: var(--bad-soft); color: var(--bad); }
.chip.bueno { background: var(--good-soft); color: var(--good); }
.chip.pro { background: var(--accent-soft); color: var(--accent-txt); }
.vacio { text-align: center; color: var(--fg-2); padding: 28px 12px; }

/* El número grande de "Hoy" */
.alcanza { padding: 22px 18px 18px; border-radius: 22px; background: var(--accent); color: var(--accent-fg); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.alcanza::after { content: ""; position: absolute; right: -28px; top: -10px; width: 64px; height: 140%; background: rgba(255,255,255,.07); transform: skewX(var(--skew)); }
.alcanza .etq { color: inherit; opacity: .85; }
.alcanza .grande { font-size: clamp(40px, 13vw, 56px); font-weight: 780; letter-spacing: -.03em; line-height: 1.05; margin: 6px 0 2px; }
.alcanza .detalle { font-size: 14px; opacity: .9; margin-top: 8px; }
.alcanza.negativo { background: var(--bad); }
.grande-n { font-size: clamp(34px, 11vw, 46px); font-weight: 780; letter-spacing: -.03em; line-height: 1.05; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; font-weight: 700; background: var(--bg-2); color: var(--fg); text-decoration: none; }
.btn.prim { background: var(--accent); color: var(--accent-fg); }
.btn.peligro { background: var(--bad-soft); color: var(--bad); }
.btn.bloque { width: 100%; }
.btn.chico { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 11px; }
.btn:disabled { opacity: .5; cursor: default; }
.icono { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--fg-2); }
.icono:hover { background: var(--bg-2); }
.fab { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + 14px + env(safe-area-inset-bottom)); z-index: 6; display: flex; align-items: center; gap: 8px;
  min-height: 56px; padding: 0 26px; border-radius: 99px; background: var(--accent); color: var(--accent-fg); font-weight: 750; font-size: 17px; box-shadow: 0 6px 20px rgba(13, 92, 79, .35); }
.enlace { color: var(--accent-txt); font-weight: 650; text-decoration: none; }
.enlace:hover { text-decoration: underline; }

/* Formularios */
label.campo { display: grid; gap: 6px; }
label.campo > span { font-size: 14px; font-weight: 650; color: var(--fg-2); }
.entrada { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--bg-3); background: var(--card); }
.entrada:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ayuda { font-size: 13px; color: var(--fg-3); }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.4; }
.check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--accent); }
.seg { display: flex; padding: 4px; border-radius: 13px; background: var(--bg-2); gap: 4px; }
.seg button { flex: 1; min-height: 40px; border-radius: 10px; font-size: 14px; font-weight: 650; color: var(--fg-2); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--fg); box-shadow: var(--shadow); }
.error { color: var(--bad); font-size: 14px; font-weight: 600; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Tarjetas de crédito */
.tc { display: grid; gap: 10px; text-decoration: none; color: inherit; }
.tc .alias { font-weight: 720; font-size: 17px; }
.barra { height: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.barra > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.barra.alta > i { background: var(--warn); }
.barra.llena > i { background: var(--bad); }
.fechas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fechas > div { background: var(--bg-2); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.fechas b { display: block; font-size: 15px; }
.compara { display: grid; gap: 8px; }
.compara .r { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--bg-2); }
.compara .r.dif { background: var(--warn-soft); color: var(--warn); font-weight: 700; }

/* Listas */
.lista { display: grid; }
.lista > .it { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); text-align: left; width: 100%; min-height: 56px; }
.lista > .it:last-child { border-bottom: 0; }
.ico-c { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--bg-2); color: var(--fg-2); }
.monto { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.monto.mas { color: var(--good); }
.dia { font-size: 13px; font-weight: 700; color: var(--fg-3); margin: 16px 4px 2px; text-transform: capitalize; }
.cat-barra { display: grid; gap: 6px; }

/* Consejo */
.consejo { display: flex; gap: 12px; align-items: flex-start; }
.consejo .ico-c { background: var(--accent-soft); color: var(--accent-txt); }
.aviso-barra { padding: 12px 14px; border-radius: 14px; background: var(--warn-soft); color: var(--warn); font-size: 14px; font-weight: 600; }
.aviso-barra.info { background: var(--accent-soft); color: var(--accent-txt); }
.legal { font-size: 12px; color: var(--fg-3); text-align: center; margin: 24px 8px 0; line-height: 1.5; }

/* Hoja inferior */
.velo { position: fixed; inset: 0; z-index: 20; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; animation: aparece .15s ease-out; }
.hoja { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--card); border-radius: 22px 22px 0 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); animation: sube .2s ease-out; }
.hoja .asa { width: 40px; height: 5px; border-radius: 9px; background: var(--bg-3); margin: 0 auto 10px; }
.hoja h2 { font-size: 19px; margin-bottom: 12px; }
@keyframes aparece { from { opacity: 0; } }
@keyframes sube { from { transform: translateY(30px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .velo, .hoja { animation: none; } }

/* Teclado del gasto rápido */
.pantalla-monto { text-align: center; font-size: clamp(40px, 13vw, 54px); font-weight: 780; letter-spacing: -.03em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.pantalla-monto.cero { color: var(--fg-3); }
.teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.teclado button { min-height: 50px; border-radius: 12px; background: var(--bg-2); font-size: 22px; font-weight: 650; }
.teclado button:active { background: var(--bg-3); }
.teclado button svg { margin: auto; }
.cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cats button { display: grid; justify-items: center; gap: 4px; padding: 10px 2px; border-radius: 14px; background: var(--bg-2); font-size: 12px; font-weight: 650; line-height: 1.2; min-height: 72px; }
.cats button .ico-c { background: var(--card); width: 34px; height: 34px; }
.cats button:disabled { opacity: .45; }
.metodo { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.metodo button { flex: none; min-height: 36px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--bg-3); font-size: 13px; font-weight: 650; color: var(--fg-2); max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metodo button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }

/* Aviso flotante */
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 84px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 30; width: max-content; max-width: calc(100% - 32px);
  background: var(--fg); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-size: 14px; font-weight: 600; display: flex; gap: 14px; align-items: center; opacity: 0; pointer-events: none; transition: all .2s; }
.toast.ver { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { color: var(--accent-2); font-weight: 750; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast button { color: var(--accent); } }

/* Entrar */
.entrar { max-width: 420px; margin: 0 auto; padding: calc(32px + env(safe-area-inset-top)) 16px 40px; }
.entrar .marca { font-size: 26px; margin-bottom: 26px; }
.entrar .marca .v { width: 30px; height: 30px; }
.entrar h1 { font-size: 26px; margin-bottom: 8px; }
.puntos { display: grid; gap: 10px; margin: 22px 0; }
.puntos div { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.puntos svg { color: var(--accent); margin-top: 2px; }

@media (min-width: 760px) {
  main { padding-top: 12px; }
  .nav { padding-inline: max(0px, calc(50% - 300px)); }
  .hoja { border-radius: 22px; margin-bottom: 4vh; }
  .velo { align-items: center; }
}
