/* ===== Tokens de tema ===== */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface2: #eef1f5;
  --text: #101418;
  --muted: #6b7480;
  --border: #e3e7ec;
  --brand: #2f6df0;
  --brandd: #1f4fc4;
  --pos: #12a37a;
  --warn: #e0a422;
  --warnd: #946c07;
  --warnbg: #fdf3dd;
  --neg: #e0503f;
  color-scheme: light;
}
:root[data-theme="oscuro"] {
  --bg: #0e1116;
  --surface: #161a20;
  --surface2: #1f242c;
  --text: #eef1f5;
  --muted: #98a1ad;
  --border: #282e38;
  --brand: #5b8dff;
  --brandd: #8fb0ff;
  --pos: #2ec08f;
  --warn: #efbb4a;
  --warnd: #efbb4a;
  --warnbg: #33290f;
  --neg: #f0705f;
  color-scheme: dark;
}

/* ===== Base ===== */
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Manrope, "Helvetica Neue", Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
input, select, button, textarea { font-family: inherit; }
input[type=range] { accent-color: var(--brand); }
::-webkit-scrollbar { height: 6px; width: 6px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
[hidden] { display: none !important; }

.app { min-height: 100vh; background: var(--bg); }

/* ===== Barra superior ===== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 12px 16px 0;
  display: flex; flex-direction: column; gap: 10px;
}
.topbar-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.logo {
  width: 30px; height: 30px; border-radius: 9px; background: var(--brand);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px;
}
.title { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.month-nav {
  display: flex; align-items: center; gap: 4px;
  background: var(--surface2); border-radius: 12px; padding: 4px;
}
.icon-btn {
  width: 34px; height: 34px; border: none; background: transparent; color: var(--text);
  border-radius: 9px; font-size: 16px; cursor: pointer;
}
.icon-btn:hover { background: var(--surface); }
.month-label { min-width: 132px; text-align: center; font-weight: 700; font-size: 14px; }
.theme-btn {
  height: 42px; min-width: 44px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font-weight: 700; font-size: 13px; cursor: pointer;
}
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; }
.tab {
  flex: none; min-height: 40px; padding: 0 15px; border-radius: 11px; cursor: pointer;
  font-size: 14px; font-weight: 800; white-space: nowrap;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
}
.tab.active { border-color: transparent; background: var(--brand); color: #fff; }

/* ===== Contenido ===== */
.main {
  max-width: 1120px; margin: 0 auto; padding: 18px 16px 56px;
  display: flex; flex-direction: column; gap: 16px;
}
.view { display: flex; flex-direction: column; gap: 16px; }
form.card { scroll-margin-top: 120px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 18px;
  box-shadow: 0 1px 2px rgba(16,20,24,.04);
}
.card-lg {
  border-radius: 22px; padding: 22px;
  box-shadow: 0 1px 2px rgba(16,20,24,.05), 0 12px 30px rgba(16,20,24,.06);
}
.card-sm { border-radius: 16px; padding: 14px 16px; }
.card-list { padding: 6px 18px 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }

.eyebrow {
  font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.eyebrow-sm {
  font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.section-title { font-size: 15px; font-weight: 800; margin-bottom: 4px; }
.section-sub { font-size: 12px; color: var(--muted); font-weight: 600; }
.mb-14 { margin-bottom: 14px !important; }
.mb-16 { margin-bottom: 16px !important; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.w-full { width: 100%; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.warn { color: var(--warn); }
.warnd { color: var(--warnd); }
.pos-bg { background: var(--pos); }

/* ===== Tarjeta hero ===== */
.hero-value {
  font-size: 44px; font-weight: 800; letter-spacing: -.03em; margin: 6px 0 2px; line-height: 1.05;
}
.hero-sub { font-size: 14px; color: var(--muted); font-weight: 600; }
.big-value { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin-top: 4px; }

.progress { height: 9px; border-radius: 99px; background: var(--surface2); overflow: hidden; }
.progress-lg { height: 12px; margin-top: 16px; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width .35s ease; }
.progress-legend {
  display: flex; justify-content: space-between; margin-top: 8px;
  font-size: 12px; font-weight: 700; color: var(--muted);
}

/* ===== Grids ===== */
.grid-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid-form-sm { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.grid-fund { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-top: 18px; }

.stat-value {
  font-size: clamp(17px, 4.4vw, 22px); font-weight: 800; letter-spacing: -.02em;
  margin-top: 6px; white-space: nowrap;
}
.grid-cards .card-sm .stat-value { font-size: clamp(18px, 4.6vw, 24px); }
.stat-sub { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 2px; }

/* ===== Donut ===== */
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 12px; }
.donut { position: relative; width: 160px; height: 160px; flex: none; }
.donut svg { width: 160px; height: 160px; display: block; }
.donut-center {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none;
}
.donut-label { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.donut-value { font-size: 15px; font-weight: 800; letter-spacing: -.02em; }
.legend { display: flex; flex-direction: column; gap: 9px; flex: 1; min-width: 170px; }
.legend-row { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend-row .name { font-weight: 700; flex: 1; }
.legend-row .amt { font-weight: 800; }
.legend-row .pct { color: var(--muted); font-weight: 700; width: 38px; text-align: right; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* ===== Barras ===== */
.bars { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.bars.gap-14 { gap: 14px; margin-top: 0; }
.bar-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.bar-note { font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 4px; }

/* ===== Listas ===== */
.list { display: flex; flex-direction: column; gap: 2px; }
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border);
}
.list-row.row-lg { gap: 11px; padding: 12px 0; }
.card-list .list-row { border-top: none; border-bottom: 1px solid var(--border); padding: 14px 0; }
.card-list .list-row.fixed { gap: 11px; padding: 13px 0; }
.chip-icon {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  display: grid; place-items: center; font-size: 15px;
}
.chip-icon.sm { width: 34px; height: 34px; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title.lg { font-size: 15px; font-weight: 800; }
.row-meta { font-size: 12px; color: var(--muted); font-weight: 600; }
.row-amount { font-size: 15px; font-weight: 800; text-align: right; }
.row-amount.lg { font-size: 16px; }
.empty { font-size: 13px; color: var(--muted); font-weight: 600; padding: 22px 0; text-align: center; }
.empty.sm { padding: 16px 0; }
.empty.md { padding: 20px 0; }
.link-btn {
  border: none; background: transparent; color: var(--brand);
  font-weight: 800; font-size: 13px; cursor: pointer; padding: 8px;
}
.row-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; flex: none;
}
.row-btn.del { color: var(--neg); }
.row-btn:hover { background: var(--surface2); }
.check-btn {
  width: 30px; height: 30px; flex: none; border-radius: 9px; cursor: pointer;
  font-size: 15px; font-weight: 800; border: 2px solid var(--border); background: transparent; color: #fff;
}
.check-btn.paid { border-color: var(--pos); background: var(--pos); }
.badge-warn {
  font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 99px; background: var(--warnbg); color: var(--warnd); flex: none;
}

/* ===== Formularios ===== */
.field label {
  display: block; font-size: 11px; font-weight: 800; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.field input, .field select {
  width: 100%; padding: 11px 12px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text); font-size: 15px; font-weight: 600;
}
.field input.strong { font-weight: 700; }
.field input.xl { font-size: 17px; font-weight: 800; }
.field input[type=color] { height: 44px; padding: 4px; }
.field input:focus, .field select:focus { outline: 2px solid var(--brand); outline-offset: 0; }
.field-end { display: flex; align-items: flex-end; }
.field.grow { flex: 1; min-width: 150px; }
.form-error { margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--neg); }
.form-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.btn {
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: none;
  font-weight: 800; font-size: 15px; cursor: pointer;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brandd); }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); font-size: 14px; padding: 0 16px; }
.form-actions .btn-secondary { font-size: 15px; padding: 0 18px; }
.btn-outline-brand { background: transparent; color: var(--brand); border: 1px solid var(--brand); font-size: 14px; padding: 0 16px; }
.btn-outline-neg { background: transparent; color: var(--neg); border: 1px solid var(--neg); font-size: 14px; padding: 0 16px; }
.btn-pos { background: var(--pos); color: #fff; }

/* Switch "¿Fue imprevisto?" */
.switch-btn {
  width: 100%; min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  border-radius: 11px; border: 1px solid var(--border); background: var(--surface2);
  color: var(--text); font-size: 14px; font-weight: 700; cursor: pointer; text-align: left;
}
.switch-track {
  width: 42px; height: 24px; border-radius: 99px; flex: none; padding: 3px; display: flex;
  background: var(--border); justify-content: flex-start; transition: background .2s;
}
.switch-knob { width: 18px; height: 18px; border-radius: 99px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch-btn.on { border-color: var(--warn); }
.switch-btn.on .switch-track { background: var(--warn); justify-content: flex-end; }
.switch-btn.on.pos { border-color: var(--pos); }
.switch-btn.on.pos .switch-track { background: var(--pos); }
.check-btn.auto { border-style: dashed; }
.badge-auto {
  font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 99px; background: rgba(18,163,122,.14); color: var(--pos); flex: none;
}

/* ===== Distribución ===== */
.dist-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.dist-head-text { flex: 1; min-width: 180px; }
.msg {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px;
  margin: 10px 0 18px; font-size: 13px; font-weight: 800;
}
.msg.ok { background: rgba(18,163,122,.14); color: var(--pos); }
.msg.bad { background: rgba(224,164,34,.18); color: var(--warnd); }
.dist-rows { display: flex; flex-direction: column; gap: 18px; }
.dist-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.dist-top .name { font-size: 14px; font-weight: 800; flex: 1; }
.dist-top input[type=number] {
  width: 68px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text); font-size: 14px; font-weight: 800; text-align: right;
}
.dist-top .unit { font-size: 13px; font-weight: 800; color: var(--muted); }
.dist-top .amt { font-size: 15px; font-weight: 800; min-width: 112px; text-align: right; }
.dist-row input[type=range] { width: 100%; }
.compare-rows { display: flex; flex-direction: column; gap: 16px; }
.compare-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.compare-head .val { font-weight: 800; }
.compare-status { font-size: 12px; font-weight: 700; margin-top: 5px; }
.compare-rows .progress { height: 10px; }

/* ===== Registro ===== */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filters-total { text-align: right; min-width: 130px; }
.filters-total-value { font-size: 22px; font-weight: 800; margin-top: 4px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 99px;
  font-size: 13px; font-weight: 700; border: 1px solid;
}
.chip button { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0 2px; }

/* ===== Imprevistos ===== */
.fund-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 6px 0 2px; }
.fund-value { font-size: 38px; font-weight: 800; letter-spacing: -.03em; color: var(--pos); }
.fund-goal { font-size: 15px; font-weight: 700; color: var(--muted); }

/* ===== Usuario en la cabecera ===== */
.user-chip {
  display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 6px 0 6px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
}
.user-avatar {
  width: 30px; height: 30px; border-radius: 9px; background: var(--surface2); color: var(--brand);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; text-transform: uppercase;
}
.user-name { font-size: 13px; font-weight: 700; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-logout {
  height: 30px; padding: 0 10px; border-radius: 9px; border: none; background: transparent;
  color: var(--muted); font-weight: 800; font-size: 12px; cursor: pointer;
}
.user-logout:hover { background: var(--surface2); color: var(--neg); }

/* ===== Pantalla de acceso ===== */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg);
}
.auth-card { width: 100%; max-width: 400px; }
.auth-brand { margin: 0 0 18px; justify-content: center; }
.auth-tabs { display: flex; gap: 6px; padding: 4px; border-radius: 13px; background: var(--surface2); margin-bottom: 18px; }
.auth-tabs .tab { flex: 1; border-color: transparent; }
.auth-fields { display: flex; flex-direction: column; gap: 12px; }
.auth-hint { margin-top: 14px; font-size: 12px; color: var(--muted); font-weight: 600; text-align: center; }

/* ===== Selector de presupuesto ===== */
.budget-select {
  height: 42px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text); font-weight: 700; font-size: 13px; max-width: 220px;
}

/* ===== Invitaciones y recordatorios ===== */
.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-radius: 16px;
  background: var(--warnbg); color: var(--warnd); font-size: 13px; font-weight: 700;
}
.banner .grow { flex: 1; min-width: 200px; }
.banner b { color: var(--text); }
.banner .btn { min-height: 38px; font-size: 13px; padding: 0 14px; }
.reminder { border-color: var(--warn); }
.reminder.overdue { border-color: var(--neg); }
.reminder-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.reminder-title { font-size: 15px; font-weight: 800; flex: 1; min-width: 200px; }
.reminder-title.warn { color: var(--warnd); }
.reminder-title.neg { color: var(--neg); }
.reminder-row { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-top: 1px solid var(--border); }
.reminder-row:first-of-type { margin-top: 10px; }
.reminder-day { font-size: 12px; font-weight: 800; color: var(--muted); width: 58px; flex: none; }
.reminder-row .row-btn.pay { width: auto; padding: 0 12px; color: var(--pos); font-weight: 800; font-size: 12px; }

