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

/* ── Palette ─────────────────────────────────────── */
:root {
  --c-pink:    #F72585;
  --c-magenta: #B5179E;
  --c-purple:  #7209B7;
  --c-dpurple: #560BAD;
  --c-indigo:  #3F37C9;
  --c-blue:    #4895EF;
  --c-cyan:    #4CC9F0;
}

/* ── Light theme ─────────────────────────────────── */
[data-theme="light"] {
  --bg:           #F4F2FF;
  --surface:      #FFFFFF;
  --surface2:     #F0ECFF;
  --border:       rgba(86,11,173,0.12);
  --text-head:    #1A0A3E;
  --text-body:    #3A2A6E;
  --text-muted:   #7A6AAE;
  --sidebar-bg:   #560BAD;
  --sidebar-text: rgba(255,255,255,0.85);
  --sidebar-active: rgba(255,255,255,0.18);
  --topbar-bg:    rgba(255,255,255,0.95);
  --shadow:       0 2px 16px rgba(86,11,173,0.1);
  --grad:         linear-gradient(135deg, #F72585, #4CC9F0);
}

/* ── Dark theme ──────────────────────────────────── */
[data-theme="dark"] {
  --bg:           #0A0715;
  --surface:      #120D24;
  --surface2:     #1C1535;
  --border:       rgba(76,201,240,0.1);
  --text-head:    #F0E8FF;
  --text-body:    #C4B0F0;
  --text-muted:   #7A6AAE;
  --sidebar-bg:   #0E0A1E;
  --sidebar-text: rgba(255,255,255,0.6);
  --sidebar-active: rgba(76,201,240,0.12);
  --topbar-bg:    rgba(18,13,36,0.9);
  --shadow:       0 2px 20px rgba(0,0,0,0.4);
  --grad:         linear-gradient(135deg, #F72585, #7209B7, #4CC9F0);
}

/* ── Reset ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text-body);
  display: flex;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

/* ── 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: width 0.25s cubic-bezier(.4,0,.2,1), transform 0.25s;
  overflow: hidden;
}

.sidebar.collapsed { width: 64px; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 10px; overflow: hidden; }

.brand-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}

.brand-text {
  font-size: 15px; font-weight: 800;
  color: #fff; white-space: nowrap;
  transition: opacity 0.2s;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .user-info { opacity: 0; width: 0; overflow: hidden; }

.collapse-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: rgba(255,255,255,0.7);
  width: 28px; height: 28px;
  cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.15s;
}
.collapse-btn:hover { background: rgba(255,255,255,0.15); }

.nav {
  flex: 1; padding: 16px 10px;
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
}

.nav-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 8px 8px 4px; white-space: nowrap;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--sidebar-text); text-decoration: none;
  font-size: 14px; font-weight: 500;
  transition: all 0.15s; white-space: nowrap; cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-item.active { background: var(--grad); color: #fff; font-weight: 600; }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.user-card { display: flex; align-items: center; gap: 10px; }

.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 700; color: #fff; display: block; white-space: nowrap; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.45); white-space: nowrap; }

.logout-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  color: rgba(255,255,255,0.45); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.15s; margin-top: 6px; text-decoration: none;
}
.logout-btn:hover { background: rgba(247,37,133,0.15); color: var(--c-pink); }

/* ── Main ────────────────────────────────────────── */
.main {
  margin-left: 240px; flex: 1;
  display: flex; flex-direction: column; min-width: 0;
  background: var(--bg);
  overflow-y: auto; height: 100vh;
  transition: margin-left 0.25s cubic-bezier(.4,0,.2,1);
}
.main.expanded { margin-left: 64px; }

/* ── Topbar ──────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 14px; }

.menu-btn {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 6px; border-radius: 8px; display: none;
}
.menu-btn:hover { background: var(--surface2); color: var(--text-head); }

.page-title { font-size: 17px; font-weight: 800; color: var(--text-head); line-height: 1; }
.page-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: block; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; width: 38px; height: 38px;
  cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-head); transition: all 0.2s;
}
.theme-toggle:hover { border-color: var(--c-purple); }

[data-theme="dark"]  .sun-icon  { display: block; }
[data-theme="dark"]  .moon-icon { display: none; }
[data-theme="light"] .sun-icon  { display: none; }
[data-theme="light"] .moon-icon { display: block; }

.topbar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #fff;
}

/* ── Content ─────────────────────────────────────── */
.content {
  padding: 22px; display: flex; flex-direction: column;
  gap: 20px; background: var(--bg); padding-bottom: 60px;
}

/* ── Stat cards ──────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 20px; transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.stat-badge { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 9px; border-radius: 20px; }
.stat-value { font-size: 34px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.stat-bar { height: 4px; border-radius: 2px; background: var(--surface2); overflow: hidden; }
.stat-fill { height: 100%; border-radius: 2px; }

/* ── Section header ──────────────────────────────── */
.section-header {
  display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.section-title { font-size: 16px; font-weight: 700; color: var(--text-head); }
.section-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Chart ───────────────────────────────────────── */
.chart-section { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px; }
.chart-wrap { height: 280px; }
.legend { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.chart-subtitle { font-size: 13px; font-weight: 600; color: var(--text-head); margin-bottom: 12px; }

/* ── Table ───────────────────────────────────────── */
.table-section { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px; }
.table-controls { display: flex; gap: 10px; flex-wrap: wrap; }
.search-input, .filter-select {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 9px; padding: 8px 12px; color: var(--text-body);
  font-size: 13px; font-family: inherit; outline: none; transition: border-color 0.2s;
}
.search-input { width: 200px; }
.search-input:focus, .filter-select:focus { border-color: var(--c-purple); }
.search-input::placeholder { color: var(--text-muted); }
.table-wrap { overflow-x: auto; }
.student-table { width: 100%; border-collapse: collapse; min-width: 700px; }
.student-table thead tr { border-bottom: 1px solid var(--border); }
.student-table th { padding: 10px 14px; text-align: left; font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.student-table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
.student-table tbody tr:hover { background: var(--surface2); }
.student-table tbody tr:last-child { border-bottom: none; }
.student-table td { padding: 12px 14px; font-size: 13px; }
.row-risk { background: rgba(247,37,133,0.05); }
.row-risk:hover { background: rgba(247,37,133,0.09) !important; }
.student-cell { display: flex; align-items: center; gap: 10px; }
.student-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--c-indigo), var(--c-cyan)); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; }
.avatar-risk { background: linear-gradient(135deg, var(--c-pink), var(--c-magenta)); }
.student-name { font-weight: 600; color: var(--text-head); font-size: 13px; }
.mono { font-family: monospace; color: var(--text-muted); font-size: 12px; }
.score-cell { display: flex; flex-direction: column; gap: 4px; min-width: 70px; }
.score-cell span { font-weight: 500; color: var(--text-head); font-size: 12px; }
.mini-bar { height: 4px; border-radius: 2px; background: var(--surface2); overflow: hidden; }
.mini-fill { height: 100%; border-radius: 2px; }
.avg-badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.avg-good { background: rgba(76,201,240,0.12); color: var(--c-cyan); }
.avg-risk { background: rgba(247,37,133,0.12); color: var(--c-pink); }
.status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }
.badge-good { background: rgba(76,201,240,0.12); color: var(--c-cyan); border: 1px solid rgba(76,201,240,0.25); }
.badge-risk { background: rgba(247,37,133,0.12); color: var(--c-pink); border: 1px solid rgba(247,37,133,0.25); }
.no-results { text-align: center; padding: 40px; color: var(--text-muted); font-size: 14px; }
.clickable-row { cursor: pointer; transition: background 0.15s; }
.clickable-row:hover { background: var(--surface2) !important; outline: 1px solid var(--c-cyan); }
.clickable-row:hover .student-name { color: var(--c-cyan); }
.total-row { background: var(--surface2) !important; border-top: 2px solid var(--border) !important; }
.total-row td { padding: 12px 12px !important; }

/* ── Modal ───────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.7); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; width: 100%; max-width: 860px; max-height: 85vh; display: flex; flex-direction: column; overflow: hidden; transform: translateY(20px); transition: transform 0.25s; }
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 22px 24px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-title { font-size: 18px; font-weight: 800; color: var(--text-head); }
.modal-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; display: block; }
.modal-close { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; font-size: 14px; color: var(--text-muted); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.15s; }
.modal-close:hover { background: rgba(247,37,133,0.12); color: var(--c-pink); border-color: var(--c-pink); }
.modal-stats { display: flex; gap: 10px; flex-wrap: wrap; padding: 16px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.mpill { background: color-mix(in srgb, var(--mc) 12%, transparent); border: 1px solid color-mix(in srgb, var(--mc) 25%, transparent); border-radius: 10px; padding: 8px 14px; display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1; min-width: 90px; }
.mp-val { font-size: 18px; font-weight: 800; color: var(--mc); }
.mp-lbl { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.modal-table-wrap { flex: 1; overflow-y: auto; padding: 0 24px 16px; }
.modal-table { width: 100%; border-collapse: collapse; min-width: 700px; margin-top: 12px; }
.modal-table th { padding: 9px 12px; text-align: left; font-size: 9px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.modal-table td { padding: 10px 12px; font-size: 12px; border-bottom: 1px solid var(--border); }
.modal-table tbody tr:last-child td { border-bottom: none; }
.modal-table tbody tr:hover { background: var(--surface2); }
.modal-footer { padding: 12px 24px; border-top: 1px solid var(--border); flex-shrink: 0; }
.modal-note { font-size: 11px; color: var(--text-muted); }

/* ── Subject cards ───────────────────────────────── */
.subject-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.subject-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; transition: transform 0.2s; }
.subject-card:hover { transform: translateY(-2px); }
.subject-card.subj-risk { border-left: 3px solid var(--c-pink); }
.subj-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.subj-name { font-size: 14px; font-weight: 700; color: var(--text-head); display: block; }
.subj-code { font-size: 11px; color: var(--text-muted); font-family: monospace; margin-top: 2px; display: block; }
.subj-bars { display: flex; flex-direction: column; gap: 8px; }
.sbar-row { display: flex; align-items: center; gap: 8px; }
.sbar-lbl { font-size: 10px; color: var(--text-muted); width: 68px; flex-shrink: 0; }
.sbar { flex: 1; height: 5px; border-radius: 3px; background: var(--surface2); overflow: hidden; }
.sbar-fill { height: 100%; border-radius: 3px; }
.sbar-val { font-size: 11px; font-weight: 600; color: var(--text-body); width: 40px; text-align: right; }

