:root {
  --bg: #0f1115;
  --surface: #151921;
  --panel: #1c2230;
  --text: #e8edf7;
  --muted: #9aa3b5;
  --accent: #5be2b6;
  --accent-2: #7aa6ff;
  --danger: #ff6b6b;
  --border: #232b3a;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0,0,0,0.35);
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(circle at 20% 20%, rgba(91,226,182,0.06), transparent 30%), radial-gradient(circle at 80% 0%, rgba(122,166,255,0.08), transparent 25%), var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent-2); text-decoration: none; }

.bg-surface { background: var(--bg); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(12,14,18,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}
.topbar-nav a {
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
  background: rgba(255,255,255,0.02);
}
.topbar-nav a.active {
  color: var(--accent);
  border-color: rgba(91,226,182,0.4);
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.brand .logo-dot {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 25px rgba(91,226,182,0.35);
}
.brand-top { text-transform: lowercase; }
.brand-sub { font-size: 12px; color: var(--muted); margin-top: -4px; }
.brand.compact .logo-dot { width: 22px; height: 22px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 700;
}

.page {
  padding: 16px;
  padding-bottom: 88px; /* space for bottom nav */
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.stat { text-align: left; }

.grid.stats {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.eyebrow {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 11px;
  margin: 0 0 2px;
}

.page h3 { margin: 4px 0; }
.page h2 { margin: 0; }
.page-title { margin: 0 0 12px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }

.btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #0a0d12;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(91,226,182,0.25); }
.btn.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #0a0d12; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.w-100 { width: 100%; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(122,166,255,0.12);
  color: var(--text);
  border: 1px solid rgba(122,166,255,0.25);
  font-size: 12px;
}
.chip.subtle {
  background: rgba(255,255,255,0.04);
  border-color: var(--border);
  color: var(--muted);
}

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }

.pill-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.table {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.table-head, .table-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  padding: 12px;
  gap: 8px;
}
.table-head {
  background: rgba(255,255,255,0.03);
  font-size: 13px;
  color: var(--muted);
}
.table-row {
  border-top: 1px solid var(--border);
  align-items: center;
}
.table-row:hover { background: rgba(255,255,255,0.03); cursor: pointer; }

.responsive .table-row { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 720px) {
  .responsive .table-row { grid-template-columns: repeat(6, minmax(0,1fr)); }
}

.table-row > div[colspan="6"] {
  grid-column: 1 / -1;
}

.sparkline {
  width: 100%;
  height: 32px;
}

.sparkline path {
  stroke: var(--accent);
  fill: none;
  stroke-width: 2;
}

.sparkline .fill {
  fill: rgba(91,226,182,0.1);
  stroke: none;
}

.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { color: var(--muted); font-size: 13px; }
.field input, .field select, .field textarea {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
}
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
}
.alert.error { border-color: var(--danger); color: #ffd6d6; }
.alert.success { border-color: var(--accent); color: var(--accent); }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(12,14,18,0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.nav-item {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}
.nav-item.is-active { color: var(--accent); }

/* Drawer */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  max-width: 360px;
  width: 86%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 16px;
  transition: transform 0.2s ease, opacity 0.2s ease;
  z-index: 40;
  box-shadow: -10px 0 25px rgba(0,0,0,0.35);
  overflow-y: auto;
  transform: translateX(110%);
  opacity: 0;
  pointer-events: none;
}
.drawer.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
.drawer-header { display: flex; justify-content: space-between; align-items: center; }
.drawer-body { margin-top: 12px; }
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  z-index: 30;
}
.drawer-backdrop.open { opacity: 1; visibility: visible; }

.icon-button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(420px, 100%);
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.pill-card strong { display: block; }

.card.mt-16, .mt-16 { margin-top: 16px; }

@media (min-width: 960px) {
  .page { padding: 24px 32px 96px; }
  .topbar { position: sticky; }
  body { background-position: 0 0; }
  .drawer { width: 340px; }
}
