:root {
  --ink: #030305;
  --ink-2: #141714;
  --on-ink: #F2F4F0;
  --on-ink-dim: #9AA39A;
  --bg: #EEF0EC;
  --card: #FFFFFF;
  --line: #D9E0DB;
  --text: #16232D;
  --muted: #5E6E77;
  --amber: #76C21F;
  --amber-ink: #081000;
  --amber-soft: #E8F5D6;
  --won: #1F9D55;
  --won-soft: #DDF0E6;
  --lost: #BE3F37;
  --lost-soft: #F6E0DE;
  --void: #6C7A83;
  --void-soft: #E7EBEC;
  --radius: 10px;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0D0B;
    --card: #161916;
    --line: #283028;
    --text: #E6ECE8;
    --muted: #93A4AE;
    --amber-soft: #1E2C0E;
    --won-soft: #173A2A;
    --lost-soft: #43211F;
    --void-soft: #22303A;
    --ink: #030404;
    --ink-2: #111411;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: var(--text); }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--lost); font-weight: 500; margin: 8px 0 0; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ---------- acceso ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: var(--ink); }
.auth-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 14px; padding: 28px 22px; display: grid; gap: 14px; }
.auth-card form { display: grid; gap: 6px; }
.auth-card label { font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 6px; }
.auth-card input { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 16px; }
.auth-card .btn { margin-top: 12px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: .02em; text-transform: uppercase; }
.brand::before { content: ""; display: inline-block; width: 10px; height: 10px; background: var(--amber); border-radius: 2px; margin-right: 8px; transform: rotate(45deg) translateY(-3px); }
.brand.big { font-size: 34px; }

/* ---------- controles ---------- */
.btn { border: 0; border-radius: 8px; padding: 12px 18px; font-weight: 600; }
.btn.primary { background: var(--amber); color: var(--amber-ink); }
.btn.primary:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.wide { width: 100%; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 7px; font-weight: 600; color: var(--muted); flex: 1; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.seg.small button { padding: 6px 12px; font-size: 13px; }
.icon-btn { border: 0; background: transparent; font-size: 18px; padding: 6px 10px; color: var(--muted); }
select { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); }

/* ---------- estructura ---------- */
#app { min-height: 100%; padding-bottom: calc(140px + env(safe-area-inset-bottom, 0px)); }
.top {
  position: sticky; top: 0; z-index: 20; background: var(--ink); color: var(--on-ink);
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
}
.wallet { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.wallet-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--on-ink-dim); }
.wallet-amt { font-size: 24px; font-weight: 700; color: var(--amber); }
.demo { background: var(--amber-soft); color: var(--text); font-size: 13px; padding: 8px 16px; }
.view { max-width: 760px; margin: 0 auto; padding-inline: 16px; }
.view-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 18px 0 10px; flex-wrap: wrap; }
h2 { font-family: var(--display); font-size: 26px; margin: 0; text-transform: uppercase; letter-spacing: .01em; }
h3.sub { font-family: var(--display); font-size: 18px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 28px 0 10px; }

