:root {
  --bg: #0f1115;
  --panel: #171a21;
  --line: #262b36;
  --text: #e6e8ee;
  --muted: #8a92a6;
  --accent: #c0392b;
  --ok: #2e9d5b;
  --warn: #d39b1f;
  --bad: #d64545;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: #e57b6f; }
h1, h2, h3 { margin: 0 0 12px; font-weight: 600; }
h1 { font-size: 20px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
.loading { padding: 40px; color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { background: #0c0e12; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; min-width: 0; }
textarea { width: 100%; min-height: 70px; }
button { background: #232834; border: 1px solid #323848; border-radius: 6px; padding: 7px 12px; cursor: pointer; }
button:hover { background: #2b3140; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { border-color: var(--bad); color: #ffb3b3; }
button.small { padding: 3px 8px; font-size: 12px; }
button:disabled { opacity: .5; cursor: default; }

/* login */
.auth { max-width: 380px; margin: 9vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; }
.auth h1 span { color: var(--accent); }
.auth form, .form { display: grid; gap: 10px; }
.auth label, .form label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.auth .qr { display: block; margin: 8px auto; image-rendering: pixelated; background: #fff; border-radius: 6px; }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.secret { word-break: break-all; background: #0c0e12; padding: 6px 8px; border-radius: 6px; display: block; }
.err { color: #ff8a8a; min-height: 1.2em; margin: 0; }
.ok-msg { color: #7fe0a4; }
.muted { color: var(--muted); }

/* layout */
.shell { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
nav { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; }
nav .brand { font-weight: 700; padding: 4px 10px 16px; }
nav .brand span { color: var(--accent); }
nav button { background: none; border: 0; text-align: left; padding: 8px 10px; border-radius: 6px; }
nav button.on { background: #262b36; }
nav .who { margin-top: auto; padding: 10px; color: var(--muted); font-size: 12px; }
main { padding: 22px 26px; overflow: auto; }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.bar .grow { flex: 1; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.card .v { font-size: 22px; font-weight: 700; }
.card .k { color: var(--muted); font-size: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 14px; margin-bottom: 18px; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; overflow: auto; }
.chart { width: 100%; height: 120px; }
.chart rect { fill: var(--accent); }
.chart rect.alt { fill: #3d7bd9; }
.chart text { fill: var(--muted); font-size: 9px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; cursor: default; }
th.sort { cursor: pointer; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #1c2029; }
td.wrap { word-break: break-word; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 99px; font-size: 11px; background: #2a3040; margin: 0 3px 2px 0; white-space: nowrap; }
.tag.ok { background: #183d28; color: #8de0ae; }
.tag.warn { background: #43361a; color: #f1cf7c; }
.tag.bad { background: #4a1f1f; color: #ffb0b0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 5px; }

dl.facts { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; margin: 0 0 14px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; word-break: break-word; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 16px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.sponsors { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.sponsors img { width: 100%; max-height: 120px; object-fit: contain; background: #000; border-radius: 6px; }
.progress { height: 6px; background: #262b36; border-radius: 3px; overflow: hidden; margin: 6px 0; }
.progress i { display: block; height: 100%; background: var(--ok); }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 20px; width: min(420px, 92vw); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  nav { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  nav .who { margin: 0; }
  main { padding: 14px; }
  .split { grid-template-columns: 1fr; }
  dl.facts { grid-template-columns: 120px 1fr; }
}
