/* ============================================================
   DESIGN SYSTEM — MGMP SaaS Platform
   Light Mode ↔ Dark Mode | Font: Inter | Accent: Indigo
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   1. CSS VARIABLES (Design Tokens)
   ============================================================ */
:root {
  /* === BACKGROUNDS === */
  --bg:          #F8FAFC;
  --bg-card:     #FFFFFF;
  --bg-hover:    #F1F5F9;
  --bg-input:    #FFFFFF;

  /* === BORDERS === */
  --border:      #E2E8F0;
  --border-focus:#6366F1;

  /* === TEXT — Contrast checked (WCAG AA/AAA) === */
  --text:        #0F172A;   /* 18:1 on white — AAA */
  --text-muted:  #475569;   /* 7:1  on white — AAA */
  --text-light:  #94A3B8;   /* 3:1  on white — AA large */

  /* === ACCENT (Indigo) === */
  --accent:        #6366F1;
  --accent-dark:   #4F46E5;
  --accent-light:  #EEF2FF;
  --accent-text:   #FFFFFF;

  /* === STATUS COLORS === */
  --success:       #059669;
  --success-bg:    #D1FAE5;
  --warning:       #D97706;
  --warning-bg:    #FEF3C7;
  --danger:        #DC2626;
  --danger-bg:     #FEE2E2;
  --info:          #2563EB;
  --info-bg:       #DBEAFE;

  /* === SIDEBAR === */
  --sidebar-w:      240px;
  --sidebar-bg:     #0F172A;
  --sidebar-text:   #94A3B8;
  --sidebar-hover:  rgba(255,255,255,0.06);
  --sidebar-active-bg:   rgba(99,102,241,0.18);
  --sidebar-active-text: #A5B4FC;

  /* === SHADOWS === */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:    0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.03);
  --shadow-xl: 0 25px 50px -12px rgba(0,0,0,0.18);

  /* === BORDER RADIUS === */
  --r-sm:   6px;
  --r:      10px;
  --r-lg:   16px;
  --r-xl:   24px;
  --r-full: 9999px;

  /* === TRANSITIONS === */
  --ease:     200ms cubic-bezier(0.4,0,0.2,1);
  --ease-out: 300ms cubic-bezier(0,0,0.2,1);
}

/* ============================================================
   DARK MODE OVERRIDE
   ============================================================ */
[data-theme="dark"] {
  --bg:       #0D1117;
  --bg-card:  #161B22;
  --bg-hover: #1C2128;
  --bg-input: #1C2128;

  --border:       #30363D;
  --border-focus: #818CF8;

  /* Text — Contrast checked on dark bg */
  --text:       #E6EDF3;   /* 15:1 on #0D1117 — AAA */
  --text-muted: #8B949E;   /* 5:1  on #0D1117 — AA  */
  --text-light: #656D76;   /* 3:1  on #0D1117 — AA large */

  /* Accent brighter for dark bg */
  --accent:       #818CF8;
  --accent-dark:  #6366F1;
  --accent-light: #1E1B4B;
  --accent-text:  #FFFFFF;

  --success:    #2EA043;  --success-bg:  #0D2616;
  --warning:    #F0883E;  --warning-bg:  #2D1900;
  --danger:     #F85149;  --danger-bg:   #2D0000;
  --info:       #58A6FF;  --info-bg:     #0D1D2E;

  --sidebar-bg:          #010409;
  --sidebar-text:        #8B949E;
  --sidebar-hover:       rgba(255,255,255,0.04);
  --sidebar-active-bg:   rgba(129,140,248,0.18);
  --sidebar-active-text: #818CF8;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
  --shadow:    0 4px 6px -1px rgba(0,0,0,0.5);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.5);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.6);
  --shadow-xl: 0 25px 50px -12px rgba(0,0,0,0.7);
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  transition: background var(--ease), color var(--ease);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: color var(--ease); }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ============================================================
   3. TYPOGRAPHY
   ============================================================ */
