/* =====================================================================
   WALLET · Sistema de diseño
   Superficie tinta profunda + color de marca real por cuenta.
   Los números son el protagonista: mono tabular, nunca se desalinean.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700;12..96,800&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  /* Superficies */
  --ink:        #0E1117;
  --surface:    #161A23;
  --surface-2:  #1E2430;
  --surface-3:  #262E3C;
  --line:       #2A3242;
  --line-soft:  #1F2632;

  /* Texto */
  --text:       #E9ECF3;
  --text-2:     #A9B3C4;
  --muted:      #6E7A8E;

  /* Semántica del dinero */
  --in:         #34D399;
  --in-dim:     #34d3991a;
  --out:        #F87171;
  --out-dim:    #f871711a;
  --gold:       #F2C14E;
  --gold-dim:   #f2c14e1a;
  --transfer:   #7DA3F0;
  --warn:       #FBBF24;

  /* Tipografía */
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body:    'Inter', system-ui, -apple-system, sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, monospace;

  /* Escala */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25);
  --nav-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}

@media (min-width: 900px) { body { padding-bottom: 0; } }

/* Todo número de dinero pasa por acá. tabular-nums evita el temblor. */
.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  letter-spacing: -.02em;
}

.pos { color: var(--in); }
.neg { color: var(--out); }
.tr  { color: var(--transfer); }

a { color: inherit; text-decoration: none; }
button { font: inherit; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------------------------------------------------------------------
   Layout
   --------------------------------------------------------------------- */
.shell { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 20px;
}

.brand {
  font-family: var(--display);
  font-weight: 800; font-size: 19px; letter-spacing: -.03em;
  display: flex; align-items: center; gap: 8px;
}
.brand-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold);
}

.nav-desktop { display: none; gap: 4px; margin-left: auto; }
@media (min-width: 900px) { .nav-desktop { display: flex; } }

.nav-desktop a {
  padding: 7px 13px; border-radius: 999px;
  color: var(--text-2); font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-desktop a:hover { background: var(--surface-2); color: var(--text); }
.nav-desktop a[aria-current="page"] { background: var(--surface-3); color: var(--text); }

/* Barra inferior en móvil */
.nav-mobile {
  position: fixed; inset: auto 0 0 0; z-index: 50;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
}
@media (min-width: 900px) { .nav-mobile { display: none; } }

.nav-mobile a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10.5px; color: var(--muted); font-weight: 500;
}
.nav-mobile a[aria-current="page"] { color: var(--gold); }
.nav-mobile svg { width: 21px; height: 21px; }

.nav-fab {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--gold); color: #0E1117;
  display: grid; place-items: center;
  box-shadow: 0 4px 16px rgba(242,193,78,.35);
}
.nav-fab svg { width: 24px; height: 24px; stroke-width: 2.5; }

/* ---------------------------------------------------------------------
   Encabezado de patrimonio: el elemento firma
   --------------------------------------------------------------------- */
.networth {
  padding: 30px 0 22px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 22px;
}
.networth-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .14em;
  color: var(--muted); font-weight: 600; margin-bottom: 6px;
}
.networth-value {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: clamp(34px, 9vw, 54px); font-weight: 700;
  letter-spacing: -.04em; line-height: 1;
}
.networth-value .cur { color: var(--muted); font-size: .5em; margin-right: 6px; vertical-align: .18em; }
.networth-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; font-size: 13px; color: var(--text-2); }

.trm-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12.5px;
}
.trm-chip strong { font-family: var(--mono); font-weight: 500; }

/* ---------------------------------------------------------------------
   Cinta de cuentas: cada tarjeta lleva el color real de la entidad
   --------------------------------------------------------------------- */
.accounts-strip {
  display: flex; gap: 11px; overflow-x: auto;
  padding: 2px 16px 14px; margin: 0 -16px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.accounts-strip::-webkit-scrollbar { display: none; }

.account-card {
  flex: 0 0 auto; min-width: 172px;
  scroll-snap-align: start;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 13px 15px;
  position: relative; overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.account-card:hover { border-color: var(--surface-3); transform: translateY(-1px); }
.account-card::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--accent, var(--muted));
}
.account-card .ac-name {
  font-size: 12.5px; color: var(--text-2); font-weight: 500;
  display: flex; align-items: center; gap: 6px; margin-bottom: 7px;
}
.account-card .ac-balance { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 19px; font-weight: 500; letter-spacing: -.03em; }
.account-card .ac-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; font-family: var(--mono); }

.ac-badge {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em;
  padding: 2px 6px; border-radius: 4px;
  background: var(--surface-3); color: var(--text-2); font-weight: 600;
}

