:root {
  --bg: #0b1020;
  --bg-2: #121a30;
  --panel: #161f38;
  --panel-2: #1c2743;
  --line: #263252;
  --text: #e7ecf7;
  --muted: #93a1c4;
  --accent: #6ea8fe;
  --accent-2: #b98bff;
  --good: #37d399;
  --warn: #ffce5c;
  --bad: #ff6b81;
  --crit: #ff4d6d;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  font-synthesis-weight: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(110, 168, 254, .12), transparent 60%),
    radial-gradient(1000px 500px at 110% 10%, rgba(185, 139, 255, .12), transparent 55%),
    var(--bg);
  min-height: 100vh;
}

a { color: var(--accent); }

.wrap { max-width: 1200px; margin: 0 auto; padding: 22px clamp(14px, 3vw, 32px) 60px; }

/* ---------- header ---------- */
header.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px;
  padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 22px; box-shadow: var(--shadow);
}
.brand h1 { font-size: 18px; margin: 0; letter-spacing: .2px; }
.brand p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }

.header-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-left: auto; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 12px; font-size: 12.5px; color: var(--muted);
}
.pill b { color: var(--text); font-weight: 600; }
.pill code { color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.dot.live { background: var(--good); box-shadow: 0 0 0 4px rgba(55, 211, 153, .18); }
.dot.off { background: var(--bad); }

button.btn {
  font: inherit; cursor: pointer; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 14px; transition: transform .08s ease, background .15s ease, border-color .15s;
}
button.btn:hover { background: #24325a; border-color: #35477a; }
button.btn:active { transform: translateY(1px); }
button.btn.ghost { background: transparent; }
button.btn.danger { border-color: #5a2740; color: #ffd0d9; background: #2a1626; }
button.btn.danger:hover { background: #3a1c33; }
button.btn.tiny { padding: 4px 9px; font-size: 12px; border-radius: 8px; }

/* ---------- stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 24px; }
.stat {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: .7;
}
.stat .n { font-size: 28px; font-weight: 700; letter-spacing: .5px; }
.stat .l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; margin-top: 2px; }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- tabs ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tab {
  font: inherit; cursor: pointer; color: var(--muted);
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  padding: 9px 15px; font-size: 14px; transition: all .15s;
}
.tab:hover { color: var(--text); background: var(--panel); }
.tab.active {
  color: var(--text); background: var(--panel-2); border-color: var(--line);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.panel { display: none; animation: fade .2s ease; }
.panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.section-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.section-head h2 { font-size: 15px; margin: 0; }
.section-head .hint { font-size: 12.5px; color: var(--muted); }
.section-head .spacer { margin-left: auto; }

/* ---------- bug board ---------- */
.board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1000px) { .board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .board { grid-template-columns: 1fr; } }
.col {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; min-height: 120px;
}
.col h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted);
  margin: 2px 4px 12px; display: flex; justify-content: space-between; align-items: center;
}
.col h3 .count {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 8px; font-size: 11px; color: var(--text);
}
.card {
  background: linear-gradient(180deg, var(--panel-2), #1a2440);
  border: 1px solid var(--line); border-left: 4px solid var(--muted);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 10px;
}
.card.sev-low { border-left-color: var(--muted); }
.card.sev-medium { border-left-color: var(--warn); }
.card.sev-high { border-left-color: var(--bad); }
.card.sev-critical { border-left-color: var(--crit); }
.card .row1 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.card .id { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--muted); }
.card .title { font-size: 13.5px; line-height: 1.35; }
.card .row2 { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.badge {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px;
  padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted);
}
.badge.sev-low { color: #b9c4dd; }
.badge.sev-medium { color: var(--warn); border-color: #4a3f22; background: #241f10; }
.badge.sev-high { color: var(--bad); border-color: #4a2530; background: #26141a; }
.badge.sev-critical { color: #fff; border-color: var(--crit); background: #3a0f1c; }
.avatar {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 10px; font-weight: 700; color: #0b1020;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.avatar.none { background: var(--panel); color: var(--muted); border: 1px dashed var(--line); }
.card .cc { font-size: 11px; color: var(--muted); margin-left: auto; }

/* ---------- users grid ---------- */
.users { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.user {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  display: flex; gap: 12px; align-items: center;
}
.user .avatar { width: 38px; height: 38px; font-size: 14px; }
.user .u-main { min-width: 0; flex: 1; }
.user .u-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.user .u-mail { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user .u-meta { display: flex; gap: 6px; margin-top: 6px; }
.tag {
  font-size: 10px; text-transform: uppercase; letter-spacing: .6px; padding: 2px 7px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
}
.tag.role-admin { color: var(--accent-2); border-color: #3c2e5c; background: #1e1730; }
.tag.role-developer { color: var(--accent); border-color: #26406b; background: #131f38; }
.tag.role-qa { color: var(--good); border-color: #1f4d3d; background: #10241d; }
.tag.on { color: var(--good); }
.tag.off { color: var(--bad); border-color: #4a2530; background: #26141a; }
.u-id { font-family: ui-monospace, Menlo, monospace; font-size: 10.5px; color: var(--muted); }

/* ---------- live log ---------- */
.log { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.log .line {
  display: grid; grid-template-columns: 84px 62px 1fr auto; gap: 12px; align-items: center;
  padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.log .line:last-child { border-bottom: none; }
.m { font-weight: 700; text-align: center; border-radius: 6px; padding: 2px 0; font-size: 11px; }
.m.GET { color: #cfe3ff; background: #14264a; }
.m.POST { color: #d7ffe9; background: #103728; }
.m.PUT { color: #fff0cf; background: #3a2f12; }
.m.PATCH { color: #f0dcff; background: #2c1c44; }
.m.DELETE { color: #ffd7de; background: #3a141f; }
.sc { font-weight: 700; }
.sc.s2 { color: var(--good); }
.sc.s3 { color: var(--accent); }
.sc.s4 { color: var(--warn); }
.sc.s5 { color: var(--bad); }
.log .path { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log .ms { color: var(--muted); }
.log .empty { padding: 24px; text-align: center; color: var(--muted); font-family: inherit; }

/* ---------- challenges ---------- */
.progress-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.progress { flex: 1; height: 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--good), var(--accent)); transition: width .4s ease; }
.progress-num { font-size: 13px; color: var(--muted); min-width: 92px; text-align: right; }

.chgroup { margin-bottom: 20px; }
.chgroup h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent);
  margin: 0 0 10px;
}
.ch {
  display: flex; gap: 12px; padding: 11px 14px; border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 8px; background: var(--panel); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.ch:hover { border-color: #35477a; }
.ch.done { opacity: .55; background: var(--panel-2); }
.ch.done .ch-title { text-decoration: line-through; }
.ch input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--good); flex: none; }
.ch-title { font-size: 13.5px; margin-bottom: 3px; }
.ch-desc { font-size: 12px; color: var(--muted); line-height: 1.45; }
.ch-desc code {
  font-family: ui-monospace, Menlo, monospace; background: var(--bg-2); border: 1px solid var(--line);
  padding: 1px 5px; border-radius: 5px; color: #cfe0ff; font-size: 11.5px;
}

/* ---------- cheat sheet ---------- */
.cheat { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cheat .chl {
  display: grid; grid-template-columns: 74px 1fr auto; gap: 12px; align-items: center;
  padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--panel); font-size: 12.5px;
}
.cheat .chl:last-child { border-bottom: none; }
.cheat .chl.group {
  background: var(--bg-2); color: var(--accent); text-transform: uppercase; letter-spacing: 1px;
  font-size: 11px; grid-template-columns: 1fr;
}
.cheat .ep { font-family: ui-monospace, Menlo, monospace; color: var(--text); }
.cheat .ds { color: var(--muted); font-size: 11.5px; }
@media (max-width: 640px) { .cheat .ds { display: none; } .cheat .chl { grid-template-columns: 74px 1fr; } }

/* ---------- flash on change ---------- */
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(110, 168, 254, .55); }
  100% { box-shadow: 0 0 0 14px rgba(110, 168, 254, 0); }
}
.flash { animation: pulse 1s ease-out; border-color: var(--accent) !important; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 10px 18px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: all .25s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.foot { margin-top: 30px; font-size: 12px; color: var(--muted); text-align: center; }
