/* ============================================================
   Dashboard — Roblox automation utility
   Design: monochrome, hairline borders, Geist + Geist Mono
   ============================================================ */

@font-face { font-family: "Geist"; src: url("/assets/fonts/Geist-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/assets/fonts/Geist-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/assets/fonts/Geist-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/assets/fonts/GeistMono-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/assets/fonts/GeistMono-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  --bg: #09090a;
  --bg-1: #0e0e10;
  --surface: #131316;
  --surface-2: #18181c;
  --surface-3: #1e1e23;
  --border: #232328;
  --border-hi: #2e2e34;
  --border-strong: #3a3a42;
  --text: #ededed;
  --text-2: #b4b4bc;
  --muted: #7a7a83;
  --faint: #4a4a52;
  --accent: #e8e8ea;
  --accent-dim: #a8a8b0;
  --green: #3ecf8e;
  --green-dim: rgba(62, 207, 142, 0.12);
  --red: #f06b6b;
  --red-dim: rgba(240, 107, 107, 0.12);
  --amber: #e6b450;
  --amber-dim: rgba(230, 180, 80, 0.12);
  --blue: #6ea8ff;
  --blue-dim: rgba(110, 168, 255, 0.12);
  --tester: #71ff9e;
  --tester-mid: #369876;
  --tester-dim: rgba(54, 152, 118, 0.16);
  --tester-line: rgba(113, 255, 158, 0.24);
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --sidebar-w: 248px;
  --header-h: 56px;
  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; }

/* ---------- layout ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  height: 100vh;
  transition: grid-template-columns 0.25s var(--ease);
}
.app.sidebar-collapsed { grid-template-columns: 64px 1fr; }

.sidebar {
  grid-row: 1 / -1;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 20;
}

.header {
  grid-column: 2;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.main {
  grid-column: 2;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 32px 48px;
  background: var(--bg);
  scroll-behavior: smooth;
}
.main::-webkit-scrollbar { width: 10px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; border: 2px solid var(--bg); }
.main::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }

/* ---------- sidebar ---------- */
.sb-top {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sb-logo {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--surface-3);
  border: 1px solid var(--border-hi);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.sb-brand { display: flex; flex-direction: column; line-height: 1; overflow: hidden; white-space: nowrap; }
.sb-brand .name { font-weight: 600; font-size: 13px; letter-spacing: -0.01em; }
.sb-brand .tag { font-size: 11px; color: var(--muted); margin-top: 3px; font-family: var(--mono); }
.app.sidebar-collapsed .sb-brand { display: none; }
.app.sidebar-collapsed .sb-nav-label { display: none; }
.app.sidebar-collapsed .sb-section { display: none; }
.app.sidebar-collapsed .sb-user-meta { display: none; }
.app.sidebar-collapsed .sb-toggle svg { transform: rotate(180deg); }

.sb-nav { flex: 1; overflow-y: auto; padding: 12px 8px; }
.sb-nav::-webkit-scrollbar { width: 0; }
.sb-section {
  font-size: 10px; font-weight: 600;
  color: var(--faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 14px 10px 6px;
}
.sb-item {
  display: flex; align-items: center; gap: 10px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
  position: relative;
  white-space: nowrap;
}
.sb-item:hover { background: var(--surface-2); color: var(--text); }
.sb-item.active { background: var(--surface-2); color: var(--text); }
.sb-item.active::before {
  content: "";
  position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 2px; border-radius: 1px;
  background: var(--accent);
}
.sb-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.sb-item .badge {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--muted);
  border: 1px solid var(--border);
}
.sb-item .badge.live { background: var(--green-dim); color: var(--green); border-color: transparent; }

.sb-footer {
  border-top: 1px solid var(--border);
  padding: 10px 8px;
  flex-shrink: 0;
}
.sb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s var(--ease);
}
.sb-user:hover { background: var(--surface-2); }
.sb-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border-hi);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.sb-user-meta { overflow: hidden; white-space: nowrap; }
.sb-user-meta .n { font-size: 13px; font-weight: 500; }
.sb-user-meta .s { font-size: 11px; color: var(--muted); margin-top: 2px; font-family: var(--mono); }

.sb-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
.sb-toggle:hover { background: var(--surface-2); color: var(--text); }

/* ---------- header ---------- */
.hd-title { display: flex; flex-direction: column; line-height: 1; }
.hd-title .t { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.hd-title .s { font-size: 11px; color: var(--muted); margin-top: 4px; font-family: var(--mono); }
.hd-spacer { flex: 1; }
.hd-search {
  display: flex; align-items: center; gap: 8px;
  height: 34px; width: 260px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  transition: border-color 0.12s var(--ease), background 0.12s var(--ease);
}
.hd-search:focus-within { border-color: var(--border-hi); background: var(--surface-2); color: var(--text); }
.hd-search input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 13px; }
.hd-search input::placeholder { color: var(--muted); }
.hd-search kbd {
  font-family: var(--mono); font-size: 10px;
  padding: 1px 5px; border-radius: 3px;
  background: var(--surface-3); border: 1px solid var(--border);
  color: var(--muted);
}
.hd-icon-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: background 0.12s var(--ease), color 0.12s var(--ease), border-color 0.12s var(--ease);
  position: relative;
}
.hd-icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-hi); }
.hd-icon-btn .dot {
  position: absolute; top: 8px; right: 9px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 2px var(--surface);
}

