:root {
  color-scheme: light;
  --bg: #f2f2f7;
  --card: #ffffff;
  --field: #f2f2f7;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6e6d68;
  --axis-text: #898781;
  --line: #e1e0d9;
  --axis: #c3c2b7;
  --btn: #0b0b0b;
  --on-btn: #ffffff;
  --good: #006300;
  --bad: #d03b3b;
  --overlay: rgba(0, 0, 0, 0.32);
  --bar-bg: rgba(248, 248, 250, 0.86);
  --c-ingresos: #1baf7a;
  --c-ahorros: #2a78d6;
  --c-fijos: #eb6834;
  --c-variables: #6250d6;
  --c-deudas: #e87ba4;
  --c-presupuesto: #c3c2b7;
  --radius: 16px;
  --tabbar-h: 56px;
  --kb: 0px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #000000;
    --card: #1c1c1e;
    --field: #2c2c2e;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #8e8d87;
    --axis-text: #898781;
    --line: #38383a;
    --axis: #48484a;
    --btn: #f0efec;
    --on-btn: #0b0b0b;
    --good: #30d158;
    --bad: #ff6961;
    --overlay: rgba(0, 0, 0, 0.55);
    --bar-bg: rgba(22, 22, 24, 0.86);
    --c-ingresos: #199e70;
    --c-ahorros: #3987e5;
    --c-fijos: #d95926;
    --c-variables: #9085e9;
    --c-deudas: #d55181;
    --c-presupuesto: #5a5955;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { opacity: 0.4; cursor: default; }
:focus-visible { outline: 2px solid var(--c-ahorros); outline-offset: 2px; }

.app { position: fixed; inset: 0; display: flex; flex-direction: column; overflow: hidden; }
.scroller { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }

.screen {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 96px;
}

/* Encabezados */
.eyebrow { font-size: 13px; font-weight: 600; color: var(--muted); margin: 4px 0 0; }
.title { font-size: 34px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.12; margin: 2px 0 8px; }
.subtitle { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; margin: 24px 4px 8px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.month-switch { display: flex; align-items: center; gap: 4px; margin: 4px -8px 8px; }
.month-switch .title { margin: 0; flex: 1; text-align: center; font-size: 26px; }
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center;
  border-radius: 22px; color: var(--ink);
}
.icon-btn:active { background: var(--field); }

/* Tarjetas y listas */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-title { font-size: 17px; font-weight: 600; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card-title .right { margin-left: auto; font-weight: 500; font-size: 15px; color: var(--muted); }
.card-note { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

.row {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 10px 16px;
  width: 100%; text-align: left;
  position: relative;
}
.row + .row::before {
  content: ""; position: absolute; top: 0; left: 16px; right: 0;
  border-top: 0.5px solid var(--line);
}
button.row:active, .row.tap:active { background: var(--field); }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { font-size: 13px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .end { text-align: right; flex-shrink: 0; }
.row .amount { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.row.add { color: var(--ink-2); font-weight: 500; min-height: 48px; }
.row .chev { color: var(--axis); flex-shrink: 0; margin-right: -6px; }

.dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex-shrink: 0; display: inline-block; }

.check {
  width: 30px; height: 30px; margin: -4px 0 -4px -6px; flex-shrink: 0;
  display: grid; place-items: center; color: var(--axis);
}
.check.on { color: var(--c); }

/* Números */
.num { font-variant-numeric: tabular-nums; }
.neg { color: var(--bad); }
.pos { color: var(--good); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; }

/* Tarjeta principal */
.hero { padding: 20px 16px 16px; }
.hero-label { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.hero-value { font-size: 46px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.08; margin: 4px 0 2px; }
.hero-sub { font-size: 15px; color: var(--muted); }
.hero-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 0.5px solid var(--line); }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin-top: 2px; }
.hint { margin-top: 12px; font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 500; color: var(--ink-2);
  background: var(--card); border-radius: 999px; padding: 6px 12px; margin: 0 0 4px;
}

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--field); border-radius: 12px; padding: 12px; margin-top: 12px; font-size: 14px; color: var(--ink-2);
}
.notice .grow { flex: 1; }

/* Medidor */
.meter { position: relative; height: 6px; border-radius: 3px; overflow: hidden; margin-top: 8px; }
.meter::before { content: ""; position: absolute; inset: 0; background: var(--c); opacity: 0.18; }
.meter > span { position: relative; display: block; height: 100%; border-radius: 3px; background: var(--c); }

/* KPI */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.kpi { background: var(--card); border-radius: var(--radius); padding: 14px 16px; }
.kpi .stat-value { font-size: 22px; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 20px; border-radius: 14px;
  font-size: 17px; font-weight: 600; width: 100%;
}
.btn.primary { background: var(--btn); color: var(--on-btn); }
.btn.secondary { background: var(--field); color: var(--ink); }
.btn.danger { background: var(--field); color: var(--bad); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 15px; width: auto; border-radius: 10px; }
.btn:active { opacity: 0.75; }
.btn-row { display: flex; gap: 10px; margin-top: 16px; }
.btn-row > * { flex: 1; }
.stack > * + * { margin-top: 10px; }

.fab {
  position: absolute; z-index: 20;
  right: max(16px, calc((100vw - 640px) / 2 + 16px));
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  height: 52px; padding: 0 22px 0 18px; border-radius: 26px;
  background: var(--btn); color: var(--on-btn);
  font-size: 17px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.fab:active { transform: scale(0.97); }

/* Control segmentado */
.seg { display: flex; background: var(--field); border-radius: 10px; padding: 2px; margin: 8px 0 4px; }
.card .seg { margin-top: 0; }
.seg button { flex: 1; min-height: 34px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--ink-2); padding: 0 6px; white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
@media (prefers-color-scheme: dark) { .seg button.on { background: #636366; } }
.seg.compact button { flex: 1 1 auto; padding: 0 4px; font-size: 13px; }

/* Tablas */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { font-size: 13px; font-weight: 600; color: var(--muted); text-align: right; padding: 0 0 8px; }
.table th:first-child, .table td:first-child { text-align: left; }
.table td { padding: 9px 0; border-top: 0.5px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.table .cat { display: inline-flex; align-items: center; gap: 8px; }
.table tr.total td { font-weight: 700; }

/* Barra de pestañas */
.tabbar {
  position: relative; z-index: 30; flex-shrink: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 0 max(8px, calc((100vw - 640px) / 2)) env(safe-area-inset-bottom);
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--line);
}
.tab {
  height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 10.5px; font-weight: 500; color: var(--muted);
}
.tab.on { color: var(--ink); }

/* Hojas modales */
.overlay { position: fixed; inset: 0; z-index: 40; background: var(--overlay); animation: fade 0.2s ease; }
.sheet {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: var(--kb);
  max-width: 640px; margin: 0 auto;
  max-height: calc(100dvh - env(safe-area-inset-top) - 16px - var(--kb));
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  background: var(--bg); border-radius: 16px 16px 0 0;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
  animation: up 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-bottom: 4px; }
.sheet-head h2 { font-size: 17px; font-weight: 600; margin: 0; text-align: center; flex: 1; }
.sheet-head .side { width: 88px; font-size: 17px; color: var(--ink-2); }
.sheet-head .side.r { text-align: right; font-weight: 600; color: var(--ink); }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--axis); margin: 0 auto 6px; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Formularios */
.field { display: block; background: var(--card); border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.field input, .field select, .field textarea {
  width: 100%; border: 0; background: transparent; outline: none; padding: 2px 0; font-size: 17px;
}
.field textarea { resize: none; min-height: 96px; line-height: 1.4; }
.field.big input { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row .field { margin: 0; }
.notes { width: 100%; border: 0; background: var(--field); border-radius: 12px; padding: 12px; min-height: 96px; resize: vertical; font-size: 16px; line-height: 1.4; outline: none; }
input[type="date"] { -webkit-appearance: none; appearance: none; min-height: 24px; }
input[type="file"] { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 2px; }
.chips button {
  min-height: 36px; padding: 0 14px; border-radius: 18px; background: var(--card); font-size: 15px; font-weight: 500;
  border: 1px solid var(--line);
}
.chips button.on { background: var(--btn); color: var(--on-btn); border-color: var(--btn); }

.error { color: var(--bad); font-size: 14px; margin: 6px 4px 0; }

/* Estados vacíos */
.empty { text-align: center; padding: 28px 16px; }
.empty h3 { margin: 10px 0 6px; font-size: 20px; letter-spacing: -0.01em; }
.empty p { margin: 0 auto 18px; color: var(--muted); font-size: 15px; max-width: 34ch; }
.empty .art { width: 56px; height: 56px; border-radius: 16px; display: inline-grid; place-items: center; background: var(--field); color: var(--ink-2); }

/* Gráficos */
.chart { margin: 4px 0 0; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis-label { font-size: 10.5px; fill: var(--axis-text); font-variant-numeric: tabular-nums; }
.chart .cap-label { font-size: 10.5px; font-weight: 600; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.chart .base { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .hit { fill: transparent; cursor: pointer; outline: none; }
.chart path[tabindex] { outline: none; }
.chart .dim { opacity: 0.35; }
.chart .mark { transition: opacity 0.15s; }
.readout { min-height: 40px; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.readout b { font-size: 17px; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.readout .sub { display: block; font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--c); display: inline-block; flex-shrink: 0; }
.swatch.multi { background: linear-gradient(90deg, var(--c-ahorros) 0 25%, var(--c-fijos) 25% 50%, var(--c-variables) 50% 75%, var(--c-deudas) 75%); }

.donut-wrap { display: flex; flex-direction: column; align-items: center; }
.donut-wrap svg { max-width: 220px; }
.donut-center-value { font-size: 20px; font-weight: 700; fill: var(--ink); letter-spacing: -0.01em; }
.donut-center-label { font-size: 12px; fill: var(--muted); }
.donut-legend { width: 100%; margin-top: 12px; }
.donut-legend button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 6px 0; text-align: left; border-top: 0.5px solid var(--line); font-size: 15px; }
.donut-legend button.on { font-weight: 600; }
.donut-legend .v { margin-left: auto; font-variant-numeric: tabular-nums; }
.donut-legend .p { width: 46px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Aviso de actualización y mensajes */
.toast {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 84px);
  background: var(--btn); color: var(--on-btn);
  padding: 10px 16px; border-radius: 999px; font-size: 15px; font-weight: 500;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2); max-width: calc(100vw - 32px);
  animation: fade 0.2s ease;
}
.update-bar {
  position: absolute; z-index: 35; left: 16px; right: 16px;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 80px);
  max-width: 608px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: 14px; padding: 10px 10px 10px 16px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16); font-size: 15px;
}
.update-bar .grow { flex: 1; }

.steps { margin: 8px 0 0; padding-left: 20px; color: var(--ink-2); font-size: 15px; }
.steps li + li { margin-top: 6px; }

.footer-note { text-align: center; font-size: 13px; color: var(--muted); margin: 24px 16px 0; }

@media (prefers-reduced-motion: reduce) {
  .sheet, .overlay, .toast { animation: none; }
}

/* Bienvenida */
.welcome {
  position: fixed; inset: 0; z-index: 38; background: var(--bg);
  overflow-y: auto; display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 8px) 20px calc(env(safe-area-inset-bottom) + 20px);
}
.welcome > * { width: 100%; max-width: 520px; margin-left: auto; margin-right: auto; }
.welcome.in-sheet { position: static; padding: 0 0 4px; overflow: visible; }
.welcome-top { min-height: 44px; display: flex; justify-content: flex-end; }
.welcome-skip, .welcome-back { font-size: 17px; color: var(--ink-2); min-height: 44px; padding: 0 4px; }
.welcome-back { display: block; margin: 8px auto 0; }
.welcome-slide { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 8px 0 16px; }
.welcome-slide.setup { justify-content: flex-start; }
.welcome-slide .art { width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center; background: var(--card); color: var(--ink); margin-bottom: 20px; }
.welcome-slide h2 { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 10px; }
.welcome-slide > p { font-size: 17px; color: var(--ink-2); margin: 0 0 16px; }
.welcome-slide ul { list-style: none; padding: 0; margin: 4px 0 0; }
.welcome-slide li { display: flex; gap: 10px; align-items: flex-start; font-size: 16px; color: var(--ink-2); padding: 8px 0; }
.welcome-slide li svg { flex-shrink: 0; margin-top: 2px; color: var(--good); }
.welcome-sections { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.welcome-sections > span { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border-radius: 999px; padding: 7px 12px; font-size: 14px; font-weight: 500; }
.welcome-nav .btn-row { margin-top: 12px; }
.welcome-dots { display: flex; justify-content: center; gap: 8px; }
.welcome-dots span { width: 8px; height: 8px; border-radius: 4px; background: var(--axis); transition: width 0.2s; }
.welcome-dots span.on { width: 22px; background: var(--ink); }
.welcome select { -webkit-appearance: none; appearance: none; }
.select { border: 0; background: var(--field); border-radius: 10px; padding: 8px 12px; font-size: 16px; font-weight: 600; }
.welcome .btn.secondary { background: var(--card); }
.field label > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 2px; }

.money-input { display: flex; align-items: baseline; gap: 6px; }
.money-input b { font-weight: 600; color: var(--ink-2); font-size: 17px; }
.field.big .money-input b { font-size: 28px; }
.money-input input { flex: 1; min-width: 0; }

/* Video guía */
.tour {
  position: fixed; inset: 0; z-index: 45; background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column; overflow: hidden;
  padding: calc(env(safe-area-inset-top) + 8px) 0 calc(env(safe-area-inset-bottom) + 10px);
  user-select: none; -webkit-user-select: none;
}
.tour-bars { display: flex; gap: 4px; padding: 0 12px; }
.tour-bars span { flex: 1; height: 3px; border-radius: 2px; background: var(--axis); overflow: hidden; }
.tour-bars i { display: block; height: 100%; width: 0; background: var(--ink); }
.tour-bars i.full { width: 100%; }
.tour-bars i.run { animation: t-bar linear forwards; }
@keyframes t-bar { from { width: 0; } to { width: 100%; } }
.tour-top { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px 0 16px; }
.tour-tab { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--card); border-radius: 999px; padding: 4px 10px; }
.tour-close { width: 44px; height: 44px; display: grid; place-items: center; transform: rotate(45deg); color: var(--ink); }
.tour-stage { flex: 1; display: flex; flex-direction: column; min-height: 0; cursor: pointer; position: relative; max-width: 520px; width: 100%; margin: 0 auto; }
.tour-screen { position: relative; flex: 1; min-height: 0; overflow: hidden; padding: 4px 16px; pointer-events: none;
  -webkit-mask-image: linear-gradient(#000 85%, transparent); mask-image: linear-gradient(#000 85%, transparent); }
.tour-screen > * { position: relative; }
.tour-caption { padding: 8px 24px 4px; animation: t-in 0.5s ease both; }
.tour-caption h2 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 6px; }
.tour-caption p { font-size: 17px; color: var(--ink-2); margin: 0; line-height: 1.4; min-height: 72px; }
.tour-hint { text-align: center; font-size: 12px; color: var(--muted); padding-top: 6px; }
.tour-paused { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); background: var(--btn); color: var(--on-btn); padding: 10px 16px; border-radius: 999px; font-size: 15px; font-weight: 600; }
.tour.paused *, .tour.paused *::before, .tour.paused *::after { animation-play-state: paused !important; }
.tour-end { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; max-width: 460px; margin: 0 auto; }
.tour-end .art { width: 72px; height: 72px; border-radius: 36px; display: grid; place-items: center; background: var(--good); color: #fff; margin-bottom: 18px; }
.tour-end h2 { font-size: 28px; margin: 0 0 8px; letter-spacing: -0.02em; }
.tour-end p { color: var(--ink-2); font-size: 17px; margin: 0 0 24px; }

/* Piezas animadas de las escenas (el retraso viene en --d) */
.t-finger {
  position: absolute; z-index: 5; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%;
  background: rgba(30, 30, 30, 0.3); border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.35);
  opacity: 0; animation: t-finger 1.6s ease var(--d) both;
}
.t-finger::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 3px solid var(--c-ahorros);
  opacity: 0; animation: t-ripple 0.6s ease-out calc(var(--d) + 0.75s) both;
}
@keyframes t-ripple { 0% { opacity: 0.9; transform: scale(1); } 100% { opacity: 0; transform: scale(2.2); } }
@keyframes t-finger {
  0% { opacity: 0; transform: translate(40px, 80px); }
  40% { opacity: 1; transform: none; }
  52% { transform: scale(0.78); }
  64% { transform: none; }
  85% { opacity: 1; }
  100% { opacity: 0; }
}
.t-after { opacity: 0; animation: t-on 0.15s var(--d) forwards; }
@keyframes t-on { to { opacity: 1; } }
.t-swap { display: inline-grid; }
.t-swap > span { grid-area: 1 / 1; display: inline-flex; justify-content: flex-end; }
.t-swap .t-from { animation: t-off 0.2s var(--d) forwards; }
.t-swap .t-to { opacity: 0; animation: t-on 0.2s var(--d) forwards; }
@keyframes t-off { to { opacity: 0; } }
.t-reveal { opacity: 0; max-height: 0; overflow: hidden; animation: t-reveal 0.4s ease var(--d) forwards; }
@keyframes t-reveal { to { opacity: 1; max-height: 120px; } }
.t-hide { animation: t-fade-out 0.3s var(--d) forwards; }
@keyframes t-fade-out { to { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; margin-top: 0; overflow: hidden; } }
.t-hide { max-height: 160px; }
.t-glow { animation: t-glow 1.6s ease var(--d) both; }
@keyframes t-glow { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 40% { box-shadow: 0 0 0 3px var(--c-ahorros); } }
.t-grow { width: 0; animation: t-grow 1.2s ease var(--d) forwards; }
@keyframes t-grow { to { width: var(--w); } }
.t-press { animation: t-press 0.5s ease var(--d) both; }
@keyframes t-press { 50% { transform: scale(0.94); opacity: 0.7; } }
.t-chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); font-size: 15px; font-weight: 500; }
.t-chip.t-on { animation: t-chip 0.01s var(--d) forwards; }
@keyframes t-chip { to { background: var(--btn); color: var(--on-btn); border-color: var(--btn); } }
.t-sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; background: var(--bg); border-radius: 16px 16px 0 0; padding: 12px 16px 16px;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25); transform: translateY(105%); animation: t-sheet 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d) forwards; }
.t-sheet .field { background: var(--card); }
@keyframes t-sheet { to { transform: none; } }
.t-stage-home { position: relative; min-height: 260px; }
.fab.t-static { position: absolute; right: 0; bottom: auto; top: 46%; }
.t-type { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; min-height: 42px; }
@keyframes t-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .t-finger { display: none; } }

.q-lines { margin-top: 14px; padding-top: 12px; border-top: 0.5px solid var(--line); }
.q-lines div { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; padding: 3px 0; color: var(--ink-2); }
.q-lines b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.edit-pill {
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
  min-height: 34px; padding: 0 12px; border-radius: 17px;
  border: 1.5px dashed var(--axis); color: var(--ink-2); font-size: 14px; font-weight: 600;
}
.edit-amount { display: inline-flex; align-items: center; gap: 6px; }
.edit-amount svg { color: var(--muted); }
