:root {
  --sidebar-w: 240px;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --sidebar-bg: #111827;
  --sidebar-text: #d1d5db;
  --sidebar-hover: #1f2937;
  --sidebar-active: #2563eb;
  --sidebar-active-text: #ffffff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
}

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

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 32px 40px;
}

/* ---------- Sidebar ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 17px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--sidebar-active);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav {
  list-style: none;
  margin: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav a:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav a.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
}

.nav svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ---------- Page content ---------- */
.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 600;
}

.page-header p {
  margin: 0;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

/* ---------- Mobile top bar + toggle ---------- */
.topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--sidebar-bg);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}

.menu-btn {
  background: none;
  border: 0;
  color: #fff;
  padding: 6px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.menu-btn svg { width: 24px; height: 24px; }

.backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 25;
}

@media (max-width: 768px) {
  .topbar { display: flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .backdrop { display: block; }

  .main { padding: 20px 16px; }
}