/* ---------- page primitives ---------- */
.page { display: none; }
.page.active { display: block; animation: fadeUp 0.28s var(--ease-out); }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes cardRise {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
.page.active .stat-grid > .stat,
.page.active .grid-3 > .card {
  animation: cardRise 0.3s var(--ease-out) backwards;
}
.page.active .stat-grid > .stat:nth-child(2),
.page.active .grid-3 > .card:nth-child(2) { animation-delay: 0.035s; }
.page.active .stat-grid > .stat:nth-child(3),
.page.active .grid-3 > .card:nth-child(3) { animation-delay: 0.07s; }
.page.active .stat-grid > .stat:nth-child(4),
.page.active .grid-3 > .card:nth-child(4) { animation-delay: 0.105s; }

.page-head { margin-bottom: 20px; }
.page-head .eyebrow {
  font-size: 11px; font-weight: 600; color: var(--muted);
  letter-spacing: 0.06em; text-transform: uppercase;
  font-family: var(--mono);
  margin-bottom: 6px;
}
.page-head h1 {
  font-size: 22px; font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.page-head p { color: var(--muted); font-size: 13px; margin-top: 6px; max-width: 640px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
}
.card + .card { }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-title { font-size: 13px; font-weight: 600; letter-spacing: -0.005em; }
.card-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.card-action {
  font-size: 12px; color: var(--muted);
  padding: 4px 8px; border-radius: 5px;
  transition: color 0.12s var(--ease), background 0.12s var(--ease);
}
.card-action:hover { color: var(--text); background: var(--surface-2); }

/* ---------- stat grid ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s var(--ease), transform 0.18s var(--ease), background 0.18s var(--ease);
}
.stat:hover { border-color: var(--border-hi); }
@media (hover: hover) {
  .stat:hover { transform: translateY(-1px); background: var(--surface-2); }
}
.stat .label {
  font-size: 11px; color: var(--muted);
  font-weight: 500; letter-spacing: 0.02em;
  display: flex; align-items: center; gap: 6px;
}
.stat .label svg { width: 12px; height: 12px; opacity: 0.7; }
.stat .value {
  font-size: 26px; font-weight: 600;
  letter-spacing: -0.03em;
  margin-top: 8px;
  font-family: var(--mono);
  line-height: 1;
}
.stat .delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-family: var(--mono);
  margin-top: 8px;
  padding: 2px 6px; border-radius: 4px;
}
.stat .delta.up { color: var(--green); background: var(--green-dim); }
.stat .delta.down { color: var(--red); background: var(--red-dim); }
.stat .delta.neutral { color: var(--muted); background: var(--surface-2); }
.stat .spark {
  position: absolute; right: 14px; bottom: 12px;
  width: 72px; height: 28px; opacity: 0.6;
}

/* ---------- two-col ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-foot { font-size: 11px; color: var(--muted); margin-top: 6px; }
.step-num {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 11px; color: var(--text-2);
}
.chip {
  appearance: none; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); font: inherit; font-size: 12px;
  transition: background .15s, color .15s, border-color .15s;
}
.chip .game-ico { width: 16px; height: 16px; border-radius: 4px; }
.chip:hover { color: var(--text); border-color: var(--border-hi); }
.chip.active { background: var(--surface-3); color: var(--text); border-color: var(--border-hi); }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-bottom: 16px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; margin-bottom: 16px; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left;
  font-size: 11px; font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0;
  white-space: nowrap;
}
tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  white-space: nowrap;
}
tbody tr { transition: background 0.1s var(--ease); }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
td .cell-main { color: var(--text); font-weight: 500; }
td .cell-sub { font-size: 11px; color: var(--muted); margin-top: 2px; font-family: var(--mono); }
td.num { font-family: var(--mono); text-align: right; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 500;
  padding: 3px 8px; border-radius: 5px;
  border: 1px solid transparent;
  font-family: var(--mono);
  letter-spacing: 0.01em;
}
.badge .dot { width: 5px; height: 5px; border-radius: 50%; }
.badge.green { color: var(--green); background: var(--green-dim); }
.badge.green .dot { background: var(--green); }
.badge.red { color: var(--red); background: var(--red-dim); }
.badge.red .dot { background: var(--red); }
.badge.amber { color: var(--amber); background: var(--amber-dim); }
.badge.amber .dot { background: var(--amber); }
.badge.blue { color: var(--blue); background: var(--blue-dim); }
.badge.blue .dot { background: var(--blue); }
.badge.tester {
  color: var(--tester);
  background: var(--tester-dim);
  border-color: var(--tester-line);
}
.badge.tester .flask { font-size: 11px; line-height: 1; }
.badge.gray { color: var(--muted); background: var(--surface-2); border-color: var(--border); }
.badge.gray .dot { background: var(--faint); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 14px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease), transform 0.08s var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-hi); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:active { transform: none; }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.primary:hover { background: var(--accent-dim); color: var(--bg); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn.danger { color: var(--red); }
.btn svg { width: 14px; height: 14px; }
.btn .game-ico { width: 16px; height: 16px; border-radius: 4px; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.icon { width: 34px; padding: 0; justify-content: center; }
.btn.icon.sm { width: 28px; height: 28px; }

/* ---------- inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.input {
  height: 34px; padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px; color: var(--text);
  transition: border-color 0.12s var(--ease), background 0.12s var(--ease);
  width: 100%;
}
.input::placeholder { color: var(--muted); }
.input:focus { outline: none; border-color: var(--border-hi); background: var(--surface-2); }
.input.mono { font-family: var(--mono); font-size: 12px; }
select.input { cursor: pointer; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; }

/* ---------- tabs (segmented) ---------- */
.seg {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}
.seg button {
  height: 26px; padding: 0 12px;
  font-size: 12px; font-weight: 500;
  border-radius: 5px;
  color: var(--muted);
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface-3); color: var(--text); }

/* ---------- progress ---------- */
.progress {
  height: 4px; border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress .bar { height: 100%; border-radius: 2px; background: var(--text); transition: width 0.4s var(--ease); }

/* ---------- empty / skeleton ---------- */
.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.empty .icon { width: 36px; height: 36px; margin: 0 auto 12px; opacity: 0.4; }

/* ---------- referral ---------- */
.ref-code {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-family: var(--mono);
  font-size: 15px; font-weight: 500;
  letter-spacing: 0.04em;
}
.ref-code .val { flex: 1; }
.ref-code button { color: var(--muted); }

/* ---------- referral hero / points ---------- */
.ref-hero {
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  overflow: hidden;
  position: relative;
}
.ref-glow {
  position: absolute; right: -40px; top: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(113, 255, 158, 0.09), transparent 70%);
  pointer-events: none;
}
.ref-progress {
  height: 8px; border-radius: 999px;
  background: var(--surface-3); overflow: hidden;
}
.ref-progress > div {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--tester-mid), var(--tester));
  transition: width 0.4s var(--ease);
}
.redeem-card { margin-bottom: 16px; }
.redeem-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.redeem-balance {
  font-family: var(--mono); font-size: 22px; font-weight: 600;
  letter-spacing: -0.02em; line-height: 1;
}
.redeem-balance span { color: var(--tester); }
.redeem-balance small {
  display: block; margin-top: 5px;
  font-family: var(--font); font-size: 11px; font-weight: 400;
  color: var(--muted); letter-spacing: 0;
}
.redeem-presets {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 8px; margin: 16px 0;
}
.redeem-option {
  text-align: left; padding: 10px 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.redeem-option:hover { border-color: var(--border-hi); background: var(--surface-2); }
.redeem-option.active {
  border-color: var(--tester-mid); background: var(--tester-dim);
}
.redeem-time { display: block; font-size: 12px; font-weight: 500; color: var(--text); }
.redeem-cost { display: block; margin-top: 4px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.redeem-option.active .redeem-cost { color: var(--tester); }
.redeem-custom {
  display: grid; grid-template-columns: 1fr auto;
  gap: 16px; align-items: end;
  padding-top: 14px; border-top: 1px solid var(--border);
}
.redeem-fields { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.redeem-fields .input { width: 110px; }
.redeem-fields select.input { width: 104px; }
.redeem-summary { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.redeem-summary .cost { font-family: var(--mono); font-size: 18px; font-weight: 600; color: var(--tester); }
.redeem-summary .cost small { display: block; font-family: var(--font); font-size: 10px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.redeem-history { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 4px; }
.redeem-history-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.redeem-history-row:last-child { border-bottom: none; }
.redeem-history-row .pts { font-family: var(--mono); color: var(--muted); }
.points-val { color: var(--tester); }

.leaderboard-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row .rank {
  width: 24px; text-align: center;
  font-family: var(--mono); font-size: 12px; color: var(--muted);
}
.leaderboard-row .rank.top { color: var(--amber); }
.lb-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
}
.lb-name { flex: 1; font-size: 13px; font-weight: 500; }
.lb-stat { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  transform: translateY(20px); opacity: 0;
  transition: transform 0.25s var(--ease-out), opacity 0.25s var(--ease-out);
  z-index: 100;
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 50;
}
.modal-backdrop.show { display: flex; animation: fadeIn 0.15s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-xl);
  width: 440px; max-width: 90vw;
  padding: 24px;
  animation: scaleIn 0.2s var(--ease-out);
}
@keyframes scaleIn { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal h2 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.modal p { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.modal.hit-modal { width: 680px; max-width: 94vw; max-height: 88vh; overflow-y: auto; }
.modal.script-modal { width: 540px; max-width: 94vw; max-height: 88vh; overflow-y: auto; }

/* ---------- script visuals / options ---------- */
.visual-preview {
  position: relative;
  padding: 12px 14px 13px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.visual-preview::before {
  content: "";
  position: absolute; left: 0; top: 12px; bottom: 12px;
  width: 2px; border-radius: 2px; background: var(--tester);
}
.visual-preview-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 6px;
}
.visual-kicker {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--muted);
}
.visual-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 9px; }
.visual-features { display: flex; flex-wrap: wrap; gap: 5px; }
.visual-feature {
  font-size: 11px; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 8px; line-height: 1.3;
}
.visual-feature.points {
  color: var(--tester); background: var(--tester-dim); border-color: var(--tester-line);
}
.visual-tag {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-2); font-size: 12px; white-space: nowrap;
}
.visual-tag::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  flex-shrink: 0; background: var(--tester);
}
.script-option {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; padding: 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
}
.script-option-title { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 3px; }
.script-option-sub { font-size: 11px; color: var(--muted); line-height: 1.45; max-width: 380px; }
.auto-points-tag {
  display: inline-block; margin-left: 4px; padding: 1px 5px;
  font-family: var(--mono); font-size: 9px; font-weight: 500; letter-spacing: 0.02em;
  color: var(--tester); background: var(--tester-dim);
  border: 1px solid var(--tester-line); border-radius: 4px;
  vertical-align: 1px;
}
.script-state { font-family: var(--mono); font-size: 11px; }
.script-state.on { color: var(--green); }
.script-state.off { color: var(--muted); }

/* ---------- overview activity ---------- */
.activity-card { margin-bottom: 16px; }
.activity-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--border); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
.activity-chart { background: var(--surface); padding: 13px 15px 12px; }
.activity-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.activity-title { font-size: 12px; font-weight: 600; color: var(--text); }
.activity-sub { font-size: 10px; color: var(--muted); margin-top: 2px; }
.activity-total {
  font-family: var(--mono); font-size: 17px; font-weight: 600;
  line-height: 1; text-align: right; color: var(--text-2);
}
.activity-total small {
  display: block; margin-top: 4px;
  font-size: 9px; font-weight: 400; color: var(--muted);
  letter-spacing: 0.06em;
}
.activity-bars {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 7px; height: 92px; margin-top: 13px;
}
.activity-col { display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; min-width: 0; }
.activity-track {
  height: 66px; border-radius: 3px; background: var(--surface-2);
  overflow: hidden; display: flex; align-items: flex-end;
}
.activity-fill {
  width: 100%; min-height: 2px; border-radius: 3px;
  background: linear-gradient(180deg, var(--text-2), var(--muted));
  transition: height 0.35s var(--ease);
}
.activity-chart + .activity-chart .activity-fill {
  background: linear-gradient(180deg, var(--tester-mid), var(--tester));
}
.activity-day {
  font-family: var(--mono); font-size: 9px; color: var(--muted);
  text-align: center; letter-spacing: 0.02em;
}

