:root {
  --bg: #0a0a0a;
  --surface: #121212;
  --surface-2: #1a1a1a;
  --line: #242424;
  --text: #f2f0ec;
  --muted: #8d8a85;
  --faint: #55534f;
  --amber: #e8a33d;
  --blue: #8db4ff;
  --pos: #9bd3a4;
  --neg: #e88b7a;
  --r: 14px;
  --sans: "Geist", -apple-system, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  --serif: "Instrument Serif", Georgia, serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); color: var(--text); font: 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; overflow-x: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.p1 { --c: var(--amber); }
.p2 { --c: var(--blue); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); display: inline-block; flex: none; }

/* Estructura */
.shell { max-width: 480px; margin: 0 auto; padding: calc(var(--safe-t) + 18px) 16px calc(var(--safe-b) + 96px); }
.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.brand { font-family: var(--serif); font-size: 26px; letter-spacing: -0.01em; }
.brand i { color: var(--amber); }
.sync { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.sync .dot { --c: var(--pos); width: 6px; height: 6px; }
.sync.off .dot { --c: var(--neg); }
.sync.wait .dot { --c: var(--amber); }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 500; }

.month { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.month button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); font-size: 16px; }
.month b { font-weight: 500; }
.month b::first-letter { text-transform: uppercase; }

.label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 12px; }
.card h3 { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: 14px; display: flex; justify-content: space-between; }

/* Hero */
.hero { padding: 6px 0 22px; }
.hero .big { font-family: var(--serif); font-size: 58px; line-height: 1; letter-spacing: -0.02em; margin: 8px 0 6px; }
.hero .big small { font-size: 26px; color: var(--muted); margin-right: 2px; }
.hero .sub { color: var(--muted); font-size: 13px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.person { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; position: relative; overflow: hidden; }
.person::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--c); }
.person .who { display: flex; align-items: center; gap: 7px; font-size: 13px; margin-bottom: 10px; }
.person .row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); padding: 2px 0; }
.person .row .num { color: var(--text); }
.person .left { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; }
.person .left .num { font-size: 17px; }

.bar { height: 6px; border-radius: 3px; background: var(--surface-2); display: flex; overflow: hidden; gap: 2px; }
.bar span { background: var(--c); height: 100%; }
.legend { display: flex; justify-content: space-between; font-size: 12.5px; margin-top: 10px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }

.settle { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settle p { font-size: 14px; }
.settle p b { font-weight: 500; }
.btn { height: 44px; padding: 0 18px; border-radius: 22px; background: var(--text); color: var(--bg); font-weight: 500; font-size: 14px; white-space: nowrap; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.full { width: 100%; }
.btn:disabled { opacity: 0.4; }

.cats .cat { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 7px 0; font-size: 13.5px; }
.cats .cat .bar { grid-column: 1 / -1; height: 3px; }
.cats .cat .bar span { --c: var(--text); opacity: 0.55; }

/* Lista de movimientos */
.list { list-style: none; }
.mov { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.mov:last-child { border-bottom: 0; }
.mov .mid { flex: 1; min-width: 0; }
.mov .t { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mov .s { font-size: 12px; color: var(--muted); }
.mov .amt { text-align: right; }
.mov .amt .num { font-size: 14.5px; }
.mov .amt .o { font-size: 11.5px; color: var(--muted); }
.mov .pos { color: var(--pos); }
.tag { font-size: 10.5px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; color: var(--muted); margin-left: 4px; }
.pend { color: var(--amber); }
.day { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); padding: 16px 0 2px; }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; font-size: 14px; }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 14px; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 34px; padding: 0 14px; border-radius: 17px; border: 1px solid var(--line); font-size: 13px; color: var(--muted); white-space: nowrap; flex: none; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Metas */
.goal .head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.goal .name { font-size: 15px; font-weight: 500; }
.goal .bar { height: 8px; }
.goal .meta { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--muted); margin-top: 10px; }

/* Barra inferior */
.nav { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(10, 10, 10, 0.88); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); z-index: 5; }
.nav .in { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr 64px 1fr 1fr; align-items: center; height: 62px; }
.nav button { font-size: 11.5px; color: var(--faint); display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: center; }
.nav button svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.nav button.on { color: var(--text); }
.nav .add { width: 50px; height: 50px; border-radius: 50%; background: var(--amber); color: #111; justify-self: center; font-size: 28px; font-weight: 300; line-height: 1; }

/* Hoja (formularios) */
#sheet-wrap { position: fixed; inset: 0; z-index: 20; }
#sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); animation: fade 0.2s; }
#sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; padding: 10px 16px calc(var(--safe-b) + 18px); max-height: 92dvh; overflow-y: auto; animation: up 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); }
#sheet .grip { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 14px; }
#sheet h2 { font-family: var(--serif); font-weight: 400; font-size: 26px; margin-bottom: 16px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; margin-bottom: 14px; }
.seg button { height: 36px; border-radius: 9px; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--surface-2); color: var(--text); }

.amount { display: flex; align-items: baseline; gap: 8px; border-bottom: 1px solid var(--line); padding: 6px 0 10px; margin-bottom: 6px; }
.amount input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-family: var(--serif); font-size: 48px; letter-spacing: -0.02em; }
.amount .cur { font-family: var(--mono); color: var(--muted); font-size: 15px; }
.conv { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; min-height: 18px; display: flex; justify-content: space-between; gap: 8px; }
.conv button { color: var(--amber); font-size: 12.5px; }

.field { margin-bottom: 14px; }
.field > span { display: block; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.field input, .field select { width: 100%; height: 46px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; outline: 0; }
.field input:focus, .field select:focus { border-color: var(--faint); }
.field .chips { flex-wrap: wrap; margin-bottom: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions { display: flex; gap: 10px; margin-top: 6px; }
.actions .btn { flex: 1; }
.danger { color: var(--neg); font-size: 13px; padding: 14px 0 2px; width: 100%; }

/* Acceso */
.auth { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; max-width: 380px; margin: 0 auto; padding: 24px 16px; }
.auth .brand { font-size: 64px; line-height: 1; margin-bottom: 8px; }
.auth p.lead { color: var(--muted); margin-bottom: 30px; }
.auth .switch { margin-top: 16px; text-align: center; font-size: 13.5px; color: var(--muted); }
.auth .switch button { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.err { color: var(--neg); font-size: 13px; min-height: 20px; margin-bottom: 8px; }

.invite { border-style: dashed; }
.invite .code { font-family: var(--mono); font-size: 26px; letter-spacing: 0.2em; margin: 8px 0 4px; color: var(--amber); }

#toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 84px); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 20px; font-size: 13.5px; z-index: 30; white-space: nowrap; animation: up 0.2s; }
