/* Light Theme Tokens (Default) */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-card: #ffffff;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  --fg: #0f172a;
  --heading-fg: #0f172a;
  --muted: #64748b;
  --muted-dark: #94a3b8;
  --input-bg: #ffffff;
  --accent: #6366f1;
  --accent-light: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
  --accent-glow: rgba(99, 102, 241, 0.15);
  --ok: #10b981;
  --ok-bg: rgba(16, 185, 129, 0.1);
  --warn: #f59e0b;
  --warn-bg: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.05), 0 2px 4px -1px rgba(15, 23, 42, 0.03);
  --shadow-glow: 0 8px 24px -4px rgba(99, 102, 241, 0.15);
}

/* Dark Theme Tokens */
[data-theme="dark"] {
  --bg: #0b0f19;
  --surface: #111827;
  --surface-card: #161e2e;
  --surface-hover: #1f293d;
  --border: #243047;
  --border-subtle: #1a2336;
  --fg: #f3f4f6;
  --heading-fg: #ffffff;
  --muted: #9ca3af;
  --muted-dark: #6b7280;
  --input-bg: #090d16;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --accent-glow: rgba(99, 102, 241, 0.25);
  --ok: #10b981;
  --ok-bg: rgba(16, 185, 129, 0.12);
  --warn: #f59e0b;
  --warn-bg: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.2);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
}
a { color: var(--accent-light); text-decoration: none; transition: color 0.15s ease; }
a:hover { opacity: 0.85; }

/* Layout Shell */
.app-layout { display: flex; width: 100%; min-height: 100vh; }
.sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 100;
}
.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.brand-logo {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--accent-gradient);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: var(--shadow-glow);
}
.brand-title { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; color: var(--heading-fg); }
.brand-version { font-size: 10px; padding: 2px 6px; background: rgba(99,102,241,0.15); color: var(--accent-light); border-radius: 99px; font-weight: 700; margin-left: auto; }

.sidebar-nav { padding: 16px 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.nav-section { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted-dark); padding: 12px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 14px; font-weight: 600;
  transition: all 0.15s ease;
}
.nav-item:hover { background: var(--surface-hover); color: var(--fg); }
.nav-item.active { background: rgba(99, 102, 241, 0.1); color: var(--accent); border-left: 3px solid var(--accent); }
.nav-icon { width: 18px; height: 18px; opacity: 0.8; }

.sidebar-footer { padding: 16px; border-top: 1px solid var(--border-subtle); background: var(--surface-hover); }
.user-profile { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 34px; height: 34px; border-radius: 99px; background: var(--border); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: var(--fg); }
.user-info { flex: 1; overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; color: var(--heading-fg); text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.user-role { font-size: 11px; color: var(--muted); }

.main-content {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.top-header {
  height: 68px;
  padding: 0 32px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 90;
}
.header-title-box { display: flex; align-items: center; gap: 12px; }
.page-title { font-size: 20px; font-weight: 700; color: var(--heading-fg); margin: 0; }
.content-wrapper { padding: 32px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* Dashboard Cards & Layout Components */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease;
}
.card:hover { border-color: rgba(99, 102, 241, 0.3); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 28px; }
.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent-gradient); opacity: 0.9;
}
.stat-label { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--heading-fg); letter-spacing: -0.5px; }
.stat-sub { font-size: 12px; color: var(--ok); margin-top: 6px; display: flex; align-items: center; gap: 4px; font-weight: 600; }

/* UI Controls & Forms */
label { display: block; font-size: 13px; font-weight: 600; color: var(--fg); margin: 14px 0 6px; }
input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

button, .btn {
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent-gradient);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 11px 20px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  transition: all 0.15s ease;
}
button:hover, .btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45); }
button.secondary, .btn.secondary {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--fg);
  box-shadow: none;
}
button.secondary:hover, .btn.secondary:hover { background: var(--border); border-color: var(--muted-dark); }

/* Status Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 99px;
  text-transform: capitalize;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.pending, .badge.camp-paused { color: var(--warn); background: var(--warn-bg); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge.approved, .badge.inst-ready, .badge.camp-finished { color: var(--ok); background: var(--ok-bg); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge.inst-provisioning, .badge.camp-running, .badge.camp-scheduled { color: var(--accent); background: rgba(99, 102, 241, 0.1); border: 1px solid rgba(99, 102, 241, 0.3); }
.badge.inst-error, .badge.camp-cancelled { color: var(--danger); background: var(--danger-bg); border: 1px solid rgba(239, 68, 68, 0.3); }
.badge.camp-draft { color: var(--muted); background: var(--surface-hover); border: 1px solid var(--border); }

/* Tables */
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th { text-align: left; padding: 12px 14px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
td { padding: 14px; border-bottom: 1px solid var(--border-subtle); font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-hover); }

/* Alerts */
.error { background: var(--danger-bg); border: 1px solid rgba(239, 68, 68, 0.4); color: var(--danger); padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-weight: 500; }
.ok { background: var(--ok-bg); border: 1px solid rgba(16, 185, 129, 0.4); color: var(--ok); padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-weight: 500; }
.info { background: rgba(99, 102, 241, 0.1); border: 1px solid rgba(99, 102, 241, 0.3); color: var(--accent); padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-weight: 500; }
.muted { color: var(--muted); }

/* Standalone Auth Container */
.auth-wrapper {
  min-height: 100vh; width: 100vw;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow);
}
