/* ==========================================================================
   admin-app.css — SpinArmory isolated Admin app design system.

   EVERY selector is scoped under `.ax`. Owns its own light token set;
   never reads the player `:root`; the player site never uses `.ax-*`.
   Isolation is bidirectional by construction. Visual language matches
   the approved clean light SaaS dashboard reference 1:1.
   ========================================================================== */

.ax {
  /* ---- tokens (self-contained, indigo/light) ---- */
  --ax-bg:        #f4f5fb;
  --ax-surface:   #ffffff;
  --ax-surface-2: #f6f7fc;
  --ax-line:      #ebedf5;
  --ax-line-2:    #dfe2ee;
  --ax-text:      #1b2333;
  --ax-text-dim:  #5b6478;
  --ax-text-mute: #98a0b3;
  --ax-brand:     #5b5be6;
  --ax-brand-2:   #4f46c9;
  --ax-brand-soft:#ececfd;
  --ax-brand-10:  rgba(91,91,230,.10);
  --ax-brand-15:  rgba(91,91,230,.16);
  --ax-grad:      linear-gradient(135deg,#6d6df0 0%,#5b5be6 55%,#4f46c9 100%);
  --ax-cyan:      #57c7e3;
  --ax-coral:     #f08a6b;
  --ax-positive:  #1faa6b;
  --ax-positive-bg: rgba(31,170,107,.12);
  --ax-negative:  #e0466b;
  --ax-negative-bg: rgba(224,70,107,.12);
  --ax-warn:      #e0a23a;
  --ax-warn-bg:   rgba(224,162,58,.16);
  --ax-r-sm: 10px;
  --ax-r:    16px;
  --ax-r-lg: 20px;
  --ax-r-pill: 999px;
  --ax-sh-sm: 0 1px 2px rgba(20,28,46,.04);
  --ax-sh:    0 8px 24px rgba(20,28,46,.06);
  --ax-sh-md: 0 12px 32px rgba(20,28,46,.10);
  --ax-sh-lg: 0 24px 60px rgba(20,28,46,.16);
  --ax-side-w: 248px;
  --ax-top-h:  64px;
  --ax-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --ax-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* z-index must stay BELOW the global modal/toast hosts
     (--z-modal 5000 / --z-toast 6000 in styles.css) — otherwise
     every spinarmoryConfirm / Prompt / toast renders behind the
     admin panel and actions look "broken / reset on first try".
     The player chrome never mounts on /admin so a low value is
     safe. */
  position: fixed; inset: 0; z-index: 100;
  background: var(--ax-bg); color: var(--ax-text);
  font-family: var(--ax-font); font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; overflow: hidden; color-scheme: light;
}
.ax *, .ax *::before, .ax *::after { box-sizing: border-box; }
.ax button { font-family: inherit; }
.ax a { color: inherit; text-decoration: none; }
/* Base SVG cap — every inline icon defaults to a sane size so an
   unconstrained icon can never render giant. More-specific rules
   below (sidebar 18 / stat-ico 22 / feature 22) still win. */
.ax svg { width: 18px; height: 18px; flex-shrink: 0; }
.ax-back svg { width: 16px; height: 16px; }
.ax-stat-arrow svg { width: 16px; height: 16px; }
.ax-feature-link svg { width: 14px; height: 14px; }
.ax-feature-ico svg { width: 22px; height: 22px; }
.ax-listrow .r svg { width: 16px; height: 16px; }
/* Charts are SVG too. The blanket `.ax svg { 18px }` icon cap above was
   also crushing every AdminCharts graph (Sparkline / LineChart /
   BarChart / Donut) down to an 18px speck — "barely visible". This
   higher-specificity rule exempts chart SVGs: width:auto makes each
   honour its own width attribute (LineChart/BarChart = "100%" → fill
   the card; Sparkline/Donut = their explicit px), the viewBox keeps
   the aspect ratio, max-width guards against overflow. */
.ax svg.ax-chart-svg {
  width: auto;
  height: auto;
  max-width: 100%;
  flex-shrink: 1;
}

/* ---- Shell ---- */
.ax-shell { display: grid; grid-template-columns: var(--ax-side-w) minmax(0,1fr); grid-template-rows: 100%; height: 100%; }

/* ---- Sidebar ---- */
.ax-side {
  grid-row: 1; display: flex; flex-direction: column;
  background: var(--ax-surface); border-right: 1px solid var(--ax-line);
  overflow: hidden;
}
.ax-side-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 0 22px; height: var(--ax-top-h); flex-shrink: 0;
  font-weight: 800; font-size: 17px; letter-spacing: -.02em; color: var(--ax-text);
}
.ax-side-brand .ax-dot {
  width: 34px; height: 34px; border-radius: 11px; flex-shrink: 0;
  background: var(--ax-grad); display: flex; align-items: center; justify-content: center;
  color: #fff; box-shadow: 0 6px 16px rgba(91,91,230,.36);
}
.ax-side-brand .ax-dot svg { width: 18px; height: 18px; }
.ax-side-scroll { padding: 12px 14px; overflow-y: auto; flex: 1; }
.ax-side-group + .ax-side-group { margin-top: 20px; }
.ax-side-label {
  font-size: 10px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ax-text-mute); padding: 0 12px 8px;
}
.ax-side-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 14px; margin-bottom: 2px; background: transparent; border: 0;
  cursor: pointer; border-radius: var(--ax-r-sm);
  font-size: 13.5px; color: var(--ax-text-dim); text-align: left;
  transition: background .14s, color .14s;
}
.ax-side-item:hover { background: var(--ax-surface-2); color: var(--ax-text); }
.ax-side-item.on { background: var(--ax-brand-soft); color: var(--ax-brand); font-weight: 600; }
.ax-side-item .ax-ico {
  width: 20px; height: 20px; flex-shrink: 0; display: flex;
  align-items: center; justify-content: center; color: currentColor; opacity: .85;
}
.ax-side-item .ax-ico svg { width: 18px; height: 18px; }
.ax-side-item.on .ax-ico { opacity: 1; }
.ax-side-foot { padding: 14px; flex-shrink: 0; }
.ax-syscard {
  background: var(--ax-grad); color: #fff; border-radius: var(--ax-r);
  padding: 16px; box-shadow: 0 10px 24px rgba(91,91,230,.30); position: relative; overflow: hidden;
}
.ax-syscard::after {
  content: ''; position: absolute; right: -28px; bottom: -32px;
  width: 110px; height: 110px; border-radius: 50%;
  background: rgba(255,255,255,.12);
}
.ax-syscard h4 { margin: 0 0 4px; font-size: 13px; font-weight: 700; }
.ax-syscard p { margin: 0 0 10px; font-size: 11.5px; opacity: .85; line-height: 1.4; }
.ax-syscard .ax-sysrow { display: flex; align-items: center; gap: 7px; font-size: 11.5px; margin-top: 5px; }
.ax-syscard .ax-sysdot { width: 7px; height: 7px; border-radius: 50%; background: #8affc4; box-shadow: 0 0 6px #8affc4; }
.ax-syscard .ax-sysdot.bad { background: #ff9db0; box-shadow: 0 0 6px #ff9db0; }

/* ---- Topbar ---- */
.ax-main { grid-row: 1; display: flex; flex-direction: column; min-width: 0; height: 100%; }
.ax-topbar {
  display: flex; align-items: center; gap: 16px;
  height: var(--ax-top-h); padding: 0 28px;
  background: var(--ax-bg); flex-shrink: 0;
}
.ax-burger {
  display: none; flex-direction: column; gap: 4px; justify-content: center;
  width: 40px; height: 40px; padding: 10px; background: var(--ax-surface);
  border: 1px solid var(--ax-line); border-radius: var(--ax-r-sm); cursor: pointer;
}
.ax-burger span { display: block; height: 2px; background: var(--ax-text); border-radius: 2px; }
.ax-crumb { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.ax-crumb b { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.ax-crumb span { color: var(--ax-text-mute); }
.ax-crumb i { font-style: normal; color: var(--ax-text-dim); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ax-top-spacer { flex: 1; }
.ax-top-live { font-size: 12px; font-weight: 700; color: var(--ax-brand); background: var(--ax-surface); border: 1px solid var(--ax-line); padding: 7px 14px; border-radius: var(--ax-r-pill); }
.ax-top-user { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ax-text-dim); white-space: nowrap; }
.ax-top-user .ax-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ax-grad); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }

/* ---- Scroll + page ---- */
.ax-scrollport { flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; }
.ax-page { max-width: 1520px; margin: 0 auto; padding: 4px 28px 36px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.ax-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ax-page-head h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.ax-page-head p { margin: 5px 0 0; color: var(--ax-text-mute); font-size: 13px; }
.ax-page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.ax-grid { display: grid; gap: 20px; }
.ax-grid.dash { grid-template-columns: minmax(0,1fr) 320px; align-items: start; }
.ax-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ---- Card ---- */
.ax-card { background: var(--ax-surface); border: 1px solid var(--ax-line); border-radius: var(--ax-r); box-shadow: var(--ax-sh); }
.ax-card-pad { padding: 22px; }
.ax-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; }
.ax-card-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.ax-card-head .ax-sub { font-size: 12px; color: var(--ax-text-mute); }

/* ---- Feature (gradient hero) card ---- */
.ax-feature {
  position: relative; overflow: hidden; color: #fff;
  background: var(--ax-grad); border-radius: var(--ax-r-lg);
  padding: 26px 28px; min-height: 168px;
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: 0 16px 36px rgba(91,91,230,.30);
}
.ax-feature::before, .ax-feature::after {
  content: ''; position: absolute; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.16); pointer-events: none;
}
.ax-feature::before { width: 220px; height: 220px; right: -70px; bottom: -90px; }
.ax-feature::after  { width: 150px; height: 150px; right: 20px; bottom: -70px; border-color: rgba(255,255,255,.10); }
.ax-feature-top { display: flex; align-items: center; justify-content: space-between; }
.ax-feature-ico { width: 44px; height: 44px; border-radius: 13px; background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center; }
.ax-feature-link { font-size: 13px; color: #fff; opacity: .92; display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.14); padding: 7px 14px; border-radius: var(--ax-r-pill); border: 0; cursor: pointer; }
.ax-feature-v { font-size: 36px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; overflow-wrap: anywhere; word-break: break-word; }
.ax-feature-k { font-size: 14px; opacity: .85; margin-top: 6px; }

/* ---- Stat tile ---- */
.ax-statgrid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill,minmax(210px,1fr)); }
.ax-stat {
  background: var(--ax-surface); border: 1px solid var(--ax-line);
  border-radius: var(--ax-r); box-shadow: var(--ax-sh); padding: 20px 22px;
  display: flex; align-items: center; gap: 16px;
  transition: box-shadow .15s, transform .15s;
}
.ax-stat.clickable { cursor: pointer; }
.ax-stat.clickable:hover { box-shadow: var(--ax-sh-md); transform: translateY(-2px); }
.ax-stat-ico { width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--ax-brand-soft); color: var(--ax-brand); }
.ax-stat-ico.cyan { background: rgba(87,199,227,.16); color: #2898b6; }
.ax-stat-ico.coral { background: rgba(240,138,107,.16); color: #d4663f; }
.ax-stat-ico.green { background: var(--ax-positive-bg); color: var(--ax-positive); }
.ax-stat-ico svg { width: 22px; height: 22px; }
/* Text column must be allowed to shrink so big money figures wrap
   inside the card instead of overflowing the row ("numbers out of
   the line"). */
.ax-stat > div:not(.ax-stat-ico):not(.ax-stat-arrow) { min-width: 0; flex: 1 1 auto; }
.ax-stat-v { font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; word-break: break-word; }
.ax-stat-k { font-size: 13px; color: var(--ax-text-mute); margin-top: 2px; }
.ax-stat-arrow { margin-left: auto; color: var(--ax-text-mute); flex-shrink: 0; }

/* ---- Chart card + legend ---- */
.ax-chartcard { background: var(--ax-surface); border: 1px solid var(--ax-line); border-radius: var(--ax-r); box-shadow: var(--ax-sh); padding: 22px; }
.ax-chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.ax-chart-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.ax-legend { display: flex; gap: 16px; flex-wrap: wrap; }
.ax-legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ax-text-dim); }
.ax-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ---- List card ---- */
.ax-listcard { background: var(--ax-surface); border: 1px solid var(--ax-line); border-radius: var(--ax-r); box-shadow: var(--ax-sh); padding: 8px; }
.ax-listcard-h { padding: 14px 16px 10px; font-size: 16px; font-weight: 700; }
.ax-listrow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--ax-r-sm); }
.ax-listrow:hover { background: var(--ax-surface-2); }
.ax-listrow .av { width: 38px; height: 38px; border-radius: 50%; background: var(--ax-surface-2); color: var(--ax-text-dim); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.ax-listrow .meta { min-width: 0; flex: 1; }
.ax-listrow .t { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ax-listrow .s { font-size: 12px; color: var(--ax-text-mute); }
.ax-listrow .r { font-size: 12px; color: var(--ax-text-dim); white-space: nowrap; }

/* ---- Toolbar / fields / buttons ---- */
.ax-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ax-toolbar .ax-input { flex: 1; min-width: 240px; }
.ax-toolbar-actions { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.ax-input, .ax-select, .ax textarea {
  width: 100%; background: var(--ax-surface); border: 1px solid var(--ax-line-2);
  border-radius: var(--ax-r-sm); padding: 11px 14px; font: inherit; color: var(--ax-text); outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.ax-input::placeholder { color: var(--ax-text-mute); }
.ax-input:focus, .ax-select:focus, .ax textarea:focus { border-color: var(--ax-brand); box-shadow: 0 0 0 4px var(--ax-brand-15); }
.ax-field { display: flex; flex-direction: column; gap: 6px; }
.ax-field > label { font-size: 12px; font-weight: 600; color: var(--ax-text-dim); }
.ax-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--ax-r-pill); font-size: 13px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; white-space: nowrap;
  transition: background .12s, border-color .12s, opacity .12s, box-shadow .12s;
}
.ax-btn:disabled { opacity: .55; cursor: not-allowed; }
.ax-btn.primary { background: var(--ax-brand); color: #fff; border-color: var(--ax-brand); box-shadow: 0 6px 16px rgba(91,91,230,.26); }
.ax-btn.primary:hover:not(:disabled) { background: var(--ax-brand-2); border-color: var(--ax-brand-2); }
.ax-btn.ghost { background: var(--ax-surface); color: var(--ax-text-dim); border-color: var(--ax-line-2); }
.ax-btn.ghost:hover:not(:disabled) { background: var(--ax-surface-2); color: var(--ax-text); }
.ax-btn.danger { background: var(--ax-negative); color: #fff; border-color: var(--ax-negative); }
.ax-btn.danger:hover:not(:disabled) { filter: brightness(.94); }
.ax-btn.sm { padding: 6px 13px; font-size: 12px; }

/* ---- Badge ---- */
.ax-badge { display: inline-flex; align-items: center; padding: 4px 11px; border-radius: var(--ax-r-pill); font-size: 11.5px; font-weight: 600; background: var(--ax-surface-2); color: var(--ax-text-dim); border: 1px solid var(--ax-line); }
.ax-badge.brand { background: var(--ax-brand-10); color: var(--ax-brand); border-color: transparent; }
.ax-badge.ok    { background: var(--ax-positive-bg); color: var(--ax-positive); border-color: transparent; }
.ax-badge.bad   { background: var(--ax-negative-bg); color: var(--ax-negative); border-color: transparent; }
.ax-badge.warn  { background: var(--ax-warn-bg); color: var(--ax-warn); border-color: transparent; }

/* ---- Table + ••• row menu ---- */
.ax-tablewrap { background: var(--ax-surface); border: 1px solid var(--ax-line); border-radius: var(--ax-r); box-shadow: var(--ax-sh); overflow-x: auto; }
.ax-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ax-table thead th { text-align: left; padding: 15px 18px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ax-text-mute); border-bottom: 1px solid var(--ax-line); white-space: nowrap; }
.ax-table thead th.r, .ax-table td.r { text-align: right; }
.ax-table tbody td { padding: 15px 18px; border-bottom: 1px solid var(--ax-line); color: var(--ax-text-dim); }
.ax-table tbody tr:last-child td { border-bottom: 0; }
.ax-table tbody tr:hover td { background: var(--ax-surface-2); }
.ax-table .ax-cell-strong { color: var(--ax-text); font-weight: 600; }
.ax-rowmenu { position: relative; display: inline-block; }
.ax-rowmenu-btn { width: 30px; height: 30px; border-radius: var(--ax-r-sm); border: 1px solid transparent; background: transparent; color: var(--ax-text-mute); cursor: pointer; font-size: 18px; line-height: 1; }
.ax-rowmenu-btn:hover { background: var(--ax-surface-2); color: var(--ax-text); }
.ax-rowmenu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 168px; background: var(--ax-surface); border: 1px solid var(--ax-line); border-radius: var(--ax-r-sm); box-shadow: var(--ax-sh-md); padding: 6px; }
.ax-rowmenu-pop button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 9px 12px; background: transparent; border: 0; border-radius: 8px; font-size: 13px; color: var(--ax-text-dim); cursor: pointer; text-align: left; }
.ax-rowmenu-pop button:hover { background: var(--ax-surface-2); color: var(--ax-text); }
.ax-rowmenu-pop button.danger { color: var(--ax-negative); }

/* ---- card-stack (≤768px) — ONLY for the generic DataTable (.ax-dt).
   Hand-built .ax-table sections have no card fallback, so they must
   stay visible everywhere and just scroll inside .ax-tablewrap. ---- */
.ax-cardlist { display: none; }
.ax-rowcard { border: 1px solid var(--ax-line); border-radius: var(--ax-r); background: var(--ax-surface); box-shadow: var(--ax-sh-sm); }
.ax-rowcard-h { padding: 14px 16px; border-bottom: 1px solid var(--ax-line); font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ax-rowcard-b { padding: 10px 16px; }
.ax-rowcard-f { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; }
.ax-rowcard-f + .ax-rowcard-f { border-top: 1px solid var(--ax-line); }
.ax-rowcard-f .k { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ax-text-mute); }
.ax-rowcard-f .v { text-align: right; color: var(--ax-text); display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---- Pagination ---- */
.ax-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--ax-text-mute); padding: 14px 6px 2px; }
.ax-pager .pg { display: flex; gap: 6px; }
.ax-pager button { min-width: 34px; height: 32px; padding: 0 10px; background: var(--ax-surface); border: 1px solid var(--ax-line-2); border-radius: var(--ax-r-sm); color: var(--ax-text-dim); cursor: pointer; }
.ax-pager button:disabled { opacity: .4; cursor: not-allowed; }
.ax-pager button:not(:disabled):hover { border-color: var(--ax-brand); color: var(--ax-brand); }

