/* Gastos Sin Miedo · estilos (marca IA Sin Miedo: papel, naranja, menta; Bricolage + Atkinson) */
:root {
  --paper: #FBF6EE; --paper-2: #F4EADB; --card: #FFFFFF;
  --ink: #1E2422; --ink-2: #4A524E; --ink-3: #6B716D; --line: #E6DACA;
  --accent: #B83E14; --accent-hover: #9C3310; --accent-soft: #FCE3D6;
  --sun: #FFC94D; --sun-soft: #FFF1C9;
  --mint: #1F6F5C; --mint-soft: #DDEFE8; --danger: #B42318; --danger-soft: #FDE4E1;
  --r-sm: 10px; --r: 16px; --r-lg: 24px;
  --shadow: 0 1px 2px rgba(60,40,20,.06), 0 8px 24px rgba(60,40,20,.08);
  --ease-out: cubic-bezier(.22,1,.36,1);
  --f-head: 'Bricolage Grotesque', system-ui, sans-serif;
  --f-body: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --nav-h: 64px; --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.5 var(--f-body); min-height: 100dvh; overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--f-head); line-height: 1.1; margin: 0 0 .4em; letter-spacing: -.02em; font-weight: 700; }
h1 { font-size: clamp(1.9rem, 6vw, 2.8rem); } h2 { font-size: 1.45rem; } h3 { font-size: 1.1rem; }
p { margin: 0 0 .9em; } a { color: var(--accent); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); } .small { font-size: .9rem; } .mono { font-variant-numeric: tabular-nums; }
.wrap { width: min(100% - 32px, 560px); margin-inline: auto; }

/* ---- Botones ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 999px; border: 2px solid transparent; background: var(--accent); color: #fff; font-weight: 700; cursor: pointer; transition: background .15s, transform .15s var(--ease-out), opacity .15s; text-decoration: none; }
.btn:hover { background: var(--accent-hover); } .btn:active { transform: scale(.98); }
.btn:disabled, .btn[aria-busy="true"] { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); } .btn.ghost:hover { background: var(--paper-2); }
.btn.mint { background: var(--mint); } .btn.mint:hover { background: #185a4b; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger-soft); } .btn.danger:hover { background: var(--danger-soft); }
.btn.sm { min-height: 40px; padding: 0 14px; font-size: .95rem; }
.btn.block { width: 100%; }
.btn .spin { display: none; } .btn[aria-busy="true"] .spin { display: inline-block; }
.spin { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.ghost .spin { border-color: rgba(0,0,0,.15); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }
.iconbtn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.iconbtn:hover { background: var(--paper-2); }

/* ---- Campos ---- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .lbl { font-weight: 700; font-size: .92rem; }
.input, select.input, textarea.input { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--card); transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(30,36,34,.08); outline: none; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.help { font-size: .88rem; color: var(--ink-3); } .err { font-size: .92rem; color: var(--danger); font-weight: 700; min-height: 1.3em; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } @media (max-width: 380px) { .row { grid-template-columns: 1fr; } }
.seg { display: flex; background: var(--paper-2); border-radius: 999px; padding: 4px; gap: 4px; }
.seg button { flex: 1; min-height: 40px; border: 0; background: transparent; border-radius: 999px; font-weight: 700; color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.seg button[data-tipo="ingreso"][aria-pressed="true"] { color: var(--mint); } .seg button[data-tipo="gasto"][aria-pressed="true"] { color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; font-size: .92rem; }
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--paper-2); color: var(--ink-2); }
.tag.alta { background: var(--mint-soft); color: var(--mint); } .tag.media { background: var(--sun-soft); color: #7a5a00; } .tag.baja { background: var(--danger-soft); color: var(--danger); }

/* ---- Tarjetas ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card.soft { background: var(--paper-2); border-color: transparent; box-shadow: none; }

/* ---- App shell ---- */
.topbar { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); padding: calc(10px + var(--sat)) 0 10px; border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--f-head); font-weight: 800; font-size: 1.1rem; letter-spacing: -.01em; }
.brand img { width: 32px; height: 32px; border-radius: 9px; flex: none; }
.brand { white-space: nowrap; }
@media (max-width: 360px) { .brand { font-size: 1rem; } .live { display: none; } }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--ink-3); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px var(--mint-soft); }
main { padding: 18px 0 calc(var(--nav-h) + var(--sab) + 24px); }
.view { display: none; animation: fade .25s var(--ease-out); } .view.on { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; height: calc(var(--nav-h) + var(--sab)); padding-bottom: var(--sab); background: var(--card); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); }
.nav button { border: 0; background: transparent; display: grid; place-items: center; gap: 2px; font-size: .72rem; font-weight: 700; color: var(--ink-3); cursor: pointer; min-height: 44px; }
.nav button svg { width: 24px; height: 24px; }
.nav button[aria-current="page"] { color: var(--accent); }
.nav .mic { position: relative; }
.nav .mic span.dot { position: absolute; top: 4px; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(184,62,20,.35); transform: translateY(-14px); }
.nav .mic span.dot svg { width: 26px; height: 26px; }
.nav .mic small { margin-top: 36px; }

