/* Generado por fase2/build-web.js desde app/index.html. No editar a mano. */
:root {
  color-scheme: light;
  --bg: #F1F2F5;
  --surface: #FFFFFF;
  --surface-2: #E8EAEF;
  --surface-3: #DCDFE6;
  --text: #13151B;
  --text-2: #565B69;
  --text-3: #8A8F9C;
  --sep: rgba(19, 24, 44, 0.11);
  --accent: #2E3FB8;
  --accent-strong: #24329A;
  --accent-ink: #FFFFFF;
  --accent-fill: #2E3FB8;
  --ink: #FFFFFF;
  --accent-soft: rgba(46, 63, 184, 0.10);
  --highlight: #E8A33D;
  --pos: #187A45;
  --pos-soft: rgba(24, 122, 69, 0.12);
  --neg: #C8322F;
  --neg-soft: rgba(200, 50, 47, 0.10);
  --warn: #A86506;
  --scrim: rgba(12, 14, 22, 0.42);
  --shadow: 0 10px 30px rgba(15, 20, 40, 0.14), 0 1px 3px rgba(15, 20, 40, 0.08);
  --tabbar: rgba(250, 250, 252, 0.86);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0C0E13;
    --surface: #181B22;
    --surface-2: #232731;
    --surface-3: #2E333F;
    --text: #EDEFF4;
    --text-2: #A2A7B5;
    --text-3: #6F7483;
    --sep: rgba(225, 232, 255, 0.12);
    --accent: #8C99FF;
    --accent-strong: #A9B3FF;
    --accent-ink: #0C0E13;
    --accent-soft: rgba(140, 153, 255, 0.16);
    --highlight: #F0B65A;
    --pos: #45C982;
    --pos-soft: rgba(69, 201, 130, 0.14);
    --neg: #FF6F68;
    --neg-soft: rgba(255, 111, 104, 0.14);
    --warn: #F0B65A;
    --scrim: rgba(0, 0, 0, 0.6);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --tabbar: rgba(22, 25, 32, 0.86);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0C0E13;
  --surface: #181B22;
  --surface-2: #232731;
  --surface-3: #2E333F;
  --text: #EDEFF4;
  --text-2: #A2A7B5;
  --text-3: #6F7483;
  --sep: rgba(225, 232, 255, 0.12);
  --accent: #8C99FF;
  --accent-strong: #A9B3FF;
  --accent-ink: #0C0E13;
  --accent-soft: rgba(140, 153, 255, 0.16);
  --highlight: #F0B65A;
  --pos: #45C982;
  --pos-soft: rgba(69, 201, 130, 0.14);
  --neg: #FF6F68;
  --neg-soft: rgba(255, 111, 104, 0.14);
  --warn: #F0B65A;
  --scrim: rgba(0, 0, 0, 0.6);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --tabbar: rgba(22, 25, 32, 0.86);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--text); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Estructura ---------- */
#app { min-height: 100%; }
.screen {
  padding: 0 var(--gutter-r) calc(110px + var(--safe-bottom)) var(--gutter-l);
  max-width: 680px;
  margin: 0 auto;
}
.topbar {
  position: sticky;
  top: var(--safe-top);
  z-index: 20;
  background: var(--bg);
  margin: 0 calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter-l));
  padding: 8px var(--gutter-r) 6px var(--gutter-l);
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.topbar::before { /* tapa la zona del notch */
  content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: var(--safe-top); background: var(--bg);
}
.topbar.scrolled { box-shadow: 0 1px 0 var(--sep); }
.big-title { font-size: 32px; font-weight: 750; letter-spacing: -0.02em; margin: 4px 0 12px; }
.sync {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-2);
  min-height: 32px; padding: 0 10px; border-radius: 16px; background: var(--surface);
  border: 0;
}
.sync .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.sync[data-s="synced"] .dot { background: var(--pos); }
.sync[data-s="syncing"] .dot { background: var(--accent); animation: pulse 1s infinite alternate; }
.sync[data-s="error"] .dot { background: var(--neg); }
.sync[data-s="local"] .dot { background: var(--highlight); }
@keyframes pulse { from { opacity: 1; } to { opacity: .3; } }