/* ---------------------------------------------------------------------
   Tarjetas y rejillas
   --------------------------------------------------------------------- */
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1000px) {
  .grid-main { grid-template-columns: 1.6fr 1fr; }
}

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 18px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 15px;
}
.card-title {
  font-family: var(--display); font-weight: 700; font-size: 15.5px;
  letter-spacing: -.02em; margin: 0;
}
.card-link { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.card-link:hover { color: var(--gold); }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 15px; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.stat-value { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 21px; font-weight: 600; letter-spacing: -.03em; margin-top: 6px; }
.stat-delta { font-size: 12px; margin-top: 4px; font-family: var(--mono); }

/* ---------------------------------------------------------------------
   Lista de movimientos
   --------------------------------------------------------------------- */
.tx-list { display: flex; flex-direction: column; }
.tx-day {
  font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); font-weight: 600;
  padding: 14px 0 7px; border-bottom: 1px solid var(--line-soft);
}
.tx {
  display: grid; grid-template-columns: 34px 1fr auto;
  gap: 12px; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--line-soft);
}
.tx:last-child { border-bottom: 0; }

.tx-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent, var(--muted)) 15%, transparent);
  color: var(--accent, var(--muted));
}
.tx-icon svg { width: 17px; height: 17px; }

.tx-main { min-width: 0; }
.tx-desc {
  font-weight: 500; font-size: 14.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tx-meta {
  font-size: 12px; color: var(--muted); margin-top: 2px;
  display: flex; align-items: center; gap: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tx-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .5; flex: none; }

.tx-amount { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 14.5px; font-weight: 500; text-align: right; white-space: nowrap; }
.tx-amount small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }

/* ---------------------------------------------------------------------
   Barras de categoría / presupuesto
   --------------------------------------------------------------------- */
.bar-row { padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.bar-row:last-child { border-bottom: 0; }
.bar-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.bar-name { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; min-width: 0; }
.bar-swatch { width: 9px; height: 9px; border-radius: 3px; background: var(--accent, var(--muted)); flex: none; }
.bar-value { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13.5px; white-space: nowrap; }

.bar-track { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--accent, var(--muted)); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.bar-fill.excedido { background: var(--out); }
.bar-fill.atencion { background: var(--warn); }
.bar-fill.bien     { background: var(--in); }

.bar-foot { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 5px; font-family: var(--mono); }

/* ---------------------------------------------------------------------
   Formularios
   --------------------------------------------------------------------- */
.field { margin-bottom: 15px; }
.label {
  display: block; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted); font-weight: 600; margin-bottom: 6px;
}

.input, .select, .textarea {
  width: 100%; padding: 11px 13px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--text);
  font-family: var(--body); font-size: 15px;
  transition: border-color .15s, background .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--gold); background: var(--surface-3);
}
.textarea { resize: vertical; min-height: 72px; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E7A8E' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 17px;
  padding-right: 36px;
}

/* Campo de monto: grande, mono, imposible de leer mal */
.amount-input {
  width: 100%; padding: 16px 15px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r); color: var(--text);
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 32px; font-weight: 600; letter-spacing: -.03em;
  text-align: right;
}
.amount-input:focus { outline: none; border-color: var(--gold); }
.amount-wrap { position: relative; }
.amount-cur {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 17px; color: var(--muted); pointer-events: none;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 18px; border-radius: var(--r-sm); border: 1px solid transparent;
  font-size: 14.5px; font-weight: 600; cursor: pointer;
  transition: filter .15s, background .15s, border-color .15s;
}
.btn:hover { filter: brightness(1.1); }
.btn-primary { background: var(--gold); color: #0E1117; }
.btn-ghost   { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn-danger  { background: transparent; color: var(--out); border-color: color-mix(in srgb, var(--out) 35%, transparent); }
.btn-block   { width: 100%; }
.btn-sm      { padding: 7px 12px; font-size: 13px; }

/* Selector de tipo: gasto / ingreso / transferencia */
.type-switch {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px;
  background: var(--surface-2); padding: 5px; border-radius: var(--r);
  border: 1px solid var(--line); margin-bottom: 20px;
}
.type-switch a {
  text-align: center; padding: 10px 6px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600; color: var(--muted);
  transition: background .15s, color .15s;
}
.type-switch a[aria-current="true"] { background: var(--surface-3); color: var(--text); }
.type-switch a[aria-current="true"][data-kind="gasto"]    { color: var(--out); }
.type-switch a[aria-current="true"][data-kind="ingreso"]  { color: var(--in); }
.type-switch a[aria-current="true"][data-kind="transferencia"] { color: var(--transfer); }

/* Chips de categorías frecuentes: el atajo de los 8 segundos */
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text-2);
  transition: border-color .15s, color .15s, background .15s;
}
.chip:hover { border-color: var(--surface-3); color: var(--text); }
.chip[aria-pressed="true"] {
  border-color: var(--accent, var(--gold));
  background: color-mix(in srgb, var(--accent, var(--gold)) 14%, transparent);
  color: var(--text);
}
.chip-swatch { width: 8px; height: 8px; border-radius: 50%; background: var(--accent, var(--muted)); }