/* ===== Botón flotante ===== */
.fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 30;
  width: 58px; height: 58px; border-radius: 18px; border: none; background: var(--brand); color: #fff;
  font-size: 30px; font-weight: 800; line-height: 1; cursor: pointer;
  box-shadow: 0 6px 20px rgba(47,109,240,.4), 0 1px 3px rgba(0,0,0,.2);
}
.fab:hover { background: var(--brandd); }
@media (max-width: 600px) { .fab { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); } }

/* ===== Gráficos ===== */
.chart-wrap { overflow-x: auto; margin-top: 14px; }
.chart { width: 100%; min-width: 480px; height: auto; display: block; font-family: inherit; }
.chart text { font-size: 11px; font-weight: 700; fill: var(--muted); }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .limit-line { stroke: var(--neg); stroke-width: 2; stroke-dasharray: 5 4; }
.chart .bar-label { fill: var(--text); font-size: 10px; text-anchor: middle; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; font-weight: 700; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.table-wrap { overflow-x: auto; margin-top: 14px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 8px; border-bottom: 1px solid var(--border); font-weight: 700; white-space: nowrap; }
.table td.num, .table th.num { text-align: right; }
.cat-budget-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.cat-budget-row .name { flex: 1; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.cat-budget-row input {
  width: 120px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text); font-size: 14px; font-weight: 800; text-align: right;
}

/* ===== Metas ===== */
.goals { display: flex; flex-direction: column; gap: 14px; }
.goal { padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface2); }
.goal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.goal-name { font-size: 15px; font-weight: 800; flex: 1; min-width: 140px; }
.goal-amount { font-size: 14px; font-weight: 800; }
.goal-amount span { color: var(--muted); font-weight: 700; }
.goal .progress { margin-top: 10px; background: var(--surface); }
.goal-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.goal-actions input {
  width: 130px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 700;
}
.goal-actions .btn { min-height: 38px; font-size: 13px; padding: 0 14px; }
.goal-done { color: var(--pos); font-size: 12px; font-weight: 800; }

