/* Paga — estilos. Mobile-first, modo claro y oscuro, sin dependencias externas. */

:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --text: #15171c;
  --muted: #6b7280;
  --line: rgba(15, 23, 42, 0.08);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, 0.18);
  --penalty: #e5484d;
  --penalty-soft: rgba(229, 72, 77, 0.12);
  --bonus: #16a34a;
  --bonus-soft: rgba(22, 163, 74, 0.13);
  --accent: #4f46e5;
  --radius: 22px;
  --radius-sm: 14px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #191c22;
    --surface-2: #23272f;
    --text: #f2f3f5;
    --muted: #9aa1ad;
    --line: rgba(255, 255, 255, 0.08);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.6);
    --penalty: #ff6b6f;
    --penalty-soft: rgba(255, 107, 111, 0.15);
    --bonus: #3ecf75;
    --bonus-soft: rgba(62, 207, 117, 0.15);
    --accent: #8b85ff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; opacity: 0.5; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
img { display: block; max-width: 100%; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- Estructura ---------- */
.page {
  max-width: 980px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 8px) 16px calc(var(--safe-b) + 110px);
  animation: fade-in 0.25s var(--ease);
}
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
}
.topbar h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 0; flex: 1; }
.topbar h1.sm { font-size: 20px; }
.icon-btn {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text);
  transition: background 0.15s, transform 0.15s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn.on { color: var(--accent); }

.boot { min-height: 100dvh; display: grid; place-items: center; }
.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner.sm { width: 18px; height: 18px; border-width: 2px; border-top-color: currentColor; }

/* ---------- Tarjetas de niño ---------- */
.cards { display: grid; gap: 16px; grid-template-columns: 1fr; margin-top: 8px; }
@media (min-width: 720px) { .cards { grid-template-columns: 1fr 1fr; gap: 20px; } }

.kid-card {
  --c: #4f46e5;
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  color: #fff;
  padding: 20px 20px 18px;
  border-radius: var(--radius);
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--c) 55%, white) 0%, transparent 55%),
    linear-gradient(150deg, var(--c), color-mix(in srgb, var(--c) 62%, black));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--c) 35%, transparent);
  overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  animation: rise 0.35s var(--ease) both;
}
.kid-card:nth-child(2) { animation-delay: 0.05s; }
.kid-card:active { transform: scale(0.985); }
.kid-head { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 44px; height: 44px;
  flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; font-size: 20px;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.35);
}
.avatar.solid { background: var(--c); box-shadow: none; }
.avatar.lg { width: 64px; height: 64px; font-size: 28px; }
.kid-name { font-size: 20px; font-weight: 700; flex: 1; }
.kid-chev { opacity: 0.7; width: 22px; height: 22px; }
.kid-amount {
  margin: 18px 0 4px;
  font-size: clamp(44px, 13vw, 60px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
}
.kid-amount.zero { opacity: 0.85; }
.kid-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  background: rgba(255, 255, 255, 0.18);
  white-space: nowrap;
}
.chip.debt { background: rgba(0, 0, 0, 0.25); }
.kid-strip {
  display: flex; gap: 6px; flex-wrap: nowrap; overflow: hidden;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  min-height: 51px;
}
.kid-strip .em {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  font-size: 19px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  position: relative;
}
.kid-strip .em.bonus { background: rgba(255, 255, 255, 0.34); }
.kid-strip .em.bonus::after {
  content: "+"; position: absolute; right: -3px; top: -5px;
  font-size: 12px; font-weight: 800;
  width: 16px; height: 16px; border-radius: 50%;
  display: grid; place-items: center;
  background: #fff; color: var(--bonus);
}
.kid-strip .em.void { opacity: 0.35; }
.kid-strip .em.more { font-size: 13px; font-weight: 700; background: transparent; width: auto; padding: 0 4px; }
.kid-strip .clean { font-size: 22px; opacity: 0.9; display: flex; align-items: center; }

/* ---------- Detalle de niño ---------- */
.hero { margin-top: 4px; }
.hero .kid-card { cursor: default; }
.hero .kid-card:active { transform: none; }
.pay-btn {
  margin-top: 16px;
  width: 100%;
  height: 52px;
  border-radius: 16px;
  font-weight: 700; font-size: 17px;
  background: #fff;
  color: color-mix(in srgb, var(--c) 80%, black);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.15s var(--ease);
}
.pay-btn:active { transform: scale(0.97); }
.pay-btn svg { width: 22px; height: 22px; }

