/* Finova Personal — estilos de las vistas v2. Colores, tipos y espacios salen de tokens.css
   (generado desde ~/assistant/design/tokens/finova-personal.json): acá no hay hex sueltos. */

@font-face {
  font-family: "Geist";
  src: url("../fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-sans); font-size: var(--text-base); line-height: 1.5;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { margin: 0; font-weight: var(--weight-semibold); letter-spacing: -0.015em; line-height: 1.2; }
h1 { font-size: var(--text-xl); }
h2 { font-size: var(--text-md); }
h3 { font-size: var(--text-base); }
p { margin: 0; }
/* Cifras: Geist con tabular-nums; la mono queda solo para tablas (.mono, .tbl, .mov). */
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.sd { color: var(--muted); font-family: var(--font-sans); font-style: italic; font-weight: var(--weight-regular); letter-spacing: 0; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.warn { color: var(--warn); }
.pos { color: var(--accent-strong); }
.small { font-size: var(--text-sm); }
.xs { font-size: var(--text-xs); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Estructura ─────────────────────────────────────────────────────────── */
.shell { width: 100%; max-width: var(--shell); margin: 0 auto; padding: 0 var(--s4); }
@media (min-width: 768px) { .shell { padding: 0 var(--s6); } }

.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-in { display: flex; align-items: center; gap: var(--s5); height: 60px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: var(--weight-semibold); letter-spacing: -0.02em; }
.wordmark svg { flex: none; }
.wordmark .p { color: var(--muted); font-weight: var(--weight-regular); }
.nav { display: none; gap: var(--s1); }
.nav a {
  text-decoration: none; color: var(--ink-2); font-size: var(--text-sm); font-weight: var(--weight-medium);
  padding: 7px 12px; border-radius: var(--r-full);
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.nav a:hover { background: var(--sunken); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-wash); color: var(--accent-strong); }
.top-end { margin-left: auto; display: flex; align-items: center; gap: var(--s2); }
.fresh { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--muted); white-space: nowrap; }
.fresh::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.fresh.stale::before { background: var(--warn-fill); box-shadow: 0 0 0 3px var(--warn-wash); }
.fresh.stale .age { color: var(--warn); }
.icon-btn.salir { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; font-size: var(--text-sm); font-weight: var(--weight-medium); }
.salir span { display: inline; }
@media (min-width: 900px) { .icon-btn.salir { padding: 0; justify-content: center; } .salir span { display: none; } }
@media (max-width: 420px) { .wordmark .p { display: none; } .top-in { gap: var(--s3); } }
.icon-btn {
  display: inline-grid; place-items: center; min-width: var(--tap); height: var(--tap); border-radius: var(--r-full);
  border: 1px solid transparent; background: none; cursor: pointer; color: var(--ink-2); text-decoration: none;
}
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.only-desk { display: none; }
.fresh .only-desk { display: none; }
@media (min-width: 900px) { .fresh .only-desk { display: inline; } }
@media (min-width: 900px) {
  .nav { display: flex; }
  .only-desk { display: inline-flex; }
  .tabbar { display: none !important; }
}

main { padding: var(--s6) 0 calc(var(--s9) + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { main { padding: var(--s7) 0 var(--s9); } }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px 8px;
  min-height: var(--tap); text-decoration: none; color: var(--muted); font-size: 11px; font-weight: var(--weight-medium);
  text-align: center; line-height: 1.2; white-space: nowrap;
}
.tabbar a[aria-current="page"] { color: var(--accent-strong); }
.tabbar svg { width: 22px; height: 22px; }

/* ── Encabezado de página ───────────────────────────────────────────────── */
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--s3) var(--s5); margin-bottom: var(--s6); }
.page-head p { color: var(--ink-2); max-width: 62ch; margin-top: var(--s2); }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: var(--text-sm); margin-bottom: var(--s3); }
.back:hover { color: var(--ink); }

/* ── Paneles ────────────────────────────────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5); }
@media (min-width: 768px) { .panel { padding: var(--s6); } }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s2) var(--s3); margin-bottom: var(--s5); }
.panel-head .aside { font-size: var(--text-sm); color: var(--muted); }
.panel-head a.aside { text-decoration: none; color: var(--accent); font-weight: var(--weight-medium); }
.panel-head a.aside:hover { text-decoration: underline; }
.stack, .grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); align-items: start; }
.stack > *, .grid-2 > * { min-width: 0; }
@media (min-width: 900px) { .stack { gap: var(--s6); } }
@media (min-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s6); } }

/* ── Fuente del dato (tooltip) ──────────────────────────────────────────── */
.src {
  position: relative; display: inline-grid; place-items: center; vertical-align: 2px;
  width: 16px; height: 16px; margin-left: 4px; border-radius: 50%;
  border: 1px solid var(--control-border); background: none; padding: 0; cursor: help;
  color: var(--muted); font: 600 10px/1 var(--font-sans);
}
.src::before { content: ""; position: absolute; inset: -14px; }  /* área táctil de 44 px */
.src-tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: min(280px, 80vw); padding: 8px 10px; border-radius: 8px;
  background: var(--ink); color: var(--bg); font: 400 12px/1.4 var(--font-sans); text-align: left;
  letter-spacing: 0; white-space: normal; z-index: 40; cursor: auto;
}
.src-tip[hidden] { display: none; }
.src.r .src-tip { left: auto; right: -8px; transform: none; }
.src.l .src-tip { left: -8px; transform: none; }
.on-brand .src { border-color: color-mix(in srgb, var(--emerald-100) 45%, transparent); color: var(--emerald-100); }