/* ---- Empty / loading ---- */
.ax-empty, .ax-loading { padding: 48px 24px; text-align: center; color: var(--ax-text-mute); border: 1px dashed var(--ax-line-2); border-radius: var(--ax-r); background: var(--ax-surface); }

/* ---- Profile page ---- */
.ax-profile-head { display: flex; align-items: center; gap: 18px; background: var(--ax-surface); border: 1px solid var(--ax-line); border-radius: var(--ax-r); box-shadow: var(--ax-sh); padding: 22px 24px; flex-wrap: wrap; }
.ax-profile-av { width: 62px; height: 62px; border-radius: 50%; background: var(--ax-grad); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 800; flex-shrink: 0; }
.ax-profile-id { min-width: 0; }
.ax-profile-id h1 { margin: 0; font-size: 22px; font-weight: 800; }
.ax-profile-id .sub { color: var(--ax-text-mute); font-size: 13px; margin-top: 3px; }
.ax-profile-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 9px; }
.ax-profile-actions { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.ax-back { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ax-text-dim); background: transparent; border: 0; cursor: pointer; padding: 4px 0; }
.ax-back:hover { color: var(--ax-brand); }

/* ---- Tabs ---- */
.ax-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--ax-line); }
.ax-tab { padding: 10px 16px; background: transparent; border: 0; cursor: pointer; font-size: 13px; color: var(--ax-text-mute); border-bottom: 2px solid transparent; }
.ax-tab:hover { color: var(--ax-text); }
.ax-tab.on { color: var(--ax-brand); border-bottom-color: var(--ax-brand); font-weight: 600; }

