/* Finanzas — negro mate premium, grises y blanco; las deudas en rojo.
   Rendimiento: sin backdrop-filter en tarjetas (solo barra, cabecera y hojas), sin fondos animados,
   y movimiento corto (150–240 ms) que solo anima transform/opacity. */

/* ---------- tokens ---------- */
:root {
  --bg: #000;
  --surface: #0f0f11;
  --surface-2: #17171a;
  --surface-3: #202024;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .13);
  --text: #f5f5f7;
  --text-2: #c7c7cc;
  --muted: #8a8a8f;
  --faint: rgba(255, 255, 255, .06);
  --hover: rgba(255, 255, 255, .045);
  --accent: #f5f5f7;
  --on-accent: #000;
  --pos: #f5f5f7;
  --neg: #ff453a;
  --neg-2: #ff6961;
  --neg-soft: rgba(255, 69, 58, .13);
  --fx: #5a5a5f;
  --chrome: rgba(10, 10, 12, .72);
  --hi: inset 0 1px 0 rgba(255, 255, 255, .06);
  --shadow: 0 1px 2px rgba(0, 0, 0, .6), 0 12px 32px -16px rgba(0, 0, 0, .9);
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-sheet: cubic-bezier(.32, .72, 0, 1);
  --t-fast: 120ms;
  --t: 180ms;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f2f2f4;
  --surface: #ffffff;
  --surface-2: #f6f6f8;
  --surface-3: #ececef;
  --line: rgba(0, 0, 0, .07);
  --line-2: rgba(0, 0, 0, .14);
  --text: #0b0b0c;
  --text-2: #3a3a3c;
  --muted: #6e6e73;
  --faint: rgba(0, 0, 0, .045);
  --hover: rgba(0, 0, 0, .035);
  --accent: #0b0b0c;
  --on-accent: #fff;
  --pos: #0b0b0c;
  --neg: #d70015;
  --neg-2: #e5333f;
  --neg-soft: rgba(215, 0, 21, .08);
  --fx: #b5b5ba;
  --chrome: rgba(242, 242, 244, .8);
  --hi: inset 0 1px 0 rgba(255, 255, 255, .9);
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 10px 28px -18px rgba(0, 0, 0, .25);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #f2f2f4; --surface: #ffffff; --surface-2: #f6f6f8; --surface-3: #ececef;
    --line: rgba(0, 0, 0, .07); --line-2: rgba(0, 0, 0, .14); --text: #0b0b0c; --text-2: #3a3a3c; --muted: #6e6e73;
    --faint: rgba(0, 0, 0, .045); --hover: rgba(0, 0, 0, .035); --accent: #0b0b0c; --on-accent: #fff; --pos: #0b0b0c;
    --neg: #d70015; --neg-2: #e5333f; --neg-soft: rgba(215, 0, 21, .08); --fx: #b5b5ba; --chrome: rgba(242, 242, 244, .8);
    --hi: inset 0 1px 0 rgba(255, 255, 255, .9); --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 10px 28px -18px rgba(0, 0, 0, .25);
    color-scheme: light;
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  letter-spacing: -.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
  overflow-x: hidden;
}
body.noscroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button, a { touch-action: manipulation; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; }
a { color: inherit; text-decoration: none; }
code { font: 12.5px ui-monospace, "Cascadia Code", Menlo, monospace; background: var(--faint); padding: 1px 5px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* fondo: degradado estático (sin filtros ni animación) */
.bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(90% 55% at 50% -12%, rgba(255, 255, 255, .07), transparent 70%),
    radial-gradient(60% 40% at 100% 100%, rgba(255, 69, 58, .05), transparent 70%),
    var(--bg);
}
:root[data-theme="light"] .bg { background: radial-gradient(90% 55% at 50% -12%, #fff, transparent 70%), var(--bg); }
.bg i { display: none; }

/* superficie: negro mate con un brillo superior sutil (sin desenfoque) */
.glass {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2), var(--surface) 42%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--hi), var(--shadow);
}

