:root {
  --bg: #0f1220;
  --panel: #171b2e;
  --panel-2: #1e2338;
  --border: #2a3050;
  --text: #e8eaf5;
  --text-dim: #9aa0bd;
  --accent: #ff4d6d;
  --accent-2: #6d5dfc;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  background: linear-gradient(180deg, var(--bg), #10132a);
  color: var(--text);
  min-height: 100vh;
}

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

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar h1 {
  font-size: 17px;
  margin: 0;
  color: var(--text);
  line-height: 1.2;
}

.sidebar .subtitle {
  font-size: 11px;
  color: var(--text-dim);
}

.nav-list { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 14px;
  transition: background .15s, color .15s;
}

.nav-icon { width: 18px; height: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.nav-icon svg { width: 18px; height: 18px; }
.nav-label { white-space: nowrap; }

.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(255,77,109,.35); }

.nav-bottom { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item.nav-logout { color: var(--danger); }
.nav-item.nav-logout:hover { background: transparent; opacity: .8; }

.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.02);
}

.breadcrumb { font-size: 13px; color: var(--text-dim); }
.breadcrumb .sep { margin: 0 6px; opacity: .5; }

.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-date { font-size: 13px; color: var(--text-dim); }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.main { flex: 1; padding: 28px 32px; max-width: 1400px; width: 100%; }

.page-title {
  font-size: 22px;
  margin: 0 0 22px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 15px;
  margin: 0 0 16px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 40px; }

.stat {
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 18px;
  border-left: 3px solid var(--border);
  transition: border-color .15s;
}

.stat.accent-pink { border-left-color: var(--accent); }
.stat.accent-purple { border-left-color: var(--accent-2); }
.stat.accent-ok { border-left-color: var(--ok); }
.stat.accent-warn { border-left-color: var(--warn); }

.stat .value { font-size: 26px; font-weight: 800; }
.stat .label { font-size: 12px; color: var(--text-dim); margin-top: 6px; }

label { display: block; font-size: 13px; color: var(--text-dim); margin: 14px 0 6px; }
label:first-child { margin-top: 0; }

input[type=text], input[type=url], input[type=password], input[type=number], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
}

textarea { resize: vertical; min-height: 80px; font-family: inherit; }

input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-2); }

.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
}

.btn:hover { opacity: .9; }
.btn.secondary { background: var(--panel-2); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 6px 12px; font-size: 12px; margin: 0; }
.btn.quick-link { display: inline-flex; align-items: center; gap: 8px; }
.btn.quick-link .nav-icon svg { width: 15px; height: 15px; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}

.switch {
  position: relative;
  width: 46px;
  height: 24px;
  flex-shrink: 0;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: .2s;
}

.slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
}

.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::before { transform: translateX(22px); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.server-list { display: flex; flex-direction: column; gap: 12px; }

.server-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  background: var(--panel-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  flex-wrap: wrap;
}

.server-row-img { flex-shrink: 0; }
.server-row-img img {
  width: 56px; height: 56px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}
.server-row-noimg {
  width: 56px; height: 56px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
}

.server-row-info { flex: 1; min-width: 180px; }
.server-row-name { font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.server-row-url {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
  word-break: break-all;
}
.server-row-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 6px;
  font-style: italic;
}

.server-row .row-actions {
  flex-wrap: wrap;
  flex-shrink: 0;
  width: 100%;
}

@media (min-width: 640px) {
  .server-row .row-actions { width: auto; }
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge.ok { background: rgba(52,211,153,.15); color: var(--ok); }
.badge.off { background: rgba(248,113,113,.15); color: var(--danger); }

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 14px;
}
.alert.success { background: rgba(52,211,153,.12); color: var(--ok); border: 1px solid rgba(52,211,153,.3); }
.alert.error { background: rgba(248,113,113,.12); color: var(--danger); border: 1px solid rgba(248,113,113,.3); }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  width: 340px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.login-box h1 { text-align: center; font-size: 20px; margin-bottom: 24px; }

.row-actions { display: flex; gap: 8px; }

.hint { font-size: 12px; color: var(--text-dim); margin-top: 6px; }

.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 6px;
  cursor: pointer;
  flex-shrink: 0;
}
.menu-toggle svg { width: 22px; height: 22px; display: block; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 40;
}
.sidebar-overlay.visible { display: block; }

@media (max-width: 768px) {
  .layout { flex-direction: column; }

  .menu-toggle { display: block; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 250px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.4);
  }

  .sidebar.open { transform: translateX(0); }

  .nav-label { display: inline; }

  .topbar { padding: 12px 16px; gap: 8px; }
  .breadcrumb { font-size: 12px; }
  .topbar-date { display: none; }

  .main { padding: 18px 16px; }

  .grid { grid-template-columns: repeat(2, 1fr); }

  table { font-size: 12px; }
  th, td { padding: 8px 4px; }

  .row-actions { flex-wrap: wrap; }
}