.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 15px; color: var(--text-2); }
.brand-mark { width: 22px; height: 22px; border-radius: 7px; background: var(--accent); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; right: 4px; top: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--highlight); }

/* ---------- Listas agrupadas ---------- */
.section-h { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin: 22px 4px 8px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.section-h .link { text-transform: none; letter-spacing: 0; font-size: 15px; }
.group { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 8px 14px;
  position: relative; width: 100%; text-align: left;
  background: none; border: 0;
}
.row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 14px; border-top: 0.5px solid var(--sep); }
.row.with-icon + .row.with-icon::before { left: 62px; }
button.row:active, .row.tap:active { background: var(--surface-2); }
.row .main { flex: 1; min-width: 0; }
.row .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .end { text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.chev { width: 8px; height: 13px; flex: none; color: var(--text-3); }
.foot { font-size: 13px; color: var(--text-2); margin: 8px 4px 0; line-height: 1.4; }
.empty { padding: 28px 16px; text-align: center; color: var(--text-2); font-size: 15px; }

/* Ícono de categoría */
.cat {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink); font-size: 13px; font-weight: 700; letter-spacing: -0.02em;
  background: var(--text-3);
  text-shadow: 0 1px 1px rgba(0,0,0,.18);
}
.cat.sm { width: 28px; height: 28px; font-size: 11px; }
.cat.lg { width: 48px; height: 48px; font-size: 16px; }
.cat.emo { font-size: 18px; text-shadow: none; }
.cat.sm.emo { font-size: 14px; }
.cat.lg.emo { font-size: 24px; }
/* v1.7: figuras de las cuentas */
.cat.shape-rounded { border-radius: 30%; }
.cat.shape-square { border-radius: 6px; }
.cat.shape-hexagon { border-radius: 0; clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%); }
.cat.shape-drop { border-radius: 50% 50% 50% 14%; }
.cat.xl { width: 72px; height: 72px; font-size: 26px; }
.cat.xl.emo { font-size: 36px; }
.acc-prev { display: flex; align-items: center; gap: 14px; padding: 6px 4px 14px; }
.acc-prev-txt { min-width: 0; }
.acc-prev-txt .title { font-size: 20px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-prev-txt .sub { color: var(--text-2); font-size: 14px; }
.icon-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.field .icon-row input[type="text"] { flex: 0 0 64px; width: 64px; min-width: 0; text-align: center; font-size: 20px; border-radius: 10px; background: var(--surface-2); min-height: 44px; }
.field .icon-row input[type="color"] { flex: none; width: 44px; min-width: 44px; height: 36px; }
.icon-pick { width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--surface-2); font-size: 22px; padding: 0; }
.icon-pick[aria-pressed="true"], .shape-pick[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); background: var(--accent-soft); }
.shape-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.shape-pick { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; min-height: 44px; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--text-2); font-size: 11px; }
.shape-nm { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* v1.8: gráficas */
.tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ch-toolbar .seg { flex: 1 1 220px; max-width: 320px; }
.ch-card { background: var(--surface); border-radius: var(--radius); padding: 14px 12px 10px; margin-bottom: 14px; }
.ch-head { padding: 0 4px 6px; }
.ch-head h3 { margin: 0; font-size: 17px; font-weight: 700; text-wrap: balance; }
.ch-headline { margin-top: 2px; font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ch-headline b { color: var(--text); font-weight: 650; }
.ch-headline b.pos { color: var(--pos); }
.ch-headline b.neg-t { color: var(--neg); }
.ch { display: block; width: 100%; height: auto; max-width: 100%; overflow: visible; }
.ch-grid { stroke: var(--sep); stroke-width: 1; }
.ch-zero { stroke: var(--text-3); stroke-width: 1; }
.ch-avg { stroke: var(--text-3); stroke-width: 1.5; stroke-dasharray: 4 3; }
.ch-ax { fill: var(--text-3); font-size: 10px; font-variant-numeric: tabular-nums; }
.ch-line { stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-area { opacity: .12; }
.ch-dot { stroke: var(--surface); stroke-width: 2; }
.ch-bar { stroke: var(--surface); stroke-width: 0; }
.ch-hit { fill: transparent; cursor: pointer; outline: none; }
.ch-hit.on, .ch-hit:focus-visible { fill: var(--text); fill-opacity: .06; }
.ch-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 6px 4px 2px; font-size: 13px; color: var(--text-2); }
.ch-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ch-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ch-note { margin: 6px 4px 0; font-size: 12.5px; color: var(--text-3); }
.ch-table { margin: 8px 4px 0; font-size: 14px; }
.ch-table summary { cursor: pointer; color: var(--accent); min-height: 32px; display: flex; align-items: center; font-weight: 600; }
.tbl-wrap { overflow-x: auto; }
.ch-table table { width: 100%; border-collapse: collapse; margin-top: 4px; font-variant-numeric: tabular-nums; }
.ch-table th, .ch-table td { padding: 6px 6px; border-bottom: 0.5px solid var(--sep); text-align: left; white-space: nowrap; }
.ch-table th { color: var(--text-3); font-weight: 600; font-size: 12px; }
.ch-table .num { text-align: right; }
.ch-tip { position: fixed; z-index: 70; max-width: 240px; padding: 8px 10px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 13px; line-height: 1.4; white-space: pre-line; pointer-events: none; box-shadow: 0 6px 20px rgba(0,0,0,.25); font-variant-numeric: tabular-nums; }
.hbars { display: grid; gap: 8px; padding: 6px 4px; }
.hbar { display: grid; grid-template-columns: minmax(0, 7.5em) 1fr auto; gap: 10px; align-items: center; font-size: 14px; border-radius: 8px; outline: none; }
.hbar.on, .hbar:focus-visible { background: var(--surface-2); }
.hb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.hb-track i { display: block; height: 100%; border-radius: 5px; }
.hb-val { color: var(--text-2); }
.chart-pick { gap: 6px; }
.chart-pick .title { font-weight: 600; }
.chart-pick .sub { font-size: 13px; color: var(--text-2); }
.mini-btn:disabled { opacity: .3; }
/* v1.9: transferir entre cuentas */
.sh-actions { display: inline-flex; gap: 4px; }
.xfer-list { display: grid; gap: 6px; }
.xfer-acc { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 8px 12px; border: 0; border-radius: 12px; background: var(--surface); color: var(--text); font-size: 16px; text-align: left; }
.xfer-acc[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.xfer-acc:disabled { opacity: .35; }
.xfer-nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xfer-bal { color: var(--text-2); font-size: 15px; white-space: nowrap; }
.xfer-swap-row { display: flex; justify-content: center; margin: 8px 0 -4px; }
.xfer-swap { border: 0; background: var(--surface-2); color: var(--accent); font-weight: 600; font-size: 14px; min-height: 40px; padding: 0 16px; border-radius: 999px; }
.xfer-prev { display: grid; gap: 6px; margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface); font-size: 14px; }
.xfer-prev > div { display: flex; justify-content: space-between; gap: 10px; }
.xfer-prev .num { white-space: nowrap; }
.xfer-warn { margin-top: 8px; padding: 8px 12px; border-radius: 10px; background: var(--surface); color: var(--neg); font-size: 14px; }
/* v1.10: tu cuenta */
.me-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--radius); background: var(--surface); }
.me-card.warn { box-shadow: inset 0 0 0 1.5px var(--warn); }
.me-av { flex: none; width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.me-av-empty { display: grid; place-items: center; font-weight: 800; color: var(--bg); }
.me-av.me-ok { background: var(--pos); color: var(--bg); }
.me-card.warn .me-av-empty { background: var(--warn); }
.me-txt { min-width: 0; }
.me-txt .title { font-weight: 650; font-size: 16px; overflow-wrap: anywhere; }
.me-txt .sub { font-size: 14px; color: var(--text-2); margin-top: 2px; line-height: 1.4; }
.me-strip { display: block; width: 100%; text-align: left; margin-bottom: 12px; padding: 12px 14px; min-height: 44px; border: 0; border-radius: var(--radius); background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--warn); color: var(--text); font-size: 14px; line-height: 1.4; }