h1,h2,h3,h4,h5,h6 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.02em;
}
h1 { font-size: 2.5rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

.text-muted   { color: var(--text-muted) !important; }
.text-light   { color: var(--text-light) !important; }
.text-accent  { color: var(--accent) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger  { color: var(--danger) !important; }
.text-info    { color: var(--info) !important; }
.text-sm  { font-size: 0.8125rem; }
.text-xs  { font-size: 0.75rem; }
.text-lg  { font-size: 1.125rem; }
.text-xl  { font-size: 1.25rem; }
.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* ============================================================
   4. BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5625rem 1.125rem;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--r);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--ease);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
  user-select: none;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.25);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn-outline:hover {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover {
  background: #b91c1c;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.25);
  transform: translateY(-1px);
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; border-radius: var(--r-sm); }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; border-radius: var(--r-lg); }
.btn-icon { padding: 0.5rem; border-radius: var(--r-sm); aspect-ratio: 1; justify-content: center; }
.btn-icon.btn-sm { padding: 0.375rem; }

/* ============================================================
   5. CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--ease), border-color var(--ease);
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.card-body { }
.card-footer {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Stat Card */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--ease);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  opacity: 0;
  transition: opacity var(--ease);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card:hover::before { opacity: 1; }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--r);
  background: var(--accent-light);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-content { flex: 1; min-width: 0; }
.stat-value {
  font-size: 1.875rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
  letter-spacing: -0.03em;
}
.stat-label { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.25rem; }
.stat-change {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--r-full);
  margin-top: 0.5rem;
  display: inline-block;
}
.stat-change.up   { background: var(--success-bg); color: var(--success); }
.stat-change.down { background: var(--danger-bg);  color: var(--danger); }

