:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #17202c;
  --muted: #677487;
  --line: #e3e8ef;
  --accent: #4f7cff;
  --accent-soft: #e8eeff;
  --pos: #16995a;
  --neg: #d6453d;
  --warn: #e0a100;
  --inc: #2bb673;
  --exp: #ff7a59;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 16px rgba(20, 30, 50, .05);
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141b;
    --card: #19212c;
    --text: #e8edf4;
    --muted: #93a0b2;
    --line: #2a3442;
    --accent: #7096ff;
    --accent-soft: #1f2b47;
    --pos: #3ccf86;
    --neg: #ff6b62;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0f141b;
    --card: #19212c;
    --text: #e8edf4;
    --muted: #93a0b2;
    --line: #2a3442;
    --accent: #7096ff;
    --accent-soft: #1f2b47;
    --pos: #3ccf86;
    --neg: #ff6b62;
    --shadow: none;
  color-scheme: dark;
}


* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h3 { margin: 0 0 12px; font-size: 1.05rem; }
h4 { margin: 0; }

/* Cabecera */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.brand { font-weight: 700; font-size: 1.15rem; white-space: nowrap; }
.sync {
  display: flex; align-items: center; gap: 8px; max-width: 60vw;
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 6px 12px; font-size: .82rem; color: var(--muted);
}
.sync span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.sync.ok i { background: var(--pos); }
.sync.err i { background: var(--neg); }
.sync.busy i { background: var(--warn); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* Navegación: abajo en teléfono, arriba en pantallas grandes */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
.tabs button {
  border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: .7rem; color: var(--muted);
}
.tabs button span { font-size: 1.25rem; filter: grayscale(1); opacity: .7; }
.tabs button.active { color: var(--accent); font-weight: 600; }
.tabs button.active span { filter: none; opacity: 1; }

.monthbar, #view { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.monthbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.monthbar[hidden] { display: none; }
.monthbar b { font-size: 1.05rem; }
.monthbar b::first-letter, .day::first-letter { text-transform: uppercase; }
.monthbar button:disabled { opacity: .35; cursor: default; }
.monthbar button {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card); font-size: 1.4rem; line-height: 1;
}

@media (min-width: 800px) {
  body { padding-bottom: 40px; }
  .tabs {
    position: sticky; top: 58px; bottom: auto; height: auto; max-width: 760px; margin: 0 auto 16px;
    border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; z-index: 4;
  }
  .tabs button { flex-direction: row; gap: 6px; font-size: .9rem; padding: 8px; border-radius: 10px; }
  .tabs button span { font-size: 1rem; }
  .tabs button.active { background: var(--accent-soft); }
  .fab { bottom: 32px !important; }
  .top { padding-left: max(16px, calc((100% - 760px) / 2 + 16px)); padding-right: max(16px, calc((100% - 760px) / 2 + 16px)); }
}