/* ---------------------------------------------------------------------
   Utilidades
   --------------------------------------------------------------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; padding: 24px 0 18px; flex-wrap: wrap; }
.page-title { font-family: var(--display); font-weight: 800; font-size: clamp(23px, 5vw, 30px); letter-spacing: -.035em; margin: 0; }
.page-sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.row   { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread{ display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mt    { margin-top: 14px; }
.mb    { margin-bottom: 14px; }

.chart { width: 100%; height: 260px; }
.chart-sm { height: 190px; }
.chart-lg { height: 340px; }

.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty-title { font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--text-2); margin-bottom: 5px; }

.flash {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 16px); z-index: 60;
  padding: 12px 18px; border-radius: var(--r);
  background: var(--surface-3); border: 1px solid var(--line);
  box-shadow: var(--shadow); font-size: 14px; font-weight: 500;
  animation: rise .3s cubic-bezier(.2,.8,.2,1);
  max-width: calc(100vw - 32px);
}
.flash.error { border-color: color-mix(in srgb, var(--out) 45%, transparent); color: var(--out); }
.flash.ok    { border-color: color-mix(in srgb, var(--in) 45%, transparent); }
@media (min-width: 900px) { .flash { bottom: 24px; } }

@keyframes rise { from { opacity: 0; transform: translate(-50%, 14px); } }

dialog {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 22px; max-width: 460px; width: calc(100vw - 32px);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(6,8,12,.7); backdrop-filter: blur(3px); }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line);
}
table.data td { padding: 11px 10px; border-bottom: 1px solid var(--line-soft); }
table.data td.n { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------------------------------------------------------------------
   Patrimonio real vs. patrimonio con tarjetas
   --------------------------------------------------------------------- */
.wealth-split {
  display: grid; grid-template-columns: 1fr; gap: 11px;
  margin-top: 18px;
}
@media (min-width: 560px) { .wealth-split { grid-template-columns: 1fr 1fr; max-width: 560px; } }

.wealth-box {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 13px 15px;
}

/* Tarjeta de crédito: se distingue de las cuentas con dinero real */
.account-card.is-credit { border-style: dashed; }

/* ---------------------------------------------------------------------
   Navegación móvil: 4 accesos fijos + hoja "Más"
   --------------------------------------------------------------------- */
.nav-more {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: 0; padding: 0; cursor: pointer;
  font-size: 10.5px; font-weight: 500; color: var(--muted);
  font-family: var(--body);
}
.nav-more svg { width: 21px; height: 21px; }
.nav-more[aria-current="page"] { color: var(--gold); }

.nav-icon { display: inline-flex; align-items: center; padding: 7px 10px !important; }

/* Hoja inferior */
dialog.sheet {
  margin: 0 0 0 auto;
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  background: var(--surface);
  animation: sheet-up .22s cubic-bezier(.2,.8,.2,1);
}
dialog.sheet::backdrop { background: rgba(6,8,12,.65); backdrop-filter: blur(2px); }

@media (min-width: 900px) { dialog.sheet { display: none !important; } }

@keyframes sheet-up { from { transform: translateY(100%); } }

.sheet-grip {
  width: 38px; height: 4px; border-radius: 999px;
  background: var(--surface-3); margin: 2px auto 12px;
}

.sheet-list { display: flex; flex-direction: column; margin-bottom: 12px; }

.sheet-item {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 6px; border-bottom: 1px solid var(--line-soft);
  background: none; border-left: 0; border-right: 0; border-top: 0;
  width: 100%; text-align: left; cursor: pointer;
  color: var(--text); font-family: var(--body);
}
.sheet-item:last-child { border-bottom: 0; }
.sheet-item:active { background: var(--surface-2); }

.sheet-icon {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--text-2);
}
.sheet-item[aria-current="page"] .sheet-icon { background: var(--gold-dim); color: var(--gold); }
.sheet-item[aria-current="page"] strong { color: var(--gold); }