/* ---------- overview recent scripts ---------- */
.recent-scripts { display: flex; flex-direction: column; }
.recent-script {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border);
}
.recent-script:last-child { border-bottom: none; padding-bottom: 0; }
.recent-script-main { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.recent-script-users {
  font-size: 12px; color: var(--muted); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.recent-script-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ---------- autojoiner ---------- */
.pick-list {
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface);
  max-height: 196px; overflow-y: auto;
}
.pick-row {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 9px 11px; border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.pick-row:last-child { border-bottom: none; }
.pick-row:hover { background: var(--surface-2); }
.pick-row input { margin-top: 2px; accent-color: var(--text-2); flex-shrink: 0; }
.pick-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pick-name {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--text-2);
}
.pick-sub {
  font-size: 10px; color: var(--muted); font-family: var(--mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.joiner-users-line { font-size: 11px; color: var(--muted); line-height: 1.5; word-break: break-word; }
.joiner-users-line strong { color: var(--text-2); font-weight: 500; }
.joiner-loader-note {
  padding: 12px; border: 1px dashed var(--border-hi); border-radius: 9px;
  color: var(--muted); font-size: 11px; line-height: 1.5;
}

/* ---------- status legend ---------- */
.status-legend { display: flex; flex-direction: column; }
.status-legend-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--muted);
}
.status-legend-row:last-child { border-bottom: none; padding-bottom: 0; }
.status-legend-row .badge { min-width: 86px; justify-content: center; }

/* ---------- danger zone ---------- */
.danger-zone { border-color: rgba(240, 107, 107, 0.28); }

/* ---------- page tabs (Scripts, Admin) ---------- */
.page-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin: -2px 0 18px;
  overflow-x: auto;
  scrollbar-width: none;
}
.page-tabs::-webkit-scrollbar { display: none; }
.page-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.page-tab svg { width: 15px; height: 15px; opacity: 0.85; }
.page-tab:hover { color: var(--text); }
.page-tab.active { color: var(--text); border-bottom-color: var(--text); }
.page-tab-count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 6px;
}

