@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── LIGHT THEME (default) ─── */
:root {
  --bg:         #f4f6fb;
  --bg2:        #ffffff;
  --bg3:        #eef0f7;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #ffffff;
  --sidebar-hover: #1e293b;
  --border:     #e2e8f0;
  --text:       #0f172a;
  --text2:      #475569;
  --text3:      #94a3b8;
  --primary:    #10b981;
  --primary-dim:#d1fae5;
  --primary-dk: #059669;
  --gold:       #f59e0b;
  --gold-dim:   #fef3c7;
  --red:        #ef4444;
  --red-dim:    #fee2e2;
  --blue:       #3b82f6;
  --blue-dim:   #dbeafe;
  --shadow:     0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.08);
  --radius:     12px;
  --radius-sm:  8px;
  --transition: 0.2s ease;
}

/* ─── DARK THEME ─── */
[data-theme="dark"] {
  --bg:         #0d1117;
  --bg2:        #161b22;
  --bg3:        #21262d;
  --sidebar-bg: #0d1117;
  --sidebar-text: #8b949e;
  --sidebar-active: #f0f6fc;
  --sidebar-hover: #21262d;
  --border:     #30363d;
  --text:       #f0f6fc;
  --text2:      #8b949e;
  --text3:      #6e7681;
  --primary:    #10b981;
  --primary-dim:#0d2e20;
  --primary-dk: #34d399;
  --gold:       #f59e0b;
  --gold-dim:   #2d1f00;
  --red:        #f85149;
  --red-dim:    #2d0e0e;
  --blue:       #58a6ff;
  --blue-dim:   #0d1f3c;
  --shadow:     0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.4);
}

/* ─── RESET & BASE ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ─── TYPOGRAPHY ─── */
h1, h2, h3, h4, h5 { font-family: 'Syne', sans-serif; line-height: 1.25; }
.mono { font-family: 'JetBrains Mono', monospace; }

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* ─── LAYOUT ─── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}
.sidebar-logo {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.sidebar-logo .logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #10b981, #059669);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 800; color: white;
  font-family: 'Syne', sans-serif;
}
.sidebar-logo .logo-text {
  font-family: 'Syne', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #f0f6fc;
  line-height: 1.2;
}
.sidebar-logo .logo-text span {
  display: block;
  font-size: 0.65rem;
  color: #10b981;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.sidebar-nav { padding: 1rem 0; flex: 1; }
.nav-section-label {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #4b5563;
  padding: 0.75rem 1.25rem 0.35rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  color: var(--sidebar-text);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 0;
  transition: all var(--transition);
  position: relative;
}
.nav-item:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.nav-item.active {
  background: rgba(16,185,129,0.12);
  color: #10b981;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: #10b981;
  border-radius: 0 3px 3px 0;
}
.nav-item .nav-icon { width: 18px; text-align: center; font-size: 1rem; flex-shrink: 0; }
.nav-item .nav-badge {
  margin-left: auto;
  background: #ef4444;
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
}
.sidebar-bottom {
  padding: 1rem 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-user {
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.sidebar-user .user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #10b981, #3b82f6);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: white;
  flex-shrink: 0;
}
.sidebar-user .user-info { overflow: hidden; }
.sidebar-user .user-name {
  font-size: 0.8rem; font-weight: 600; color: #e2e8f0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user .user-role {
  font-size: 0.65rem; color: #10b981;
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* ─── MAIN CONTENT ─── */
.main-content {
  margin-left: 240px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── TOPBAR ─── */
.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 0.75rem; }
.topbar-title { font-family: 'Syne', sans-serif; font-size: 1.05rem; font-weight: 700; }
.topbar-subtitle { font-size: 0.78rem; color: var(--text3); }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }

/* ─── THEME TOGGLE ─── */
.theme-toggle {
  width: 42px; height: 24px;
  background: var(--border);
  border-radius: 12px;
  position: relative;
  border: none;
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
}
.theme-toggle::after {
  content: '';
  width: 18px; height: 18px;
  background: var(--bg2);
  border-radius: 50%;
  position: absolute;
  top: 3px; left: 3px;
  transition: transform var(--transition), background var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
[data-theme="dark"] .theme-toggle { background: #10b981; }
[data-theme="dark"] .theme-toggle::after { transform: translateX(18px); }

/* ─── PAGE CONTENT ─── */
.page-content { padding: 1.75rem; flex: 1; }

/* ─── CARDS ─── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

/* ─── STAT CARDS ─── */
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.stat-card .stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}
.stat-card .stat-value {
  font-family: 'Syne', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.35rem;
}
.stat-card .stat-change {
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.stat-card .stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dk); transform: translateY(-1px); }
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg3); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-gold { background: var(--gold); color: white; }
.btn-gold:hover { background: #d97706; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.75rem; }
.btn-lg { padding: 0.85rem 1.75rem; font-size: 0.9rem; }

/* ─── BADGES ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}
.badge-green { background: var(--primary-dim); color: var(--primary-dk); }
.badge-gold { background: var(--gold-dim); color: #92400e; }
.badge-red { background: var(--red-dim); color: #b91c1c; }
.badge-blue { background: var(--blue-dim); color: #1d4ed8; }
.badge-gray { background: var(--bg3); color: var(--text2); }

[data-theme="dark"] .badge-gold { color: var(--gold); }
[data-theme="dark"] .badge-red { color: var(--red); }
[data-theme="dark"] .badge-blue { color: var(--blue); }

/* ─── FORM ELEMENTS ─── */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 0.4rem;
}
.form-control {
  width: 100%;
  padding: 0.65rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.12);
}
.form-hint { font-size: 0.72rem; color: var(--text3); margin-top: 0.3rem; }
.form-error { font-size: 0.72rem; color: var(--red); margin-top: 0.3rem; }

/* ─── TABLE ─── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text3);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
tbody td {
  padding: 0.875rem 1rem;
  font-size: 0.83rem;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg3); }

/* ─── ALERT ─── */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.alert-info { background: var(--blue-dim); color: var(--blue); border: 1px solid rgba(59,130,246,0.2); }
.alert-success { background: var(--primary-dim); color: var(--primary-dk); border: 1px solid rgba(16,185,129,0.2); }
.alert-warning { background: var(--gold-dim); color: #92400e; border: 1px solid rgba(245,158,11,0.2); }
.alert-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
[data-theme="dark"] .alert-warning { color: var(--gold); }

/* ─── GRID HELPERS ─── */
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 1.25rem; }

/* ─── PROGRESS BAR ─── */
.progress-bar {
  height: 6px;
  background: var(--bg3);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 0.5rem;
}
.progress-fill {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--primary), #34d399);
  transition: width 0.6s ease;
}

/* ─── MOBILE HAMBURGER ─── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
}
.hamburger span {
  width: 20px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition);
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text3);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state h3 { font-size: 0.95rem; font-weight: 600; color: var(--text2); margin-bottom: 0.35rem; }
.empty-state p { font-size: 0.8rem; }

/* ─── MODAL ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-md);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.modal-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 1rem; }
.modal-close {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
}

/* ─── TOAST ─── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  font-size: 0.82rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 260px;
  animation: slideIn 0.3s ease;
}
.toast.success { border-left: 3px solid var(--primary); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--blue); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-content { padding: 1rem; }
  .topbar { padding: 0.875rem 1rem; }
  .topbar-right { flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; }
  .card { overflow-x: auto; }
}
@media (max-width: 480px) {
  .grid-2 { grid-template-columns: 1fr; }
  .topbar-right { gap: 0.35rem; }
}
