/* =========================================================
   MiBilletera — sistema visual
   Tokens -> base -> componentes -> pantallas
   Estilo: sobrio y financiero. Tipografía liviana, mucho aire, color solo donde informa.
   ========================================================= */

/* Inter (licencia OFL, ver /fonts/LICENSE-Inter.txt): tipografía variable, un solo archivo */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/InterVariable.woff2') format('woff2');
}

:root {
  --bg: #f4f5f3;
  --surface: #ffffff;
  --surface-2: #f0f2f0;
  --text: #121c19;
  --muted: #68756f;
  --line: #e7ebe9;
  --line-strong: #d6dcd9;

  --accent: #0a6e61;
  --accent-strong: #07574d;
  --accent-soft: #e0f1ed;
  --accent-contrast: #ffffff;

  --pos: #0e7a4f;
  --pos-soft: #e1f4ea;
  --neg: #c8392d;
  --neg-soft: #fcebe9;
  --warn: #a35a00;
  --warn-soft: #fdf0dc;

  --ink-a: #17413a;
  --ink-b: #0a1d1a;

  --shadow: 0 0 0 1px rgba(18, 28, 25, 0.04), 0 1px 2px rgba(18, 28, 25, 0.04), 0 4px 14px rgba(18, 28, 25, 0.035);
  --shadow-lg: 0 14px 34px rgba(18, 28, 25, 0.16);

  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1110;
    --surface: #1d2523;
    --surface-2: #28322f;
    --text: #eef3f1;
    --muted: #97a5a1;
    --line: #2d3836;
    --line-strong: #3d4a47;

    --accent: #3fd0bb;
    --accent-strong: #7be3d2;
    --accent-soft: #163b36;
    --accent-contrast: #04211d;

    --pos: #4cdb9d;
    --pos-soft: #12301f;
    --neg: #ff8076;
    --neg-soft: #3a1d1a;
    --warn: #f7b45a;
    --warn-soft: #3a2b14;

    --ink-a: #17413a;
    --ink-b: #0a1d1a;

    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 14px 34px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  font-feature-settings: 'cv05', 'cv08', 'ss03';
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 16px 0;
}

