:root {
  --black: #000;
  --ink-0: #0b0b0b;
  --ink-1: #141414;
  --ink-2: #1f1f1f;
  --ink-3: #2c2c2c;
  --line: #262626;
  --mute: #8f8f8f;
  --soft: #bdbdbd;
  --white: #fafafa;

  --display: "Archivo", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 20px;
  --pad: 18px;
  --tabbar: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--black);
  color: var(--white);
  font-family: var(--display);
  font-variation-settings: "wdth" 100;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
::selection { background: var(--white); color: var(--black); }
input, button, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; border-radius: 6px; }
* { scrollbar-width: thin; scrollbar-color: var(--ink-3) transparent; }

.ic {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---------- GATE ---------- */
.gate {
  min-height: 100dvh;
  display: grid; place-content: center; justify-items: center;
  gap: 40px; padding: 32px 24px calc(32px + var(--safe-b));
}
.gate-logo {
  width: min(64vw, 280px); height: auto;
  animation: reveal 1100ms var(--ease-out) both;
}
@keyframes reveal {
  from { clip-path: inset(0 0 100% 0); filter: blur(6px); transform: translateY(12px); }
  to   { clip-path: inset(0 0 0 0); filter: blur(0); transform: none; }
}
.gate-form { width: min(100%, 320px); display: grid; gap: 12px; animation: fadeUp 500ms 300ms var(--ease-out) both; }
.gate-label { font-size: 13px; color: var(--mute); letter-spacing: 0.02em; }
.gate-form input {
  height: 52px; padding: 0 14px; font-size: 17px;
  background: var(--ink-1); border: 1px solid var(--line); border-radius: var(--r-md);
}
.gate-form input:focus { outline: none; border-color: var(--white); }
.gate-form input::placeholder { color: #6f6f6f; }
.gate-form .gate-label:not(:first-child) { margin-top: 6px; }
.gate-err { margin: 0; min-height: 20px; font-size: 14px; color: var(--white); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- SHELL ---------- */
.app { min-height: 100dvh; padding-bottom: calc(var(--tabbar) + var(--safe-b) + 24px); }

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) var(--pad) 10px;
  background: rgb(0 0 0 / 0.86);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--ink-2);
}
.top-logo { width: 40px; height: 40px; object-fit: contain; }
.ev-btn {
  flex: 1; min-width: 0;
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto;
  column-gap: 8px; align-items: center; text-align: left;
  background: none; border: 0; padding: 6px 8px; border-radius: var(--r-sm);
  transition: background-color 160ms ease, transform 160ms var(--ease-out);
}
.ev-btn:active { transform: scale(0.98); background: var(--ink-1); }
.ev-name {
  font-weight: 750; font-size: 16px; font-variation-settings: "wdth" 112;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; letter-spacing: 0.01em;
}
.ev-date { grid-row: 2; font-size: 12.5px; color: var(--mute); }
.ev-chev { grid-row: 1 / span 2; grid-column: 2; color: var(--mute); }
.sync { width: 8px; height: 8px; border-radius: 50%; background: var(--white); opacity: 0.9; transition: opacity 200ms ease; flex: none; }
.sync.busy { animation: blink 900ms ease-in-out infinite; }
.sync.err { background: transparent; box-shadow: inset 0 0 0 1.5px var(--white); }
@keyframes blink { 50% { opacity: 0.2; } }

.tabs {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tabbar) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgb(0 0 0 / 0.9);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--ink-2);
}
.tab {
  display: grid; place-content: center; justify-items: center; gap: 4px;
  background: none; border: 0; color: var(--mute);
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em;
  transition: color 160ms ease, transform 140ms var(--ease-out);
}
.tab:active { transform: scale(0.94); }
.tab[aria-current="page"] { color: var(--white); }
.tab[aria-current="page"] .ic { stroke-width: 2.25; }