/* ---------- admin console ---------- */
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.admin-list { display: flex; flex-direction: column; }
.admin-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.admin-list-row:last-child { border-bottom: none; padding-bottom: 0; }
.admin-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.admin-avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.admin-avatar-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.pill-row { display: flex; flex-wrap: wrap; gap: 4px; }
.pill {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-2);
  background: var(--surface-2);
  white-space: nowrap;
}
.pill.green { color: var(--green); background: var(--green-dim); border-color: transparent; }
.pill.red { color: var(--red); background: var(--red-dim); border-color: transparent; }
.pill.amber { color: var(--amber); background: var(--amber-dim); border-color: transparent; }
.pill.blue { color: var(--blue); background: var(--blue-dim); border-color: transparent; }
.pill.tester { color: var(--tester); background: var(--tester-dim); border-color: var(--tester-line); }
.pill.gray { color: var(--muted); border-color: var(--border); }
.admin-user-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 4px; min-width: 250px; }
.admin-users-table td:last-child { text-align: right; }
.admin-users-table tr.is-banned { opacity: 0.62; }
.admin-inline-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  gap: 10px;
}
.admin-game-list { display: flex; flex-direction: column; }
.admin-game-row {
  display: grid;
  grid-template-columns: 1.1fr 160px 1fr 110px;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.admin-game-row:last-child { border-bottom: none; padding-bottom: 0; }
.admin-game-name { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.admin-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.admin-action-row:last-child { border-bottom: none; padding-bottom: 0; }
.delete-confirm {
  margin-top: 12px; padding: 14px;
  background: var(--red-dim); border: 1px solid rgba(240, 107, 107, 0.35);
  border-radius: 10px;
}
.delete-confirm p { color: var(--text-2); font-size: 12px; line-height: 1.6; margin-bottom: 12px; }
.delete-confirm p strong { color: var(--red); font-weight: 600; }

/* ---------- game / avatar / executor tags ---------- */
.game-tag { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 12px; white-space: nowrap; }
.game-tag > span { line-height: 1.2; }
.game-ico {
  width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0;
  object-fit: cover; border: 1px solid var(--border); background: var(--surface-3); display: block;
}
.ph-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  object-fit: cover; background: var(--surface-3); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted);
}
.ph-avatar.lg { width: 30px; height: 30px; }
.ph-avatar.xl { width: 38px; height: 38px; }
.ph-avatar svg { width: 14px; height: 14px; }
.exec-tag {
  display: inline-block; font-family: var(--mono); font-size: 11px; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px;
  padding: 3px 8px; line-height: 1.2; white-space: nowrap;
}

