:root {
  --bg: #0b1120;
  --bg-alt: #0f172a;
  --surface: #131c31;
  --surface-2: #1a2540;
  --border: #223154;
  --accent: #38bdf8;
  --accent-light: #7dd3fc;
  --text: #e5edf8;
  --muted: #8b9bbd;
  --ok: #34d399;
  --warn: #fbbf24;
  --off: #64748b;
  --radius: 14px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 60;
  transition: transform 0.25s ease;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 22px;
  font-weight: 800;
  font-size: 1.05rem;
  border-bottom: 1px solid var(--border);
}
.brand__mark { color: var(--accent); font-size: 1.2rem; }

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 12px;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item__icon { width: 18px; text-align: center; opacity: 0.9; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.is-active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(56, 189, 248, 0.04));
  color: var(--accent-light);
}

.sidebar__footer { padding: 16px; border-top: 1px solid var(--border); }
.demo-note {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.demo-note strong { font-size: 0.85rem; color: var(--accent-light); }
.demo-note span { font-size: 0.78rem; color: var(--muted); }

/* Main */
.app__main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Topbar */
.topbar {
  height: 68px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}
.topbar__burger span {
  display: block;
  width: 16px;
  height: 2px;
  margin: 0 auto;
  background: var(--text);
}

.topbar__search {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
}
.topbar__search-icon { color: var(--muted); }
.topbar__search input {
  border: none;
  background: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  width: 100%;
}
.topbar__search input::placeholder { color: var(--muted); }

.topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar__badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--warn);
  border: 1px solid rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.08);
  padding: 4px 9px;
  border-radius: 999px;
}
.icon-btn {
  position: relative;
  background: none;
  border: none;
  font-size: 1.05rem;
  cursor: pointer;
  color: var(--muted);
}
.icon-btn__dot {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-alt);
}
.topbar__user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  color: #06131f;
  font-weight: 700;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topbar__user-info { display: flex; flex-direction: column; line-height: 1.25; }
.topbar__user-info strong { font-size: 0.85rem; }
.topbar__user-info span { font-size: 0.72rem; color: var(--muted); }

/* Content */
.content {
  padding: 28px 28px 8px;
  flex: 1;
}

.content__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 6px;
}
.content__head h1 { margin: 0; font-size: 1.7rem; font-weight: 800; }
.content__head-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.content__updated { font-size: 0.78rem; color: var(--muted); }

.status-pill {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
}
.status-pill--ok { background: rgba(52, 211, 153, 0.12); color: var(--ok); }

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.stat-card__label { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.stat-card__value {
  font-size: 1.7rem;
  font-weight: 800;
  margin-bottom: 12px;
}
.stat-card__value span { font-size: 0.9rem; font-weight: 500; color: var(--muted); margin-left: 4px; }
.stat-card__bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: 10px;
}
.stat-card__bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 999px;
}
.stat-card__trend { font-size: 0.78rem; color: var(--muted); }
.stat-card__trend--up { color: var(--ok); }
.stat-card__trend--down { color: var(--warn); }

/* Panels */
.panel-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}
.panel-grid .panel { margin-bottom: 0; }
.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 8px;
}
.panel__head h2 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.panel__hint { font-size: 0.78rem; color: var(--muted); }

/* Chart */
.chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 160px;
}
.chart__bar {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
}
.chart__bar::before {
  content: '';
  display: block;
  width: 100%;
  height: var(--h);
  border-radius: 8px 8px 2px 2px;
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
  opacity: 0.85;
}
.chart__bar span {
  position: absolute;
  bottom: -22px;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Uptime */
.uptime {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}
.uptime__circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 8px solid var(--surface-2);
  border-top-color: var(--ok);
  border-right-color: var(--ok);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  transform: rotate(-45deg);
}
.uptime__circle span { transform: rotate(45deg); }
.uptime__circle small { font-size: 0.8rem; color: var(--muted); }
.uptime p { margin: 0; font-size: 0.85rem; color: var(--muted); }
.uptime strong { color: var(--text); }

/* Table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
}
.table tr:last-child td { border-bottom: none; }
.table__server { display: flex; align-items: center; gap: 10px; font-weight: 600; white-space: nowrap; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot--ok { background: var(--ok); }
.dot--warn { background: var(--warn); }
.dot--off { background: var(--off); }

.badge {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}
.badge--ok { background: rgba(52, 211, 153, 0.12); color: var(--ok); }
.badge--warn { background: rgba(251, 191, 36, 0.12); color: var(--warn); }
.badge--off { background: rgba(100, 116, 139, 0.15); color: var(--off); }

/* Activity */
.activity { display: flex; flex-direction: column; gap: 16px; }
.activity li { display: flex; gap: 12px; align-items: flex-start; }
.activity__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}
.activity__dot--ok { background: var(--ok); }
.activity__dot--warn { background: var(--warn); }
.activity__dot--off { background: var(--off); }
.activity p { margin: 0 0 3px; font-size: 0.88rem; }
.activity span { font-size: 0.76rem; color: var(--muted); }

/* Users */
.user-list { display: flex; flex-direction: column; gap: 14px; }
.user-list li { display: flex; align-items: center; gap: 12px; }
.user-list__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-light);
  flex-shrink: 0;
}
.user-list__info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.user-list__info strong { font-size: 0.88rem; }
.user-list__info span { font-size: 0.76rem; color: var(--muted); }

/* Settings */
.settings-grid { display: flex; flex-direction: column; gap: 4px; }
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Footer */
.app-footer {
  padding: 18px 28px 26px;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 16, 0.6);
  z-index: 50;
}

/* Responsive */
@media (max-width: 1080px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 20px 0 40px rgba(0,0,0,0.4);
  }
  .sidebar.is-open { transform: translateX(0); }
  .app__main { margin-left: 0; }
  .topbar__burger { display: flex; }
  .sidebar-overlay.is-open { display: block; }
  .topbar__search { display: none; }
}

@media (max-width: 620px) {
  .stats-grid { grid-template-columns: 1fr; }
  .content { padding: 20px 16px 8px; }
  .topbar { padding: 0 16px; }
  .topbar__user-info { display: none; }
  .content__head { flex-direction: column; align-items: flex-start; }
  .content__head-meta { align-items: flex-start; }
}
