/* Mis Finanzas — Copyright (c) 2026 Felipe Manrique. Todos los derechos reservados. Ver LICENSE. */
/* Layout: una columna tipo app iOS (máx 560px) sobre una aurora suave; todo flota en Liquid Glass transparente
   (estilo 27: borde oscuro fino + brillo especular fuerte) con la barra de pestañas y el micrófono abajo. */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* color del sistema (26/27) — relleno vs. "tinta" para texto chico sobre claro */
  --accent: #0088FF;
  --accent-ink: #1E6EF4;
  --income: #008932;
  --income-fill: #34C759;
  --expense: #E9152D;
  --expense-fill: #FF383C;
  --warn: #C55300;
  --warn-fill: #FF8D28;
  --income-tint: rgba(52, 199, 89, 0.16);
  --expense-tint: rgba(255, 56, 60, 0.13);

  --label: #000;
  --label-2: rgba(60, 60, 67, 0.72);
  --label-3: rgba(60, 60, 67, 0.40);
  --fill: rgba(118, 118, 128, 0.14);
  --fill-2: rgba(118, 118, 128, 0.24);
  --separator: rgba(60, 60, 67, 0.16);

  /* fondo: aurora */
  --bg: #EEF3FA;
  --aurora-1: rgba(0, 136, 255, 0.38);
  --aurora-2: rgba(0, 200, 179, 0.32);
  --aurora-3: rgba(97, 85, 245, 0.30);
  --aurora-4: rgba(255, 45, 85, 0.14);

  /* Liquid Glass — --glass-tint 0 (transparente) ↔ 1 (más opaco); lo ajusta la persona en Ajustes */
  --glass-tint: .35;
  --glass-rgb: 255, 255, 255;
  --glass-bg: rgba(var(--glass-rgb), calc(.20 + .55 * var(--glass-tint)));        /* controles */
  --glass-card: rgba(var(--glass-rgb), calc(.30 + .50 * var(--glass-tint)));      /* tarjetas con texto */
  --glass-sheet: rgba(var(--glass-rgb), calc(.52 + .36 * var(--glass-tint)));     /* hojas grandes */
  --glass-inner: rgba(var(--glass-rgb), calc(.50 + .40 * var(--glass-tint)));     /* tarjetas dentro de hojas */
  --glass-blur: blur(calc(5px + 22px * var(--glass-tint))) saturate(200%);
  --glass-blur-lg: blur(calc(14px + 22px * var(--glass-tint))) saturate(180%);
  --glass-highlight: rgba(255, 255, 255, .95);
  --glass-bevel: rgba(0, 0, 0, .05);
  --glass-edge: rgba(0, 0, 0, .10);
  --glass-sheen: rgba(255, 255, 255, .55);
  --glass-opaque: rgba(255, 255, 255, .96);

  --shadow-card: 0 1px 2px rgba(15, 35, 80, .05), 0 10px 30px rgba(15, 35, 80, .08);
  --shadow-elevated: 0 2px 6px rgba(15, 35, 80, .08), 0 20px 48px rgba(15, 35, 80, .18);
  --scrim: rgba(10, 20, 40, 0.18);

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --snappy: cubic-bezier(0.36, 0.66, 0.04, 1);
  --r-sm: 12px; --r-md: 18px; --r-lg: 26px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #0091FF; --accent-ink: #5CB8FF;
    --income: #30D158; --income-fill: #30D158; --expense: #FF4245; --expense-fill: #FF4245; --warn: #FF9230; --warn-fill: #FF9230;
    --income-tint: rgba(48, 209, 88, 0.18); --expense-tint: rgba(255, 66, 69, 0.18);
    --label: #fff; --label-2: rgba(235, 235, 245, 0.72); --label-3: rgba(235, 235, 245, 0.36);
    --fill: rgba(118, 118, 128, 0.26); --fill-2: rgba(118, 118, 128, 0.40); --separator: rgba(235, 235, 245, 0.12);
    --bg: #05070F;
    --aurora-1: rgba(0, 145, 255, 0.34); --aurora-2: rgba(0, 218, 195, 0.20); --aurora-3: rgba(109, 124, 255, 0.30); --aurora-4: rgba(255, 55, 95, 0.12);
    --glass-rgb: 30, 34, 46;
    --glass-bg: rgba(var(--glass-rgb), calc(.30 + .45 * var(--glass-tint)));
    --glass-card: rgba(var(--glass-rgb), calc(.40 + .42 * var(--glass-tint)));
    --glass-sheet: rgba(var(--glass-rgb), calc(.62 + .30 * var(--glass-tint)));
    --glass-inner: rgba(255, 255, 255, calc(.06 + .06 * var(--glass-tint)));
    --glass-highlight: rgba(255, 255, 255, .30); --glass-bevel: rgba(0, 0, 0, .35); --glass-edge: rgba(0, 0, 0, .55);
    --glass-sheen: rgba(255, 255, 255, .16); --glass-opaque: rgba(36, 36, 40, .97);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
    --shadow-elevated: 0 2px 6px rgba(0, 0, 0, .4), 0 20px 48px rgba(0, 0, 0, .6);
    --scrim: rgba(0, 0, 0, 0.40);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent: #0091FF; --accent-ink: #5CB8FF;
  --income: #30D158; --income-fill: #30D158; --expense: #FF4245; --expense-fill: #FF4245; --warn: #FF9230; --warn-fill: #FF9230;
  --income-tint: rgba(48, 209, 88, 0.18); --expense-tint: rgba(255, 66, 69, 0.18);
  --label: #fff; --label-2: rgba(235, 235, 245, 0.72); --label-3: rgba(235, 235, 245, 0.36);
  --fill: rgba(118, 118, 128, 0.26); --fill-2: rgba(118, 118, 128, 0.40); --separator: rgba(235, 235, 245, 0.12);
  --bg: #05070F;
  --aurora-1: rgba(0, 145, 255, 0.34); --aurora-2: rgba(0, 218, 195, 0.20); --aurora-3: rgba(109, 124, 255, 0.30); --aurora-4: rgba(255, 55, 95, 0.12);
  --glass-rgb: 30, 34, 46;
  --glass-bg: rgba(var(--glass-rgb), calc(.30 + .45 * var(--glass-tint)));
  --glass-card: rgba(var(--glass-rgb), calc(.40 + .42 * var(--glass-tint)));
  --glass-sheet: rgba(var(--glass-rgb), calc(.62 + .30 * var(--glass-tint)));
  --glass-inner: rgba(255, 255, 255, calc(.06 + .06 * var(--glass-tint)));
  --glass-highlight: rgba(255, 255, 255, .30); --glass-bevel: rgba(0, 0, 0, .35); --glass-edge: rgba(0, 0, 0, .55);
  --glass-sheen: rgba(255, 255, 255, .16); --glass-opaque: rgba(36, 36, 40, .97);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-elevated: 0 2px 6px rgba(0, 0, 0, .4), 0 20px 48px rgba(0, 0, 0, .6);
  --scrim: rgba(0, 0, 0, 0.40);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font); font-size: 17px; line-height: 1.3; color: var(--label); background: var(--bg);
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
/* aurora fija detrás de todo: le da al vidrio algo que refractar */
body::before {
  content: ""; position: fixed; inset: -10%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(42% 34% at 12% 8%, var(--aurora-1), transparent 70%),
    radial-gradient(38% 30% at 92% 18%, var(--aurora-3), transparent 70%),
    radial-gradient(46% 36% at 78% 72%, var(--aurora-2), transparent 70%),
    radial-gradient(40% 30% at 10% 88%, var(--aurora-4), transparent 70%),
    var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Liquid Glass ---------- */
/* controles flotantes */
.tabbar, .icon-btn, .search, .segmented, .month-switch .today-link, .toast, .cur-btn {
  background-color: var(--glass-bg);
  background-image: linear-gradient(135deg, var(--glass-sheen) 0%, rgba(255, 255, 255, 0) 42%);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: 0 0 0 .5px var(--glass-edge), inset 0 1px 1px var(--glass-highlight), inset 0 -1px 1px var(--glass-bevel);
}
/* superficies de contenido (texto encima → un poco más de cuerpo) */
.summary, .group, .card, .stat, .list, .banner, .examples button, .welcome-points, .warn-list {
  background-color: var(--glass-card);
  background-image: linear-gradient(140deg, var(--glass-sheen) 0%, rgba(255, 255, 255, 0) 38%);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: 0 0 0 .5px var(--glass-edge), inset 0 1px 1px var(--glass-highlight), inset 0 -1px 1px var(--glass-bevel), var(--shadow-card);
}

.app, .sheet-body, .toast { zoom: var(--ui-zoom, 1); }
.app {
  max-width: 560px; margin: 0 auto;
  padding-inline: 16px;
  padding-block: calc(env(safe-area-inset-top, 0px) + 10px) calc(env(safe-area-inset-bottom, 0px) + 128px);
}

/* ---------- Encabezado ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 8px 4px; }
.large-title { font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 0; display: grid; place-items: center;
  color: var(--accent); transition: transform .18s var(--snappy);
}
.icon-btn:active { transform: scale(.9); }
.icon-btn svg { width: 21px; height: 21px; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.cloud[data-level="ok"] { color: var(--income); }
.cloud[data-level="pending"], .cloud[data-level="busy"] { color: var(--warn); }
.cloud[data-level="busy"] svg { animation: breathe 1.2s ease-in-out infinite; }
.cloud[data-level="error"] { color: #fff; background-color: var(--expense-fill); }
@keyframes breathe { 50% { opacity: .35; } }

.month-switch { display: flex; align-items: center; gap: 4px; margin-block: 6px 14px; }
.month-switch .label { font-size: 17px; font-weight: 600; color: var(--label-2); min-width: 0; padding-inline: 6px; }
.month-switch button { border: 0; background: none; color: var(--accent); width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; }
.month-switch button:disabled { color: var(--label-3); }
.month-switch button svg { width: 20px; height: 20px; }
.month-switch .today-link { width: auto; padding-inline: 14px; font-size: 15px; font-weight: 600; border-radius: 999px; margin-left: auto; }

/* ---------- Resumen ---------- */
.summary { border-radius: var(--r-lg); padding: 22px; display: grid; gap: 16px; }
.summary .caption { font-size: 15px; color: var(--label-2); }
.balance { font-size: clamp(34px, 11vw, 46px); line-height: 1.05; font-weight: 700; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.balance.neg { color: var(--expense); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.split > div { container-type: inline-size; border-radius: var(--r-md); padding: 12px 14px; display: grid; gap: 2px; min-width: 0; box-shadow: inset 0 1px 1px rgba(255, 255, 255, .35); }
.split .in { background: var(--income-tint); }
.split .out { background: var(--expense-tint); }
.split .v { font-size: clamp(14px, 15cqi, 22px); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.split .in .v { color: var(--income); }
.split .out .v { color: var(--expense); }
.usd-line { font-size: 15px; color: var(--label-2); }
.budget { display: grid; gap: 6px; }
.budget .bar { height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; }
.budget .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #00C8B3); border-radius: 4px; transition: width .5s var(--ease); }
.budget .bar i.over { background: var(--expense-fill); }
.budget .row { display: flex; justify-content: space-between; font-size: 14px; color: var(--label-2); gap: 8px; }

/* ---------- Búsqueda y filtros ---------- */
.tools { display: grid; gap: 10px; margin-block: 20px 8px; }
.search { display: flex; align-items: center; gap: 8px; border-radius: 999px; padding-inline: 14px; height: 44px; }
.search svg { width: 18px; height: 18px; color: var(--label-2); flex: none; }
.search input { border: 0; background: none; outline: none; flex: 1; min-width: 0; font-size: 17px; }
.search input::placeholder { color: var(--label-2); }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border-radius: 999px; padding: 3px; }
.segmented button { border: 0; background: none; border-radius: 999px; padding: 8px 10px; font-size: 15px; font-weight: 500; color: var(--label-2); transition: background .25s var(--ease), color .2s; }
.segmented button[aria-pressed="true"] {
  background: rgba(255, 255, 255, .85); color: var(--label); font-weight: 600;
  box-shadow: 0 0 0 .5px var(--glass-edge), 0 2px 8px rgba(0, 0, 0, .10), inset 0 1px 1px #fff;
}
:root[data-theme="dark"] .segmented button[aria-pressed="true"] { background: rgba(255, 255, 255, .18); box-shadow: 0 0 0 .5px rgba(0,0,0,.5), inset 0 1px 1px rgba(255,255,255,.25); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .segmented button[aria-pressed="true"] { background: rgba(255, 255, 255, .18); box-shadow: 0 0 0 .5px rgba(0,0,0,.5), inset 0 1px 1px rgba(255,255,255,.25); } }
.chip-filter { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--label-2); }
.chip-filter button { border: 0; background: var(--fill); color: var(--accent-ink); border-radius: 999px; padding: 6px 12px; font-size: 15px; font-weight: 600; }

/* ---------- Lista ---------- */
.day { margin-top: 20px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; padding-inline: 6px; margin-bottom: 8px; font-size: 14px; font-weight: 600; color: var(--label-2); gap: 8px; }
.group { border-radius: var(--r-md); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; width: 100%; border: 0; background: none; text-align: left;
  position: relative; min-height: 64px; transition: background .15s;
}
.row:active { background: var(--fill); }
.row + .row::before { content: ""; position: absolute; top: 0; left: 66px; right: 0; height: .5px; background: var(--separator); }
.badge {
  --c: #8E8E93;
  width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center;
  font-size: 16px; font-weight: 700; color: #fff;
  background: linear-gradient(160deg, rgba(255, 255, 255, .38), rgba(255, 255, 255, 0) 55%), var(--c);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .5), inset 0 -1px 2px rgba(0, 0, 0, .12), 0 2px 6px color-mix(in srgb, var(--c) 35%, transparent);
}
.row .mid { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row .t { font-size: 17px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { font-size: 14px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .amt { font-size: 17px; font-weight: 600; white-space: nowrap; }
.amt.in { color: var(--income); }
.mic-tag { display: inline-block; vertical-align: -2px; width: 13px; height: 13px; color: var(--label-3); margin-right: 3px; }

.empty { text-align: center; padding: 36px 8px 8px; color: var(--label-2); display: grid; gap: 14px; justify-items: center; }
.empty h2 { font-size: 24px; line-height: 30px; font-weight: 700; color: var(--label); margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
.empty p { margin: 0; font-size: 16px; max-width: 34ch; text-wrap: pretty; }
.examples { display: grid; gap: 10px; width: 100%; max-width: 400px; }
.examples button {
  border: 0; border-radius: var(--r-md); padding: 14px 16px; text-align: left; font-size: 16px;
  display: flex; gap: 12px; align-items: center; color: var(--label); transition: transform .15s var(--snappy);
}
.examples button:active { transform: scale(.98); }
.examples button svg { width: 18px; height: 18px; color: var(--accent); flex: none; }

/* ---------- Tarjetas / secciones ---------- */
.section-title { font-size: 22px; line-height: 28px; font-weight: 700; margin: 30px 4px 12px; letter-spacing: -0.01em; }
.section-title:first-child { margin-top: 8px; }
.card { border-radius: var(--r-lg); padding: 16px; }
.footnote { font-size: 14px; color: var(--label-2); margin: 8px 6px 0; line-height: 19px; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { border-radius: var(--r-md); padding: 16px; display: grid; gap: 4px; min-width: 0; }
.stat .k { font-size: 14px; color: var(--label-2); }
.stat .v { font-size: 22px; font-weight: 700; overflow-wrap: anywhere; letter-spacing: -0.01em; }
.stat .v.txt { font-size: 18px; line-height: 24px; overflow-wrap: break-word; hyphens: auto; }
.stat .d { font-size: 14px; color: var(--label-2); overflow-wrap: anywhere; }

.catbars { display: grid; gap: 4px; }
.catbar { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; border: 0; background: none; text-align: left; padding: 10px 6px; border-radius: 12px; width: 100%; }
.catbar:active { background: var(--fill); }
.catbar .n { display: flex; gap: 10px; align-items: center; font-size: 16px; min-width: 0; }
.catbar .n span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.catbar .dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.catbar .v { font-size: 16px; font-weight: 600; text-align: right; }
.catbar .v small { color: var(--label-2); font-weight: 400; margin-left: 6px; }
.catbar .track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; }
.catbar .track i { display: block; height: 100%; border-radius: 4px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }

.chart svg { display: block; width: 100%; height: auto; }
.chart text { fill: var(--label-2); font-size: 12px; font-family: var(--font); }
.legend { display: flex; gap: 16px; font-size: 14px; color: var(--label-2); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

/* listas de ajustes */
.list { border-radius: var(--r-md); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 52px; position: relative; width: 100%; border: 0; background: none; text-align: left; font-size: 17px; color: var(--label); }
.item + .item::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--separator); }
button.item:active, a.item:active { background: var(--fill); }
.item .grow { flex: 1; min-width: 0; }
.item .sub { display: block; font-size: 14px; color: var(--label-2); line-height: 18px; margin-top: 2px; }
.item .val { color: var(--label-2); font-size: 17px; text-align: right; }
.item .chev { width: 14px; height: 14px; color: var(--label-3); flex: none; }
.item.danger { color: var(--expense); }
.item.link { color: var(--accent-ink); }
.item select, .item input[type="number"], .item input[type="text"] { border: 0; background: none; color: var(--label-2); text-align: right; font-size: 17px; max-width: 55%; outline: none; }
.item input.inline { color: var(--label); text-align: right; width: 9em; }
.item.stack { display: grid; gap: 10px; }
.range-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-size: 14px; color: var(--label-2); }
.range-row input[type="range"] { width: 100%; accent-color: var(--accent); }

.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--fill-2); transition: background .25s var(--ease); }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: transform .3s var(--ease); }
.switch input:checked + span { background: var(--income-fill); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Barra inferior + micrófono ---------- */
/* banda de borde de desplazamiento: el contenido se desvanece al pasar debajo de la barra */
.scroll-edge-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; height: calc(env(safe-area-inset-bottom, 0px) + 110px); z-index: 19; pointer-events: none;
  background: linear-gradient(to top, color-mix(in srgb, var(--bg) 70%, transparent), transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  -webkit-mask-image: linear-gradient(to top, #000 45%, transparent); mask-image: linear-gradient(to top, #000 45%, transparent);
}
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  width: min(calc(100% - 24px), 440px);
  display: grid; grid-template-columns: 1fr 1fr 88px 1fr 1fr; align-items: center;
  height: 68px; border-radius: 34px; z-index: 20; padding-inline: 6px;
  box-shadow: 0 0 0 .5px var(--glass-edge), inset 0 1px 1px var(--glass-highlight), inset 0 -1px 1px var(--glass-bevel), var(--shadow-elevated);
}
.tab { border: 0; background: none; display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--label-2); padding: 7px 0; margin: 0 2px; border-radius: 26px; transition: background .25s var(--ease), color .2s; }
.tab svg { width: 25px; height: 25px; }
.tab[aria-current="page"] { color: var(--accent-ink); background: rgba(255, 255, 255, .55); box-shadow: inset 0 1px 1px rgba(255, 255, 255, .9), 0 0 0 .5px rgba(0, 0, 0, .06); }
:root[data-theme="dark"] .tab[aria-current="page"] { background: rgba(255, 255, 255, .12); box-shadow: inset 0 1px 1px rgba(255, 255, 255, .18); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tab[aria-current="page"] { background: rgba(255, 255, 255, .12); box-shadow: inset 0 1px 1px rgba(255, 255, 255, .18); } }
/* micrófono: el único vidrio teñido (acción principal) */
.mic {
  justify-self: center; width: 72px; height: 72px; border-radius: 50%; border: 0; margin-top: -30px;
  color: #fff; display: grid; place-items: center; position: relative;
  background:
    radial-gradient(120% 90% at 30% 15%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 45%),
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, transparent), color-mix(in srgb, #3B2FC9 78%, transparent));
  -webkit-backdrop-filter: blur(12px) saturate(180%); backdrop-filter: blur(12px) saturate(180%);
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .18), inset 0 1.5px 1px rgba(255, 255, 255, .75), inset 0 -2px 4px rgba(0, 0, 0, .18),
    0 10px 26px color-mix(in srgb, var(--accent) 50%, transparent);
  transition: transform .2s var(--snappy);
}
.mic:active { transform: scale(.92); }
.mic svg { width: 32px; height: 32px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .2)); }