/* ── Hero del resumen: la balanza ───────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden; color: var(--emerald-50);
  background: linear-gradient(140deg, var(--brand-from) 0%, var(--emerald-800) 55%, var(--brand-to) 100%);
  border-radius: var(--r-lg); padding: var(--s5);
  display: grid; gap: var(--s6);
}
@media (min-width: 768px) { .hero { padding: var(--s7); } }
@media (min-width: 1100px) { .hero { grid-template-columns: 1.35fr 1fr; gap: var(--s8); align-items: end; } }
.hero-label { font-size: var(--text-sm); color: var(--emerald-200); }
.hero-net { font-variant-numeric: tabular-nums; font-weight: 500;
  font-size: clamp(36px, 8.4vw, var(--text-3xl)); letter-spacing: -0.045em; line-height: 1.02; margin-top: var(--s2); color: var(--on-brand); }
.beam { margin-top: var(--s6); }
.beam-track { display: flex; height: 14px; border-radius: var(--r-full); overflow: hidden; background: color-mix(in srgb, var(--emerald-50) 12%, transparent); }
.beam-have { background: var(--emerald-300); }
.beam-goods { background: var(--emerald-500); }
.beam-owe {
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--emerald-50) 34%, transparent) 0 6px, color-mix(in srgb, var(--emerald-50) 18%, transparent) 6px 12px);
}
.beam-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); margin-top: var(--s4); }
@media (min-width: 600px) { .beam-legend { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.beam-legend .k { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--emerald-200); }
.beam-legend .k i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.beam-legend .v { font-variant-numeric: tabular-nums; font-size: var(--text-lg); color: var(--on-brand); margin-top: 2px; letter-spacing: -0.02em; }
.beam-legend .n { font-size: var(--text-xs); color: var(--emerald-200); margin-top: 2px; }
.hero .sd { color: var(--emerald-200); }

.year {
  border-top: 1px solid color-mix(in srgb, var(--emerald-50) 16%, transparent); padding-top: var(--s5);
}
@media (min-width: 1100px) { .year { border-top: 0; border-left: 1px solid color-mix(in srgb, var(--emerald-50) 16%, transparent); padding: 0 0 0 var(--s7); } }
.year-sentence { font-size: var(--text-md); line-height: 1.55; color: var(--emerald-100); max-width: 40ch; }
.year-sentence b { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--on-brand); letter-spacing: -0.02em; white-space: nowrap; }
.year-gap { display: flex; align-items: baseline; gap: var(--s3); margin-top: var(--s5); flex-wrap: wrap; }
.year-gap .v { font-variant-numeric: tabular-nums; font-size: var(--text-xl); color: var(--amber-400); letter-spacing: -0.03em; }
.year-gap .v.ok { color: var(--emerald-200); }
.year-gap .l { font-size: var(--text-sm); color: var(--emerald-200); }
.year-bars { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px var(--s3); margin-top: var(--s4); font-size: var(--text-xs); color: var(--emerald-200); }
.year-bars .val { font-variant-numeric: tabular-nums; color: var(--on-brand); text-align: right; }
.year-bars .track { height: 8px; }
.year-bars .track div { height: 8px; border-radius: var(--r-full); }
.year-bars .in { background: var(--emerald-300); }
.year-bars .out { background: color-mix(in srgb, var(--emerald-50) 70%, transparent); }

/* ── Barras de uso / avance ─────────────────────────────────────────────── */
.meter { height: 8px; border-radius: var(--r-full); background: var(--sunken); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.meter.hot > i { background: var(--warn-fill); }
.meter.over { box-shadow: inset 0 0 0 1px var(--warn); }

.cards-use { display: grid; gap: var(--s5); }
.cu-row { display: grid; gap: 8px; }
.cu-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.cu-name { font-weight: var(--weight-medium); }
.cu-pct { font-variant-numeric: tabular-nums; font-size: var(--text-sm); }
.cu-sub { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px var(--s3); font-size: var(--text-xs); color: var(--muted); }

/* ── Listas ─────────────────────────────────────────────────────────────── */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s3) 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; padding-top: 0; }
.list .when { font-size: var(--text-xs); color: var(--muted); }
.list .amt { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Gráficos ───────────────────────────────────────────────────────────── */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font: 400 11px var(--font-sans); font-variant-numeric: tabular-nums; }
.chart .b-in { fill: var(--accent); }
.chart .b-casa { fill: var(--spend); }
.chart .b-r1se { fill: var(--spend-2); }
.chart .zero { stroke: var(--line-strong); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover, .chart .hit:focus { fill: color-mix(in srgb, var(--ink) 5%, transparent); outline: none; }
.chart .hit.plain:hover, .chart .hit.plain:focus { fill: transparent; }
.chart .cur { fill: color-mix(in srgb, var(--ink) 6%, transparent); stroke: none; pointer-events: none; }
.chart .hit:focus-visible ~ .cur { stroke: var(--focus); stroke-width: 2; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: color-mix(in srgb, var(--accent) 12%, transparent); }
.chart .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.tip {
  position: absolute; z-index: 10; pointer-events: none; min-width: 170px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px -8px var(--shadow-color), 0 2px 6px var(--shadow-color);
  padding: 10px 12px; font-size: var(--text-xs); opacity: 0; transition: opacity var(--dur-fast) var(--ease-out);
}
.tip.on { opacity: 1; }
.tip h4 { margin: 0 0 6px; font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.tip .r { display: flex; justify-content: space-between; gap: 16px; padding: 1px 0; }
.tip .r span:last-child { font-variant-numeric: tabular-nums; }
.tip .r.tot { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 5px; font-weight: var(--weight-medium); }
.legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); font-size: var(--text-xs); color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw-in { background: var(--accent); } .sw-casa { background: var(--spend); } .sw-r1se { background: var(--spend-2); }
.spark { width: 88px; height: 28px; display: block; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark.flat polyline { stroke: var(--line-strong); }

/* ── Cuentas ────────────────────────────────────────────────────────────── */
.group + .group { margin-top: var(--s7); }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); padding-bottom: var(--s3); border-bottom: 1px solid var(--ink); }
.group-head .tot { font-variant-numeric: tabular-nums; font-size: var(--text-md); }
.acc { list-style: none; margin: 0; padding: 0; }
.acc a {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "n s" "m t"; gap: 2px var(--s4);
  align-items: center; padding: var(--s4) var(--s2); margin: 0 calc(var(--s2) * -1);
  border-bottom: 1px solid var(--line); text-decoration: none; border-radius: 8px;
  transition: background var(--dur-fast) var(--ease-out);
}
.acc a:hover { background: var(--surface); }
.acc .n { grid-area: n; font-weight: var(--weight-medium); display: flex; align-items: center; gap: 8px; min-width: 0; }
.acc .s { grid-area: s; text-align: right; font-variant-numeric: tabular-nums; font-size: var(--text-md); }
.acc .m { grid-area: m; font-size: var(--text-xs); color: var(--muted); }
.acc .t { grid-area: t; justify-self: end; }
@media (min-width: 768px) {
  .acc a { grid-template-columns: minmax(0, 1.6fr) 1fr 110px minmax(150px, auto); grid-template-areas: "n m t s"; padding: var(--s4) var(--s3); margin: 0 calc(var(--s3) * -1); }
}
.tag { display: inline-block; font-size: 11px; font-weight: var(--weight-medium); color: var(--ink-2); background: var(--sunken); border-radius: var(--r-full); padding: 1px 8px; white-space: nowrap; }
.tag.warn { background: var(--warn-wash); color: var(--warn); }
.tag.ok { background: var(--accent-wash); color: var(--accent-strong); }
details.unused { margin-top: var(--s2); }
details.unused summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--text-sm); color: var(--muted); padding: var(--s3) 0; min-height: var(--tap);
}
details.unused summary::-webkit-details-marker { display: none; }
details.unused summary::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform var(--dur-fast) var(--ease-out); }
details.unused[open] summary::before { transform: rotate(45deg); }
details.unused summary:hover { color: var(--ink); }