.main { max-width: 760px; margin: 0 auto; padding: 20px var(--pad) 0; outline: none; }
.view { animation: viewIn 260ms var(--ease-out) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- TYPE & BLOCKS ---------- */
.h-display {
  margin: 0;
  font-weight: 850; font-variation-settings: "wdth" 125;
  font-size: clamp(40px, 13vw, 76px); line-height: 0.92; letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.h-sec {
  margin: 0; font-size: 13px; font-weight: 700; color: var(--mute);
  text-transform: uppercase; letter-spacing: 0.08em; font-variation-settings: "wdth" 110;
}
.lead { margin: 10px 0 0; color: var(--soft); font-size: 15px; max-width: 52ch; }
.lead strong { color: var(--white); font-weight: 700; }

.hero { padding: 10px 0 26px; border-bottom: 1px solid var(--line); }
.hero-label { font-size: 13px; color: var(--mute); margin: 0 0 10px; font-weight: 600; }
.neg::before { content: "−"; margin-right: 0.04em; }

.ledger { margin: 0; padding: 0; list-style: none; }
.ledger > li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 15px 0; border-bottom: 1px solid var(--line);
}
.ledger dt, .ledger .k { color: var(--soft); font-size: 15px; }
.ledger .v { font-weight: 700; font-size: 18px; font-variation-settings: "wdth" 112; }
.ledger .v small { color: var(--mute); font-weight: 500; font-size: 13px; margin-left: 6px; }

.be { padding: 22px 0 26px; border-bottom: 1px solid var(--line); }
.be-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.be-row p { margin: 0; color: var(--soft); font-size: 14.5px; }
.bar { height: 6px; background: var(--ink-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--white); border-radius: inherit; transform-origin: left; animation: grow 900ms 120ms var(--ease-out) both; }
@keyframes grow { from { transform: scaleX(0); } }

.section { padding: 26px 0 8px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

.cat-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.cat-bars li { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 14.5px; }
.cat-bars .bar { grid-column: 1 / -1; height: 4px; }
.cat-bars .pct { color: var(--mute); font-size: 12.5px; margin-left: 6px; }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 16px; border-radius: 10px;
  font-weight: 650; font-size: 15px; letter-spacing: 0.005em;
  border: 1px solid var(--ink-3); background: var(--ink-1); color: var(--white);
  transition: transform 140ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, opacity 160ms ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn-solid { background: var(--white); color: var(--black); border-color: var(--white); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--soft); padding: 0 10px; }
.btn-block { width: 100%; height: 52px; font-size: 16px; }
.btn-danger { background: transparent; border-color: var(--ink-3); color: var(--soft); }
.btn-danger.armed { background: var(--white); color: var(--black); border-color: var(--white); }
.btn .ic { width: 18px; height: 18px; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { border-color: var(--mute); }
  .btn-solid:hover { background: #e6e6e6; }
  .btn-ghost:hover { color: var(--white); }
}

.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: none; border: 0; border-radius: 10px; color: var(--soft);
  transition: background-color 160ms ease, transform 140ms var(--ease-out);
}
.icon-btn:active { transform: scale(0.94); background: var(--ink-2); }

.toolbar { display: flex; gap: 10px; align-items: center; margin: 22px 0 6px; }
.toolbar .grow { flex: 1; }

/* ---------- GASTOS ---------- */
.stats { display: flex; gap: 22px; margin-top: 14px; flex-wrap: wrap; }
.stat { font-size: 13px; color: var(--mute); }
.stat b { display: block; color: var(--white); font-size: 17px; font-weight: 700; font-variation-settings: "wdth" 112; }

.cats { display: grid; gap: 10px; margin-top: 14px; }
.cat { background: var(--ink-0); border: 1px solid var(--ink-2); border-radius: var(--r-md); overflow: hidden; }
.cat-head {
  width: 100%; display: grid; grid-template-columns: 1fr auto 20px; align-items: center; gap: 12px;
  padding: 16px; background: none; border: 0; text-align: left;
}
.cat-name { font-weight: 750; font-size: 15px; text-transform: uppercase; letter-spacing: 0.02em; font-variation-settings: "wdth" 115; }
.cat-count { display: block; font-weight: 500; font-size: 12.5px; color: var(--mute); text-transform: none; letter-spacing: 0; font-variation-settings: "wdth" 100; margin-top: 2px; }
.cat-total { font-weight: 700; font-size: 16px; }
.cat-head .ic { color: var(--mute); transition: transform 240ms var(--ease-out); }
.cat.open .cat-head .ic { transform: rotate(180deg); }
.cat-empty .cat-total { color: var(--mute); font-weight: 500; }

.collapse { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 280ms var(--ease-out); }
.cat.open .collapse { grid-template-rows: 1fr; }
.collapse > div { overflow: hidden; }

.rows { list-style: none; margin: 0; padding: 0 16px; border-top: 1px solid var(--ink-2); }
.row {
  display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--ink-2);
}
.row:last-child { border-bottom: 0; }
.row-main { background: none; border: 0; padding: 0; text-align: left; min-width: 0; display: grid; gap: 1px; }
.row-title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 12.5px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-amt { font-weight: 650; font-size: 15px; background: none; border: 0; padding: 0; }
.row.unpaid .row-amt { color: var(--soft); }