/* ---------- Inicio ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.month-nav .label { font-size: 17px; font-weight: 650; text-align: center; flex: 1; }
.icon-btn {
  min-width: 44px; min-height: 44px; border-radius: 22px; border: 0;
  background: var(--surface); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; padding: 0 10px;
}
.icon-btn:disabled { color: var(--text-3); }
.icon-btn svg { width: 20px; height: 20px; }
.hero { background: var(--surface); border-radius: 20px; padding: 18px 18px 16px; }
.hero .k { font-size: 13px; color: var(--text-2); font-weight: 600; }
.hero .net { font-size: 38px; font-weight: 750; letter-spacing: -0.03em; margin: 2px 0 14px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.hero .split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hero .split > div { background: var(--bg); border-radius: 12px; padding: 10px 12px; min-width: 0; }
/* v1.14: saldo total protagonista arriba; el resumen del mes, más discreto debajo */
.hero-total .net { font-size: 44px; color: var(--text); }
.hero-total .net.neg-v, .hero .neg-v { color: var(--neg); }
.hero-total .split:has(> div:only-child) { grid-template-columns: 1fr; }
.hero-month .net { font-size: 30px; }
.hero .split .v { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.hero .note { font-size: 13px; color: var(--text-2); margin-top: 10px; }

.chart-card { background: var(--surface); border-radius: var(--radius); padding: 16px; display: flex; gap: 16px; align-items: center; }
.chart-card svg { flex: none; }
.legend { flex: 1; min-width: 0; list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; }
.legend .sw { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.legend .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .pc { color: var(--text-2); font-variant-numeric: tabular-nums; }
@media (max-width: 360px) { .chart-card { flex-direction: column; align-items: stretch; } .chart-card svg { align-self: center; } }

.bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.bar.over > i { background: var(--neg); }
.bar.near > i { background: var(--warn); }
/* v1.4: tarjetas de crédito en Inicio */
.card-acc { margin-bottom: 10px; }
.card-bar { height: 6px; margin: 0 14px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.card-bar > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.card-bar.warn > i { background: var(--warn); }
.card-bar.over > i { background: var(--neg); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px 12px; font-size: 14px; color: var(--text-2); }
.card-foot > span { min-width: 0; }
/* v1.5: presupuestos por periodo */
.period-chip { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--text-2); font-size: 12px; font-weight: 600; vertical-align: 2px; white-space: nowrap; }
.field.bud-row { flex-wrap: wrap; row-gap: 6px; }
.field.bud-row .bud-name { flex: 1 1 120px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field.bud-row input { flex: 0 1 110px; min-width: 80px; }
.field.bud-row select { flex: 0 0 auto; max-width: 140px; }
/* v1.13: ¿Cuánto tienes hoy?, recuperar datos y miles al escribir */
.field.bal-row .bal-name { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.field.bal-row .bal-name .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field.bal-row .bal-name .sub { font-size: 13px; color: var(--text-2); }
.field.bal-row input { flex: 0 1 140px; min-width: 90px; color: var(--text); }
input.amt-in { font-variant-numeric: tabular-nums; }
.hero-total .hero-adjust { margin-top: 12px; width: 100%; }
.rescue-card { background: var(--surface); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.rescue-card .title { font-weight: 650; }
.rescue-card .sub { font-size: 15px; color: var(--text-2); margin-top: 2px; line-height: 1.4; }
.rescue-card .row-btns { margin-top: 10px; }
.backup-line { margin-top: 4px; }
/* v1.6: alertas de presupuesto */
.bud-alert { position: fixed; z-index: 60; top: 0; left: 0; right: 0; margin: 0 auto; max-width: 560px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px));
  transform: translateY(-120%); transition: transform .28s ease; pointer-events: none; }
.bud-alert.in { transform: none; pointer-events: auto; }
.bud-alert > .ba-icon, .bud-alert > .ba-body { position: relative; }
.bud-alert { display: flex; }
.bud-alert::before { content: ""; position: absolute; inset: calc(env(safe-area-inset-top, 0px) + 10px) max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px)); border-radius: 16px; background: var(--surface); box-shadow: 0 10px 30px rgba(0,0,0,.25); border: 1px solid var(--sep); }
.bud-alert > * { z-index: 1; }
.bud-alert .ba-icon { margin: 14px 0 0 14px; }
.bud-alert .ba-body { padding: 12px 14px 12px 10px; }
.ba-icon { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: var(--bg); background: var(--warn); }
[data-level="2"] .ba-icon, [data-level="2"] > .ba-icon { background: var(--neg); }
.ba-body { flex: 1; min-width: 0; }
.ba-title { font-weight: 650; font-size: 16px; color: var(--text); }
.ba-detail { font-size: 14px; color: var(--text-2); margin-top: 2px; line-height: 1.35; }
.ba-more { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.ba-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.home-alerts { display: grid; gap: 8px; margin-bottom: 12px; }
.home-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 4px 12px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--sep); }
.home-alert .mini-btn { margin-top: -10px; color: var(--text-3); font-size: 22px; }
@media (prefers-reduced-motion: reduce) { .bud-alert { transition: none; } }

