:root {
  --bg: #0f1014;
  --panel: #17181e;
  --panel-2: #1e2028;
  --line: #2a2d38;
  --text: #e8e9ee;
  --muted: #9195a3;
  --accent: #ff4fa3;
  --accent-2: #ff7dbd;
  --ok: #3ba55d;
  --warn: #f0a020;
  --bad: #ed4245;
  --info: #5865f2;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 12.5px; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 4px 10px 18px; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.nav-group { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; color: var(--text); margin-bottom: 2px;
}
.nav a:hover { background: var(--panel-2); text-decoration: none; }
.nav a.on { background: rgba(255, 79, 163, .14); color: var(--accent-2); }
.nav .ico { width: 18px; text-align: center; }
.nav .pill { margin-left: auto; background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; }
.main { padding: 22px 28px 60px; min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.top h1 { font-size: 22px; margin: 0; flex: 1; }
.me { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.me img { width: 28px; height: 28px; border-radius: 50%; }
.lang a { color: var(--muted); padding: 2px 6px; border-radius: 6px; }
.lang a.on { color: var(--text); background: var(--panel-2); }

/* ---------- Blocks ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.card h2 { font-size: 15px; margin: 0 0 12px; }
.card h3 { font-size: 13px; margin: 14px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
a.kpi { color: var(--text); text-decoration: none; }
a.kpi:hover { border-color: var(--muted); }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: 12px; }
.kpi.alert { border-color: var(--bad); }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.help { color: var(--muted); font-size: 12.5px; margin: 4px 0 0; }
.chart-box { position: relative; height: 240px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
tr:hover td { background: rgba(255, 255, 255, .015); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.flag td { background: rgba(237, 66, 69, .08); }

/* ---------- Badges ---------- */
.b { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.b.ok, .b.delivered, .b.active, .b.undetected, .b.available, .b.open { background: rgba(59, 165, 93, .16); color: #6fd391; }
.b.warn, .b.pending, .b.paid, .b.updating { background: rgba(240, 160, 32, .16); color: #ffc15c; }
.b.bad, .b.down, .b.expired, .b.cancelled, .b.failed, .b.refunded, .b.revoked, .b.suspended, .b.sold { background: rgba(237, 66, 69, .16); color: #ff8587; }
.b.info, .b.panel { background: rgba(88, 101, 242, .18); color: #9ea7ff; }
.b.discord { background: rgba(255, 79, 163, .14); color: var(--accent-2); }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 5px; }
label.inline { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; margin: 6px 14px 6px 0; }
input[type=text], input[type=number], input[type=url], input:not([type]), select, textarea {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(255, 79, 163, .45); border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }
input[type=color] { width: 54px; height: 36px; padding: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
select[multiple] { min-height: 130px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  padding: 7px 14px; border-radius: 8px; font: inherit; font-weight: 600;
}
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: transparent; border-color: var(--bad); color: #ff8587; }
.btn.danger:hover { background: var(--bad); color: #fff; }
.btn.sm { padding: 3px 10px; font-size: 12.5px; }
form.inline { display: inline; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Flash, misc ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 600; }
.flash.ok { background: rgba(59, 165, 93, .16); color: #8fe0a8; border: 1px solid rgba(59, 165, 93, .4); }
.flash.error { background: rgba(237, 66, 69, .14); color: #ff9b9d; border: 1px solid rgba(237, 66, 69, .4); }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.avatar { width: 22px; height: 22px; border-radius: 50%; vertical-align: middle; }
.details { max-width: 420px; color: var(--muted); font-size: 12px; word-break: break-word; }
.tag { display: inline-block; padding: 1px 8px; margin: 2px 4px 2px 0; border-radius: 6px; font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }
.msg { padding: 8px 0; border-bottom: 1px solid var(--line); }
.msg .who { font-weight: 700; }
.msg .who.staff { color: var(--accent-2); }
.msg .when { color: var(--muted); font-size: 12px; margin-left: 8px; }
.msg .body { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.msg .emb { border-left: 3px solid var(--accent); padding: 4px 10px; margin-top: 4px; background: var(--panel-2); border-radius: 4px; white-space: pre-wrap; color: var(--muted); }
.key-list { max-height: 420px; overflow-y: auto; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 34px; width: 100%; max-width: 380px; text-align: center; }
.login .btn { width: 100%; justify-content: center; padding: 11px; background: #5865f2; border-color: #5865f2; color: #fff; }

/* ---------- Phone ---------- */
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 16px; }
  .side .nav { display: none; }
  .side.open .nav { display: block; }
  .menu-toggle { display: inline-flex; margin-left: auto; }
  .brand { padding: 4px 0; }
  .main { padding: 16px; }
  .g2, .g3, .form-grid { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .value { font-size: 19px; }
}