/* ============================================================
   6. BADGES & TAGS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--r-full);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge-primary { background: var(--accent-light); color: var(--accent); }
.badge-success { background: var(--success-bg);   color: var(--success); }
.badge-warning { background: var(--warning-bg);   color: var(--warning); }
.badge-danger  { background: var(--danger-bg);    color: var(--danger); }
.badge-info    { background: var(--info-bg);       color: var(--info); }
.badge-ghost   { background: var(--bg-hover);      color: var(--text-muted); }

/* ============================================================
   7. ALERTS / FLASH MESSAGES
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1.125rem;
  border-radius: var(--r);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  border: 1px solid;
  animation: slideDown 0.3s var(--ease-out);
}
.alert-icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-icon svg { width: 100%; height: 100%; }
.alert span:last-of-type:not(.alert-icon) { flex: 1; }
.alert-close {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  color: inherit;
  opacity: 0.6;
  padding: 0;
  margin-left: auto;
  line-height: 1;
}
.alert-close:hover { opacity: 1; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-color: color-mix(in srgb, var(--info) 30%, transparent); }

/* ============================================================
   8. FORMS
   ============================================================ */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 0.5625rem 0.875rem;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  outline: none;
  transition: all var(--ease);
  line-height: 1.5;
}
.form-control::placeholder { color: var(--text-light); }
.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
  background: var(--bg-card);
}
.form-control:disabled { opacity: 0.6; cursor: not-allowed; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.375rem; }
.form-error { font-size: 0.8125rem; color: var(--danger); margin-top: 0.375rem; }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(220,38,38,0.15); }
.form-row { display: grid; gap: 1rem; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ============================================================
   9. TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
thead {
  background: var(--bg-hover);
  position: sticky;
  top: 0;
  z-index: 1;
}
thead th {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--ease);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
tbody td {
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: var(--text);
  vertical-align: middle;
}
.td-actions { display: flex; gap: 0.375rem; align-items: center; }

/* ============================================================
   10. SIDEBAR — Dashboard Layout
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 100;
  transition: transform var(--ease-out), width var(--ease-out);
  overflow: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  text-decoration: none;
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo-icon svg { width: 20px; height: 20px; color: #fff; }
.sidebar-logo-text { font-weight: 700; font-size: 0.9375rem; color: #E6EDF3; line-height: 1.2; }
.sidebar-logo-sub  { font-size: 0.7rem; color: var(--sidebar-text); }

.sidebar-nav { flex: 1; padding: 1rem 0.75rem; overflow-y: auto; }
.nav-section { margin-bottom: 1.5rem; }
.nav-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(148,163,184,0.5);
  padding: 0 0.625rem;
  margin-bottom: 0.375rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5625rem 0.75rem;
  border-radius: var(--r);
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--ease);
  margin-bottom: 2px;
  position: relative;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; transition: opacity var(--ease); }
.nav-link:hover {
  background: var(--sidebar-hover);
  color: #E6EDF3;
}
.nav-link:hover svg { opacity: 1; }
.nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}
.nav-link.active svg { opacity: 1; color: var(--sidebar-active-text); }
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: var(--r-full);
}

.sidebar-user {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; overflow: hidden; }
.sidebar-user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #E6EDF3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 0.7rem;
  color: var(--sidebar-text);
  text-transform: capitalize;
}

/* ============================================================
   11. TOPBAR
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-xs);
}
.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }

/* Theme Toggle */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: var(--r);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all var(--ease);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.theme-toggle svg { width: 16px; height: 16px; }
.icon-sun  { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun  { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* Avatar / User Menu */
.user-avatar {
  width: 34px; height: 34px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--ease);
}
.user-avatar:hover { border-color: var(--accent); }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0.375rem;
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: none;
  animation: fadeIn 0.15s var(--ease-out);
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-size: 0.875rem;
  border-radius: var(--r-sm);
  transition: background var(--ease);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.dropdown-item svg { width: 15px; height: 15px; color: var(--text-muted); }
.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger svg { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 0.25rem 0; }

/* ============================================================
   12. PAGE LAYOUT
   ============================================================ */
.page-content { padding: 1.75rem 1.5rem; flex: 1; }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}
.page-title { font-size: 1.375rem; font-weight: 700; margin-bottom: 0.25rem; }
.page-subtitle { font-size: 0.875rem; color: var(--text-muted); }
.page-actions { display: flex; gap: 0.625rem; flex-wrap: wrap; }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

/* Content Grid */
.content-grid { display: grid; gap: 1.5rem; }
.content-grid-2 { grid-template-columns: 1fr 1fr; }
.content-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ============================================================
   13. MODALS
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.25s var(--ease-out);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg-card); z-index: 1;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.modal-title { font-size: 1.0625rem; font-weight: 600; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--r);
  border: none;
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.125rem;
  transition: all var(--ease);
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 0.625rem;
}
.modal-lg  { max-width: 720px; }
.modal-sm  { max-width: 400px; }

/* ============================================================
   14. SEARCH BAR
   ============================================================ */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box input {
  padding-left: 2.375rem;
  width: 280px;
}
.search-box .search-icon {
  position: absolute;
  left: 0.75rem;
  color: var(--text-light);
  width: 16px; height: 16px;
  pointer-events: none;
}

/* ============================================================
   15. EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 3.5rem 2rem;
  color: var(--text-muted);
}
.empty-state-icon {
  width: 64px; height: 64px;
  background: var(--bg-hover);
  border-radius: var(--r-xl);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
}
.empty-state-icon svg { width: 30px; height: 30px; color: var(--text-light); }
.empty-state h4 { font-size: 1rem; color: var(--text); margin-bottom: 0.5rem; }
.empty-state p  { font-size: 0.875rem; max-width: 320px; margin: 0 auto 1.25rem; }

/* ============================================================
   16. PAGINATION
   ============================================================ */
.pagination-wrap { display: flex; justify-content: center; padding: 1.25rem 0; }
.pagination { display: flex; gap: 0.25rem; }
.page-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--bg-card);
  text-decoration: none;
  transition: all var(--ease);
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ============================================================
   17. NAVBAR — LANDING PAGE
   ============================================================ */
