:root {
  --pine: #2e1f8f;
  --pine-2: #5b3fd9;
  --mint: #5b3fd9;
  --gold: #ffc53d;
  --bg: #f4f4fb;
  --card: #ffffff;
  --ink: #1b1a3a;
  --muted: #66698a;
  --line: #e6e6f3;
  --red: #c81e5b;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--pine-2); }
code { background: #eeeef8; padding: 1px 5px; border-radius: 4px; }
code.big { font-size: 1.3em; letter-spacing: .05em; }

.shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.side { background: linear-gradient(170deg, #2e1f8f, #5b3fd9 70%, #8b3fe8); color: #e8f1ef; padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 700; }
.brand small { display: block; font-weight: 400; font-size: 12px; opacity: .75; }
.mark { width: 38px; height: 38px; border-radius: 11px; background: var(--gold); color: var(--pine); display: grid; place-items: center; font-size: 22px; font-weight: 700; flex: none; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a { color: #cfe0dd; text-decoration: none; padding: 9px 12px; border-radius: 9px; }
.side nav a:hover { background: rgba(255,255,255,.08); }
.side nav a.on { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.who { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.who .link { color: var(--gold); }

.main { padding: 26px 30px 60px; max-width: 1180px; width: 100%; }
h1 { margin: 0 0 18px; font-size: 25px; }
h2 { margin: 0 0 10px; font-size: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.card.danger { border-color: #f4c5d6; }
.muted { color: var(--muted); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat strong { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }

.bars { width: 100%; height: auto; display: block; }
.bar { fill: var(--mint); }
.bar.zero { fill: var(--line); }

.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); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:last-child td { border-bottom: 0; }

.tag { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 99px; padding: 1px 9px; }
.tag.active { background: #dff6ec; color: #0b6e54; }
.tag.blocked { background: #fde8ef; color: var(--red); }

.btn { display: inline-block; background: var(--pine); color: #fff; border: 1px solid var(--pine); border-radius: 9px; padding: 8px 15px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--pine-2); }
.btn.ghost { background: transparent; color: var(--pine); }
.btn.ghost:hover { background: #eeeef8; }
.btn.red { background: var(--red); border-color: var(--red); }
.link { background: none; border: 0; padding: 0; color: var(--pine-2); font: inherit; text-decoration: underline; cursor: pointer; }

input, select, textarea { font: inherit; color: inherit; background: #fff; border: 1px solid #c4c5dc; border-radius: 9px; padding: 8px 11px; width: 100%; }
input[type=checkbox] { width: auto; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--mint); outline-offset: 1px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
.stack label.check { flex-direction: row; align-items: center; gap: 8px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters input { flex: 1 1 220px; width: auto; }
.filters select { flex: 0 1 170px; width: auto; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 0; }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.flash { border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.flash.ok { background: #dff6ec; color: #0a5a45; }
.flash.err { background: #fde8ef; color: #8b1a39; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs a { padding: 6px 14px; border-radius: 99px; text-decoration: none; background: #e9e9f5; color: var(--ink); }
.tabs a.on { background: var(--pine); color: #fff; }
.pager { display: flex; gap: 14px; align-items: center; justify-content: flex-end; margin-top: 12px; font-size: 14px; }

body.bare { display: grid; place-items: center; min-height: 100vh; padding: 16px; background: linear-gradient(145deg, #2e1f8f, #5b3fd9 60%, #8b3fe8); }
.auth-card { background: var(--card); border-radius: 18px; padding: 26px; width: 100%; max-width: 390px; }
.auth-card .brand { color: var(--ink); margin-bottom: 18px; }
.auth-card h1 { font-size: 20px; }

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; gap: 12px; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .main { padding: 18px 16px 50px; }
}
