:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f1f4;
  --text: #12141a;
  --text-dim: #6b7280;
  --border: #e5e7eb;
  --accent: #0f766e;
  --accent-soft: #d7efec;
  --ingreso: #15803d;
  --ingreso-soft: #dcfce7;
  --gasto: #dc2626;
  --gasto-soft: #fee2e2;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #151c2c;
    --surface-2: #1c2436;
    --text: #eef1f6;
    --text-dim: #93a0b4;
    --border: #263149;
    --accent: #2dd4bf;
    --accent-soft: #123536;
    --ingreso: #4ade80;
    --ingreso-soft: #10321f;
    --gasto: #f87171;
    --gasto-soft: #3a1a1c;
    --shadow: 0 1px 3px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { touch-action: manipulation; }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* HEADER */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(var(--safe-top) + 10px) 16px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}
.month-label {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  background: none;
  border: none;
  text-transform: capitalize;
  min-width: 150px;
  padding: 6px 12px;
  border-radius: 10px;
}
.month-label:active { background: var(--surface-2); }
.month-nav {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 26px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.month-nav:active { background: var(--surface-2); }

/* MAIN */
#main {
  flex: 1;
  padding: 6px 16px 120px;
  overflow-y: auto;
}
.view.hidden { display: none; }

/* BALANCE CARD */
.balance-card {
  background: linear-gradient(150deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000 12%));
  border-radius: 24px;
  padding: 22px 22px 18px;
  color: #fff;
  box-shadow: var(--shadow);
  margin-top: 8px;
}
.balance-label { font-size: 13px; opacity: .82; font-weight: 500; letter-spacing: .02em; }
.balance-amount {
  display: block;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-top: 4px;
  line-height: 1.05;
}
.balance-split {
  display: flex;
  align-items: center;
  margin-top: 18px;
  background: rgba(255,255,255,.13);
  border-radius: 14px;
  padding: 12px 8px;
}
.split-item { flex: 1; text-align: center; }
.split-caption { display: block; font-size: 12px; opacity: .8; }
.split-value { display: block; font-size: 17px; font-weight: 700; margin-top: 2px; }
.split-divider { width: 1px; align-self: stretch; background: rgba(255,255,255,.22); }

/* SECTION */
.section-block { margin-top: 26px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.section-head h2 { font-size: 16px; font-weight: 700; margin: 0; }
.link-btn {
  background: none; border: none; color: var(--accent);
  font-size: 14px; font-weight: 600; padding: 4px;
}

/* CATEGORY BREAKDOWN */
.cat-breakdown { display: flex; flex-direction: column; gap: 14px; }
.cat-row { display: flex; align-items: center; gap: 12px; }
.cat-emoji {
  width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; flex-shrink: 0;
}
.cat-info { flex: 1; min-width: 0; }
.cat-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.cat-name { font-size: 14px; font-weight: 600; }
.cat-amount { font-size: 14px; font-weight: 700; }
.cat-pct { font-size: 12px; color: var(--text-dim); margin-left: 6px; font-weight: 500; }
.cat-bar { height: 7px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.cat-bar-fill { height: 100%; border-radius: 4px; transition: width .4s ease; }

/* TX LIST */
.tx-list { display: flex; flex-direction: column; }
.tx-list.grouped { gap: 4px; }
.tx-date-head {
  font-size: 12px; font-weight: 600; color: var(--text-dim);
  text-transform: capitalize; margin: 18px 2px 6px;
}
.tx-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border);
  background: none; border-left: none; border-right: none; border-top: none;
  width: 100%; text-align: left;
}
.tx-item:active { background: var(--surface-2); border-radius: 12px; }
.tx-emoji {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; flex-shrink: 0;
}
.tx-body { flex: 1; min-width: 0; }
.tx-cat { font-size: 15px; font-weight: 600; }
.tx-nota { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-amount { font-size: 15px; font-weight: 700; white-space: nowrap; }
.tx-amount.ingreso { color: var(--ingreso); }
.tx-amount.gasto { color: var(--text); }

.empty-hint { color: var(--text-dim); font-size: 14px; text-align: center; padding: 20px 0; }
.empty-big {
  text-align: center; padding: 60px 20px; color: var(--text-dim);
}
.empty-big .emoji { font-size: 44px; display: block; margin-bottom: 12px; }
.empty-big .title { font-size: 16px; font-weight: 600; color: var(--text); }
.empty-big .sub { font-size: 14px; margin-top: 4px; }

/* FILTER */
.filter-bar { display: flex; gap: 8px; margin: 10px 0 4px; }
.chip {
  padding: 7px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 14px; font-weight: 600; color: var(--text-dim);
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* BOTTOM NAV */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 480px; margin: 0 auto;
  height: calc(64px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex; align-items: center; justify-content: space-around;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
  z-index: 30;
}
.nav-btn {
  flex: 1; background: none; border: none;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text-dim); padding: 8px 0;
}
.nav-btn.active { color: var(--accent); }
.nav-icon { font-size: 20px; line-height: 1; }
.nav-text { font-size: 11px; font-weight: 600; }
.fab {
  position: fixed;
  right: max(18px, calc(50% - 240px + 18px));
  bottom: calc(74px + var(--safe-bottom));
  width: 58px; height: 58px; border-radius: 50%;
  border: none; background: var(--accent); color: #fff;
  font-size: 32px; font-weight: 300; line-height: 1;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent);
  z-index: 35;
  display: flex; align-items: center; justify-content: center;
}
.fab:active { transform: scale(.94); }