/* ---------- layout ---------- */
.shell { max-width: 1180px; margin: 0 auto; padding: 0 16px calc(150px + env(safe-area-inset-bottom)); }
header.top {
  position: sticky; top: 0; z-index: 5;
  padding: calc(12px + env(safe-area-inset-top)) 0 12px;
  display: flex; align-items: center; gap: 10px;
}
header.top::before {
  content: ""; position: absolute; inset: 0 -16px; z-index: -1;
  background: var(--chrome);
  -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--line);
  opacity: 0; transition: opacity var(--t) var(--ease);
}
body.scrolled header.top::before { opacity: 1; }
header.top .ttl { flex: 1; min-width: 0; }
header.top h1 { font: 700 28px/1.1 var(--font-display); letter-spacing: -.028em; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.top .date { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.icon-btn {
  border: 0; background: transparent; width: 40px; height: 40px; border-radius: 12px; flex: 0 0 40px;
  display: grid; place-items: center; color: var(--muted);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { transform: scale(.92); }

/* navegación: barra inferior en móvil, lateral en escritorio */
.nav {
  position: fixed; z-index: 8; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex; padding: 5px; border-radius: 22px;
  background: var(--chrome); border: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .6);
}
.nav .brand { display: none; }
.nav a {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 2px 6px; border-radius: 17px; font-size: 10.5px; font-weight: 600; color: var(--muted);
  transition: color var(--t-fast), background var(--t-fast), transform var(--t-fast) var(--ease);
}
.nav a:active { transform: scale(.94); }
.nav a svg { width: 22px; height: 22px; }
.nav a[aria-current="page"] { color: var(--text); background: var(--faint); }
.nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

@media (min-width: 960px) {
  .nav { top: 16px; bottom: 16px; left: 16px; right: auto; width: 220px; flex-direction: column; gap: 2px; padding: 14px 10px; border-radius: 20px; }
  .nav .brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; font: 700 17px var(--font-display); letter-spacing: -.02em; }
  .nav .brand img { border-radius: 8px; }
  .nav a { flex: 0 0 auto; flex-direction: row; gap: 12px; padding: 10px 12px; font-size: 14.5px; border-radius: 11px; font-weight: 550; }
  .nav a svg { width: 20px; height: 20px; }
  .nav a:hover { background: var(--hover); color: var(--text); }
  .shell { padding: 0 28px 48px 268px; max-width: 1480px; }
  header.top { padding-top: 22px; padding-bottom: 16px; }
  header.top::before { inset: 0 -28px; }
  header.top h1 { font-size: 32px; }
}

/* ---------- tipografía ---------- */
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--muted); }
.big { font: 700 clamp(36px, 10vw, 54px)/1.02 var(--font-display); letter-spacing: -.045em; margin: 8px 0 2px; white-space: nowrap; }
.card-pad { padding: 18px; }
.card-h { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; flex-wrap: wrap; }
.card-h h2 { font: 650 17px var(--font-display); letter-spacing: -.02em; margin: 0; }
.card-h .hint { font-size: 12px; color: var(--muted); margin-left: auto; }
.badge { font-size: 12px; font-weight: 650; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; display: inline-grid; place-items: center; background: var(--faint); color: var(--text-2); }
.badge:empty { display: none; }
.more-link { margin-left: auto; font-size: 13px; color: var(--text-2); font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.more-link:hover { color: var(--text); }
.more-link svg { width: 16px; height: 16px; }
.sec { display: flex; align-items: center; gap: 10px; margin: 24px 4px 10px; font: 650 15px var(--font-display); letter-spacing: -.015em; }
.sec .r { margin-left: auto; color: var(--muted); font: 500 13px var(--font); }
.sec > svg { width: 18px; height: 18px; color: var(--muted); }
a.sec { border-radius: 12px; }
a.sec:hover .r { color: var(--text); }
a.sec > svg:last-child { width: 16px; height: 16px; margin-left: -4px; color: var(--muted); }

/* ---------- dashboard ---------- */
.dash { display: grid; gap: 12px; grid-template-columns: 1fr; }
.dash > * { min-width: 0; }
.hero {
  padding: 20px 20px 18px; overflow: hidden;
  background: radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, .09), transparent 55%), linear-gradient(180deg, var(--surface-2), var(--surface));
}
:root[data-theme="light"] .hero { background: linear-gradient(180deg, #fff, #fafafb); }
.hero-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.hs {
  display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--r-md); background: var(--faint); border: 1px solid var(--line);
  min-width: 0; transition: background var(--t-fast), transform var(--t-fast) var(--ease);
}
.hs:hover { background: var(--hover); }
.hs:active { transform: scale(.98); }
.hs span { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.hs b { font: 650 19px var(--font-display); letter-spacing: -.025em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs.pos b { color: var(--pos); }
.hs.neg b { color: var(--neg); }
.hs.pos, .hs.neg { color: var(--text); }
.balance-bar { display: flex; height: 6px; border-radius: 6px; overflow: hidden; margin-top: 14px; gap: 3px; background: var(--faint); }
.balance-bar i { display: block; height: 100%; border-radius: 6px; }
.balance-bar i.pos { background: var(--pos); }
.balance-bar i.neg { background: var(--neg); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; border-radius: var(--r-md); }
.kpi > div { min-width: 0; }
.kpi .lbl { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.kpi .val { font: 650 20px var(--font-display); letter-spacing: -.025em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.kpi .sub { font-size: 12px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.kpi .sub .ok { color: var(--text-2); font-weight: 550; }
.kpi-ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--faint); color: var(--text-2); flex: 0 0 44px; }
.kpi-ic svg { width: 21px; height: 21px; }
.ring { flex: 0 0 auto; width: 44px; height: 44px; }
.ring-bg { stroke: var(--faint); }
.ring-fg { stroke: var(--text); transition: stroke-dashoffset 400ms var(--ease); }
.ring.pos .ring-fg { stroke: var(--pos); }
.ring.neg .ring-fg { stroke: var(--neg); }
@media (min-width: 560px) {
  .kpi { flex-direction: row; align-items: center; gap: 14px; }
  .ring, .kpi-ic { width: 50px; height: 50px; flex: 0 0 50px; }
}
@media (min-width: 1100px) {
  .dash { grid-template-columns: repeat(12, 1fr); gap: 16px; }
  .hero { grid-column: span 5; display: flex; flex-direction: column; justify-content: center; }
  .kpis { grid-column: span 7; }
  .area-proj { grid-column: span 7; }
  .area-pend { grid-column: span 5; }
  .area-dist { grid-column: span 5; }
  .area-tl { grid-column: span 7; }
  .area-per { grid-column: span 12; }
  .area-pend .list { max-height: 440px; overflow: auto; overscroll-behavior: contain; }
}
@media (max-width: 1099px) {
  .hero, .kpis { order: 0; }
  .area-pend { order: 1; }
  .area-proj { order: 2; }
  .area-dist { order: 3; }
  .area-tl { order: 4; }
  .area-per { order: 5; }
}

/* proyección */
.proj-plot { position: relative; height: 196px; padding-left: 40px; }
.proj-grid { position: absolute; inset: 0 0 22px 0; pointer-events: none; }
.proj-grid div { position: absolute; left: 40px; right: 0; border-top: 1px solid var(--line); }
.proj-grid span { position: absolute; left: -40px; top: -8px; width: 36px; text-align: right; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.proj-cols { position: relative; display: flex; height: 100%; gap: 2px; }
.pcol { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; border: 0; background: none; padding: 0; border-radius: 9px; transition: background var(--t-fast); }
.pcol:hover, .pcol.sel { background: var(--faint); }
.pcol .bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; padding: 0 2px; }
.pcol .b { width: 40%; max-width: 14px; height: 100%; display: flex; flex-direction: column-reverse; gap: 1px; }
.pcol .b i { display: block; border-radius: 3px 3px 1px 1px; min-height: 0; }
.pcol .b.out .cu { background: var(--neg); }
.pcol .b.out .fx { background: var(--fx); border-radius: 1px; }
.pcol .b.in i { background: var(--pos); opacity: .85; }
.pcol .lbl { height: 22px; line-height: 22px; text-align: center; font-size: 11px; color: var(--muted); font-weight: 550; }
.pcol.sel .lbl { color: var(--text); }
.proj-legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.proj-legend span { display: inline-flex; align-items: center; gap: 6px; }
.k { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.k.cu { background: var(--neg); }
.k.fx { background: var(--fx); }
.k.in { background: var(--pos); }
.proj-detail { margin-top: 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--faint); border: 1px solid var(--line); }
.pd-m { font-weight: 650; font-size: 14px; margin-bottom: 6px; }
.pd-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pd-grid span { display: block; font-size: 11.5px; color: var(--muted); }
.pd-grid b { font-size: 14px; font-weight: 650; white-space: nowrap; }
@media (max-width: 480px) {
  .pd-grid { grid-template-columns: 1fr 1fr; }
  .proj-plot { height: 176px; padding-left: 34px; }
  .proj-grid div { left: 34px; }
  .proj-grid span { left: -34px; width: 30px; }
  .pcol .lbl { font-size: 10px; }
  .card-h .hint { display: none; }
}

/* fin de cada deuda */
.tl { display: grid; gap: 2px; }
.tl-axis { position: relative; height: 16px; margin-left: calc(34% + 10px); margin-right: 62px; font-size: 10.5px; color: var(--muted); }
.tl-axis span { position: absolute; transform: translateX(-50%); font-weight: 600; }
.tl-row {
  display: grid; grid-template-columns: 34% 1fr 52px; gap: 10px; align-items: center; padding: 7px 6px; margin: 0 -6px;
  border: 0; background: none; text-align: left; border-radius: 11px; transition: background var(--t-fast);
}
.tl-row:hover { background: var(--hover); }
.tl-l { min-width: 0; display: grid; }
.tl-l b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-l small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-track { position: relative; height: 8px; border-radius: 8px; background: var(--faint); }
.tl-y { position: absolute; top: -4px; bottom: -4px; width: 1px; background: var(--line); }
.tl-bar { position: absolute; top: 0; bottom: 0; border-radius: 8px; min-width: 6px; }
.tl-bar.pagar { background: var(--neg); }
.tl-bar.cobrar { background: var(--pos); opacity: .85; }
.tl-end { font-size: 12px; font-weight: 600; text-align: right; white-space: nowrap; color: var(--text-2); }
.tl-key { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.tl-key i { width: 9px; height: 9px; border-radius: 3px; margin-left: 6px; }
.tl-key i.pagar { background: var(--neg); }
.tl-key i.cobrar { background: var(--pos); }

/* distribución */
.dist { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.donut { position: relative; width: var(--size); height: var(--size); max-width: 40vw; max-height: 40vw; }
.donut svg { width: 100%; height: 100%; display: block; }
.donut-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-c small { font-size: 11.5px; color: var(--muted); font-weight: 550; }
.donut-c b { font: 650 15px var(--font-display); letter-spacing: -.02em; }
.legend { display: grid; gap: 2px; min-width: 0; }
.lg { display: grid; grid-template-columns: 9px 1fr auto; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 10px; transition: background var(--t-fast); }
.lg:hover { background: var(--hover); }
.lg > i { width: 9px; height: 9px; border-radius: 3px; }
.lg-n { min-width: 0; display: grid; font-weight: 600; font-size: 14px; }
.lg-n small, .lg-v small { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.lg-v { text-align: right; display: grid; font-weight: 600; font-size: 14px; }
@media (max-width: 480px) { .dist { grid-template-columns: 1fr; justify-items: center; } .legend { width: 100%; } .donut { max-width: 46vw; max-height: 46vw; } }

/* ---------- listas ---------- */
.list { overflow: hidden; }
.list.inset { border-radius: var(--r-md); background: var(--faint); border: 1px solid var(--line); }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%;
  background: none; border: 0; border-top: 1px solid var(--line); text-align: left; position: relative;
  transition: background var(--t-fast), opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.row:first-child { border-top: 0; }
.card-pad .list .row { padding-left: 2px; padding-right: 2px; }
button.row:hover, a.row:hover { background: var(--hover); }
button.row:active, a.row:active { background: var(--faint); }
.row .main { flex: 1; min-width: 0; }
.row .main.link { all: unset; flex: 1; min-width: 0; cursor: pointer; border-radius: 8px; }
.row .main.link:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.row .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.row .amt { text-align: right; font-weight: 650; white-space: nowrap; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.row .amt .s { font-weight: 400; margin-top: 3px; }
.row .chev, .row .chev svg { width: 18px; height: 18px; color: var(--muted); flex: 0 0 18px; }
.row.leaving { opacity: 0; transform: translateX(16px); }
.row.archived .t, .row.archived .amt { color: var(--muted); }
.row.archived .t { text-decoration: line-through; text-decoration-color: var(--line-2); }
.muted-row { opacity: .7; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty.small { padding: 18px 16px; font-size: 13px; }
.glass.empty { padding: 36px 16px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.dot.cobrar { background: var(--pos); }
.dot.pagar { background: var(--neg); }

.avatar {
  width: 38px; height: 38px; border-radius: 12px; flex: 0 0 38px;
  display: grid; place-items: center; font-weight: 650; font-size: 13px; letter-spacing: .01em;
  color: var(--text-2); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line);
}
.avatar.pagar { color: var(--neg); background: var(--neg-soft); box-shadow: inset 0 0 0 1px rgba(255, 69, 58, .2); }
.avatar.sm { width: 26px; height: 26px; flex-basis: 26px; border-radius: 8px; font-size: 10.5px; }
.avatar.lg { width: 60px; height: 60px; flex-basis: 60px; border-radius: 18px; font-size: 21px; }
.day { width: 42px; flex: 0 0 42px; text-align: center; line-height: 1.05; padding: 6px 0; border-radius: 11px; background: var(--faint); }
.day b { display: block; font-size: 17px; font-weight: 650; }
.day span { font-size: 9.5px; color: var(--muted); text-transform: uppercase; font-weight: 600; letter-spacing: .04em; }
.day.late { background: var(--neg-soft); color: var(--neg); }

.bar { height: 4px; border-radius: 4px; background: var(--faint); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--text-2); border-radius: 4px; }
.bar.cobrar i { background: var(--pos); }
.bar.pagar i { background: var(--neg); }

.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 99px; font-weight: 600; vertical-align: 1px; }
.pill.ok { color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-2); }
.pill.warn { background: var(--faint); color: var(--text-2); }
.pill.late { background: var(--neg-soft); color: var(--neg); }
.pill.mute { background: var(--faint); color: var(--muted); }
.pill.block { display: block; text-align: center; padding: 9px; margin: 0 0 14px; font-size: 13px; }

.check {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%;
  border: 1.5px solid var(--line-2); background: none; display: grid; place-items: center; color: transparent;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease);
}
@media (hover: hover) { .check:not(.on):hover { border-color: var(--text-2); color: var(--muted); } }
.check:active { transform: scale(.88); }
.check.on { background: var(--text); border-color: var(--text); color: var(--bg); animation: pop 200ms var(--ease); }
.check svg { width: 16px; height: 16px; }
@keyframes pop { 50% { transform: scale(1.12); } }

/* ---------- stats / toolbar ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 2px 0 16px; }
.stats.three > :last-child:nth-child(odd) { grid-column: span 2; }
@media (min-width: 720px) {
  .stats.three { grid-template-columns: repeat(3, 1fr); }
  .stats.three > :last-child:nth-child(odd) { grid-column: auto; }
  .stats.four { grid-template-columns: repeat(4, 1fr); }
}
.stat { padding: 14px 16px; min-width: 0; border-radius: var(--r-md); }
.stat .lbl { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.stat .val { font: 650 22px var(--font-display); letter-spacing: -.03em; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.pos .val { color: var(--pos); }
.stat.neg .val { color: var(--neg); }

.toolbar { display: flex; gap: 8px; align-items: center; margin: 2px 0 14px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; gap: 2px; }
.sheet .seg { background: var(--faint); border: 1px solid var(--line); }
.seg.full { display: flex; }
.seg.full button { flex: 1; }
.seg button { border: 0; background: none; padding: 7px 13px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--muted); transition: background var(--t-fast), color var(--t-fast); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.search { flex: 1; min-width: 160px; }
.search input { width: 100%; padding: 11px 14px; border-radius: 12px; font-size: 16px; outline: none; transition: border-color var(--t-fast); }
.search input:focus { border-color: var(--line-2); }
.month-nav { display: flex; align-items: center; gap: 4px; padding: 3px; border-radius: 12px; }
.month-nav b { min-width: 150px; text-align: center; font-size: 14.5px; font-weight: 600; }

/* ---------- botones ---------- */
.btn {
  border: 1px solid var(--line-2); background: var(--faint); padding: 10px 15px; border-radius: 12px; font-weight: 600; font-size: 14.5px;
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  transition: background var(--t-fast), transform var(--t-fast) var(--ease), opacity var(--t-fast);
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn.primary:hover { opacity: .9; }
.btn.danger { color: var(--neg); }
.btn.danger:hover { background: var(--neg-soft); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.row-actions { margin-left: auto; display: flex; gap: 6px; }
.stack { display: grid; gap: 8px; }
.hide-m { display: none; }
@media (min-width: 960px) { .hide-m { display: inline-flex; } }
@media (max-width: 480px) { .row .btn.sm span { display: none; } }

.fab {
  position: fixed; right: 18px; bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 7;
  width: 54px; height: 54px; border-radius: 18px; border: 0; background: var(--accent); color: var(--on-accent);
  box-shadow: 0 10px 26px -8px rgba(0, 0, 0, .7); display: grid; place-items: center;
  transition: transform var(--t-fast) var(--ease);
}
.fab:active { transform: scale(.9); }
.fab svg { width: 24px; height: 24px; }
@media (min-width: 960px) { .fab { display: none; } }

/* ---------- personas ---------- */
.people { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.person { display: grid; gap: 14px; padding: 16px; transition: border-color var(--t-fast), transform var(--t-fast) var(--ease); }
.person:hover { border-color: var(--line-2); }
.person:active { transform: scale(.985); }
.person-h { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person-h > div:not(.avatar) { flex: 1; min-width: 0; display: grid; }
.person-h b { font: 650 16px var(--font-display); letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-h small { font-size: 12px; color: var(--muted); }
.person-h .net { font: 650 16px var(--font-display); letter-spacing: -.02em; white-space: nowrap; }
.person-k { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 10px 12px; border-radius: var(--r-md); background: var(--faint); }
.person-k > div { min-width: 0; }
.person-k span { display: block; font-size: 11px; color: var(--muted); font-weight: 550; }
.person-k b { font-size: 13.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.person-hero { display: flex; gap: 16px; align-items: center; padding: 20px; margin-bottom: 12px; overflow: hidden; }
.ph-main { min-width: 0; }
.cols { display: grid; gap: 4px 20px; }
.cols > * { min-width: 0; }
.cols .card-h { margin: 20px 4px 10px; }
@media (min-width: 1000px) { .cols { grid-template-columns: 1.15fr 1fr; } }

/* ---------- hojas (modales) ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 20; animation: fade var(--t) ease-out both; }
.sheet {
  position: fixed; z-index: 21; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--line-2); border-bottom: 0; border-radius: 22px 22px 0 0;
  box-shadow: var(--hi), 0 -20px 50px -20px rgba(0, 0, 0, .8);
  padding: 8px 18px calc(20px + env(safe-area-inset-bottom));
  animation: sheet-up 240ms var(--ease-sheet) both; outline: none;
}
#sheet-root.closing .backdrop { animation: fade-out 160ms ease-in both; }
#sheet-root.closing .sheet { animation: sheet-down 170ms cubic-bezier(.4, 0, 1, 1) both; }
@media (min-width: 640px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 540px; translate: -50% -50%; border-radius: 22px; border-bottom: 1px solid var(--line-2); padding-bottom: 20px; max-height: 88dvh; animation-name: sheet-in; animation-duration: 200ms; }
  #sheet-root.closing .sheet { animation-name: sheet-out; animation-duration: 140ms; }
}
.sheet .grab { width: 38px; height: 5px; border-radius: 5px; background: var(--line-2); margin: 2px auto 12px; }
@media (min-width: 640px) { .sheet .grab { display: none; } .sheet h3 { margin-top: 10px; } }
.sheet h3 { margin: 4px 0 6px; font: 700 21px var(--font-display); letter-spacing: -.025em; display: flex; align-items: center; gap: 8px; }
.sheet h3 .x { margin-left: auto; }
.sheet-sub { margin: 0 0 14px; color: var(--muted); }
.sheet-sub a { color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.sheet-h { margin: 18px 0 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.notes { white-space: pre-wrap; color: var(--muted); margin: 0 0 14px; }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--faint); border: 1px solid var(--line); margin: 8px 0 14px; }
.banner > svg { width: 22px; height: 22px; color: var(--muted); flex: 0 0 22px; }
.banner > div { flex: 1; display: grid; }
.banner span { font-size: 13px; color: var(--muted); }
.banner.ok > svg { color: var(--text); }
.progress-lg { position: relative; height: 22px; border-radius: 11px; background: var(--faint); overflow: hidden; margin: 4px 0 14px; }
.progress-lg i { position: absolute; inset: 0 auto 0 0; background: var(--text-2); border-radius: 11px; }
.progress-lg.cobrar i { background: var(--pos); }
.progress-lg.pagar i { background: var(--neg); }
.progress-lg span { position: absolute; right: 10px; top: 0; line-height: 22px; font-size: 12px; font-weight: 650; mix-blend-mode: difference; color: #fff; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes sheet-in { from { opacity: 0; transform: scale(.96); } }
@keyframes sheet-out { to { opacity: 0; transform: scale(.97); } }
@keyframes fade { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

form.f { display: grid; gap: 12px; }
.f label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 550; }
.f label.chk { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 500; }
.f label.chk input { width: 20px; height: 20px; accent-color: var(--text); }
.f input, .f select, .f textarea {
  padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--faint); font-size: 16px; width: 100%;
  transition: border-color var(--t-fast), background var(--t-fast); outline: none; color: var(--text);
}
.f select option { background: var(--surface); }
.f input:focus, .f select:focus, .f textarea:focus { border-color: var(--line-2); background: var(--hover); }
.f .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.f .three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.hint { font-size: 12px; color: var(--muted); }
.f .hint { margin-top: -4px; }
.hint.center { text-align: center; margin: 4px 0 0; }
.f .actions { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.f .actions .btn { flex: 1; }
.err { color: var(--neg); font-size: 13px; }
.err:empty { display: none; }
@media (max-width: 420px) { .f .three { grid-template-columns: 1fr 1fr; } .f .three > :last-child { grid-column: span 2; } }

.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.kv div { background: var(--faint); border: 1px solid var(--line); border-radius: 12px; padding: 10px 11px; min-width: 0; }
.kv span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 550; }
.kv b { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.quick { display: flex; gap: 8px; margin-bottom: 14px; }
.quick .btn { flex: 1; }
.more { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; padding: 28px 24px 22px; animation: fade-up 220ms var(--ease) both; }
.login-card > img { display: block; margin-bottom: 14px; border-radius: 14px; }
.login h1 { margin: 0 0 4px; font: 700 28px var(--font-display); letter-spacing: -.03em; }
.login p { color: var(--muted); margin: 0 0 8px; }
.meter { height: 4px; border-radius: 4px; background: var(--faint); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: 4px; transition: width var(--t) var(--ease), background var(--t); background: var(--neg); }
.meter[data-s="1"] i { width: 25%; }
.meter[data-s="2"] i { width: 50%; background: var(--muted); }
.meter[data-s="3"] i { width: 75%; background: var(--text); }
.meter[data-s="4"] i { width: 100%; background: var(--text); }
.boot { min-height: 100dvh; }

#toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); translate: -50% 0;
  background: var(--surface-3); border: 1px solid var(--line-2); color: var(--text);
  padding: 11px 16px; border-radius: 13px; font-size: 14px; font-weight: 550;
  box-shadow: 0 14px 34px -14px rgba(0, 0, 0, .7);
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease); z-index: 30; max-width: calc(100% - 32px);
}
#toast.show { opacity: 1; transform: none; }
#toast.err { color: var(--neg); border-color: rgba(255, 69, 58, .35); }
@media (min-width: 960px) { #toast { bottom: 28px; left: calc(50% + 126px); } }

/* ---------- movimiento: una sola entrada corta por vista ---------- */
main.enter { animation: fade-up 200ms var(--ease) both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0s !important; transition-duration: 1ms !important; }
}

/* cambio de contenido dentro de una hoja abierta: sin volver a deslizar */
.sheet.swap { animation: none; }
.sheet.swap > * { animation: fade 140ms ease-out both; }
#sheet-root.closing { pointer-events: none; }
