/* Yupay · estilos. Tema claro por defecto, oscuro según el sistema o el botón de tema. */
:root {
  --bg: #F7F5F0; --surface: #FFFFFF; --surface2: #F1EEE7; --ink: #1B1A2E; --muted: #66657A; --line: #E6E1D6;
  --brand: #E6336E; --brand2: #FF8A3D; --brand-ink: #C81E5B; --on-brand: #FFFFFF;
  --ok: #0B8F77; --ok-bg: #DDF5EE; --bad: #CF2445; --bad-bg: #FCE4E8; --warn: #9A5B00; --warn-bg: #FFF1D6; --info-bg: #E8ECFF; --info: #2F3FA8;
  --shadow: 0 1px 2px rgba(27,26,46,.05), 0 8px 24px rgba(27,26,46,.06);
  --r: 20px; --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #100F1C; --surface: #1B1A2C; --surface2: #25243A; --ink: #F4F2FA; --muted: #A9A7BE; --line: #302E48;
  --brand: #FF5C8D; --brand-ink: #FF86AA; --ok: #3DDCBC; --ok-bg: #12332E; --bad: #FF7088; --bad-bg: #3B1722; --warn: #FFC56B; --warn-bg: #3A2B10; --info-bg: #1E2350; --info: #AAB6FF;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #100F1C; --surface: #1B1A2C; --surface2: #25243A; --ink: #F4F2FA; --muted: #A9A7BE; --line: #302E48;
  --brand: #FF5C8D; --brand-ink: #FF86AA; --ok: #3DDCBC; --ok-bg: #12332E; --bad: #FF7088; --bad-bg: #3B1722; --warn: #FFC56B; --warn-bg: #3A2B10; --info-bg: #1E2350; --info: #AAB6FF;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.45 var(--font); -webkit-font-smoothing: antialiased; min-height: 100dvh; overflow-x: hidden; }
h1 { font-size: 1.6rem; line-height: 1.15; margin: 0 0 .35em; letter-spacing: -.02em; text-wrap: balance; }
h2 { font-size: 1.12rem; margin: 0 0 .6em; letter-spacing: -.01em; }
h3 { font-size: 1rem; margin: 1.2em 0 .3em; }
p { margin: 0 0 .8em; }
a { color: var(--brand-ink); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small, small { font-size: .84rem; } .center { text-align: center; } .strong { font-weight: 800; }
.mono, .code { font-family: ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: .04em; }
.grow { flex: 1; min-width: 0; }
.ic { width: 1.35em; height: 1.35em; flex: none; vertical-align: -.28em; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }

/* Marca */
.logo { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink); }
.logo svg { width: 34px; height: 34px; } .logo b { font-size: 1.45rem; font-weight: 800; letter-spacing: -.04em; }
.brand:hover { text-decoration: none; }

/* Estructura de la app */
.side { display: none; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem; padding: calc(.6rem + env(safe-area-inset-top)) 1rem .6rem; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); }
.top-title { flex: 1; text-align: right; color: var(--muted); font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.theme-float { position: fixed; top: calc(.8rem + env(safe-area-inset-top)); right: 1rem; z-index: 5; }
.main { padding: .5rem 1rem calc(6.2rem + env(safe-area-inset-bottom)); max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }
.main > p { margin: 0; }
.tabbar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom)); }
.tabbar a { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .4rem 0; color: var(--muted); font-size: .7rem; font-weight: 700; border-radius: 14px; }
.tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar a:hover { text-decoration: none; } .tabbar a.on { color: var(--brand-ink); }
.tabbar .ic { width: 26px; height: 26px; }
@media (min-width: 900px) {
  body.is-app { display: grid; grid-template-columns: 250px 1fr; }
  .side { display: flex; flex-direction: column; gap: 1.2rem; position: sticky; top: 0; height: 100dvh; padding: 1.4rem 1rem; border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; }
  .side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
  .side nav a { display: flex; align-items: center; gap: .7rem; padding: .62rem .8rem; border-radius: 12px; color: var(--ink); font-weight: 650; }
  .side nav a:hover { background: var(--surface2); text-decoration: none; }
  .side nav a.on { background: color-mix(in srgb, var(--brand) 13%, transparent); color: var(--brand-ink); }
  .side-foot { display: flex; flex-direction: column; gap: .6rem; border-top: 1px solid var(--line); padding-top: 1rem; }
  .who b, .who small { display: block; } .who small { color: var(--muted); }
  .top .brand, .tabbar { display: none; }
  .top { grid-column: 2; padding: 1.1rem 2rem .4rem; } .top-title { text-align: left; font-size: 1.5rem; color: var(--ink); font-weight: 800; letter-spacing: -.02em; }
  .main { grid-column: 2; padding: 1rem 2rem 3rem; width: 100%; margin: 0; }
  .side { grid-row: 1 / span 2; }
}