.hidden-soft { display: none !important; }

/* SHEET */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 40; opacity: 1; transition: opacity .25s;
}
.sheet-backdrop.hidden { display: none; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-width: 480px; margin: 0 auto;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  z-index: 50;
  padding: 8px 20px calc(24px + var(--safe-bottom));
  box-shadow: 0 -8px 40px rgba(0,0,0,.2);
  transform: translateY(0);
  transition: transform .3s cubic-bezier(.32,.72,0,1);
  max-height: 92dvh; overflow-y: auto;
}
.sheet.hidden { transform: translateY(105%); pointer-events: none; }
.sheet-handle {
  width: 38px; height: 5px; border-radius: 3px;
  background: var(--border); margin: 4px auto 10px;
}
.sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.sheet-title { font-size: 16px; font-weight: 700; }
.sheet-cancel, .sheet-save {
  background: none; border: none; font-size: 16px; font-weight: 600; padding: 4px;
}
.sheet-cancel { color: var(--text-dim); }
.sheet-save { color: var(--accent); }

.type-toggle {
  display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px;
}
.type-opt {
  flex: 1; padding: 9px; border: none; background: none; border-radius: 9px;
  font-size: 15px; font-weight: 600; color: var(--text-dim);
}
.type-opt.gasto.active { background: var(--surface); color: var(--gasto); box-shadow: var(--shadow); }
.type-opt.ingreso.active { background: var(--surface); color: var(--ingreso); box-shadow: var(--shadow); }

.amount-input-wrap {
  display: flex; align-items: center; justify-content: center;
  gap: 4px; margin: 26px 0 20px;
}
.amount-currency { font-size: 34px; font-weight: 700; color: var(--text-dim); }
.amount-input {
  font-size: 46px; font-weight: 800; border: none; background: none;
  color: var(--text); width: auto; max-width: 70%; text-align: left;
  letter-spacing: -.02em; padding: 0; outline: none;
}
.amount-input::placeholder { color: var(--border); }