/* ---------- public hits ---------- */
.public-table th:last-child { width: 88px; }
.ph-row { cursor: pointer; transition: background 0.14s var(--ease); }
.ph-row:hover { background: var(--surface-2); }
.ph-row.mine td:first-child { box-shadow: inset 2px 0 0 var(--text-2); }
.ph-view-cell { text-align: right; }
.ph-view-cell .btn { height: 26px; padding: 0 10px; }
.ph-drop { display: flex; align-items: center; gap: 4px; min-width: 0; }
.ph-drop-item {
  display: inline-flex; align-items: center; gap: 5px;
  min-width: 0; max-width: 138px; padding: 3px 5px 3px 3px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px;
  line-height: 1.15;
}
.ph-drop-img {
  width: 22px; height: 22px; border-radius: 5px; flex-shrink: 0;
  background: var(--surface-3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.ph-drop-img img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.ph-drop-img .hit-item-fallback svg { width: 13px; height: 13px; }
.ph-drop-copy { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.ph-drop-name {
  max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 10px; color: var(--text-2);
}
.ph-drop-val { font-family: var(--mono); font-size: 9px; color: var(--green); white-space: nowrap; }
.ph-drop-more {
  flex-shrink: 0; font-family: var(--mono); font-size: 10px; color: var(--muted);
  padding: 0 3px;
}
.ph-drop-empty { color: var(--muted); }
.your-hit-flag {
  display: inline-block; font-size: 10px; font-weight: 500; letter-spacing: 0.02em;
  color: var(--text); background: var(--surface-3); border: 1px solid var(--border-hi);
  border-radius: 4px; padding: 1px 5px; line-height: 1.4; white-space: nowrap;
}

/* ---------- first-visit notice ---------- */
.notice {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px; margin-bottom: 16px;
  background: var(--surface-2); border: 1px solid var(--border-hi); border-radius: var(--radius);
}
.notice-mark {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); border: 1px solid var(--border); color: var(--text-2);
}
.notice-mark svg { width: 17px; height: 17px; display: block; }
.notice-copy { flex: 1; min-width: 0; }
.notice-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.notice-text { font-size: 12px; color: var(--muted); line-height: 1.45; }
.notice-text b { color: var(--text-2); font-weight: 500; }
.notice-close {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 13px; line-height: 1; padding: 5px; border-radius: 6px; flex-shrink: 0;
}
.notice-close:hover { background: var(--surface-3); color: var(--text); }

/* ---------- toggle ---------- */
.toggle {
  appearance: none; padding: 0; cursor: pointer; flex-shrink: 0;
  width: 42px; height: 24px; border-radius: 999px; position: relative;
  background: var(--surface-3); border: 1px solid var(--border-hi);
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.toggle .toggle-knob {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--text-2); transition: transform 0.18s var(--ease), background 0.18s var(--ease);
}
.toggle.on { background: rgba(52, 211, 153, 0.14); border-color: var(--green); }
.toggle.on .toggle-knob { transform: translateX(18px); background: var(--green); }

/* ---------- settings rows ---------- */
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 14px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.setting-title { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 3px; }
.setting-sub { font-size: 12px; color: var(--muted); line-height: 1.45; max-width: 560px; }
.setting-foot { font-size: 11px; color: var(--muted); margin-top: 10px; }

/* ---------- hit modal inventory ---------- */
.hit-inv { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.hit-item {
  display: flex; align-items: center; gap: 10px;
  min-width: 190px; max-width: 250px; flex: 1;
  padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.hit-item-empty { color: var(--muted); font-size: 12px; justify-content: center; min-width: 100%; }
.hit-item-img {
  width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0;
  background: var(--surface-3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.hit-item-img img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.hit-item-fallback { color: var(--muted); display: flex; }
.hit-item-fallback svg { width: 20px; height: 20px; }
.hit-item-name {
  font-size: 12px; font-weight: 500; color: var(--text); line-height: 1.25; margin-bottom: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hit-item-val { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.hit-item-val b { color: var(--green); font-weight: 500; }
.hit-more {
  display: flex; align-items: center; justify-content: center;
  min-width: 84px; padding: 8px 10px; border-radius: 10px;
  border: 1px dashed var(--border-hi); color: var(--muted); font-size: 11px; font-family: var(--mono);
}
.hit-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.hit-meta > div { background: var(--surface-2); padding: 10px 12px; }
.hit-meta span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px; }
.hit-meta b { font-size: 12px; font-weight: 500; color: var(--text); font-family: var(--mono); word-break: break-all; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-2-1, .grid-1-2, .grid-3 { grid-template-columns: 1fr; }
  .hd-search { width: 180px; }
  .redeem-presets { grid-template-columns: repeat(3, 1fr); }
  .redeem-custom { grid-template-columns: 1fr; }
  .redeem-summary { justify-content: space-between; }
  .admin-game-row { grid-template-columns: 1fr 1fr; }
  .admin-game-name { grid-column: 1 / -1; }
  .admin-inline-form { grid-template-columns: 1fr 1fr; }
  .admin-inline-form .btn { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 640px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stat-grid { grid-template-columns: 1fr; }
  .main { padding: 16px; }
  .notice { flex-wrap: wrap; gap: 10px 12px; }
  .notice-copy { flex-basis: calc(100% - 46px); }
  .notice .toggle { margin-left: 46px; }
  .notice-close { position: absolute; top: 10px; right: 12px; }
  .setting-row { align-items: flex-start; }
  .hit-item { min-width: 100%; max-width: none; }
  .hit-meta { grid-template-columns: 1fr 1fr; }
  .redeem-presets { grid-template-columns: repeat(2, 1fr); }
  .redeem-summary { align-items: flex-start; }
  .redeem-history-row { align-items: flex-start; }
  .activity-grid { grid-template-columns: 1fr; }
  .recent-script { align-items: flex-start; flex-direction: column; gap: 8px; }
  .recent-script-meta { flex-wrap: wrap; }
  .status-legend-row { align-items: flex-start; }
  .status-legend-row .badge { min-width: 76px; }
  .page-tab { padding: 0 9px; }
  .admin-inline-form { grid-template-columns: 1fr; }
  .admin-game-row { grid-template-columns: 1fr; }
  .admin-game-name { grid-column: auto; }
  .admin-action-row { align-items: flex-start; flex-direction: column; gap: 10px; }
  .admin-list-row { align-items: flex-start; flex-direction: column; gap: 6px; }
  .admin-user-actions { justify-content: flex-start; min-width: 0; }
  .admin-toolbar { align-items: flex-start; }
}

/* ---------- canvas chart ---------- */
.chart-card { position: relative; }
.chart-card canvas { width: 100%; height: 200px; display: block; }

/* ---------- misc ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.text-mono { font-family: var(--mono); }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.fw-600 { font-weight: 600; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* card hover */
.card { transition: border-color 0.15s var(--ease); }
.card:hover { border-color: var(--border-hi); }

/* live pulse */
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(62,207,142,0.5); }
  70% { box-shadow: 0 0 0 6px rgba(62,207,142,0); }
  100% { box-shadow: 0 0 0 0 rgba(62,207,142,0); }
}
.badge.live .dot { animation: pulse 2.4s var(--ease) infinite; }

/* focus ring */
.input:focus, .btn:focus-visible, .sb-item:focus-visible,
.chip:focus-visible, .toggle:focus-visible, .redeem-option:focus-visible {
  outline: 2px solid var(--border-strong);
  outline-offset: 1px;
}

/* sidebar collapsed item centering */
.app.sidebar-collapsed .sb-item { justify-content: center; padding: 0; }
.app.sidebar-collapsed .sb-item .badge { display: none; }

/* smoother number rendering */
.stat .value, td.num { font-variant-numeric: tabular-nums; }

/* ---------- finish ---------- */
::selection { background: rgba(113, 255, 158, 0.18); color: var(--text); }
html { color-scheme: dark; }

/* ---------- lower mode ----------
   Everything here is intentionally blunt: kill motion, blur and glow so
   low-end devices have less compositing work to do. Layout never changes. */
html.low-mode *,
html.low-mode *::before,
html.low-mode *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
html.low-mode .main { scroll-behavior: auto; }
html.low-mode .modal-backdrop {
  backdrop-filter: none;
  background: rgba(0, 0, 0, 0.78);
}
html.low-mode .toast,
html.low-mode .modal,
html.low-mode .card,
html.low-mode .stat { box-shadow: none !important; }
html.low-mode .ref-glow,
html.low-mode .hd-icon-btn .dot { display: none; }
html.low-mode .card:hover,
html.low-mode .stat:hover { transform: none; background: var(--surface); }
html.low-mode .badge.live .dot { box-shadow: none; }



/* ---------- mobile layout ---------- */
.hd-menu { display: none; }
.sb-backdrop { display: none; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; height: 100vh; height: 100dvh; }
  .app.sidebar-collapsed { grid-template-columns: 1fr; }
  .header { grid-column: 1; padding: 0 14px; gap: 10px; }
  .main { grid-column: 1; padding: 18px 14px 44px; }
  .sidebar {
    display: flex;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 268px;
    max-width: 86vw;
    transform: translateX(-102%);
    transition: transform 0.22s var(--ease);
    z-index: 60;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.55);
  }
  .app.sb-open .sidebar { transform: translateX(0); }
  .sb-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s var(--ease);
    z-index: 55;
  }
  .app.sb-open .sb-backdrop { opacity: 1; pointer-events: auto; }
  .hd-menu { display: inline-flex; }
  .sb-toggle { display: none; }
  .hd-search { display: none; }
  .page-head h1 { font-size: 24px; }
}

@media (max-width: 640px) {
  .main { padding: 14px 12px 40px; }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 22px; }
  .stat-value { font-size: 22px; }
  .modal { width: calc(100vw - 20px); padding: 16px; max-height: 86vh; max-height: 86dvh; }
  .modal-backdrop { padding: 10px; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 auto; justify-content: center; }
  thead th, tbody td { padding-left: 10px; padding-right: 10px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .page-tabs { margin-left: -2px; margin-right: -2px; }
}

/* ---------- login gate ---------- */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(600px 320px at 50% -10%, rgba(255, 255, 255, 0.06), transparent 70%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 30px 26px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}
.login-logo {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card h1 { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.login-card p { color: var(--muted); font-size: 13px; line-height: 1.55; margin-bottom: 18px; }
.login-btn { width: 100%; justify-content: center; }
.login-foot { margin-top: 14px; font-size: 11px; color: var(--muted); }
.login-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #f87171;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 12px;
}
.sb-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

/* ---------- server icon ---------- */
.sb-logo { padding: 0; overflow: hidden; background: var(--surface-2); }
.sb-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.login-logo {
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  border-radius: 15px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border-hi);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.55);
}
.login-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- liveliness ---------- */
.card { transition: transform 0.18s var(--ease-out), border-color 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out); }
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28); }
.btn { transition: transform 0.15s var(--ease-out), background 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.sb-item { transition: background 0.16s var(--ease-out), color 0.16s var(--ease-out), transform 0.16s var(--ease-out); }
.sb-item:hover { transform: translateX(2px); }
tbody tr { transition: background 0.14s var(--ease-out); }
.page.active { animation: fadeUp 0.3s var(--ease-out); }
.page.active .grid-2 > .card,
.page.active .grid-2-1 > .card,
.page.active .grid-1-2 > .card { animation: cardRise 0.32s var(--ease-out) backwards; }
.page.active .grid-2 > .card:nth-child(2),
.page.active .grid-2-1 > .card:nth-child(2),
.page.active .grid-1-2 > .card:nth-child(2) { animation-delay: 0.045s; }
.page.active .grid-2 > .card:nth-child(3),
.page.active .grid-2-1 > .card:nth-child(3),
.page.active .grid-1-2 > .card:nth-child(3) { animation-delay: 0.09s; }

/* login ambience */
.login-screen::before {
  content: "";
  position: absolute;
  inset: -25%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.07), transparent 70%);
  animation: ambient 16s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes ambient {
  from { transform: translate3d(-3%, -2%, 0) scale(1); opacity: 0.65; }
  to { transform: translate3d(3%, 2%, 0) scale(1.1); opacity: 1; }
}
.login-card { position: relative; z-index: 1; animation: scaleIn 0.35s var(--ease-out); }
html.low-mode .login-screen::before { display: none; }