.section-title {
  margin: 28px 4px 10px;
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted);
  display: flex; align-items: center; justify-content: space-between;
}

.list {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.list:empty { display: none; }
.empty {
  text-align: center; color: var(--muted);
  padding: 28px 16px; font-size: 32px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}

.entry {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s;
}
.entry:last-child { border-bottom: 0; }
.entry:active { background: var(--surface-2); }
.entry .em {
  width: 42px; height: 42px; flex: none;
  border-radius: 13px;
  display: grid; place-items: center;
  font-size: 21px;
  background: var(--penalty-soft);
}
.entry.bonus .em { background: var(--bonus-soft); }
.entry .body { flex: 1; min-width: 0; }
.entry .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry .sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry .amt { font-weight: 700; color: var(--penalty); white-space: nowrap; }
.entry.bonus .amt { color: var(--bonus); }
.entry .thumb {
  width: 42px; height: 42px; flex: none;
  border-radius: 10px; object-fit: cover;
  background: var(--surface-2);
}
.entry.void .title, .entry.void .amt { text-decoration: line-through; text-decoration-thickness: 2px; }
.entry.void { opacity: 0.5; }
.entry.void .amt { color: var(--muted); }

/* Histórico */
.period {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}
.period > summary {
  list-style: none;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
}
.period > summary::-webkit-details-marker { display: none; }
.period .p-dates { flex: 1; font-weight: 600; }
.period .p-dates small { display: block; font-weight: 500; color: var(--muted); font-size: 13px; }
.period .p-paid { font-weight: 800; font-size: 18px; }
.period .p-chev { width: 20px; height: 20px; color: var(--muted); transition: transform 0.2s var(--ease); }
.period[open] .p-chev { transform: rotate(90deg); }
.period .p-body { border-top: 1px solid var(--line); }
.period .p-sum {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}
.pill.pen { background: var(--penalty-soft); color: var(--penalty); }
.pill.bon { background: var(--bonus-soft); color: var(--bonus); }

/* ---------- Botón flotante ---------- */
.fab {
  position: fixed;
  right: max(20px, calc(50vw - 470px));
  bottom: calc(var(--safe-b) + 22px);
  width: 64px; height: 64px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-lg);
  z-index: 10;
  transition: transform 0.2s var(--ease);
  animation: pop 0.35s var(--ease) both 0.1s;
}
.fab:active { transform: scale(0.9); }
.fab svg { width: 30px; height: 30px; }

/* ---------- Hojas (bottom sheet) ---------- */
.sheet-wrap {
  position: fixed; inset: 0;
  z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.scrim {
  position: absolute; inset: 0;
  background: rgba(8, 10, 14, 0.45);
  animation: fade-in 0.2s ease both;
}
.sheet {
  position: relative;
  width: 100%; max-width: 560px;
  max-height: calc(100dvh - var(--safe-t) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  padding: 10px 18px calc(var(--safe-b) + 20px);
  box-shadow: var(--shadow-lg);
  animation: slide-up 0.32s var(--ease) both;
}
@media (min-width: 720px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 28px; padding-bottom: 22px; animation-name: zoom-in; }
}
.sheet-wrap.closing .scrim { animation: fade-out 0.18s ease both; }
.sheet-wrap.closing .sheet { animation: slide-down 0.2s ease-in both; }
.grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 6px; }
@media (min-width: 720px) { .grabber { display: none; } }
.sheet-head { display: flex; align-items: center; gap: 8px; min-height: 48px; margin-bottom: 6px; }
.sheet-head .h-title { flex: 1; font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 10px; min-width: 0; }
.sheet-head .h-title .avatar { width: 34px; height: 34px; font-size: 16px; }
.step { animation: step-in 0.25s var(--ease) both; }

/* Elegir niño */
.kid-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 6px 0 8px; }
.kid-pick button {
  --c: #4f46e5;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(150deg, var(--c), color-mix(in srgb, var(--c) 62%, black));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  font-weight: 700; font-size: 19px;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--c) 30%, transparent);
  transition: transform 0.15s var(--ease);
}
.kid-pick button:active { transform: scale(0.95); }
.kid-pick .avatar { width: 64px; height: 64px; font-size: 28px; }

