/* ============================================================
   CLASSROOM AI — Design System
   Kenya Science & Engineering Fair · 62nd Edition
   ============================================================ */

/* ── Google Fonts ── */
@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600&display=swap");

/* ── Design Tokens ── */
:root {
  /* Colours */
  --bg-base: #efeae2;
  --bg-raised: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f2f5;
  --border: #e9edef;
  --border-hover: #d1d7db;

  --blue: #128c7e;
  --blue-light: #25d366;
  --blue-glow: rgba(37, 211, 102, 0.4);
  --cyan: #075e54;
  --cyan-light: #128c7e;
  --green: #25d366;
  --green-light: #1ebea5;
  --amber: #f2950a;
  --orange: #e53935;
  --red: #ef4444;
  --purple: #8b5cf6;

  /* Text */
  --text-primary: #111b21;
  --text-secondary: #3b4a54;
  --text-muted: #667781;

  /* Sidebar */
  --sidebar-w: 210px;
  --topbar-h: 64px;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-card: 0 2px 4px rgba(11, 20, 26, 0.08);
  --shadow-blue: 0 0 10px rgba(18, 140, 126, 0.2);

  /* Transitions */
  --t-fast: 0.15s ease;
  --t-med: 0.25s ease;
  --t-slow: 0.4s ease;

  /* Typography */
  --font-head: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
}

/* ── Base Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}
img {
  display: block;
  max-width: 100%;
}
button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
}
input,
select,
textarea {
  font: inherit;
}

/* ============================================================
   LAYOUT — Sidebar + Topbar + Main
   ============================================================ */

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--t-med);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}
.sidebar-brand-name {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.sidebar-brand-sub {
  font-size: 0.68rem;
  color: var(--cyan);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 10px 8px 4px;
  margin-top: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--t-fast);
  position: relative;
}

.nav-link i {
  width: 18px;
  text-align: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.nav-link:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-link.active {
  background: linear-gradient(
    135deg,
    rgba(29, 78, 216, 0.25),
    rgba(6, 182, 212, 0.1)
  );
  color: var(--cyan-light);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: linear-gradient(180deg, var(--blue-light), var(--cyan));
  border-radius: 0 3px 3px 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Topbar ── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  z-index: 100;
}

.topbar-toggle {
  display: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.topbar-title {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--green-light);
}

.live-dot {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.7);
  }
}

.topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all var(--t-fast);
}

.topbar-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 5px 14px 5px 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: white;
}

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 16px 20px 20px;
  min-height: calc(100vh - var(--topbar-h));
  flex: 1;
  width: calc(100% - var(--sidebar-w));
}

/* ============================================================
   COMPONENTS
   ============================================================ */

/* ── Glass Card ── */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  transition: all var(--t-med);
  position: relative;
}

.glass-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title i {
  color: var(--cyan);
}

/* ── Stat Card ── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  transition: all var(--t-med);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(6, 182, 212, 0.04));
  pointer-events: none;
}

.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-icon.blue {
  background: rgba(29, 78, 216, 0.15);
  color: var(--blue-light);
}
.stat-icon.cyan {
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan);
}
.stat-icon.green {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
}
.stat-icon.amber {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber);
}
.stat-icon.red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}
.stat-icon.purple {
  background: rgba(139, 92, 246, 0.15);
  color: var(--purple);
}

.stat-body {
  flex: 1;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  margin: 4px 0;
}

.stat-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stat-trend {
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
}
.stat-trend.up {
  color: var(--green);
}
.stat-trend.down {
  color: var(--red);
}

/* ── Behavior Badge ── */
.behavior-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid;
}

.behavior-badge.attentive {
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
}
.behavior-badge.engaged {
  color: #67e8f9;
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.25);
}
.behavior-badge.alert-b {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.25);
}
.behavior-badge.disengaged {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.25);
}
.behavior-badge.anxious {
  color: #fdba74;
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.25);
}
.behavior-badge.disruptive {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.25);
}
.behavior-badge.suspicious {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
}
.behavior-badge.confused {
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.25);
}

/* ── Meter / Progress Bar ── */
.meter-wrap {
  margin: 12px 0;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.8rem;
}

.meter-label span:first-child {
  color: var(--text-secondary);
}
.meter-label span:last-child {
  font-weight: 700;
  color: var(--text-primary);
}