/* ===== Modal: listas ===== */
.modal-list { display: flex; flex-direction: column; margin-top: 12px; max-height: 40vh; overflow: auto; }
.modal-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 13px; font-weight: 700; color: var(--text); }
.modal-row .grow { flex: 1; min-width: 0; }
.modal-row .sub { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.modal-row .row-btn { width: auto; padding: 0 10px; height: 32px; font-size: 12px; font-weight: 800; }
.form-ok { margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--pos); }
.link-btn.w-full { display: block; text-align: center; }

/* ===== Panel de administración ===== */
.admin-table td { white-space: normal; vertical-align: middle; }
.admin-table td.actions { white-space: nowrap; text-align: right; }
.admin-table .row-btn { width: auto; height: 32px; padding: 0 10px; font-size: 12px; font-weight: 800; margin-left: 4px; }
.admin-table .sub { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.pill { display: inline-block; padding: 3px 8px; border-radius: 99px; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.pill.admin { background: rgba(47,109,240,.14); color: var(--brand); }
.pill.susp { background: rgba(224,80,63,.14); color: var(--neg); }
.pill.temp { background: var(--warnbg); color: var(--warnd); }
.pill.ok { background: rgba(18,163,122,.14); color: var(--pos); }
.banner.ok { background: rgba(18,163,122,.14); color: var(--pos); }
.banner.bad { background: rgba(224,80,63,.14); color: var(--neg); }
.notice-bar { background: var(--warnbg); color: var(--warnd); font-size: 13px; font-weight: 700; padding: 10px 16px; text-align: center; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; background: var(--surface2); padding: 8px 10px; border-radius: 10px; display: block; margin-top: 8px; user-select: all; }

/* ===== Móvil (iPhone): sin zoom al enfocar campos, botones más cómodos ===== */
@media (max-width: 768px) {
  input, select, textarea { font-size: 16px !important; }
  .field input.xl { font-size: 18px !important; }
  .main { padding-bottom: 96px; } /* espacio para el botón flotante */
  .topbar-inner { padding-top: max(12px, env(safe-area-inset-top)); }
  .topbar-row { gap: 8px; }
  .month-nav { order: 10; flex: 1 1 100%; justify-content: space-between; }
  .month-label { flex: 1; min-width: 0; }
  .budget-select { order: 9; flex: 1 1 100%; max-width: none; }
  .theme-btn { height: 38px; padding: 0 10px; }
  .user-chip { height: 38px; }
  .user-avatar { width: 26px; height: 26px; }
  .user-name { max-width: 80px; }
  .tabs { scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
}
@media (max-width: 480px) {
  .title { display: none; } /* en el teléfono basta el logo; el nombre ya está en la pantalla de inicio */
  .row-btn { width: 40px; height: 40px; }
  .footer-group + .footer-group { margin-left: 0; }
}
/* Instalada en pantalla de inicio (standalone): sin selección accidental de texto en botones */
@media (display-mode: standalone) {
  button, .tab { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  .topbar { padding-top: env(safe-area-inset-top); }
}

/* ===== Ajustes (lista de acciones) ===== */
.settings-card { padding: 6px 6px 6px; }
.settings-title {
  font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  padding: 10px 12px 6px;
}
.settings-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 12px;
  border: none; border-radius: 12px; background: transparent; color: var(--text); text-align: left;
  font-family: inherit; cursor: pointer; text-decoration: none;
}
.settings-row + .settings-row { border-top: 1px solid var(--border); border-radius: 0 0 12px 12px; }
.settings-row:hover { background: var(--surface2); }
.settings-icon {
  width: 36px; height: 36px; border-radius: 11px; flex: none; display: grid; place-items: center;
  font-size: 17px; background: var(--surface2);
}
.settings-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.settings-text b { font-size: 15px; font-weight: 800; }
.settings-text small { font-size: 12px; color: var(--muted); font-weight: 600; }
.settings-row .chev { color: var(--muted); font-size: 20px; font-weight: 700; flex: none; }
.settings-row.danger b { color: var(--neg); }
.settings-row.danger .settings-icon { background: rgba(224,80,63,.12); }
.save-line { font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; padding: 4px 0 0; }
.save-line.ok { color: var(--pos); }
.save-line.bad { color: var(--neg); }

/* ===== Pie ===== */
.footer-box {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 16px;
  border-radius: 16px; border: 1px dashed var(--border);
}
.footer-text { flex: 1 1 100%; font-size: 12px; font-weight: 700; color: var(--muted); }
.footer-text.ok { color: var(--pos); }
.footer-text.bad { color: var(--neg); }
.footer-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.footer-group + .footer-group { margin-left: auto; }
.footer-label {
  font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-right: 4px;
}
.footer-group .btn { min-height: 40px; font-size: 13px; padding: 0 14px; }
.btn-danger { background: var(--neg); color: #fff; }

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(16,20,24,.55); backdrop-filter: blur(2px);
}
.modal-card { width: 100%; max-width: 420px; }
.modal-card .section-sub { line-height: 1.45; }
.modal-card .section-sub b { color: var(--text); }