/* Cuadrícula de motivos */
.reason-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 420px) { .reason-grid { grid-template-columns: repeat(4, 1fr); } }
.reason-grid + .reason-grid { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.reason-tile {
  border-radius: 18px;
  background: var(--surface-2);
  padding: 14px 6px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; line-height: 1.2;
  text-align: center;
  min-height: 104px;
  transition: transform 0.15s var(--ease), background 0.15s;
}
.reason-tile .e { font-size: 38px; line-height: 1; }
.reason-tile:active { transform: scale(0.94); }
.reason-tile.bonus { background: var(--bonus-soft); color: var(--bonus); }

/* Formulario final */
.amount-field {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 0 2px;
  color: var(--penalty);
}
.amount-field.bonus { color: var(--bonus); }
.amount-field .sign { font-size: 40px; font-weight: 800; }
.amount-field input {
  width: 4.4ch;
  max-width: 70vw;
  border: 0; background: transparent;
  font-size: 54px; font-weight: 800; letter-spacing: -0.03em;
  text-align: center; color: inherit;
  padding: 0;
}
.amount-field input:focus { outline: none; }
.amount-field .cur { font-size: 40px; font-weight: 800; }
.amount-line { width: 160px; height: 3px; border-radius: 2px; margin: 0 auto 18px; background: currentColor; opacity: 0.25; }

.photo-tile {
  position: relative;
  width: 100%;
  height: 150px;
  border-radius: 18px;
  border: 2px dashed var(--line);
  background: var(--surface-2);
  display: grid; place-items: center;
  color: var(--muted);
  overflow: hidden;
}
.photo-tile svg { width: 40px; height: 40px; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.photo-tile.has { border: 0; }
.photo-tile .x {
  position: absolute; top: 8px; right: 8px;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.55); color: #fff;
  display: grid; place-items: center;
}
.photo-tile .x svg { width: 18px; height: 18px; }
.file-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.field {
  width: 100%;
  border: 1.5px solid transparent;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 16px;
  transition: border-color 0.15s, background 0.15s;
}
.field:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: var(--surface); }
textarea.field { resize: none; min-height: 52px; }
.row { display: flex; gap: 10px; align-items: center; }
.stack { display: grid; gap: 10px; margin-top: 12px; }
.date-field { display: flex; align-items: center; gap: 10px; }
.date-field svg { width: 22px; height: 22px; color: var(--muted); flex: none; }

.btn {
  height: 54px;
  border-radius: 16px;
  padding: 0 20px;
  font-weight: 700; font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface-2);
  transition: transform 0.15s var(--ease), opacity 0.15s;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn.block { width: 100%; }
.btn.primary { background: var(--text); color: var(--bg); }
.btn.penalty { background: var(--penalty); color: #fff; }
.btn.bonus { background: var(--bonus); color: #fff; }
.btn.danger { background: var(--penalty-soft); color: var(--penalty); }
.btn.kid { background: var(--c); color: #fff; }
.btn svg { width: 22px; height: 22px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }

/* Confirmación de pago */
.confirm-pay { text-align: center; padding: 8px 0 0; }
.confirm-pay .avatar { margin: 0 auto 10px; }
.confirm-pay .big { font-size: 52px; font-weight: 800; letter-spacing: -0.03em; margin: 4px 0; }
.confirm-pay .debt-note {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--penalty-soft); color: var(--penalty);
  font-weight: 600; font-size: 14px;
}

/* Detalle de anotación */
.entry-detail .photo {
  width: 100%; max-height: 60dvh; object-fit: contain;
  border-radius: 18px; background: var(--surface-2);
  margin-bottom: 14px;
}
.entry-detail .big-em { font-size: 54px; text-align: center; line-height: 1.1; }
.entry-detail .name { text-align: center; font-size: 20px; font-weight: 700; margin-top: 4px; }
.entry-detail .amt { text-align: center; font-size: 34px; font-weight: 800; margin-top: 6px; color: var(--penalty); }
.entry-detail.bonus .amt { color: var(--bonus); }
.entry-detail.void .amt, .entry-detail.void .name { text-decoration: line-through; color: var(--muted); }
.entry-detail .meta { text-align: center; color: var(--muted); font-size: 14px; margin-top: 4px; }
.entry-detail .comment {
  margin-top: 14px; padding: 12px 14px;
  border-radius: var(--radius-sm); background: var(--surface-2);
  white-space: pre-wrap; overflow-wrap: anywhere;
}

/* Visor de foto */
.viewer {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0, 0, 0, 0.92);
  display: grid; place-items: center;
  animation: fade-in 0.2s ease both;
}
.viewer img { max-width: 100vw; max-height: 100dvh; object-fit: contain; }
.viewer .icon-btn { position: absolute; top: calc(var(--safe-t) + 10px); right: 10px; color: #fff; background: rgba(255,255,255,0.12); }

/* ---------- PIN ---------- */
.pin { text-align: center; padding: 4px 0 6px; }
.pin .lock-ico { width: 56px; height: 56px; margin: 6px auto 10px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); }
.pin .lock-ico svg { width: 28px; height: 28px; }
.pin .pin-title { font-size: 19px; font-weight: 700; min-height: 27px; }
.dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0 22px; min-height: 16px; }
.dots span { width: 14px; height: 14px; border-radius: 50%; background: var(--line); transition: background 0.15s, transform 0.15s var(--ease); }
.dots span.on { background: var(--text); transform: scale(1.1); }
.dots.shake { animation: shake 0.4s; }
.dots.shake span.on { background: var(--penalty); }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px 22px; justify-content: center; }
.keypad button {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--surface-2);
  font-size: 28px; font-weight: 500;
  display: grid; place-items: center;
  transition: transform 0.1s, background 0.1s;
}
.keypad button:active { transform: scale(0.9); background: var(--line); }
.keypad button.ghost { background: transparent; }
.keypad button.ok { background: var(--text); color: var(--bg); }
.keypad svg { width: 26px; height: 26px; }
.pin-error { color: var(--penalty); font-weight: 600; min-height: 22px; margin-top: 12px; font-size: 14px; }