.field-label {
  display: block; font-size: 13px; font-weight: 600; color: var(--text-dim);
  margin: 14px 2px 8px;
}
.cat-picker {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.cat-opt {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 4px; border-radius: 14px; border: 1.5px solid transparent;
  background: var(--surface-2);
}
.cat-opt .co-emoji { font-size: 22px; }
.cat-opt .co-name { font-size: 11px; font-weight: 500; color: var(--text-dim); text-align: center; line-height: 1.1; }
.cat-opt.active { border-color: var(--accent); background: var(--accent-soft); }
.cat-opt.active .co-name { color: var(--text); font-weight: 600; }

.text-field {
  width: 100%; padding: 13px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: 16px; color: var(--text); outline: none;
  font-family: inherit;
}
.text-field:focus { border-color: var(--accent); }

.delete-btn {
  width: 100%; margin-top: 24px; padding: 13px; border-radius: 12px;
  border: none; background: var(--gasto-soft); color: var(--gasto);
  font-size: 15px; font-weight: 600;
}
.delete-btn.hidden { display: none; }

/* MONTH SHEET */
.month-sheet { max-height: none; }
.year-nav {
  display: flex; align-items: center; justify-content: center; gap: 20px;
  margin: 6px 0 18px; font-size: 18px; font-weight: 700;
}
.month-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.month-cell {
  padding: 14px 0; border-radius: 12px; border: none;
  background: var(--surface-2); font-size: 14px; font-weight: 600;
  color: var(--text); text-transform: capitalize;
}
.month-cell.active { background: var(--accent); color: #fff; }
.month-cell.current { border: 1.5px solid var(--accent); }

/* TOAST */
.toast {
  position: fixed; bottom: calc(90px + var(--safe-bottom)); left: 50%;
  transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 11px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 600; z-index: 60;
  box-shadow: var(--shadow); white-space: nowrap;
  transition: opacity .25s, transform .25s;
}
.toast.hidden { opacity: 0; transform: translateX(-50%) translateY(10px); pointer-events: none; }

/* ===== LOADING ===== */
.loading-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); z-index: 100;
}
.spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid var(--surface-2); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== AUTH SCREEN ===== */
.auth-screen {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 24px calc(24px + env(safe-area-inset-right)) 24px calc(24px + env(safe-area-inset-left));
  background: var(--bg);
  overflow-y: auto;
}
.auth-card {
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; align-items: stretch;
}
.auth-logo {
  width: 68px; height: 68px; border-radius: 20px;
  align-self: center;
  background: linear-gradient(150deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000 12%));
  color: #fff; font-size: 38px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 40%, transparent);
}
.auth-app-name {
  text-align: center; font-size: 24px; font-weight: 800;
  margin: 16px 0 6px; letter-spacing: -.02em;
}
.auth-subtitle {
  text-align: center; color: var(--text-dim); font-size: 14px;
  margin: 0 0 24px; line-height: 1.4;
}
.auth-form { display: flex; flex-direction: column; }
.auth-form .field-label { margin-top: 12px; }
.auth-form .field-label:first-child { margin-top: 0; }
.auth-error {
  color: var(--gasto); font-size: 13px; font-weight: 500;
  margin: 12px 0 0; line-height: 1.4;
}
.auth-submit {
  margin-top: 20px; padding: 15px; border-radius: 14px; border: none;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 700;
}
.auth-submit:active { transform: scale(.99); }
.auth-submit:disabled { opacity: .65; }
.auth-toggle-row {
  text-align: center; margin-top: 22px; font-size: 14px; color: var(--text-dim);
}
.auth-toggle-row .link-btn { font-size: 14px; padding: 4px 2px; }

/* ===== LOGOUT BTN ===== */
.icon-btn {
  position: absolute; right: 12px;
  top: calc(var(--safe-top) + 10px);
  width: 40px; height: 40px; border-radius: 12px;
  border: none; background: none; color: var(--text-dim);
  font-size: 20px; display: flex; align-items: center; justify-content: center;
}
.icon-btn:active { background: var(--surface-2); }

/* ===== COTIZACIÓN DÓLAR ===== */
.rate-card {
  display: flex; align-items: center; gap: 12px;
  margin-top: 16px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow);
}
.rate-icon { font-size: 22px; }
.rate-info { flex: 1; display: flex; flex-direction: column; }
.rate-title { font-size: 13px; font-weight: 600; }
.rate-date { font-size: 11px; color: var(--text-dim); text-transform: capitalize; }
.rate-value { font-size: 18px; font-weight: 800; color: var(--accent); }

/* ===== TOGGLE DE MONEDA (en el formulario) ===== */
.moneda-toggle {
  display: flex; gap: 8px; justify-content: center; margin: 0 0 6px;
}
.moneda-opt {
  padding: 8px 18px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: 14px; font-weight: 600; color: var(--text-dim);
}
.moneda-opt.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.moneda-preview {
  text-align: center; font-size: 13px; color: var(--text-dim);
  font-weight: 500; margin-bottom: 6px;
}
.moneda-preview.hidden { display: none; }

/* Selector de cuotas (3 / 6 / 9 / 12 / 18) */
.cuotas-picker { display: flex; gap: 8px; margin-bottom: 10px; }
.cuota-opt {
  flex: 1; padding: 12px 0; border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 12px; font-size: 16px; font-weight: 700; font-family: inherit;
  color: var(--text); cursor: pointer;
}
.cuota-opt.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.cuotas-preview {
  text-align: center; font-size: 14px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border-radius: 10px; padding: 9px; margin-bottom: 14px;
}
.cuotas-preview.hidden { display: none; }
#cuotasField.hidden, #montoLabel.hidden { display: none; }

/* Importar resumen de tarjeta */
.import-chip { margin-left: auto; }
.file-drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 26px 16px; border: 2px dashed var(--border); border-radius: 14px;
  background: var(--surface-2); cursor: pointer; margin-bottom: 12px;
}
.file-drop:active { border-color: var(--accent); background: var(--accent-soft); }
.file-drop-icon { font-size: 28px; }
.file-drop-title { font-size: 15px; font-weight: 700; color: var(--accent); }
.file-drop-sub { font-size: 12px; color: var(--text-dim); }
.import-status {
  text-align: center; font-size: 13px; color: var(--text-dim);
  padding: 10px; background: var(--surface-2); border-radius: 10px;
}
.import-status.hidden { display: none; }
.import-resumen {
  background: var(--surface-2); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px;
}
.imp-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 3px 0; font-size: 14px; }
.imp-row.dim { color: var(--text-dim); font-size: 13px; }
.imp-row strong { font-weight: 800; }
.imp-item .ins-info { gap: 3px; flex: 1; }
.imp-cat {
  margin-top: 4px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font-family: inherit; font-size: 12px; max-width: 165px;
}
.imp-cuota {
  font-size: 11px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border-radius: 6px; padding: 1px 5px; margin-left: 4px;
}
#importarPaso1.hidden, #importarPaso2.hidden, #importarConfirm.hidden { display: none; }