.landing-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 2rem;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(226,232,240,0.8);
  transition: all var(--ease);
}
[data-theme="dark"] .landing-nav {
  background: rgba(13,17,23,0.85);
  border-bottom-color: rgba(48,54,61,0.8);
}
.landing-nav .nav-logo {
  display: flex; align-items: center; gap: 0.75rem; text-decoration: none; flex-shrink: 0;
}
.nav-logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
}
.nav-logo-icon svg { width: 18px; height: 18px; color: #fff; }
.nav-logo-name { font-weight: 800; font-size: 1rem; color: var(--text); }

.landing-nav .nav-menu { display: flex; align-items: center; gap: 0.25rem; flex: 1; }
.landing-nav .nav-menu a {
  padding: 0.4rem 0.875rem;
  border-radius: var(--r);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--ease);
}
.landing-nav .nav-menu a:hover { color: var(--text); background: var(--bg-hover); }

.landing-nav .nav-cta { display: flex; align-items: center; gap: 0.625rem; margin-left: auto; }

/* ============================================================
   18. LANDING PAGE SECTIONS
   ============================================================ */
.landing-main { padding-top: 64px; }

/* Hero */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem 5rem;
  position: relative;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(99,102,241,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(139,92,246,0.12) 0%, transparent 50%);
}
[data-theme="dark"] .hero-bg {
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(99,102,241,0.28) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(139,92,246,0.18) 0%, transparent 50%);
}
.hero-content { position: relative; z-index: 1; max-width: 780px; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.875rem;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: var(--r-full);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.hero h1 {
  font-size: clamp(2.25rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, var(--text) 0%, #6366F1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
[data-theme="dark"] .hero h1 {
  background: linear-gradient(135deg, #E6EDF3 0%, #818CF8 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
.hero p {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}
.hero-actions { display: flex; gap: 0.875rem; justify-content: center; flex-wrap: wrap; }
.hero-stats {
  margin-top: 3.5rem;
  display: flex;
  gap: 3rem;
  justify-content: center;
  flex-wrap: wrap;
}
.hero-stat-item { text-align: center; }
.hero-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.04em;
  display: block;
}
.hero-stat-label { font-size: 0.8125rem; color: var(--text-muted); }

/* Section Base */
.section { padding: 5rem 2rem; }
.section-inner { max-width: 1100px; margin: 0 auto; }
.section-header { text-align: center; margin-bottom: 3.5rem; }
.section-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}
.section-title { font-size: clamp(1.75rem, 4vw, 2.375rem); margin-bottom: 0.875rem; }
.section-subtitle { font-size: 1.0625rem; color: var(--text-muted); max-width: 520px; margin: 0 auto; line-height: 1.7; }

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 1.75rem;
  transition: all var(--ease);
}
.feature-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(99,102,241,0.3);
  transform: translateY(-3px);
}
.feature-icon {
  width: 48px; height: 48px;
  border-radius: var(--r-lg);
  background: var(--accent-light);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.125rem;
}
.feature-icon svg { width: 22px; height: 22px; }
.feature-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.feature-desc  { font-size: 0.875rem; color: var(--text-muted); line-height: 1.65; }

/* CTA Section */
.cta-section {
  padding: 6rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cta-inner {
  max-width: 600px;
  margin: 0 auto;
  position: relative; z-index: 1;
}
.cta-section .cta-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.08));
}
[data-theme="dark"] .cta-section .cta-bg {
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.15));
}

/* Footer Landing */
.landing-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 3rem 2rem 1.5rem;
}
.footer-inner { max-width: 1100px; margin: 0 auto; }
.footer-top { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 3rem; margin-bottom: 2.5rem; }
.footer-brand p { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.75rem; line-height: 1.7; max-width: 300px; }
.footer-col h5 { font-size: 0.875rem; font-weight: 600; margin-bottom: 0.875rem; }
.footer-col ul li { margin-bottom: 0.5rem; }
.footer-col ul li a { font-size: 0.875rem; color: var(--text-muted); transition: color var(--ease); }
.footer-col ul li a:hover { color: var(--accent); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 0.75rem;
  font-size: 0.8125rem; color: var(--text-muted);
}