.sheet-text { display: flex; flex-direction: column; min-width: 0; }
.sheet-text strong { font-size: 15px; font-weight: 600; }
.sheet-text small { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* =====================================================================
   Optimización móvil
   Escritorio queda intacto: todo vive dentro de max-width: 640px.
   ===================================================================== */

/* Nada debe desbordar el ancho de la pantalla */
html, body { max-width: 100%; overflow-x: hidden; }

/* Tablas: se desplazan solas en vez de romper el layout */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
.table-wrap table.data { min-width: 380px; }

/* Las gráficas nunca se salen */
.chart { max-width: 100%; }

/* Respaldo si el navegador no soporta <dialog> */
dialog.sheet.sheet-open {
  display: block; z-index: 90;
  box-shadow: 0 -8px 40px rgba(0,0,0,.6);
}

@media (max-width: 640px) {

  body { font-size: 14.5px; }
  .shell { padding: 0 14px; }

  /* --- Cabecera de patrimonio --- */
  .networth { padding: 22px 0 18px; margin-bottom: 18px; }
  .networth-value { font-size: clamp(31px, 11vw, 44px); }
  .networth-meta { gap: 6px 14px; font-size: 12.5px; margin-top: 12px; }
  .wealth-split { gap: 9px; margin-top: 14px; }
  .wealth-box { padding: 11px 13px; }

  /* --- Cabeceras de página --- */
  .page-head { padding: 18px 0 14px; gap: 10px; }
  .page-head > .row,
  .page-head > form { width: 100%; }
  .page-head .row { gap: 8px; }
  .page-head .btn,
  .page-head .input,
  .page-head form .input { flex: 1 1 auto; min-width: 0; }

  /* --- Tarjetas --- */
  .card { padding: 15px; border-radius: 14px; }
  .card-head { margin-bottom: 12px; }
  .card-title { font-size: 15px; }
  .grid { gap: 11px; }

  /* Métricas: 2 columnas, texto más contenido */
  .stat { padding: 12px 13px; }
  .stat-label { font-size: 10px; letter-spacing: .07em; }
  .stat-value { font-size: 18px; margin-top: 4px; }
  .stat-delta { font-size: 11px; }

  /* --- Cinta de cuentas --- */
  .accounts-strip { gap: 9px; padding: 2px 14px 12px; margin: 0 -14px; }
  .account-card { min-width: 158px; padding: 12px 13px; }
  .account-card .ac-balance { font-size: 17px; }

  /* --- Movimientos --- */
  .tx { grid-template-columns: 32px 1fr auto; gap: 10px; padding: 10px 0; }
  .tx-icon { width: 32px; height: 32px; border-radius: 9px; }
  .tx-desc { font-size: 14px; }
  .tx-meta { font-size: 11.5px; }
  .tx-amount { font-size: 13.5px; }

  /* --- Barras de categoría y presupuesto --- */
  .bar-name { font-size: 13.5px; }
  .bar-value { font-size: 12.5px; }
  .bar-foot { font-size: 11px; }

  /* En presupuesto el campo del monto baja a su propia línea */
  .bar-head { flex-wrap: wrap; }
  .bar-head .row { width: 100%; justify-content: flex-end; }

  /* --- Gráficas más bajas para no ocupar toda la pantalla --- */
  .chart    { height: 215px; }
  .chart-sm { height: 175px; }
  .chart-lg { height: 265px; }

  /* --- Formularios: 16px evita que iOS haga zoom al enfocar --- */
  .input, .select, .textarea { font-size: 16px; padding: 12px 13px; }
  .amount-input { font-size: 28px; padding: 15px 14px; }
  .field { margin-bottom: 13px; }

  /* Área táctil mínima cómoda */
  .btn { min-height: 44px; padding: 11px 16px; }
  .btn-sm { min-height: 38px; padding: 8px 13px; font-size: 13px; }
  .chip { min-height: 38px; padding: 8px 13px; }

  /* Los pares de campos se apilan cuando aprietan */
  .grid-2 > .field,
  form .grid-2 { gap: 10px; }

  /* --- Filtros de movimientos --- */
  .card form .grid-3 { gap: 9px; }

  /* --- Diálogos: casi pantalla completa --- */
  dialog:not(.sheet) {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 80px);
    overflow-y: auto;
    padding: 18px;
  }

  /* --- Hoja Más --- */
  .sheet-item { padding: 14px 4px; }
  .sheet-text strong { font-size: 14.5px; }

  /* --- Avisos --- */
  .flash { font-size: 13.5px; padding: 11px 15px; }

  /* --- Tipografía de encabezados --- */
  .page-title { font-size: clamp(21px, 6vw, 26px); }
  .page-sub { font-size: 12.5px; }
}

/* Pantallas muy angostas (iPhone SE y similares) */
@media (max-width: 380px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 16.5px; }
  .account-card { min-width: 146px; }
  .nav-mobile a span, .nav-more span { font-size: 9.5px; }
}