/* page-level search icons (SVG inserted without width/height) */
.hd-search svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ---------- sidebar performance mode ---------- */
.sb-perf {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 10px 0;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-2);
  text-align: left;
  width: calc(100% - 20px);
  transition: background 0.16s var(--ease-out), border-color 0.16s var(--ease-out);
}
.sb-perf:hover { background: var(--surface-3); border-color: var(--border-hi); }
.sb-perf-icon { color: var(--muted); display: flex; align-items: center; }
.sb-perf-icon svg { width: 18px; height: 18px; }
.sb-perf-copy { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sb-perf-copy .t { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; }
.sb-perf-copy .s { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.sb-perf .toggle { margin-left: auto; flex-shrink: 0; }
.app.sidebar-collapsed .sb-perf { display: none; }

/* ---------- loading skeletons ---------- */
.skel { background: var(--surface-2); border-radius: 6px; position: relative; overflow: hidden; }
.skel::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  animation: shimmer 1.25s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skel-title { width: 210px; max-width: 60%; height: 26px; margin-bottom: 10px; }
.skel-sub { width: 380px; max-width: 80%; height: 12px; margin-bottom: 20px; }
.skel-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.skel-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.skel-line { height: 12px; }
.skel-line.lg { height: 22px; }
.w10 { width: 10%; } .w15 { width: 15%; } .w25 { width: 25%; } .w30 { width: 30%; } .w40 { width: 40%; } .w60 { width: 60%; }
.skel-table { padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.skel-tr { display: flex; align-items: center; gap: 12px; }
.skel-circle { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; }
@media (max-width: 960px) { .skel-row { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .skel-row { grid-template-columns: 1fr; } }
html.low-mode .skel::after { animation: none; }

/* ---------- view transitions ---------- */
::view-transition-old(root) { animation: vtOut 0.18s var(--ease-out) both; }
::view-transition-new(root) { animation: vtIn 0.22s var(--ease-out) both; }
@keyframes vtOut { to { opacity: 0; transform: translateY(-4px); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(6px); } }
html.low-mode ::view-transition-old(root),
html.low-mode ::view-transition-new(root) { animation: none; }


/* compact performance toggle */
.sb-perf {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin: 8px 12px 0; padding: 0;
  background: none; border: none; border-radius: 0; width: auto;
  text-align: left;
}
.sb-perf:hover { background: none; border: none; }
.sb-perf-label { font-size: 11px; color: var(--muted); letter-spacing: 0.01em; }
.toggle.sm { width: 30px; height: 18px; }
.toggle.sm .toggle-knob { width: 12px; height: 12px; top: 2px; left: 2px; }
.toggle.sm.on .toggle-knob { transform: translateX(12px); }

/* skeleton entrance */
.skel-page { animation: skelIn 0.3s var(--ease-out) both; }
@keyframes skelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.skel-row > .skel-card { animation: skelRise 0.42s var(--ease-out) both; }
.skel-row > .skel-card:nth-child(2) { animation-delay: 0.05s; }
.skel-row > .skel-card:nth-child(3) { animation-delay: 0.1s; }
.skel-row > .skel-card:nth-child(4) { animation-delay: 0.15s; }
.skel-table { animation: skelRise 0.45s var(--ease-out) 0.1s both; }
.skel-tr { animation: skelRise 0.4s var(--ease-out) both; }
.skel-tr:nth-child(1) { animation-delay: 0.16s; }
.skel-tr:nth-child(2) { animation-delay: 0.2s; }
.skel-tr:nth-child(3) { animation-delay: 0.24s; }
.skel-tr:nth-child(4) { animation-delay: 0.28s; }
.skel-tr:nth-child(5) { animation-delay: 0.32s; }
@keyframes skelRise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
html.low-mode .skel-page, html.low-mode .skel-row > .skel-card,
html.low-mode .skel-table, html.low-mode .skel-tr { animation: none; }

/* smooth skeletons: one gentle pulse, single page entrance */
.skel { animation: skelPulse 1.8s ease-in-out infinite; }
.skel::after { display: none; }
@keyframes skelPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.skel-page { animation: skelIn 0.38s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
.skel-row > .skel-card, .skel-table, .skel-tr { animation: none; }

/* visuals admin: code box */
.vis-code { min-height: 180px; font-family: var(--mono); font-size: 12px; line-height: 1.5; resize: vertical; }

/* blacklisted screen */
.login-card.blocked { border-color: rgba(248, 113, 113, 0.35); }
.login-card.blocked h1 { color: #f87171; }

/* admin feed creator */
.feed-results { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.feed-results:empty { display: none; }
.feed-result { max-width: 100%; }
.feed-selected { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.feed-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-size: 12px; color: var(--text-2); }
.feed-chip b { color: var(--green); font-weight: 500; }
.feed-chip .btn { height: 18px; min-height: 0; padding: 0 5px; font-size: 14px; line-height: 1; }