  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  /* ── Tokens de diseño (única fuente de color/forma; el modo oscuro solo los redefine) ── */
  :root {
    --bg: #f5f5f5; --card: #ffffff; --surface-2: #ffffff; --border: #e5e5e5;
    --primary: #d97706; --primary-dk: #b45309;
    --danger: #dc2626; --success: #16a34a;
    --text: #1f1f1f; --muted: #6b7280; --faint: #9ca3af;   /* neutros grises (sin tinte crema) */
    --hl: #fff4e6;                                   /* realce "seleccionado / yo": naranja muy suave */
    --tint-green-bg: #e6f4ea; --tint-green-fg: #15803d;   /* tints afinados: menos pastel */
    --tint-red-bg:   #fae8e8; --tint-red-fg:   #b42318;
    --tint-amber-bg: #f6edd8; --tint-amber-fg: #92400e;
    --tint-orange-bg: #ffedd5; --tint-orange-fg: #b45309;   /* naranja suave: botones + "Avisar" */
    --tint-neutral-bg: #ebebed;
    --accent-bg: #f4f4f5; --accent-border: #e4e4e7;  /* resumen de pedidos: gris neutro (antes amarillo crema) */
    --snack-bg: #2a2a2c; --snack-fg: #ffffff;        /* snackbar/aviso de recarga (oscuro en ambos temas) */
    --amber-line: #e0c068;                           /* bordes dorados apagados (avisos, payer-badge, PIN) */
    --r: 12px; --sh: 0 1px 3px rgba(0,0,0,.08);
    color-scheme: light;                             /* controles nativos siguen el tema, no el sistema */
    /* escala tipográfica y de espaciado (para homogeneizar las vistas) */
    --fs-xs: .72rem; --fs-sm: .78rem; --fs-md: .88rem; --fs-lg: 1rem;
    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  }
  /* Modo oscuro: solo redefine tokens (JS pone data-theme en <html> según preferencia/sistema). */
  html[data-theme="dark"] {
    --bg: #171717; --card: #232323; --surface-2: #2a2a2a; --border: #383838;   /* grises neutros (sin marrón) */
    --danger: #f87171; --success: #4ade80;
    --text: #f4f4f5; --muted: #a1a1aa; --faint: #71717a;
    --hl: #2d2620;                                    /* realce "yo": cálido sutil, sin marrón mostaza */
    --tint-green-bg: #14331f; --tint-green-fg: #86efac;
    --tint-red-bg:   #3a1d1d; --tint-red-fg:   #fca5a5;
    --tint-amber-bg: #3a2e15; --tint-amber-fg: #fcd34d;
    --tint-orange-bg: #3a2814; --tint-orange-fg: #fdba74;
    --tint-neutral-bg: #2b2b2d;
    --accent-bg: #2a2a2a; --accent-border: #383838;  /* resumen de pedidos: gris neutro (antes oliva) */
    --snack-bg: #3a3a3c; --snack-fg: #f4f4f5;         /* elevado sobre el fondo oscuro */
    --amber-line: #5c4d22;                            /* dorado apagado para bordes en oscuro */
    --sh: 0 1px 3px rgba(0,0,0,.45);
    color-scheme: dark;
  }
  /* color-scheme lo fija cada tema (:root=light, [data-theme=dark]=dark): así los
     controles nativos (p. ej. el input del PIN) siguen el tema forzado, no el sistema. */

  /* Accesibilidad: foco visible y respeto a "reducir movimiento" */
  :focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important;
                             transition-duration: .001ms !important; scroll-behavior: auto !important; }
  }
  body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
         background: var(--bg); color: var(--text); min-height: 100vh;
         overscroll-behavior-y: contain;
         -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

  /* iOS hace auto-zoom (y descentra la página) al enfocar un input con
     font-size < 16px. Base de 16px en todos los controles para evitarlo; las
     clases específicas (.pin-input, .login-input) lo suben más, sin bajar de 16. */
  input, select, textarea { font-size: 16px; }

  /* pull-to-refresh */
  #ptr-bar { height: 0; overflow: hidden; background: var(--bg);
             border-bottom: 1px solid var(--border);
             display: flex; align-items: center; justify-content: center;
             font-size: .83rem; color: var(--muted);
             transition: height .2s ease; }
  #ptr-bar.visible { height: 40px; }

  /* top nav */
  nav { background: var(--primary); padding: 10px 14px; display: flex; align-items: center;
        gap: 8px; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,.18);
        /* con viewport-fit=cover el contenido entra bajo la status bar de iOS */
        padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .brand { font-weight: 700; font-size: 1.05rem; color: white; flex: 1; white-space: nowrap; }
  #nav-user { font-size: .78rem; color: rgba(255,255,255,.85); }
  #nav-group { display: none; align-items: center; gap: 4px; background: rgba(255,255,255,.18);
               border: none; cursor: pointer; color: white; font-size: .76rem; font-weight: 600;
               padding: 5px 9px; border-radius: 999px; max-width: 42vw; }
  #nav-group .ng-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* Misma estética de tarjeta que .card (sombra, radio, padding) para que la
     pantalla de selección de grupo sea coherente con Desayunos y Admin. */
  .group-row { display: flex; align-items: center; justify-content: space-between; gap: 8px;
               padding: 14px; border-radius: var(--r); border: 1px solid var(--border);
               margin-bottom: 12px; cursor: pointer; background: var(--card); box-shadow: var(--sh);
               transition: border-color .15s, transform .05s; }
  .group-row:active { transform: scale(.99); }
  .group-row.active { border-color: var(--primary); background: var(--hl); }
  .group-row .gr-name { font-weight: 600; }
  .group-row .gr-role { font-size: .72rem; color: var(--muted); }
  /* Fila de listado homogénea para los popups (miembros, búsqueda, bares…). */
  .list-row { display: flex; align-items: center; justify-content: space-between; gap: 8px;
              padding: 10px 4px; border-bottom: 1px solid var(--border); }
  .list-row:last-child { border-bottom: none; }
  .list-row .lr-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .list-row .lr-main .lr-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .list-row .lr-actions { display: flex; gap: 4px; flex-shrink: 0; }
  .list-scroll { max-height: 44vh; overflow: auto; overscroll-behavior: contain; }
  .login-suggest { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
  .suggest-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
                  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
                  background: var(--card); cursor: pointer; font-size: .98rem; color: var(--text); }
  .suggest-item:hover, .suggest-item:focus { border-color: var(--primary); background: var(--hl); }
  .suggest-item .si-emoji { font-size: 1.3rem; }
  #btn-logout { background: none; border: none; cursor: pointer; color: white;
                padding: 6px; border-radius: 8px; display: flex; align-items: center;
                justify-content: center; opacity: .85; transition: opacity .15s; }
  #btn-logout:hover { opacity: 1; background: rgba(255,255,255,.2); }

  /* Avatar de iniciales (sustituye los emojis 👨/👩): color derivado del nombre. */
  .avatar { display: inline-flex; align-items: center; justify-content: center;
            font-size: .72em; width: 1.85em; height: 1.85em; border-radius: 50%;
            font-weight: 700; color: #fff; background: hsl(var(--av-h, 30) 48% 46%);
            flex-shrink: 0; line-height: 1; vertical-align: middle; letter-spacing: .02em; }

  /* bottom nav */
  #bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--card);
                border-top: 1px solid var(--border); display: none; align-items: stretch;
                z-index: 100; height: 70px;
                padding-bottom: env(safe-area-inset-bottom, 0px);
                box-shadow: 0 -2px 8px rgba(0,0,0,.08); }
  #bottom-nav.visible { display: flex; }
  .bnav-btn { flex: 1; display: flex; flex-direction: column; align-items: center;
              justify-content: center; gap: 2px; background: none; border: none;
              cursor: pointer; color: var(--muted); transition: color .15s;
              padding: 8px 4px; min-width: 0; min-height: 44px; }
  .bnav-btn:hover { color: var(--primary); }
  .bnav-btn.active { color: var(--primary); }
  .bnav-icon { font-size: 1.45rem; line-height: 1; }
  .bnav-label { font-size: .62rem; font-weight: 600; }
  .bnav-center .bnav-icon { font-size: 1.7rem; }
  .bnav-center { color: var(--text); }
  .bnav-center.active { color: var(--primary); }

  /* views */
  .view { display: none; padding: 14px; padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); max-width: 480px; margin: 0 auto; }
  .view.active { display: block; }
  h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 14px; }
  h3 { font-size: .95rem; font-weight: 600; margin-bottom: 8px; }

  /* card */
  .card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r);
          padding: 14px; box-shadow: var(--sh); margin-bottom: 12px; }

  /* buttons */
  .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
         padding: 11px 18px; border-radius: 9px; border: none; font-size: .93rem;
         font-weight: 600; cursor: pointer; transition: all .15s; width: 100%; }
  /* hovers theme-aware: los sólidos oscurecen, los suaves intensifican su tinte
     (color-mix → funcionan igual en claro y oscuro, sin pastel hardcodeado) */
  .btn-primary  { background: var(--tint-orange-bg); color: var(--tint-orange-fg); }
  .btn-primary:hover  { background: color-mix(in srgb, var(--tint-orange-bg), var(--tint-orange-fg) 14%); }
  .btn-danger   { background: var(--danger);  color: white; }
  .btn-danger:hover   { background: color-mix(in srgb, var(--danger), #000 14%); }
  .btn-success  { background: var(--tint-green-bg); color: var(--tint-green-fg); }
  .btn-success:hover  { background: color-mix(in srgb, var(--tint-green-bg), var(--tint-green-fg) 14%); }
  .btn-soft-success { background: var(--tint-green-bg); color: var(--tint-green-fg); }
  .btn-soft-success:hover { background: color-mix(in srgb, var(--tint-green-bg), var(--tint-green-fg) 14%); }
  .btn-soft-danger  { background: var(--tint-red-bg); color: var(--tint-red-fg); }
  .btn-soft-danger:hover  { background: color-mix(in srgb, var(--tint-red-bg), var(--tint-red-fg) 14%); }
  .btn-soft-warning { background: var(--tint-amber-bg); color: var(--tint-amber-fg); }
  .btn-soft-warning:hover { background: color-mix(in srgb, var(--tint-amber-bg), var(--tint-amber-fg) 14%); }
  /* Estado "ocupado" mientras una acción async está en vuelo: spinner + no
     re-clicable (anti doble-submit). Lo gestiona el helper busy(). */
  .btn.is-loading { pointer-events: none; opacity: .8; }
  .btn.is-loading::before { content: ''; width: 14px; height: 14px; flex-shrink: 0;
              border: 2px solid currentColor; border-right-color: transparent;
              border-radius: 50%; animation: btnspin .6s linear infinite; }
  @keyframes btnspin { to { transform: rotate(360deg); } }
  .help-dot { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--border);
              background: transparent; color: var(--muted); font-size: .72rem; font-weight: 700;
              cursor: pointer; line-height: 1; padding: 0; }
  .help-dot:hover { border-color: var(--primary); color: var(--primary); }
  .help-table { border-collapse: collapse; font-size: .8rem; margin-top: 10px; }
  .help-table td { padding: 7px 8px 7px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
  .help-table tr:last-child td { border-bottom: none; }
  .help-table td:first-child { font-weight: 600; padding-right: 10px; min-width: 96px; }
  .pay-tag { display: inline-block; white-space: nowrap; }
  .btn-ghost    { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
  .btn-ghost:hover    { background: var(--border); }
  .btn:disabled { opacity: .45; cursor: not-allowed; }
  .btn-sm       { padding: 7px 13px; font-size: .82rem; width: auto; }
  .btn-xs       { padding: 5px 8px; font-size: .72rem; width: auto; }

  /* modal */
  .modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
           z-index: 200; align-items: center; justify-content: center; padding: 16px;
           overscroll-behavior: contain; }
  .modal.open { display: flex; }
  /* Con un modal abierto se bloquea el scroll del fondo: así el scroll (y el foco
     táctil) se queda dentro del popup y no se "escapa" a la pantalla de detrás. */
  body.modal-open { overflow: hidden; }
  /* El confirm genérico se abre DESDE dentro de otros modales (quitar miembro,
     regenerar PIN…): debe quedar siempre por encima, no detrás. */
  #confirm-modal { z-index: 320; }
  .modal-box { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 22px; width: 100%; max-width: 320px;
               max-height: 85dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
               overscroll-behavior: contain; }
  .modal-box h3 { margin-bottom: 14px; font-size: 1.05rem; }
  .modal-actions { display: flex; gap: 8px; margin-top: 12px; }

  /* pin input */
  .pin-input { width: 100%; font-size: 1.5rem; text-align: center; letter-spacing: .3em;
               padding: 11px; border: 2px solid var(--border); border-radius: 9px;
               background: var(--card); color: var(--text);
               outline: none; margin-bottom: 10px; }
  .pin-input:focus { border-color: var(--primary); }

  /* name input (login) */
  /* login */
  #view-login.active { display: flex; flex-direction: column; justify-content: center;
                       min-height: calc(100dvh - 120px); padding-bottom: 24px; }
  .login-hero { text-align: center; margin-bottom: 22px; }
  .login-logo { font-size: 3.4rem; line-height: 1; filter: drop-shadow(0 5px 12px rgba(217,119,6,.28)); }
  .login-title { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; margin: 12px 0 5px; }
  .login-sub { color: var(--muted); font-size: .92rem; margin: 0; }
  .login-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px;
                padding: 18px; box-shadow: 0 12px 32px rgba(28,25,23,.07); }
  .login-field { position: relative; }
  .login-field-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
                      opacity: .45; font-size: 1rem; pointer-events: none; }
  .login-input { width: 100%; font-size: 1.15rem; padding: 14px 14px 14px 42px; background: var(--bg);
                 border: 1.5px solid var(--border); border-radius: 12px; outline: none;
                 transition: border-color .15s, box-shadow .15s, background .15s; }
  .login-input::placeholder { color: var(--faint); }
  .login-input:focus { border-color: var(--primary); background: var(--surface-2);
                       box-shadow: 0 0 0 3px rgba(217,119,6,.15); }
  .login-btn { width: 100%; margin-top: 4px; padding: 13px; font-size: 1rem; border-radius: 12px; }

  /* form */
  select, input[type=number], .text-input {
    width: 100%; padding: 9px 11px; border: 1.5px solid var(--border);
    border-radius: 8px; font-size: .92rem; outline: none;
    background: var(--card); color: var(--text); }
  /* El <select> nativo, bajo color-scheme, pinta su propio fondo de campo (un gris
     distinto) y desentona del modal. Le quitamos el aspecto nativo para que el fondo
     sea EXACTAMENTE el del contenedor (--surface-2, igual que .modal-box) + flecha propia. */
  select {
    appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; }
  select:focus, input:focus { border-color: var(--primary); }
  label { font-size: .82rem; font-weight: 600; color: var(--muted); display: block; margin-bottom: 5px; }
  .form-group { margin-bottom: 12px; }

  /* menu items */
  .cat-label { font-size: .72rem; font-weight: 700; text-transform: uppercase;
               letter-spacing: .07em; color: var(--muted); margin: 12px 0 5px; }
  .menu-item { display: flex; align-items: center; gap: 10px;
               padding: 9px 0; border-bottom: 1px solid var(--border); }
  .menu-item:last-child { border-bottom: none; }
  .item-info { flex: 1; }
  .item-name  { font-size: .88rem; font-weight: 500; }
  .item-price { font-size: .78rem; color: var(--muted); }
  .qty-ctrl { display: flex; align-items: center; gap: 6px; }
  .qty-btn { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--border);
             background: var(--surface-2); font-size: 1rem; cursor: pointer;
             display: flex; align-items: center; justify-content: center;
             transition: all .1s; flex-shrink: 0; }
  .qty-btn:hover { border-color: var(--primary); color: var(--primary); }
  .qty-val { min-width: 20px; text-align: center; font-weight: 600; font-size: .88rem; }

  /* resumen de pedidos en la sesión */
  .grouped-bg { background: var(--accent-bg); border: 1px solid var(--accent-border); border-radius: 10px; padding: 6px 10px; }
  .grouped-clickable { cursor: pointer; transition: border-color .12s, box-shadow .12s; }
  .grouped-clickable:hover { border-color: #fde047; box-shadow: 0 0 0 3px rgba(253,224,71,.25); }
  .grouped-clickable:active { transform: scale(.997); }

  /* pedidos a pantalla completa: hereda el fondo amarillo de la tarjeta */
  .grouped-fs { background: var(--accent-bg); padding: 0; }
  .grouped-fs-inner { display: flex; flex-direction: column; width: 100%; height: 100%;
                      padding: 20px max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
                      box-sizing: border-box; }
  .grouped-fs-content { flex: 1; min-height: 0; display: flex; flex-direction: column;
                        justify-content: center; overflow: hidden; line-height: 1.25; }
  /* lista demasiado larga para caber ni al mínimo: scroll en vez de recorte */
  .grouped-fs-content.is-scroll { justify-content: flex-start; overflow-y: auto;
                                  -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .grouped-fs-content .order-line { font-size: 1em; padding: .12em 0; }
  .grouped-fs-content .qty        { margin-right: .18em; }
  .grouped-fs-content .grouped-fs-section {
    font-size: 1em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    opacity: .5; margin: .9em 0 .15em; }
  .grouped-fs-content .grouped-fs-section:first-child { margin-top: 0; }
  .grouped-fs-content .text-muted { font-size: 1em; text-align: center; }
  .grouped-fs-actions { padding-top: 16px; flex-shrink: 0; }
  /* "tú" en el desglose por persona: mismo ámbar de marca que balance-row-me */
  .participant-me { background: var(--hl); border-radius: 8px; margin: 0 -8px;
                    padding-left: 8px !important; padding-right: 8px !important; }

  /* order lines */
  .order-line { display: flex; justify-content: space-between; font-size: .88rem; padding: 3px 0;
                font-variant-numeric: tabular-nums; }
  .qty { color: var(--muted); margin-right: 3px; }
  .total-row { font-variant-numeric: tabular-nums;
               display: flex; justify-content: space-between; align-items: center;
               font-size: .9rem; border-top: 1.5px solid var(--border);
               padding-top: 9px; margin-top: 9px; }

  /* participant */
  .participant { display: flex; justify-content: space-between; align-items: flex-start;
                 padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
  .participant:last-child { border-bottom: none; }
  .p-items { color: var(--muted); font-size: .78rem; margin-top: 1px; }

  /* raciones (items compartibles) */
  .racion-tag { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
                background: var(--tint-neutral-bg); color: var(--muted);
                border-radius: 5px; padding: 1px 5px; margin-left: 5px; vertical-align: middle; }
  .shared-row { border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px; margin-bottom: 10px; }
  .shared-row:last-child { margin-bottom: 0; }
  .shared-names { font-size: .82rem; display: flex; flex-direction: column; gap: 2px;
                  font-variant-numeric: tabular-nums; }
  .check-list { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
  .check-row, .radio-row { display: flex; align-items: center; gap: 9px; padding: 7px 6px;
                           border-radius: 8px; cursor: pointer; font-size: .9rem; }
  .check-row:hover, .radio-row:hover { background: var(--hl); }
  .check-row input, .radio-row input { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--primary); }

  /* session picker */
  .picker-card { cursor: pointer; transition: all .15s; }
  .btn-add-session { background: transparent; border: 2px dashed var(--border);
                     border-radius: var(--r); color: var(--primary); padding: 16px; }
  .btn-add-session:hover { border-color: var(--primary); background: rgba(217, 119, 6, .06); }
  .picker-card:hover { border-color: var(--primary); transform: translateY(-1px); }
  .picker-venue { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
  .picker-meta  { font-size: .8rem; color: var(--muted); margin-bottom: 12px; }

  /* history */
  .hist-row { cursor: pointer; }
  .hist-meta { font-size: .78rem; color: var(--muted); margin-top: 2px; }
  .hist-detail { display: none; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
  .hist-detail.open { display: block; }
  .hist-deleted { opacity: .5; border-left: 3px solid var(--danger); }

  /* balances */
  .balance-row { display: flex; justify-content: space-between; align-items: center;
                 padding: 6px 0; min-height: 43px;
                 border-bottom: 1px solid var(--border); font-size: .88rem; }
  .balance-row:last-child { border-bottom: none; }
  /* resalta los apuntes donde aparece el usuario logueado: tinte ámbar de marca
     (el mismo "seleccionado/activo" de group-row.active) */
  .balance-row-me { background: var(--hl); border-radius: 8px;
                    margin: 0 -14px; padding-left: 14px !important; padding-right: 14px !important; }
  .balance-row-me span:first-child { font-weight: 600; }
  .notice-card { background: var(--tint-amber-bg); border-color: var(--amber-line); padding: 4px 14px; }
  .notice-card .balance-row { padding: 4px 0; min-height: 37px; font-size: .85rem; border-color: var(--amber-line); }
  .notice-card .btn-sm { padding: 5px 10px; font-size: .78rem; }
  .amt-badge { background: var(--tint-red-bg); color: var(--danger); font-weight: 700;
               padding: 2px 8px; border-radius: 6px; font-size: .82rem;
               min-width: 62px; text-align: right;
               font-variant-numeric: tabular-nums; }
  .chip-amt  { min-width: 62px; text-align: right; font-variant-numeric: tabular-nums; }

  /* settle modal inputs */
  #settle-pin { width: 100%; font-size: 1.2rem; text-align: center; letter-spacing: .2em;
                padding: 9px; border: 2px solid var(--border); border-radius: 8px;
                outline: none; margin-bottom: 10px; }
  #settle-pin:focus { border-color: var(--primary); }
  #settle-amount { margin-bottom: 12px; }

  /* payer badge */
  .payer-badge { display: inline-flex; align-items: center; gap: 5px;
                 background: var(--tint-amber-bg); border: 1px solid var(--amber-line); border-radius: 8px;
                 padding: 5px 11px; font-size: .82rem; font-weight: 600; color: var(--tint-amber-fg); }

  /* status dot */
  .s-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
            animation: pulse 1.5s infinite; display: inline-block; flex-shrink: 0; }
  @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

  /* chip */
  .chip { display: inline-block; background: var(--tint-neutral-bg); border-radius: 6px;
          padding: 2px 8px; font-size: .76rem; color: var(--muted); }

  /* panel tabs */
  .panel-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
  .panel-tabs .btn-ghost { color: var(--muted); }
  .panel-tabs .btn-ghost.active { background: var(--tint-orange-bg); border-color: var(--tint-orange-bg); color: var(--tint-orange-fg); }

  /* pin display (new user) */
  .pin-display { font-size: 2rem; font-weight: 700; letter-spacing: .4em; text-align: center;
                 background: var(--tint-amber-bg); border-radius: 10px; padding: 14px; margin: 10px 0;
                 color: var(--tint-amber-fg); border: 1px solid var(--amber-line); }

  /* log mods */
  .log-entry { font-size: .75rem; color: var(--muted); padding: 3px 0;
               border-bottom: 1px dashed var(--border); }
  .log-entry:last-child { border-bottom: none; }

  /* misc */
  .flex-between { display: flex; justify-content: space-between; align-items: center; }
  .mb-8  { margin-bottom: 8px; }
  .mb-12 { margin-bottom: 12px; }
  .mt-8  { margin-top: 8px; }
  .gap-8  { height: 8px; }
  .gap-12 { height: 12px; }
  .text-muted  { color: var(--muted); font-size: .84rem; }
  .text-center { text-align: center; }
  .error-msg { color: var(--danger); font-size: .82rem; min-height: 18px; margin-bottom: 6px; }
  .big-icon { font-size: 2.8rem; margin-bottom: 10px; }
  .section-title { font-size: .8rem; font-weight: 700; text-transform: uppercase;
                   letter-spacing: .06em; color: var(--muted); margin: 16px 0 8px; }

  /* toast */
  .toast { position: fixed; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
           padding: 10px 20px; border-radius: 10px; font-size: .88rem; font-weight: 600;
           z-index: 999; pointer-events: none; animation: fadeup .25s ease;
           /* intenta una sola línea (max-content); si no cabe, salta sin cortar */
           width: max-content; max-width: calc(100vw - 24px); text-align: center; }
  .toast-success { background: var(--tint-green-bg); color: var(--tint-green-fg); border: 1px solid #bbf7d0; }
  .toast-error   { background: var(--tint-red-bg); color: var(--tint-red-fg); border: 1px solid #fecaca; }
  @keyframes fadeup { from{opacity:0;transform:translateX(-50%) translateY(8px)} to{opacity:1;transform:translateX(-50%) translateY(0)} }
  /* Aviso de versión nueva (el SW cacheó una actualización) */
  #update-banner { display: none; position: fixed; left: 50%; transform: translateX(-50%);
                   bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 998;
                   align-items: center; gap: 10px; background: var(--snack-bg); color: var(--snack-fg);
                   padding: 9px 9px 9px 16px; border-radius: 999px; font-size: .85rem;
                   box-shadow: 0 8px 24px rgba(0,0,0,.28); }
  #update-banner.show { display: flex; }
  #update-banner button { background: var(--primary); color: white; border: none; cursor: pointer;
                          border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: .82rem; }

  /* ── pagos registrados: bloque pago + compensaciones en cadena ── */
  .pago-block { align-items: flex-start; }
  .pago-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .comp-group { margin: 5px 0 4px; padding-left: 10px; border-left: 2px solid var(--border); }
  .comp-head { font-size: .74rem; color: var(--muted); margin-bottom: 3px; }
  .comp-chain { font-size: .8rem; color: var(--text); padding: 1px 0; line-height: 1.4; }
  .chain-hop { white-space: nowrap; }   /* "→ Nombre" no se parte; el salto cae entre saltos */

  /* ── Tus movimientos: tinte del importe por dirección + saldo acumulado ── */
  /* Importe (ancho fijo para alinear columnas con la del saldo) */
  .chip-amt    { min-width: 66px; }
  .amt-in      { background: var(--tint-green-bg); color: var(--tint-green-fg); }   /* dinero que te llega */
  .amt-out     { background: var(--tint-amber-bg); color: var(--tint-amber-fg); }   /* dinero que envías / adelantas */
  .amt-debt    { background: var(--tint-red-bg); color: var(--tint-red-fg); }   /* te pagan el desayuno (lo debes) → rojo */
  .amt-neutral { background: var(--tint-neutral-bg); color: var(--muted); } /* compensación sin efecto en tu saldo */
  .amt-amber   { background: var(--tint-amber-bg); color: var(--tint-amber-fg); font-weight: 400; }   /* deudas pendientes (lista directo/simplificado): ámbar apagado, no compite con los botones */
  /* Saldo acumulado: sin fondo, gris claro, sin negrita, columna alineada a la derecha */
  .mov-bal { font-size: .78rem; font-weight: 400; white-space: nowrap; font-variant-numeric: tabular-nums;
             color: var(--faint); min-width: 52px; text-align: right; }

  /* ── stats / rankings ── */
  .stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .award-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r);
                box-shadow: var(--sh); padding: 12px; text-align: center; }
  .award-card.is-me { border-color: var(--primary); background: var(--hl); }
  .award-emoji { font-size: 1.7rem; line-height: 1; }
  .award-title { font-size: .8rem; font-weight: 700; color: var(--text); margin: 6px 0 2px; }
  .award-desc { font-size: .7rem; color: var(--muted); line-height: 1.25; margin-bottom: 6px; }
  .award-winner { display: flex; align-items: center; justify-content: center; gap: 5px;
                  font-size: .9rem; font-weight: 600; }
  .award-winner.award-empty { color: var(--muted); font-weight: 500; font-style: italic; }
  .award-value { font-size: .78rem; color: var(--muted); margin-top: 2px; }

  .stats-me-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 8px; }
  .stats-me-grid > div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
  .stats-me-grid b { font-size: 1.05rem; }
  .stats-me-grid span { font-size: .72rem; color: var(--muted); }
  .stats-me-grid .net-pos { color: var(--success); }
  .stats-me-grid .net-neg { color: var(--danger); }

  .stats-empty { text-align: center; padding: 32px 16px; color: var(--muted); }
  .stats-empty-emoji { font-size: 2.4rem; margin-bottom: 8px; }
