:root {
  --bg: #f2f4ef;
  --surface: #ffffff;
  --surface-2: #eef1eb;
  --surface-3: #e4e9e0;
  --text: #1e261f;
  --muted: #6f786f;
  --line: #dde3da;
  --line-2: #e3e8df;
  --green: #2f7d4a;
  --green-2: #e2f1e6;
  --green-ring: #c9e5d2;
  /* Gasto en terracota, no en rojo: el rojo antiguo (#c94e4e) y el verde de ingresos
     se distinguían con un margen de 4,9 en daltonismo rojo-verde (el mínimo sano es 8).
     Este terracota llega a 8,3 y mantiene el aire cálido de la paleta. */
  --red: #c2410c;
  --red-2: #fbe8de;
  --red-ring: #f4d8c7;
  --danger: #b3382f;
  --danger-2: #f8e4e4;
  --amber: #b77a22;
  --amber-2: #fdf1dc;
  /* Categorías: cinco tonos validados (todos los pares entre sí, también en daltonismo)
     más gris para "Otros", que es un cajón de sastre y no merece color propio. */
  --cat-1: #2563a8;
  --cat-2: #c2410c;
  --cat-3: #2f7d4a;
  --cat-4: #8b5cf6;
  --cat-5: #c28f2a;
  --cat-6: #8a938a;
  /* Relieve: contacto + media + ambiental, más una línea de luz arriba. */
  --shadow: 0 1px 2px rgba(29,41,31,.05), 0 5px 12px rgba(29,41,31,.05), 0 16px 34px rgba(29,41,31,.08), inset 0 1px 0 #ffffff;
  --shadow-sm: 0 1px 2px rgba(29,41,31,.05), 0 3px 8px rgba(29,41,31,.05), 0 9px 18px rgba(29,41,31,.055), inset 0 1px 0 #ffffff;
  --shadow-btn: 0 1px 2px rgba(29,41,31,.1), 0 4px 10px rgba(29,41,31,.08), inset 0 1px 0 #ffffff;
  --shadow-in: inset 0 1px 3px rgba(29,41,31,.09);
  --radius: 20px;
  --font-display: Fraunces, Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; }
.app-column { min-height: 100vh; padding-bottom: 82px; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px 12px;
  background: rgba(245, 246, 242, 0.93);
  backdrop-filter: blur(18px);
}
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 13px;
  background: linear-gradient(145deg, #3b8d57, #246b3e);
  display: grid; place-items: center; color: white; font-weight: 800;
  box-shadow: 0 8px 18px rgba(47,125,74,.18);
}
.brand-title { font-weight: 800; font-size: 1.1rem; }
.brand-subtitle { color: var(--muted); font-size: .78rem; margin-top: 1px; }
.icon-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center;
}
.main-content { padding: 0 16px 24px; max-width: 1180px; margin: 0 auto; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 16px; }
.page-title { margin: 0; font-size: 1.55rem; letter-spacing: -.03em; }
.page-subtitle { color: var(--muted); font-size: .9rem; margin-top: 4px; }

.grid { display: grid; gap: 12px; }
.summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px;
}
.metric-label { color: var(--muted); font-size: .78rem; }
.metric-value { font-weight: 800; font-size: 1.35rem; letter-spacing: -.03em; margin-top: 6px; }
.metric-value.positive { color: var(--green); }
.metric-value.negative { color: var(--red); }
.metric-meta { color: var(--muted); font-size: .72rem; margin-top: 4px; }