.meter-track {
  height: 8px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.meter-fill.blue {
  background: linear-gradient(90deg, var(--blue), var(--blue-light));
}
.meter-fill.cyan {
  background: linear-gradient(90deg, var(--cyan), var(--cyan-light));
}
.meter-fill.green {
  background: linear-gradient(90deg, var(--green), var(--green-light));
}
.meter-fill.amber {
  background: linear-gradient(90deg, var(--amber), #fcd34d);
}
.meter-fill.red {
  background: linear-gradient(90deg, var(--red), #fca5a5);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-body);
  transition: all var(--t-fast);
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background: linear-gradient(135deg, var(--blue), #2563eb);
  color: white;
  box-shadow: 0 0 0 0 var(--blue-glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb, var(--blue-light));
  box-shadow: 0 0 24px var(--blue-glow);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--red), #dc2626);
  color: white;
}
.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-1px);
}

.btn-ghost {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn-success {
  background: linear-gradient(135deg, var(--green), #059669);
  color: white;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Event Log ── */
.event-log {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 340px;
  overflow-y: auto;
}

.event-log::-webkit-scrollbar {
  width: 4px;
}
.event-log::-webkit-scrollbar-track {
  background: transparent;
}
.event-log::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

.log-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  animation: logSlideIn 0.3s ease;
}

@keyframes logSlideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.log-item:last-child {
  border-bottom: none;
}

.log-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.log-dot.green {
  background: var(--green);
}
.log-dot.red {
  background: var(--red);
}
.log-dot.amber {
  background: var(--amber);
}
.log-dot.cyan {
  background: var(--cyan);
}
.log-dot.purple {
  background: var(--purple);
}

.log-body {
  flex: 1;
}
.log-text {
  font-size: 0.85rem;
  color: var(--text-primary);
}
.log-time {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Student Detection Card ── */
.detection-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--t-fast);
}

.detection-card:hover {
  border-color: var(--border-hover);
}

.detection-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.detection-info {
  flex: 1;
}
.detection-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}
.detection-score {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Canvas Container ── */
.canvas-container {
  position: relative;
  display: inline-block;
  border-radius: var(--radius-md);
  overflow: hidden;
  width: 100%;
}

.canvas-container video,
.canvas-container canvas {
  width: 100%;
  height: auto;
  display: block;
}

.canvas-container canvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

/* ── Video Container ── */
.video-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: rgba(0, 0, 0, 0.4);
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.video-placeholder i {
  font-size: 2.5rem;
  color: var(--border-hover);
}

/* ── Form Controls ── */
.form-group {
  margin-bottom: 20px;
}
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all var(--t-fast);
  outline: none;
}

.form-control:focus {
  border-color: var(--blue-light);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control option {
  background: var(--bg-raised);
}

/* ── Divider ── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ── Alert Box ── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 0.87rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.alert-info {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}
.alert-warn {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.25);
  color: #fcd34d;
}

/* ── Toast Notifications ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.87rem;
  min-width: 260px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast.success i {
  color: var(--green);
}
.toast.error i {
  color: var(--red);
}
.toast.info i {
  color: var(--cyan);
}

/* ── Grid Helpers ── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* ── Page Section ── */
.page-section {
  margin-bottom: 28px;
}

.section-title {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Loading Spinner ── */
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--blue-light);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.model-loading-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}
.model-loading-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  border-radius: 4px;
  animation: loadingAnim 2s ease-in-out infinite alternate;
}
@keyframes loadingAnim {
  from {
    width: 20%;
  }
  to {
    width: 90%;
  }
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state i {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.4;
}
.empty-state p {
  font-size: 0.9rem;
}

/* ── Table ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--bg-card);
  color: var(--text-secondary);
}

.data-table tr:hover td {
  background: var(--bg-card);
}

/* ── Range Input ── */
input[type="range"] {
  width: 100%;
  accent-color: var(--blue-light);
  cursor: pointer;
}

/* ── Switch Toggle ── */
.switch-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.switch-wrap:last-child {
  border-bottom: none;
}

.switch-info .switch-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  display: block;
  text-transform: none;
  letter-spacing: 0;
  margin: 0;
}
.switch-info .switch-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
}
.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--t-fast);
}
.toggle-slider::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform var(--t-fast);
}
.toggle input:checked + .toggle-slider {
  background: var(--blue);
}
.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ── Scrollbar Global ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* ── Utility ── */
.text-primary {
  color: var(--text-primary) !important;
}
.text-secondary {
  color: var(--text-secondary) !important;
}
.text-muted {
  color: var(--text-muted) !important;
}
.text-cyan {
  color: var(--cyan) !important;
}
.text-blue {
  color: var(--blue-light) !important;
}
.text-green {
  color: var(--green) !important;
}
.text-red {
  color: var(--red) !important;
}
.text-amber {
  color: var(--amber) !important;
}
.text-center {
  text-align: center;
}
.fw-bold {
  font-weight: 700;
}
.fw-semibold {
  font-weight: 600;
}
.font-head {
  font-family: var(--font-head);
}
.mt-0 {
  margin-top: 0;
}
.mt-8 {
  margin-top: 8px;
}
.mt-16 {
  margin-top: 16px;
}
.mt-24 {
  margin-top: 24px;
}
.mb-0 {
  margin-bottom: 0;
}
.mb-8 {
  margin-bottom: 8px;
}
.mb-16 {
  margin-bottom: 16px;
}
.mb-24 {
  margin-bottom: 24px;
}
.flex {
  display: flex;
}
.items-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.gap-8 {
  gap: 8px;
}
.gap-12 {
  gap: 12px;
}
.gap-16 {
  gap: 16px;
}
.w-full {
  width: 100%;
}

/* ── Entry page background ── */
.entry-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(
      ellipse 120% 80% at 50% 0%,
      rgba(29, 78, 216, 0.2) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse 80% 60% at 80% 100%,
      rgba(6, 182, 212, 0.1) 0%,
      transparent 50%
    ),
    var(--bg-base);
  z-index: 0;
}

.entry-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(29, 78, 216, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 78, 216, 0.07) 1px, transparent 1px);
  background-size: 64px 64px;
  z-index: 0;
  animation: gridScroll 30s linear infinite;
}

@keyframes gridScroll {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 64px 64px;
  }
}

/* ── Animations ── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.anim-fade-up {
  animation: fadeUp 0.6s ease both;
}
.anim-delay-1 {
  animation-delay: 0.1s;
}
.anim-delay-2 {
  animation-delay: 0.2s;
}
.anim-delay-3 {
  animation-delay: 0.3s;
}
.anim-delay-4 {
  animation-delay: 0.4s;
}
.anim-delay-5 {
  animation-delay: 0.5s;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .topbar {
    left: 0;
  }
  .topbar-toggle {
    display: flex;
  }
  .main-content {
    margin-left: 0;
    padding: 20px 16px 40px;
    width: 100%;
  }
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}
