:root {
  --bg: #efece4;
  --paper: #fffcf6;
  --ink: #1a1917;
  --muted: #6b6459;
  --line: #e4ddd0;
  --chip: #ece6d9;
  --accent: #c45c26;
  --good: #1f6b4a;
  --bad: #b42318;
  --warn: #b45309;
  --info: #1d4e89;
  --shield: #0f766e;
  --white: #fff;
  --tint-good: #e8f3ec;
  --tint-bad: #f8eaea;
  --tint-warn: #f7f0de;
  --tint-info: #eaf1f7;
  --tint-shield: #e6f4f2;
  --edge-good: #cde5d6;
  --edge-bad: #ead0d0;
  --edge-warn: #eadfbe;
  --edge-info: #d0deeb;
  --shadow: 0 1px 0 rgba(26, 25, 23, 0.06);
  --shadow-md: 0 8px 24px rgba(26, 25, 23, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --tab: 78px;
  --side: 228px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 22px;
  --space-6: 32px;
  --ease: 180ms ease;
  --touch: 44px;
  --font: "Segoe UI", system-ui, sans-serif;
  --focus: 0 0 0 3px rgba(196, 92, 38, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}
h1 { font-size: 1.55rem; margin: 0; font-weight: 750; letter-spacing: -0.03em; }
h2 { font-size: 1.05rem; margin: 0 0 10px; font-weight: 700; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
code { font-size: 0.9em; }
.num, .monto, .kpi .num { font-variant-numeric: tabular-nums; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0 0 4px;
  font-weight: 700;
}
.lead { color: var(--muted); margin-top: 10px; }
.hint { color: var(--muted); font-size: 0.88rem; margin-top: 10px; }
.ciclo-nota {
  margin: 4px 0 14px;
  padding: 10px 12px;
  background: var(--paper, #f4f0ea);
  border-radius: 10px;
  line-height: 1.4;
}
.sub { color: var(--muted); font-size: 0.82rem; }
.error, .hint.error { color: var(--bad); }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ——— Auth ——— */
.auth-body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 400px at 20% -10%, rgba(196, 92, 38, 0.08), transparent 50%),
    var(--bg);
}
.auth-login {
  display: block;
  padding: 0;
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(196, 92, 38, 0.16), transparent 52%),
    radial-gradient(700px 380px at 110% 110%, rgba(15, 118, 110, 0.08), transparent 46%),
    var(--bg);
}
.auth-shell {
  min-height: 100dvh;
  display: grid;
  align-items: stretch;
}
.auth-visual {
  display: grid;
  place-items: center;
  padding: 28px 20px 8px;
}
.auth-cuaderno {
  width: min(420px, 100%);
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px 26px 22px 22px;
  padding: 28px 26px 22px 44px;
  box-shadow: var(--shadow-md);
  transform: rotate(-1.2deg);
}
.auth-cuaderno::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 22px;
  bottom: 22px;
  width: 10px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 12px, #d7cfc2 3px, transparent 4px),
    radial-gradient(circle at 50% 36px, #d7cfc2 3px, transparent 4px),
    radial-gradient(circle at 50% 60px, #d7cfc2 3px, transparent 4px),
    linear-gradient(90deg, #e8dfd0, #f3eadc);
}
.auth-cuaderno::after {
  content: "";
  position: absolute;
  top: -2px;
  right: 36px;
  width: 18px;
  height: 52px;
  background: var(--accent);
  border-radius: 0 0 4px 4px;
  opacity: 0.9;
}
.auth-marca {
  font-size: 1.8rem;
  display: block;
  margin-bottom: 10px;
}
.auth-cuaderno h2 {
  font-size: 1.7rem;
  letter-spacing: -0.04em;
  line-height: 1.15;
  margin: 0 0 18px;
}
.auth-promesas {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.auth-promesas li {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.auth-ico {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--paper);
  border-radius: 12px;
  font-size: 1.2rem;
}
.auth-promesas strong { display: block; font-size: 0.95rem; }
.auth-promesas p { color: var(--muted); font-size: 0.84rem; margin-top: 2px; }
.auth-lugar {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.auth-card {
  width: min(440px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.auth-login .auth-card {
  width: min(460px, 100%);
  margin: 28px auto;
  padding: 36px 28px 28px;
}
.auth-login .auth-card h1 {
  font-size: 2.1rem;
  margin-top: 4px;
}
.auth-pass {
  position: relative;
}
.auth-pass input { padding-right: 84px; }
.auth-ojo {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.82rem;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 8px;
}
.auth-ojo:hover { color: var(--ink); background: var(--chip); }
.auth-ojo:active { transform: translateY(-50%); }
.auth-pie {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.82rem;
}
.auth-login #login-error {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--tint-bad);
  border-radius: 10px;
}
@media (max-width: 899px) {
  .auth-cuaderno {
    transform: none;
    padding: 20px 18px 16px 36px;
  }
  .auth-cuaderno h2 { font-size: 1.35rem; margin-bottom: 12px; }
  .auth-promesas {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
  }
  .auth-promesas li {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    padding: 8px 6px;
  }
  .auth-ico { width: 36px; height: 36px; }
  .auth-promesas p, .auth-lugar { display: none; }
  .auth-login .auth-card { margin-top: 8px; }
}
@media (min-width: 900px) {
  .auth-login .auth-shell {
    grid-template-columns: 1.15fr 0.85fr;
  }
  .auth-visual { padding: 40px 32px; }
  .auth-login .auth-card {
    margin: 0;
    min-height: 100dvh;
    width: 100%;
    max-width: none;
    border: 0;
    border-radius: 0;
    border-left: 1px solid var(--line);
    box-shadow: none;
    display: grid;
    align-content: center;
    justify-items: stretch;
    padding: 48px 56px;
  }
  .auth-login .auth-card > * { max-width: 400px; width: 100%; }
}
.auth-card label, .form-grid label {
  display: block;
  font-size: 0.85rem;
  margin: 14px 0 6px;
  font-weight: 600;
}
.auth-card input, .auth-card select, .form-grid input, .form-grid select, .form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  min-height: var(--touch);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.auth-card input:focus, .auth-card select:focus, .form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  border-color: var(--accent);
}
.input-error { border-color: var(--bad) !important; }
.check { display: flex !important; align-items: center; gap: 8px; font-weight: 500 !important; }
.check input { width: auto !important; min-height: 0; }

/* ——— Buttons ——— */
.btn, .login button {
  width: 100%;
  margin-top: 16px;
  background: var(--ink);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  min-height: var(--touch);
  font-weight: 650;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform var(--ease), background var(--ease), opacity var(--ease);
}
.btn:hover { background: #2a2825; }
.btn:active { transform: scale(0.98); }
.btn.sec {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.sec:hover { background: var(--chip); }
.btn.small { width: auto; margin: 0; padding: 8px 12px; min-height: 36px; font-size: 0.88rem; }
.btn.warn { background: var(--accent); }
.btn.warn:hover { background: #a84d1f; }
.btn.danger { background: var(--bad); }
.btn.danger:hover { background: #931d14; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.ghost {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  min-width: var(--touch);
  min-height: var(--touch);
  padding: 8px 12px;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--ease);
}
.ghost:hover { background: var(--chip); }
.toggle {
  border: 1px solid var(--line);
  background: var(--chip);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  min-height: 32px;
  font-size: 0.78rem;
  transition: background var(--ease);
}
.toggle:hover { background: var(--line); }

.atajos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.atajos .btn { margin: 0; }
.fab-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; }
.fab-row .btn { width: auto; margin: 0; flex: 1 1 auto; min-width: 140px; }

/* ——— Shell ——— */
.app-body { display: flex; min-height: 100dvh; }
.sidebar {
  display: none;
  width: var(--side);
  background: var(--paper);
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow: auto;
}
.brand { margin-bottom: 22px; padding: 0 6px; }
.brand strong { font-size: 1.15rem; letter-spacing: -0.03em; }
.side-nav { display: grid; gap: 2px; }
.side-nav a, .side-nav button {
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--ease), color var(--ease);
}
.side-nav .ico, .tabs .ico, .sheet-card .ico { font-size: 1.05rem; width: 1.4em; text-align: center; }
.side-nav a.on, .side-nav a:hover, .side-nav button:hover { background: var(--chip); color: var(--ink); }
.side-nav a.on { box-shadow: inset 3px 0 0 var(--accent); }

.app-main {
  flex: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--tab) + 22px);
  width: 100%;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.top-actions { display: flex; gap: 8px; align-items: center; }
.estado-dot {
  width: 10px; height: 10px;
  border-radius: 99px;
  background: var(--muted);
  display: inline-block;
}
.estado-dot.verde { background: var(--good); }
.estado-dot.amarillo { background: var(--warn); }
.estado-dot.rojo { background: var(--bad); }

.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--paper);
  border-top: 1px solid var(--line);
  height: calc(var(--tab) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
}
.tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
  font-size: 0.72rem;
  display: grid;
  place-items: center;
  gap: 2px;
  line-height: 1.15;
  transition: color var(--ease);
}
.tabs button.on { color: var(--accent); }

/* ——— Cards ——— */
.card, .hero, .card-primary, .card-success, .card-warning, .card-danger, .card-info, .card-protection {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card-success { background: var(--tint-good); border-color: var(--edge-good); }
.card-warning { background: var(--tint-warn); border-color: var(--edge-warn); }
.card-danger { background: var(--tint-bad); border-color: var(--edge-bad); }
.card-info { background: var(--tint-info); border-color: var(--edge-info); }
.card-protection { background: var(--tint-shield); border-color: #c5e4df; }
.card-primary { border-color: #edd4c4; }

.kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.kpi .label { color: var(--muted); font-size: 0.78rem; }
.kpi .num {
  font-size: 1.28rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  margin-top: 4px;
}
.kpi.good .num, .hoy-libre.good .num { color: var(--good); }
.kpi.bad .num, .hoy-libre.bad .num { color: var(--bad); }
.kpi.warn .num { color: var(--warn); }
.kpi.full { grid-column: 1 / -1; }

.hoy-libre { margin-bottom: 12px; }
.hoy-libre .num { font-size: 2.15rem; letter-spacing: -0.04em; line-height: 1.1; }
.hoy-libre .split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.hoy-libre .split .label { font-size: 0.72rem; color: var(--muted); }
.hoy-libre .split .val { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.92rem; }

.cubre-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}
.cubre-grid .val {
  font-weight: 750;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  margin-top: 2px;
}
.cubre-vs { margin: 16px 0 8px; }
.cubre-cmp { display: grid; gap: 8px; }
.cubre-row {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted);
}
.cubre-row strong {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  min-width: 7.5rem;
  text-align: right;
}
.cubre-track {
  height: 12px;
  background: var(--chip);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.cubre-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--good);
  max-width: 100%;
}
.cubre-row.sale .cubre-track i { background: var(--accent); }
.cubre-row.sale.over .cubre-track i { background: var(--bad); }

.strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 8px;
  margin-bottom: 12px;
  text-align: center;
  box-shadow: var(--shadow);
}
.strip .label { color: var(--muted); font-size: 0.72rem; }
.strip .num { font-weight: 750; font-size: 0.92rem; margin-top: 2px; }
.strip .num.ok { color: var(--good); }
.strip .num.bad { color: var(--bad); }

/* ——— Status ——— */
.semaforo, .alerta {
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.semaforo { font-weight: 650; }
.semaforo .titulo { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; }
.semaforo .sub { margin-top: 4px; font-weight: 500; }
.semaforo.rojo, .alerta.critica, .alerta.roja { background: var(--tint-bad); border-color: var(--edge-bad); color: var(--bad); }
.semaforo.amarillo, .alerta.atencion, .alerta.amarilla, .alerta.advertencia { background: var(--tint-warn); border-color: var(--edge-warn); color: var(--warn); }
.semaforo.verde, .alerta.logro { background: var(--tint-good); border-color: var(--edge-good); color: var(--good); }
.alerta.recomendacion { background: var(--tint-info); border-color: var(--edge-info); color: var(--info); }
.alerta p + p, .semaforo.rojo .sub, .semaforo.amarillo .sub, .semaforo.verde .sub { margin-top: 4px; color: var(--muted); font-size: 0.9rem; font-weight: 500; }

.barra, .progress-lg {
  height: 10px;
  background: var(--chip);
  border-radius: var(--radius-pill);
  overflow: hidden;
  display: flex;
  margin: 8px 0 12px;
}
.progress-lg { height: 14px; margin: 10px 0; }
.barra > span, .barra i, .progress-lg > span {
  display: block;
  height: 100%;
  background: var(--shield);
  border-radius: inherit;
  transition: width 220ms ease;
}

.fila, .list-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  width: 100%;
  text-align: left;
  background: transparent;
  border-left: 0; border-right: 0; border-top: 0;
  appearance: none;
}
.fila { grid-template-columns: 1fr auto; }
.fila:last-child, .list-item:last-child { border-bottom: 0; }
.pct {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}
.peso-nums { text-align: right; }
.peso-nums .monto { font-weight: 700; }
.peso-bar {
  height: 7px;
  background: var(--chip);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-top: 6px;
}
.peso-bar > i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  max-width: 100%;
}
.list-ico {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--chip);
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}
.list-item .monto { text-align: right; }
.list-item .meta { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.monto { font-weight: 700; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.link-edit {
  display: inline;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  font: inherit;
  font-weight: 700;
  color: inherit;
  text-align: left;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  min-height: 0;
}
.apagado { opacity: 0.45; }
.chev { color: var(--muted); font-size: 1.25rem; line-height: 1; }
.bloque-titulo { margin-bottom: 2px; }
.grupo-titulo {
  margin: 16px 0 6px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.accion-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 0;
  appearance: none;
  min-height: var(--touch);
}
.accion-row:last-of-type { border-bottom: 0; }
.accion-row .dot {
  width: 10px; height: 10px;
  border-radius: 99px;
  background: var(--warn);
}
.accion-row .dot.rojo { background: var(--bad); }
.accion-row .dot.amarillo { background: var(--warn); }
.accion-row .dot.verde { background: var(--good); }
.cta-mini { font-size: 0.75rem; color: var(--accent); font-weight: 650; }

.etapas { display: grid; gap: 8px; }
.etapa {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--chip);
  font-size: 0.88rem;
}
.etapa.ok { background: var(--tint-good); }
.etapa.now { background: var(--tint-shield); border: 1px solid #c5e4df; }
.etapa .mark { font-weight: 700; width: 1.4em; }

.bolsillos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.bolsillo {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  min-height: 108px;
  box-shadow: var(--shadow);
}
.bolsillo .num { font-weight: 750; margin-top: 6px; font-size: 1.05rem; }
.bolsillo.tipo-emergencia { background: var(--tint-shield); border-color: #c5e4df; }

.form-grid { display: grid; gap: 4px; }
.fuente {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.help {
  display: inline-flex;
  width: 20px; height: 20px;
  border-radius: 99px;
  border: 1px solid var(--line);
  align-items: center; justify-content: center;
  font-size: 0.75rem;
  margin-left: 6px;
  background: #fff;
  vertical-align: middle;
}

.sheet {
  position: fixed;
  inset: 0;
  background: rgba(26, 25, 23, 0.35);
  z-index: 30;
  display: none;
  align-items: end;
  animation: fade 180ms ease;
}
.sheet:not([hidden]) { display: grid; }
.sheet[hidden] { display: none !important; }
.sheet-card {
  background: var(--paper);
  border-radius: 20px 20px 0 0;
  padding: 8px 12px calc(16px + env(safe-area-inset-bottom));
  display: grid;
}
.sheet-handle {
  width: 40px; height: 4px;
  background: var(--line);
  border-radius: 99px;
  margin: 8px auto 6px;
}
.sheet-card button {
  background: transparent;
  border: 0;
  text-align: left;
  padding: 14px 12px;
  min-height: var(--touch);
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sheet-card button:last-child { border-bottom: 0; color: var(--muted); }
.sheet-card a.sheet-link {
  background: transparent;
  text-align: left;
  padding: 14px 12px;
  min-height: var(--touch);
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  font-size: 0.75rem;
  text-align: center;
}
.cal-dow { color: var(--muted); font-weight: 700; padding: 6px 0; }
.cal-day {
  min-height: 46px;
  border-radius: 10px;
  background: var(--chip);
  padding: 4px 2px;
  border: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.cal-day.has { background: var(--tint-good); font-weight: 700; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-dots { display: flex; gap: 2px; }
.cal-dots i { width: 5px; height: 5px; border-radius: 99px; display: block; background: var(--muted); }
.cal-dots i.ingreso { background: var(--good); }
.cal-dots i.deuda { background: var(--bad); }
.cal-dots i.obligacion { background: var(--warn); }
.cal-dots i.meta { background: var(--info); }
.cal-dots i.gasto { background: var(--accent); }
.cal-day.otro-mes { opacity: 0.72; }

.chip {
  display: inline-block;
  background: var(--chip);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  font-size: 0.75rem;
  margin: 2px;
}
.chip.ingreso, .chip.ok { background: var(--tint-good); }
.chip.deuda, .chip.tarjeta { background: var(--tint-bad); color: #a33b3b; }
.chip.obligacion { background: var(--tint-warn); }
.chip.meta { background: var(--tint-info); }
.chip.gasto { background: var(--tint-warn); }
.chip.pendiente { background: var(--tint-warn); }
.chip.pagado { background: var(--tint-good); }

.dlg {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  max-width: 420px;
  width: min(420px, 94vw);
  background: var(--paper);
  box-shadow: var(--shadow-md);
}
.dlg-wide { max-width: 480px; width: min(480px, 94vw); }
.dlg-actions { justify-content: flex-end; margin-top: 16px; }
.dlg-actions .btn { width: auto; margin: 0; min-width: 110px; }
.dlg::backdrop { background: rgba(26, 25, 23, 0.4); }
.plantilla { font-size: 0.75rem; color: var(--muted); }
.plantilla.distinto { text-decoration: line-through; }

.mini-fondo {
  width: 100%;
  text-align: left;
  background: var(--tint-shield);
  border: 1px solid #c5e4df;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  appearance: none;
}
.mini-fondo .progress-lg { margin: 8px 0 0; height: 8px; }
.mini-deuda {
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  appearance: none;
}
.mini-deuda .num { font-size: 1.15rem; font-weight: 750; color: var(--bad); }
.mini-deuda .deuda-mini-filas { margin-top: 8px; }
.mini-deuda .deuda-mini-filas p { display: flex; justify-content: space-between; gap: 8px; font-size: 0.86rem; margin: 4px 0 0; }
.deuda-card .deuda-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 10px 0;
}
.deuda-card .deuda-kpis p { margin: 0; }
.deuda-card .deuda-kpis .label { font-size: 0.72rem; color: var(--muted); }
.deuda-card .estado-cuota { margin: 8px 0; }
.tabla-pre { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.tabla-pre th, .tabla-pre td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.tabla-pre th { color: var(--muted); font-weight: 700; font-size: 0.75rem; }
.tabla-pre td.num, .tabla-pre th.num { text-align: right; }
.tabla-pre tr.pasado td { color: var(--bad); }
.tabla-pre tr.bien td:last-child { color: var(--good); }
.chip.deuda { background: var(--tint-bad); color: var(--bad); }
.chip.parcial { background: var(--tint-warn); color: var(--warn); }
.link-more { text-align: center; margin: 4px 0 8px; }
.link-more button {
  background: none;
  border: 0;
  color: var(--accent);
  font-weight: 650;
  padding: 8px;
  min-height: var(--touch);
}

.mes-switch {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 4px 0 20px;
}
.mes-switch select {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 4px;
  min-height: 36px;
}

.empty {
  text-align: center;
  padding: 28px 16px;
}
.empty .ico { font-size: 1.8rem; display: block; margin-bottom: 8px; }
.empty .btn { width: auto; margin: 16px auto 0; min-width: 180px; }

.skeleton {
  background: linear-gradient(90deg, var(--chip) 25%, #f4efe4 50%, var(--chip) 75%);
  background-size: 200% 100%;
  animation: shine 1.1s infinite;
  border-radius: 10px;
  height: 14px;
  margin: 10px 0;
}
.skeleton.h { height: 72px; border-radius: var(--radius); }
@keyframes shine {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab) + 16px);
  transform: translateX(-50%);
  z-index: 50;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100% - 24px));
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: #fff;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow-md);
  animation: fade 180ms ease;
}
.toast.out { opacity: 0; transition: opacity 180ms ease; }
.toast.ok { background: var(--good); }
.toast.bad { background: var(--bad); }

.total-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 4px 4px;
  font-weight: 750;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}

@media (min-width: 900px) {
  .sidebar { display: block; }
  .tabs { display: none; }
  .app-main { padding-bottom: 32px; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .bolsillos { grid-template-columns: repeat(3, 1fr); }
  .toasts { bottom: 24px; }
  .fab-row .btn { flex: 0 0 auto; }
}
@media (max-width: 380px) {
  .hoy-libre .num { font-size: 1.75rem; }
  .atajos { grid-template-columns: 1fr; }
}

.ghost.malo { color: var(--bad); border-color: var(--edge-bad); }
.ghost.malo:hover { background: var(--tint-bad); }
.admin-fila-link { text-decoration: none; }
.admin-fila-link strong { font-weight: 750; }

.onb-card-page { width: min(520px, 100%); }

/* ——— Onboarding: un paso, una pregunta, se elige ——— */
.onb-body {
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(196, 92, 38, 0.14), transparent 52%),
    radial-gradient(700px 380px at 110% 110%, rgba(15, 118, 110, 0.07), transparent 46%),
    var(--bg);
}
.onb-wrap {
  width: min(520px, 100%);
  max-width: 100%;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.onb-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.onb-head .eyebrow { margin: 0 0 8px; }
.onb-dots {
  display: flex;
  gap: 6px;
}
.onb-dots span {
  width: 22px;
  height: 6px;
  border-radius: 999px;
  background: var(--chip);
}
.onb-dots span.on { background: #e2c4b0; }
.onb-dots span.ahora { background: var(--accent); width: 28px; }
.onb-hola {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 650;
  margin: 0 0 4px;
}
.onb-form { flex: 1; display: flex; flex-direction: column; }
.onb-step[hidden] { display: none !important; }
.onb-step h1 {
  font-size: 1.7rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 8px;
}
.onb-step .lead {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.95rem;
}
.onb-opts {
  display: grid;
  gap: 8px;
}
.onb-opts.stack { grid-template-columns: 1fr; }
.onb-opts.stack .onb-opt > span {
  grid-template-columns: 44px 1fr;
}
.onb-opts.stack .onb-opt small { grid-column: 2; }
.onb-opts.cities { grid-template-columns: 1fr 1fr; }
.onb-opts.dias { grid-template-columns: 1fr; }
.onb-opts.dias .onb-opt > span {
  grid-template-columns: 1fr;
  justify-items: start;
}
.onb-opts.dias .onb-opt small,
.onb-opts.dias .onb-opt em.chip { grid-column: 1; }
.onb-opts.montos { grid-template-columns: 1fr 1fr; }
.onb-opt {
  margin: 0;
  cursor: pointer;
  position: relative;
}
.onb-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.onb-opt > span {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 4px 12px;
  align-items: center;
  min-height: var(--touch);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.onb-opt.chip > span {
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.onb-opt .onb-ico {
  grid-row: span 2;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--bg);
  border-radius: 12px;
  font-style: normal;
  font-size: 1.2rem;
}
.onb-opt strong {
  font-size: 1rem;
  font-weight: 750;
}
.onb-opt small {
  color: var(--muted);
  font-size: 0.82rem;
}
.onb-opt em.chip {
  grid-column: 2;
  justify-self: start;
  font-style: normal;
  margin-top: 4px;
  background: #f8efe8;
  color: var(--accent);
  border: 0;
}
.onb-opt.sugerido > span { border-color: #e8d0c0; }
.onb-opt input:checked + span {
  border-color: var(--accent);
  background: #f8efe8;
  box-shadow: var(--focus);
}
.onb-opt input:focus-visible + span { box-shadow: var(--focus); }
.onb-otra {
  margin-top: 12px;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.onb-otra label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 6px;
}
.onb-otra select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  min-height: var(--touch);
}
.onb-recap {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.onb-recap ul { list-style: none; margin: 8px 0 0; padding: 0; }
.onb-recap li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.onb-recap li:last-child { border-bottom: 0; }
.onb-recap span { color: var(--muted); }
.onb-recap strong { font-weight: 750; text-align: right; }
.onb-rango {
  margin-top: 4px;
  padding: 18px 16px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.onb-rango-vivo {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.onb-rango-num {
  margin: 0;
  min-width: 0;
  text-align: center;
  font-size: clamp(1.15rem, 5.2vw, 2.05rem);
  font-weight: 750;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.onb-stepper {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  margin: 0;
  flex: none;
  border: 1px solid var(--line);
  background: var(--chip);
  border-radius: 12px;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  position: relative;
  z-index: 2;
  touch-action: manipulation;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.onb-stepper:hover { background: var(--paper); box-shadow: var(--focus); }
.onb-stepper:active { transform: scale(0.96); }
.onb-rango input[type="range"] {
  display: block;
  width: 100%;
  height: 36px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.onb-rango-extremos {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}
#caja-dia-otro { margin-top: 12px; }
.onb-nav {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  margin-top: 18px;
  padding: 10px;
  box-sizing: border-box;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 5;
}
.onb-nav .btn {
  width: auto;
  margin-top: 0;
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
}
.onb-nav .btn.sec {
  flex: 0 1 auto;
  padding-left: 16px;
  padding-right: 16px;
}
.onb-nav [hidden] { display: none !important; }
.onb-body #onb-error {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--tint-bad);
  border-radius: 10px;
}
@media (min-width: 900px) {
  .onb-wrap { padding: 36px 24px 24px; }
  .onb-step h1 { font-size: 2rem; }
}
.onb-label {
  display: block;
  font-size: 0.85rem;
  margin: 14px 0 6px;
  font-weight: 600;
}
.onb-choices {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.onb-choices label {
  margin: 0;
  cursor: pointer;
  position: relative;
}
.onb-choices input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.onb-choices span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 0.88rem;
  font-weight: 650;
  text-align: center;
}
.onb-choices input:checked + span {
  border-color: var(--accent);
  background: #f8efe8;
  box-shadow: var(--focus);
}
.onb-choices input:focus-visible + span { box-shadow: var(--focus); }

.onb-grid { display: grid; gap: 12px; margin-top: 18px; }
.onb-card { text-align: left; cursor: pointer; }
.onb-card h2 { margin-bottom: 6px; }
.admin-body .vista { padding-bottom: 40px; }
.admin-body .app-main { padding-bottom: 32px; }
.admin-topnav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}
.admin-topnav a, .admin-topnav button {
  text-decoration: none;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  font-weight: 650;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.admin-topnav a.on { color: var(--ink); background: var(--chip); }
.admin-crear {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}
.admin-crear-acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.admin-crear-acciones .btn { width: auto; margin: 0; }
.admin-lista { display: grid; gap: 10px; margin-top: 12px; }
.admin-persona {
  display: grid;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.admin-persona:last-child { border-bottom: 0; padding-bottom: 0; }
.admin-persona.apagada { opacity: 0.72; }
.admin-nombre {
  font-weight: 750;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.admin-persona-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.admin-persona-acciones .ghost { min-height: 40px; padding: 8px 14px; font-size: 0.88rem; font-weight: 650; }
.dlg-actions { display: flex; gap: 8px; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.admin-table th, .admin-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table th { color: var(--muted); font-weight: 700; }
@media (min-width: 900px) {
  .admin-topnav { display: none; }
  .admin-crear { grid-template-columns: 1fr 1fr; }
  .admin-crear-acciones { grid-column: 1 / -1; }
  .admin-persona { grid-template-columns: 1fr auto; align-items: start; }
}