/* ---------- Hojas (sheets) ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; opacity: 0; transition: opacity .3s var(--ease); }
.scrim.open { opacity: 1; }
.sheet {
  position: fixed; left: 50%; bottom: 0; z-index: 41; width: min(100%, 560px);
  max-height: calc(100% - env(safe-area-inset-top, 0px) - 20px);
  background-color: var(--glass-sheet);
  background-image: linear-gradient(160deg, var(--glass-sheen) 0%, rgba(255, 255, 255, 0) 30%);
  -webkit-backdrop-filter: var(--glass-blur-lg); backdrop-filter: var(--glass-blur-lg);
  border-radius: 32px 32px 0 0;
  box-shadow: 0 0 0 .5px var(--glass-edge), inset 0 1px 1px var(--glass-highlight), var(--shadow-elevated);
  transform: translate(-50%, 100%); transition: transform .45s var(--ease);
  display: flex; flex-direction: column;
}
.sheet.open { transform: translate(-50%, 0); }
.sheet .grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--fill-2); margin: 8px auto 0; flex: none; }
.sheet-head { display: grid; grid-template-columns: minmax(70px, auto) 1fr minmax(70px, auto); align-items: center; padding: 8px 14px; flex: none; gap: 8px; }
.sheet-head h2 { font-size: 17px; font-weight: 600; margin: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-head .txt-btn { border: 0; background: none; color: var(--accent-ink); font-size: 17px; padding: 8px 4px; justify-self: start; }
.sheet-head .txt-btn.strong { font-weight: 600; justify-self: end; }
.sheet-head .txt-btn:disabled { color: var(--label-3); }
.sheet-body { overflow-y: auto; padding: 4px 16px calc(env(safe-area-inset-bottom, 0px) + 24px); -webkit-overflow-scrolling: touch; display: grid; gap: 16px; overscroll-behavior: contain;
  grid-auto-rows: max-content; align-content: start; } /* las tarjetas no se achican: si no entra, se desplaza */
