:root {
  --bg: #f4f6f3; --panel: #fff; --ink: #1c2220; --muted: #66706a; --line: #e2e7e3;
  --green: #0f6b4c; --green-hover: #0b5a3f; --mint: #7eebc1; --lime: #eef8c4; --tint: #e5f6ed; --tint-ink: #0d5a40; --pale: #e5f6ed; --ok: #1a8a5a; --red: #c2483b; --amber: #c98a1b;
  --brand-gradient: linear-gradient(135deg, #7eebc1 0%, #c9f4b6 55%, #eef8c4 100%);
  --grid: #e8ebe6; --baseline: #c3c8c1; --shadow: 0 8px 26px #2533270a;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.4 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; }
body.no-scroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 2px solid #1f9a6b; outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Estructura */
.shell { min-height: 100vh; display: flex; }
.sidebar { width: 246px; background: #fff; border-right: 1px solid var(--line); padding: 24px 16px 16px; display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 15; overflow-y: auto; }
.brand { display: flex; gap: 11px; align-items: center; border: 0; text-align: left; color: var(--ink); padding: 14px 14px; margin: 0 0 20px; border-radius: 14px; background: var(--brand-gradient); box-shadow: inset 0 0 0 1px #ffffff99, 0 8px 22px -10px #1f9a6b66; font: 800 19px/1.1 Manrope, sans-serif; letter-spacing: -.4px; width: 100%; }
.brand small { display: block; font: 700 9px 'DM Sans', sans-serif; letter-spacing: 1.6px; color: #1c2220a6; margin-top: 4px; }
.brandmark { width: 34px; height: 34px; border-radius: 10px; background: #ffffff8c; display: grid; place-items: center; flex: none; }
.brandmark svg { width: 20px; height: 20px; display: block; }
.sidebar nav { display: grid; gap: 3px; }
.nav-item { border: 0; background: transparent; color: #626b63; text-align: left; padding: 10px 12px; border-radius: 9px; display: flex; align-items: center; gap: 12px; min-height: 42px; }
.nav-item i { font-style: normal; font-size: 17px; width: 20px; text-align: center; }
.nav-item span { font-size: 14px; font-weight: 500; }
.nav-item:hover, .nav-item.active { background: var(--tint); color: var(--green); }
.nav-item.active span { font-weight: 700; }
.side-bottom { margin-top: auto; padding-top: 16px; }
.sync-card { border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; margin-bottom: 12px; }
.sync-line { display: flex; gap: 8px; align-items: center; font-size: 12px; }
.sync-line i { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); flex: none; }
.sync-card small { display: block; margin: 5px 0 0 16px; color: var(--muted); font-size: 11px; }
.profile { width: 100%; border: 0; border-top: 1px solid var(--line); background: none; padding: 12px 3px 0; display: flex; align-items: center; gap: 9px; text-align: left; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--pale); color: var(--green); font-weight: 700; display: grid; place-items: center; flex: none; }
.profile-info { min-width: 0; flex: 1; }
.profile-info b, .profile-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-info b { font-size: 12px; }
.profile-info small { font-size: 11px; color: var(--muted); }
.profile-more { font-size: 20px; color: var(--muted); }
.scrim { position: fixed; inset: 0; background: #1c222066; z-index: 14; }
.main { margin-left: 246px; padding: 28px 40px 18px; width: calc(100% - 246px); max-width: 1600px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 1.2px; margin-bottom: 5px; }
.topbar h1 { font: 700 26px Manrope, sans-serif; margin: 0; letter-spacing: -.6px; }
.top-actions { display: flex; gap: 12px; align-items: center; }
.period { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; background: #fff; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; }
.period select { border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; font-weight: 600; }
.mobile-menu, .mobile-nav { display: none; }
footer { padding: 24px 2px; color: #8c938a; font-size: 12px; }
footer span { margin: 0 5px; }
.footer-sync { float: right; }

/* Botones */
.primary { background: var(--green); color: #fff; border: 0; border-radius: 8px; padding: 10px 14px; font-size: 13px; font-weight: 600; min-height: 40px; }
.primary:hover:not(:disabled) { background: var(--green-hover); }
.secondary { border: 1px solid var(--line); border-radius: 8px; padding: 9px 13px; background: #fff; color: #4d584f; font-size: 13px; font-weight: 500; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
.secondary:hover:not(:disabled) { background: #f5f7f4; }
.small { min-height: 34px; padding: 6px 11px; font-size: 12px; }
.text-btn { border: 0; background: none; color: var(--green); font-size: 13px; font-weight: 600; padding: 6px 4px; min-height: 32px; }
.text-btn:hover { text-decoration: underline; }
.text-btn.inline { padding: 0; min-height: 0; font-size: inherit; }
.text-btn.negative { color: var(--red); }
.icon-btn { border: 0; background: transparent; font-size: 26px; line-height: 1; color: #6b756d; width: 40px; height: 40px; }
.file-btn { cursor: pointer; }
.actions { display: inline-flex; gap: 6px; }
.quick-actions, .card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* Tarjetas */
.card, .stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.card { padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-title { font: 700 15px Manrope, sans-serif; }
.card-hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
p.card-hint { margin: 10px 0; }
.stack { display: grid; gap: 15px; align-content: start; min-width: 0; }
.welcome { margin-bottom: 14px; border-color: #bfe9d3; background: linear-gradient(135deg, #effcf5, #f8fde9); }

/* Libre para gastar */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; background: radial-gradient(120% 140% at 100% 0%, #1f6b52 0%, transparent 55%), linear-gradient(135deg, #1c2220 0%, #173a2e 100%); color: #fff; border: 0; margin-bottom: 14px; padding: 22px 24px; }
.hero .hero-label { color: var(--mint); opacity: 1; font-weight: 600; }
.hero-bad { background: linear-gradient(135deg, #2a1d1b 0%, #6d2f25 100%); }
.hero-bad .hero-label { color: #ffb4a6; }
.hero-label { font-size: 13px; opacity: .85; }
.hero-value { font: 800 40px/1.15 Manrope, sans-serif; letter-spacing: -1px; margin: 3px 0; }
.hero-sub { font-size: 13px; opacity: .85; }
.hero-side { display: flex; gap: 26px; flex-wrap: wrap; }
.hero-side b { display: block; font: 700 19px Manrope, sans-serif; }
.hero-side small { font-size: 12px; opacity: .85; }

/* Indicadores */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { padding: 16px 18px; min-width: 0; }
.stat-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; color: #5f695f; font-size: 13px; }
.stat-icon { width: 26px; height: 26px; background: #eef6f1; border-radius: 8px; display: grid; place-items: center; color: var(--green); font-size: 14px; flex: none; }
.stat-value { font: 700 23px Manrope, sans-serif; margin-top: 10px; letter-spacing: -.6px; overflow-wrap: anywhere; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-sub.good { color: var(--ok); }
.stat-sub.bad { color: var(--red); }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 15px; margin-top: 16px; }
.lower-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 15px; margin-top: 15px; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.quick { border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; background: #fff; text-align: left; min-width: 0; }
.quick:hover { background: #f7f9f6; }
.quick small { color: var(--muted); font-size: 12px; }
.quick b { display: block; font: 700 15px Manrope, sans-serif; margin-top: 5px; overflow-wrap: anywhere; }
.quick-icon { float: right; color: var(--green); font-size: 15px; }
.legend { display: flex; gap: 14px; color: #5f695f; font-size: 12px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }

/* Listas */
.row-list { display: grid; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid #f0f2ef; min-width: 0; }
.list-row.plain { width: 100%; background: none; border-width: 1px 0 0; text-align: left; }
.row-icon { width: 34px; height: 34px; border-radius: 10px; background: #eef6f1; display: grid; place-items: center; color: var(--green); flex: none; }
.row-meta { flex: 1; min-width: 0; }
.row-meta b, .row-meta small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta b { font-size: 13.5px; font-weight: 600; }
.row-meta small { font-size: 12px; color: var(--muted); margin-top: 2px; }
.row-amount { font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.positive { color: #137a4f; }
.negative { color: #b9473a; }
.empty { text-align: center !important; color: var(--muted); padding: 32px 12px !important; font-size: 13px; }

/* Secciones y tablas */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; flex-wrap: wrap; }
.section-head h2 { font: 700 18px Manrope, sans-serif; margin: 0; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.input-small, .toolbar select { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 9px 10px; color: #4d584f; font-size: 13px; min-height: 40px; }
.table-wrap { overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 11px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 12px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; border-bottom: 1px solid var(--line); font-weight: 700; white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid #f1f2ef; font-size: 13px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .amount { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.more { text-align: center; }
.pill { background: var(--tint); color: var(--tint-ink); border-radius: 20px; padding: 3px 8px; font-size: 11px; white-space: nowrap; }
.progress { height: 6px; border-radius: 9px; background: #eef1ed; overflow: hidden; margin-top: 9px; }
.progress i { display: block; height: 100%; border-radius: 9px; background: #1f9a6b; transition: width .25s; }
.budget-grid, .item-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.list-gap { margin-top: 14px; }
.meter-card { margin-top: 14px; }
.budget-card, .item-card { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 16px; min-width: 0; }
.item-card.muted { opacity: .65; }
.budget-card h3, .item-card h3 { font: 700 14.5px Manrope, sans-serif; margin: 0; overflow-wrap: anywhere; }
.item-card .card-head, .budget-card .card-head { margin-bottom: 2px; }
.budget-num { font: 700 21px Manrope, sans-serif; margin-top: 8px; overflow-wrap: anywhere; }
.budget-num .budget-note { font: 500 13px 'DM Sans', sans-serif; }
.budget-note { color: var(--muted); font-size: 12.5px; margin-top: 6px; line-height: 1.45; }
.alert { color: #a85e23; }
.goal-plan { color: #3c5d48; font-weight: 500; }
.card-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.card-metrics > div { background: #f6f8f5; border-radius: 8px; padding: 9px; min-width: 0; }
.card-metrics small { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 4px; }
.card-metrics b { font: 700 13.5px Manrope, sans-serif; overflow-wrap: anywhere; }
.mini-history { list-style: none; margin: 10px 0 0; padding: 0; border-top: 1px solid #f0f2ef; }
.mini-history li { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 3px 0; color: var(--muted); }
.mini-history li span { flex: 1; min-width: 0; }
.mini-history b { color: var(--ink); white-space: nowrap; }
.status-row { align-items: center; }
.status { font-size: 12.5px; font-weight: 700; margin-right: auto; }
.status-pagado { color: var(--ok); }
.status-pendiente { color: #8a6a21; }
.status-vencido { color: var(--red); }
.status-omitido, .status-inactivo { color: var(--muted); }

/* Gráficos */
.chart { min-width: 0; }
.chart svg { display: block; max-width: 100%; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .base { stroke: var(--baseline); stroke-width: 1; }
.chart .tick { fill: #6f7871; font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover, .chart .hit:focus-visible { fill: #20302512; outline: none; }
.chart .cross-line { stroke: var(--baseline); stroke-width: 1; }
.chart .hit-area { cursor: crosshair; touch-action: pan-y; }
.chart-tip { position: fixed; z-index: 30; pointer-events: none; background: #1c2220; color: #fff; padding: 8px 11px; border-radius: 8px; font-size: 12.5px; line-height: 1.45; white-space: pre-line; box-shadow: 0 6px 18px #0f1a1440; max-width: 260px; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; margin-top: 15px; }
.stats-grid .span-2 { grid-column: 1 / -1; }
.insight-card { margin-top: 15px; }
.insights { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 20px; }
.insights li { display: flex; gap: 10px; padding: 7px 0; font-size: 13.5px; line-height: 1.45; }
.insights p { margin: 0; }
.insights span { color: var(--green); width: 18px; text-align: center; flex: none; }
.donut-wrap { display: grid; grid-template-columns: minmax(190px, 260px) minmax(0, 1fr); gap: 24px; align-items: center; }
.donut svg { margin: 0 auto; }
.slice { cursor: pointer; transition: opacity .15s; outline: none; }
.slice:focus-visible { stroke: var(--ink); stroke-width: 2; }
.slice.dim { opacity: .25; }
.donut-center-name { fill: #5f695f; font-size: 13px; }
.donut-center-value { fill: var(--ink); font: 700 17px Manrope, sans-serif; }
.donut-list { display: grid; gap: 2px; min-width: 0; }
.donut-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 40px; gap: 10px; align-items: center; width: 100%; background: none; border: 0; border-radius: 8px; padding: 9px 8px; text-align: left; font-size: 13.5px; min-height: 40px; transition: opacity .15s; }
.donut-row:hover { background: #f4f6f3; }
.donut-row.dim { opacity: .45; }
.donut-row i { width: 12px; height: 12px; border-radius: 3px; }
.donut-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-row b { font-variant-numeric: tabular-nums; }
.donut-row small { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.donut-link { min-height: 24px; margin-top: 8px; text-align: right; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 38%) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #4d584f; }
.bar-track { height: 8px; background: transparent; border-bottom: 1px solid var(--grid); display: block; }
.bar-track i { display: block; height: 8px; border-radius: 0 4px 4px 0; }
.bar-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-twin { margin-top: 10px; font-size: 13px; }
.table-twin summary { cursor: pointer; color: var(--green); font-weight: 600; padding: 4px 0; }
.table.compact td, .table.compact th { padding: 7px 8px; font-variant-numeric: tabular-nums; }

/* Modal y formularios */
.modal-backdrop { position: fixed; inset: 0; background: #1c2220b3; display: none; align-items: center; justify-content: center; padding: 18px; z-index: 20; }
.modal-backdrop.open { display: flex; }
.modal { width: min(600px, 100%); max-height: 92vh; overflow: auto; background: #fff; border-radius: 15px; padding: 22px; box-shadow: 0 25px 80px #101a1540; overscroll-behavior: contain; }
.modal header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 14px; gap: 10px; }
.modal h2 { font: 700 20px Manrope, sans-serif; margin: 0; overflow-wrap: anywhere; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full, .full { grid-column: 1 / -1; }
.field label, .segmented legend { font-size: 12.5px; color: #4f5a50; font-weight: 600; }
.field label { display: block; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #d9ded7; border-radius: 8px; padding: 10px; background: #fff; font-size: 14px; color: var(--ink); min-height: 42px; }
.field textarea { margin-top: 5px; font-weight: 400; display: block; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #1f9a6b; outline: 2px solid #c9eedc; }
.hint { color: var(--muted); font-size: 11.5px; }
.check-field { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #48534a; min-height: 32px; }
.check-field input { width: 18px; height: 18px; flex: none; }
.divider { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; font-size: 13px; }
.segmented { border: 0; padding: 0; margin: 0; flex-direction: row; flex-wrap: wrap; gap: 8px; }
.segmented legend { padding: 0; margin-bottom: 6px; }
.segmented label { flex: 1 1 140px; cursor: pointer; display: block; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.segmented span { display: block; text-align: center; border: 1px solid #d9ded7; border-radius: 8px; padding: 10px; font-size: 13.5px; color: #4d584f; font-weight: 500; }
.segmented input:checked + span { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid #1f9a6b; outline-offset: 2px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.form-danger { margin-top: 10px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: #1c2220; color: #fff; padding: 11px 17px; border-radius: 9px; font-size: 13.5px; opacity: 0; transition: .2s; z-index: 40; pointer-events: none; width: max-content; max-width: min(92vw, 520px); text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 1100px) {
  .sidebar { width: 210px; }
  .main { margin-left: 210px; width: calc(100% - 210px); padding: 24px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .budget-grid, .item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .lower-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; width: 270px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .sidebar.open { transform: translateX(0); }
  .main { margin: 0; width: 100%; padding: calc(14px + env(safe-area-inset-top)) 16px calc(90px + env(safe-area-inset-bottom)); }
  .topbar { flex-wrap: wrap; margin-bottom: 14px; gap: 10px; }
  .top-title { flex: 1; min-width: 0; }
  .topbar h1 { font-size: 22px; }
  .eyebrow { font-size: 10px; }
  .mobile-menu { display: block; border: 1px solid var(--line); background: #fff; border-radius: 8px; width: 40px; height: 40px; color: var(--ink); flex: none; }
  .top-actions { width: 100%; }
  .period { width: 100%; justify-content: space-between; }
  .period select { font-size: 16px; text-align: right; }
  .add-desktop { display: none; }
  .hero { padding: 18px; }
  .hero-value { font-size: 34px; }
  .hero-side { gap: 18px; width: 100%; border-top: 1px solid #ffffff33; padding-top: 12px; }
  .hero-side > div { flex: 1 1 120px; }
  .stats, .stats-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .stats-3 .stat:first-child { grid-column: 1 / -1; }
  .stat { padding: 13px; }
  .stat-value { font-size: 19px; }
  .card { padding: 15px; }
  .budget-grid, .item-grid { grid-template-columns: minmax(0, 1fr); }
  .section-head { align-items: stretch; flex-direction: column; }
  .section-head > .primary { width: 100%; }
  .toolbar { width: 100%; }
  .toolbar .input-small { flex: 1 1 100%; font-size: 16px; }
  .toolbar select { flex: 1 1 100%; font-size: 16px; }
  .toolbar > button, .toolbar > label { flex: 1 1 auto; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-actions > * { flex: 1 1 auto; }
  /* iOS hace zoom en campos con letra menor a 16px. */
  .field input, .field select, .field textarea { font-size: 16px; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { border-radius: 16px 16px 0 0; max-height: 94vh; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); width: 100%; }
  .toast { bottom: calc(82px + env(safe-area-inset-bottom)); }
  .footer-sync { display: none; }
  .stats-grid { grid-template-columns: minmax(0, 1fr); }
  .donut-wrap { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  /* Movimientos: tabla convertida en tarjetas. */
  .table:not(.compact) thead { display: none; }
  .table:not(.compact), .table:not(.compact) tbody, .table:not(.compact) tr { display: block; }
  .table:not(.compact) tr { padding: 10px 12px; border-bottom: 1px solid #edf0ec; }
  .table:not(.compact) tr:last-child { border-bottom: 0; }
  .table:not(.compact) td { display: flex; justify-content: space-between; gap: 14px; padding: 3px 0; border: 0; text-align: right; }
  .table:not(.compact) td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; }
  .table:not(.compact) td.blank { display: none; }
  .table:not(.compact) td.cell-actions { justify-content: flex-end; }
  .table:not(.compact) td.empty, .table:not(.compact) td.more { display: block; text-align: center; }
  .mobile-nav { display: flex; position: fixed; inset: auto 0 0; background: #fff; border-top: 1px solid var(--line); justify-content: space-around; align-items: center; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
  .mobile-nav button { flex: 1; border: 0; background: none; color: #667067; font-size: 11px; display: grid; justify-items: center; gap: 1px; min-height: 48px; align-content: center; }
  .mobile-nav button.active { color: var(--green); font-weight: 700; }
  .mobile-nav b { font-size: 18px; font-weight: 400; }
  .mobile-nav .mobile-add { flex: 0 0 52px; width: 52px; height: 52px; min-height: 52px; border-radius: 50%; background: var(--green); color: #fff; margin: -18px 4px 0; box-shadow: 0 6px 16px #0f6b4c55; }
  .mobile-nav .mobile-add b { font-size: 22px; }
}
@media (max-width: 460px) {
  .card-metrics { grid-template-columns: minmax(0, 1fr); }
  .card-metrics > div { display: flex; justify-content: space-between; align-items: center; }
  .card-metrics small { margin: 0; }
  .bar-row { grid-template-columns: minmax(0, 1fr) auto; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