/* ---- Modal / Drawer / scrim ---- */
.ax-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(20,28,46,.45); display: flex; align-items: center; justify-content: center; padding: 24px; animation: ax-fade .14s ease-out; }
@keyframes ax-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes ax-slide { from { transform: translateX(24px) } to { transform: translateX(0) } }
.ax-modal { width: 100%; max-width: 560px; max-height: 88vh; background: var(--ax-surface); border-radius: var(--ax-r-lg); box-shadow: var(--ax-sh-lg); display: flex; flex-direction: column; }
.ax-modal.wide { max-width: 920px; }
.ax-modal-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--ax-line); font-weight: 700; flex-shrink: 0; }
.ax-modal-b { padding: 22px; overflow: auto; }
.ax-x { width: 32px; height: 32px; border: 0; background: var(--ax-surface-2); border-radius: var(--ax-r-sm); cursor: pointer; color: var(--ax-text-dim); font-size: 16px; }
.ax-scrim { position: fixed; inset: 0; z-index: 50; background: rgba(20,28,46,.4); animation: ax-fade .14s ease-out; }

/* ---- Auth-denied ---- */
.ax-denied { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px; }
.ax-denied h2 { margin: 0; font-size: 22px; }
.ax-denied p { margin: 0; color: var(--ax-text-mute); max-width: 420px; }