/* ============================================================
   19. AUTH PAGES (Login / Register)
   ============================================================ */
.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.auth-panel-left {
  background: linear-gradient(135deg, #1E1B4B 0%, #312E81 40%, #4338CA 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem 3rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.auth-panel-left::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.auth-left-content { position: relative; z-index: 1; }
.auth-left-logo {
  display: flex; align-items: center; gap: 0.75rem;
  text-decoration: none; margin-bottom: 3rem;
}
.auth-left-logo-icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
}
.auth-left-logo-icon svg { width: 22px; height: 22px; color: #fff; }
.auth-left-logo-text { font-weight: 800; font-size: 1.0625rem; color: #fff; }
.auth-left-title { font-size: 2rem; font-weight: 800; color: #fff; letter-spacing: -0.03em; margin-bottom: 1rem; line-height: 1.2; }
.auth-left-subtext { font-size: 1rem; color: rgba(255,255,255,0.7); line-height: 1.7; }
.auth-left-features { margin-top: 2.5rem; display: flex; flex-direction: column; gap: 0.875rem; }
.auth-feature {
  display: flex; align-items: center; gap: 0.75rem;
  font-size: 0.9375rem; color: rgba(255,255,255,0.85);
}
.auth-feature-dot { width: 8px; height: 8px; border-radius: 50%; background: #818CF8; flex-shrink: 0; }

.auth-panel-right {
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  padding: 3rem 2rem;
  background: var(--bg);
  position: relative;
}
.auth-form-wrap { width: 100%; max-width: 420px; }
.auth-theme-toggle {
  position: absolute; top: 1.25rem; right: 1.25rem;
}
.auth-header { margin-bottom: 2rem; }
.auth-title    { font-size: 1.625rem; font-weight: 800; letter-spacing: -0.03em; }
.auth-subtitle { font-size: 0.9375rem; color: var(--text-muted); margin-top: 0.375rem; }
.auth-footer-link {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ============================================================
   20. UTILITIES
   ============================================================ */
.d-flex  { display: flex; }
.d-grid  { display: grid; }
.d-none  { display: none; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.ml-auto { margin-left: auto; }
.w-full  { width: 100%; }

.p-0 { padding: 0; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.divider { height: 1px; background: var(--border); margin: 1.25rem 0; }
.rounded-full { border-radius: var(--r-full); }
.overflow-hidden { overflow: hidden; }

/* ============================================================
   21. SCROLLBAR STYLE
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ============================================================
   22. ANIMATIONS
   ============================================================ */
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp  { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes slideDown{ from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes pulse    { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes spin     { to { transform: rotate(360deg); } }

.animate-pulse { animation: pulse 2s ease infinite; }
.animate-spin  { animation: spin 1s linear infinite; }
.animate-fade  { animation: fadeIn 0.4s var(--ease-out); }

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--border) 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ============================================================
   23. RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .content-grid-2 { grid-template-columns: 1fr; }
  .content-grid-3 { grid-template-columns: 1fr 1fr; }
  .footer-top { grid-template-columns: 1fr 1fr; }
  .auth-panel-left { display: none; }
  .auth-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar { padding: 0 1rem; }
  .page-content { padding: 1.25rem 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  .landing-nav .nav-menu { display: none; }
  .hero h1 { font-size: 2rem; }
  .hero p  { font-size: 1rem; }
  .section { padding: 3.5rem 1.25rem; }
  .hero-stats { gap: 2rem; }
  .features-grid { grid-template-columns: 1fr; }
  .footer-top { grid-template-columns: 1fr; gap: 2rem; }
  .content-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; justify-content: center; }
}