.banner {
  background: var(--accent-soft); color: var(--text); border-radius: var(--radius);
  padding: 14px; margin-bottom: 14px; font-size: 15px;
}
.banner strong { display: block; margin-bottom: 4px; }
.banner .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ---------- Botones ---------- */
.btn {
  min-height: 48px; padding: 0 18px; border-radius: 12px; border: 0;
  background: var(--accent-fill); color: var(--accent-ink); font-weight: 650; font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.block { width: 100%; }
.btn.sec { background: var(--surface-2); color: var(--accent); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: var(--neg); color: #fff; }
.btn.danger-sec { background: var(--neg-soft); color: var(--neg); }
.btn.small { min-height: 44px; font-size: 15px; padding: 0 14px; }
.btn:disabled { opacity: .4; cursor: default; }
.link { color: var(--accent); background: none; border: 0; padding: 0 4px; min-height: 44px; font-size: 17px; }

/* ---------- Movimientos ---------- */
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border-radius: 10px; padding: 0 10px; min-height: 40px;
}
.search svg { width: 16px; height: 16px; color: var(--text-3); flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 17px; min-height: 40px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter-l)); padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.chips::-webkit-scrollbar { display: none; }
/* QA111-3: los detalles del movimiento (cuenta, fecha, nota, Dividir) bajan de línea en vez de salirse de la pantalla */
.chips.chips-wrap { flex-wrap: wrap; overflow-x: visible; }
.chips.chips-wrap .chip { max-width: 100%; }
.chip {
  flex: none; min-height: 36px; padding: 0 14px; border-radius: 18px; border: 0;
  background: var(--surface); color: var(--text); font-size: 15px;
  display: inline-flex; align-items: center; gap: 6px; position: relative; white-space: nowrap;
}
.chip.on { background: var(--accent-fill); color: var(--accent-ink); }
.chip select, .chip input[type="date"], .chip input[type="month"] {
  position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; border: 0; cursor: pointer;
}
.day-h { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); margin: 18px 4px 6px; font-weight: 600; }
.tx-amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx-amt.inc { color: var(--pos); }
.tx-amt.tr { color: var(--text-3); }
.tag-mini { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: var(--pos-soft); color: var(--pos); margin-left: 4px; vertical-align: 1px; }