.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin: 14px 0 18px; }
.action-btn {
  border: 0; border-radius: 18px; padding: 15px 8px; font-weight: 800;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.action-btn .action-icon { font-size: 1.4rem; }
.action-income { background: var(--green); color: #fff; box-shadow: 0 1px 2px rgba(29,41,31,.16), 0 5px 12px rgba(47,125,74,.24), 0 12px 24px rgba(47,125,74,.18), inset 0 1px 0 rgba(255,255,255,.26); }
.action-expense { background: var(--red); color: #fff; box-shadow: 0 1px 2px rgba(29,41,31,.16), 0 5px 12px rgba(194,65,12,.24), 0 12px 24px rgba(194,65,12,.18), inset 0 1px 0 rgba(255,255,255,.26); }
.action-transfer { background: #e9ece5; color: #333f35; border: 1px solid #d5dcd2; box-shadow: var(--shadow-btn); }

.section { margin-top: 18px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; gap: 12px; }
.section-title { font-size: 1rem; font-weight: 800; }
.link-btn { border: 0; background: transparent; color: var(--green); font-weight: 700; padding: 4px; }

.movement-list { display: grid; gap: 8px; }
.movement-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 11px; align-items: center;
  padding: 13px 14px; border: 1px solid var(--line-2); border-radius: 17px; background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.movement-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; background: var(--surface-2); }
.movement-main { min-width: 0; }
.movement-title { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.movement-meta { color: var(--muted); font-size: .76rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.movement-actions { display: flex; gap: 5px; margin-top: 7px; }
.tappable-row { cursor: pointer; transition: background .15s ease, transform .15s ease; }
.tappable-row:active { background: var(--surface-2); transform: scale(.995); }
.tappable-row:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.amount { font-weight: 800; text-align: right; }
.amount.expense { color: var(--red); }
.amount.income { color: var(--green); }
.amount.transfer { color: var(--text); }
.date-mini { color: var(--muted); font-size: .68rem; margin-top: 3px; text-align: right; }

.bottom-nav {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  padding: 8px max(8px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.96); backdrop-filter: blur(18px); border-top: 1px solid var(--line);
}
.bottom-nav::-webkit-scrollbar { display: none; }
.nav-btn { flex: 1 0 66px; border: 0; background: transparent; color: var(--muted); border-radius: 13px; padding: 6px 2px; font-size: .64rem; font-weight: 700; display: flex; flex-direction: column; gap: 3px; align-items: center; }
.nav-btn .nav-icon { font-size: 1.15rem; }
.nav-btn.active { color: var(--green); background: var(--green-2); }
.desktop-sidebar { display: none; }

.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 5px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter-select, .field select, .field input, .field textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 14px; padding: 12px 13px; outline: none;
}
.filter-select { width: auto; min-width: 130px; padding: 9px 12px; font-size: .82rem; }
.search-box { position: relative; }
.search-box input { width: 100%; border: 1px solid var(--line); border-radius: 15px; padding: 12px 14px 12px 40px; background: #fff; }
.search-box::before { content: "⌕"; position: absolute; left: 14px; top: 8px; font-size: 1.35rem; color: var(--muted); }

.account-group { padding: 0; overflow: hidden; }
.account-head { padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.account-name { font-weight: 850; }
.account-balance { font-weight: 850; color: var(--green); }
.subaccounts { border-top: 1px solid var(--line); }
.subaccount-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid #edf0eb; }
.subaccount-row:last-child { border-bottom: 0; }
.subaccount-name { color: #3f493f; }
.row-edit-icon { width: 40px; height: 40px; flex: 0 0 auto; border: 0; border-radius: 13px; display: grid; place-items: center; background: var(--surface-2); color: #4a5a4c; box-shadow: var(--shadow-btn); }
.row-edit-icon .lucide-icon { width: 18px; height: 18px; }
.account-page-icon.small { width: 36px; height: 36px; border-radius: 11px; }
.compact-account-list { gap: 12px; }

.primary-btn, .secondary-btn, .danger-btn {
  border-radius: 15px; padding: 12px 15px; font-weight: 800; border: 0;
}
.primary-btn { background: var(--green); color: #fff; }
.secondary-btn { background: var(--surface-2); color: var(--text); }
.danger-btn { background: var(--danger-2); color: var(--danger); }
.fab {
  position: fixed; right: 18px; bottom: 92px; z-index: 15; border: 0; border-radius: 999px;
  padding: 13px 17px; background: var(--green); color: #fff; font-weight: 850; box-shadow: 0 12px 30px rgba(47,125,74,.25);
}

.report-grid { display: grid; gap: 12px; margin-top: 12px; }
.chart-card { min-height: 220px; }
.bar-chart { display: grid; gap: 12px; margin-top: 14px; }
.bar-row { display: grid; grid-template-columns: 105px 1fr auto; gap: 8px; align-items: center; font-size: .8rem; }
.bar-track { height: 11px; border-radius: 999px; background: var(--surface-2); overflow: hidden; box-shadow: inset 0 1px 2px rgba(29,41,31,.08); }
.bar-fill { height: 100%; border-radius: inherit; background: var(--red); }
.donut-wrap { display: grid; place-items: center; min-height: 190px; }
.donut { width: 145px; height: 145px; border-radius: 50%; display: grid; place-items: center; }
.donut-hole { width: 92px; height: 92px; border-radius: 50%; background: #fff; display: grid; place-items: center; text-align: center; box-shadow: inset 0 0 0 1px var(--line); }
.donut-main { font-weight: 900; font-size: 1.02rem; }
.donut-sub { color: var(--muted); font-size: .7rem; }
.legend { display: flex; justify-content: center; gap: 14px; color: var(--muted); font-size: .75rem; flex-wrap: wrap; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.line-chart { width: 100%; height: 190px; margin-top: 8px; }
.tags-list { display: grid; gap: 8px; }
.tag-rank { display: grid; grid-template-columns: 24px 1fr auto; gap: 9px; align-items: center; padding: 9px 0; border-bottom: 1px solid #eef1ec; }
.tag-rank:last-child { border-bottom: 0; }
.rank-num { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 9px; background: var(--green-2); color: var(--green); font-weight: 900; font-size: .75rem; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(26, 32, 27, .42); display: flex; align-items: flex-end; justify-content: center; }
.modal-backdrop.hidden { display: none; }
.modal {
  width: min(720px, 100%); max-height: 92vh; overflow-y: auto; background: var(--bg);
  border-radius: 26px 26px 0 0; padding: 17px 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -18px 60px rgba(15, 22, 16, .18);
}
.modal-handle { width: 44px; height: 5px; border-radius: 999px; background: #ccd3ca; margin: 0 auto 14px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.modal-title { margin: 0; font-size: 1.25rem; }
.form-grid { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; }
.field label { font-size: .76rem; color: var(--muted); font-weight: 750; }
.field textarea { min-height: 84px; resize: vertical; }
.form-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 9px; margin-top: 8px; }
.form-actions.edit-form-actions { grid-template-columns: auto 1fr 1.35fr; }
.movement-form-actions { position: sticky; z-index: 5; bottom: calc(-18px - env(safe-area-inset-bottom)); margin: 2px -16px calc(-18px - env(safe-area-inset-bottom)); padding: 12px 16px calc(18px + env(safe-area-inset-bottom)); background: linear-gradient(to bottom, rgba(246,248,243,.92), var(--bg) 24%); backdrop-filter: blur(12px); border-top: 1px solid var(--line-2); }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 7px 10px; background: var(--green-2); color: #35583f; font-size: .78rem; font-weight: 700; }
.helper { color: var(--muted); font-size: .72rem; }
.inline-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.empty-state { padding: 28px 18px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 18px; background: rgba(255,255,255,.6); }
.demo-banner { background: #fff7df; border: 1px solid #f0ddb0; color: #72541f; padding: 11px 13px; border-radius: 15px; font-size: .8rem; display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 12px; }

.settings-list { display: grid; gap: 10px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 15px; background: #fff; border: 1px solid var(--line); border-radius: 17px; }
.setting-title { font-weight: 800; }
.setting-sub { color: var(--muted); font-size: .75rem; margin-top: 2px; }
.small-count { min-width: 30px; text-align: center; font-weight: 850; color: var(--green); }

.toast { position: fixed; z-index: 120; left: 50%; bottom: 98px; transform: translate(-50%, 20px); background: #1f2c22; color: #fff; padding: 11px 15px; border-radius: 13px; opacity: 0; pointer-events: none; transition: .2s ease; font-weight: 700; font-size: .82rem; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 820px) {
  .app-shell { display: grid; grid-template-columns: 230px 1fr; }
  .desktop-sidebar { display: block; position: sticky; top: 0; height: 100vh; padding: 22px 15px; border-right: 1px solid var(--line); background: rgba(255,255,255,.82); backdrop-filter: blur(18px); }
  .app-column { padding-bottom: 0; }
  .bottom-nav { display: none; }
  .topbar { padding: 18px 26px 10px; }
  .main-content { padding: 4px 26px 38px; }
  .sidebar-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; padding: 0 8px; }
  .sidebar-nav { display: grid; gap: 6px; }
  .sidebar-btn { border: 0; background: transparent; color: var(--muted); border-radius: 13px; padding: 11px 12px; display: flex; align-items: center; gap: 10px; font-weight: 750; text-align: left; }
  .sidebar-btn.active { color: var(--green); background: var(--green-2); }
  .summary-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .quick-actions { max-width: 620px; }
  .report-grid { grid-template-columns: 1.15fr .85fr; }
  .report-grid .full { grid-column: 1 / -1; }
  .modal-backdrop { align-items: center; padding: 20px; }
  .modal { border-radius: 26px; max-height: 88vh; padding: 22px; }
  .fab { bottom: 28px; right: 28px; }
  .form-grid.two-col { grid-template-columns: 1fr 1fr; }
  .form-grid.two-col .span-2 { grid-column: 1 / -1; }
}
.inline-row input { width: 100%; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 14px; padding: 12px 13px; outline: none; }

.hidden { display: none !important; }
.mode-pill, .linked-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 7px; background: #fff0bb; color: #76520d; font-size: .62rem; font-weight: 900; vertical-align: middle; }
.linked-pill { background: #e7edf8; color: #40547a; }
.demo-banner.compact { margin-top: -4px; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.mini-btn { border: 0; border-radius: 10px; padding: 7px 8px; background: var(--surface-2); color: var(--text); font-size: .72rem; font-weight: 750; }
.danger-text { color: var(--danger); }
.padded { padding: 0 16px 14px; }
.configurable-metric { position: relative; }
.metric-config { position: absolute; top: 10px; right: 10px; border: 0; border-radius: 10px; width: 30px; height: 30px; background: var(--surface-2); color: var(--green); }
.metric-link { border: 0; padding: 0; background: transparent; color: var(--green); cursor: pointer; text-align: left; }
.picker-field { position: relative; }
.picker-trigger { width: 100%; min-height: 45px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--line); border-radius: 14px; padding: 11px 13px; background: #fff; color: var(--text); text-align: left; }
.picker-trigger b { color: var(--green); }
.picker-panel { position: relative; z-index: 12; display: grid; gap: 7px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.picker-panel > input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fafbf9; }
.picker-options { display: grid; gap: 4px; max-height: 220px; overflow-y: auto; }
.picker-options button { display: flex; align-items: center; gap: 9px; border: 0; border-radius: 11px; padding: 10px; background: transparent; color: var(--text); text-align: left; }
.picker-options button:hover { background: var(--green-2); }
.quick-picks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.quick-pick { min-width: 0; display: grid; place-items: center; gap: 3px; border: 1px solid var(--line); border-radius: 13px; padding: 9px 5px; background: #fff; color: var(--muted); }
.quick-pick > span { font-size: 1.15rem; }
.quick-pick small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-pick.selected { border-color: #82b491; background: var(--green-2); color: var(--green); }
.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.setting-row { width: 100%; text-align: left; color: inherit; }
.setting-row > span:first-child { display: grid; }
.manager-card { box-shadow: none; }
.manager-list { display: grid; gap: 6px; margin: 10px 0; }
.manager-list > div { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.manager-list > div > span { display: grid; gap: 2px; }
.manager-list small { color: var(--muted); }
.check-list { display: grid; gap: 7px; }
.check-list label { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.check-list input { width: 19px; height: 19px; accent-color: var(--green); }
.debt-card h3 { margin: 8px 0 0; }
.type-badge, .status-pill { display: inline-flex; border-radius: 999px; padding: 5px 8px; font-size: .68rem; font-weight: 850; background: var(--red-2); color: var(--red); }
.type-badge.receivable { background: var(--green-2); color: var(--green); }
.status-pill { background: #fff4d5; color: #80601c; }
.status-pill.done { background: var(--green-2); color: var(--green); }
.debt-numbers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.debt-numbers div { display: grid; gap: 3px; }
.debt-numbers small { color: var(--muted); font-size: .68rem; }
.debt-numbers strong { font-size: .9rem; }
.info-box, .result-box { background: var(--green-2); border: 1px solid #cde2d2; border-radius: 14px; padding: 12px; color: #35583f; font-size: .85rem; }
.utility-grid { display: grid; gap: 12px; }
.result-box { font-weight: 750; }
button:disabled { opacity: .45; cursor: not-allowed; }

@media (min-width: 700px) {
  .utility-grid { grid-template-columns: 1fr 1fr; }
  .utility-grid .full { grid-column: 1 / -1; }
  .quick-picks { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* ============================================================
   REDISEÑO 2026-09 · bloques de la pantalla de inicio
   ============================================================ */

.home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 16px; }
.home-month { color: var(--muted); font-size: .8rem; font-weight: 600; }
.home-hello { font-size: 1.15rem; font-weight: 700; letter-spacing: -.015em; margin-top: 1px; }

.hero-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 22px; padding: 20px; box-shadow: var(--shadow); }
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.hero-label { font-size: .72rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.hero-amount { font-family: var(--font-display); font-size: 2.6rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.05; margin-top: 8px; }
.hero-delta { display: inline-flex; align-items: center; gap: 4px; font-size: .82rem; font-weight: 700; padding: 4px 9px; border-radius: 999px; }
.hero-delta.up { background: var(--green-2); color: #215838; }
.hero-delta.down { background: var(--red-2); color: #7c2d09; }
.hero-delta-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.hero-foot { width: 100%; margin-top: 14px; padding: 13px 0 0; border: 0; border-top: 1px solid var(--surface-2); background: transparent; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .78rem; color: #4a5a4c; font-weight: 600; text-align: left; }
.hero-foot b { color: var(--green); }
.hero-gear { width: 30px; height: 30px; margin: -5px -4px 0 0; border: 0; border-radius: 10px; background: var(--surface-2); color: #4a5a4c; display: grid; place-items: center; box-shadow: 0 1px 2px rgba(29,41,31,.07), inset 0 1px 0 #fff; }

.seg { display: inline-grid; grid-auto-flow: column; gap: 3px; background: var(--surface-3); border-radius: 12px; padding: 3px; box-shadow: var(--shadow-in); }
.seg-btn { border: 0; border-radius: 9px; height: 34px; padding: 0 15px; background: transparent; color: var(--muted); font-size: .8rem; font-weight: 700; }
.seg-btn.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(29,41,31,.16), inset 0 1px 0 #fff; }
.seg.icons .seg-btn { width: 38px; padding: 0; display: grid; place-items: center; }

.lucide-icon { display: inline-block; width: 1.15em; height: 1.15em; flex: 0 0 auto; background: currentColor; -webkit-mask: var(--lucide-url) center / contain no-repeat; mask: var(--lucide-url) center / contain no-repeat; vertical-align: -.17em; }
.nav-icon .lucide-icon, .sidebar-btn .lucide-icon { width: 1.2rem; height: 1.2rem; }

.acc-slider { display: flex; gap: 11px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.acc-slider::-webkit-scrollbar { display: none; }
.acc-card { flex: 0 0 auto; min-width: 136px; text-align: left; background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; padding: 13px 14px; box-shadow: var(--shadow-sm); color: inherit; }
.acc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.acc-icon { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-size: .8rem; font-weight: 800; box-shadow: 0 1px 3px rgba(29,41,31,.1); }
.acc-icon.has-brand, .acc-pick-icon.has-brand, .acc-grid-icon.has-brand, .account-page-icon.has-brand { background: #fff !important; overflow: hidden; padding: 4px; }
.account-brand-logo { width: 100%; height: 100%; object-fit: contain; display: block; }
.account-summary { display: flex; align-items: center; gap: 11px; min-width: 0; }
.account-page-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: 0 0 auto; font-size: .8rem; font-weight: 800; }
.subaccount-name { display: flex; align-items: center; gap: 7px; }
.acc-sub-pill { font-size: .62rem; font-weight: 700; color: var(--muted); background: var(--surface-2); padding: 3px 7px; border-radius: 999px; }
.acc-name { font-size: .76rem; color: var(--muted); margin-top: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-balance { font-size: 1.05rem; font-weight: 800; letter-spacing: -.02em; margin-top: 1px; }
.acc-balance small { display: block; font-size: .68rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }

.panel { background: var(--surface); border: 1px solid var(--line-2); border-radius: 22px; padding: 18px 16px 16px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-title { font-size: .95rem; font-weight: 700; }
.panel-sub { font-size: .75rem; color: var(--muted); margin-top: 2px; }

.cat-list { display: grid; gap: 12px; margin-top: 18px; }
.cat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.cat-name { display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; font-weight: 600; }
.cat-dot { width: 9px; height: 9px; border-radius: 3px; }
.cat-value { font-size: .82rem; font-weight: 700; color: #4a5a4c; }
.cat-fill { height: 11px; border-radius: 999px; box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }

.donut-row { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.donut-svg { width: 132px; height: 132px; flex: 0 0 auto; filter: drop-shadow(0 5px 12px rgba(29,41,31,.18)); }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut-total { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.donut-wrap-2 { position: relative; width: 132px; height: 132px; flex: 0 0 auto; }
.donut-legend { flex: 1 1 auto; display: grid; gap: 8px; min-width: 0; }
.donut-legend > div { display: flex; align-items: center; gap: 8px; }
.donut-legend span.nm { flex: 1 1 auto; font-size: .78rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend span.vl { font-size: .78rem; font-weight: 700; color: #4a5a4c; }

.series-chips { display: flex; gap: 8px; margin-top: 13px; }
.series-chip { height: 32px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--text); font-size: .78rem; font-weight: 700; display: inline-flex; align-items: center; gap: 7px; box-shadow: var(--shadow-btn); }
.series-chip.off { background: var(--surface-2); color: #9aa39a; border-color: var(--line-2); box-shadow: inset 0 1px 3px rgba(29,41,31,.07); }
.series-chip .dot { width: 9px; height: 9px; border-radius: 3px; background: #c3cbc2; }

.months-chart { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; height: 110px; margin-top: 14px; }
.months-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.months-bars { display: flex; align-items: flex-end; gap: 3px; height: 88px; }
.months-bar { border-radius: 4px 4px 0 0; box-shadow: inset 0 1px 0 rgba(255,255,255,.28); }
.months-label { font-size: .68rem; color: var(--muted); }

.mov-card { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; padding: 13px 15px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-sm); color: inherit; }
.mov-list { display: grid; gap: 10px; }
.mov-icon { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 auto; }
.mov-main { flex: 1 1 auto; min-width: 0; }
.mov-title { font-size: .9rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mov-meta { font-size: .74rem; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mov-right { text-align: right; flex: 0 0 auto; }
.mov-amount { font-size: .94rem; font-weight: 800; }
.mov-date { font-size: .68rem; color: var(--muted); }

.home-stack { display: grid; gap: 16px; }

/* ============================================================
   REDISEÑO 2026-09 · pantalla de nuevo movimiento
   ============================================================ */

.modal { position: relative; }
.field-label { display: block; font-size: .72rem; font-weight: 700; color: #4a5a4c; margin-bottom: 6px; }
.movement-form { display: grid; gap: 16px; }
.type-seg { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); width: 100%; margin-bottom: 14px; }
.type-seg .seg-btn { width: 100%; padding: 0; }

.amount-row { display: flex; gap: 11px; align-items: flex-start; }
.amount-box { flex: 1 1 auto; background: var(--surface); border: 1.5px solid var(--line); border-radius: 18px; padding: 12px 14px 11px; box-shadow: var(--shadow-sm); }
.amount-line { display: flex; align-items: baseline; gap: 6px; }
.amount-line input { flex: 1 1 auto; width: 100%; min-width: 0; border: 0; outline: none; background: transparent; font-size: 2rem; font-weight: 800; letter-spacing: -.03em; color: var(--text); padding: 0; -moz-appearance: textfield; }
.amount-line input::-webkit-outer-spin-button, .amount-line input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.amount-symbol { font-size: 1.25rem; font-weight: 700; color: #4a5a4c; }
.movement-form.is-expense .amount-box { border-color: var(--red); }
.movement-form.is-income .amount-box { border-color: var(--green); }
.movement-form.is-transfer .amount-box { border-color: var(--amber); }
.movement-form.is-expense .save-btn { background: var(--red); }
.movement-form.is-transfer .save-btn { background: var(--amber); }
.date-box { width: 128px; flex: 0 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px 12px 11px; box-shadow: var(--shadow-sm); }
.date-box input { width: 100%; border: 0; outline: none; background: transparent; font-size: .95rem; font-weight: 600; color: var(--text); padding: 0; }

.pick-block { display: grid; gap: 8px; }
.pick-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pick-head .field-label { margin-bottom: 0; }
.acc-pick-row { display: flex; gap: 8px; align-items: stretch; }
.acc-pick-slider { flex: 1 1 auto; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.acc-pick-slider::-webkit-scrollbar { display: none; }
.acc-pick { flex: 0 0 auto; min-width: 112px; max-width: 150px; text-align: left; display: grid; gap: 2px; background: var(--surface); border: 1.5px solid var(--line-2); border-radius: 16px; padding: 10px 11px; box-shadow: var(--shadow-btn); color: inherit; }
.acc-pick.on { border-color: var(--green); }
.movement-form.is-expense .acc-pick.on { border-color: var(--red); }
.movement-form.is-transfer .acc-pick.on { border-color: var(--amber); }
.acc-pick-icon { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-size: .72rem; font-weight: 800; margin-bottom: 6px; }
.acc-pick-name { font-size: .76rem; font-weight: 600; color: #4a5a4c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-pick-uses { font-size: .66rem; color: var(--muted); }
.acc-pick-more { flex: 0 0 auto; width: 44px; border: 1px solid var(--line); background: var(--surface); border-radius: 16px; color: #4a5a4c; font-size: 1.1rem; box-shadow: var(--shadow-btn); }

.cat-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.category-quick-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; width: 100%; }
.category-quick-grid .cat-chip { width: 100%; height: 56px; padding: 6px 5px; border-radius: 14px; display: grid; grid-template-rows: 22px auto; justify-items: center; gap: 2px; min-width: 0; }
.category-quick-grid .cat-chip > span:last-child { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; font-size: .68rem; }
.cat-chip-icon, .option-icon { width: 24px; height: 24px; display: grid; place-items: center; }
.cat-chip-icon .custom-icon-image, .option-icon .custom-icon-image { width: 24px; height: 24px; border-radius: 7px; object-fit: contain; }
.cat-more { color: var(--green); }
.cat-chip { height: 40px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: #4a5a4c; font-size: .82rem; font-weight: 600; box-shadow: 0 1px 2px rgba(29,41,31,.05), inset 0 1px 0 #fff; display: inline-flex; align-items: center; gap: 7px; }
.cat-chip.on { color: var(--text); border-color: var(--green); border-width: 1.5px; box-shadow: var(--shadow-btn); }
.movement-form.is-expense .cat-chip.on { border-color: var(--red); }

.sub-line { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; border-radius: 15px; border: 1.5px dashed #c8d1c6; background: #f7f8f5; color: inherit; text-align: left; }
.sub-line.on { border-style: solid; border-color: var(--green); background: var(--surface); box-shadow: var(--shadow-btn); }
.movement-form.is-expense .sub-line.on { border-color: var(--red); }
.sub-line.empty { border-style: dashed; }
.sub-check { color: var(--green); font-weight: 900; }
.movement-form.is-expense .sub-check { color: var(--red); }
.sub-text { flex: 1 1 auto; font-size: .86rem; min-width: 0; }
.sub-action { flex: 0 0 auto; font-size: .78rem; font-weight: 700; color: var(--green); }

.advanced-toggle { width: 100%; min-height: 48px; border-radius: 15px; border: 1px dashed #c8d1c6; background: var(--surface-2); color: #4a5a4c; font-size: .85rem; font-weight: 600; }
.advanced-fields { display: grid; gap: 12px; }

.modal-overlay { position: absolute; inset: 0; z-index: 6; background: var(--bg); border-radius: 26px 26px 0 0; padding: 17px 16px calc(18px + env(safe-area-inset-bottom)); overflow-y: auto; }
.overlay-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.overlay-title { font-size: 1.05rem; font-weight: 700; }
.overlay-search { width: 100%; border: 1px solid var(--line); border-radius: 15px; padding: 13px 15px; background: var(--surface); outline: none; margin-bottom: 12px; box-shadow: var(--shadow-in); }
.overlay-list { display: grid; gap: 7px; }
.overlay-list button { width: 100%; text-align: left; min-height: 52px; padding: 0 15px; border-radius: 15px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-size: .9rem; font-weight: 600; box-shadow: var(--shadow-btn); }
.icon-option-list button { display: flex; align-items: center; gap: 12px; }

/* Selector común de iconos para cuentas, categorías y subcategorías. */
.icon-choice-current { width: 100%; display: grid; grid-template-columns: 50px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); text-align: left; box-shadow: var(--shadow-btn); }
.icon-choice-current > span:nth-child(2) { display: grid; gap: 2px; }
.icon-choice-current small { color: var(--muted); font-size: .7rem; }
.icon-choice-preview { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 15px; background: var(--surface-2); overflow: hidden; color: var(--green); }
.icon-choice-preview .lucide-icon { width: 25px; height: 25px; }
.custom-icon-image { width: 100%; height: 100%; object-fit: contain; display: block; }
.icon-picker-panel { padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.icon-library { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 7px; max-height: 270px; overflow-y: auto; }
.icon-library-item { min-width: 0; min-height: 58px; padding: 7px 3px; display: grid; justify-items: center; align-content: center; gap: 4px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; color: #4a5a4c; }
.icon-library-item.selected { border-color: var(--green); color: var(--green); background: var(--green-2); }
.icon-library-item span { display: grid; place-items: center; width: 24px; height: 24px; overflow: hidden; }
.icon-library-item small { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .58rem; text-align: center; }
.icon-upload-btn { min-height: 44px; margin-top: 9px; display: flex; align-items: center; justify-content: center; gap: 7px; border-radius: 13px; background: var(--green); color: #fff !important; font-weight: 750; cursor: pointer; }
.manager-title-with-icon { display: flex; align-items: center; gap: 9px; min-width: 0; }
.manager-title-with-icon > span:last-child { display: grid; }
.manager-icon, .manager-sub-icon { display: grid; place-items: center; flex: 0 0 auto; overflow: hidden; background: var(--surface-2); color: var(--green); }
.manager-icon { width: 38px; height: 38px; border-radius: 12px; }
.manager-sub-icon { width: 28px; height: 28px; border-radius: 9px; }
.manager-icon .custom-icon-image, .manager-sub-icon .custom-icon-image { width: 100%; height: 100%; object-fit: contain; }

.acc-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 9px; }
.acc-grid-item { display: grid; justify-items: center; gap: 6px; padding: 12px 8px 11px; border-radius: 16px; border: 1.5px solid var(--line-2); background: var(--surface); color: inherit; box-shadow: var(--shadow-btn); }
.acc-grid-item.on { border-color: var(--green); }
.acc-grid-icon { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-size: .75rem; font-weight: 800; }
.acc-grid-name { font-size: .7rem; font-weight: 700; text-align: center; line-height: 1.25; }
.acc-grid-balance { font-size: .66rem; color: var(--muted); }

@media (min-width: 820px) {
  .acc-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .modal-overlay { border-radius: 26px; }
}

/* ============================================================
   REDISEÑO 2026-09 · modo rápido
   ============================================================ */

.quick-link { width: 100%; min-height: 44px; margin-bottom: 14px; border-radius: 14px; border: 1px dashed #c8d1c6; background: var(--surface); color: #4a5a4c; font-size: .82rem; font-weight: 700; }
.quick-top { display: grid; grid-template-columns: 1fr 150px; gap: 11px; align-items: end; margin-bottom: 14px; }
.quick-top .field input { width: 100%; border: 1.5px solid var(--red); border-radius: 13px; padding: 12px 13px; background: var(--surface); font-weight: 600; outline: none; }
.quick-lines { display: grid; gap: 0; background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; overflow: hidden; }
.quick-line { padding: 10px 12px 11px; border-bottom: 1px solid var(--surface-2); }
.quick-line:last-child { border-bottom: 0; }
.quick-line:nth-child(even) { background: #fbfcfa; }
.quick-row-1 { display: flex; gap: 8px; align-items: center; }
.quick-row-2 { display: flex; gap: 8px; margin-top: 7px; padding-left: 24px; }
.quick-num { width: 16px; flex: 0 0 auto; font-size: .7rem; font-weight: 800; color: #b0b8af; }
.quick-amount { width: 100px; flex: 0 0 auto; display: flex; align-items: center; gap: 4px; height: 44px; padding: 0 10px; border: 1px solid #d5dcd2; border-radius: 11px; background: var(--surface); }
.quick-amount input { width: 100%; min-width: 0; border: 0; outline: none; background: transparent; font-size: 1rem; font-weight: 800; padding: 0; }
.quick-amount span { font-size: .8rem; font-weight: 700; color: var(--muted); }
.quick-select { flex: 1 1 0; min-width: 0; height: 44px; border: 1px solid #d5dcd2; border-radius: 11px; background: var(--surface); color: var(--text); font-size: .84rem; font-weight: 600; padding: 0 9px; }
.quick-select.small { height: 40px; font-size: .78rem; font-weight: 500; background: #f7f8f5; border-color: var(--line-2); }
.quick-remove { width: 32px; height: 44px; flex: 0 0 auto; border: 0; background: transparent; color: #b0b8af; font-size: 1rem; }
.quick-add { width: 100%; min-height: 50px; margin-top: 10px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface); color: var(--green); font-weight: 700; }
.quick-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 14px 0 4px; }
.quick-foot strong { font-size: 1.15rem; letter-spacing: -.02em; }
.primary-btn.save-expense { background: var(--red); }

/* Divisas */
.amount-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.amount-head .field-label { margin-bottom: 0; }
.currency-btn { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: .72rem; font-weight: 800; box-shadow: 0 1px 2px rgba(29,41,31,.07), inset 0 1px 0 #fff; }
.currency-hint { font-size: .74rem; color: #4a5a4c; margin-top: 7px; }
.currency-hint:not(:empty) { padding-top: 7px; border-top: 1px solid var(--surface-2); }
.currency-hint b { color: var(--text); }
.currency-row { display: flex; align-items: center; gap: 12px; }
.currency-row.on { border-color: var(--green); border-width: 1.5px; }
.currency-code { width: 44px; flex: 0 0 auto; font-weight: 800; }
.currency-name { flex: 1 1 auto; font-weight: 500; color: #4a5a4c; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.currency-rate { flex: 0 0 auto; font-size: .76rem; font-weight: 700; color: var(--muted); }
.mov-foreign { font-size: .7rem; color: var(--muted); font-weight: 600; }


/* ============================================================
   ARREGLOS DE MÓVIL · 2026-09-20
   Un contenedor con scroll lateral solo hace scroll si su padre le impide
   crecer. En un grid o un flex, el hijo crece hasta caber su contenido salvo
   que se le ponga min-width: 0. Sin eso, los sliders empujaban el ancho de
   toda la página y en el móvil se salía de la pantalla.
   ============================================================ */

html, body { max-width: 100%; overflow-x: hidden; }
.app-shell, .app-column, .main-content { max-width: 100%; min-width: 0; }
.main-content { overflow-x: clip; }
.home-stack { grid-template-columns: minmax(0, 1fr); }
.home-stack > * { min-width: 0; }
.home-head, .hero-card, .panel, .mov-list, .quick-actions { min-width: 0; max-width: 100%; }

.acc-slider, .acc-pick-slider {
  min-width: 0; max-width: 100%;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
}
.acc-slider > *, .acc-pick-slider > * { scroll-snap-align: start; }
.acc-pick-row { min-width: 0; max-width: 100%; }
section:has(> .acc-slider) { min-width: 0; }

/* Modales y formularios: nada puede ser más ancho que la pantalla. */
.modal { max-width: 100%; box-sizing: border-box; overflow-x: hidden; }
.movement-form, .form-grid, .amount-row, .quick-top, .quick-lines, .quick-line, .quick-row-1, .quick-row-2 { min-width: 0; max-width: 100%; }
.movement-form > *, .amount-row > *, .quick-row-1 > *, .quick-row-2 > * { min-width: 0; }
.amount-box, .date-box { box-sizing: border-box; }
.cat-chips, .chip-wrap, .button-grid, .form-actions { min-width: 0; max-width: 100%; }
.overlay-list button, .acc-grid, .acc-grid-item { min-width: 0; max-width: 100%; box-sizing: border-box; }
.acc-grid-name, .acc-grid-balance, .currency-name { overflow-wrap: anywhere; }
.quick-select { max-width: 100%; }
.picker-panel, .picker-options, .quick-picks { min-width: 0; max-width: 100%; }
.movement-item, .mov-card, .card, .setting-row { min-width: 0; max-width: 100%; box-sizing: border-box; }
.filters, .search-box { max-width: 100%; }
table, pre { max-width: 100%; overflow-x: auto; display: block; }

/* Botones de acción: más bajos, para que quepan en la primera pantalla. */
.quick-actions.compact { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 9px; margin: 0; }
.quick-actions.compact .action-btn { flex-direction: row; gap: 7px; padding: 0 8px; height: 52px; border-radius: 16px; font-size: .84rem; }
.quick-actions.compact .action-icon { font-size: 1.05rem; }

/* Importe con dos divisas */
.amount-line.converted { align-items: baseline; }
.amount-line.converted #amountMainValue { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; color: var(--text); }
.amount-second { display: flex; align-items: center; gap: 7px; margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--surface-2); }
.amount-second-label { font-size: .72rem; font-weight: 700; color: var(--muted); flex: 0 0 auto; }
.amount-second input { flex: 1 1 auto; min-width: 0; border: 0; outline: none; background: transparent; font-size: 1.15rem; font-weight: 700; color: #4a5a4c; padding: 0; -moz-appearance: textfield; }
.amount-second input::-webkit-outer-spin-button, .amount-second input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.amount-symbol.small { font-size: .95rem; color: var(--muted); }

/* La fecha necesita algo más de sitio: el selector nativo trae su propio icono. */
.date-box { width: 142px; }
.date-box input { font-size: .88rem; }
@media (max-width: 360px) {
  .amount-row { flex-wrap: wrap; }
  .date-box { width: 100%; }
}