.scroller { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
.scroller::-webkit-scrollbar { display: none; }
.groups { padding-block: 14px 8px; }
.groups button { flex: none; border: 0; border-radius: 999px; padding: 8px 14px; background: var(--card); font-weight: 600; box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap; }
.groups button.on { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.leagues { padding-block: 2px 12px; border-bottom: 1px solid var(--line); }
.leagues button { flex: none; border: 0; background: none; padding: 6px 2px; margin-right: 10px; font-weight: 600; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; }
.leagues button.on { color: var(--text); border-bottom-color: var(--amber); }

/* ---------- partidos ---------- */
.events { display: grid; gap: 10px; padding-top: 12px; }
.day { font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.event { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); padding: 12px; display: grid; gap: 10px; }
.event-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.teams { font-weight: 600; line-height: 1.25; }
.teams span { display: block; }
.kick { font-family: var(--display); font-size: 15px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mkt { display: grid; gap: 4px; }
.mkt-name { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.odds-row { display: grid; grid-template-columns: repeat(var(--n, 2), 1fr); gap: 6px; }
.odd {
  border: 1px solid var(--line); background: var(--bg); border-radius: 7px; padding: 7px 8px;
  display: flex; justify-content: space-between; align-items: center; gap: 6px; min-width: 0;
}
.odd .lbl { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.odd .price { font-family: var(--display); font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.odd:hover { border-color: var(--amber); }
.odd.on { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.odd.on .lbl { color: var(--amber-ink); }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
.skeleton { height: 150px; border-radius: var(--radius); background: linear-gradient(90deg, var(--card), var(--bg), var(--card)); background-size: 200% 100%; animation: sh 1.2s infinite linear; }
@keyframes sh { to { background-position: -200% 0; } }

/* ---------- boletos ---------- */
.tickets { display: grid; gap: 10px; }
.ticket { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ticket-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; gap: 8px; border-bottom: 1px dashed var(--line); }
.ticket-head .who { font-weight: 600; }
.pill { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; }
.pill.pending { background: var(--amber-soft); color: var(--text); }
.pill.won { background: var(--won-soft); color: var(--won); }
.pill.lost { background: var(--lost-soft); color: var(--lost); }
.pill.void, .pill.push { background: var(--void-soft); color: var(--void); }
.legs { list-style: none; margin: 0; padding: 4px 12px; }
.legs li { padding: 8px 0; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; border-bottom: 1px solid var(--line); }
.legs li:last-child { border-bottom: 0; }
.leg-pick { font-weight: 600; }
.leg-match { font-size: 13px; color: var(--muted); grid-column: 1; }
.leg-price { font-family: var(--display); font-weight: 700; font-size: 17px; text-align: right; }
.leg-state { grid-column: 2; text-align: right; }
.leg-result { font-size: 12px; color: var(--muted); grid-column: 1 / -1; }
.leg-admin { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.leg-admin button { font-size: 12px; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); }
.ticket-foot { display: flex; justify-content: space-between; padding: 10px 12px; background: var(--bg); font-size: 13px; gap: 8px; }
.ticket-foot strong { font-family: var(--display); font-size: 17px; }
.ticket-foot .won { color: var(--won); }
.ticket-foot .lost { color: var(--lost); }

/* ---------- tabla ---------- */
.board { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.board li { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); }
.board li:last-child { border-bottom: 0; }
.board .pos { font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--muted); text-align: center; }
.board li:first-child .pos { color: var(--amber); }
.board .name { font-weight: 600; }
.board .stats { font-size: 12px; color: var(--muted); }
.board .bal { text-align: right; line-height: 1.1; }
.board .bal strong { font-family: var(--display); font-size: 22px; display: block; font-variant-numeric: tabular-nums; }
.board .bal .up { color: var(--won); }
.board .bal .down { color: var(--lost); }
.board li.me { background: var(--amber-soft); }

/* ---------- boleto (hoja) ---------- */
.slip-bar { position: fixed; left: 0; right: 0; bottom: calc(62px + env(safe-area-inset-bottom, 0px)); z-index: 25; padding: 0 12px 8px; display: flex; justify-content: center; pointer-events: none; }
.slip-open { pointer-events: auto; width: 100%; max-width: 520px; border: 0; border-radius: 12px; background: var(--amber); color: var(--amber-ink); display: flex; align-items: center; gap: 10px; padding: 12px 14px; font-weight: 700; box-shadow: 0 6px 18px rgba(0,0,0,.22); }
.slip-count { background: var(--ink); color: var(--amber); border-radius: 6px; min-width: 26px; padding: 1px 6px; font-size: 17px; }
.slip-odds { margin-left: auto; font-size: 20px; }
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(8, 16, 22, .55); }
.sheet-body { position: relative; width: 100%; max-width: 560px; max-height: 88%; overflow-y: auto; background: var(--card); border-radius: 16px 16px 0 0; padding: 14px 16px calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 12px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.slip-legs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.slip-legs li { display: grid; grid-template-columns: 1fr auto auto; gap: 2px 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.slip-legs .pick { font-weight: 600; }
.slip-legs .match { font-size: 12px; color: var(--muted); grid-column: 1; }
.slip-legs .price { font-family: var(--display); font-weight: 700; font-size: 18px; grid-row: 1 / 3; grid-column: 2; }
.slip-legs .x { grid-row: 1 / 3; grid-column: 3; border: 0; background: none; color: var(--muted); font-size: 16px; }
.stake-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stake-row label { font-weight: 600; }
.stake-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--bg); }
.stake-input span { color: var(--muted); font-family: var(--display); font-size: 20px; }
.stake-input input { width: 90px; border: 0; background: transparent; padding: 10px 4px; font-family: var(--display); font-weight: 700; font-size: 22px; text-align: right; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 5px 12px; font-family: var(--display); font-weight: 600; font-size: 16px; }
.payout { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px; background: var(--won-soft); border-radius: 8px; }
.payout strong { font-size: 24px; color: var(--won); }
.sheet-actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; }

/* ---------- pestañas ---------- */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--ink); display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabs button { border: 0; background: transparent; color: var(--on-ink-dim); padding: 12px 4px 14px; font-weight: 600; font-size: 13px; position: relative; border-top: 3px solid transparent; }
.tabs button.on { color: var(--on-ink); border-top-color: var(--amber); }
.tabs span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs em { position: absolute; top: 6px; right: 14%; font-style: normal; background: var(--amber); color: var(--amber-ink); font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 6px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(130px + env(safe-area-inset-bottom, 0px)); z-index: 50; background: var(--ink); color: var(--on-ink); padding: 10px 16px; border-radius: 8px; font-weight: 500; max-width: calc(100% - 32px); box-shadow: 0 6px 18px rgba(0,0,0,.25); }

@media (min-width: 700px) {
  .event { grid-template-columns: 220px 1fr; align-items: start; }
  .event-head { flex-direction: column; }
  .mkts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .mkts .mkt .odds-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ---------- fase 1: filas de momios, formularios, admin ---------- */
.odds-row.n2 { --n: 2; }
.odds-row.n3 { --n: 3; }
.slip-legs li.changed { border-color: var(--amber); background: var(--amber-soft); }
.card-form { display: grid; gap: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.card-form label { font-size: 13px; font-weight: 600; color: var(--muted); }
.card-form input { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-inline { display: flex; gap: 8px; }
.row-inline input { flex: 1; min-width: 0; }
.ok { color: var(--won); font-weight: 500; margin: 0; }
.notice { background: var(--amber-soft); border-radius: 8px; padding: 10px 12px; font-weight: 600; margin: 0; }
#admin-box { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 6px; }
#admin-box h3.sub, .card-form h3.sub { margin: 8px 0 2px; }
.users { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.users li { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 8px; }
.user-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-row .muted { margin-left: auto; }
.user-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.user-actions button { font-size: 13px; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); }
.user-actions button[data-sure] { background: var(--lost-soft); border-color: var(--lost); color: var(--lost); }
.top .brand { font-size: 21px; white-space: nowrap; }
.wallet-label { white-space: nowrap; }
@media (max-width: 360px) { .top .brand { font-size: 18px; } .wallet-amt { font-size: 20px; } }

/* ---------- marca EasyBet ---------- */
.auth { background: var(--ink); }
.auth-card { background: #030305; color: var(--on-ink); border: 1px solid #1E231E; }
.auth-card label { color: var(--on-ink-dim); }
.auth-card input { background: #050607; border-color: #2A302A; color: var(--on-ink); }
.auth-card .seg { background: #050607; border-color: #2A302A; }
.auth-card .seg button { color: var(--on-ink-dim); }
.auth-card .seg button.on { background: #1C211C; color: var(--on-ink); }
.auth-logo { width: 100%; max-width: 300px; height: auto; margin: 0 auto 4px; display: block; }
.brand-img { height: 28px; width: auto; display: block; }
.slip-count { color: var(--amber); }
