:root {
  --bg: #070b14;
  --side: #0b1020;
  --card: #121a2d;
  --line: rgba(255, 255, 255, 0.06);
  --text: #e8eefc;
  --muted: #8b97b3;
  --orange: #ff7a18;
  --green: #3dd68c;
  --red: #ff5d73;
  --blue: #3b82f6;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: inherit; }
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 28px;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
}
.sidebar nav { display: flex; flex-direction: column; gap: 6px; }
.sidebar nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 11px 12px;
  border-radius: 10px;
}
.sidebar nav a.active,
.sidebar nav a:hover {
  background: #17315f;
  color: #fff;
}
.side-logout {
  margin-top: auto;
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
}
.main { flex: 1; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 28px 0;
}
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: 0.04em; }
.who { color: var(--muted); font-size: 14px; }
.content { padding: 22px 28px 40px; }
.flash {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: #132033;
}
.flash.ok { color: var(--green); }
.flash.bad { color: var(--red); }
.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 18px 16px;
  min-height: 132px;
  text-decoration: none;
  display: block;
}
.stat-value {
  color: var(--orange);
  font-size: 28px;
  font-weight: 800;
}
.stat-value.light { color: #fff; font-size: 30px; }
.stat-label {
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}
.stat-sub { color: #9aa6c3; font-size: 13px; margin-top: 6px; }
.status-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.pill {
  border-radius: 999px;
  padding: 8px 12px;
  background: #121a2d;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.pill.on { color: var(--green); }
.pill.off { color: var(--red); }
.table-card, .form-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-top: 18px;
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: 0.04em; }
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  background: #1c2740;
}
.badge.ok { color: var(--green); }
.badge.bad { color: var(--red); }
.badge.custom { color: var(--orange); }
label { display: block; color: var(--muted); font-size: 13px; margin: 12px 0 6px; }
input, select, textarea {
  width: 100%;
  background: #0c1322;
  color: var(--text);
  border: 1px solid #24324d;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}
input[type="checkbox"] { width: auto; }
textarea { min-height: 80px; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
button, .button {
  background: var(--blue);
  color: white;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.ghost, .button.ghost { background: #24324d; }
button.warn { background: #7f1d1d; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.filters a, .filters span {
  color: var(--muted);
  text-decoration: none;
  background: #121a2d;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
}
.filters a.on { color: white; background: #17315f; }
.pager { display: flex; gap: 12px; margin-top: 14px; }
.guest { min-height: 100vh; display: grid; place-items: center; }
.login-card {
  width: min(420px, calc(100% - 32px));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
}
.login-card h1 { margin: 0 0 8px; }
.muted { color: var(--muted); }
.internal {
  white-space: pre-wrap;
  color: #c5d0e6;
  font-size: 12px;
  max-width: 360px;
}
.section-title { margin: 22px 0 8px; font-size: 16px; }
@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .shell { display: block; }
  .sidebar { width: auto; height: auto; position: static; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .side-logout { margin-top: 12px; }
  .cards, .row { grid-template-columns: 1fr; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
}
