:root {
  /* Brand palette (OKLCH) */
  --bg:            oklch(0.09 0.000 0);
  --surface:       oklch(0.13 0.008 225);
  --surface-raised:oklch(0.165 0.009 225);
  --border:        oklch(0.22 0.012 225);
  --border-subtle: oklch(0.17 0.008 225);

  --ink:           oklch(0.95 0.000 0);
  --ink-secondary: oklch(0.65 0.010 225);
  --ink-muted:     oklch(0.58 0.010 225);  /* 4.5:1 on --surface-raised */

  --brand:         oklch(0.55 0.130 228);   /* cobalt — brand identity */
  --brand-dim:     oklch(0.18 0.040 228);
  --brand-hover:   oklch(0.60 0.130 228);
  --brand-ink:     oklch(0.68 0.120 228);  /* brand as text: 4.5:1 on raised */

  --green:         oklch(0.72 0.18  145);   /* wins, CTAs, positive */
  --green-dim:     oklch(0.20 0.055 145);
  --green-hover:   oklch(0.76 0.18  145);

  --red:           oklch(0.62 0.20  25);    /* loss, warning */
  --red-dim:       oklch(0.18 0.060 25);

  --amber:         oklch(0.76 0.16  75);    /* jackpot, special */
  --amber-dim:     oklch(0.20 0.055 75);

  --live-red:      oklch(0.65 0.22  25);

  /* Semantic */
  --odd-home:      var(--green);
  --odd-draw:      oklch(0.70 0.10  228);
  --odd-away:      var(--red);

  /* Elevation */
  --shadow-sm:     0 1px 3px oklch(0 0 0 / 0.4);
  --shadow-md:     0 4px 12px oklch(0 0 0 / 0.5);
  --shadow-lg:     0 12px 32px oklch(0 0 0 / 0.6);

  /* Layout */
  --sidebar-w:     220px;
  --betslip-w:     296px;
  --header-h:      56px;
  --ticker-h:      32px;

  /* Touch */
  --tap: 44px;

  /* Radius */
  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  12px;
  --r-xl:  16px;

  /* Type */
  --font-body: 'Archivo', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', ui-monospace, Menlo, monospace;

  /* Z-index scale */
  --z-sidebar:  10;
  --z-header:   20;
  --z-drawer:   30;
  --z-betslip:  25;
  --z-modal:    40;
  --z-toast:    50;
}
/* ═══════════════════════════════════════════════════════════
   FOREBET ADMIN
   Same token system as the player site; a denser, quieter surface.
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* A display rule on a class beats the hidden attribute's UA default, which
   silently reveals every step of the login flow at once. Guard it once here
   rather than remembering per component. */
[hidden] { display: none !important; }

button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font: inherit; }

:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; border-radius: var(--r-sm); }

.w-full { width: 100%; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; min-height: 40px;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--green); color: oklch(0.12 0 0); }
.btn-primary:hover:not(:disabled) { background: var(--green-hover); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { border: 1px solid var(--border); color: var(--ink-secondary); }
.btn-ghost:hover { background: var(--surface-raised); color: var(--ink); }
.btn-danger { background: var(--red); color: oklch(0.98 0 0); }
.btn-danger:hover { filter: brightness(1.1); }
.btn-sm { padding: 6px 10px; min-height: 34px; font-size: 12px; }

.linkish { color: var(--brand-ink); font-size: 12px; text-align: center; width: 100%; padding: 6px; }
.linkish:hover { text-decoration: underline; }

/* ── LOGIN GATE ──────────────────────────────────────────── */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-card {
  width: 100%; max-width: 360px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 28px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-lg);
}
.gate-brand { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; }
.gate-brand-tag {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--brand-ink); margin-left: 8px; vertical-align: middle;
}
.gate-step { display: flex; flex-direction: column; gap: 10px; }
.gate-hint { font-size: 12px; color: var(--ink-secondary); }