/* dentro de la hoja: tarjetas translúcidas sin blur propio (un vidrio no refracta a través de otro) */
.sheet .card, .sheet .group, .sheet .banner, .sheet .warn-list, .sheet .welcome-points, .sheet .field-group,
.sheet .said, .sheet .review-card, .sheet .text-entry textarea, .sheet .list, .sheet .cat-chips button, .sheet .examples button {
  background-color: var(--glass-inner); background-image: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  box-shadow: 0 0 0 .5px var(--separator), inset 0 1px 1px rgba(255, 255, 255, .5);
}
.sheet .segmented, .sheet .cur-btn { -webkit-backdrop-filter: none; backdrop-filter: none; background-color: var(--fill); }

/* formulario de movimiento */
.amount-field { display: flex; align-items: baseline; justify-content: center; gap: 8px; padding-block: 8px 4px; }
.cur-btn { border: 0; flex: none; align-self: center; border-radius: 999px; font-size: 15px; font-weight: 600; padding: 6px 12px; color: var(--label-2); }
.amount-field input {
  border: 0; background: none; outline: none; font-size: 48px; font-weight: 700; letter-spacing: -0.03em; width: 100%; max-width: 9ch; text-align: center;
  font-variant-numeric: tabular-nums;
}
.amount-field.out input { color: var(--expense); }
.amount-field.in input { color: var(--income); }
.field-group { border-radius: var(--r-md); overflow: hidden; }
.field { display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 50px; position: relative; }
.field + .field::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--separator); }
.field label { font-size: 17px; flex: none; min-width: 6.5em; }
.field input, .field select, .field textarea { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 17px; text-align: right; color: var(--label-2); padding-block: 13px; }
.field input:focus, .field select:focus { color: var(--label); }
.field select { appearance: none; -webkit-appearance: none; direction: rtl; }
.field select option { direction: ltr; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chips button { border: 0; border-radius: 999px; padding: 8px 14px; font-size: 15px; color: var(--label); display: inline-flex; align-items: center; gap: 6px; }
.cat-chips button i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.cat-chips button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.label-sm { font-size: 14px; font-weight: 600; color: var(--label-2); margin: 0 6px -8px; }

.btn {
  border: 0; border-radius: 999px; padding: 16px 22px; font-size: 17px; font-weight: 600; width: 100%; color: #fff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 55%),
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, transparent), color-mix(in srgb, var(--accent) 80%, #3B2FC9));
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .14), inset 0 1px 1px rgba(255, 255, 255, .6), 0 6px 18px color-mix(in srgb, var(--accent) 32%, transparent);
  transition: transform .15s var(--snappy), opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; }