main { flex: 1; padding-bottom: 96px; animation: screen-in 0.28s var(--ease) both; }
.form-screen { animation: screen-in 0.28s var(--ease) both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { main, .form-screen { animation: none; } * { transition: none !important; } }

h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.icon { flex: none; display: block; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { height: 12px; }

/* ---------- Encabezados ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 20px 2px 10px; }
.page-head h1 { font-size: 1.85rem; line-height: 1.05; font-weight: 700; letter-spacing: -0.035em; }
.page-head .sub { color: var(--muted); font-size: 0.86rem; margin-top: 4px; }
.page-head .btn { width: auto; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 4px 10px; }
.section-title h2 { font-size: 0.95rem; font-weight: 650; letter-spacing: -0.01em; color: var(--text); }
.link { border: 0; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 0.8rem; padding: 5px 12px; border-radius: 99px; transition: transform 0.12s; }
.link:active { transform: scale(0.95); }

/* ---------- Superficies ---------- */
.panel { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 2px 16px; }
.panel.pad { padding: 14px 16px; }
.panel + .panel { margin-top: 10px; }

.row-item {
  display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 64px; padding: 11px 0; border: 0; border-top: 1px solid var(--line);
  background: none; text-align: left; transition: background 0.15s;
}
.panel > .row-item:first-child, .panel > :first-child > .row-item:first-child { border-top: 0; }
.row-item.static { cursor: default; }
.row-item.dim { opacity: 0.5; }
.row-item:active:not(.static) { background: var(--surface-2); }
.row-title { font-weight: 560; font-size: 0.98rem; display: block; overflow-wrap: anywhere; line-height: 1.25; letter-spacing: -0.01em; }
.row-sub { color: var(--muted); font-size: 0.8rem; display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-right { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.97rem; line-height: 1.3; letter-spacing: -0.01em; }
.row-right small { font-weight: 450; color: var(--muted); font-size: 0.78rem; }

.avatar {
  width: 42px; height: 42px; border-radius: 14px; flex: none;
  display: grid; place-items: center; font-weight: 650; font-size: 0.98rem;
  background: hsl(var(--h, 170) 42% 92%); color: hsl(var(--h, 170) 45% 28%);
}
@media (prefers-color-scheme: dark) {
  .avatar { background: hsl(var(--h, 170) 30% 19%); color: hsl(var(--h, 170) 65% 76%); }
}
.avatar.soft { background: var(--accent-soft); color: var(--accent); }
.avatar.neg { background: var(--neg-soft); color: var(--neg); }
.avatar.pos { background: var(--pos-soft); color: var(--pos); }
.avatar.warn { background: var(--warn-soft); color: var(--warn); }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 8px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.01em; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.pos { background: var(--pos-soft); color: var(--pos); }
.chip.neg { background: var(--neg-soft); color: var(--neg); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }

.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 22px 12px; color: var(--muted); font-size: 0.9rem; }
.empty .avatar { width: 48px; height: 48px; border-radius: 16px; }
.empty strong { color: var(--text); font-weight: 600; }

/* ---------- Botones ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px; padding: 10px 18px;
  border: 1px solid var(--line-strong); border-radius: 14px;
  background: var(--surface); color: var(--text); font-weight: 600; letter-spacing: -0.005em; text-decoration: none;
  transition: transform 0.12s var(--ease), background 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); box-shadow: 0 1px 2px rgba(10, 110, 97, 0.3), 0 6px 14px rgba(10, 110, 97, 0.18); }
.btn.soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.btn.danger { color: var(--neg); background: var(--surface); }
.btn.small { min-height: 36px; width: auto; padding: 6px 14px; font-size: 0.88rem; border-radius: 11px; }
.btn:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.btn + .btn:not(.small) { margin-top: 10px; }
.btn-row .btn + .btn { margin-top: 0; }

/* ---------- Barra inferior ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  max-width: 520px; margin: 0 auto;
  display: flex; align-items: flex-end; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-top: 1px solid var(--line);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 2px 0 2px; border: 0; background: none; color: var(--muted); font-size: 0.66rem; font-weight: 600; letter-spacing: 0; position: relative; min-width: 0; }
.tab .ti { display: grid; place-items: center; width: 46px; height: 28px; border-radius: 14px; transition: background 0.2s var(--ease), transform 0.2s var(--ease); }
.tab[aria-current='page'] { color: var(--accent); }
.tab[aria-current='page'] .ti { background: var(--accent-soft); }
.tab:active .ti { transform: scale(0.92); }

.fab { flex: none; width: 62px; height: 62px; padding: 0; margin: 0 2px 8px; border-radius: 50%; border: 4px solid var(--bg); background: var(--accent); color: var(--accent-contrast); display: grid; place-items: center; box-shadow: 0 8px 20px rgba(10, 110, 97, 0.38); transform: translateY(-16px); transition: transform 0.15s var(--ease); box-sizing: border-box; }
.fab:active { transform: translateY(-16px) scale(0.93); }
.sheet-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(8, 16, 14, 0.45); backdrop-filter: blur(2px); display: flex; align-items: flex-end; justify-content: center; animation: fade-in 0.2s ease both; }
.sheet { width: 100%; max-width: 520px; background: var(--surface); border-radius: 26px 26px 0 0; padding: 10px 18px calc(16px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); animation: sheet-up 0.3s var(--ease) both; }
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 2px auto 10px; }
.sheet .row-item { min-height: 58px; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Inicio ---------- */
.home-top { padding-top: 14px; }
.home-top + .panel, .hero + .panel { margin-top: 12px; }
.hero {
  position: relative; overflow: hidden; color: #fff;
  border-radius: var(--r-lg); padding: 20px 20px 16px;
  background: radial-gradient(120% 90% at 100% 0%, rgba(63, 208, 187, 0.22), transparent 55%), linear-gradient(160deg, var(--ink-a), var(--ink-b));
  box-shadow: var(--shadow-lg);
}
.hero-top { display: flex; justify-content: space-between; align-items: center; }
.hero-label { font-size: 0.82rem; font-weight: 500; opacity: 0.72; }
.hero-date { font-size: 0.78rem; opacity: 0.6; font-weight: 450; }
.hero-line { display: flex; align-items: baseline; gap: 10px; margin-top: 10px; }
.hero-amount { font-size: 2.35rem; font-weight: 650; letter-spacing: -0.035em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero-amount .sym { font-size: 1.35rem; font-weight: 500; opacity: 0.7; margin-right: 4px; letter-spacing: 0; }
.hero-amount .dec { font-size: 1.3rem; font-weight: 500; opacity: 0.6; letter-spacing: -0.01em; }
.hero-amount.second { font-size: 1.25rem; font-weight: 600; opacity: 0.92; }
.hero-amount.second .sym { font-size: 0.85rem; }
.hero-amount.second .dec { font-size: 0.9rem; }
.hero-amount.neg-big { color: #ffb4ab; }
.hero-line .cur { font-size: 0.68rem; font-weight: 650; letter-spacing: 0.08em; padding: 2px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.14); }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.hero-stats > div { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.07); font-size: 0.76rem; font-weight: 450; opacity: 0.95; }
.hero-stats b { display: block; font-size: 0.98rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.hero-stats .up { color: #86efbb; }
.hero-stats .down { color: #ffc2bb; }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 2px; }
.qa { display: flex; flex-direction: column; align-items: center; gap: 8px; border: 0; background: none; font-size: 0.78rem; font-weight: 600; color: var(--text); padding: 4px 0; }
.qa .circle { width: 56px; height: 56px; border-radius: 20px; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow); }
.qa.expense .circle { color: var(--neg); background: var(--neg-soft); box-shadow: none; }
.qa.income .circle { color: var(--pos); background: var(--pos-soft); box-shadow: none; }
.qa.transfer .circle { color: var(--accent); background: var(--accent-soft); box-shadow: none; }
.qa.cards .circle { color: var(--warn); background: var(--warn-soft); box-shadow: none; }
.qa:active .circle { transform: scale(0.94); }

.due { display: flex; gap: 14px; padding: 12px 16px 12px 0; align-items: center; width: 100%; border: 0; background: none; text-align: left; }
.due-card { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 0 0 0 22px; overflow: hidden; position: relative; margin-bottom: 8px; }
.due-card::before { content: ''; position: absolute; left: 10px; top: 16px; bottom: 16px; width: 3px; border-radius: 3px; background: var(--line-strong); }
.due-card.urgent::before { background: var(--neg); }
.due-card.soon::before { background: var(--warn); }
.due-card.calm::before { background: var(--accent); }
.chip-line { display: block; margin-top: 3px; }
.due .row-sub { white-space: normal; }
.due-hint { padding: 0 16px 12px 0; margin-top: -4px; }
.due-amounts { display: flex; flex-direction: column; align-items: flex-end; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.hint { display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; padding: 8px 10px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-strong); font-size: 0.78rem; line-height: 1.35; }
@media (prefers-color-scheme: dark) { .hint { color: var(--accent); } }

/* Tarjetas en el Inicio: el plástico con el color del banco y, debajo, lo que vence */
.rail { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-left: 16px; margin: 0 -16px; padding: 4px 16px 6px; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail-item { flex: 0 0 186px; scroll-snap-align: start; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; transition: transform 0.15s var(--ease); }
.rail-item:active { transform: scale(0.97); }
.cc.rail-card { min-height: 116px; padding: 14px 16px; border-radius: 18px; box-shadow: 0 8px 22px rgba(18, 28, 25, 0.16); }
.rail-card .cc-name { font-size: 0.9rem; font-weight: 600; letter-spacing: -0.01em; }
.rail-face { position: relative; z-index: 1; }
.rail-sub { font-size: 0.7rem; opacity: 0.8; font-weight: 500; letter-spacing: 0.02em; }
.rail-amt { font-size: 1.2rem; font-weight: 650; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.rail-foot { display: flex; flex-direction: column; gap: 1px; padding: 10px 4px 2px; font-size: 0.78rem; font-weight: 550; line-height: 1.3; }
.rail-foot-amt { font-weight: 650; font-size: 0.86rem; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.rail-foot .neg { font-weight: 650; }

/* ---------- Movimientos ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 0 10px; }
.month-nav .round { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--text); }
.month-label { font-weight: 650; font-size: 1.05rem; letter-spacing: -0.02em; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.stat { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 12px 14px; }
.stat small { color: var(--muted); font-weight: 500; font-size: 0.78rem; }
.stat .v { font-weight: 650; font-size: 1.02rem; margin-top: 3px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.day-head { margin: 16px 4px 6px; font-size: 0.8rem; font-weight: 600; color: var(--muted); }

/* ---------- Tarjetas (visual) ---------- */
.cc {
  position: relative; overflow: hidden; color: #fff; border-radius: 20px; padding: 16px 18px; min-height: 128px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(135deg, #1f3c88, #0b1736); box-shadow: 0 14px 28px rgba(18, 28, 25, 0.2);
}
.cc.mastercard { background: linear-gradient(135deg, #b4421a, #3d1530); }
.cc.other { background: linear-gradient(135deg, #14867a, #0b2f33); }
.cc::after { content: ''; position: absolute; right: -60px; top: -70px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 70%); }
.cc-top { display: flex; justify-content: space-between; align-items: flex-start; position: relative; z-index: 1; }
.cc-name { font-weight: 650; font-size: 1.02rem; letter-spacing: -0.01em; }
.cc-net { font-weight: 650; letter-spacing: 0.1em; font-size: 0.7rem; opacity: 0.85; text-transform: uppercase; }
.cc-chip { width: 34px; height: 25px; border-radius: 6px; background: linear-gradient(135deg, #f6d98a, #c79a36); opacity: 0.95; position: relative; z-index: 1; }
.cc-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; position: relative; z-index: 1; }
.cc-num { font-size: 0.92rem; letter-spacing: 0.18em; font-weight: 500; }
.cc-meta { text-align: right; font-size: 0.74rem; opacity: 0.9; line-height: 1.3; }
.cc-meta b { display: block; font-size: 0.92rem; font-weight: 600; }
.cc-mini { width: 36px; height: 26px; border-radius: 7px; flex: none; position: relative; background: linear-gradient(135deg, #1f3c88, #0b1736); box-shadow: 0 3px 8px rgba(18, 28, 25, 0.18); }
.cc-mini.mastercard { background: linear-gradient(135deg, #b4421a, #3d1530); }
.cc-mini.other { background: linear-gradient(135deg, #14867a, #0b2f33); }
.cc-mini::after { content: ''; position: absolute; left: 5px; top: 7px; width: 9px; height: 7px; border-radius: 2px; background: linear-gradient(135deg, #f6d98a, #c79a36); }
.limit-bar { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; margin-top: 8px; }
.limit-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 6px; }

.stmt-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 6px 0 4px; }
.stmt-head h3 { font-size: 1rem; font-weight: 650; letter-spacing: -0.015em; }
.amount-pair { display: flex; gap: 20px; padding: 6px 0 8px; flex-wrap: wrap; }
.amount-pair div { display: flex; flex-direction: column; }
.amount-pair small { color: var(--muted); font-weight: 500; font-size: 0.76rem; }
.amount-pair b { font-size: 1.3rem; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.diff { display: flex; gap: 8px; align-items: flex-start; padding: 9px 12px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 0.82rem; font-weight: 550; margin: 6px 0; line-height: 1.35; }
.diff.good { background: var(--pos-soft); color: var(--pos); }

/* ---------- Formularios ---------- */
.form-screen { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; padding-bottom: 100px; }
.form-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 12px 0 10px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); }
.form-head h1 { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.02em; }
.back { width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--text); transition: transform 0.12s; }
.back:active { transform: scale(0.92); }
.form-body { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.form-actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; max-width: 520px; margin: 0 auto;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 78%, transparent);
  display: flex; flex-direction: column; gap: 8px;
}
.form-actions .btn + .btn { margin-top: 0; }

.field { display: block; }
.field > span { display: block; font-size: 0.78rem; font-weight: 550; color: var(--muted); margin: 0 2px 6px; }
.field small { display: block; margin: 6px 2px 0; color: var(--muted); font-size: 0.76rem; line-height: 1.35; }
.field input, select {
  width: 100%; min-height: 50px; padding: 9px 14px;
  border: 1px solid var(--line-strong); border-radius: 13px;
  background: var(--surface); color: var(--text); font-size: 1rem;
  appearance: none; -webkit-appearance: none; transition: border-color 0.15s, box-shadow 0.15s;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 22px) 22px, calc(100% - 16px) 22px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.field input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field input[inputmode='numeric'][type='password'] { letter-spacing: 0.3em; }

.seg { display: flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 14px; }
.seg-btn { flex: 1; min-height: 40px; border: 0; border-radius: 11px; background: none; color: var(--muted); font-weight: 600; transition: background 0.15s, color 0.15s; }
.seg-btn[aria-pressed='true'] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(18, 28, 25, 0.12); }
.seg-btn.expense[aria-pressed='true'] { color: var(--neg); }
.seg-btn.income[aria-pressed='true'] { color: var(--pos); }
.seg-btn.transfer[aria-pressed='true'] { color: var(--accent); }
.seg.small .seg-btn { min-height: 36px; }

.amount-card { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 16px 16px 14px; text-align: center; }
.amount-card label { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.amount-row { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 6px; }
.amount-sym { font-size: 1.5rem; font-weight: 500; color: var(--muted); }
input.amount { width: auto; min-width: 5ch; field-sizing: content; max-width: 280px; border: 0; background: none; text-align: center; font-size: 2.5rem; font-weight: 650; letter-spacing: -0.04em; color: var(--text); outline: none; font-variant-numeric: tabular-nums; padding: 2px 0; min-height: 0; box-shadow: none; }
input.amount::placeholder { color: var(--line-strong); }
.rate { text-align: center; color: var(--accent); font-weight: 600; font-size: 0.9rem; }

.check { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 6px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); font-weight: 550; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.check span { font-size: 0.95rem; }
.group { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.group > h3 { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.group .field input, .group select { background: var(--surface-2); border-color: transparent; }
.group .field input:focus, .group select:focus { background: var(--surface); border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { min-width: 44px; min-height: 38px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); font-weight: 600; }
.chip-btn[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.preview { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 0.82rem; color: var(--muted); line-height: 1.45; }
.preview b { color: var(--text); font-weight: 600; }
.error { color: var(--neg); font-weight: 550; text-align: center; }
.error:empty { display: none; }
.ok { color: var(--pos); font-weight: 550; }

/* ---------- PIN ---------- */
.pin-screen { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 24px 0; }
.brand-logo { width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 24px; display: grid; place-items: center; color: #fff; background: radial-gradient(120% 90% at 100% 0%, rgba(63, 208, 187, 0.3), transparent 55%), linear-gradient(160deg, var(--ink-a), var(--ink-b)); box-shadow: var(--shadow-lg); }
.pin-screen h1 { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.04em; }
.dots { display: flex; justify-content: center; gap: 18px; margin: 30px 0 12px; }
.dot { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--line-strong); transition: transform 0.15s var(--ease), background 0.15s, border-color 0.15s; }
.dot.on { background: var(--accent); border-color: var(--accent); transform: scale(1.15); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 18px auto 0; max-width: 300px; width: 100%; }
.key { min-height: 64px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow); font-size: 1.5rem; font-weight: 500; transition: transform 0.1s, background 0.15s; }
.key:active { background: var(--accent-soft); transform: scale(0.94); }
.key.ghost { visibility: hidden; }

/* ---------- Ajustes ---------- */
.csv-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.list { list-style: none; margin: 8px 0 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 8px; padding: 13px 0; border-top: 1px solid var(--line); }
.list a { color: var(--accent); font-weight: 600; }

@media (min-width: 600px) {
  body { background: radial-gradient(circle at 50% -10%, var(--accent-soft), var(--bg) 55%); }
}

/* ---------- Logos y listas plegables ---------- */
.avatar.logo { display: block; background: #fff; border: 1px solid var(--line); padding: 6px; overflow: hidden; }
.avatar.logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.more-btn { width: 100%; border: 0; border-top: 1px solid var(--line); background: none; color: var(--accent); font-weight: 600; font-size: 0.88rem; padding: 12px 0 10px; }

/* ---------- Colores de tarjeta por banco ---------- */
.cc.bbva { background: linear-gradient(135deg, #1a6ad3, #072a5e); }
.cc.santander { background: linear-gradient(135deg, #ea2323, #8f0707); }
.cc.naranjax { background: linear-gradient(135deg, #ff7f22, #d24400); }
.cc.nacion { background: linear-gradient(135deg, #0a73c2, #053e6e); }
.cc.mercadopago { background: linear-gradient(135deg, #1fb0ec, #0073a8); }
.cc.carrefour { background: linear-gradient(135deg, #1b57b5, #0b2a63); }
.cc.bancodelsol { background: linear-gradient(135deg, #ffd51f, #e2a600); color: #2b2100; }
.cc.bancodelsol::after { background: radial-gradient(circle, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 70%); }
.cc.icbc { background: linear-gradient(135deg, #ffffff, #eceff1); color: #141414; box-shadow: 0 12px 26px rgba(18, 28, 25, 0.14), inset 0 0 0 1px rgba(0, 0, 0, 0.07); }
.cc.icbc::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 8px; background: #c8102e; }
.cc.icbc::after { background: radial-gradient(circle, rgba(200, 16, 46, 0.1), rgba(200, 16, 46, 0) 70%); }
.cc.icbc .cc-net { color: #c8102e; opacity: 1; }
.cc.icbc .cc-name, .cc.icbc .cc-num { color: #111; }

.cc-mini.bbva { background: linear-gradient(135deg, #1a6ad3, #072a5e); }
.cc-mini.santander { background: linear-gradient(135deg, #ea2323, #8f0707); }
.cc-mini.naranjax { background: linear-gradient(135deg, #ff7f22, #d24400); }
.cc-mini.nacion { background: linear-gradient(135deg, #0a73c2, #053e6e); }
.cc-mini.mercadopago { background: linear-gradient(135deg, #1fb0ec, #0073a8); }
.cc-mini.carrefour { background: linear-gradient(135deg, #1b57b5, #0b2a63); }
.cc-mini.bancodelsol { background: linear-gradient(135deg, #ffd51f, #e2a600); }
.cc-mini.icbc { background: #fff; box-shadow: inset 6px 0 0 #c8102e, inset 0 0 0 1px rgba(0, 0, 0, 0.12), 0 3px 8px rgba(18, 28, 25, 0.1); }

/* Los logos de banco son anchos: se muestran en un rectángulo redondeado */
.avatar.tile { width: 58px; border-radius: 12px; }
.avatar.logo.tile { padding: 5px 7px; }

.warn-text { color: var(--warn); font-weight: 550; }

/* Barra de la bandeja con el botón de sincronizar */
.row-item .bare .row-sub { max-width: 100%; }
.row-item .bare { overflow: hidden; flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; background: none; border: 0; padding: 0; text-align: left; min-width: 0; }
.steps { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
.steps code { word-break: break-all; font-size: 12px; }
details > summary { cursor: pointer; font-weight: 600; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }


/* ---------- Sensación de app nativa ---------- */
body { -webkit-user-select: none; user-select: none; }
input, textarea, .selectable { -webkit-user-select: text; user-select: text; }
.row-item:active:not(.static), .due:active, .more-btn:active { background: var(--surface-2); }

/* Título compacto que aparece al hacer scroll */
.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 9; max-width: 520px; margin: 0 auto; display: grid; place-items: end center; height: calc(46px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 0 12px; font-weight: 650; font-size: 0.98rem; letter-spacing: -0.01em; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); border-bottom: 1px solid var(--line); opacity: 0; transform: translateY(-6px); pointer-events: none; transition: opacity 0.2s var(--ease), transform 0.2s var(--ease); }
.topbar.on { opacity: 1; transform: none; }

/* Hoja para elegir una opción (reemplaza al desplegable del navegador) */
.sheet.picker { max-height: 82vh; display: flex; flex-direction: column; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.picker-title { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.015em; padding: 2px 2px 12px; }
.picker-searchbox { display: flex; align-items: center; gap: 10px; min-height: 48px; margin-bottom: 4px; padding: 0 14px; border-radius: 14px; background: var(--surface-2); color: var(--muted); }
.picker-search { flex: 1; min-width: 0; height: 46px; border: 0; background: none; font-size: 1rem; color: var(--text); outline: none; padding: 0; }
.picker-search::-webkit-search-cancel-button { display: none; }
.picker-list { overflow-y: auto; margin: 0 -6px; padding: 0 6px; overscroll-behavior: contain; }
.picker-opt { min-height: 62px; border-radius: 0; gap: 14px; }
.picker-opt .row-title { font-size: 1rem; }
.picker-opt[aria-pressed='true'] .row-title { color: var(--accent); font-weight: 650; }
.picker-empty { padding: 28px 0; }
.radio { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; color: var(--accent-contrast); transition: background 0.15s, border-color 0.15s; }
.radio.on { background: var(--accent); border-color: var(--accent); }

/* Ocultar importes */
.hero-right { display: flex; align-items: center; gap: 8px; }
.eye { width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.12); color: #fff; display: grid; place-items: center; }
.eye:active { background: rgba(255, 255, 255, 0.22); }
.privacy .hero-amount, .privacy .hero-stats b, .privacy .row-right, .privacy .due-amounts, .privacy .rail-amt, .privacy .rail-foot-amt, .privacy .amount-pair b, .privacy .stat .v, .privacy .cc-meta b { filter: blur(9px); transition: filter 0.2s; }

/* Esqueletos de carga */
.skeleton { padding-top: 20px; }
.sk { border-radius: 10px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
.sk-title { width: 46%; height: 34px; margin: 0 2px 18px; border-radius: 12px; }
.sk-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.skeleton .panel .sk-row:first-child { border-top: 0; }
.sk-avatar { width: 42px; height: 42px; border-radius: 14px; flex: none; }
.sk-line { height: 12px; width: 70%; margin-bottom: 8px; }
.sk-line.short { width: 40%; margin-bottom: 0; }
.sk-amount { width: 70px; height: 14px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }


/* ---------- Teclado numérico ---------- */
.sheet.keypad { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.kp-label { text-align: center; font-size: 0.82rem; color: var(--muted); font-weight: 500; margin-top: 2px; }
.kp-amount { display: flex; justify-content: center; align-items: baseline; gap: 8px; min-height: 64px; padding: 6px 0 12px; }
.kp-sym { font-size: 1.5rem; font-weight: 500; color: var(--muted); }
.kp-num { font-size: 3rem; font-weight: 650; letter-spacing: -0.045em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kp-num.empty { color: var(--line-strong); }
.kp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.kp-key { min-height: 62px; border: 0; border-radius: 18px; background: var(--surface-2); font-size: 1.55rem; font-weight: 500; display: grid; place-items: center; transition: transform 0.1s var(--ease), background 0.15s; font-variant-numeric: tabular-nums; }
.kp-key:active { transform: scale(0.95); background: var(--accent-soft); }
.kp-key.fn { color: var(--muted); }
input.amount[readonly] { cursor: pointer; caret-color: transparent; }


/* ---------- Pagos: cronograma ---------- */
.sched-summary { margin: 6px 0 4px; padding: 16px 18px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent-strong); }
@media (prefers-color-scheme: dark) { .sched-summary { color: var(--accent); } }
.ss-label { font-size: 0.8rem; font-weight: 550; opacity: 0.85; }
.ss-amount { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-top: 4px; font-size: 1.9rem; font-weight: 650; letter-spacing: -0.035em; color: var(--text); font-variant-numeric: tabular-nums; }
.ss-amount .second { font-size: 1.2rem; }
.ss-amount .sym { font-size: 1.1rem; font-weight: 500; color: var(--muted); margin-right: 3px; letter-spacing: 0; }
.ss-amount .dec { font-size: 1.1rem; font-weight: 500; color: var(--muted); }
.ss-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 0.8rem; font-weight: 500; }
.ss-late { color: var(--neg); font-weight: 600; }
.sched-month { margin: 22px 4px 0; font-size: 0.78rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.sched-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 16px 6px 8px; }
.sched-month + .sched-head { margin-top: 8px; }
.sched-day { font-size: 0.95rem; font-weight: 650; letter-spacing: -0.01em; }
.sched-total { font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 500; }
.sched-head.today .sched-day { color: var(--accent); }
.sched-head.late .sched-day { color: var(--neg); }

a.row-item { color: inherit; text-decoration: none; }

.version { margin: 24px 0 8px; font-size: 0.76rem; }


/* ---------- Buscador ---------- */
.picker-searchbox.big { min-height: 52px; margin-bottom: 0; background: var(--surface); box-shadow: var(--shadow); }
.search-count { font-size: 0.8rem; margin: 2px 4px 0; }
.filters summary { list-style: none; }
.filters summary::-webkit-details-marker { display: none; }
.filters[open] summary { margin-bottom: 12px; }
.page-head .link { display: inline-flex; align-items: center; gap: 6px; }

/* Las tarjetas del Inicio se alinean todas a la línea de arriba, tengan o no un vencimiento debajo */
.rail { align-items: flex-start; }
.rail-item { align-self: flex-start; display: flex; flex-direction: column; justify-content: flex-start; }

.bio-btn { max-width: 320px; margin: 18px auto 0; }

/* Ajuste de tamaños: íconos y letras más chicos para que nada se vea apretado */
.avatar { width: 36px; height: 36px; border-radius: 12px; font-size: 0.86rem; }
.avatar svg { width: 18px; height: 18px; }
.avatar.logo { padding: 5px; }
.row-item { gap: 12px; min-height: 56px; padding: 9px 0; }
.row-title { font-size: 0.92rem; }
.row-sub { font-size: 0.74rem; }
.row-right { font-size: 0.9rem; gap: 2px; }
.row-right small { font-size: 0.72rem; }
.due { gap: 12px; padding: 10px 14px 10px 0; }
.due-amounts { font-size: 0.9rem; gap: 2px; text-align: right; white-space: nowrap; }
.day-head { font-size: 0.76rem; }
.hero-stats b { display: flex; flex-direction: column; gap: 1px; font-size: 0.92rem; }
.stat-line { white-space: nowrap; display: block; }
.sched-total { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; font-size: 0.78rem; }
.sched-head { align-items: flex-start; }
.more-btn { font-size: 0.84rem; }

/* Páginas de texto (política de privacidad) */
.doc { max-width: 720px; margin: 0 auto; padding: 28px 20px 60px; line-height: 1.6; }
.doc h1 { font-size: 1.6rem; margin-bottom: 4px; }
.doc h2 { font-size: 1.05rem; margin: 22px 0 6px; }
.doc ul { padding-left: 20px; }
.doc a { color: var(--accent); }

/* Banco sin logo oficial cargado: inicial sobre el color de su marca */
.avatar.mono { background: var(--brand, #64748b); color: #fff; font-weight: 700; font-size: 0.78rem; letter-spacing: -0.02em; }

/* Cuentas: una franja con el color de la marca del banco, para distinguirlas de un vistazo */
.row-item.brand-row::before { content: ''; flex: none; align-self: stretch; width: 4px; margin: 8px 0; border-radius: 4px; background: var(--brand); }
.row-item.brand-row { gap: 11px; }

/* Tarjetas de los bancos nuevos (la paleta sale del color de cada marca) */
.cc.credicoop { background: linear-gradient(135deg, #7b8077, #3d413b); }
.cc.galicia { background: linear-gradient(135deg, #ff7a1a, #c24a00); }
.cc.macro { background: linear-gradient(135deg, #2f3b78, #11172f); }
.cc.provincia { background: linear-gradient(135deg, #14a05b, #075f33); }
.cc.ciudad { background: linear-gradient(135deg, #2a63c9, #12296b); }
.cc.hsbc { background: linear-gradient(135deg, #e6232f, #8c000a); }
.cc.supervielle { background: linear-gradient(135deg, #ff2a1a, #8a0a00); }
.cc.patagonia { background: linear-gradient(135deg, #0a5aa0, #06284a); }
.cc.hipotecario { background: linear-gradient(135deg, #f78b3f, #b84a08); }
.cc.brubank { background: linear-gradient(135deg, #7b66ea, #3a2a9c); }
.cc.uala { background: linear-gradient(135deg, #4b63f0, #1e2c97); }
.cc.itau { background: linear-gradient(135deg, #f58a1f, #b04e00); }
.cc.amex { background: linear-gradient(135deg, #3f8ed0, #174a7c); }
.cc-mini.credicoop { background: linear-gradient(135deg, #7b8077, #3d413b); }
.cc-mini.galicia { background: linear-gradient(135deg, #ff7a1a, #c24a00); }
.cc-mini.macro { background: linear-gradient(135deg, #2f3b78, #11172f); }
.cc-mini.provincia { background: linear-gradient(135deg, #14a05b, #075f33); }
.cc-mini.ciudad { background: linear-gradient(135deg, #2a63c9, #12296b); }
.cc-mini.hsbc { background: linear-gradient(135deg, #e6232f, #8c000a); }
.cc-mini.supervielle { background: linear-gradient(135deg, #ff2a1a, #8a0a00); }
.cc-mini.patagonia { background: linear-gradient(135deg, #0a5aa0, #06284a); }
.cc-mini.hipotecario { background: linear-gradient(135deg, #f78b3f, #b84a08); }
.cc-mini.brubank { background: linear-gradient(135deg, #7b66ea, #3a2a9c); }
.cc-mini.uala { background: linear-gradient(135deg, #4b63f0, #1e2c97); }
.cc-mini.itau { background: linear-gradient(135deg, #f58a1f, #b04e00); }
.cc-mini.amex { background: linear-gradient(135deg, #3f8ed0, #174a7c); }

/* ---------- Pantallas anchas (PC y tablet grande): panel lateral y dos columnas ---------- */
@media (hover: hover) {
  .row-item:hover:not(.static), .due:hover, .more-btn:hover, .tab:hover { background: var(--surface-2); }
  .btn, .link, .chip-btn, .seg-btn, .row-item:not(.static), .due, .rail-item, .tab, .fab { cursor: pointer; }
}
@media (min-width: 900px) {
  body { background: var(--bg); }
  #app { max-width: 1320px; }
  /* con barra de secciones: panel lateral fijo a la izquierda y el contenido a la derecha */
  #app:has(> .tabs) { display: grid; grid-template-columns: 188px minmax(0, 1fr); align-items: start; }
  #app:has(> .tabs) > main { grid-column: 2; grid-row: 1; width: 100%; max-width: 1180px; padding: 26px 28px 56px; justify-self: start; }
  #app > .tabs {
    grid-column: 1; grid-row: 1 / span 3; position: sticky; top: 0; left: auto; right: auto; bottom: auto; z-index: 10;
    height: 100vh; max-width: none; margin: 0; padding: 20px 10px; gap: 2px;
    flex-direction: column; align-items: stretch; justify-content: flex-start;
    background: var(--surface); border-top: 0; border-right: 1px solid var(--line); backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .tabs::before { content: 'MiBilletera'; order: -2; padding: 2px 10px 16px; font-weight: 700; font-size: 1.08rem; letter-spacing: -0.035em; color: var(--text); }
  .tab { flex: none; flex-direction: row; justify-content: flex-start; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 11px; font-size: 0.9rem; color: var(--text); }
  .tab .ti { width: 26px; height: 26px; border-radius: 9px; background: none; }
  .tab[aria-current='page'] { background: var(--accent-soft); color: var(--accent); }
  .tab[aria-current='page'] .ti { background: none; }
  .fab { order: -1; display: flex; flex-direction: row; align-items: center; justify-content: center; width: 100%; height: 42px; margin: 0 0 14px; padding: 0 12px; gap: 8px; border: 0; border-radius: 12px; transform: none; box-shadow: none; }
  .fab svg { width: 20px; height: 20px; flex: none; }
  .fab::after { content: 'Cargar'; font-weight: 650; font-size: 0.92rem; }
  .fab:hover { background: var(--accent-strong); }
  .fab:active { transform: scale(0.98); }
  .topbar { display: none; }

  /* Inicio: dos columnas independientes. Izquierda: saldo y cuentas. Derecha: tarjetas (4 en fila), los 3 próximos vencimientos lado a lado y, debajo, los últimos movimientos; todo del mismo ancho */
  .home-grid { display: grid; grid-template-columns: minmax(0, 0.84fr) minmax(0, 1.16fr); gap: 28px; align-items: start; }
  .home-col { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
  .hb { min-width: 0; }
  .hb-hero .home-top { padding-top: 0; }
  .hb-cards .section-title, .hb-due .section-title, .hb-moves .section-title, .hb-accounts .section-title { margin-top: 10px; }
  .hb-cards .section-title { margin-top: 0; }
  .rail { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; overflow: visible; margin: 0; padding: 4px 0 6px; scroll-snap-type: none; }
  .rail { align-items: stretch; }
  .rail-item { flex: none; display: flex; flex-direction: column; }
  .rail-item .rail-card { flex: 1 0 auto; min-height: 100px; } /* alto parejo para todas, pensado para la que lleva pesos y dólares */
  .rail-item:nth-child(n+5) { display: none; } /* en la PC se ven 4 en fila; el resto, con "Ver todas" */
  .rail-card.cc { min-height: 100px; padding: 10px 11px; border-radius: 14px; }
  .rail-card .cc-name { font-size: 0.74rem; }
  .rail-amt { font-size: 0.86rem; }
  .rail-sub { font-size: 0.62rem; }
  .rail-foot { font-size: 0.7rem; padding-top: 6px; }
  .rail-foot-amt { font-size: 0.74rem; }
  /* vencimientos: tres tarjetas del mismo ancho, con el contenido apilado para que entre */
  .due-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: stretch; }
  .due-row .due-card { margin-bottom: 0; padding-left: 16px; }
  .due-row .due-card::before { left: 7px; top: 12px; bottom: 12px; }
  .due-row .due { flex-direction: column; align-items: flex-start; gap: 6px; padding: 11px 10px 11px 0; }
  /* el ícono de tarjeta es más bajo que el de un servicio: se alinea por el borde de abajo para que los títulos queden a la misma altura */
  .due-row .due .avatar { margin-bottom: 2px; }
  .due-row .due .cc-mini { margin: 5px 0 7px; } /* 5 + 26 + 7 = 38, lo mismo que un ícono de servicio (36 + 2) */
  .due-row .due .grow { width: 100%; }
  .due-row .row-title { font-size: 0.86rem; }
  .due-row .row-sub { font-size: 0.7rem; white-space: normal; }
  .due-row .due-card { display: flex; flex-direction: column; }
  .due-row .due { flex: 1; }
  .due-row .due-amounts { margin-left: 0; margin-top: auto; align-items: flex-start; font-size: 0.92rem; }
  .due-row .due-hint { display: none; }
  .due-row .due-more { grid-column: 1 / -1; width: 100%; border-top: 0; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }

  /* pantallas sin barra (formularios): una columna centrada, un poco más ancha */
  #app:not(:has(> .tabs)) { max-width: 720px; }
  .form-actions { max-width: 720px; }
  .form-screen { padding-bottom: 110px; }

  /* hojas (elegir cuenta, categoría, teclado): ventana centrada en vez de subir desde abajo */
  .sheet-backdrop { align-items: center; }
  .sheet { max-width: 460px; border-radius: 22px; max-height: 86vh; overflow-y: auto; }
  .sheet-grip { display: none; }
}
.lbl-long { display: none; }
@media (min-width: 900px) { .lbl-short { display: none; } .lbl-long { display: inline; } }

/* Listas tipo planilla en pantallas anchas: avatar | concepto | categoría y cuenta | importe */
@media (min-width: 900px) {
  .panel.table .row-item { display: grid; grid-template-columns: 36px minmax(0, 1.5fr) minmax(0, 1fr) auto; align-items: center; column-gap: 16px; }
  .panel.table .row-item .grow { display: contents; }
  .panel.table .row-item .row-title { grid-column: 2; }
  .panel.table .row-item .row-sub { grid-column: 3; margin: 0; }
  .panel.table .row-item .row-right { grid-column: 4; }
  .panel.table .row-item > .avatar, .panel.table .row-item > .cc-mini { grid-column: 1; }
}
/* pantallas intermedias (tablet): vencimientos de a dos */
@media (min-width: 900px) and (max-width: 1199px) {
  .due-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* cuentas: el nombre siempre en una sola línea (con puntos suspensivos si no entra) */
.row-item.brand-row .grow { min-width: 0; }
.row-item.brand-row .row-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Al pasar el mouse (o tocar), el sombreado de una fila llega de borde a borde del panel, no solo hasta el margen interno */
.panel { overflow: hidden; }
.panel .row-item:active:not(.static) { box-shadow: -16px 0 0 var(--surface-2), 16px 0 0 var(--surface-2); }
@media (hover: hover) {
  .panel .row-item:hover:not(.static) { box-shadow: -16px 0 0 var(--surface-2), 16px 0 0 var(--surface-2); }
}