/* ── Alert banner ────────────────────────────────── */
.alert-banner { display: flex; align-items: center; gap: 14px; background: rgba(247,37,133,0.08); border: 1px solid rgba(247,37,133,0.25); border-left: 4px solid var(--c-pink); border-radius: 12px; padding: 14px 18px; font-size: 13px; color: var(--text-body); flex-wrap: wrap; }
.alert-icon { font-size: 20px; flex-shrink: 0; }
.alert-banner div { flex: 1; line-height: 1.5; }
.alert-banner strong { color: var(--c-pink); }

/* ── Buttons ─────────────────────────────────────── */
.btn-primary { background: var(--grad); border: none; border-radius: 9px; padding: 9px 18px; color: #fff; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; transition: opacity 0.2s; display: inline-block; text-decoration: none; }
.btn-primary:hover { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 14px; color: var(--text-body); font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.15s; white-space: nowrap; }
.btn-sm:hover { border-color: var(--c-cyan); color: var(--c-cyan); }
.chip { background: var(--surface2); border: 1px solid var(--border); border-radius: 20px; padding: 5px 12px; font-size: 12px; color: var(--text-muted); cursor: pointer; font-family: inherit; transition: all 0.15s; }
.chip:hover { background: var(--c-purple); color: #fff; border-color: var(--c-purple); }

/* ── AI advice ───────────────────────────────────── */
.advice-context-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.ctx-subj-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; text-align: center; }
.ctx-subj-card.ctx-risk { border-color: rgba(247,37,133,0.3); background: rgba(247,37,133,0.04); }
.ctx-subj-name { font-size: 11px; font-weight: 600; color: var(--text-head); margin-bottom: 6px; }
.ctx-subj-avg  { font-size: 20px; font-weight: 800; margin-bottom: 3px; }
.ctx-subj-status { font-size: 10px; color: var(--text-muted); }
.advice-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; min-height: 180px; display: flex; align-items: center; justify-content: center; }
.advice-placeholder { text-align: center; }
.ai-icon { font-size: 36px; margin-bottom: 12px; }
.advice-placeholder p { font-size: 14px; color: var(--text-muted); max-width: 400px; line-height: 1.6; }
.advice-loading { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface2); border-top-color: var(--c-cyan); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.advice-loading p { font-size: 13px; color: var(--text-muted); }
.advice-result { font-size: 14px; color: var(--text-body); line-height: 1.8; width: 100%; }
.advice-result strong { color: var(--text-head); }