.btn.tinted { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-ink); box-shadow: inset 0 1px 1px rgba(255, 255, 255, .5), 0 0 0 .5px color-mix(in srgb, var(--accent) 20%, transparent); }
.btn.danger { background: var(--expense-tint); color: var(--expense); box-shadow: inset 0 1px 1px rgba(255, 255, 255, .4); }
.btn.danger.armed { background: var(--expense-fill); color: #fff; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* voz */
.listen { display: grid; justify-items: center; gap: 18px; padding-block: 14px 4px; text-align: center; }
.orb {
  width: 120px; height: 120px; border-radius: 50%; border: 0; color: #fff; display: grid; place-items: center; position: relative;
  background:
    radial-gradient(120% 90% at 30% 15%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 45%),
    linear-gradient(180deg, var(--accent), #3B2FC9);
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, .6), inset 0 -3px 6px rgba(0, 0, 0, .2), 0 12px 30px color-mix(in srgb, var(--accent) 45%, transparent);
  transition: transform .2s var(--snappy), filter .3s;
}
.orb svg { width: 46px; height: 46px; position: relative; z-index: 1; }
.orb::before, .orb::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--accent); opacity: 0; }
.orb.live::before { animation: pulse 1.6s var(--ease) infinite; }
.orb.live::after { animation: pulse 1.6s var(--ease) .5s infinite; }
.orb.idle { filter: saturate(.3) brightness(1.15); }
@keyframes pulse { 0% { transform: scale(1); opacity: .35; } 100% { transform: scale(1.7); opacity: 0; } }
.status { font-size: 16px; color: var(--label-2); min-height: 20px; }
.transcript { font-size: 24px; line-height: 30px; min-height: 60px; max-width: 30ch; text-wrap: pretty; font-weight: 500; }
.transcript .interim { color: var(--label-3); }
.hint { font-size: 14px; color: var(--label-2); max-width: 36ch; }
.text-entry { display: grid; gap: 10px; }
.text-entry textarea { width: 100%; min-height: 90px; resize: vertical; border: 0; border-radius: var(--r-md); padding: 14px 16px; font-size: 17px; outline: none; }
.link-btn { border: 0; background: none; color: var(--accent-ink); font-size: 16px; font-weight: 500; padding: 6px; }

