/* ==========================================================================
   CONTADOR LTN · Mini App
   Diseño minimalista, profesional y adaptable (claro / oscuro).
   ========================================================================== */

:root {
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 24px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --max: 540px;
  --nav-h: 66px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.22,.8,.3,1);
}

html[data-theme="dark"] {
  --bg: #070B10;
  --bg-2: #0A1017;
  --surface: #101922;
  --surface-2: #16222D;
  --surface-3: #1C2A37;
  --border: rgba(255,255,255,.075);
  --border-strong: rgba(255,255,255,.14);
  --text: #EAF2F8;
  --text-2: #B7C7D6;
  --muted: #8296A9;
  --primary: #1ED08A;
  --primary-2: #0FA76C;
  --primary-soft: rgba(30,208,138,.12);
  --primary-ink: #04150E;
  --gold: #F4C95D;
  --gold-soft: rgba(244,201,93,.13);
  --danger: #FF5F6D;
  --danger-soft: rgba(255,95,109,.12);
  --warning: #FFB454;
  --warning-soft: rgba(255,180,84,.13);
  --info: #5AA9FF;
  --info-soft: rgba(90,169,255,.12);
  --shadow: 0 16px 40px rgba(0,0,0,.42);
  --shadow-soft: 0 8px 24px rgba(0,0,0,.28);
  --ring: 0 0 0 1px var(--border);
  --glow: 0 0 0 1px rgba(30,208,138,.28), 0 10px 34px rgba(30,208,138,.14);
  --header: rgba(7,11,16,.72);
  --nav: rgba(8,13,19,.985);
  --scrim: rgba(0,0,0,.62);
  --skeleton: linear-gradient(100deg, #101922 20%, #1A2733 36%, #101922 52%);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #F4F6FA;
  --bg-2: #EDF1F7;
  --surface: #FFFFFF;
  --surface-2: #F4F7FB;
  --surface-3: #E9EFF6;
  --border: rgba(14,30,48,.08);
  --border-strong: rgba(14,30,48,.16);
  --text: #0D1B28;
  --text-2: #3B4E61;
  --muted: #6B7C8D;
  --primary: #0FA76C;
  --primary-2: #0B8B59;
  --primary-soft: rgba(15,167,108,.10);
  --primary-ink: #FFFFFF;
  --gold: #B78109;
  --gold-soft: rgba(183,129,9,.10);
  --danger: #E23D4D;
  --danger-soft: rgba(226,61,77,.09);
  --warning: #C77800;
  --warning-soft: rgba(199,120,0,.10);
  --info: #2D7FF0;
  --info-soft: rgba(45,127,240,.09);
  --shadow: 0 18px 40px rgba(13,27,40,.12);
  --shadow-soft: 0 8px 22px rgba(13,27,40,.08);
  --ring: 0 0 0 1px var(--border);
  --glow: 0 0 0 1px rgba(15,167,108,.2), 0 12px 30px rgba(15,167,108,.12);
  --header: rgba(244,246,250,.78);
  --nav: rgba(255,255,255,.985);
  --scrim: rgba(13,27,40,.42);
  --skeleton: linear-gradient(100deg, #EDF1F7 20%, #FFFFFF 36%, #EDF1F7 52%);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 110% -10%, rgba(30,208,138,.10), transparent 60%),
    radial-gradient(900px 520px at -20% 8%, rgba(90,169,255,.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
body.no-anim * { animation: none !important; transition: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; }
h1,h2,h3,h4,p { margin: 0; }
::selection { background: var(--primary-soft); }

#app {
  min-height: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: calc(var(--sat) + 10px) 16px calc(var(--nav-h) + var(--sab) + 26px);
  position: relative;
}

/* ------------------------------------------------------------------ Boot */
.boot {
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
}
.boot-logo { width: 86px; height: 86px; animation: bootPulse 1.8s var(--ease) infinite; }
.logo-mark { width: 100%; height: 100%; filter: drop-shadow(0 14px 30px rgba(30,208,138,.25)); }
.boot-title { font-size: 22px; font-weight: 800; letter-spacing: .14em; margin-top: 8px; }
.boot-sub { color: var(--muted); font-size: 13.5px; }
.boot-bar { width: 148px; height: 4px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.boot-bar span { display: block; height: 100%; width: 38%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #66F0BE); animation: bootBar 1.2s var(--ease) infinite; }
@keyframes bootPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.055); } }
@keyframes bootBar { 0% { transform: translateX(-110%); } 100% { transform: translateX(320%); } }

/* --------------------------------------------------------- Landing "pronto" */
.landing {
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 22px;
  padding: 16px 4px 40px;
  animation: fadeUp .5s var(--ease);
}
.landing-hero { position: relative; display: grid; place-items: center; padding: 26px 0 8px; }
.landing-orb {
  width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, rgba(30,208,138,.42), rgba(30,208,138,.06) 62%, transparent 70%);
  filter: blur(2px);
  position: absolute;
}
.landing-orb::after {
  content: ""; position: absolute; inset: -18px; border-radius: 50%;
  border: 1px solid rgba(30,208,138,.24); animation: ring 4s var(--ease) infinite;
}
.landing-orb::before {
  content: ""; position: absolute; inset: -42px; border-radius: 50%;
  border: 1px dashed rgba(90,169,255,.16); animation: spin 26s linear infinite;
}
@keyframes ring { 0%,100% { transform: scale(.96); opacity: .5; } 50% { transform: scale(1.04); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
.landing-logo { width: 92px; height: 92px; position: relative; z-index: 1; }
.landing-card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 22px;
  box-shadow: var(--shadow);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.landing-card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(500px 180px at 50% -20%, rgba(30,208,138,.12), transparent 70%);
  pointer-events: none;
}
.landing-chip {
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--primary-soft); color: var(--primary);
  border: 1px solid rgba(30,208,138,.24);
  border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
}
.landing-chip svg { width: 14px; height: 14px; flex: none; }
.landing h1 { font-size: 27px; line-height: 1.18; letter-spacing: -.02em; margin: 14px 0 8px; font-weight: 800; }
.landing p { color: var(--muted); font-size: 14.5px; max-width: 340px; margin: 0 auto; }
.landing-user { margin-top: 16px; font-size: 12.5px; color: var(--muted); }
.landing-actions { display: grid; gap: 10px; margin-top: 18px; }
.landing-foot { text-align: center; color: var(--muted); font-size: 12px; }

/* ------------------------------------------------------------------ Header */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  margin: 0 -16px 12px; padding: calc(var(--sat) + 8px) 16px 10px;
  background: var(--header);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.topbar.scrolled { border-color: var(--border); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand-logo { width: 34px; height: 34px; flex: none; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-soft); }
.brand-text { min-width: 0; overflow: hidden; }
.brand-name { overflow: hidden; text-overflow: ellipsis; }
.brand-name { font-size: 13.5px; font-weight: 800; letter-spacing: .12em; white-space: nowrap; }
.top-actions { flex: none; }
.brand-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text-2); transition: transform .15s var(--ease), background .2s, color .2s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn.accent { color: var(--primary); background: var(--primary-soft); border-color: rgba(30,208,138,.22); }
.icon-btn svg { width: 19px; height: 19px; }
.role-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 8px; border: 1px solid var(--border);
  color: var(--muted); background: var(--surface-2);
}
.role-chip svg { width: 12px; height: 12px; }
.role-chip.programmer { color: var(--gold); border-color: rgba(244,201,93,.28); background: var(--gold-soft); }
.role-chip.admin { color: var(--info); border-color: rgba(90,169,255,.26); background: var(--info-soft); }

