:root {
  color-scheme: dark;
  --bg: #0b1020;
  --sidebar: #10182a;
  --surface: #151f33;
  --surface2: #1b2940;
  --border: #263650;
  --text: #edf3fc;
  --muted: #8d9bb2;
  --accent: #35c9b0;
  --blue: #5688ff;
  --danger: #ef6475;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }

button, input { font: inherit; }

.app-layout { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  padding: 26px 18px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 30px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.4px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, #35c9b0, #3979e9);
  display: grid;
  place-items: center;
  color: #071321;
  font-weight: 900;
}

.nav-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.3px;
  padding: 14px 12px 8px;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  margin: 2px 0;
  color: #aab8cd;
  border-radius: 9px;
  transition: .18s;
}

.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: var(--surface2);
}

.nav-link.active {
  box-shadow: inset 3px 0 var(--accent);
}

.nav-icon { width: 20px; text-align: center; }

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 18px 10px 0;
  color: var(--muted);
  font-size: 12px;
}

.main {
  margin-left: 250px;
  padding: 30px 38px;
  max-width: 1700px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
}

.page-title { font-size: 25px; font-weight: 700; letter-spacing: -.7px; }
.page-subtitle { color: var(--muted); margin-top: 4px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 30px;
}

.avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #294c65;
  color: #9ce8dc;
  font-weight: 700;
}

.grid { display: grid; gap: 18px; }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card, .panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card { padding: 20px; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 29px; font-weight: 700; margin-top: 12px; }
.stat-note { color: var(--muted); font-size: 11px; margin-top: 5px; }

.panel { padding: 22px; margin-top: 22px; }
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.panel-title { font-size: 16px; font-weight: 650; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 11px;
  background: #173a36;
  color: #62ddc1;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.muted { color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 15px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #071a20;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--surface2); color: var(--text); }
.btn-danger { background: #482530; color: #ff9ba7; }

table { width: 100%; border-collapse: collapse; }
th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  padding: 12px;
}
td { padding: 14px 12px; border-top: 1px solid var(--border); }
.empty-state { text-align: center; color: var(--muted); padding: 35px 15px; }

.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text);
}

.form-input:focus { outline: 1px solid var(--accent); }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main { padding: 25px; }
}

@media (max-width: 700px) {
  .sidebar { position: static; width: 100%; padding: 12px; }
  .brand { padding: 5px 8px 12px; }
  .sidebar nav { display: flex; overflow-x: auto; gap: 5px; }
  .nav-label, .sidebar-bottom { display: none; }
  .nav-link { white-space: nowrap; padding: 9px; }
  .main { margin-left: 0; padding: 20px 14px; }
  .topbar { align-items: flex-start; }
  .page-title { font-size: 21px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { padding: 14px; }
  .stat-value { font-size: 24px; }
  .panel { overflow-x: auto; padding: 15px; }
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 0%, #192d43 0%, transparent 55%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 410px;
  padding: 38px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 70px #0005;
}

.login-logo { display: flex; justify-content: center; margin-bottom: 16px; }
.login-logo .brand-mark { width: 48px; height: 48px; font-size: 21px; }
.login-brand { text-align: center; font-weight: 700; font-size: 18px; }
.login-card h1 { text-align: center; font-size: 23px; margin: 28px 0 4px; }
.login-description { text-align: center; color: var(--muted); margin: 0 0 28px; }
.login-form { display: grid; gap: 10px; }
.login-form label { color: #b9c6d9; font-size: 12px; font-weight: 600; margin-top: 8px; }
.login-button { width: 100%; margin-top: 15px; padding: 13px; }
.login-footer { text-align: center; color: var(--muted); font-size: 11px; margin-top: 25px; }

@media (max-width: 480px) {
  .login-card { padding: 28px 22px; }
}

.brand-light { font-weight: 400; color: #9cacc3; }
.nav-disabled { cursor: default; opacity: .72; }
.nav-disabled small {
  margin-left: auto;
  color: #71819a;
  font-size: 9px;
  text-transform: uppercase;
}
.sidebar-bottom { line-height: 1.8; }
.sidebar-version { color: #64748b; font-size: 10px; }
.main { min-height: 100vh; }
.user-chip form { margin: 0; }
.logout-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 0 2px 0 8px;
}
.logout-button:hover { color: var(--danger); }

.welcome-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
}
.welcome-row h2 { margin: 0 0 4px; font-size: 17px; }
.welcome-row p { margin: 0; color: var(--muted); font-size: 12px; }
.server-badge {
  white-space: nowrap;
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 8px 12px;
  color: #65d9bd;
  font-size: 11px;
}
.server-badge .status-dot {
  display: inline-block;
  margin-right: 6px;
  background: var(--accent);
}
.stat-top { display: flex; justify-content: space-between; align-items: center; }
.stat-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #20344a;
  color: var(--accent);
  font-size: 18px;
}
.stat-pending { font-size: 22px; color: #e6bd75; }
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: 18px;
}
.dashboard-grid .panel { margin-top: 22px; min-width: 0; }
.panel-subtitle { color: var(--muted); font-size: 11px; margin-top: 3px; }
.coming-label {
  color: #d3b477;
  font-size: 9px;
  letter-spacing: .7px;
  white-space: nowrap;
}
.chart-placeholder {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px dashed #30415b;
  border-radius: 11px;
  background: #111a2b;
  text-align: center;
  padding: 20px;
}
.chart-placeholder strong { font-size: 13px; }
.chart-placeholder span, .empty-state span {
  max-width: 330px;
  color: var(--muted);
  font-size: 11px;
}
.chart-symbol { font-size: 34px; color: #5b83b7; }
.server-info { display: grid; gap: 0; }
.server-info div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}
.server-info div:last-child { border-bottom: 0; }
.server-info span { color: var(--muted); }
.server-info strong { font-size: 11px; }
.good-text { color: var(--accent); }
.activity-panel { margin-top: 18px; }
.empty-state {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.empty-state strong { font-size: 13px; color: #cbd6e6; }
.empty-icon { font-size: 27px; color: #5b83b7; }
.dashboard-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 2px 5px;
  color: #65758d;
  font-size: 10px;
}

@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .welcome-row { align-items: flex-start; flex-direction: column; }
  .dashboard-grid { display: block; }
  .dashboard-grid .panel { margin-top: 12px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .coming-label { white-space: normal; }
  .dashboard-footer { flex-direction: column; }
}

/* Client speed limit editor */
.client-limit-edit {
  position: relative;
  display: inline-block;
}

.client-limit-edit summary {
  list-style: none;
  cursor: pointer;
  white-space: nowrap;
}

.client-limit-edit summary::-webkit-details-marker {
  display: none;
}

.client-limit-edit[open] > form {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  padding: 16px;
  display: grid;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .25);
}

.client-limit-edit form label {
  font-size: 12px;
  color: var(--muted);
}

.client-limit-edit form .form-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

