:root {
  --bg: #020b1f;
  --panel: #071833;
  --panel-2: #091f43;
  --text: #d7ebff;
  --muted: #88a6ca;
  --line: #143766;
  --primary: #14d4ff;
  --primary-600: #00aee6;
  --danger: #f43f5e;
  --danger-100: rgba(244, 63, 94, 0.16);
  --ok-100: rgba(52, 211, 153, 0.16);
  --ok-700: #34d399;
  --warn: #fbbf24;
  --shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 10% -10%, rgba(20, 212, 255, 0.18) 0, transparent 35%),
    radial-gradient(circle at 90% -10%, rgba(43, 144, 255, 0.2) 0, transparent 40%),
    radial-gradient(circle at 50% 120%, rgba(14, 165, 233, 0.16) 0, transparent 45%),
    var(--bg);
  font-family: "Manrope", "Segoe UI", sans-serif;
}

.container {
  max-width: 1520px;
  margin: 0 auto;
  padding: 20px 24px 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 14px 22px;
  background: rgba(2, 11, 31, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.scope-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 24, 51, 0.9);
}

.scope-items {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.scope-item {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  color: #9dd6ff;
  background: #04112a;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  background: linear-gradient(120deg, #14d4ff, #3b82f6);
  color: #041127;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  font-size: 12px;
}

.brand-title {
  font-weight: 700;
  font-size: 17px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nav a {
  text-decoration: none;
  color: #9dd6ff;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 10px;
}

.nav a:hover {
  background: rgba(20, 212, 255, 0.15);
}

.hero {
  background: linear-gradient(130deg, rgba(20, 212, 255, 0.11), rgba(14, 34, 68, 0.8));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0 0 4px;
  font-size: 30px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.competition-card {
  border-color: rgba(157, 214, 255, 0.3);
  backdrop-filter: blur(1px);
}

h1, h2 { margin: 0 0 14px; }
p { margin: 0 0 10px; }
a { color: #8ddcff; }
a:hover { color: #bcf1ff; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}

.kpi-title { color: var(--muted); font-size: 13px; }
.kpi-value { font-size: 28px; font-weight: 800; margin-top: 4px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

label.wide { grid-column: 1 / -1; }
.checkbox-line {
  flex-direction: row;
  align-items: center;
  margin-top: 24px;
  font-weight: 700;
}

input, select, textarea, button {
  font: inherit;
}

input, select, textarea {
  width: 100%;
  border: 1px solid #1a457c;
  background: #04112a;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
}

.btn.primary { background: var(--primary); color: #fff; }
.btn.primary { color: #001326; }
.btn.primary:hover { background: var(--primary-600); }
.btn.secondary { background: rgba(20, 212, 255, 0.18); color: #a6ecff; border-color: #1f5f95; }
.btn.ghost { background: #04112a; border-color: var(--line); color: #9fc4e8; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.full { width: 100%; }

.inline-form {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-form.wide { width: 100%; }
.check-inline {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  margin-right: 8px;
}
.check-inline input {
  width: auto;
}
.checks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 12px;
}

.competition-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.chip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: #a8d8ff;
  background: #04112a;
  font-weight: 700;
}
.chip-btn.active {
  background: rgba(20, 212, 255, 0.2);
  border-color: #1f5f95;
  color: #cbf4ff;
}

#usersStatsChart {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(4, 17, 42, 0.75);
  margin-bottom: 12px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th, td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #8cc8ff;
}

.row-ok { background: var(--ok-100); }
.row-bad { background: var(--danger-100); }
.row-danger { background: rgba(248, 113, 113, 0.14); }

.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}
.status-pill.ok { background: #dcfce7; color: var(--ok-700); }
.status-pill.bad { background: #fee2e2; color: #991b1b; }
.status-pill.bad { background: rgba(244, 63, 94, 0.2); color: #fecdd3; }
.status-pill.warn { background: rgba(251, 191, 36, 0.2); color: #fef3c7; }

.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  display: inline-block;
}
.dot-bordered {
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.toggle-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 700;
}
.toggle-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

td .inline-form input[type="text"] {
  min-width: 320px;
}

.thread {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.msg {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}
.msg-admin {
  background: rgba(20, 212, 255, 0.12);
  border-color: #145085;
}
.msg-user {
  background: #04112a;
}
.msg-head {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.muted { color: var(--muted); }
.mono { font-family: "IBM Plex Mono", monospace; }
.error { color: var(--danger); margin-bottom: 10px; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  width: min(430px, 95vw);
  background: #071833;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 20px;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .container {
    padding: 14px;
  }
}