.paid {
  width: 24px; height: 24px; border-radius: 7px; padding: 0;
  border: 1.5px solid var(--ink-3); background: transparent; display: grid; place-items: center; color: var(--black);
  transition: background-color 160ms ease, border-color 160ms ease, transform 140ms var(--ease-out);
}
.paid .ic { width: 15px; height: 15px; stroke-width: 2.75; opacity: 0; transform: scale(0.6); transition: opacity 160ms ease, transform 200ms var(--ease-out); }
.paid[aria-pressed="true"] { background: var(--white); border-color: var(--white); }
.paid[aria-pressed="true"] .ic { opacity: 1; transform: none; }
.paid:active { transform: scale(0.9); }

.cat-add { width: 100%; justify-content: flex-start; border-radius: 0; border: 0; border-top: 1px solid var(--ink-2); background: none; color: var(--soft); height: 48px; padding: 0 16px; }

/* ---------- ENTRADAS ---------- */
.search {
  position: relative; flex: 1;
}
.search .ic { position: absolute; left: 13px; top: 50%; translate: 0 -50%; color: var(--mute); pointer-events: none; }
.search input {
  width: 100%; height: 44px; padding: 0 12px 0 40px;
  background: var(--ink-1); border: 1px solid var(--ink-2); border-radius: 10px; font-size: 16px;
}
.search input:focus { outline: none; border-color: var(--mute); }
.search input::placeholder { color: var(--mute); }