/* ==========================================================================
   .ax-legacy — compat bridge for not-yet-native sections + the drawer
   rendered asPage. Remaps the player tokens the legacy markup reads to
   the light palette and kills inherited dark + overflow:hidden clipping,
   strictly scoped so the player site is untouched.
   ========================================================================== */
.ax-legacy {
  color: var(--ax-text);
  --bg-0:#f4f5fb; --bg-1:#fff; --bg-2:#fff; --bg-3:#f6f7fc;
  --panel:#fff; --panel-2:#f6f7fc;
  --line:rgba(27,35,51,.10); --line-soft:rgba(27,35,51,.10); --line-2:rgba(27,35,51,.16);
  --text:#1b2333; --text-dim:#5b6478; --text-mute:#98a0b3;
  --accent:#5b5be6; --accent-10:rgba(91,91,230,.10); --accent-15:rgba(91,91,230,.16);
  --accent-glow:rgba(91,91,230,.28); --accent-2:#4f46c9;
  --red:#e0466b; --magenta:#e0466b; --blue:#3d7bf4; --green:#1faa6b;
  --white-02:rgba(27,35,51,.02); --white-04:rgba(27,35,51,.04);
  --white-06:rgba(27,35,51,.06); --white-10:rgba(27,35,51,.10);
  --shadow-sm:0 1px 2px rgba(20,28,46,.06); --shadow-md:0 8px 24px rgba(20,28,46,.08);
}
.ax-legacy .card, .ax-legacy .frame, .ax-legacy .admin-card, .ax-legacy [class*="-card"] { overflow: visible !important; }
/* Match the native .ax-tablewrap chrome so bridged (profile) tables
   look identical to the native pages: rounded surface card + shadow
   + the scroll container that prevents clipping. */
