/* ============================================================
   Painel — estilos (sem build). Cores vêm do tema ativo
   (tabela themes → variáveis CSS injetadas no <html>).
   ============================================================ */
:root {
  --bg: #0b0d12;
  --surface: #12151c;
  --surface-2: #181c25;
  --border: rgba(255, 255, 255, 0.07);
  --text: #e8eaf0;
  --muted: #8a90a2;
  --accent: #c8a45c;
  --accent-2: #e6cf98;
  --success: #3ecf8e;
  --danger: #f2626b;
  --warning: #f0b44c;
  --radius: 14px;
  --sidebar: 252px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 85% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, color-mix(in srgb, var(--accent) 5%, transparent), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 22px 14px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #14110a; font-weight: 800; font-size: 15px;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent);
}
.brand-name { font-weight: 650; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.nav-label { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 16px 12px 6px; opacity: .7; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px; color: var(--muted);
  transition: background .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { color: var(--text); background: rgba(255,255,255,.04); }
.nav a.active {
  color: var(--text);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 16%, transparent), transparent);
  box-shadow: inset 2px 0 0 var(--accent);
}
.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; color: var(--accent-2);
}
.sidebar-foot .who { min-width: 0; flex: 1; }
.sidebar-foot .who b { display: block; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who span { font-size: 12px; color: var(--muted); }

.main { min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 60px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.topbar h1 { font-size: 24px; }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Cards / grids ---------- */
.card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 92%, transparent), color-mix(in srgb, var(--surface) 92%, transparent));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 20px 40px -24px rgba(0,0,0,.6);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2 { font-size: 15px; }
.card-head small { color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: grid; gap: 16px; }
.mt { margin-top: 16px; }

.stat { position: relative; overflow: hidden; }
.stat .label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.stat .value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 12px; margin-top: 4px; color: var(--muted); }
.stat .delta.up { color: var(--success); }
.stat .delta.down { color: var(--danger); }
.stat::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%);
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--accent); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px -20px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 20px; text-align: left; white-space: nowrap; }
th { font-size: 11.5px; font-weight: 550; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); }
td { border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
tbody tr { transition: background .12s; }
tbody tr:hover { background: rgba(255,255,255,.025); }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.pos { color: var(--success); }
.neg { color: var(--danger); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 550;
  background: rgba(255,255,255,.06); color: var(--muted); border: 1px solid var(--border);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--success); background: color-mix(in srgb, var(--success) 10%, transparent); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.badge.bad { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.badge.warn { color: var(--warning); background: color-mix(in srgb, var(--warning) 10%, transparent); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.badge.gold { color: var(--accent-2); background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.badge.plain::before { display: none; }

/* ---------- Forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 550; cursor: pointer;
  transition: transform .08s, background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  border-color: transparent; color: #17130b;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px -10px color-mix(in srgb, var(--accent) 70%, transparent);
}
.btn-primary:hover { box-shadow: 0 10px 28px -8px color-mix(in srgb, var(--accent) 80%, transparent); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; opacity: .8; }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 70%, transparent); color: var(--text);
  border: 1px solid var(--border); font: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; color: var(--text); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.error { color: var(--danger); font-size: 12.5px; margin-top: 5px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters .input { width: auto; min-width: 160px; height: 36px; }

/* ---------- Flash / secrets ---------- */
.flash {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; margin-bottom: 18px;
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
  background: color-mix(in srgb, var(--success) 9%, transparent);
}
.flash.err { border-color: color-mix(in srgb, var(--danger) 30%, transparent); background: color-mix(in srgb, var(--danger) 9%, transparent); }
.secret-box { border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.secret-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.secret-row:last-child { border-bottom: 0; }
.secret-row code { word-break: break-all; color: var(--accent-2); }

/* ---------- Chart ---------- */
.chart { width: 100%; height: 240px; display: block; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Game grid ---------- */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.game-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.game-cover {
  aspect-ratio: 16 / 10; display: grid; place-items: center; font-size: 42px; position: relative;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--surface-2)), var(--surface));
  background-size: cover; background-position: center center;
}
.game-cover .badge { position: absolute; top: 10px; left: 10px; }
.game-body { padding: 14px 16px 16px; display: grid; gap: 6px; }
.game-body b { font-weight: 600; }
.game-meta { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12.5px; }

/* ---------- Pagination ---------- */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px 0; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.pager .links { display: flex; gap: 6px; }

/* ---------- Tabs ---------- */
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); margin-bottom: 16px; }
.tabs a { padding: 7px 14px; border-radius: 9px; color: var(--muted); font-weight: 500; }
.tabs a.active { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.05) inset; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; padding: 34px 30px; }
.auth-card .brand { justify-content: center; padding-bottom: 26px; }
.auth-card h1 { font-size: 20px; text-align: center; }
.auth-card p.lead { text-align: center; color: var(--muted); margin: 6px 0 26px; }

/* ---------- Theme swatches ---------- */
.theme-option { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 12px; border: 1px solid var(--border); }
.theme-option.active { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.swatch { display: flex; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); flex: none; }
.swatch span { width: 18px; height: 34px; }

/* ---------- Mobile ---------- */
.menu-toggle { display: none; }
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(280px, 85vw); z-index: 40;
    transform: translateX(-100%); transition: transform .2s ease;
    padding-top: calc(22px + env(safe-area-inset-top, 0px));
  }
  body.nav-open .sidebar { transform: none; box-shadow: 30px 0 60px rgba(0,0,0,.5); }
  .menu-toggle { display: inline-flex; }
  .grid-3, .grid-2, .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: 1fr; }
  .stat .value { font-size: 22px; }
}