/* Tarjetas */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--line); padding: 16px; margin-bottom: 14px;
}
.cards3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.cards3 .card { margin: 0; padding: 12px; }
.stat small { display: block; color: var(--muted); font-size: .78rem; }
.stat b { display: block; font-size: clamp(.8rem, 3.9vw, 1.05rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
@media (min-width: 600px) { .stat b { font-size: 1.3rem; } }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.muted { color: var(--muted); font-size: .88rem; margin: 6px 0 0; }
.empty { color: var(--muted); text-align: center; padding: 32px 12px; }

/* Mi dinero */
.moneyhead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.moneyhead b { font-size: 1.5rem; letter-spacing: -.01em; }
.acclist { list-style: none; margin: 4px 0 0; padding: 0; }
.acclist li {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 4px; border-top: 1px solid var(--line); cursor: pointer; border-radius: 8px;
}
.acclist li:active { background: var(--accent-soft); }
.accicon { font-size: 1.2rem; text-align: center; }
.acclist b, .stat b, .txlist span, .legend b { font-variant-numeric: tabular-nums; }
.neutral { color: var(--muted); }

/* Semana de pago */
.weekhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.weekhead h3 { margin: 0; }
.weekhead .muted { margin: 0; text-transform: capitalize; }
.weekgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 10px; }
.weekgrid > div { min-width: 0; }
.weekgrid small { display: block; color: var(--muted); font-size: .78rem; }
.weekgrid b { display: block; font-variant-numeric: tabular-nums; font-size: clamp(.85rem, 3.9vw, 1.1rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.payok { color: var(--pos); font-weight: 600; font-size: .9rem; margin: 10px 0 0; }
.week .btn.wide { margin-top: 12px; }
.field { margin-bottom: 12px; }
.field .seg { margin: 4px 0 0; }
.flabel { display: block; font-size: .85rem; color: var(--muted); }

/* Barras de progreso */
.progress { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--pos); border-radius: inherit; transition: width .3s; }
.progress.warn span { background: var(--warn); }
.progress.over span { background: var(--neg); }
.progress.goalp span { background: var(--accent); }
.progress.debt span { background: #a35bff; }

/* Dona */
.donutwrap { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.donut {
  width: 170px; height: 170px; border-radius: 50%; flex: none; margin: 0 auto;
  display: grid; place-items: center;
}
.donut > div {
  width: 62%; height: 62%; border-radius: 50%; background: var(--card);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 6px;
}
.donut small { color: var(--muted); font-size: .75rem; }
.donut b { font-size: .9rem; }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 220px; }
.legend li { display: grid; grid-template-columns: 12px 1fr auto 44px; gap: 8px; align-items: center; padding: 5px 0; font-size: .9rem; }
.legend i { width: 12px; height: 12px; border-radius: 4px; }
.legend em { color: var(--muted); font-style: normal; text-align: right; font-size: .8rem; }

/* Barras 6 meses */
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; height: 160px; align-items: end; }
.bcol { display: flex; flex-direction: column; align-items: center; height: 100%; gap: 6px; }
.bpair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.bpair span { width: 40%; max-width: 22px; border-radius: 5px 5px 0 0; min-height: 2px; }
.bi { background: var(--inc); }
.be { background: var(--exp); }
.bcol small { color: var(--muted); font-size: .75rem; text-transform: capitalize; }
.bcol.cur small { color: var(--text); font-weight: 700; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 2px 0 8px; vertical-align: -1px; }

/* Movimientos */
.seg { display: flex; background: var(--line); border-radius: 12px; padding: 3px; margin-bottom: 14px; }
.seg button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 10px; font-size: .9rem; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.day { color: var(--muted); font-size: .8rem; font-weight: 600; margin: 14px 4px 6px; }
.txlist { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.txlist li { display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; cursor: pointer; }
.txlist li + li { border-top: 1px solid var(--line); }
.txlist li:active { background: var(--accent-soft); }
.txlist i { width: 10px; height: 32px; border-radius: 5px; }
.txlist small { display: block; color: var(--muted); font-size: .82rem; }
.txlist span { font-weight: 600; white-space: nowrap; }

/* Presupuesto y metas */
.budrow { padding: 12px 0; border-top: 1px solid var(--line); }
.budhead { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.budhead .muted { margin: 0; }
.budinput { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: .85rem; color: var(--muted); }
.budinput input { width: 150px; }
.goal + .goal { margin-top: 16px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* Formularios */
.form label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 10px;
  padding: 10px 12px; font-size: 16px; /* 16px evita zoom en iPhone */
}
input[type=checkbox] { width: 20px; height: 20px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.btn {
  border: 0; background: var(--accent); color: #fff; border-radius: 10px; padding: 10px 16px; font-weight: 600;
}
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { color: var(--neg); }
.btn.wide { width: 100%; margin-top: 8px; }
.btngrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

dialog {
  border: 0; border-radius: 20px; padding: 20px; width: min(440px, calc(100vw - 24px));
  background: var(--card); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
dialog::backdrop { background: rgba(10, 15, 25, .45); }
dialog .seg { margin-top: 4px; }
dialog.ask { width: min(360px, calc(100vw - 32px)); }
dialog.ask p { margin: 0 0 8px; font-size: 1rem; }
.btn.dangerfill { background: var(--neg); color: #fff; }

.fab {
  position: fixed; right: 20px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); z-index: 7;
  width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--accent); color: #fff;
  font-size: 2rem; line-height: 1; box-shadow: 0 6px 20px rgba(79, 124, 255, .45);
}
.fab[hidden] { display: none; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 90px); z-index: 20;
  transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: .9rem;
  transition: .25s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%); }

/* Pantallas de ingreso y bloqueo */
body.gated > .top, body.gated > .tabs, body.gated > #monthbar, body.gated > main, body.gated > .fab { display: none !important; }
.gate {
  position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow-y: auto;
  display: flex; align-items: center; justify-content: center;
  padding: calc(env(safe-area-inset-top) + 24px) max(20px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 24px) max(20px, env(safe-area-inset-left));
}
.gatebox { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: stretch; text-align: center; gap: 4px; }
.gatebox .form { text-align: left; margin-top: 12px; }
.gatelogo { width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 8px; box-shadow: var(--shadow); }
.gate h1 { margin: 0; font-size: 1.6rem; letter-spacing: -.01em; }
.gatesub { color: var(--muted); margin: 4px 0 8px; }
.btn.big { padding: 14px 16px; font-size: 1.05rem; margin-top: 16px; }
.btn:disabled { opacity: .6; }
.linkbtn { background: none; border: 0; color: var(--accent); padding: 10px; font-size: .95rem; }
.autherr { color: var(--neg); font-size: .9rem; margin: -4px 0 10px; }

/* Ajustes: cuenta */
.acctline { margin: 0; overflow-wrap: anywhere; }
.lockrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); margin-top: 12px; }
.lockrow small { display: block; color: var(--muted); font-size: .85rem; margin-top: 2px; }
.lockrow .btn { flex: none; }

/* Administración */
.tabs button { position: relative; }
.badge {
  position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--neg); color: #fff; font-size: .7rem; font-style: normal; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
@media (min-width: 800px) { .badge { position: static; margin-left: 4px; } }
.urow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.uinfo { min-width: 0; flex: 1 1 220px; }
.uinfo b { display: block; overflow-wrap: anywhere; }
.uinfo small { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: .82rem; margin-top: 4px; }
.uacts { display: flex; gap: 8px; flex-wrap: wrap; }
.uacts .btn { padding: 8px 12px; font-size: .9rem; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .75rem; font-weight: 600; background: var(--line); color: var(--muted); }
.chip.ok { background: color-mix(in srgb, var(--pos) 18%, transparent); color: var(--pos); }
.chip.warn { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.chip.bad { background: color-mix(in srgb, var(--neg) 18%, transparent); color: var(--neg); }
.viewer { border-color: var(--accent); }
.viewhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.viewhead h3 { margin: 0; overflow-wrap: anywhere; }
.viewer .moneyhead { margin-top: 8px; }
.ro li { cursor: default; }
.authnote { font-size: .85rem; color: var(--muted); background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; margin: -2px 0 12px; }
.statusicon { font-size: 2.6rem; margin-top: 16px; }
.statustitle { margin: 6px 0 0; font-size: 1.15rem; }
.authhint { font-size: .82rem; color: var(--muted); margin: -6px 0 12px; }
.authfoot { font-size: .8rem; color: var(--muted); margin: 14px 0 0; line-height: 1.5; }
.addform { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.addform .addprev, .addform .autherr, .addform .row-end { grid-column: 1 / -1; }
.addprev { margin: -6px 0 4px; }
@media (max-width: 520px) { .addform { grid-template-columns: 1fr; } }
.creds { margin-top: 14px; padding: 14px; border-radius: 12px; background: color-mix(in srgb, var(--pos) 12%, transparent); border: 1px solid color-mix(in srgb, var(--pos) 35%, transparent); }
.creds pre { white-space: pre-wrap; overflow-wrap: anywhere; font: .9rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--card); border-radius: 8px; padding: 10px 12px; margin: 10px 0 0; user-select: all; }
.lockuser { font-weight: 600; margin: 0 0 4px; overflow-wrap: anywhere; }
.btn.faceid { display: flex; align-items: center; justify-content: center; gap: 10px; }
.linkbtn.subtle { color: var(--muted); font-size: .85rem; padding-top: 2px; }
.btn.outline { background: var(--card); color: var(--text); border: 1px solid var(--line); margin-top: 10px; }
#authSubmit { margin-top: 4px; }
.steps { margin: 0 0 4px; padding-left: 20px; display: grid; gap: 6px; font-size: .92rem; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.namerow { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.namerow label { flex: 1; margin-bottom: 0; }
.namerow .btn { flex: none; }
.uinfo small + small { margin-top: 2px; }
.brand { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.budinput label { color: var(--muted); }
.budctl { display: flex; align-items: center; gap: 6px; }
.iconbtn { width: 36px; height: 36px; flex: none; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: .9rem; }
.iconbtn:hover { color: var(--neg); border-color: var(--neg); }
.budrow + .row-end, .budrow ~ .row-end { padding-top: 14px; border-top: 1px solid var(--line); margin-top: 0; }

/* Comodidad móvil: superficies, jerarquía y controles táctiles. */
:root { --radius: 22px; --nav-h: 76px; --accent: #4869df; --shadow: 0 6px 24px rgba(26, 43, 76, .045); }
body { letter-spacing: -.015em; }
button, a, input, select { touch-action: manipulation; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.top { padding-top: calc(env(safe-area-inset-top) + 16px); padding-bottom: 16px; }
.brand { font-weight: 800; letter-spacing: -.04em; }
.sync { min-height: 44px; max-width: 48%; }
.monthbar { margin-top: 6px; margin-bottom: 20px; }
.monthbar button, .iconbtn { min-width: 44px; min-height: 44px; }
.card { padding: 20px; margin-bottom: 18px; }
h3 { font-size: 1rem; letter-spacing: -.02em; }
.money { background: linear-gradient(135deg, var(--accent-soft), var(--card) 80%); border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); }
.moneyhead { align-items: flex-start; flex-direction: column; gap: 0; margin-bottom: 18px; }
.moneyhead h3 { color: var(--muted); font-size: .86rem; margin-bottom: 4px; }
.moneyhead b { font-size: clamp(1.65rem, 7vw, 2.5rem); letter-spacing: -.045em; overflow-wrap: anywhere; max-width: 100%; }
.acclist li { min-height: 60px; padding: 12px 0; grid-template-columns: 32px minmax(0, 1fr) auto; }
.accname { overflow-wrap: anywhere; }
.acclist b { overflow-wrap: anywhere; }
.btn, .linkbtn, .seg button { min-height: 48px; }
.btn { border-radius: 14px; padding: 12px 16px; }
input:not([type=checkbox]), select, textarea { min-height: 50px; border-radius: 14px; }
.form label { gap: 7px; margin-bottom: 18px; font-weight: 500; }
.seg { padding: 4px; border-radius: 16px; gap: 2px; }
.seg button { border-radius: 12px; padding: 8px 6px; }
.tabs { padding-left: 6px; padding-right: 6px; }
.tabs button { gap: 5px; font-size: .64rem; min-width: 0; border-radius: 16px; margin: 6px 0; }
.tabs button.active { background: var(--accent-soft); }
.tabs button span { font-size: 1.3rem; }
.txlist li { min-height: 76px; grid-template-columns: 6px minmax(0, 1fr) auto; gap: 10px; padding: 14px; }
.txlist li > div { min-width: 0; overflow-wrap: anywhere; }
.txlist small { margin-top: 4px; }
.legend { min-width: 0; width: 100%; }
.legend li { grid-template-columns: 10px minmax(0, 1fr) auto 34px; font-size: .8rem; }
.legend li > span { overflow-wrap: anywhere; }
.fab { border-radius: 20px; width: auto; min-width: 60px; height: 56px; padding: 0 18px; display: flex; gap: 8px; align-items: center; justify-content: center; }
.fab::after { content: 'Agregar'; font-size: .9rem; font-weight: 700; }
#view { padding-bottom: 88px; }
.gate { background: radial-gradient(ellipse at top, var(--accent-soft), var(--bg) 65%); }
.gatebox { max-width: 400px; }
.gatelogo { width: 80px; height: 80px; border-radius: 24px; margin-bottom: 16px; }
.gate h1 { font-size: 2rem; font-weight: 800; letter-spacing: -.05em; }
.gatesub { margin-bottom: 20px; }
@media (max-width: 599px) {
  .cards3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
  .cards3 .card { padding: 16px; min-width: 0; }
  .cards3 .card:last-child { grid-column: 1 / -1; }
  .stat b { font-size: clamp(1rem, 4.5vw, 1.4rem); white-space: normal; overflow-wrap: anywhere; overflow: visible; }
  .stat small { margin-bottom: 6px; }
  .weekgrid { grid-template-columns: 1fr; gap: 0; }
  .weekgrid > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .weekgrid b { white-space: normal; overflow-wrap: anywhere; text-align: right; font-size: 1rem; }
  .money .row-end { display: grid; grid-template-columns: 1fr 1fr; }
  .money .row-end .btn { padding-left: 8px; padding-right: 8px; font-size: .85rem; }
  .btngrid { grid-template-columns: 1fr; }
  dialog:not(.ask) { width: 100%; max-width: 100%; max-height: calc(100dvh - env(safe-area-inset-top) - 16px); margin: auto 0 0; border-radius: 26px 26px 0 0; padding: 24px 20px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; }
  dialog .row-end { gap: 8px; }
  dialog .row-end .btn { flex: 1 1 auto; }
  .gate { align-items: safe center; }
}
@media (max-width: 359px) {
  .brand { font-size: 1rem; }
  .card { padding: 16px; }
  .acclist li { grid-template-columns: 28px minmax(0, 1fr); }
  .acclist li > b { grid-column: 2; }
  .txlist li { grid-template-columns: 6px minmax(0, 1fr); }
  .txlist li > span { grid-column: 2; white-space: normal; overflow-wrap: anywhere; }
}
@media (min-width: 800px) {
  .tabs { top: calc(76px + env(safe-area-inset-top)); }
  .tabs button { margin: 0; font-size: .85rem; min-height: 48px; }
  .gatebox { padding: 32px; max-width: 460px; background: var(--card); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Navegación inferior también en computadores. */
@media (min-width: 800px) {
  body { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px); }
  .tabs {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0;
    width: 100%; max-width: none; margin: 0;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    padding: 6px max(16px, calc((100% - 760px) / 2)) calc(6px + env(safe-area-inset-bottom));
    border: 0; border-top: 1px solid var(--line); border-radius: 0; z-index: 6;
  }
  .tabs button { flex-direction: column; gap: 4px; font-size: .75rem; min-height: 48px; }
  .tabs button span { font-size: 1.3rem; }
  .fab { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px) !important; }
  .badge { position: absolute; top: 3px; left: calc(50% + 6px); margin-left: 0; }
}

/* Paleta y tipografía: azul índigo, superficies suaves y texto legible. */
:root, :root[data-theme="light"] {
  --bg: #f3f5fa;
  --card: #ffffff;
  --text: #202b40;
  --muted: #59677e;
  --line: #dce3ee;
  --accent: #435dcc;
  --accent-soft: #e9edfc;
  --pos: #147348;
  --neg: #bb3939;
  --warn: #996400;
  --inc: #27946a;
  --exp: #d96756;
  --shadow: 0 4px 20px rgba(31, 48, 84, .045);
}
:root[data-theme="dark"] {
  --bg: #101622;
  --card: #1a2332;
  --text: #edf2fc;
  --muted: #acb9cf;
  --line: #303d52;
  --accent: #a2b5ff;
  --accent-soft: #263451;
  --pos: #73d9ac;
  --neg: #ff9b96;
  --warn: #efc76c;
  --inc: #73d9ac;
  --exp: #ff9b96;
  --shadow: 0 6px 24px rgba(0, 0, 0, .10);
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}
h3, h4 { font-weight: 650; letter-spacing: -.015em; }
.brand { font-weight: 750; letter-spacing: -.025em; }
.moneyhead b { font-weight: 750; letter-spacing: -.035em; line-height: 1.2; }
.stat b, .weekgrid b { font-weight: 700; letter-spacing: -.02em; }
.stat small, .weekgrid small { font-size: .84rem; }
.form label, .flabel { font-size: .9rem; }
input, select, textarea { color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.btn, .fab { color: #fff; background: var(--btn, #435dcc); }
.btn.ghost, .btn.outline { color: var(--text); }
.btn.danger { color: var(--neg); }
.btn.dangerfill { background: #b93139; color: #fff; }
.btn.outline, .btn.ghost { background: var(--card); }
.tabs { box-shadow: 0 -4px 24px rgba(22, 35, 60, .06); }
.tabs button { font-weight: 500; }
.tabs button.active { color: var(--accent); font-weight: 700; }
.txlist small { font-size: .86rem; }
.money { background: linear-gradient(135deg, var(--accent-soft), var(--card)); }
@media (hover: hover) {
  .btn:hover, .fab:hover { filter: brightness(1.08); }
  .tabs button:hover { background: var(--accent-soft); }
}

@font-face {
  font-family: 'Manrope';
  src: url('manrope-variable.ttf') format('truetype');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
body { font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.brand, .gate h1 { font-weight: 800; }
.moneyhead b { font-weight: 800; }

.reserve-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 20px 0; }
.reserve-grid > div { padding: 16px; border-radius: 16px; background: var(--accent-soft); min-width: 0; }
.reserve-grid span { display: block; color: var(--muted); font-size: .85rem; }
.reserve-grid b { display: block; margin-top: 8px; font-size: 1.4rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.reserve-grid label { min-width: 0; margin: 0; }
@media (max-width: 359px) { .reserve-grid { grid-template-columns: 1fr; } }

.budget-repeat { display: flex; align-items: center; gap: 10px; min-height: 48px; margin-top: 8px; color: var(--muted); font-size: .9rem; }
.budget-repeat input { flex: none; accent-color: var(--accent); }

.summary-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.summary-head h3 { margin: 0; }
.summary-head a { color: var(--accent); font-size: .85rem; display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.summary-grid small { display: block; color: var(--muted); font-size: .8rem; }
.summary-grid b { display: block; font-size: 1.1rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.home-goals { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
@media (max-width: 420px) { .summary-grid { grid-template-columns: 1fr; } .summary-grid > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; } }

.budget-paid { color: var(--text); font-weight: 600; }
#budgetPayNotice { margin-bottom: 18px; }
#budgetPayAmount { font-size: 1.4rem; }

.budget-summary-title { margin: 0 4px 8px; }

.six-range { margin-bottom: 20px; }
.six-months .donut { width: 200px; height: 200px; }
.six-months .donut b { overflow-wrap: anywhere; max-width: 100%; }

/* Presupuesto cómodo de usar con una mano en pantallas pequeñas. */
.budget-panel > .row-end { margin: 18px 0; }
@media (max-width: 599px) {
  .budget-panel { background: transparent; border: 0; box-shadow: none; padding: 0; }
  .budget-panel > h3 { font-size: 1.2rem; margin: 0 4px 8px; }
  .budget-panel > .muted { margin: 0 4px; }
  .budget-panel > .row-end .btn { width: 100%; min-height: 52px; }
  .budget-items { display: grid; gap: 16px; }
  .budget-items .budrow { background: var(--card); padding: 18px; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
  .budget-items .budhead { flex-direction: column; gap: 4px; margin-bottom: 12px; }
  .budget-items .budhead > b { font-size: 1.05rem; overflow-wrap: anywhere; }
  .budget-items .budinput { display: block; margin: 16px 0; }
  .budget-items .budinput > label { display: block; margin-bottom: 7px; }
  .budget-items .budctl { display: grid; grid-template-columns: minmax(0, 1fr) 48px; gap: 10px; }
  .budget-items .budinput input { width: 100%; min-height: 52px; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .budget-items .iconbtn { width: 48px; height: 52px; border-radius: 14px; }
  .budget-items .budget-repeat { min-height: 56px; margin: 8px 0 0; padding: 12px; border: 1px solid var(--line); border-radius: 14px; font-size: .9rem; line-height: 1.4; }
  .budget-items .budget-repeat input { width: 24px; height: 24px; }
  .budget-items .budget-paid { background: var(--accent-soft); border-color: transparent; }
  .budget-panel .empty { background: var(--card); border-radius: 20px; }
}

.budget-pay-all { padding: 16px; border-radius: 16px; background: var(--accent-soft); color: var(--text); font-weight: 700; margin-bottom: 16px; }
.bulk-budget-row { padding: 16px 0 0; margin-top: 16px; border-top: 1px solid var(--line); }
.bulk-budget-row > b { display: block; margin-bottom: 12px; overflow-wrap: anywhere; }
.edit-budget-payment { margin: 4px 0 8px; width: 100%; }

.tabs button[data-tab="movimientos"], .tabs button[data-tab="presupuesto"] { white-space: normal; text-align: center; }
@media (max-width: 799px) { .tabs button { font-size: .6rem; line-height: 1.2; padding: 4px 2px; } }

.occasional-total { font-size: 1.8rem; font-weight: 800; margin: 8px 0 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.occasional-details { margin-top: 14px; }
.occasional-details summary { min-height: 48px; padding: 12px 4px; cursor: pointer; color: var(--accent); font-weight: 600; }
.occasional-details .txlist { margin: 8px 0 16px; }

/* En teléfono, las leyendas van debajo del círculo sin comprimirse. */
@media (max-width: 599px) {
  .donutwrap { flex-direction: column; align-items: stretch; gap: 20px; }
  .donutwrap .donut { align-self: center; max-width: 100%; }
  .donutwrap .legend { flex: none; width: 100%; min-width: 0; }
  .donutwrap .legend li { grid-template-columns: 10px minmax(0, 1fr) auto 38px; gap: 8px; padding: 8px 0; }
  .donutwrap .legend b { font-size: .84rem; max-width: 38vw; overflow-wrap: anywhere; }
  .donutwrap .legend span { word-break: normal; }
}

/* Ajustes: tipo de cuentas */
.seg.accmode { margin-bottom: 4px; }
.seg.accmode button { font-size: .88rem; padding: 10px 6px; }

/* Interruptores de Mi dinero */
.switchrow { margin-top: 0; }
.switch { position: relative; width: 52px; height: 32px; flex: none; border: 0; border-radius: 99px; background: var(--line); padding: 0; transition: background .2s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch.on { background: var(--accent); }
.switch.on i { transform: translateX(20px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .switch, .switch i { transition: none; } }

.curchip { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 99px; font-size: .72rem; font-weight: 700; letter-spacing: .04em; vertical-align: middle; background: var(--accent-soft); color: var(--accent); }

/* ===== Color propio de cada sesión (se elige en Ajustes) ===== */
:root[data-accent="azul"], :root[data-theme="light"][data-accent="azul"] { --accent: #435dcc; --accent-soft: #e9edfc; --btn: #435dcc; }
:root[data-theme="dark"][data-accent="azul"] { --accent: #a2b5ff; --accent-soft: #263451; --btn: #435dcc; }
:root[data-accent="marino"], :root[data-theme="light"][data-accent="marino"] { --accent: #203c6b; --accent-soft: #e3e9f3; --btn: #203c6b; }
:root[data-theme="dark"][data-accent="marino"] { --accent: #9fb6dd; --accent-soft: #1f2a3d; --btn: #203c6b; }
:root[data-accent="turquesa"], :root[data-theme="light"][data-accent="turquesa"] { --accent: #0b7f77; --accent-soft: #dcf3f1; --btn: #0b7f77; }
:root[data-theme="dark"][data-accent="turquesa"] { --accent: #4fe0d3; --accent-soft: #15312f; --btn: #0b7f77; }
:root[data-accent="verde"], :root[data-theme="light"][data-accent="verde"] { --accent: #2f7a50; --accent-soft: #e2f2e9; --btn: #2f7a50; }
:root[data-theme="dark"][data-accent="verde"] { --accent: #7ddcaa; --accent-soft: #1c3328; --btn: #2f7a50; }
:root[data-accent="grafito"], :root[data-theme="light"][data-accent="grafito"] { --accent: #3d4552; --accent-soft: #e8eaee; --btn: #3d4552; }
:root[data-theme="dark"][data-accent="grafito"] { --accent: #c3cad6; --accent-soft: #2a2f37; --btn: #3d4552; }
:root[data-accent="morado"], :root[data-theme="light"][data-accent="morado"] { --accent: #6a43bb; --accent-soft: #eee8fa; --btn: #6a43bb; }
:root[data-theme="dark"][data-accent="morado"] { --accent: #c4a6ff; --accent-soft: #2c2346; --btn: #6a43bb; }
:root[data-accent="rosa"], :root[data-theme="light"][data-accent="rosa"] { --accent: #b23c6f; --accent-soft: #fae7ef; --btn: #b23c6f; }
:root[data-theme="dark"][data-accent="rosa"] { --accent: #f7a3c7; --accent-soft: #3a2030; --btn: #b23c6f; }
:root[data-accent="rojo"], :root[data-theme="light"][data-accent="rojo"] { --accent: #c22f35; --accent-soft: #fbe5e6; --btn: #c22f35; }
:root[data-theme="dark"][data-accent="rojo"] { --accent: #ff9b9f; --accent-soft: #3b1f22; --btn: #c22f35; }
:root[data-accent="terracota"], :root[data-theme="light"][data-accent="terracota"] { --accent: #ad512a; --accent-soft: #f8e8df; --btn: #ad512a; }
:root[data-theme="dark"][data-accent="terracota"] { --accent: #f2a77f; --accent-soft: #3a271c; --btn: #ad512a; }
:root[data-accent="dorado"], :root[data-theme="light"][data-accent="dorado"] { --accent: #8a6508; --accent-soft: #f5eedb; --btn: #8a6508; }
:root[data-theme="dark"][data-accent="dorado"] { --accent: #e8c46a; --accent-soft: #342b17; --btn: #8a6508; }
.fab { box-shadow: 0 6px 20px color-mix(in srgb, var(--btn, var(--accent)) 40%, transparent); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 12px 8px; margin-top: 4px; }
.swatchbox { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); background: none; border: 0; padding: 0; }
.swatch { width: 42px; height: 42px; border-radius: 50%; position: relative; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.swatchbox.on .swatch::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2.5px solid var(--sw); }
.swatchbox.on .swatch::before { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.05rem; }
.swatchbox.on { color: var(--text); font-weight: 600; }
.swatchbox:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; border-radius: 8px; }
/* El color de la sesión también tiñe el fondo (y en modo oscuro tarjetas y bordes) */
:root[data-accent] {
  --bg: color-mix(in srgb, var(--btn) 4%, #f8f9fb);
  --line: color-mix(in srgb, var(--btn) 10%, #e2e6ec);
}
:root[data-theme="dark"][data-accent] {
  --bg: color-mix(in srgb, var(--btn) 16%, #0b0f16);
  --card: color-mix(in srgb, var(--btn) 10%, #161c26);
  --line: color-mix(in srgb, var(--btn) 24%, #29323f);
}

/* ===== Ajustes: ordenado y minimalista ===== */
.settings { max-width: 560px; margin: 0 auto; }
.settings .card { margin-bottom: 0; }
.sgroup { margin: 26px 8px 8px; font-size: .74rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.slist { padding: 0 16px; }
.srow {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%;
  min-height: 56px; padding: 10px 0; border: 0; border-top: 1px solid var(--line); background: none;
  font: inherit; color: var(--text); text-align: left; margin: 0;
}
.slist > .srow:first-child { border-top: 0; }
.srow > span:first-child { min-width: 0; }
.srow small { display: block; color: var(--muted); font-size: .8rem; margin-top: 1px; }
.srow.col { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 0; }
.sico { margin-right: 10px; }
.srow.chev::after { content: "›"; color: var(--muted); font-size: 1.4rem; line-height: 1; }
.srow.chev[aria-expanded="true"]::after { transform: rotate(90deg); }
.srow.danger { justify-content: center; color: var(--neg); font-weight: 600; }
.slogout { margin-top: 26px; }
.snote { margin: 8px 8px 0; font-size: .8rem; color: var(--muted); }
.sprofile { display: flex; align-items: center; gap: 14px; }
.avatar { width: 54px; height: 54px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--btn, var(--accent)); color: #fff; font-weight: 800; font-size: 1.35rem; }
.pinfo { flex: 1; min-width: 0; }
.pinfo b { display: block; font-size: 1.12rem; }
.pinfo small { display: block; color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.pinfo small:empty { display: none; }
.slink { flex: none; background: none; border: 0; padding: 8px; color: var(--accent); font: inherit; font-weight: 600; }
.sform { margin-top: 10px !important; }
.sinline { display: flex; gap: 8px; margin-top: 6px; }
.sinline input { flex: 1; min-width: 0; }
.sinline .btn { flex: none; }
.cdots { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; justify-items: center; }
.cdot { width: 30px; height: 30px; border-radius: 50%; border: 0; padding: 0; position: relative; background: var(--sw); }
.cdot.on::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--sw); }
.cdot:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; }
@media (max-width: 360px) { .cdots { grid-template-columns: repeat(5, 1fr); row-gap: 12px; } }
.sselect { width: auto; max-width: 62%; min-height: 0 !important; border: 0; background: transparent; padding: 6px 0; text-align: right; color: var(--muted); font-weight: 500; }
.sselect:focus { outline: 2px solid var(--accent); border-radius: 8px; }
.spass { padding: 4px 0 14px; border-top: 1px solid var(--line); }

/* ===== Estilo minimalista en toda la app ===== */
.card { box-shadow: none; border: 1px solid var(--line); border-radius: 20px; padding: 18px; margin-bottom: 12px; }
.money { background: var(--card) !important; }
.card h3, .summary-head h3 { font-size: 1rem; font-weight: 650; margin: 0; }
.summary-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.summary-head a { font-size: .85rem; font-weight: 600; text-decoration: none; color: var(--accent); white-space: nowrap; }
.summary-head .muted { margin: 0; font-size: .82rem; text-transform: capitalize; }
.section-head { margin: 22px 4px 10px; }
.weekgrid { gap: 6px; margin: 4px 0 12px; }
.weekgrid small { font-size: .78rem; color: var(--muted); }
.weekgrid b { font-size: 1.05rem; }
.weekhead { margin-bottom: 10px; }
.weekhead .muted { font-size: .82rem; }
.card .muted { font-size: .85rem; margin-top: 8px; }
.moneyhead { margin-bottom: 4px; }
.moneyhead h3 { font-size: .9rem; font-weight: 600; color: var(--muted); }
.acclist li { padding: 12px 2px; }
.occasional-total { font-size: 1.6rem; font-weight: 750; letter-spacing: -.02em; margin: 0 0 4px; }
.reserve-grid > div { border-radius: 14px; }
.home-goals .goal { padding-top: 12px; border-top: 1px solid var(--line); margin-top: 12px; }
.goal .budhead b { font-weight: 600; }
.progress { height: 8px; }
.donut { width: 150px; height: 150px; }
.legend li { font-size: .88rem; }
.txlist { border-radius: 18px; }
.txlist li { padding: 13px 16px; }
.txlist i { width: 8px; height: 28px; }
.day { font-size: .78rem; letter-spacing: .02em; margin: 18px 6px 8px; }
.seg { border-radius: 14px; }
.monthbar button { border: 1px solid var(--line); background: var(--card); }
.row-end .btn { padding: 10px 16px; }
.weekhead .muted { text-transform: none; }
.weekhead .muted::first-letter { text-transform: uppercase; }

/* ===== Modo claro más limpio ===== */
:root, :root[data-theme="light"] {
  --text: #172033;
  --muted: #667085;
  --card: #ffffff;
  --line: #e7e9ee;
  --pos: #157347;
  --neg: #c43d3d;
}
:root[data-accent], :root[data-theme="light"][data-accent] {
  --bg: color-mix(in srgb, var(--btn) 3%, #f7f8fa);
  --line: #e7e9ee;
  --accent-soft: color-mix(in srgb, var(--btn) 9%, #ffffff);
}
:root:not([data-theme="dark"]) .card { box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px rgba(16, 24, 40, .03); }
:root:not([data-theme="dark"]) .money { border-color: var(--line) !important; background: var(--card) !important; }
:root:not([data-theme="dark"]) .tabs { background: rgba(255, 255, 255, .94); border-top-color: var(--line); box-shadow: 0 -1px 0 var(--line); }
:root:not([data-theme="dark"]) .monthbar button,
:root:not([data-theme="dark"]) .sync { background: #fff; border-color: var(--line); }
:root:not([data-theme="dark"]) .btn.ghost, :root:not([data-theme="dark"]) .btn.outline { background: #fff; border-color: var(--line); }
:root:not([data-theme="dark"]) input, :root:not([data-theme="dark"]) select, :root:not([data-theme="dark"]) textarea { background: #f8f9fb; border-color: var(--line); }
:root:not([data-theme="dark"]) .seg { background: #eef0f3; }
:root:not([data-theme="dark"]) .reserve-grid > div { background: var(--accent-soft); }
:root:not([data-theme="dark"]) .curchip { background: var(--accent-soft); }

/* ===== Letra del título (Fraunces, licencia OFL) ===== */
@font-face { font-family: "Fraunces Title"; src: url("fraunces-title.woff?v=1") format("woff"); font-weight: 400 900; font-display: swap; }
.brand { font-family: "Fraunces Title", Georgia, "Times New Roman", serif; font-weight: 600; font-size: 1.7rem; line-height: 1.1; letter-spacing: -.015em; }
@media (max-width: 420px) { .brand { font-size: 1.55rem; } }

/* ===== Sincronización en Ajustes; fecha con la letra del título ===== */
#syncBtn { display: none; }
.top { min-height: 56px; }
.sstate { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.sstate i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.sstate.ok i { background: var(--pos); }
.sstate.err i { background: var(--neg); }
.sstate.busy i { background: var(--warn); animation: pulse 1s infinite; }
.monthbar b { font-family: "Fraunces Title", Georgia, "Times New Roman", serif; font-weight: 600; font-size: 1.3rem; letter-spacing: -.01em; }

/* ===== Pantalla de ingreso con la letra del título ===== */
.gate h1 { font-family: "Fraunces Title", Georgia, "Times New Roman", serif; font-weight: 600; font-size: 2.1rem; letter-spacing: -.015em; }
.gatelogo { box-shadow: 0 6px 18px rgba(18, 28, 51, .28); }

/* ===== Ojo de la contraseña ===== */
.pwrap { position: relative; display: block; }
.pwrap input { width: 100%; padding-right: 48px; }
.eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); border-radius: 10px; padding: 0; cursor: pointer; }
.eye:hover, .eye:focus-visible { color: var(--text); }

/* ===== Inicio minimalista ===== */
.mhome { padding: 20px 18px 14px; }
.mlabel { font-size: .85rem; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.mtotal { font-size: 2.3rem; font-weight: 750; letter-spacing: -.03em; margin: 4px 0 2px; line-height: 1.15; }
.mnote { margin: 8px 0 0; font-size: .85rem; color: var(--muted); }
.accpills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.accpill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 999px; padding: 7px 12px; font: inherit; font-size: .85rem; }
.accpill b { font-weight: 650; }
.mactions { display: flex; gap: 4px; margin: 8px -8px 0; }
.mactions .slink { font-size: .88rem; }
.mweek .mleft { font-weight: 650; font-size: .95rem; color: var(--text); text-transform: none; }
.mweek .mleft.neg { color: var(--neg); }
.mweek .btn { margin-top: 12px; }
.hbig { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: 10px; }
.stackbar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--line); gap: 2px; }
.stackbar span { display: block; min-width: 4px; }
.mlist { list-style: none; margin: 12px 0 0; padding: 0; }
.mlist li { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: .92rem; }
.mlist li i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.mlist li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mlist li b { font-weight: 600; }
.mlist.plain { margin-top: 0; }
.mlist.plain li + li { border-top: 1px solid var(--line); }
.kv { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; font-size: .92rem; color: var(--muted); }
.kv b { color: var(--text); font-weight: 650; }
.kv small { color: var(--muted); font-weight: 500; }
.sixbars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; height: 120px; align-items: end; margin: 6px 0 4px; }
.sixbars > div { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 100%; position: relative; padding-bottom: 20px; }
.sixbars .b { width: 9px; border-radius: 4px 4px 0 0; min-height: 2px; }
.sixbars .b.inc { background: var(--inc); }
.sixbars .b.exp { background: var(--exp); }
.sixbars small { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; font-size: .72rem; color: var(--muted); text-transform: capitalize; }
.six { margin-top: 18px; }
.accpills { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.accpill { flex-direction: column; align-items: flex-start; gap: 2px; border-radius: 14px; padding: 10px 12px; text-align: left; color: var(--muted); font-size: .8rem; }
.accpill b { color: var(--text); font-size: .98rem; }
.accpill b.neg { color: var(--neg); }
.hgoal .goal p.muted { margin-top: 6px; }
.hgoal .mnote { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.hgoal .goal + .mnote { }
.pinhome { display: block; margin: 10px 0 0; padding: 6px 0; border: 0; background: none; font: inherit; font-size: .85rem; color: var(--muted); }
.pinhome.on { color: var(--accent); font-weight: 600; }
/* pantalla de ingreso con el color elegido */
:root[data-accent] .gatelogo { box-shadow: 0 6px 18px color-mix(in srgb, var(--btn) 30%, transparent); }
.addbud { display: block; margin: 10px -8px -4px; }
.cdots { grid-template-columns: repeat(5, 1fr); row-gap: 14px; max-width: 300px; }
.cdot { width: 34px; height: 34px; }
/* con el color rojo, los montos negativos van en naranjo oscuro para no confundirse con los botones */
:root[data-accent="rojo"], :root[data-theme="light"][data-accent="rojo"] { --neg: #c2410c; }
:root[data-theme="dark"][data-accent="rojo"] { --neg: #ffa36b; }

/* ===== Admin minimalista ===== */
.atop { display: flex; justify-content: flex-end; margin: -4px 0 8px; }
.ausers, .ausers + .slist { margin-bottom: 12px; }
.ahead span { font-weight: 600; }
.acount { display: inline-block !important; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent) !important; font-weight: 600; font-size: .78rem !important; }
.auser { align-items: flex-start; justify-content: flex-start; gap: 12px; padding: 14px 0 8px; }
.avatar.sm { width: 36px; height: 36px; font-size: .95rem; margin-top: 2px; }
.auser .uinfo { flex: 1; min-width: 0; }
.auser .uinfo b { font-weight: 600; font-size: .95rem; }
.auser .uinfo small { display: block; color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ulinks { display: flex; flex-wrap: wrap; gap: 2px; margin: 4px -8px 0; }
.ulinks .slink { font-size: .82rem; padding: 6px 8px; }
.slink.danger { color: var(--neg); }
.aadd span { font-weight: 600; }
.alinks { justify-content: flex-start; gap: 6px; min-height: 48px; margin: 0 -8px; width: calc(100% + 16px); padding-left: 0; }
.alinks .slink { font-size: .88rem; text-decoration: none; }
.vartag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .75rem; font-weight: 600; }
.hfunds { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.hgoal .hfunds:first-of-type:not(:has(+ *)) { }
.ftotal { margin-bottom: 4px; }
.ftotal b { font-size: 1.05rem; }
.hfunds .fsplit { margin-top: 2px; border: 0; padding: 0; }
.reserves .ftotal { margin: 10px 0 12px; }
.smonth { font: inherit; text-transform: capitalize; }
.editname { border: 0; background: none; padding: 2px 6px; margin-left: 2px; font-size: .85rem; opacity: .55; cursor: pointer; }
.editname:hover, .editname:focus-visible { opacity: 1; }
.budrename { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.budrename input { flex: 1 1 auto; width: 100%; min-width: 0; }
.budrename .btn { padding: 10px 14px; }
.budrename { width: 100%; box-sizing: border-box; }
.budrename { flex-wrap: wrap; justify-content: flex-end; } .budrename input { flex-basis: 100%; }