.ax-legacy .data-table-scroll {
  overflow-x: auto !important;
  background: var(--ax-surface) !important;
  border: 1px solid var(--ax-line) !important;
  border-radius: var(--ax-r) !important;
  box-shadow: var(--ax-sh) !important;
}
.ax-legacy .page-back-row, .ax-legacy .admin-topbar, .ax-legacy .admin-side, .ax-legacy .admin-nav-scrim { display: none !important; }
.ax-legacy .admin-shell { display: block !important; padding: 0 !important; }
.ax-legacy .admin-pane, .ax-legacy .admin-page-frame { min-width: 0 !important; }
.ax-legacy .page-shell.admin-panel { padding: 0 !important; background: transparent !important; }
/* NOTE: do NOT neutralise .modal-root/.modal-shell here. The profile
   page renders the drawer with `asPage` (a plain <div className=
   "aud-aspage">, never a modal-root), so flattening was unnecessary —
   and it was forcing EVERY modal opened from a bridged section
   (create-reload, wallet-adjust, free-spins, etc.) to render inline
   with no overlay/close, breaking those flows. Modals from bridged
   sections must keep their normal fixed-overlay behaviour. */
/* Drawer asPage body: the drawer assumes a fixed-height modal (its
   outer stack is height:100% and the tab content is an inner
   overflow:auto scroller). As a PAGE it must flow naturally and let
   .ax-scrollport own scrolling. */