/* Última importación y posibles duplicados con cargas manuales */
.import-ultima {
  font-size: 12.5px; color: var(--text-dim); background: var(--surface-2);
  border-radius: 9px; padding: 8px 11px; margin: 0 0 12px;
}
.import-ultima.hidden { display: none; }
.import-dupes {
  background: color-mix(in srgb, #f59e0b 12%, transparent);
  border: 1px solid color-mix(in srgb, #f59e0b 34%, transparent);
  border-radius: 12px; padding: 11px 13px; margin-bottom: 14px;
}
.import-dupes.hidden { display: none; }
.dup-titulo { margin: 0 0 7px; font-size: 13px; font-weight: 700; line-height: 1.35; }
.dup-fila { display: flex; flex-direction: column; font-size: 12.5px; padding: 3px 0; }
.dup-fila small { color: var(--text-dim); font-size: 11.5px; }
.dup-check { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 12.5px; cursor: pointer; }
.dup-check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Importar agrupado por comercio */
.imp-row.aviso { color: #b45309; font-size: 12px; display: block; padding-top: 6px; }
.imp-grupo { border-bottom: 1px solid var(--border); }
.imp-grupo .ins-row { border-bottom: none; }
.imp-cat-grupo {
  margin-top: 5px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font-family: inherit; font-size: 12px; max-width: 170px;
}
.imp-veces {
  border: none; background: none; padding: 0; font-family: inherit;
  font-size: 12px; font-weight: 600; color: var(--accent); cursor: pointer;
}
.imp-detalle { padding: 0 0 8px 2px; }
.imp-detalle.hidden { display: none; }
.imp-det {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12px; color: var(--text-dim); padding: 3px 0;
}
.linea-costo small { display: block; font-size: 11px; font-weight: 600; color: var(--text-dim); }

/* ===== Wall-E ===== */
.walle-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 13px 14px; margin: 0 0 18px; box-shadow: var(--shadow);
}
.walle-card.hidden { display: none; }
.walle-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.walle-ico { font-size: 16px; }
.walle-name { font-size: 12px; font-weight: 800; letter-spacing: .4px; color: var(--accent); text-transform: uppercase; }
.walle-item { display: flex; gap: 9px; align-items: flex-start; padding: 6px 0; }
.walle-item + .walle-item { border-top: 1px solid var(--border); }
.walle-item span { font-size: 15px; line-height: 1.3; flex-shrink: 0; }
.walle-item p { margin: 0; font-size: 13.5px; line-height: 1.4; color: var(--text); }
.walle-item.bien p { color: var(--text); }
.walle-item.ojo p { color: var(--text); }

.type-opt.transf.active { color: var(--text-dim); }
.tx-amount.transferencia { color: var(--text-dim); }
#medioDestField.hidden { display: none; }

/* ===== Medios de pago y saldos ===== */
.saldo-neto {
  display: flex; gap: 8px; background: var(--surface-2);
  border-radius: 14px; padding: 12px; margin-bottom: 12px;
}
.sn-col { flex: 1; display: flex; flex-direction: column; gap: 2px; align-items: center; text-align: center; }
.sn-col small { font-size: 11px; color: var(--text-dim); }
.sn-col strong { font-size: 16px; font-weight: 800; }
.sn-col strong.debe { color: #ef4444; }
.sn-col.destacado { background: var(--surface); border-radius: 10px; padding: 4px 6px; box-shadow: var(--shadow); }
.sn-col.destacado strong { color: var(--accent); }
.saldo-list { display: flex; flex-direction: column; }
.saldo-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 11px 0; border: none; border-bottom: 1px solid var(--border);
  background: none; font-family: inherit; color: var(--text); cursor: pointer;
}
.saldo-item:last-child { border-bottom: none; }
.saldo-item .tx-emoji {
  width: 38px; height: 38px; border-radius: 11px; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0;
}
.saldo-val { font-size: 15px; font-weight: 800; flex-shrink: 0; }
.saldo-val.tiene { color: var(--accent); }
.saldo-val.debe { color: #ef4444; }

.medio-picker { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.medio-picker.hidden { display: none; }
#medioField.hidden { display: none; }
.medio-opt {
  flex-shrink: 0; display: flex; align-items: center; gap: 5px;
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 999px;
  background: var(--surface-2); font-family: inherit; color: var(--text); cursor: pointer;
}
.medio-opt small { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.medio-opt.active { border-color: var(--accent); background: var(--accent-soft); }
.rapido-medios { margin-bottom: 12px; }

/* ===== Chat con Wall-E ===== */
.walle-chat {
  margin-left: auto; border: none; background: none; padding: 0;
  font-family: inherit; font-size: 12px; font-weight: 700; color: var(--accent); cursor: pointer;
}
.chat-sheet { display: flex; flex-direction: column; max-height: 88vh; }
.chat-cuerpo {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 9px;
  padding: 6px 2px 12px; min-height: 220px;
}
.chat-msg {
  max-width: 84%; padding: 10px 13px; border-radius: 15px;
  font-size: 14px; line-height: 1.45; white-space: pre-line;
}
.chat-msg.yo { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
.chat-msg.walle { align-self: flex-start; background: var(--surface-2); color: var(--text); border-bottom-left-radius: 5px; }
.chat-sugerencias { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 10px; }
.chat-sug {
  flex-shrink: 0; padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--accent); font-family: inherit;
  font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.chat-barra { display: flex; gap: 8px; align-items: center; }
.chat-barra input {
  flex: 1; padding: 12px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-family: inherit; font-size: 15px; outline: none;
}
.chat-barra input:focus { border-color: var(--accent); }
.chat-enviar {
  width: 42px; height: 42px; flex-shrink: 0; border: none; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 19px; font-weight: 700; cursor: pointer;
}

/* ===== Proyección ===== */
.sec-hint { font-size: 12px; color: var(--text-dim); }
.proy-resumen { background: var(--surface-2); border-radius: 12px; padding: 11px 13px; margin-bottom: 14px; }
.proy-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 3px 0; font-size: 14px; }
.proy-row.dim { color: var(--text-dim); font-size: 12.5px; }
.proy-row strong { font-weight: 800; }
.proy-row strong.pos { color: var(--accent); }
.proy-row strong.neg { color: #ef4444; }
.proy-graf {
  display: flex; align-items: flex-end; gap: 7px; height: 104px; margin-bottom: 10px;
}
.proy-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; }
.proy-bars {
  flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px;
}
.proy-bar { width: 44%; border-radius: 5px 5px 0 0; min-height: 3px; }
.proy-bar.gas { background: var(--accent); }
.proy-bar.ing { background: color-mix(in srgb, var(--accent) 32%, transparent); }
.proy-col.actual .proy-bar.gas { background: color-mix(in srgb, var(--accent) 70%, #000 18%); }
.proy-mes { font-size: 10.5px; font-weight: 600; color: var(--text-dim); white-space: nowrap; }
.proy-col.actual .proy-mes { color: var(--accent); font-weight: 800; }
.proy-fin { display: block; font-size: 9px; line-height: 1; margin-top: 1px; }
.proy-leyenda { display: flex; gap: 14px; font-size: 11px; color: var(--text-dim); }
.proy-leyenda span { display: flex; align-items: center; gap: 4px; }
.proy-leyenda .dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.proy-leyenda .dot.gas { background: var(--accent); }
.proy-leyenda .dot.ing { background: color-mix(in srgb, var(--accent) 32%, transparent); }
.proy-nota {
  margin: 11px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--text-dim);
  background: var(--accent-soft); border-radius: 10px; padding: 9px 11px;
}

/* ===== Inversiones ===== */
.patrimonio {
  background: linear-gradient(150deg, var(--accent), color-mix(in srgb, var(--accent) 68%, #000 14%));
  border-radius: 18px; padding: 16px 17px; margin-bottom: 14px; color: #fff;
}
.pat-cap { display: block; font-size: 12.5px; opacity: .85; }
.pat-ars { display: block; font-size: 30px; font-weight: 800; letter-spacing: -.8px; margin-top: 2px; }
.pat-usd { display: block; font-size: 14px; font-weight: 600; opacity: .82; }
.pat-rend { display: flex; gap: 9px; margin-top: 13px; }
.pat-r {
  flex: 1; background: rgba(255,255,255,.14); border-radius: 11px; padding: 8px 10px;
  display: flex; flex-direction: column; gap: 1px;
}
.pat-r small { font-size: 10.5px; opacity: .85; }
.pat-r strong { font-size: 17px; font-weight: 800; }
.pat-r.destacado { background: rgba(255,255,255,.24); }
.pat-aviso {
  margin: 11px 0 0; font-size: 12px; line-height: 1.4;
  background: rgba(0,0,0,.2); border-radius: 9px; padding: 8px 10px;
}
.inv-list { display: flex; flex-direction: column; }
.inv-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 11px 0; border: none; border-bottom: 1px solid var(--border);
  background: none; font-family: inherit; color: var(--text); cursor: pointer;
}
.inv-item:last-child { border-bottom: none; }
.inv-item .tx-emoji {
  width: 38px; height: 38px; border-radius: 11px; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0;
}
.inv-right { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; flex-shrink: 0; }
.inv-valor { font-size: 15px; font-weight: 700; }
.inv-rend { font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.inv-rend small { font-size: 9.5px; font-weight: 600; opacity: .7; margin-left: 2px; }
.inv-rend.pos { color: var(--accent); }
.inv-rend.neg { color: #ef4444; }
.inv-linea { display: flex; gap: 8px; align-items: center; }
.inv-linea .text-field { flex: 1; }
.moneda-toggle.mini { margin: 0; flex-shrink: 0; width: auto; }
.moneda-toggle.mini .moneda-opt { padding: 9px 13px; font-size: 13px; }
.inv-preview {
  background: var(--surface-2); border-radius: 12px; padding: 10px 13px; margin-top: 14px;
}
.inv-preview.hidden { display: none; }
.inv-preview .proy-row strong.pos { color: var(--accent); }
.inv-preview .proy-row strong.neg { color: #ef4444; }
.inv-preview .pat-aviso { background: none; color: #b45309; padding: 6px 0 0; }

/* Gastos que se repiten → fijos */
.recur-check { display: flex; align-items: flex-start; gap: 11px; flex: 1; min-width: 0; cursor: pointer; }
.recur-check input { width: 21px; height: 21px; accent-color: var(--accent); margin-top: 3px; flex-shrink: 0; }

.field-hint { font-size: 12px; color: var(--text-dim); margin: 6px 0 0; line-height: 1.35; }
.field-hint.hidden { display: none; }

/* ===== Accesos rápidos (bajo la tarjeta del dólar) ===== */
.quick-row { display: flex; gap: 10px; margin: 0 0 18px; }
.quick-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 13px 8px; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow);
  font-family: inherit; color: var(--text); cursor: pointer;
}
.quick-btn:active { transform: scale(.97); }
.quick-btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.quick-ico { font-size: 21px; line-height: 1.1; }
.quick-txt { font-size: 15px; font-weight: 800; }
.quick-sub { font-size: 11px; opacity: .75; }

/* ===== Hoja de movimiento rápido ===== */
.rapido-foto { position: relative; margin-bottom: 12px; }
.rapido-foto.hidden { display: none; }
.rapido-foto img {
  width: 100%; max-height: 190px; object-fit: cover;
  border-radius: 14px; display: block; background: var(--surface-2);
}
.rapido-foto-quitar {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px;
  border: none; border-radius: 50%; background: rgba(0,0,0,.62); color: #fff;
  font-size: 15px; font-family: inherit; cursor: pointer;
}
.rapido-foto-info {
  position: absolute; left: 8px; bottom: 8px; font-size: 11px; font-weight: 600;
  color: #fff; background: rgba(0,0,0,.55); border-radius: 6px; padding: 2px 7px;
}
.rapido-monto {
  display: flex; align-items: baseline; justify-content: center; gap: 6px;
  padding: 6px 0 14px;
}
.rapido-cur { font-size: 26px; font-weight: 700; color: var(--text-dim); }
.rapido-val { font-size: 46px; font-weight: 800; letter-spacing: -1.5px; }

.rapido-cats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 14px;
}
.rapido-cat {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 9px 3px; border: 1.5px solid var(--border); border-radius: 12px;
  background: var(--surface-2); font-family: inherit; color: var(--text);
  font-size: 17px; cursor: pointer; min-width: 0;
}
.rapido-cat small {
  font-size: 10px; font-weight: 600; color: var(--text-dim);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rapido-cat.active { border-color: var(--c, var(--accent)); background: var(--accent-soft); }
.rapido-cat.active small { color: var(--text); }
.rapido-cat.mas { font-size: 15px; font-weight: 700; color: var(--text-dim); }

.rapido-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.pad-key {
  padding: 15px 0; border: none; border-radius: 13px; background: var(--surface-2);
  font-size: 25px; font-weight: 700; font-family: inherit; color: var(--text); cursor: pointer;
}
.pad-key:active { background: var(--accent-soft); }
.pad-key.mini { font-size: 17px; font-weight: 600; color: var(--text-dim); }

/* Comprobante adjunto en un movimiento ya guardado */
.tx-clip { font-size: 11px; opacity: .7; margin-left: 3px; }
.ver-foto-btn {
  width: 100%; margin: 4px 0 12px; padding: 11px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface-2); color: var(--accent);
  font-size: 14px; font-weight: 700; font-family: inherit; cursor: pointer;
}
.ver-foto-btn.hidden { display: none; }

/* Equivalente en pesos de un monto en dólares (en las listas) */
.tx-eq {
  display: block; font-size: 11px; font-weight: 500;
  color: var(--text-dim); margin-top: 1px;
}

/* ===== FIJOS ===== */
.fijos-summary { margin-bottom: 8px; }
.fijos-tot { display: flex; gap: 10px; }
.ft-item {
  flex: 1; background: var(--surface-2); border-radius: 12px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 2px;
}
.ft-cap { font-size: 12px; color: var(--text-dim); }
.ft-val { font-size: 16px; font-weight: 700; }
.ft-val.ingreso { color: var(--ingreso); }

/* Fila del interruptor "fijo" en el formulario */
.fijo-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 16px; padding: 12px 14px;
  background: var(--surface-2); border-radius: 12px;
}
.fijo-text { display: flex; flex-direction: column; }
.fijo-title { font-size: 15px; font-weight: 600; }
.fijo-sub { font-size: 12px; color: var(--text-dim); }

/* Interruptor tipo iOS */
.switch {
  width: 50px; height: 30px; border-radius: 999px;
  background: var(--border); border: none; position: relative;
  transition: background .2s; flex-shrink: 0; padding: 0;
}
.switch.on { background: var(--accent); }
.switch.locked { opacity: .5; }
.switch-knob {
  position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch.on .switch-knob { transform: translateX(20px); }

/* ===== COMIDAS ===== */
.comida-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin: 10px 0 14px; flex-wrap: wrap;
}
.comida-title { font-size: 22px; font-weight: 800; margin: 0; }
.comida-actions { display: flex; gap: 8px; }
.pill-btn {
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--text);
  display: inline-flex; align-items: center; gap: 6px;
}
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--gasto); color: #fff; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.badge.hidden { display: none; }

.comida-seg {
  display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px;
}
.seg-opt {
  flex: 1; padding: 9px; border: none; background: none; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: var(--text-dim);
}
.seg-opt.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

.comida-navrow {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 14px 0 8px;
}
.comida-label { font-size: 16px; font-weight: 700; min-width: 150px; text-align: center; text-transform: capitalize; }

/* Tarjeta de comida (día) */
.meal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 14px; box-shadow: var(--shadow);
  margin-top: 8px;
}
.meal-card.sugerido { border-style: dashed; }
.meal-top { display: flex; align-items: center; gap: 12px; }
.meal-emoji {
  width: 46px; height: 46px; border-radius: 13px; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0;
}
.meal-info { flex: 1; min-width: 0; }
.meal-name { font-size: 16px; font-weight: 700; }
.meal-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.meal-cost { font-size: 15px; font-weight: 700; white-space: nowrap; }
.meal-actions { display: flex; gap: 8px; margin-top: 14px; }
.meal-btn {
  flex: 1; padding: 11px; border-radius: 12px; border: none;
  font-size: 14px; font-weight: 600;
}
.meal-btn.ghost { background: var(--surface-2); color: var(--text); }
.meal-btn.accent { background: var(--accent); color: #fff; }
.meal-done { color: var(--ingreso); font-weight: 700; font-size: 14px; align-self: center; }
.meal-done.sm { font-size: 13px; }

/* Semana */
.week-proj {
  text-align: center; font-size: 13px; color: var(--text-dim);
  margin: 4px 0 12px;
}
.week-proj strong { color: var(--text); font-size: 15px; margin-left: 4px; }
.week-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.week-day { width: 42px; text-align: center; flex-shrink: 0; }
.wd-name { display: block; font-size: 11px; color: var(--text-dim); font-weight: 600; }
.wd-num { display: block; font-size: 17px; font-weight: 700; }
.week-meal { flex: 1; min-width: 0; }
.mini-meal {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 14px;
}
.mini-meal.sugerido { color: var(--text-dim); }
.mini-sug, .mini-meal > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.mini-cost { font-size: 13px; font-weight: 600; }
.mini-btn {
  border: none; background: var(--surface-2); color: var(--text);
  width: 30px; height: 30px; border-radius: 9px; font-size: 13px; font-weight: 600;
}
.mini-btn.accent { background: var(--accent); color: #fff; }
.wide-btn {
  width: 100%; margin-top: 16px; padding: 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 14px; font-weight: 600; color: var(--accent);
}

/* Mes */
.mes-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mes-dow { text-align: center; font-size: 11px; color: var(--text-dim); font-weight: 600; padding-bottom: 4px; }
.mes-cell {
  aspect-ratio: 1; border: none; background: var(--surface-2); border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 0;
}
.mes-cell.empty { background: none; }
.mes-cell.hoy { border: 1.5px solid var(--accent); }
.mes-num { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.mes-emoji { font-size: 16px; line-height: 1; min-height: 16px; }

/* Preferencias */
.pref-hint { font-size: 13px; color: var(--text-dim); margin: 0 0 14px; line-height: 1.4; }
.pref-search { display: flex; gap: 8px; }
.pref-search .text-field { flex: 1; }
.pref-add {
  padding: 0 16px; border-radius: 12px; border: none;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 600;
}
.pref-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; min-height: 4px; }
.pref-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px; background: var(--accent-soft);
  font-size: 14px; font-weight: 600;
}
.pref-chip button { border: none; background: none; color: var(--text-dim); font-size: 14px; padding: 0; }
.fav-list { display: flex; flex-wrap: wrap; gap: 8px; }
.fav-chip {
  padding: 8px 14px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: 14px; font-weight: 600; color: var(--text-dim);
}
.fav-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Compras */
.compras-total-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--surface-2); border-radius: 12px;
  margin-bottom: 12px; font-size: 14px; font-weight: 600;
}
.compras-total-row span:last-child { font-size: 18px; font-weight: 800; color: var(--accent); }
.compra-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.compra-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

/* Filas de insumos (despensa y confirmar compra) */
.ins-list { display: flex; flex-direction: column; }
.ins-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.ins-info { display: flex; flex-direction: column; min-width: 0; }
.ins-name { font-size: 15px; font-weight: 600; }
.ins-cant { font-size: 12px; color: var(--text-dim); }
.ins-price {
  display: flex; align-items: center; gap: 2px;
  background: var(--surface-2); border-radius: 10px; padding: 6px 10px;
  flex-shrink: 0;
}
.ins-cur { color: var(--text-dim); font-weight: 600; }
.ins-input {
  width: 84px; border: none; background: none; outline: none;
  font-size: 15px; font-weight: 700; color: var(--text); text-align: right;
  font-family: inherit;
}

/* Coto: precios reales */
.coto-all-btn {
  width: 100%; margin: 0 0 12px; padding: 11px; border: none; border-radius: 12px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 700;
  font-family: inherit; cursor: pointer;
}
.coto-all-btn:disabled { opacity: .65; }
.coto-btn {
  border: 1px solid var(--accent); background: none; color: var(--accent);
  font-size: 12px; font-weight: 700; font-family: inherit;
  padding: 4px 9px; border-radius: 999px; margin-right: 8px; cursor: pointer; flex-shrink: 0;
}
.coto-btn:disabled { opacity: .5; }
.ins-coto { font-size: 12px; color: var(--accent); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coto-picks { display: flex; flex-direction: column; gap: 6px; padding: 6px 0 12px; }
.coto-picks.hidden { display: none; }
.coto-loading { font-size: 13px; color: var(--text-dim); padding: 4px 2px; }
.coto-pick {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left;
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px;
  padding: 8px 10px; font-family: inherit; cursor: pointer; color: var(--text);
}
.coto-pick:active { background: var(--accent-soft); }
.coto-pick-name { font-size: 13px; line-height: 1.3; min-width: 0; }
.coto-pick-price { font-size: 14px; font-weight: 700; text-align: right; white-space: nowrap; flex-shrink: 0; }
.coto-pick-price small { display: block; font-size: 11px; font-weight: 500; color: var(--text-dim); }

/* Desglose de compra (con despensa) */
.ins-plan { font-size: 12px; color: var(--text); margin-top: 2px; }
.ins-plan.stock { color: var(--accent); }
.linea-costo { font-size: 15px; font-weight: 700; flex-shrink: 0; white-space: nowrap; }
.linea-costo.free { font-size: 12px; font-weight: 600; color: var(--accent); }

/* Despensa (stock) */
.stock-toggle-row { display: flex; gap: 8px; margin: 0 0 12px; }
.stock-toggle {
  flex: 1; padding: 8px; border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 10px; font-size: 13px; font-weight: 600; font-family: inherit; color: var(--text-dim); cursor: pointer;
}
.stock-toggle.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.stock-input { width: 70px; }

#loading.hidden,
#auth-screen.hidden,
#app.hidden,
#fechaField.hidden,
.auth-error.hidden { display: none; }