.lbl { font-size: 11px; font-weight: 600; color: var(--ink-secondary); }
.inp {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 12px; color: var(--ink);
  min-height: 42px; width: 100%;
}
.inp:focus { border-color: var(--brand); outline: none; }
.inp-sm { min-height: 34px; padding: 6px 10px; font-size: 12px; width: auto; }
.inp-code {
  font-family: var(--font-mono); font-size: 22px; letter-spacing: .3em;
  text-align: center; padding: 12px;
}
.prefix-wrap { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.prefix-wrap .inp { border: none; border-radius: 0; }
.prefix { display: grid; place-items: center; padding: 0 10px; background: var(--surface-raised); color: var(--ink-secondary); font-family: var(--font-mono); font-size: 13px; }

.err { background: var(--red-dim); color: var(--red); border: 1px solid var(--red); border-radius: var(--r-sm); padding: 9px 12px; font-size: 12px; }

.enroll-secret {
  font-family: var(--font-mono); font-size: 13px; word-break: break-all;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 10px 12px; color: var(--brand-ink);
}
.recovery-list {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px;
  font-family: var(--font-mono); font-size: 11px;
  background: var(--bg); border: 1px solid var(--amber); border-radius: var(--r-sm); padding: 10px;
  color: var(--amber);
}

/* ── SHELL ───────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.brand-tag { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--brand-ink); margin-left: 6px; }

.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: var(--r-sm);
  font-size: 13px; color: var(--ink-secondary); white-space: nowrap; min-height: 40px;
}
.tab:hover { background: var(--surface-raised); color: var(--ink); }
.tab.active { background: var(--brand-dim); color: var(--brand-ink); font-weight: 600; }
.pill { background: var(--surface); color: var(--ink); font-family: var(--font-mono); font-size: 10px; padding: 1px 6px; border-radius: 10px; }
.tab.active .pill { background: var(--brand); color: oklch(0.98 0 0); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }

.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.whoami { font-size: 12px; color: var(--ink-secondary); white-space: nowrap; }

.main { padding: 20px; max-width: 1100px; margin: 0 auto; }
.view-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.view-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.budget { margin-left: auto; font-size: 12px; color: var(--ink-secondary); font-family: var(--font-mono); }
.range { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.range-sep { font-size: 12px; color: var(--ink-muted); }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 10px;
}
.card-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card-title { font-size: 14px; font-weight: 600; }
.card-sub { font-size: 11px; color: var(--ink-muted); font-family: var(--font-mono); }

.money { font-family: var(--font-mono); font-weight: 500; }
.money-lg { font-size: 18px; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.warn { color: var(--amber); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--surface-raised); border-radius: var(--r-sm); padding: 8px 10px; }
.stat-k { font-size: 10px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-v { font-family: var(--font-mono); font-size: 14px; margin-top: 2px; }

.badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 3px 8px; border-radius: var(--r-sm);
  background: var(--surface-raised); color: var(--ink-secondary);
}
.badge-wait { background: var(--amber-dim); color: var(--amber); }
.badge-ok { background: var(--green-dim); color: var(--green); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.empty { padding: 40px 0; text-align: center; color: var(--ink-muted); font-size: 13px; }
.empty-ok { color: var(--green); }

/* ── TABLE ───────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th {
  text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-muted); padding: 8px 10px; border-bottom: 1px solid var(--border);
  font-weight: 600; white-space: nowrap;
}
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .num { font-family: var(--font-mono); text-align: right; white-space: nowrap; }
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: oklch(0 0 0 / .7);
  display: grid; place-items: center; padding: 20px; z-index: 40;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 22px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
}
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.modal-body { font-size: 13px; color: var(--ink-secondary); line-height: 1.6; margin-bottom: 18px; }
.modal-body strong { color: var(--ink); font-family: var(--font-mono); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ── TOAST ───────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 11px 18px; font-size: 13px;
  box-shadow: var(--shadow-lg); z-index: 50; max-width: calc(100vw - 32px);
}
.toast[hidden] { display: none; }

@media (max-width: 720px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .topbar-end { width: 100%; }
  .tabs { width: 100%; order: 3; }
  .main { padding: 14px; }
  .budget, .range { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Role badge. The server is the authority on what an admin may do; this only
   tells them which they are. */
.role-tag {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  margin-left: 8px;
  vertical-align: middle;
}
.role-super    { background: var(--brand-dim); color: var(--brand-ink); }
.role-operator { background: var(--surface-raised); color: var(--ink-secondary); }

/* Transaction status colours; failures should be visible at a glance. */
.badge-fail { background: var(--red-dim); color: var(--red); }

/* Customer rows open a detail view. Without an affordance the drill-down is a
   feature nobody finds, so the row states that it is interactive. */
.tbl tbody tr.row-click { cursor: pointer; }
.tbl tbody tr.row-click:hover { background: var(--surface-raised); }
.tbl tbody tr.row-click:focus-visible {
  outline: 2px solid var(--brand-ink);
  outline-offset: -2px;
}

/* Risk flags on a withdrawal. Reasons to look twice, printed where the decision
   is made rather than on a screen an operator would have to go and find. */
.flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 2px;
}
.flag {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
}
.flag-high   { background: var(--red-dim);   color: var(--red); }
.flag-medium { background: var(--amber-dim); color: var(--amber); }

/* Payment gateway switcher. */
.gw-list { display: flex; flex-direction: column; gap: 8px; }
.gw-option {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--r-md, 8px);
  border: 1px solid var(--border); background: var(--surface);
}
.gw-active { border-color: var(--green); }
.gw-unconfigured { opacity: .6; }
.gw-name { font-weight: 700; text-transform: capitalize; }
.gw-status { font-size: 12px; color: var(--ink-muted); }
.gw-option .btn, .gw-option .badge, .gw-option .card-sub { margin-left: auto; }

/* Inline match creation form. */
.match-form { padding: 16px; margin-bottom: 16px; }
.mf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.mf-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-secondary); }
.mf-field span { font-weight: 600; }
.mf-field .inp { width: 100%; }
.mf-pricing { padding: 12px 0; border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); margin-bottom: 12px; }
.mf-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.mf-tab {
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-secondary);
}
.mf-tab.active { border-color: var(--brand); background: var(--brand-dim); color: var(--ink); }
.mf-mode { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.mf-mode .mf-hint { grid-column: 1 / -1; }
.mf-hint { font-size: 11px; color: var(--ink-muted); line-height: 1.5; margin: 0; }
.mf-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.mf-preview { margin-top: 12px; padding: 12px; border-radius: var(--r-md, 8px); background: var(--surface-raised); }
.mf-preview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 8px; }
.mf-preview-grid div { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-secondary); }
.mf-preview-grid strong { color: var(--ink); font-family: var(--font-mono); }

/* Manual payout rows in Settings. */
.mp-row { padding: 10px 0; border-top: 1px solid var(--border-subtle); }
.mp-row:first-of-type { border-top: none; }
.mp-main { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.mp-main .badge { margin-left: auto; }
.mp-meta { font-size: 12px; color: var(--ink-secondary); margin-top: 3px; }
.mp-completed { opacity: .75; }
.mp-cancelled, .mp-failed { opacity: .6; }
