:root {
  --bg: #070b18;
  --bg2: #0c1226;
  --panel: rgba(20, 28, 56, 0.72);
  --panel-solid: #121a35;
  --line: rgba(255, 255, 255, 0.08);
  --line2: rgba(255, 255, 255, 0.14);
  --text: #eef1ff;
  --muted: #8d97c2;
  --gold: #ffc93c;
  --gold2: #ff9f1c;
  --felt: #22c97a;
  --blue: #4f8cff;
  --violet: #9b5cff;
  --red: #ff5470;
  --cyan: #3de0ff;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Inter, system-ui, sans-serif; color: var(--text); font-size: 14px;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(155, 92, 255, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(34, 201, 122, 0.12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--cyan); text-decoration: none; }
h1, h2, h3 { font-family: 'Space Grotesk', Inter, sans-serif; margin: 0; letter-spacing: -0.01em; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 22px 16px; display: flex; flex-direction: column; gap: 6px;
  background: linear-gradient(180deg, rgba(15, 21, 44, 0.95), rgba(9, 13, 28, 0.95)); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 22px; }
.brand .ball {
  width: 40px; height: 40px; border-radius: 50%; position: relative; flex: none;
  background: radial-gradient(circle at 32% 28%, #555 0, #111 45%, #000 100%);
  box-shadow: 0 0 0 2px rgba(255, 201, 60, 0.35), 0 6px 20px rgba(255, 201, 60, 0.25);
}
.brand .ball::after {
  content: '8'; position: absolute; inset: 10px; border-radius: 50%; background: #fff; color: #000;
  font: 700 13px/20px 'Space Grotesk'; text-align: center;
}
.brand h1 { font-size: 18px; }
.brand small { color: var(--gold); font-weight: 600; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; color: var(--muted); font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.nav a.active {
  color: #1a1200; font-weight: 600;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  box-shadow: 0 6px 18px rgba(255, 170, 30, 0.28);
}
.nav .badge { margin-left: auto; background: var(--red); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.sidebar .foot { margin-top: auto; color: var(--muted); font-size: 12px; padding: 10px; }
.main { padding: 24px 32px 48px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.topbar h2 { font-size: 26px; }
.topbar .sub { color: var(--muted); margin-top: 4px; }
.topbar .spacer { flex: 1; }
.pill-online { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--felt); box-shadow: 0 0 10px var(--felt); animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------- cards ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  backdrop-filter: blur(14px); box-shadow: var(--shadow);
}
.card h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card h3 .hint { color: var(--muted); font-weight: 400; font-family: Inter; font-size: 12px; margin-left: auto; }
.grid { display: grid; gap: 18px; }
.kpis { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-bottom: 18px; }
.kpi { position: relative; overflow: hidden; }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.kpi .value { font: 700 30px/1.15 'Space Grotesk'; margin-top: 8px; }
.kpi .delta { font-size: 12px; color: var(--felt); margin-top: 4px; }
.kpi .glow { position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; opacity: 0.22; filter: blur(8px); }
.charts { grid-template-columns: repeat(12, 1fr); }
.span-8 { grid-column: span 8; } .span-4 { grid-column: span 4; } .span-6 { grid-column: span 6; } .span-12 { grid-column: span 12; }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 220px; }

/* ---------- tables ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.input, select.input, textarea.input {
  background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line2); border-radius: 10px; padding: 9px 12px; outline: none; min-width: 0;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 201, 60, 0.15); }
select.input option { background: var(--panel-solid); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 7px 13px; border-radius: 99px; border: 1px solid var(--line2); background: transparent; cursor: pointer; color: var(--muted); }
.chip.on { background: rgba(255, 201, 60, 0.14); border-color: rgba(255, 201, 60, 0.5); color: var(--gold); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: rgba(255, 255, 255, 0.03); }
.table-wrap { overflow-x: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.player { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; color: #fff;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 600; background: rgba(255, 255, 255, 0.07); color: var(--muted); }
.tag.premium { background: linear-gradient(135deg, rgba(255, 201, 60, 0.25), rgba(255, 159, 28, 0.2)); color: var(--gold); }
.tag.banned { background: rgba(255, 84, 112, 0.18); color: var(--red); }
.tag.google { color: #8ab4ff; } .tag.apple { color: #fff; } .tag.guest { color: var(--muted); }
.tag.bot { color: var(--violet); background: rgba(155, 92, 255, 0.15); }
.tag.ranked { color: var(--cyan); background: rgba(61, 224, 255, 0.12); }
.tag.friend { color: var(--felt); background: rgba(34, 201, 122, 0.12); }
.tag.open { color: var(--gold); background: rgba(255, 201, 60, 0.12); }
.tag.resolved { color: var(--felt); background: rgba(34, 201, 122, 0.12); }
.tag.dismissed { color: var(--muted); }
.coins { color: var(--gold); font-weight: 600; }
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.05); padding: 9px 15px; border-radius: 10px; cursor: pointer;
  font-weight: 600; transition: transform 0.1s, background 0.15s; white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.09); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #1a1200; border: none; box-shadow: 0 6px 18px rgba(255, 170, 30, 0.25); }
.btn.danger { background: rgba(255, 84, 112, 0.15); color: var(--red); border-color: rgba(255, 84, 112, 0.35); }
.btn.success { background: rgba(34, 201, 122, 0.15); color: var(--felt); border-color: rgba(34, 201, 122, 0.35); }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.4; cursor: default; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: 100%; max-width: 380px; padding: 34px; }
.login .brand { justify-content: center; padding-bottom: 8px; }
.login p { color: var(--muted); text-align: center; margin: 0 0 24px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { color: var(--muted); font-size: 12px; font-weight: 600; }
.err { color: var(--red); min-height: 20px; font-size: 13px; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(3, 6, 15, 0.7); backdrop-filter: blur(4px); display: flex; justify-content: flex-end; z-index: 50; animation: fade 0.15s; }
.drawer { width: min(720px, 100%); height: 100%; overflow-y: auto; background: var(--bg2); border-left: 1px solid var(--line2); padding: 26px; animation: slide 0.22s ease-out; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer .head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.drawer .head .avatar { width: 54px; height: 54px; font-size: 20px; }
.drawer .close { margin-left: auto; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.stat { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat b { display: block; font: 700 18px 'Space Grotesk'; margin-top: 4px; }
.stat span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.action { display: flex; gap: 8px; }
.action .input { flex: 1; }
.section-title { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; margin: 20px 0 10px; font-weight: 600; }
.cue-list { display: flex; flex-wrap: wrap; gap: 8px; }
.log { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: rgba(0, 0, 0, 0.3); border-radius: 10px; padding: 12px; max-height: 340px; overflow: auto; }
.log div { padding: 3px 0; border-bottom: 1px dashed var(--line); }

/* ---------- reports ---------- */
.report { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.report:last-child { border-bottom: none; }
.report .meta { color: var(--muted); font-size: 12px; margin-top: 6px; }
.report .details { margin-top: 8px; padding: 10px 12px; background: rgba(0, 0, 0, 0.25); border-radius: 10px; color: #cfd5f5; }
.report .btns { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- misc ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(30px); opacity: 0; pointer-events: none;
  background: var(--panel-solid); border: 1px solid var(--line2); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow);
  transition: all 0.25s; z-index: 100; font-weight: 500;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: rgba(255, 84, 112, 0.5); color: var(--red); }
.empty { color: var(--muted); text-align: center; padding: 30px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.swatch { width: 16px; height: 16px; border-radius: 5px; display: inline-block; vertical-align: middle; border: 1px solid var(--line2); }
.stat-bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; width: 70px; display: inline-block; vertical-align: middle; margin-left: 6px; }
.stat-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--felt), var(--gold)); }
.menu-btn { display: none; }

@media (max-width: 1100px) {
  .span-8, .span-4, .span-6 { grid-column: span 12; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; width: 260px; transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: none; }
  .main { padding: 16px; }
  .menu-btn { display: inline-flex; }
  .actions, .stats { grid-template-columns: 1fr 1fr; }
  .topbar h2 { font-size: 21px; }
}
