:root {
  --primary: #1565c0;
  --primary-container: #d3e4fd;
  --surface: #f8fafc;
  --surface-card: #fff;
  --on-surface: #1a1c1e;
  --muted: #5c6370;
  --border: #e2e8f0;
  --ok: #0d7a4a;
  --warn: #b45309;
  --error: #b3261e;
  --radius: 12px;
  --font: 'Roboto', system-ui, sans-serif;
}
[data-theme="dark"] {
  --primary: #90caf9;
  --primary-container: #0d3f6e;
  --surface: #0f1419;
  --surface-card: #1a2332;
  --on-surface: #e8edf4;
  --muted: #9aa4b2;
  --border: #2a3544;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--surface);
  color: var(--on-surface);
  min-height: 100vh;
}
a { color: var(--primary); }
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px;
  background: var(--surface-card);
  border-right: 1px solid var(--border);
  padding: 1rem 0.75rem;
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem 1.25rem;
  text-decoration: none;
  color: inherit;
}
.sidebar-brand strong { display: block; font-size: 1rem; }
.sidebar-brand small { color: var(--muted); font-size: 0.75rem; }
.nav-section { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 0.75rem; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  border: none;
  background: transparent;
  color: inherit;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.nav-link:hover, .nav-link.active { background: var(--primary-container); color: var(--on-surface); }
.main { flex: 1; padding: 1.25rem 1.5rem 3rem; max-width: 960px; }
.card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.card h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.page-header { margin-bottom: 1.25rem; }
.page-header h1 { margin: 0 0 0.35rem; font-size: 1.5rem; }
.subtitle { color: var(--muted); margin: 0; font-size: 0.9rem; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  background: var(--surface-card);
  color: inherit;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  font-size: 0.875rem;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }
.form-group { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.75rem; }
.form-group span { font-size: 0.8rem; color: var(--muted); }
input, select, textarea {
  font: inherit;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: inherit;
  width: 100%;
}
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th, .table td { padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--border); text-align: left; }
.badge { display: inline-block; padding: 0.15rem 0.45rem; border-radius: 6px; font-size: 0.75rem; background: var(--border); }
.badge-ok { background: #d1fae5; color: #065f46; }
.badge-warn { background: #fef3c7; color: #92400e; }
[data-theme="dark"] .badge-ok { background: #064e3b; color: #a7f3d0; }
[data-theme="dark"] .badge-warn { background: #78350f; color: #fde68a; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.stat { background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.85rem; }
.stat-value { font-size: 1.25rem; font-weight: 700; }
.stat-label { font-size: 0.75rem; color: var(--muted); }
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 400px; }
.form-error { color: var(--error); font-size: 0.85rem; }
.form-success { color: var(--ok); font-size: 0.85rem; }
.toast {
  position: fixed; bottom: 1rem; right: 1rem; background: var(--on-surface); color: var(--surface);
  padding: 0.65rem 1rem; border-radius: 8px; z-index: 100; font-size: 0.875rem;
}
.menu-toggle { display: none; position: fixed; top: 0.75rem; left: 0.75rem; z-index: 50; }
@media (max-width: 768px) {
  .shell { flex-direction: column; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40; transform: translateX(-100%);
    transition: transform 0.2s; box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .main { padding-top: 3.5rem; }
}
