:root {
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-sidebar-bg: #020617;
  --color-sidebar-text: #e5e7eb;
  --radius-main: 14px;
}

:root {
  --bg: #050811;
  --bg-elevated: #0c101b;
  --bg-elevated-alt: #111827;
  --sidebar-bg: #050b16;
  --border-subtle: #1f2937;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.15);
  --accent-strong: #2563eb;
  --text: #f9fafb;
  --text-muted: #9ca3af;
  --danger: #ef4444;
  --success: #22c55e;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(circle at top, #111827 0, #020617 50%, #000 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  display: flex;
}

/* Layout */

#app {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar */

.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #020617 0%, #020617 40%, #020617 70%, #020617 100%);
  border-right: 1px solid rgba(148, 163, 184, 0.15);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.logo-icon {
  background: radial-gradient(circle at top, var(--accent) 0%, var(--accent-strong) 40%, #1d4ed8 100%);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-text .brand {
  font-weight: 600;
  letter-spacing: 0.03em;
}

.logo-text .sub {
  font-size: 11px;
  color: var(--text-muted);
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.menu-item {
  border: none;
  background: transparent;
  color: var(--text-muted);
  text-align: left;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.menu-item:hover {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
}

.menu-item.active {
  background: var(--accent-soft);
  color: #e5f0ff;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.3);
}

.sidebar-footer {
  margin-top: auto;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  padding-top: 10px;
}

/* Main */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
}

/* Topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

#page-title {
  font-size: 20px;
  font-weight: 600;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Buttons */

.btn {
  border-radius: 999px;
  padding: 9px 16px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: white;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* Cards */

.card {
  background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.12) 0, #020617 35%, #020617 100%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.18);
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.9);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-header h2 {
  font-size: 16px;
  margin: 0;
}

.card-body {
  font-size: 14px;
  color: var(--text-muted);
}

/* Stats */

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card {
  background: radial-gradient(circle at 10% 0, rgba(59, 130, 246, 0.35) 0, #020617 40%, #020617 100%);
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* Alerts */

.alert {
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 8px;
}

.alert-error {
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.55);
}

.alert-success {
  background: rgba(52, 211, 153, 0.12);
  color: #bbf7d0;
  border: 1px solid rgba(52, 211, 153, 0.55);
}

.hidden {
  display: none;
}

/* Auth */

.auth-wrapper {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1.2fr);
  gap: 18px;
  align-items: stretch;
}

.auth-card {
  background: linear-gradient(145deg, #020617 0%, #020617 25%, #020617 100%);
  border-radius: var(--radius-lg);
  padding: 16px 18px 18px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.9);
}

.auth-side {
  background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.35) 0, #020617 40%, #020617 100%);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  border: 1px solid rgba(59, 130, 246, 0.5);
  box-shadow: 0 18px 45px rgba(37, 99, 235, 0.6);
  font-size: 14px;
}

.auth-side h2 {
  margin-top: 0;
  margin-bottom: 12px;
}

.auth-tabs {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.8);
  padding: 3px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.auth-tab {
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}

.auth-tab.active {
  background: var(--accent);
  color: white;
}

.form {
  display: none;
  margin-top: 4px;
}

.form.active {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: 4px;
}

input {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.85);
  color: var(--text);
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.7);
}

/* Views */

.view {
  display: none;
}

.view-active {
  display: block;
}

/* Responsive */

@media (max-width: 960px) {
  .sidebar {
    display: none;
  }

  .main {
    padding: 12px;
  }

  .grid-3 {
    grid-template-columns: 1fr;
  }

  .auth-wrapper {
    grid-template-columns: 1fr;
  }

  .auth-side {
    order: -1;
  }
}

/* === THEME TOGGLE BUTTON === */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
    z-index: 2000;
}

/* === LIGHT MODE === */
.light {
    --bg: #ffffff;
    --bg2: #f5f5f5;
    --text: #222222;
    --primary: #007bff;
}

.light body {
    background: var(--bg);
    color: var(--text);
}

.light .sidebar,
.light .topbar,
.light .card {
    background: var(--bg2);
}