/* ── Bot bubble formatting ───────────────────────── */
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bot-bullet { padding: 3px 0 3px 10px; border-left: 2px solid var(--c-purple); margin: 4px 0; font-size: 13px; }
.bubble strong { color: var(--text-head); }

/* ── Tab panes ───────────────────────────────────── */
.tab-pane { display: none; flex-direction: column; gap: 20px; }
.tab-pane.active { display: flex; }

/* ── Auth pages ──────────────────────────────────── */
.auth-body { display: flex !important; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 40px; width: 100%; max-width: 420px; margin: 20px; }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-title { font-size: 22px; font-weight: 800; color: var(--text-head); margin-bottom: 4px; }
.auth-sub { font-size: 13px; color: var(--text-muted); }
.auth-error { background: rgba(247,37,133,0.1); border: 1px solid rgba(247,37,133,0.3); border-radius: 9px; padding: 10px 14px; font-size: 13px; color: var(--c-pink); margin-bottom: 16px; }
.auth-success { background: rgba(76,201,240,0.1); border: 1px solid rgba(76,201,240,0.3); border-radius: 9px; padding: 10px 14px; font-size: 13px; color: var(--c-cyan); margin-bottom: 16px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-switch { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 20px; }
.auth-link { color: var(--c-cyan); font-weight: 600; }
.auth-link:hover { text-decoration: underline; }
.field-hint { font-size: 11px; color: var(--text-muted); margin-top: 3px; display: block; }
.role-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 4px; }
.role-btn { background: var(--surface2); border: 1.5px solid var(--border); border-radius: 10px; padding: 10px; color: var(--text-muted); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.15s; }
.role-btn:hover { border-color: var(--c-purple); color: var(--text-head); }
.role-btn.active { background: rgba(114,9,183,0.15); border-color: var(--c-purple); color: var(--text-head); }

/* ── Form inputs ─────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.06em; text-transform: uppercase; }
.form-group input, .form-group select, .form-group textarea { background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; padding: 10px 13px; color: var(--text-body); font-size: 13px; font-family: inherit; outline: none; transition: border-color 0.2s; resize: none; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--c-purple); }
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-muted); }

/* ── Scrollbar ───────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Sticky topbar fix ──────────────────────────────────────── */
.chart-section,
.table-section {
	scroll-margin-top: 82px;
}

/* ── Mobile ──────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: 240px !important; }
  .sidebar.mobile-open { transform: translateX(0); }
  .main { margin-left: 0 !important; }
  .menu-btn { display: flex; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px; }
}
/* Mobile menu button position fix */
@media (max-width: 768px) {
  .topbar-left {
    gap: 8px;
  }
  .menu-btn {
    display: flex;
    flex-shrink: 0;
  }
}
.topbar-left > div:first-child {
  padding-left: 0;
}

.topbar {
  padding-left: 20px;
}

/* ── Profile picture inside avatar circles ──────────────────────────────── */
.user-avatar img,
.topbar-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* ── Student avatar pictures in faculty table ── */
.student-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}