.people { list-style: none; margin: 8px 0 0; padding: 0; }
.person {
  width: 100%; display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center;
  padding: 12px 0; background: none; border: 0; border-bottom: 1px solid var(--ink-2); text-align: left;
  transition: background-color 160ms ease;
}
.person:active { background: var(--ink-0); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--ink-3); font-weight: 750; font-size: 13.5px; letter-spacing: 0.02em; font-variation-settings: "wdth" 115;
}
.person-name { font-size: 15.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-name span { font-weight: 400; color: var(--soft); }
.person-dni { font-size: 13px; color: var(--mute); }
.person-price { font-size: 14.5px; font-weight: 600; text-align: right; }
.person-price small { display: block; font-size: 11.5px; color: var(--mute); font-weight: 500; }
.stagger > * { animation: fadeUp 320ms var(--ease-out) both; animation-delay: calc(min(var(--i, 0), 12) * 28ms); }

.empty { padding: 48px 8px; text-align: center; color: var(--mute); }
.empty h3 { margin: 0 0 6px; color: var(--white); font-size: 17px; font-weight: 700; }
.empty p { margin: 0 auto 18px; max-width: 34ch; font-size: 14.5px; }

/* ---------- SHEET ---------- */
.sheet {
  margin: 0; padding: 0; border: 0;
  inset: auto 0 0 0; width: 100%; max-width: 100%; max-height: 92dvh;
  background: var(--ink-0); color: var(--white);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  border-top: 1px solid var(--ink-3);
  padding-bottom: var(--safe-b);
  flex-direction: column;
  transform: translateY(0);
  transition: transform 340ms var(--ease-drawer), opacity 200ms ease;
}
.sheet[open] { display: flex; }
@starting-style { .sheet[open] { transform: translateY(100%); } }
.sheet.closing { transform: translateY(100%); transition-duration: 220ms; transition-timing-function: var(--ease-out); }
.sheet::backdrop { background: rgb(0 0 0 / 0.7); transition: opacity 300ms ease; opacity: 1; }
@starting-style { .sheet[open]::backdrop { opacity: 0; } }
.sheet.closing::backdrop { opacity: 0; }
.sheet-grip { width: 40px; height: 4px; border-radius: 9px; background: var(--ink-3); margin: 10px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 4px 20px; flex: none; }
.sheet-head h2 { margin: 0; font-size: 19px; font-weight: 800; font-variation-settings: "wdth" 118; text-transform: uppercase; letter-spacing: 0.01em; }
.sheet-body { padding: 8px 20px 22px; overflow-y: auto; overscroll-behavior: contain; }

.form { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; color: var(--soft); font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; height: 50px; padding: 0 14px;
  background: var(--black); border: 1px solid var(--ink-3); border-radius: 10px; font-size: 16px;
  transition: border-color 160ms ease;
}
.field textarea { height: 84px; padding: 12px 14px; resize: vertical; }
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238f8f8f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 18px; padding-right: 40px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--white); }
.field input::placeholder, .field textarea::placeholder { color: #6f6f6f; }
.field .hint { font-size: 12.5px; color: var(--mute); }
.money { position: relative; }
.money::before { content: "$"; position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: var(--mute); font-size: 16px; }
.money input { padding-left: 30px; font-variant-numeric: tabular-nums; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 12px; font-size: 15px; padding: 4px 0; }
.check input { width: 22px; height: 22px; accent-color: var(--white); }
.form-err { margin: 0; font-size: 14px; color: var(--white); background: var(--ink-2); border-radius: 10px; padding: 10px 12px; }
.form-err:empty { display: none; }
.actions { display: grid; gap: 10px; margin-top: 6px; }
.actions-row { display: flex; gap: 10px; }
.actions-row .btn { flex: 1; }

.ev-list { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.ev-item {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--ink-2); background: var(--black); text-align: left;
  transition: border-color 160ms ease, transform 140ms var(--ease-out);
}
.ev-item:active { transform: scale(0.985); }
.ev-item[aria-current="true"] { border-color: var(--white); }
.ev-item b { display: block; font-weight: 700; text-transform: uppercase; font-variation-settings: "wdth" 112; font-size: 14.5px; }
.ev-item span { font-size: 12.5px; color: var(--mute); }
.divider { height: 1px; background: var(--ink-2); margin: 6px 0 18px; }

.cat-edit { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.cat-edit li { display: flex; gap: 8px; align-items: center; }
.cat-edit input { flex: 1; height: 46px; padding: 0 12px; background: var(--black); border: 1px solid var(--ink-3); border-radius: 10px; font-size: 16px; }
.cat-edit input:focus { outline: none; border-color: var(--white); }

/* ---------- v2: login chip, checklist, audit ---------- */
.me {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--white); color: var(--black); border: 0; font-weight: 800; font-size: 12px; letter-spacing: 0.02em;
  font-variation-settings: "wdth" 115; transition: transform 140ms var(--ease-out);
}
.me:active { transform: scale(0.94); }

.dot {
  width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center;
  border: 1.5px dashed var(--ink-3); color: var(--black);
}
.dot .ic { width: 14px; height: 14px; stroke-width: 3; }
.dot-curso { border: 1.5px solid var(--white); background: linear-gradient(90deg, var(--white) 50%, transparent 50%); }
.dot-definido { border: 1.5px solid var(--white); background: var(--white); }

.chips { display: flex; gap: 8px; margin: 22px 0 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--ink-3); background: transparent; color: var(--soft);
  font-size: 14px; font-weight: 600; transition: background-color 160ms ease, color 160ms ease, transform 140ms var(--ease-out);
}
.chip span { color: var(--mute); font-weight: 500; }
.chip:active { transform: scale(0.96); }
.chip[aria-selected="true"] { background: var(--white); color: var(--black); border-color: var(--white); }
.chip[aria-selected="true"] span { color: #555; }

.checklist { list-style: none; margin: 10px 0 0; padding: 0; }
.ck {
  width: 100%; display: grid; grid-template-columns: 24px 1fr auto; gap: 14px; align-items: start;
  padding: 16px 0; background: none; border: 0; border-bottom: 1px solid var(--ink-2); text-align: left;
}
.ck .dot { margin-top: 1px; }
.ck-main { min-width: 0; display: grid; gap: 3px; }
.ck-name { font-weight: 750; font-size: 16px; text-transform: uppercase; letter-spacing: 0.02em; font-variation-settings: "wdth" 115; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ck-state { font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; color: var(--mute); font-variation-settings: "wdth" 100; }
.ck-definido .ck-state { color: var(--white); }
.ck-sub { font-size: 14px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ck-empty { color: #6f6f6f; }
.ck-meta { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--mute); }
.ck-meta .ic { width: 13px; height: 13px; }
.ck-amt { text-align: right; font-weight: 700; font-size: 15.5px; font-variation-settings: "wdth" 110; }
.ck-amt small { display: block; font-size: 11.5px; font-weight: 500; color: var(--mute); font-variation-settings: "wdth" 100; margin-top: 2px; }
.tbd { color: var(--mute); font-weight: 500; font-style: italic; }
@media (hover: hover) and (pointer: fine) { .ck:hover .ck-name, .costs button:hover .costs-name { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; } }

.costs { list-style: none; margin: 0; padding: 0; }
.costs button {
  width: 100%; display: grid; grid-template-columns: 20px 1fr auto; gap: 12px; align-items: center;
  padding: 11px 0; background: none; border: 0; border-bottom: 1px solid var(--ink-2); text-align: left; font-size: 15px;
}
.costs .dot { width: 18px; height: 18px; }
.costs .dot .ic { width: 11px; height: 11px; }
.costs-name small { display: block; font-size: 12.5px; color: var(--mute); }
.costs-amt { font-weight: 650; }
.costs-total { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 0 4px; border-top: 1.5px solid var(--white); margin-top: -1px; }
.costs-total span { font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; font-size: 13px; font-variation-settings: "wdth" 115; }
.costs-total b { font-size: 22px; font-weight: 800; font-variation-settings: "wdth" 118; }
.costs-note { margin: 8px 0 0; color: var(--mute); font-size: 13.5px; }
.warn { display: block; margin-top: 6px; color: var(--mute); font-size: 13.5px; }
.ledger .kx { color: var(--mute); font-size: 12.5px; margin-left: 4px; }

.log { list-style: none; margin: 0; padding: 0; }
.log li, .hist li { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--ink-2); font-size: 14px; }
.log-who { font-weight: 750; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; background: var(--white); color: var(--black); padding: 2px 7px; border-radius: 6px; font-variation-settings: "wdth" 112; }
.log-what { color: var(--soft); min-width: 0; }
.log-what b { color: var(--white); font-weight: 650; }
.log-ch { display: block; color: var(--mute); font-size: 12.5px; margin-top: 3px; }
.log-ch b { color: var(--soft); }
.log-when { color: var(--mute); font-size: 12px; white-space: nowrap; }

.flabel { font-size: 13px; color: var(--soft); font-weight: 600; }
.opt { color: var(--mute); font-weight: 500; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--black); border: 1px solid var(--ink-3); border-radius: 12px; }
.seg[data-n="5"] { grid-auto-flow: row; grid-template-columns: repeat(5, 1fr); }
.seg-opt { position: relative; }
.seg-opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg-opt span {
  display: grid; place-content: center; text-align: center; min-height: 42px; padding: 4px 4px; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: var(--soft); line-height: 1.15;
  transition: background-color 160ms ease, color 160ms ease;
}
.seg-opt small { display: block; font-size: 11.5px; font-weight: 500; color: var(--mute); margin-top: 1px; }
.seg-opt input:checked + span { background: var(--white); color: var(--black); }
.seg-opt input:checked + span small { color: #555; }
.seg-opt input:focus-visible + span { outline: 2px solid var(--white); outline-offset: 2px; }
.seg[data-n="5"] .seg-opt span { font-size: 13px; }

.calc { margin: -6px 0 0; font-size: 13.5px; color: var(--soft); }
.calc:empty { display: none; }

.audit { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--ink-2); display: grid; gap: 10px; }
.audit p { margin: 0; display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--soft); }
.audit p .ic { width: 16px; height: 16px; margin-top: 2px; color: var(--mute); }
.audit b { color: var(--white); }
.hist summary { cursor: pointer; font-size: 13.5px; font-weight: 650; color: var(--white); padding: 6px 0; list-style: none; }
.hist summary::-webkit-details-marker { display: none; }
.hist summary::after { content: " +"; color: var(--mute); }
.hist[open] summary::after { content: " −"; }
.hist ul { list-style: none; margin: 4px 0 0; padding: 0; }
.hist .log-what { font-size: 13px; }
.sign { margin: 14px 0 0; text-align: center; font-size: 12.5px; color: var(--mute); }
.sign b { color: var(--soft); }

