:root {
  --bg: #0a1628;
  --surface: #1a2b4b;
  --surface2: #243756;
  --border: rgba(148, 163, 184, 0.18);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --green: #4ade80;
  --red: #f87171;
  --amber: #fbbf24;
  --sidebar-w: 220px;
  --r: 8px;
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: linear-gradient(168deg, #0c1a32, #060f1c);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}
.hidden { display: none !important; }
.mono { font-family: ui-monospace, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.r { text-align: right; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }

.auth-overlay {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
}
.brand-block, .sidebar-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.brand-icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: linear-gradient(145deg, rgba(56,189,248,.2), rgba(45,212,191,.15));
  color: var(--accent); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.brand-icon.sm { width: 36px; height: 36px; }
.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub { color: var(--muted); font-size: 11px; }

.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.auth-tab {
  flex: 1; padding: 8px; border: 1px solid var(--border); background: transparent;
  color: var(--muted); border-radius: var(--r); cursor: pointer; font: inherit;
}
.auth-tab.active { color: var(--text); border-color: var(--accent); background: rgba(56,189,248,.1); }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; color: var(--muted); }
.input, .select {
  width: 100%; padding: 9px 11px; border-radius: var(--r);
  border: 1px solid var(--border); background: #0a1628; color: var(--text); font: inherit;
}
.form-error { color: var(--red); font-size: 12px; min-height: 16px; }
.form-success { color: var(--green); font-size: 12px; }
.auth-footer { margin-top: 20px; text-align: center; color: var(--muted); font-size: 11px; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: #060d18; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.nav-item {
  text-align: left; padding: 10px 12px; border: none; border-radius: var(--r);
  background: transparent; color: var(--muted); cursor: pointer; font: inherit;
}
.nav-item.active, .nav-item:hover { background: rgba(56,189,248,.12); color: var(--text); }
.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.sidebar-link { color: var(--muted); font-size: 12px; text-decoration: none; }
.sidebar-link:hover { color: var(--accent); }

.main-area { flex: 1; padding: 28px; overflow: auto; }
.page-header { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-title { font-size: 1.4rem; font-weight: 700; }
.page-sub { color: var(--muted); margin-top: 4px; font-size: 13px; }
.page-actions { display: flex; gap: 8px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 14px; border: none; border-radius: var(--r);
  background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.btn-block { width: 100%; }
.btn-xs { padding: 4px 8px; font-size: 11px; }
.btn-danger { background: var(--red); }
.btn-logout { background: transparent; border: 1px solid var(--border); color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.card-pad { padding: 20px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; background: var(--surface2); }
.empty-cell { text-align: center; color: var(--muted); padding: 32px !important; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 14px; display: flex; flex-direction: column; gap: 6px;
}
.stat-card span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.stat-card strong { font-size: 1.2rem; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: rgba(56,189,248,.15); color: var(--accent); font-size: 11px; }
.alert { padding: 14px; border-radius: var(--r); margin-bottom: 16px; }
.alert-warn { background: rgba(251,191,36,.12); border: 1px solid rgba(251,191,36,.3); }
.alert code { word-break: break-all; }

.health-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.health-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.health-dot.ok { background: var(--green); }
.health-dot.bad { background: var(--red); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }
.docs-pre { white-space: pre-wrap; word-break: break-word; font-size: 12px; line-height: 1.6; }

.toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast { padding: 10px 14px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.toast-ok { border-left: 3px solid var(--green); }
.toast-err { border-left: 3px solid var(--red); }

@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