/* ── Detalle de cuenta ──────────────────────────────────────────────────── */
.acct-head { display: grid; gap: var(--s2); margin-bottom: var(--s6); }
.acct-bal { font-variant-numeric: tabular-nums; font-size: clamp(32px, 7vw, var(--text-2xl)); letter-spacing: -0.04em; line-height: 1.05; }
.facts { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); font-size: var(--text-sm); color: var(--ink-2); }
.search { position: relative; }
.search input {
  width: 100%; height: 44px; padding: 0 14px 0 40px; border-radius: var(--r-md);
  border: 1px solid var(--control-border); background: var(--surface);
}
.search input::-webkit-search-cancel-button {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px; cursor: pointer;
  background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 4l8 8M12 4l-8 8' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / 16px no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 4l8 8M12 4l-8 8' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.search input::-webkit-search-cancel-button:hover { background: var(--ink); }
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.mov { width: 100%; border-collapse: collapse; margin-top: var(--s4); font-size: var(--text-sm); }
.mov th { text-align: left; font-weight: var(--weight-medium); color: var(--muted); font-size: var(--text-xs); padding: 0 var(--s2) var(--s2); border-bottom: 1px solid var(--line); }
.mov td { padding: var(--s3) var(--s2); border-bottom: 1px solid var(--line); vertical-align: top; }
.mov .fecha { white-space: nowrap; }
.mov .r { text-align: right; white-space: nowrap; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.mov .who { font-weight: var(--weight-medium); }
.mov .cat { color: var(--muted); font-size: var(--text-xs); }
.mov .in { color: var(--accent-strong); }
.mov .hide-sm { display: none; }
@media (min-width: 768px) { .mov .hide-sm { display: table-cell; } .mov .only-sm { display: none; } }
.more { margin-top: var(--s4); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap);
  padding: 0 18px; border-radius: var(--r-md); border: 1px solid var(--control-border); background: var(--surface);
  font-weight: var(--weight-medium); cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--sunken); }