.review-card { border-radius: var(--r-md); overflow: hidden; }
.review-card .rc-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 4px 16px; }
.review-card .rc-head .segmented { flex: none; width: 190px; }
.review-card .rc-head .grow { flex: 1; }
.review-card .rc-amount { display: flex; align-items: baseline; gap: 8px; padding: 4px 16px 8px; }
.review-card .rc-amount input { font-size: 32px; font-weight: 700; border: 0; background: none; outline: none; width: 100%; min-width: 0; font-variant-numeric: tabular-nums; }
.review-card.out .rc-amount input { color: var(--expense); }
.review-card.in .rc-amount input { color: var(--income); }
.review-card .field { padding-inline: 16px; }
.review-card .rc-head + .rc-amount + .field::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--separator); }
.low-conf { font-size: 14px; color: var(--warn); padding: 0 16px 10px; }
.said { font-size: 15px; color: var(--label-2); border-radius: var(--r-md); padding: 14px 16px; display: grid; gap: 8px; }
.said q { color: var(--label); font-size: 18px; }

/* toast */
.toast {
  position: fixed; left: 16px; right: 16px; margin-inline: auto; width: fit-content; bottom: calc(env(safe-area-inset-bottom, 0px) + 98px); z-index: 60;
  transform: translateY(20px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 14px; padding: 12px 12px 12px 20px; border-radius: 999px;
  color: var(--label); font-size: 16px; font-weight: 500; max-width: 440px;
  transition: transform .4s var(--ease), opacity .25s;
}
.toast { background-color: var(--glass-sheet); box-shadow: 0 0 0 .5px var(--glass-edge), inset 0 1px 1px var(--glass-highlight), var(--shadow-elevated); }
.toast.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.toast button { border: 0; background: var(--accent); color: #fff; border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 15px; }

.banner { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--r-md); padding: 14px 16px; font-size: 15px; margin-top: 12px; }
.banner svg { width: 22px; height: 22px; color: var(--warn-fill); flex: none; margin-top: 1px; }
.banner button { border: 0; background: none; color: var(--accent-ink); padding: 0; font-size: 15px; font-weight: 600; }

/* bienvenida */
.welcome { display: grid; justify-items: center; gap: 10px; text-align: center; padding-top: 4px; }
.welcome-logo { width: 96px; height: 96px; border-radius: 24px; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .1), 0 12px 32px rgba(20, 104, 240, .38); }
.welcome h2 { font-size: 30px; line-height: 36px; font-weight: 700; letter-spacing: -0.02em; margin: 8px 0 0; text-wrap: balance; }
.welcome p { margin: 0; color: var(--label-2); font-size: 17px; max-width: 34ch; text-wrap: pretty; }
.welcome-points { display: grid; gap: 16px; border-radius: var(--r-md); padding: 18px; }
.welcome-points > div { display: flex; gap: 14px; align-items: flex-start; font-size: 16px; color: var(--label-2); }
.welcome-points strong { color: var(--label); font-weight: 600; }
.wp-ic {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; color: #fff;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .5), inset 0 -1px 2px rgba(0, 0, 0, .12);
  background-image: linear-gradient(160deg, rgba(255, 255, 255, .35), rgba(255, 255, 255, 0) 55%);
}
.wp-ic svg { width: 19px; height: 19px; }
.warn-list { margin: 0; padding: 16px 18px 16px 36px; border-radius: var(--r-md); display: grid; gap: 10px; font-size: 16px; color: var(--label-2); }