/* ---------- TOAST ---------- */
.toast {
  position: fixed; z-index: 100; left: 50%; bottom: calc(var(--tabbar) + var(--safe-b) + 14px);
  translate: -50% 0; max-width: calc(100% - 32px);
  padding: 12px 16px; border-radius: 12px; background: var(--white); color: var(--black);
  font-size: 14.5px; font-weight: 600; box-shadow: 0 10px 30px rgb(0 0 0 / 0.5);
  opacity: 0; transform: translateY(12px) scale(0.98); pointer-events: none;
  transition: opacity 200ms ease, transform 260ms var(--ease-out);
}
.toast.show { opacity: 1; transform: none; }

/* ---------- DESKTOP ---------- */
@media (min-width: 820px) {
  :root { --pad: 28px; }
  .app { padding-bottom: 60px; }
  .top { padding-left: max(var(--pad), calc((100vw - 760px) / 2 + var(--pad))); padding-right: max(var(--pad), calc((100vw - 760px) / 2 + var(--pad))); }
  .tabs {
    position: sticky; top: 61px; bottom: auto; height: auto; padding: 0;
    display: flex; justify-content: center; gap: 4px; border-top: 0; border-bottom: 1px solid var(--ink-2);
  }
  .tab { display: flex; gap: 8px; padding: 14px 18px; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
  .tab[aria-current="page"] { border-bottom-color: var(--white); }
  .main { padding-top: 34px; }
  .sheet {
    inset: 0; margin: auto; width: min(480px, 92vw); max-height: 86vh;
    border-radius: var(--r-lg); border: 1px solid var(--ink-3);
    transition: transform 240ms var(--ease-out), opacity 200ms ease;
  }
  @starting-style { .sheet[open] { transform: scale(0.96); opacity: 0; } }
  .sheet.closing { transform: scale(0.97); opacity: 0; }
  .sheet-grip { display: none; }
  .sheet-head { padding-top: 16px; }
  .toast { bottom: 28px; }
  .resumen-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 0 48px; align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; }
  .sheet, .sheet.closing { transform: none !important; }
  .collapse { transition: none; }
}