.btn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.btn.primary:hover { background: var(--emerald-800); }
html[data-theme="dark"] .btn.primary:hover { background: var(--emerald-300); }
.empty { padding: var(--s6) 0; color: var(--muted); text-align: center; }

/* ── Créditos ───────────────────────────────────────────────────────────── */
.debt-sum { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4) var(--s5); }
@media (min-width: 900px) { .debt-sum { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }
.debt-sum .l { font-size: var(--text-sm); color: var(--muted); }
.debt-sum .v { font-variant-numeric: tabular-nums; font-size: var(--text-lg); letter-spacing: -0.02em; margin-top: 2px; }
.debt-sum .big .v { font-size: var(--text-xl); }
@media (max-width: 599px) { .debt-sum .v { font-size: var(--text-md); } .debt-sum .big .v { font-size: var(--text-lg); } }
.debt { display: grid; gap: var(--s4); padding: var(--s5) 0; border-top: 1px solid var(--line); }
.debt:first-child { border-top: 0; padding-top: 0; }
.debt-top { display: flex; justify-content: space-between; align-items: start; gap: var(--s4); }
.debt-name { margin: 0; font-weight: var(--weight-semibold); font-size: var(--text-md); line-height: 1.25; }
.sub-h + .debt { border-top: 0; padding-top: var(--s2); }
.debt-bal .l { display: inline-flex; align-items: center; justify-content: flex-end; gap: 2px; }
.debt-kind { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.debt-bal { text-align: right; }
.debt-bal .v { font-variant-numeric: tabular-nums; font-size: var(--text-lg); letter-spacing: -0.02em; }
.debt-bal .l { font-size: var(--text-xs); color: var(--muted); }
.debt-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3) var(--s5); }
@media (min-width: 768px) { .debt-facts { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.debt-facts dt { font-size: var(--text-xs); color: var(--muted); }
.debt-facts dd { margin: 2px 0 0; font-variant-numeric: tabular-nums; font-size: var(--text-sm); }
.progress-row { display: grid; grid-template-columns: 1fr auto; gap: var(--s3); align-items: center; }
.progress-row .p { font-variant-numeric: tabular-nums; font-size: var(--text-xs); color: var(--ink-2); min-width: 7ch; text-align: right; }
.note { font-size: var(--text-xs); color: var(--muted); }
.chips {
  position: sticky; top: 60px; z-index: 15; display: flex; gap: var(--s2); overflow-x: auto; padding: var(--s2) 0;
  margin: calc(var(--s2) * -1) 0 0; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); scrollbar-width: none;
}
.chips a {
  flex: none; display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: var(--r-full);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); text-decoration: none;
  font-size: var(--text-sm); font-weight: var(--weight-medium); white-space: nowrap;
}
.chips a:hover { border-color: var(--control-border); color: var(--ink); }
[id] { scroll-margin-top: 120px; }
.sub-h { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink-2); text-transform: none; margin: var(--s5) 0 var(--s2); }
.sub-h:first-child { margin-top: 0; }
.pers { list-style: none; margin: 0; padding: 0; }
.pers li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--s4); padding: var(--s3) 0; border-top: 1px solid var(--line); }
.pers li:first-child { border-top: 0; }
.pers .n { font-weight: var(--weight-medium); }
.pers .v { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.pers .note { grid-column: 1 / -1; }
.fold > summary {
  cursor: pointer; list-style: none; display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3);
  min-height: var(--tap); flex-wrap: wrap;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary h2 { display: inline-flex; align-items: center; gap: 10px; }
.fold > summary h2::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform var(--dur-fast) var(--ease-out); }
.fold[open] > summary h2::before { transform: rotate(45deg); }
.fold[open] > summary { margin-bottom: var(--s4); }
.fold .tot { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: var(--text-sm); }
.cards-off { margin-top: var(--s4); }
.cards-grid { display: grid; gap: var(--s5); }
@media (min-width: 768px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .cards-grid { grid-template-columns: repeat(3, 1fr); } }
.ccard { border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5); display: grid; gap: var(--s4); background: var(--surface); }
.ccard .top-r { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.ccard .bal { font-variant-numeric: tabular-nums; font-size: var(--text-xl); letter-spacing: -0.03em; }
.ccard dl { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin: 0; }
.ccard dt { font-size: var(--text-xs); color: var(--muted); }
.ccard dd { margin: 2px 0 0; font-variant-numeric: tabular-nums; font-size: var(--text-sm); }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.tbl th { text-align: left; font-weight: var(--weight-medium); color: var(--muted); font-size: var(--text-xs); padding: 0 var(--s3) var(--s2) 0; border-bottom: 1px solid var(--line); }
.tbl td { padding: var(--s3) var(--s3) var(--s3) 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl .r { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl th.r { font-family: var(--font-sans); }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl .hide-sm { display: none; }
@media (min-width: 768px) { .tbl .hide-sm { display: table-cell; } }

/* ── Flujo ──────────────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s4) var(--s5); }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpis .l { font-size: var(--text-sm); color: var(--muted); }
.kpis .v { font-variant-numeric: tabular-nums; font-size: var(--text-lg); margin-top: 2px; letter-spacing: -0.02em; }
.seg { display: inline-flex; flex: none; white-space: nowrap; padding: 3px; border-radius: var(--r-full); background: var(--sunken); gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: var(--r-full); font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--ink-2); cursor: pointer; min-height: 32px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px var(--shadow-color); }
.rubros { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s4); }
.rubros li { display: grid; grid-template-columns: 1fr auto; gap: 6px var(--s4); }
.rubros .bar { grid-column: 1 / -1; height: 6px; border-radius: var(--r-full); background: var(--sunken); overflow: hidden; }
.rubros .bar i { display: block; height: 100%; background: var(--spend); border-radius: inherit; }
.rubros.r1se .bar i { background: var(--spend-2); }
.rubros .amt { font-variant-numeric: tabular-nums; }
.rubros .sub { grid-column: 1 / -1; font-size: var(--text-xs); color: var(--muted); margin-top: -2px; }

/* ── Login ──────────────────────────────────────────────────────────────── */
.login { min-height: 100vh; min-height: 100dvh; display: grid; }
@media (min-width: 900px) { .login { grid-template-columns: minmax(420px, 1.05fr) 1fr; } }
.brand {
  display: none; position: relative; overflow: hidden; color: var(--emerald-50);
  background: linear-gradient(160deg, var(--brand-from) 0%, var(--emerald-800) 58%, var(--brand-to) 100%);
  padding: var(--s8) var(--s8) var(--s7);
}
@media (min-width: 900px) { .brand { display: flex; flex-direction: column; justify-content: space-between; } }
.brand .wordmark { color: var(--on-brand); font-size: var(--text-md); }
.brand .wordmark .p { color: var(--emerald-200); }
.brand-line { font-size: clamp(28px, 2.6vw, 38px); line-height: 1.18; letter-spacing: -0.03em; font-weight: 500; max-width: 19ch; color: var(--on-brand); }
.brand-line span { display: block; color: var(--emerald-200); }
.brand svg.trace { position: absolute; left: 0; right: 0; bottom: 18%; width: 100%; height: 38%; opacity: .9; }
.brand-foot { position: relative; font-size: var(--text-xs); color: var(--emerald-200); }
.form-side { display: grid; place-items: center; padding: var(--s7) var(--s5); }
.form-box { width: 100%; max-width: 380px; }
.form-box .mob-brand { display: flex; margin-bottom: var(--s8); }
@media (min-width: 900px) { .form-box .mob-brand { display: none; } }
.form-box h1 { font-size: var(--text-xl); letter-spacing: -0.025em; }
.form-box .lead { color: var(--ink-2); margin-top: var(--s2); }
.field { display: grid; gap: 6px; margin-top: var(--s5); }
.field label { font-size: var(--text-sm); font-weight: var(--weight-medium); }
.input { position: relative; }
.input input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: var(--r-md);
  border: 1px solid var(--control-border); background: var(--surface); font-size: 16px;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.input input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.input input[aria-invalid="true"] { border-color: var(--danger); }
.input .peek {
  position: absolute; right: 4px; top: 4px; height: 40px; padding: 0 12px; border: 0; background: none;
  color: var(--ink-2); font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer; border-radius: 8px;
}
.input .peek:hover { background: var(--sunken); }
.input input.has-peek { padding-right: 84px; }
.check { display: flex; align-items: center; gap: 10px; margin-top: var(--s4); font-size: var(--text-sm); color: var(--ink-2); cursor: pointer; min-height: var(--tap); }
.check input { width: 18px; height: 18px; accent-color: var(--accent-strong); margin: 0; }
.form-box .btn.primary { width: 100%; height: 48px; margin-top: var(--s4); font-size: var(--text-base); }
.alert { margin-top: var(--s5); padding: 12px 14px; border-radius: var(--r-md); font-size: var(--text-sm); line-height: 1.45; }
.alert.err { background: var(--danger-wash); color: var(--danger); }
.alert.lock { background: var(--warn-wash); color: var(--warn); }
.alert.setup { background: var(--sunken); color: var(--ink-2); }
.alert code { font-family: var(--font-mono); font-size: 12px; word-break: break-all; }

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