/* Pantallas de ingreso */
.auth { min-height: 100dvh; max-width: 440px; margin: 0 auto; padding: calc(2.2rem + env(safe-area-inset-top)) 1.1rem 2rem; display: flex; flex-direction: column; gap: 1rem; justify-content: center; }
.auth > .brand { align-self: center; margin-bottom: .4rem; } .auth > .brand svg { width: 46px; height: 46px; } .auth > .brand b { font-size: 2rem; }
.auth > p { margin: 0; }

/* Tarjetas */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.2rem; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .6rem; flex-wrap: wrap; } .card-head h2 { margin: 0; }
.grid2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.stack { display: flex; flex-direction: column; gap: .6rem; } .stack.row { flex-direction: row; flex-wrap: wrap; }
.prose h3 { margin-top: 1.2em; }

/* Formularios */
form { margin: 0; }
.field { display: block; margin-bottom: .9rem; }
.field > span { display: block; font-weight: 700; font-size: .93rem; margin-bottom: .3rem; }
.field small { display: block; color: var(--muted); margin-top: .3rem; }
input, select { width: 100%; min-height: 52px; padding: .7rem .95rem; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface2); color: var(--ink); font: inherit; }
input:focus, select:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
input[type=checkbox] { width: 24px; min-height: 0; height: 24px; flex: none; accent-color: var(--brand); padding: 0; }
.check { display: flex; gap: .7rem; align-items: flex-start; margin: 0 0 .9rem; font-size: .95rem; cursor: pointer; }
.row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 0 .8rem; }
.pin input { text-align: center; font-size: 2rem; letter-spacing: .5em; font-weight: 800; padding-left: calc(.95rem + .5em); min-height: 68px; }
.amount input { text-align: center; font-size: 2.6rem; font-weight: 800; min-height: 84px; letter-spacing: -.02em; }
.amount small, .amount > span { text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-bottom: .9rem; }
.chip { border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: .5rem .95rem; font: inherit; font-weight: 700; cursor: pointer; min-height: 44px; }
.chip:hover { border-color: var(--brand); color: var(--brand-ink); }
.filters { display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-end; } .filters .field { margin: 0; flex: 1 1 150px; } .filters .btn { min-height: 52px; }
.search { display: flex; gap: .5rem; margin-bottom: .8rem; } .search input { min-height: 46px; }
form.inline { display: flex; flex-wrap: wrap; gap: .4rem; flex: 1 1 100%; } form.inline input, form.inline select { min-height: 42px; flex: 1 1 120px; width: auto; padding: .4rem .7rem; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 48px; padding: .6rem 1.1rem; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 750; cursor: pointer; text-align: center; transition: transform .08s, filter .15s; }
.btn:hover { text-decoration: none; filter: brightness(.97); } .btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(135deg, #D81F63, #E6336E 55%, #EE4B3A); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(230,51,110,.28); }
.btn.ghost { background: transparent; } .btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.link { border: 0; background: none; color: var(--brand-ink); min-height: 44px; }
.btn.block { display: flex; width: 100%; } .btn.lg { min-height: 58px; font-size: 1.08rem; border-radius: 16px; } .btn.sm { min-height: 40px; padding: .35rem .8rem; font-size: .9rem; border-radius: 12px; }
form .btn.block + .btn.block, .btn.block + form, form + form { margin-top: .6rem; }
.btnrow { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; }

/* Avisos */
.flash { padding: .85rem 1rem; border-radius: 14px; font-weight: 650; margin: 0 0 .2rem; background: var(--info-bg); color: var(--info); }
.flash.ok { background: var(--ok-bg); color: var(--ok); } .flash.error { background: var(--bad-bg); color: var(--bad); } .flash.warn { background: var(--warn-bg); color: var(--warn); }
.card .flash { margin-bottom: .9rem; }
.badge { display: inline-block; padding: .16rem .6rem; border-radius: 999px; background: var(--surface2); color: var(--muted); font-size: .78rem; font-weight: 750; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.bad { background: var(--bad-bg); color: var(--bad); }

/* Saldo */
.balance { border-radius: 26px; padding: 1.5rem 1.4rem; color: #fff; background: radial-gradient(120% 140% at 100% 0%, #FF9A4D 0%, transparent 55%), linear-gradient(135deg, #D81F63, #E6336E 45%, #F2573F); box-shadow: 0 14px 34px rgba(230,51,110,.32); position: relative; overflow: hidden; }
.balance::after { content: ""; position: absolute; right: -40px; bottom: -70px; width: 200px; height: 200px; border-radius: 50%; border: 26px solid rgba(255,255,255,.12); }
.balance small { display: block; opacity: .92; font-weight: 650; } .balance .eq { margin-top: .2rem; opacity: .85; }
.big { font-size: clamp(2.3rem, 11vw, 3.3rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.big > span:last-child { font-size: .42em; font-weight: 750; letter-spacing: 0; opacity: .85; }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.actions a { display: flex; flex-direction: column; align-items: center; gap: .45rem; color: var(--ink); text-align: center; font-size: .82rem; line-height: 1.2; min-width: 0; }
.actions a:hover { text-decoration: none; }
.actions a > span { width: 62px; height: 62px; border-radius: 20px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--brand-ink); }
.actions .ic { width: 28px; height: 28px; } .actions b { font-weight: 700; overflow-wrap: anywhere; }
.nudge { display: flex; align-items: center; gap: .8rem; color: var(--ink); text-align: left; font: inherit; cursor: pointer; width: 100%; }
.nudge:hover { text-decoration: none; } .nudge small { display: block; color: var(--muted); font-weight: 500; } .chev { font-size: 1.6rem; color: var(--muted); }
.meter { height: 8px; border-radius: 99px; background: var(--surface2); margin-top: .5rem; overflow: hidden; } .meter i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #E6336E, #FF8A3D); }

/* Listas de movimientos */
.txs { list-style: none; margin: 0; padding: 0; }
.txs li, .txs .rowlink { display: flex; align-items: center; gap: .8rem; }
.txs li { padding: .7rem 0; border-top: 1px solid var(--line); } .txs li:first-child { border-top: 0; } .txs li.wrap { flex-wrap: wrap; }
.txs .rowlink { flex: 1; color: var(--ink); min-width: 0; } .txs .rowlink:hover { text-decoration: none; }
.txs b { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .txs small { display: block; color: var(--muted); overflow-wrap: anywhere; font-weight: 500; }
.txs li.wrap b, .txs li.wrap small { white-space: normal; overflow-wrap: anywhere; }
.dot { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--surface2); color: var(--muted); flex: none; }
.dot.in { background: var(--ok-bg); color: var(--ok); } .dot.out { background: var(--surface2); color: var(--ink); }
.amt { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; } .amt.in { color: var(--ok); }
.empty-line { color: var(--muted); text-align: center; padding: 1rem 0; margin: 0; }
.pager { display: flex; justify-content: space-between; gap: .5rem; margin-top: .8rem; } .pager:empty { display: none; }
.avatar { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto .7rem; font-size: 1.9rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, #E6336E, #FF8A3D); }
.avatar.sm { width: 42px; height: 42px; font-size: 1.05rem; margin: 0; flex: none; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .7rem; }
.menu-grid a { display: flex; flex-direction: column; gap: .5rem; color: var(--ink); } .menu-grid a:hover { text-decoration: none; border-color: var(--brand); } .menu-grid .ic { width: 28px; height: 28px; color: var(--brand-ink); }

/* QR */
.qrbox { display: flex; flex-direction: column; align-items: center; gap: .5rem; margin: .8rem auto; }
.qrbox > div { width: 190px; max-width: 100%; background: #fff; padding: 10px; border-radius: 18px; border: 1px solid var(--line); line-height: 0; }
.qrbox.xl > div { width: min(320px, 100%); } .qrbox svg { width: 100%; height: auto; display: block; }
.code { font-size: 1.1rem; font-weight: 800; }
.scanner { position: relative; aspect-ratio: 1; background: #0b0b14; border-radius: 22px; overflow: hidden; margin-bottom: .9rem; max-width: 420px; margin-inline: auto; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; inset: 14%; border: 4px solid rgba(255,255,255,.9); border-radius: 26px; box-shadow: 0 0 0 999px rgba(0,0,0,.28); }
.cam-msg { position: absolute; inset: auto 0 0 0; margin: 0; padding: .9rem; color: #fff; text-align: center; background: rgba(0,0,0,.55); font-weight: 650; }
.okmark { width: 92px; height: 92px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; margin: 0 auto 1rem; animation: pop .45s cubic-bezier(.2,1.4,.4,1); }
.okmark .ic { width: 52px; height: 52px; stroke-width: 2.6; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
.receipt .big { margin-bottom: .4rem; }
.pos.off { opacity: .6; }

/* Indicadores y tablas */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: .9rem 1rem; color: var(--ink); min-width: 0; }
a.kpi:hover { text-decoration: none; border-color: var(--brand); }
.kpi small { display: block; color: var(--muted); font-weight: 650; } .kpi b { display: block; font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; } .kpi em { display: block; font-style: normal; color: var(--muted); font-size: .8rem; }
.kpi.hi { background: linear-gradient(135deg, #D81F63, #F2573F); border-color: transparent; color: #fff; } .kpi.hi small, .kpi.hi em { color: rgba(255,255,255,.9); }
.card .kpis { margin-bottom: .8rem; } .card .kpi { background: var(--surface2); }
.tablewrap { overflow-x: auto; margin: 0 -.4rem; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); white-space: nowrap; } td { font-variant-numeric: tabular-nums; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; } .r { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 0; } .dl dt { color: var(--muted); } .dl dd { margin: 0; overflow-wrap: anywhere; font-weight: 600; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 170px; overflow-x: auto; padding-top: .5rem; }
.bar { flex: 1 0 18px; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.bar .cols { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.bar i { display: block; flex: 1; max-width: 14px; min-height: 2px; border-radius: 5px 5px 0 0; } .bar small { font-size: .65rem; color: var(--muted); height: 1em; }
i.a { background: #E6336E; } i.b { background: #12A594; }
.legend { font-size: .82rem; color: var(--muted); } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 .3rem 0 .6rem; }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.hbars li { display: grid; grid-template-columns: minmax(70px, 34%) 1fr auto; gap: .6rem; align-items: center; font-size: .92rem; }
.hbars span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .hbars i { height: 10px; background: var(--surface2); border-radius: 99px; overflow: hidden; } .hbars i b { display: block; height: 100%; background: linear-gradient(90deg, #E6336E, #FF8A3D); border-radius: 99px; } .hbars em { font-style: normal; font-weight: 800; }

@media print {
  .side, .top, .tabbar, .no-print, .flash { display: none !important; }
  body, .card { background: #fff !important; color: #000 !important; box-shadow: none; border: 0; } body.is-app { display: block; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.card > p.center:last-child, .card > form.center { margin: .9rem 0 0; }
