:root {
  color-scheme: dark;
  --bg-0: #020617;
  --bg-1: #07111f;
  --bg-2: #0b1627;
  --bg-3: #111d31;
  --panel: #111d31;
  --panel-2: #142238;
  --border: rgba(148, 163, 184, .13);
  --border-strong: rgba(148, 163, 184, .22);
  --text: #fafafa;
  --muted: #a1a1aa;
  --faint: #71717a;
  --accent: #38bdf8;
  --accent-2: #60a5fa;
  --accent-grad: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  --danger: #f87171;
  --danger-bg: rgba(239, 68, 68, .12);
  --ok-bg: rgba(20, 184, 166, .12);
  --ok: #5eead4;
  --warn-bg: rgba(245, 158, 11, .12);
  --warn: #fbbf24;
  --shadow: 0 24px 48px -12px rgba(0, 0, 0, .58), 0 4px 12px rgba(0, 0, 0, .35);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; }
body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, .9), rgba(2, 6, 23, 1) 42%),
    radial-gradient(1000px 520px at 100% -100px, rgba(56, 189, 248, .12), transparent 62%),
    radial-gradient(760px 480px at -120px 120px, rgba(37, 99, 235, .10), transparent 64%);
  background-attachment: fixed;
  color: var(--text);
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .6; }

.page, .shell { min-height: 100vh; display: flex; flex-direction: column; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card, .panel {
  background: rgba(17, 29, 49, .92);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.auth-card { width: min(440px, 100%); padding: 24px; }

.brand, .logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand { margin-bottom: 18px; }
.brand img, .topbar-logo {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, .34), 0 0 20px rgba(14, 165, 233, .24);
}
.brand h1, .logo h1 { margin: 0; font-size: 20px; line-height: 1.1; letter-spacing: -.01em; }
.brand p, .logo p { margin: 3px 0 0; color: var(--faint); font-size: 12px; }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 18px 0;
}
.tabs button {
  border: 0;
  background: transparent;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 700;
}
.tabs button.active { background: var(--bg-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }

.field { display: grid; gap: 6px; margin-top: 12px; }
.field span { color: var(--muted); font-weight: 700; font-size: 13px; }
.input, textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 12px;
  background: rgba(2, 6, 23, .52);
  color: var(--text);
  outline: none;
}
.input:focus, textarea:focus { border-color: rgba(56, 189, 248, .58); box-shadow: 0 0 0 3px rgba(56, 189, 248, .12); }
textarea { resize: vertical; min-height: 92px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 11px 14px;
  font-weight: 800;
  min-height: 42px;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { color: #fff; background: var(--accent-grad); box-shadow: 0 8px 24px rgba(14, 165, 233, .20); }
.btn.secondary { color: var(--text); background: var(--bg-2); border-color: var(--border-strong); }
.btn.danger { color: var(--danger); background: var(--danger-bg); border-color: rgba(239, 68, 68, .30); }
.btn.small { min-height: 34px; padding: 8px 10px; font-size: 13px; }
.full { width: 100%; margin-top: 16px; }

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(3, 10, 24, .92);
  backdrop-filter: saturate(160%) blur(14px);
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .03), 0 10px 30px rgba(0, 0, 0, .18);
}
.topbar .brand { margin: 0; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.body { flex: 1; display: flex; min-height: 0; }
.sidenav {
  width: 244px;
  padding: 22px 14px;
  background: rgba(7, 17, 31, .86);
  border-right: 1px solid var(--border);
}
.nav-btn {
  width: 100%;
  padding: 13px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--faint);
  text-align: left;
  font-weight: 750;
}
.nav-btn.active {
  color: var(--text);
  background: var(--bg-2);
  box-shadow: inset 0 0 0 1px var(--border);
}
.main {
  flex: 1;
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 32px 40px;
}
.wrap { display: grid; gap: 18px; }
.panel { padding: 20px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stack { display: grid; gap: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
h2 { margin: 0; font-size: 22px; color: var(--text); letter-spacing: -.01em; }
p { color: var(--faint); margin: 6px 0 0; line-height: 1.45; }
.note { border-radius: 8px; padding: 12px; background: rgba(255, 255, 255, .045); color: var(--muted); border: 1px solid var(--border); }
.ok { background: var(--ok-bg); color: var(--ok); border-color: rgba(20, 184, 166, .26); }
.warn { background: var(--warn-bg); color: var(--warn); border-color: rgba(245, 158, 11, .26); }
.error { background: var(--danger-bg); color: var(--danger); border-color: rgba(239, 68, 68, .30); }
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 20;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-2);
  box-shadow: var(--shadow);
  max-width: min(520px, calc(100vw - 32px));
}
.session-card, .user-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: rgba(2, 6, 23, .35);
}
.session-card strong, .user-row strong { display: block; color: var(--text); }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(148, 163, 184, .08);
  color: var(--muted);
  border: 1px solid var(--border);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.green { background: rgba(14, 165, 233, .14); color: #7dd3fc; border-color: rgba(56, 189, 248, .32); }
.pill.red { background: var(--danger-bg); color: var(--danger); border-color: rgba(239, 68, 68, .30); }
.hidden { display: none !important; }

@media (max-width: 820px) {
  .topbar { height: auto; align-items: flex-start; padding: 14px 16px; flex-direction: column; }
  .body { display: block; }
  .sidenav { width: 100%; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--border); }
  .nav-btn { text-align: center; }
  .main { padding: 16px; }
  .grid { grid-template-columns: 1fr; }
  .section-head, .session-card, .user-row { flex-direction: column; align-items: stretch; }
  .actions { width: 100%; }
  .actions .btn { flex: 1; }
}