/* ----------------------------------------------------------------- Screens */
.screen { animation: fadeUp .32s var(--ease); padding-bottom: 6px; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.section { margin: 20px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-title { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.section-link { font-size: 12.5px; color: var(--primary); font-weight: 700; }
.hello { margin: 2px 0 14px; }
.hello h1 { font-size: 25px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; }
.hello p { color: var(--muted); font-size: 13.5px; margin-top: 3px; }

/* ------------------------------------------------------------------- Cards */
.card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 16px;
  position: relative;
}
.card.tight { padding: 12px; }
.card.flush { padding: 0; overflow: hidden; }
.card-row { display: flex; align-items: center; gap: 12px; }
.card + .card { margin-top: 10px; }

.balance-hero {
  border-radius: var(--radius-lg);
  padding: 18px;
  background:
    radial-gradient(420px 200px at 110% -30%, rgba(30,208,138,.22), transparent 65%),
    linear-gradient(160deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.balance-hero::after {
  content: ""; position: absolute; width: 220px; height: 220px; right: -90px; top: -120px;
  border-radius: 50%; border: 1px solid rgba(30,208,138,.16);
}
.balance-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.balance-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.live-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 4px 9px; border-radius: 999px; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 0 rgba(30,208,138,.6); animation: live 2s infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(30,208,138,.5); } 70% { box-shadow: 0 0 0 7px rgba(30,208,138,0); } 100% { box-shadow: 0 0 0 0 rgba(30,208,138,0); } }
.balance-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.balance-cell { background: rgba(255,255,255,.03); border: 1px solid var(--border); border-radius: 14px; padding: 10px 10px 9px; min-width: 0; }
html[data-theme="light"] .balance-cell { background: var(--surface-2); }
.balance-cell .cur { display: flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.balance-cell .amount { font-size: 16.5px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.balance-cell .amount.flash { animation: flash .6s var(--ease); }
@keyframes flash { 0% { color: var(--primary); transform: scale(1.04); } 100% { color: inherit; transform: none; } }
.balance-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 12px; }

/* --------------------------------------------------------------- Quick grid */
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.quick {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 13px 8px 11px; color: var(--text-2); font-size: 11.5px; font-weight: 600;
  transition: transform .16s var(--ease), border-color .2s, background .2s;
  min-height: 76px; justify-content: center;
}
.quick:active { transform: scale(.955); border-color: var(--border-strong); }
.quick .q-ico {
  width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.quick .q-ico svg { width: 19px; height: 19px; }
.quick.gold .q-ico { background: var(--gold-soft); color: var(--gold); }
.quick.info .q-ico { background: var(--info-soft); color: var(--info); }
.quick.danger .q-ico { background: var(--danger-soft); color: var(--danger); }

/* -------------------------------------------------------------- Lottery row */
.lottery-scroll { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.lottery-scroll::-webkit-scrollbar { display: none; }
.lottery-card {
  flex: none; min-width: 142px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 12px; display: flex; flex-direction: column; gap: 7px;
  transition: transform .16s var(--ease), border-color .2s;
}
.lottery-card:active { transform: scale(.97); }
.lottery-card.open { border-color: rgba(30,208,138,.26); box-shadow: inset 0 0 0 1px rgba(30,208,138,.08); }
.lottery-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.lottery-name { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; }
.lottery-period { font-size: 11px; color: var(--muted); }
.countdown { font-size: 12px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.countdown.soon { color: var(--warning); }
.countdown.closed { color: var(--muted); }
.mini-bar { height: 3px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #67F2C3); border-radius: inherit; }

/* ------------------------------------------------------------------- Lists */
.list { display: flex; flex-direction: column; gap: 8px; }
.row-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 13px; display: flex; align-items: center; gap: 11px;
  transition: transform .15s var(--ease), border-color .2s;
  text-align: left; width: 100%;
}
.row-card:active { transform: scale(.985); border-color: var(--border-strong); }
.row-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); font-size: 18px; flex: none; }
.row-main { min-width: 0; flex: 1; }
.row-title { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.row-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-end { text-align: right; flex: none; }
.row-amount { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.row-end small { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.numbers-line { font-size: 12px; color: var(--text-2); margin-top: 5px; word-break: break-word; font-family: var(--mono); letter-spacing: -.02em; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); font-size: 13px; }
.empty .e-ico { font-size: 28px; margin-bottom: 8px; opacity: .8; }

/* ------------------------------------------------------------------ Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 800; letter-spacing: .03em; padding: 3px 7px; border-radius: 7px; text-transform: uppercase; }
.badge.ok { color: var(--primary); background: var(--primary-soft); }
.badge.pending { color: var(--warning); background: var(--warning-soft); }
.badge.partial { color: var(--info); background: var(--info-soft); }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.badge.neutral { color: var(--muted); background: var(--surface-2); }
.badge.gold { color: var(--gold); background: var(--gold-soft); }
.badge.info { color: var(--info); background: var(--info-soft); }

/* ----------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 16px; border-radius: 14px;
  font-size: 14px; font-weight: 700; letter-spacing: -.01em;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  transition: transform .14s var(--ease), filter .2s, background .2s;
  width: 100%;
}
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: linear-gradient(180deg, #28DE97, var(--primary-2)); color: var(--primary-ink); border-color: transparent; box-shadow: 0 8px 22px rgba(30,208,138,.24); }
.btn.gold { background: linear-gradient(180deg, #FFD77A, #E7B23F); color: #2B1D00; border-color: transparent; }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(255,95,109,.22); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 12.5px; border-radius: 11px; }
.btn.xs { min-height: 32px; padding: 0 10px; font-size: 11.5px; border-radius: 9px; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }
.btn-icon-square { width: 46px; min-width: 46px; padding: 0; }

/* --------------------------------------------------------------- Segmented */
.seg {
  display: flex; gap: 4px; padding: 4px; border-radius: 13px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.seg button {
  flex: 1; min-height: 36px; white-space: nowrap; border-radius: 9px; font-size: 12.5px; font-weight: 700;
  color: var(--muted); transition: background .2s, color .2s, transform .12s;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}
.seg button:active { transform: scale(.97); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-soft); }
html[data-theme="light"] .seg button.active { background: #fff; }
.seg.tabs { overflow-x: auto; scrollbar-width: none; }
.seg.tabs::-webkit-scrollbar { display: none; }
.seg.tabs button { flex: none; white-space: nowrap; padding: 0 14px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 12px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 12.5px; font-weight: 700; color: var(--text-2);
  transition: all .16s var(--ease);
}
.chip:active { transform: scale(.96); }
.chip.active { background: var(--primary-soft); border-color: rgba(30,208,138,.34); color: var(--primary); }
.chip .c-emoji { font-size: 15px; }
.chip.disabled { opacity: .45; pointer-events: none; }

/* ------------------------------------------------------------------ Forms */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.input, .select, textarea.input {
  width: 100%; min-height: 46px; padding: 0 13px;
  border-radius: 13px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); outline: none;
  font-size: 14px; transition: border-color .2s, box-shadow .2s, background .2s;
}
textarea.input { padding: 12px 13px; min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, textarea.input:focus { border-color: rgba(30,208,138,.4); box-shadow: 0 0 0 3px var(--primary-soft); }
.input::placeholder { color: var(--muted); opacity: .8; }
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; }
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 54px; }
.input-suffix span { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 800; color: var(--muted); }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.error-text { color: var(--danger); font-size: 12px; margin-top: 6px; }

.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border); transition: background .2s; }
.switch i::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; left: 3px; top: 3px; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: transform .22s var(--ease); }
.switch input:checked + i { background: var(--primary); border-color: transparent; }
.switch input:checked + i::after { transform: translateX(18px); }

/* ------------------------------------------------------------ Number grid */
.num-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.num-tools .chip { min-height: 32px; font-size: 11.5px; padding: 0 10px; }
.num-cell:disabled { opacity: .5; }
.chip input[type="checkbox"] { accent-color: var(--primary); width: 14px; height: 14px; margin: 0 2px 0 0; }
.num-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.num-cell {
  position: relative; aspect-ratio: 1 / 1; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--text-2); transition: transform .12s var(--ease), background .16s, border-color .16s, color .16s;
  overflow: hidden; min-width: 0;
}
.num-cell:active { transform: scale(.9); }
.num-cell.sel { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 4px 12px rgba(30,208,138,.28); }
.num-cell.limited::after { content: ""; position: absolute; top: 3px; right: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--danger); }
.num-cell .fill { position: absolute; left: 0; bottom: 0; height: 2px; background: rgba(90,169,255,.7); width: var(--fill, 0%); }
.num-cell.full { color: var(--danger); background: var(--danger-soft); }
.num-cell.full.sel { color: var(--primary-ink); }
.num-cell .em { position: absolute; top: 2px; left: 3px; font-size: 7px; opacity: .55; line-height: 1; }
.centena-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 10px; }
.centena-pad button { min-height: 42px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 800; font-size: 15px; }
.centena-pad button:active { transform: scale(.95); }
.selected-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; min-height: 34px; }
.sel-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px 6px 10px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 800; font-family: var(--mono); }
.sel-chip b { font-weight: inherit; }