.setup { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.setup .card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 28px; box-shadow: var(--shadow); padding: 26px 18px 22px; }
.setup .logo { width: 64px; height: 64px; margin: 0 auto 6px; }

/* ---------- Ajustes ---------- */
.group {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px 0;
}
.set-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  min-height: 60px;
}
.set-row:last-child { border-bottom: 0; }
.set-row .grow { flex: 1; min-width: 0; }
.set-row .label { font-weight: 600; }
.set-row .hint { font-size: 13px; color: var(--muted); }
.mini {
  border: 1.5px solid transparent;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 9px 10px;
  font-size: 16px;
  min-width: 0;
  transition: border-color 0.15s, background 0.15s;
}
.mini:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: var(--surface); }
.mini.name { flex: 1; width: 100%; }
.mini.emoji { width: 52px; text-align: center; font-size: 22px; padding: 6px 4px; }
.mini.money { width: 96px; text-align: right; }
.mini.pct { width: 84px; text-align: right; }
.suffix { color: var(--muted); font-weight: 600; }
.swatch {
  width: 40px; height: 40px; flex: none;
  border-radius: 50%;
  border: 0; padding: 0;
  overflow: hidden;
  background: var(--c);
  position: relative;
}
.swatch input { position: absolute; inset: -8px; width: 56px; height: 56px; opacity: 0; cursor: pointer; }
.kind-toggle {
  width: 40px; height: 40px; flex: none;
  border-radius: 12px;
  font-size: 22px; font-weight: 800;
  background: var(--penalty-soft); color: var(--penalty);
  display: grid; place-items: center;
}
.kind-toggle.bonus { background: var(--bonus-soft); color: var(--bonus); }
.order-btns { display: flex; flex-direction: column; }
.order-btns button { width: 32px; height: 22px; display: grid; place-items: center; color: var(--muted); border-radius: 6px; }
.order-btns button:hover { background: var(--surface-2); }
.order-btns svg { width: 18px; height: 18px; }
.set-row.inactive .mini { opacity: 0.45; }
.set-row.inactive .kind-toggle { opacity: 0.45; }

.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background 0.2s; }
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 0.2s var(--ease);
}
.switch input:checked + span { background: var(--bonus); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }

.add-row {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px;
  color: var(--accent); font-weight: 700;
}
.add-row svg { width: 20px; height: 20px; }
.example { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

/* ---------- Avisos ---------- */
#toasts {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--safe-b) + 100px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
  z-index: 100;
  padding: 0 16px;
}
.toast {
  max-width: 420px;
  padding: 12px 18px;
  border-radius: 16px;
  background: var(--text); color: var(--bg);
  font-weight: 600; font-size: 15px;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s var(--ease) both;
  display: flex; align-items: center; gap: 8px;
}
.toast.error { background: var(--penalty); color: #fff; }
.toast.out { animation: toast-out 0.25s ease both; }

.offline {
  margin: 8px 0 0; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--penalty-soft); color: var(--penalty); font-weight: 600; text-align: center;
}