/* ---------- Barra de pestañas ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--tabbar);
  -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  border-top: 0.5px solid var(--sep);
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) max(8px, var(--safe-bottom)) max(8px, env(safe-area-inset-left, 0px));
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: center;
}
.tab {
  background: none; border: 0; min-height: 48px; color: var(--text-3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 10px; font-weight: 600; min-width: 0;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--accent); }
.tab-add { display: flex; justify-content: center; }
.tab-add button {
  width: 56px; height: 56px; border-radius: 28px; border: 0; margin-top: -18px;
  background: var(--accent-fill); color: var(--accent-ink); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
}
.tab-add svg { width: 28px; height: 28px; }

/* ---------- Hojas ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 50; opacity: 0; transition: opacity .25s; }
.scrim.in { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  max-width: 680px; margin: 0 auto;
  max-height: calc(100% - var(--safe-top) - 10px);
  background: var(--bg); border-radius: 16px 16px 0 0;
  display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .32s cubic-bezier(.2,.9,.25,1);
  box-shadow: var(--shadow);
}
.sheet.tall { height: calc(100% - var(--safe-top) - 10px); }
.sheet.in { transform: none; }
.sheet-h {
  display: grid; grid-template-columns: minmax(64px, auto) 1fr minmax(64px, auto); align-items: center;
  padding: 8px max(8px, env(safe-area-inset-right, 0px)) 4px max(8px, env(safe-area-inset-left, 0px)); flex: none;
  position: relative;
}
.sheet-h::before { content: ""; position: absolute; top: 5px; left: 50%; width: 36px; height: 5px; border-radius: 3px; background: var(--surface-3); transform: translateX(-50%); }
.sheet-h h2 { margin: 0; font-size: 17px; font-weight: 650; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-h .link:last-child { text-align: right; justify-self: end; font-weight: 650; }
.sheet-b {
  overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1;
  padding: 4px var(--gutter-r) calc(16px + var(--safe-bottom)) var(--gutter-l);
}
.err {
  background: var(--neg-soft); color: var(--neg); border-radius: 10px; padding: 10px 12px; font-size: 15px; margin: 8px 0;
}

/* Formulario */
.field { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 4px 14px; position: relative; }
.field + .field::before { content: ""; position: absolute; top: 0; right: 0; left: 14px; border-top: 0.5px solid var(--sep); }
.field label, .field .lbl { flex: none; min-width: 96px; color: var(--text); }
.field input, .field select, .field textarea {
  flex: 1; min-width: 0; border: 0; background: none; outline: none; text-align: right; min-height: 44px; font-size: 17px; color: var(--text-2);
}
.field select { direction: rtl; }
.field select option { direction: ltr; }
.field input[type="color"] { flex: none; width: 44px; height: 32px; padding: 0; border-radius: 8px; overflow: hidden; }
.field textarea { text-align: left; min-height: 80px; padding: 10px 0; resize: vertical; }
/* v1.4: selector de color de la app */
.field-col { flex-direction: column; align-items: stretch; gap: 10px; padding-block: 12px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 0; padding: 0; background: var(--sw); position: relative; cursor: pointer; flex: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .swatch { background: var(--sw-d); } }
:root[data-theme="dark"] .swatch { background: var(--sw-d); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--text); }
.field .swatch.custom { min-width: 44px; max-width: 44px; }
.swatch.custom { background: conic-gradient(#e5484d, #f5a524, #3fb950, #2f81f7, #a371f7, #e5484d) !important; }
.swatch.custom[aria-pressed="true"]::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--sw); }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
textarea.big {
  width: 100%; min-height: 140px; border: 0; border-radius: var(--radius); background: var(--surface); padding: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; resize: vertical; color: var(--text);
}
.switch, .field input.switch { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 16px; background: var(--surface-3); position: relative; flex: none; margin: 0; transition: background .2s; cursor: pointer; }
.switch::after, .field input.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.switch:checked, .field input.switch:checked { background: var(--pos); }
.switch:checked::after, .field input.switch:checked::after { transform: translateX(20px); }
.field input.switch { min-height: 31px; padding: 0; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 10px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: none; min-height: 36px; border-radius: 8px; font-size: 15px; font-weight: 600; color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* Hoja añadir */
.amount-box { text-align: center; padding: 10px 0 6px; }
.amount-box .val {
  font-size: 48px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
  line-height: 1.1; min-height: 56px; overflow-wrap: anywhere;
}
.amount-box .val.zero { color: var(--text-3); }
.amount-box.expense .val:not(.zero) { color: var(--text); }
.amount-box.income .val:not(.zero) { color: var(--pos); }
.cat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 4px; margin: 8px 0; }
.cat-opt {
  border: 0; background: none; border-radius: 12px; padding: 6px 2px; min-height: 72px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--text);
}
.cat-opt .nm { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-opt[aria-pressed="true"] { background: var(--accent-soft); }
.cat-opt[aria-pressed="true"] .cat { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.more-cats { width: 100%; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.keypad button {
  min-height: 50px; border: 0; border-radius: 10px; background: var(--surface); font-size: 24px; font-weight: 500;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.keypad button:active { background: var(--surface-3); }
.keypad svg { width: 24px; height: 24px; vertical-align: middle; }
.add-sticky { position: sticky; bottom: 0; background: var(--bg); padding-top: 8px; margin-top: 4px; }
.note-input { width: 100%; border: 0; background: var(--surface); border-radius: 10px; padding: 0 12px; min-height: 44px; font-size: 17px; outline: none; margin-top: 8px; }

/* v1.2 */
.badge-count { min-width: 28px; height: 28px; border-radius: 14px; padding: 0 8px; background: var(--highlight); color: #1B1406; font-weight: 750; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; flex: none; }
.mini-btn { flex: none; width: 44px; min-height: 44px; border: 0; background: none; color: var(--accent); font-size: 18px; border-radius: 10px; }
.mini-btn:disabled { color: var(--text-3); opacity: .5; }
.pend-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 8px 12px 12px; }
.pend-actions .btn { padding: 0 6px; }

/* Importación */
.preview { overflow-x: auto; background: var(--surface); border-radius: var(--radius); }
.preview table { border-collapse: collapse; width: 100%; font-size: 13px; }
.preview th, .preview td { padding: 8px 10px; text-align: left; border-bottom: 0.5px solid var(--sep); white-space: nowrap; }
.preview td.num { text-align: right; }
.preview tr.dup td { color: var(--text-3); }
.preview tr.bad td { color: var(--neg); }
.flag { font-size: 11px; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.flag.bad { background: var(--neg-soft); color: var(--neg); }
.map-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.map-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.map-grid select { min-height: 44px; border-radius: 10px; border: 0; background: var(--surface); padding: 0 10px; font-size: 15px; color: var(--text); width: 100%; }

/* Toast */
.toast {
  position: fixed; z-index: 60;
  left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(84px + var(--safe-bottom));
  max-width: 480px; margin: 0 auto;
  background: var(--text); color: var(--bg); border-radius: 14px; padding: 6px 6px 6px 16px; min-height: 50px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 15px;
  box-shadow: var(--shadow);
  transform: translateY(20px); opacity: 0; transition: transform .25s, opacity .25s; pointer-events: none;
}
.toast.in { transform: none; opacity: 1; pointer-events: auto; }
.toast button { background: none; border: 0; color: var(--highlight); font-weight: 700; min-height: 44px; padding: 0 12px; font-size: 15px; }
.sheet-open .toast { bottom: calc(16px + var(--safe-bottom)); }

/* Bloqueo / carga / bienvenida */
.center-screen {
  min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(24px + var(--safe-top)) var(--gutter-r) calc(24px + var(--safe-bottom)) var(--gutter-l); text-align: center;
}
.loader-mark { width: 56px; height: 56px; border-radius: 18px; background: var(--accent); position: relative; margin-bottom: 18px; }
.loader-mark::after { content: ""; position: absolute; right: 10px; top: 10px; width: 14px; height: 14px; border-radius: 50%; background: var(--highlight); animation: pulse .8s infinite alternate; }
.skel { width: min(320px, 100%); display: grid; gap: 10px; margin-top: 22px; }
.skel i { display: block; height: 14px; border-radius: 7px; background: var(--surface-2); }
.skel i:nth-child(2) { width: 70%; } .skel i:nth-child(3) { width: 85%; }
.pin-dots { display: flex; gap: 14px; margin: 18px 0 8px; min-height: 16px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--text-2); }
.pin-dots i.f { background: var(--text); border-color: var(--text); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; margin-top: 18px; justify-content: center; }
.pin-pad button { width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--surface); font-size: 28px; font-weight: 400; font-variant-numeric: tabular-nums; }
.pin-pad button.plain { background: none; font-size: 16px; color: var(--accent); }
.pin-pad button:active { background: var(--surface-3); }
.welcome h1 { font-size: 30px; letter-spacing: -0.02em; margin: 0 0 12px; }
.privacy { background: var(--surface); border-radius: var(--radius); padding: 16px; text-align: left; font-size: 15px; line-height: 1.5; }
.privacy strong { display: block; font-size: 17px; margin-bottom: 6px; }

.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* Velo al pasar a segundo plano con PIN: el selector de apps no debe mostrar datos */
.veil { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.veil[hidden] { display: none; }

/* v1.11: dividir gastos y deudas con personas */
.owe-pos { color: var(--pos); }
.owe-neg { color: var(--neg); }
.owe-zero { color: var(--text-3); }
.row .sub.owe-pos { color: var(--pos); }
.row .sub.owe-neg { color: var(--neg); }
.row .sub.owe-zero { color: var(--text-3); }
.tag-mini.tag-debt { background: var(--accent-soft); color: var(--accent); }
.row .sub.split-line { color: var(--accent); }
.split-sum { margin: 8px 4px 0; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 14px; line-height: 1.35; font-variant-numeric: tabular-nums; }
.split-total { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); font-size: 15px; color: var(--text-2); }
.split-total b { font-size: 20px; color: var(--text); }
.pchips { display: flex; flex-wrap: wrap; gap: 8px; }
.pchip { min-height: 44px; padding: 0 14px 0 6px; gap: 8px; }
.pchip[aria-pressed="true"] { background: var(--accent-fill); color: var(--accent-ink); }
.pchip[aria-pressed="true"] .cat { box-shadow: 0 0 0 2px var(--accent-ink); }
.pchip > span:last-child { max-width: 12em; overflow: hidden; text-overflow: ellipsis; }
.pchip-new { min-height: 44px; color: var(--accent); font-weight: 600; background: var(--accent-soft); }
.row-btns { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.field .sp-name, .field.sp-row .sp-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-in { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; background: var(--surface-2); border-radius: 10px; padding: 0 10px; min-height: 40px; }
.field .sp-in input { color: var(--text); width: 5.5em; min-width: 0; flex: none; text-align: right; background: none; border: 0; padding: 0; min-height: 40px; outline: none; }
.sp-amt { flex: none; min-width: 4.5em; text-align: right; color: var(--text-2); font-size: 15px; }
.split-mine { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); font-size: 16px; line-height: 1.4; }
.split-mine b.num { font-size: 20px; }
.people-card { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; width: 100%; padding: 12px 14px; min-height: 44px; border: 0; border-radius: var(--radius); background: var(--surface); color: var(--text); text-align: left; }
.people-card:active { background: var(--surface-2); }
/* v1.13: dividir cuentas más visible */
.people-intro { flex-wrap: nowrap; align-items: center; text-align: left; }
.pi-ic { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; background: var(--accent-soft); }
.pi-txt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.pi-txt b { font-size: 15px; color: var(--text); }
.pi-txt span { font-size: 13px; color: var(--text-2); line-height: 1.35; }
.split-cta { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; margin: 8px 0 2px; border: 1.5px dashed var(--accent); border-radius: 12px; background: transparent; color: var(--accent); font-size: 15px; font-weight: 600; }
.split-cta.on { border-style: solid; background: var(--accent-soft); }
.pc-cols { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-width: 0; }
.pc-cols > span { display: flex; flex-direction: column; min-width: 0; }
.pc-cols .k { font-size: 13px; color: var(--text-2); font-weight: 600; }
.pc-cols .v { font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.pc-sub { order: 3; flex-basis: 100%; font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-card .chev { order: 2; }
.people-hero { padding: 12px; }
.people-hero .split .v { font-size: 22px; }
.person-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 6px 4px 16px; }
.ph-name { font-size: 20px; font-weight: 700; margin-top: 6px; overflow-wrap: anywhere; }
.ph-lbl { font-size: 15px; font-weight: 600; }
.ph-amt { font-size: 38px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.1; overflow-wrap: anywhere; }
.debt-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.da-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 56px; padding: 10px 12px; border: 0; border-radius: 12px; background: var(--surface); color: var(--text); text-align: left; }
.da-btn:active { background: var(--surface-2); }
.da-t { font-weight: 650; font-size: 16px; color: var(--accent); }
.da-s { font-size: 13px; color: var(--text-2); }
.hist-row { gap: 10px; }
.hist-row .end { font-weight: 600; white-space: nowrap; }
.hk { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); }
.hk-split { background: var(--accent); }
.hk-loan { background: var(--warn); }
.hk-settle { background: var(--pos); }
.hk-adjust { background: var(--text-3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