/* --------------------------------------------------------------- Summary bar */
.sticky-action {
  position: sticky; bottom: calc(var(--nav-h) + var(--sab) + 8px); z-index: 25;
  margin-top: 16px; padding: 10px 12px; border-radius: 16px;
  background: var(--nav); border: 1px solid var(--border-strong);
  backdrop-filter: blur(16px); box-shadow: var(--shadow);
}
.summary-compact { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.summary-compact .t-value { font-size: 20px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.summary-compact .t-label { font-size: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.total-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.total-line .t-label { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.total-line .t-value { font-size: 20px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- Bottom nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--max); z-index: 50;
  padding: 8px 12px calc(8px + var(--sab));
  background: var(--nav); backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: 48px; border-radius: 12px; color: var(--muted); font-size: 9.5px; font-weight: 700;
  letter-spacing: .02em; transition: color .2s, background .2s, transform .14s;
  position: relative;
}
.nav-item svg { width: 21px; height: 21px; }
.nav-item:active { transform: scale(.94); }
.nav-item.active { color: var(--primary); }
.nav-item.active::after { content: ""; position: absolute; bottom: 2px; width: 16px; height: 3px; border-radius: 99px; background: var(--primary); }
.nav-badge {
  position: absolute; top: 3px; right: calc(50% - 20px); min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 99px; background: var(--danger); color: #fff; font-size: 9px; font-weight: 800;
  display: grid; place-items: center; border: 2px solid var(--nav);
}

/* ------------------------------------------------------------------ Sheet */
.sheet-root { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
.sheet-scrim {
  position: absolute; inset: 0; background: var(--scrim); opacity: 0;
  transition: opacity .25s var(--ease); backdrop-filter: blur(2px);
}
.sheet {
  position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 104%);
  width: 100%; max-width: var(--max);
  max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 24px 24px 0 0;
  border: 1px solid var(--border); border-bottom: 0;
  padding: 10px 16px calc(20px + var(--sab));
  transition: transform .32s var(--ease);
  box-shadow: 0 -20px 60px rgba(0,0,0,.4);
}
.sheet-root.open { pointer-events: auto; }
.sheet-root.open .sheet-scrim { opacity: 1; }
.sheet-root.open .sheet { transform: translate(-50%, 0); }
.sheet-grip { width: 42px; height: 4px; border-radius: 99px; background: var(--surface-3); margin: 4px auto 14px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sheet-title { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.sheet-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.sheet-close { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); flex: none; }

/* ------------------------------------------------------------------ Toast */
.toast-root { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--sab) + 18px); transform: translateX(-50%); z-index: 120; width: calc(100% - 32px); max-width: calc(var(--max) - 32px); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
  border-radius: 13px; padding: 11px 14px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 9px;
  animation: toastIn .3s var(--ease); pointer-events: auto;
}
.toast.ok { border-color: rgba(30,208,138,.35); }
.toast.err { border-color: rgba(255,95,109,.4); }
.toast .t-ico { font-size: 16px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- Stat grid */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px;
}
.stat .s-label { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat .s-value { font-size: 19px; font-weight: 800; letter-spacing: -.02em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat .s-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.stat.accent { background: linear-gradient(160deg, var(--primary-soft), var(--surface)); border-color: rgba(30,208,138,.2); }

/* ---------------------------------------------------------------- Admin nav */
.admin-tabs { margin: 0 -16px 14px; padding: 0 16px; }
.admin-tab-panel { animation: fadeUp .25s var(--ease); }
.kv { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 700; text-align: right; word-break: break-word; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.mono { font-family: var(--mono); font-size: 12px; }
.copy-line { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 8px 10px; }
.copy-line code { flex: 1; font-family: var(--mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-line button { font-size: 11px; font-weight: 800; color: var(--primary); flex: none; }

/* --------------------------------------------------------------- Accordion */
.acc { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; margin-bottom: 8px; }
.acc-head { display: flex; align-items: center; gap: 10px; padding: 13px 14px; width: 100%; text-align: left; }
.acc-head .a-ico { width: 32px; height: 32px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.acc-head .a-title { flex: 1; font-size: 13px; font-weight: 700; }
.acc-head .a-chev { color: var(--muted); transition: transform .25s var(--ease); }
.acc.open .a-chev { transform: rotate(180deg); }
.acc-body { display: none; padding: 0 14px 14px; }
.acc.open .acc-body { display: block; animation: fadeUp .22s var(--ease); }
.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.field-grid .field { margin-bottom: 0; }
.field-grid .input { min-height: 40px; font-size: 13px; }

/* --------------------------------------------------------------- Skeleton */
.sk { background: var(--skeleton); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-line { height: 12px; margin: 8px 0; }
.sk-card { height: 88px; border-radius: var(--radius); margin-bottom: 10px; }

/* --------------------------------------------------------------- Utility */
.mt0 { margin-top: 0 !important; } .mt4 { margin-top: 4px; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb0 { margin-bottom: 0 !important; } .mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .tiny { font-size: 10.5px; }
.bold { font-weight: 800; } .center { text-align: center; } .right { text-align: right; }
.grow { flex: 1; } .nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.pos { color: var(--primary); } .neg { color: var(--danger); }
.flex { display: flex; } .flex-center { display: flex; align-items: center; } .gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap10 { gap: 10px; }
.wrap { flex-wrap: wrap; }
.round { border-radius: 999px; }
.press { transition: transform .14s var(--ease); } .press:active { transform: scale(.97); }

/* --------------------------------------------------------------- Responsive */
@media (max-width: 480px) {
  .top-actions .role-chip { display: none; }
}
@media (max-width: 380px) {
  #app { padding-left: 12px; padding-right: 12px; }
  .num-cell { font-size: 10.5px; border-radius: 7px; }
  .balance-cell .amount { font-size: 14.5px; }
  .quick { font-size: 10.5px; }
}
@media (min-width: 600px) {
  #app { padding-left: 20px; padding-right: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