/* ---------- Animaciones ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes pop { from { opacity: 0; transform: scale(0.6); } }
@keyframes slide-up { from { transform: translateY(100%); } }
@keyframes slide-down { to { transform: translateY(100%); } }
@keyframes zoom-in { from { opacity: 0; transform: scale(0.95); } }
@keyframes step-in { from { opacity: 0; transform: translateX(14px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
@keyframes shake {
  20% { transform: translateX(-8px); } 40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); } 80% { transform: translateX(5px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

.kid-label {
  margin-top: 18px;
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  opacity: 0.75;
}
.kid-label + .kid-amount { margin-top: 4px; }

/* Filas de ajustes más compactas en móviles estrechos */
@media (max-width: 420px) {
  .set-row { gap: 7px; padding: 9px 10px; }
  .mini.emoji { width: 44px; font-size: 20px; }
  .mini.money { width: 84px; }
  .kind-toggle { width: 36px; height: 36px; }
  .switch { width: 46px; height: 28px; }
  .switch span::after { width: 22px; height: 22px; }
  .switch input:checked + span::after { transform: translateX(18px); }
  .order-btns button { width: 26px; }
}

/* ---------- Perfiles y entrada (0.2.0) ---------- */
.center { text-align: center; }
.big-emoji { font-size: 44px; }

.avatar.emoji { font-size: 22px; }
.avatar.xs { width: 18px; height: 18px; font-size: 10px; font-weight: 800; }
.avatar.xs.emoji { font-size: 11px; }
.avatar.lg.emoji { font-size: 34px; }
.avatar.xl { width: 84px; height: 84px; font-size: 36px; }
.avatar.xl.emoji { font-size: 44px; }

.setup .card { position: relative; }
.setup .pin-back { position: absolute; top: 10px; left: 10px; }
.pin > .avatar { margin: 6px auto 10px; }

.faces {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 18px 10px; margin-top: 18px;
}
.face {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 8px 4px; border-radius: 20px;
  font-weight: 700; font-size: 16px;
  transition: transform 0.15s var(--ease), background 0.15s;
  animation: rise 0.3s var(--ease) both;
}
.face:hover { background: var(--surface-2); }
.face:active { transform: scale(0.95); }
.face:nth-child(2) { animation-delay: 0.04s; }
.face:nth-child(3) { animation-delay: 0.08s; }
.face:nth-child(4) { animation-delay: 0.12s; }

.keypad button.spacer { visibility: hidden; }

.me-btn {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center; border-radius: 50%;
  transition: transform 0.15s var(--ease);
}
.me-btn:active { transform: scale(0.92); }
.me-btn .avatar { width: 34px; height: 34px; font-size: 15px; }
.me-btn .avatar.emoji { font-size: 19px; }
.me-card { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 4px 0 20px; }
.me-name { font-size: 20px; font-weight: 700; }
.btn.quiet { background: transparent; color: var(--muted); }

/* Quién anotó: mini avatar discreto */
.entry .sub .by { display: inline-block; vertical-align: -4px; margin-right: 6px; }
.entry .sub .by .avatar { display: inline-grid; }
.entry-detail .meta.who { display: flex; align-items: center; justify-content: center; gap: 6px; }

/* Ajustes → Perfiles */
.face-swatch { position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; cursor: pointer; }
.face-swatch .avatar, .set-row > .avatar { width: 40px; height: 40px; font-size: 17px; }
.face-swatch .avatar.emoji, .set-row > .avatar.emoji { font-size: 21px; }
.face-swatch input { position: absolute; inset: -8px; width: 56px; height: 56px; opacity: 0; cursor: pointer; }
.static-name { padding: 9px 2px; font-size: 16px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin-chip {
  flex: none; height: 36px; padding: 0 12px;
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px;
  background: var(--surface-2); color: var(--accent);
  font-weight: 700; font-size: 14px; letter-spacing: 0.04em;
}
.pin-chip.on { color: var(--muted); }
.pin-chip svg { width: 16px; height: 16px; }