/* ---- Hoy ---- */
.daynav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.daynav h2 { margin: 0; font-size: 1.3rem; text-transform: capitalize; }
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.tot { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.tot .lbl { color: var(--ink-3); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.tot .val { font-family: var(--f-head); font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.tot.gasto .val { color: var(--accent); } .tot.ingreso .val { color: var(--mint); }
.pend { background: var(--sun-soft); border: 1px solid #F3DDA0; border-radius: var(--r); padding: 14px 16px; margin-bottom: 16px; }
.pend h3 { margin: 0 0 4px; } .pend .actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.list { display: grid; gap: 8px; }
.mov { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; cursor: pointer; transition: transform .15s var(--ease-out), box-shadow .15s; }
.mov:hover { box-shadow: var(--shadow); } .mov:active { transform: scale(.99); }
.mov.pendiente { border-style: dashed; border-color: #E0B94F; }
.mono-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-family: var(--f-head); font-weight: 800; font-size: 1rem; color: #fff; }
.mov .t { font-weight: 700; line-height: 1.25; } .mov .s { color: var(--ink-3); font-size: .85rem; margin-top: 2px; }
.mov .amt { font-family: var(--f-head); font-weight: 800; font-size: 1.05rem; white-space: nowrap; letter-spacing: -.01em; }
.mov .amt.gasto { color: var(--accent); } .mov .amt.ingreso { color: var(--mint); } .mov .amt.traslado { color: var(--ink-3); }
.empty { text-align: center; padding: 36px 16px; color: var(--ink-2); }
.empty .big { font-size: 2.2rem; margin-bottom: 8px; }
.empty q { display: block; font-style: italic; color: var(--ink); margin-top: 8px; }

/* ---- Agregar (voz) ---- */
.voice { text-align: center; padding: 10px 0 6px; }
.micbtn { width: 132px; height: 132px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; margin: 10px auto 12px; cursor: pointer; position: relative; box-shadow: 0 10px 30px rgba(184,62,20,.35); transition: transform .2s var(--ease-out), background .2s; }
.micbtn svg { width: 54px; height: 54px; }
.micbtn:hover { transform: scale(1.03); } .micbtn:active { transform: scale(.97); }
.micbtn[data-state="listening"] { background: var(--ink); }
.micbtn[data-state="listening"]::before, .micbtn[data-state="listening"]::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 3px solid rgba(30,36,34,.25); animation: pulse 1.6s ease-out infinite; }
.micbtn[data-state="listening"]::after { animation-delay: .8s; }
.micbtn[data-state="thinking"] { background: var(--mint); }
@keyframes pulse { 0% { transform: scale(.9); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .micbtn::before, .micbtn::after { animation: none !important; } .view { animation: none; } }
.status { min-height: 1.5em; font-weight: 700; } .transcript { min-height: 2.4em; font-size: 1.15rem; color: var(--ink); padding: 10px 14px; border-radius: var(--r-sm); background: var(--paper-2); margin: 10px 0; }
.transcript:empty::before { content: "Di por ejemplo: «gasté veinte mil en almuerzo» o «me pagaron dos millones de salario»"; color: var(--ink-3); font-size: .95rem; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: .85rem; margin: 16px 0 10px; } .or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.inline-form { display: flex; gap: 8px; } .inline-form .input { flex: 1; }
.confirm { margin-top: 18px; border-top: 3px solid var(--accent); }
.confirm .amount { display: flex; align-items: center; gap: 8px; }
.confirm .amount .input { font-family: var(--f-head); font-size: 1.6rem; font-weight: 800; min-height: 56px; }
.confirm .amount select { width: 112px; flex: none; padding-right: 28px; }
.ok-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 8px; }

details.det { margin: 4px 0 12px; background: var(--paper-2); border-color: transparent; }
details.det summary { padding: 12px 0; } details.det .body { padding-bottom: 8px; }
details.det .body .field { margin-bottom: 10px; } details.det .input { background: var(--card); }
.mov .s .det { color: var(--ink-2); }

/* ---- Resumen ---- */
.bars { display: grid; gap: 10px; margin-top: 10px; }
.bar { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.bar .track { grid-column: 1 / -1; height: 10px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .5s var(--ease-out); }
.days { display: flex; align-items: flex-end; gap: 4px; height: 90px; margin-top: 10px; }
.days .d { flex: 1; display: grid; align-content: end; justify-items: center; gap: 4px; height: 100%; }
.days .d i { display: block; width: 100%; max-width: 28px; background: var(--accent-soft); border-radius: 6px 6px 2px 2px; border-top: 3px solid var(--accent); min-height: 3px; }
.days .d small { font-size: .65rem; color: var(--ink-3); }
.delta { font-size: .85rem; font-weight: 700; } .delta.up { color: var(--danger); } .delta.down { color: var(--mint); }

/* ---- Límites ---- */
.lim { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.lim .track { grid-column: 1 / -1; height: 10px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.lim .fill { height: 100%; border-radius: 999px; background: var(--mint); transition: width .5s var(--ease-out); }
.lim.warn .fill { background: #D99A1B; } .lim.over .fill { background: var(--danger); }
.lim .pct { font-size: .8rem; font-weight: 700; color: var(--ink-3); } .lim.warn .pct { color: #7a5a00; } .lim.over .pct { color: var(--danger); }
.limrow { display: grid; grid-template-columns: 1fr 140px; gap: 10px; align-items: center; margin-bottom: 8px; }
.limrow .input { min-height: 44px; }

/* ---- Suscripciones ---- */
.sub { display: grid; gap: 6px; }
.sub .head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.sub .head b { font-size: 1.05rem; } .sub .sig { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- Ajustes ---- */
details { border: 1px solid var(--line); border-radius: var(--r); background: var(--card); padding: 0 16px; margin-top: 12px; }
details summary { cursor: pointer; font-weight: 700; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details summary::after { content: "+"; font-size: 1.3rem; color: var(--ink-3); } details[open] summary::after { content: "–"; }
details .body { padding: 0 0 16px; }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; background: var(--paper-2); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
pre.code { padding: 12px; white-space: pre-wrap; }
ol.steps { padding-left: 20px; } ol.steps li { margin-bottom: 8px; }
.tokenbox { display: flex; gap: 8px; align-items: center; } .tokenbox .code { flex: 1; min-height: 44px; display: flex; align-items: center; }

/* ---- Hoja (editar) ---- */
dialog.sheet { border: 0; padding: 0; background: transparent; max-width: none; width: 100%; margin: auto 0 0; }
dialog.sheet::backdrop { background: rgba(30,36,34,.45); }
dialog.sheet .panel { background: var(--paper); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 14px 16px calc(20px + var(--sab)); max-height: 92dvh; overflow: auto; width: min(100%, 640px); margin-inline: auto; }
.handle { width: 44px; height: 5px; border-radius: 999px; background: var(--line); margin: 0 auto 12px; }

/* ---- Toast ---- */
.toasts { position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-h) + var(--sab) + 12px); z-index: 20; display: grid; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; box-shadow: var(--shadow); animation: fade .25s var(--ease-out); font-weight: 600; }
.toast.ok { background: var(--mint); } .toast.err { background: var(--danger); }
.toast button { background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: 8px; min-height: 36px; padding: 0 12px; font-weight: 700; cursor: pointer; }

/* ---- Landing / auth ---- */
.hero { padding: calc(28px + var(--sat)) 0 10px; }
.hero .brand { font-size: 1.2rem; margin-bottom: 26px; }
.hero h1 { margin-bottom: 12px; } .hero .lead { font-size: 1.1rem; color: var(--ink-2); max-width: 36ch; }
.proof { display: grid; gap: 10px; margin: 18px 0 24px; }
.proof div { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; color: var(--ink-2); }
.proof div b { color: var(--ink); }
.proof svg { width: 24px; height: 24px; color: var(--mint); }
.auth .tabs { margin-bottom: 16px; }
.foot { text-align: center; color: var(--ink-3); font-size: .82rem; padding: 26px 0 calc(20px + var(--sab)); }