/* ---------- Accesibilidad ---------- */
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .tabbar, .icon-btn, .search, .segmented, .month-switch .today-link, .toast, .cur-btn, .sheet,
  .summary, .group, .card, .stat, .list, .banner, .examples button, .welcome-points, .warn-list, .scroll-edge-bottom {
    background-color: var(--glass-opaque) !important; background-image: none !important;
    -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0s !important; }
}
@media (min-width: 700px) {
  .app { padding-top: calc(env(safe-area-inset-top, 0px) + 32px); }
}

#toast-msg { min-width: 0; }

/* ---------- Mis Finanzas ML: tipos, semáforo, presupuesto, metas ---------- */
:root { --sav: #0088FF; --sav-tint: rgba(0, 136, 255, 0.13); --debt: #C55300; --debt-tint: rgba(255, 141, 40, 0.16);
  --sem-g: #34C759; --sem-y: #FFCC00; --sem-r: #FF383C; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --sav: #5CB8FF; --sav-tint: rgba(0, 145, 255, 0.20); --debt: #FF9230; --debt-tint: rgba(255, 146, 48, 0.20); } }
:root[data-theme="dark"] { --sav: #5CB8FF; --sav-tint: rgba(0, 145, 255, 0.20); --debt: #FF9230; --debt-tint: rgba(255, 146, 48, 0.20); }

.split.four { grid-template-columns: 1fr 1fr; }
.split .sav { background: var(--sav-tint); }
.split .debt { background: var(--debt-tint); }
.split .sav .v { color: var(--sav); }
.split .debt .v { color: var(--debt); }
.amt.sav { color: var(--sav); }
.amt.debt { color: var(--debt); }
.amount-field.sav input, .review-card.sav .rc-amount input { color: var(--sav); }
.amount-field.debt input, .review-card.debt .rc-amount input { color: var(--debt); }
.segmented.four button, .segmented.five button { padding-inline: 4px; font-size: 14px; }
.review-card .rc-head .segmented.four { flex: 1; width: auto; }

/* semáforo */
.sem-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--label-3); box-shadow: inset 0 1px 1px rgba(255,255,255,.5); }
.sem-dot[data-level="verde"] { background: var(--sem-g); box-shadow: 0 0 8px color-mix(in srgb, var(--sem-g) 70%, transparent); }
.sem-dot[data-level="amarillo"] { background: var(--sem-y); box-shadow: 0 0 8px color-mix(in srgb, var(--sem-y) 70%, transparent); }
.sem-dot[data-level="rojo"] { background: var(--sem-r); box-shadow: 0 0 8px color-mix(in srgb, var(--sem-r) 70%, transparent); }
.sem-pill { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; text-align: left; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--fill); font-size: 15px; color: var(--label); }
.sem-pill.static { margin-bottom: 12px; }
.sem-pill svg { width: 16px; height: 16px; color: var(--label-3); flex: none; }
.sem-pill .grow { flex: 1; min-width: 0; }
.sem-pill[data-level="verde"] { background: rgba(52, 199, 89, .14); }
.sem-pill[data-level="amarillo"] { background: rgba(255, 204, 0, .18); }
.sem-pill[data-level="rojo"] { background: rgba(255, 56, 60, .14); }
.semaforo { display: flex; align-items: center; gap: 20px; padding: 20px; }
.sem-lights { display: grid; gap: 8px; padding: 10px 9px; border-radius: 22px; background: rgba(20, 22, 30, .82); box-shadow: inset 0 1px 2px rgba(0,0,0,.5), 0 0 0 .5px rgba(0,0,0,.3); flex: none; }
.sem-lights i { width: 30px; height: 30px; border-radius: 50%; display: block; opacity: .22; box-shadow: inset 0 -2px 4px rgba(0,0,0,.35), inset 0 2px 3px rgba(255,255,255,.35); }
.sem-lights .r { background: var(--sem-r); } .sem-lights .y { background: var(--sem-y); } .sem-lights .g { background: var(--sem-g); }
.semaforo[data-level="rojo"] .r, .semaforo[data-level="amarillo"] .y, .semaforo[data-level="verde"] .g { opacity: 1; }
.semaforo[data-level="rojo"] .r { box-shadow: 0 0 18px var(--sem-r), inset 0 2px 3px rgba(255,255,255,.5); }
.semaforo[data-level="amarillo"] .y { box-shadow: 0 0 18px var(--sem-y), inset 0 2px 3px rgba(255,255,255,.5); }
.semaforo[data-level="verde"] .g { box-shadow: 0 0 18px var(--sem-g), inset 0 2px 3px rgba(255,255,255,.5); }
.sem-text { display: grid; gap: 2px; min-width: 0; }
.sem-text .caption { font-size: 14px; color: var(--label-2); }
.sem-title { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.sem-sub { font-size: 16px; color: var(--label-2); }
.sem-reasons { display: grid; gap: 14px; margin-top: 12px; }
.sem-group { display: grid; gap: 8px; }
.sem-h { margin: 0; font-size: 14px; font-weight: 600; color: var(--label-2); }
.sem-reason { display: flex; gap: 10px; align-items: flex-start; font-size: 16px; line-height: 21px; }
.sem-reason .sem-dot { margin-top: 5px; }

/* presupuesto, 50/30/20, hormiga, metas */
.cta-card { display: grid; gap: 14px; }
.cta-card p { margin: 0; font-size: 16px; line-height: 22px; color: var(--label-2); }
.cta-card strong { color: var(--label); }
.budget-table, .rule { display: grid; gap: 14px; }
.bt-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 16px; }
.bt-top small { color: var(--label-2); font-weight: 400; font-size: 14px; }
.bar { height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), #00C8B3); transition: width .5s var(--ease); }
.bt-row.near .bar i { background: var(--warn-fill); }
.bt-row.over .bar i { background: var(--expense-fill); }
.bt-row.ok .bar i, .bar.done i { background: var(--income-fill); }
.bar.debt i { background: linear-gradient(90deg, var(--warn-fill), #FFCC00); }
.bt-total { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding-top: 12px; border-top: .5px solid var(--separator); font-size: 17px; font-weight: 600; }
.bt-total small { color: var(--label-2); font-weight: 400; font-size: 14px; }
.bt-total .neg { color: var(--expense); }
.rule-bar { position: relative; height: 12px; border-radius: 6px; background: var(--fill); margin-top: 6px; }
.rule-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 6px; box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.rule-bar b { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--label); opacity: .55; }
.rule-hint { font-size: 14px; color: var(--label-2); margin-top: 4px; }
.hormiga { display: grid; gap: 4px; }
.h-big { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
.h-sub { font-size: 15px; color: var(--label-2); }
.h-year { font-size: 16px; margin-top: 6px; }
.h-top { display: grid; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: .5px solid var(--separator); font-size: 15px; }
.h-top div { display: flex; justify-content: space-between; gap: 10px; }
.metas { display: grid; gap: 12px; }
.meta { border: 0; width: 100%; text-align: left; color: var(--label); display: grid; gap: 4px; font-size: 16px; }
.meta:active { transform: scale(.99); }
.meta-name { font-weight: 600; font-size: 17px; min-width: 0; }
.meta-name small { font-weight: 400; color: var(--label-2); }
.meta-sub { font-size: 14px; color: var(--label-2); margin-top: 4px; }
.meta-tip { font-size: 15px; }
.meta-tip.ok { color: var(--income); font-weight: 600; }
.chip { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--debt-tint); color: var(--debt); white-space: nowrap; }
.metas + .btn, .cta-card + .btn { margin-top: 12px; }
#stats > .btn { margin-top: 12px; }
.bt-top > span:first-child { min-width: 0; }
.bt-top .num { white-space: nowrap; text-align: right; display: grid; justify-items: end; line-height: 1.2; }
.bt-top .num small { font-size: 13px; }

.btn.small { width: auto; flex: none; padding: 9px 14px; font-size: 15px; }

/* guía 50/30/20 */
.guide { display: grid; gap: 14px; }
.guide h3 { font-size: 20px; line-height: 25px; margin: 14px 4px 0; letter-spacing: -0.01em; }
.guide-lead { margin: 0; font-size: 17px; line-height: 23px; }
.guide-bar { display: flex; gap: 3px; height: 14px; border-radius: 7px; overflow: hidden; }
.guide-bar i { display: block; box-shadow: inset 0 1px 0 rgba(255,255,255,.4); }
.guide-block { border-radius: var(--r-md); padding: 14px 16px; background: color-mix(in srgb, var(--g) 13%, transparent); box-shadow: inset 0 1px 1px rgba(255,255,255,.4); display: grid; gap: 6px; }
.guide-block p { margin: 0; font-size: 16px; line-height: 22px; color: var(--label-2); }
.guide-block .guide-cats { font-size: 15px; }
.guide-block .guide-cats strong { color: var(--label); }
.guide-head { display: flex; gap: 12px; align-items: center; }
.guide-head > span:last-child { display: grid; gap: 1px; }
.guide-head strong { font-size: 18px; }
.guide-pct { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; color: var(--g); min-width: 2.4em; }
.guide-amt { font-size: 14px; color: var(--label-2); }
.guide-def { display: grid; gap: 8px; }
.guide-def p { margin: 0; font-size: 16px; line-height: 22px; color: var(--label-2); }
.guide-def p strong, .guide-def p b { color: var(--label); }
.guide-def .sem-dot { display: inline-block; vertical-align: -1px; }