.ax-legacy .aud-aspage > .stack { height: auto !important; }
/* The tab body is `<div style="flex:1;overflow:auto">`. Forcing
   overflow:visible (old rule) let the page scroll vertically but
   ALSO removed the horizontal scroll, so the 3 unwrapped wide
   sub-tab tables (Ledger/Bets/Linked) overflowed and clipped.
   Keep page vertical scroll (overflow-y:visible) but restore
   horizontal scroll so wide tables stay reachable. */
.ax-legacy .aud-aspage > .stack > div[style*="overflow"] { overflow-y: visible !important; overflow-x: auto !important; }

/* ── Bridge visual upgrade ──────────────────────────────────────────────
   Restyle the legacy global primitives to the new .ax component
   language so every not-yet-natively-rebuilt section already looks
   like the new design (rounded soft cards, pill buttons, clean
   tables, modern inputs/badges/tabs). Scoped strictly to .ax-legacy
   so the dark player site is never touched. */
.ax-legacy .card, .ax-legacy .frame, .ax-legacy .admin-card {
  background: var(--ax-surface) !important;
  border: 1px solid var(--ax-line) !important;
  border-radius: var(--ax-r) !important;
  box-shadow: var(--ax-sh) !important;
  padding: 20px !important;
}
.ax-legacy .card .card, .ax-legacy .frame .frame { box-shadow: none !important; }
.ax-legacy .kicker, .ax-legacy .meta-label, .ax-legacy .admin-page-head .kicker {
  color: var(--ax-text-mute) !important; letter-spacing: .12em !important;
  text-transform: uppercase !important; font-size: 10px !important; font-weight: 700 !important;
}
.ax-legacy h1, .ax-legacy h2, .ax-legacy h3, .ax-legacy .admin-page-head h2 {
  color: var(--ax-text) !important; letter-spacing: -.01em !important;
}
.ax-legacy .btn-primary, .ax-legacy .btn-secondary {
  background: var(--ax-brand) !important; color: #fff !important;
  border: 1px solid var(--ax-brand) !important; border-radius: var(--ax-r-pill) !important;
  box-shadow: 0 6px 16px rgba(91,91,230,.24) !important; font-weight: 600 !important;
}
.ax-legacy .btn-primary:hover, .ax-legacy .btn-secondary:hover { background: var(--ax-brand-2) !important; }
.ax-legacy .btn-ghost, .ax-legacy .chip, .ax-legacy .page-tab {
  background: var(--ax-surface) !important; color: var(--ax-text-dim) !important;
  border: 1px solid var(--ax-line-2) !important; border-radius: var(--ax-r-pill) !important;
}
.ax-legacy .btn-ghost:hover, .ax-legacy .chip:hover { background: var(--ax-surface-2) !important; color: var(--ax-text) !important; }
.ax-legacy .btn-danger {
  background: var(--ax-negative) !important; color: #fff !important;
  border: 1px solid var(--ax-negative) !important; border-radius: var(--ax-r-pill) !important; font-weight: 600 !important;
}
.ax-legacy .page-tab.on, .ax-legacy .chip.on, .ax-legacy .tab.on, .ax-legacy .tab-strip .on {
  background: var(--ax-brand-soft) !important; color: var(--ax-brand) !important;
  border-color: transparent !important;
}
.ax-legacy .input, .ax-legacy .dw-input, .ax-legacy input[type="text"],
.ax-legacy input[type="search"], .ax-legacy input[type="number"],
.ax-legacy input[type="email"], .ax-legacy select, .ax-legacy textarea {
  background: var(--ax-surface) !important; color: var(--ax-text) !important;
  border: 1px solid var(--ax-line-2) !important; border-radius: var(--ax-r-sm) !important;
}
.ax-legacy .input:focus, .ax-legacy .dw-input:focus, .ax-legacy input:focus,
.ax-legacy select:focus, .ax-legacy textarea:focus {
  outline: none !important; border-color: var(--ax-brand) !important;
  box-shadow: 0 0 0 4px var(--ax-brand-15) !important;
}
.ax-legacy .badge {
  border-radius: var(--ax-r-pill) !important; background: var(--ax-surface-2) !important;
  color: var(--ax-text-dim) !important; border: 1px solid var(--ax-line) !important; font-weight: 600 !important;
}
.ax-legacy .badge[data-tone="accent"] { background: var(--ax-brand-10) !important; color: var(--ax-brand) !important; border-color: transparent !important; }
.ax-legacy .badge[data-tone="hot"], .ax-legacy .badge[data-tone="danger"] { background: var(--ax-negative-bg) !important; color: var(--ax-negative) !important; border-color: transparent !important; }
.ax-legacy .badge[data-tone="accent"], .ax-legacy .badge[data-tone="ok"], .ax-legacy .badge[data-tone="success"] { }
.ax-legacy .data-table { font-size: 13px !important; }
.ax-legacy .data-table thead tr, .ax-legacy .data-table thead th {
  background: var(--ax-surface-2) !important; color: var(--ax-text-mute) !important;
  border-bottom: 1px solid var(--ax-line) !important;
  text-transform: uppercase !important; letter-spacing: .05em !important; font-size: 11px !important;
}
.ax-legacy .data-table td { border-top: 1px solid var(--ax-line) !important; color: var(--ax-text-dim) !important; padding: 13px 16px !important; }
.ax-legacy .data-table tbody tr:hover td { background: var(--ax-brand-10) !important; color: var(--ax-text) !important; }
.ax-legacy .empty, .ax-legacy .empty-state, .ax-legacy .sa-error-banner, .ax-legacy .alert {
  border-radius: var(--ax-r) !important; background: var(--ax-surface) !important;
  border: 1px dashed var(--ax-line-2) !important; color: var(--ax-text-mute) !important;
}
.ax-legacy .alert.error, .ax-legacy .sa-error-banner { color: var(--ax-negative) !important; border-color: var(--ax-negative) !important; }
.ax-legacy .tab-strip, .ax-legacy .tabs { border-bottom: 1px solid var(--ax-line) !important; }
.ax-legacy .tab-strip button, .ax-legacy .tabs button {
  color: var(--ax-text-mute) !important; border-radius: var(--ax-r-sm) var(--ax-r-sm) 0 0 !important;
}
.ax-legacy ::-webkit-scrollbar { width: 10px; height: 10px; }
.ax-legacy ::-webkit-scrollbar-thumb { background: var(--ax-line-2); border-radius: 999px; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .ax-shell { grid-template-columns: 1fr; }
  .ax-burger { display: flex; }
  .ax-side { position: fixed; top: 0; left: 0; bottom: 0; width: 280px; max-width: 86vw; z-index: 55; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--ax-sh-lg); }
  .ax.nav-open .ax-side { transform: translateX(0); }
  .ax-grid.dash { grid-template-columns: 1fr; }
}
@media (min-width: 1025px) { .ax-scrim { display: none; } }
@media (max-width: 768px) {
  .ax-page { padding: 4px 16px 28px; }
  .ax-topbar { padding: 0 16px; gap: 10px; }
  .ax-top-user .nm { display: none; }
  .ax-crumb b { font-size: 17px; }
  /* Only the generic DataTable swaps to its card list; hand-built
     tables remain and scroll horizontally inside .ax-tablewrap. */
  .ax-dt .ax-tablewrap { display: none; }
  .ax-dt .ax-cardlist { display: flex; }
}
