/* ═══════════════════════════════════════════════
   TAZHEEB — MAIN STYLESHEET
   Covers: variables, base, layout, components
═══════════════════════════════════════════════ */

/* ── VARIABLES ───────────────────────────────── */
:root {
  --gold:   #C9A84C;
  --gold2:  #F0C060;
  --gold3:  #E8B84B;
  --glass:  rgba(255,255,255,0.12);
  --glass2: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.18);
  --border2:rgba(255,255,255,0.08);
  --blur:   blur(20px);
  --blur2:  blur(40px);
  --shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.12);
  --shadow2:0 20px 60px rgba(0,0,0,0.3);
  --rad:  16px;
  --rad2: 12px;
  --rad3: 8px;
  --trans: all 0.35s cubic-bezier(0.4,0,0.2,1);
}
.light {
  --bg:  #F8F6F1; --bg2: #EFF0EC; --bg3: #E4E2DB;
  --surface:  rgba(255,255,255,0.72);
  --surface2: rgba(255,255,255,0.52);
  --text: #1D2B3C; --text2: #3D4E5F; --text3: #6B7D8E;
  --accent: var(--gold);
  --glow: rgba(201,168,76,0.25);
  --sidebar-from: #141C26; --sidebar-to: #0A1018;
  --card:  rgba(255,255,255,0.76);
  --card2: rgba(255,255,255,0.55);
}
.dark {
  --bg:  #080D1A; --bg2: #0C1220; --bg3: #101828;
  --surface:  rgba(255,255,255,0.06);
  --surface2: rgba(255,255,255,0.03);
  --text: #EEF0F5; --text2: #A8B0C0; --text3: #5A6070;
  --accent: var(--gold2);
  --glow: rgba(240,192,96,0.2);
  --sidebar-from: #040810; --sidebar-to: #02060E;
  --card:  rgba(255,255,255,0.06);
  --card2: rgba(255,255,255,0.03);
}

/* ── BASE ────────────────────────────────────── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html {
  font-size: 16px;
  height: 100%;
  overflow: hidden;   /* root can never scroll */
}
body {
  font-family: 'Plus Jakarta Sans', 'Lexend', 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: var(--trans);
  overflow: hidden;
  height: 100vh;
  max-height: 100vh;
  display: flex;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }
select { appearance: none; -webkit-appearance: none; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(201,168,76,0.3); border-radius: 3px; }

/* ── ICON SYSTEM ─────────────────────────────── */
.lucide, .icon-xs, .icon-sm, .icon-md, .icon-lg, .icon-xl {
  stroke: currentColor; fill: none;
  vertical-align: middle; flex-shrink: 0; display: inline-block;
}
.icon-xs { width:12px; height:12px; stroke-width:2; }
.icon-sm { width:15px; height:15px; stroke-width:2; }
.icon-md { width:18px; height:18px; stroke-width:1.8; }
.icon-lg { width:22px; height:22px; stroke-width:1.75; }
.icon-xl { width:26px; height:26px; stroke-width:1.6; }

/* ── SIDEBAR ─────────────────────────────────── */
#sidebar {
  width: 240px; min-width: 240px;
  height: 100vh; position: relative;
  background: linear-gradient(180deg, var(--sidebar-from), var(--sidebar-to));
  border-right: 1px solid rgba(201,168,76,0.2);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: width 0.32s cubic-bezier(0.4,0,0.2,1),
              min-width 0.32s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}
#sidebar.collapsed { width: 68px; min-width: 68px; }
#penrose-canvas { position: absolute; inset: 0; opacity: 0.45; pointer-events: none; }

/* ── SIDEBAR NAV ITEMS ───────────────────────── */
.sb-nav {
  flex: 1; padding: 12px 8px;
  display: flex; flex-direction: column; gap: 4px;
  position: relative; z-index: 2;
  overflow-y: auto; overflow-x: hidden;
}
.sb-nav::-webkit-scrollbar { width: 4px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(201,168,76,0.25); border-radius: 2px; }

.sb-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--rad3);
  cursor: pointer; transition: var(--trans);
  position: relative; white-space: nowrap;
  color: rgba(240,232,208,0.7);
  overflow: hidden;
}
.sb-item:hover  { background: rgba(201,168,76,0.12); color: rgba(240,232,208,0.95); }
.sb-item.active { background: rgba(201,168,76,0.2); box-shadow: 0 0 20px rgba(201,168,76,0.15); color: #F0E8D0; }
.sb-item.active::before {
  content: ''; position: absolute;
  left: 0; top: 20%; height: 60%; width: 3px;
  background: var(--gold); border-radius: 0 3px 3px 0;
}

/* Icon container — always visible, centered when collapsed */
.sb-icon {
  flex-shrink: 0; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--trans);
}
.sb-item:hover .sb-icon, .sb-item.active .sb-icon { transform: scale(1.12); }

/* Label — fades out and takes no space when collapsed */
.sb-label {
  font-size: 13.5px; font-weight: 400;
  opacity: 1; max-width: 160px;
  transition: opacity 0.22s ease, max-width 0.28s ease;
  overflow: hidden; white-space: nowrap;
}
.sb-item.active .sb-label { font-weight: 500; }
#sidebar.collapsed .sb-label {
  opacity: 0; max-width: 0;
  pointer-events: none;
}

/* Centre icons when collapsed */
#sidebar.collapsed .sb-item {
  justify-content: center;
  padding: 10px 0;
}
#sidebar.collapsed .sb-item.active::before { display: none; }

/* Section dividers */
.sb-section {
  color: rgba(201,168,76,0.5); font-size: 10px; font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  padding: 10px 14px 4px;
  overflow: hidden; white-space: nowrap;
  opacity: 1; max-height: 28px;
  transition: opacity 0.22s ease, max-height 0.28s ease, padding 0.22s ease;
}
/* collapsed-show: section stays in DOM but hides as thin divider */
.sb-section.collapsed-show,
#sidebar:not(.collapsed) .sb-section { opacity: 1; max-height: 28px; }
#sidebar.collapsed .sb-section.collapsed-show {
  opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0;
  pointer-events: none;
}

/* Legacy collapsed-hide alias (keep for safety) */
#sidebar.collapsed .collapsed-hide { display: none; }

.sb-footer {
  padding: 12px 8px; position: relative; z-index: 2;
  border-top: 1px solid rgba(201,168,76,0.1);
}

/* ── MAIN LAYOUT ─────────────────────────────── */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
#topbar {
  height: 64px; display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  background: var(--surface); backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 50; flex-shrink: 0;
}
.topbar-title { font-size: 17px; font-weight: 600; color: var(--text); flex: 1; }
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 50px; padding: 7px 16px;
  cursor: text; transition: var(--trans); color: var(--text3);
}
.topbar-search:hover, .topbar-search:focus-within {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow);
}
.topbar-search input {
  background: none; border: none; outline: none;
  color: var(--text); font-family: inherit; font-size: 13.5px; width: 160px;
}
.topbar-search input::placeholder { color: var(--text3); }
.tb-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--trans); position: relative;
  background: var(--surface); border: 1px solid var(--border); color: var(--text2);
}
.tb-btn:hover { background: var(--card); border-color: var(--accent); box-shadow: 0 0 12px var(--glow); color: var(--text); }
.tb-btn .notif-badge {
  position: absolute;
  top: 1px; right: 1px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 20px;
  background: var(--gold);
  border: 2px solid var(--bg);
  display: none;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  line-height: 12px;
  text-align: center;
  letter-spacing: -0.3px;
}
.theme-toggle {
  width: 56px; height: 28px; border-radius: 50px; cursor: pointer;
  transition: var(--trans); background: var(--surface);
  border: 1px solid var(--border); position: relative;
  display: flex; align-items: center; padding: 3px;
}
.theme-toggle::after {
  content: ''; width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.dark .theme-toggle::after { transform: translateX(28px); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #8B6914);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; color: #1A1205; font-size: 14px;
  cursor: pointer; border: 2px solid var(--gold); transition: var(--trans);
}
.avatar:hover { box-shadow: 0 0 16px var(--glow); transform: scale(1.06); }

/* ── CONTENT AREA ────────────────────────────── */
#content { flex: 1; overflow-y: auto; padding: 28px; position: relative; }
.page { display: none; animation: fadeIn 0.4s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

/* ── GLASS CARDS ─────────────────────────────── */
.glass-card {
  background: var(--card); backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--rad);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
  transition: var(--trans);
}
.glass-card:hover { border-color: rgba(201,168,76,0.3); box-shadow: 0 8px 28px rgba(201,168,76,0.1), 0 2px 8px rgba(0,0,0,0.08); }
.glass-card2 {
  background: var(--card2); backdrop-filter: blur(12px);
  border: 1px solid var(--border2); border-radius: var(--rad2);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08); transition: var(--trans);
}

/* ── GRID LAYOUTS ────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }

/* ── STAT CARDS ──────────────────────────────── */
.stat-card {
  padding: 24px; cursor: default;
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.05), 0 1px 4px rgba(0,0,0,0.04);
}
.stat-icon-wrap {
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(201,168,76,0.1); border: 1px solid rgba(201,168,76,0.2);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; color: var(--accent);
}
.stat-label { font-size: 11.5px; color: var(--text3); font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase; margin-bottom: 8px; }
.stat-value { font-size: 30px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; }
.stat-note  { font-size: 12px; margin-top: 8px; color: var(--text3); line-height: 1.4; }

/* ── PAGE HEADERS ────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title  { font-size: 18px; font-weight: 700; color: var(--text); }
/* Admin dashboard title gets extra prominence */
#page-dashboard > .section-header .section-title,
#page-student-dashboard > .section-header .section-title {
  font-size: 22px; font-weight: 700;
}
.section-sub    { font-size: 13px; color: var(--text2); font-weight: 400; }
.section-action { font-size: 13px; color: var(--accent); cursor: pointer; font-weight: 500; transition: var(--trans); }
.section-action:hover { opacity: 0.8; }
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 24px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.page-header p  { font-size: 14px; color: var(--text2); }

/* ── PROGRESS ────────────────────────────────── */
.progress-bar  { height: 6px; border-radius: 3px; background: var(--surface); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--gold), var(--gold2)); transition: width 1s ease; }

/* ── BADGES ──────────────────────────────────── */
.badge        { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 50px; font-size: 11px; font-weight: 600; }
.badge-gold   { background: rgba(201,168,76,0.2);  color: var(--gold);  border: 1px solid rgba(201,168,76,0.3); }
.badge-green  { background: rgba(76,175,80,0.15);  color: #4CAF50; border: 1px solid rgba(76,175,80,0.25); }
.badge-blue   { background: rgba(64,120,220,0.15); color: #6090E0; border: 1px solid rgba(64,120,220,0.25); }
.badge-red    { background: rgba(220,64,64,0.15);  color: #E06060; border: 1px solid rgba(220,64,64,0.25); }
.badge-gray   { background: rgba(120,120,130,0.15);color: var(--text3); border: 1px solid rgba(120,120,130,0.2); }

/* ── EMPTY STATES ────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 64px 24px; color: var(--text3); text-align: center;
}
.empty-icon {
  width: 52px; height: 52px; stroke: var(--text3); opacity: 0.22;
  margin-bottom: 20px; flex-shrink: 0;
}
.empty-title { font-size: 15px; font-weight: 600; color: var(--text2); margin-bottom: 8px; }
.empty-sub   { font-size: 13px; color: var(--text3); max-width: 280px; line-height: 1.6; }

/* ── TABLES ──────────────────────────────────── */
.data-table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: 11.5px; font-weight: 600; color: var(--text3);
  letter-spacing: 0.5px; text-transform: uppercase;
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 13px 14px; font-size: 13.5px; color: var(--text);
  border-bottom: 1px solid var(--border2); transition: var(--trans);
}
.data-table tr:hover td { background: rgba(201,168,76,0.04); }
.student-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px; margin-right: 10px; vertical-align: middle;
}

/* ── FORMS ───────────────────────────────────── */
.form-group   { margin-bottom: 16px; }
.form-label   { font-size: 12.5px; font-weight: 500; color: var(--text2); margin-bottom: 6px; display: block; }
.form-input {
  width: 100%; padding: 12px 16px; border-radius: var(--rad2);
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--text); font-family: inherit; font-size: 14px;
  outline: none; transition: var(--trans);
}
.form-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--glow); }
.form-input::placeholder { color: var(--text3); }
select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23C9A84C' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
.input-icon-wrap { position: relative; display: flex; align-items: center; }
.input-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text3); pointer-events: none; z-index: 1; flex-shrink: 0; }
.input-icon-wrap .form-input { padding-left: 40px; }
.form-divider {
  font-size: 11px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text3);
  padding: 14px 0 10px;
  border-top: 1px solid var(--border2);
  margin-top: 6px;
}

/* ── BUTTONS ─────────────────────────────────── */
.btn-primary {
  width: 100%; padding: 13px; border-radius: var(--rad2); border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  color: #1A1205; font-family: inherit; font-size: 14.5px; font-weight: 600;
  transition: var(--trans); letter-spacing: 0.3px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px var(--glow); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  padding: 10px 18px; border-radius: var(--rad2);
  border: 1px solid var(--border); background: var(--card);
  color: var(--text); font-family: inherit; font-size: 13px;
  cursor: pointer; transition: var(--trans);
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon {
  width: 30px; height: 30px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--card2);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text2); transition: var(--trans);
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon.danger:hover { border-color: rgba(220,64,64,0.5); color: #E06060; background: rgba(220,64,64,0.08); }

/* ── FILTER CHIPS ────────────────────────────── */
.filter-chip {
  padding: 7px 16px; border-radius: 50px;
  border: 1px solid var(--border); background: var(--card2);
  color: var(--text2); font-family: inherit; font-size: 13px;
  cursor: pointer; transition: var(--trans);
}
.filter-chip:hover { border-color: var(--accent); color: var(--text); }
.filter-chip.active-chip { border-color: var(--gold); background: rgba(201,168,76,0.15); color: var(--gold); }
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 50px; padding: 8px 16px; transition: var(--trans); color: var(--text3);
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow); }
.search-bar input { background: none; border: none; outline: none; color: var(--text); font-family: inherit; font-size: 13.5px; flex: 1; }
.search-bar input::placeholder { color: var(--text3); }

/* ── VIEW TOGGLE ─────────────────────────────── */
.view-toggle { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.view-toggle-btn {
  padding: 7px 12px; background: none; border: none; cursor: pointer;
  color: var(--text3); display: flex; align-items: center; transition: var(--trans);
}
.view-toggle-btn.active { background: rgba(201,168,76,0.15); color: var(--gold); }

/* ── MODAL ───────────────────────────────────── */
#modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.45); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; padding: 20px;
}
#modal-overlay.open { display: flex !important; }
.modal {
  width: 100%; max-width: 580px; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  animation: fadeInUp 0.25s ease;
}
.modal-header {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 600; color: var(--text); }
.modal-close {
  background: none; border: none; cursor: pointer; color: var(--text3);
  padding: 4px; display: flex; align-items: center;
  border-radius: 6px; transition: var(--trans);
}
.modal-close:hover { background: var(--surface); color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0;
}
@keyframes fadeInUp { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:none; } }

/* ── TOAST ───────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9000;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; border-radius: 12px;
  background: var(--card); backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(0,0,0,0.16), 0 4px 12px rgba(0,0,0,0.1);
  font-size: 13.5px; font-weight: 500; color: var(--text);
  pointer-events: all;
  animation: slideInRight 0.3s cubic-bezier(0.4,0,0.2,1);
  min-width: 240px; max-width: 360px;
}
.toast.success { border-color: rgba(76,175,80,0.4);  background: rgba(255,255,255,0.95); }
.toast.error   { border-color: rgba(220,64,64,0.4);  background: rgba(255,255,255,0.95); }
.toast.info    { border-color: rgba(201,168,76,0.4); background: rgba(255,255,255,0.95); }
.dark .toast   { background: var(--card); }
@keyframes slideInRight { from { opacity:0; transform:translateX(28px); } to { opacity:1; transform:none; } }

/* ── NOTIFICATION PANEL ──────────────────────── */
#notif-panel {
  position: fixed; top: 70px; right: 20px; width: 360px; z-index: 200;
  background: var(--card); backdrop-filter: var(--blur2);
  border: 1px solid var(--border); border-radius: var(--rad);
  box-shadow: var(--shadow2); display: none; animation: slideDown 0.25s ease;
}
@keyframes slideDown { from { opacity:0; transform:translateY(-10px); } to { opacity:1; transform:none; } }
/* ── NOTIFICATION PANEL HEADER ───────────────── */
.notif-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  flex-shrink: 0;
}

/* ── NOTIFICATION ITEMS (rich, typed) ────────── */
.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border2);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}
.notif-item:hover { background: rgba(201,168,76,0.05); }

/* Unread state — subtle gold tint */
.notif-item.notif-unread {
  background: rgba(201,168,76,0.07);
}
.notif-item.notif-unread::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gold);
  border-radius: 0 2px 2px 0;
}

/* Inner flex row: icon/avatar + body */
.notif-item-inner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

/* Circular icon (for system notification types) */
.notif-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}
.notif-icon-task     { background: rgba(201,168,76,0.15); color: var(--gold); }
.notif-icon-chat     { background: rgba(47,158,222,0.15); color: #2F9EDE; }
.notif-icon-approved { background: rgba(34,197,94,0.14);  color: #22c55e; }
.notif-icon-done     { background: rgba(201,168,76,0.2);  color: var(--gold); }

/* Profile picture avatar (for student-related notifications) */
.notif-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  -webkit-user-drag: none;
}
.notif-avatar-init {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gold);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

/* Text body */
.notif-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.notif-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.notif-sub {
  font-size: 12px;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notif-time {
  font-size: 11px;
  color: var(--text3);
  opacity: 0.75;
  margin-top: 3px;
}

/* Coloured pill tag (e.g. "Report") */
.notif-tag {
  background: rgba(201,168,76,0.15);
  color: var(--gold);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* Gold star for high-priority report notifications */
.notif-star {
  position: absolute;
  top: 10px;
  right: 14px;
  color: #f59e0b;
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
}

/* ── PROFILE DROPDOWN (replaces side panel) ──── */
.profile-dropdown {
  position: fixed; top: 64px; right: 14px; z-index: 400;
  width: 230px;
  background: var(--card); backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.22), 0 2px 8px rgba(0,0,0,0.12),
              inset 0 1px 0 rgba(255,255,255,0.1);
  overflow: hidden;
  /* Hidden by default */
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(-8px) scale(0.97);
  transform-origin: top right;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
.profile-dropdown.open {
  opacity: 1; visibility: visible; pointer-events: all;
  transform: translateY(0) scale(1);
}
.pd-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 16px 14px;
  background: linear-gradient(135deg, rgba(201,168,76,0.1), rgba(201,168,76,0.04));
}
.pd-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold), #8B6914);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #1A1205; font-size: 15px;
  border: 2px solid rgba(201,168,76,0.6);
}
.pd-info { min-width: 0; }
.pd-name { font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-role { font-size: 11.5px; color: var(--text3); margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.pd-divider { height: 1px; background: var(--border); margin: 2px 0; }
.pd-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; background: none; border: none;
  font-family: inherit; font-size: 13.5px; color: var(--text2);
  cursor: pointer; transition: all 0.15s; text-align: left;
}
.pd-item:hover { background: rgba(201,168,76,0.08); color: var(--text); }
.pd-danger { color: #E06060; }
.pd-danger:hover { background: rgba(220,64,64,0.08) !important; color: #E06060; }

/* Keep legacy profile-avatar-lg for any refs */
.profile-avatar-lg {
  width: 50px; height: 50px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #8B6914);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #1A1205; font-size: 18px; border: 2px solid var(--gold);
}

/* ── SETTINGS ────────────────────────────────── */
.settings-section { margin-bottom: 28px; }
.settings-section-title {
  font-size: 13px; font-weight: 600; color: var(--text3);
  letter-spacing: 0.8px; text-transform: uppercase; margin-bottom: 14px;
}
.settings-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--card);
  border: 1px solid var(--border2); border-radius: var(--rad2);
  margin-bottom: 8px; transition: var(--trans);
}
.settings-item:hover { border-color: var(--border); }
.settings-item-left { display: flex; flex-direction: column; gap: 3px; }
.settings-item-label { font-size: 14px; font-weight: 500; color: var(--text); }
.settings-item-desc  { font-size: 12px; color: var(--text3); }
.toggle-switch {
  width: 44px; height: 24px; border-radius: 50px;
  background: var(--border); position: relative; cursor: pointer; transition: var(--trans);
}
.toggle-switch.on { background: var(--gold); }
.toggle-switch::after {
  content: ''; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; position: absolute;
  top: 3px; left: 3px; transition: var(--trans);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.toggle-switch.on::after { transform: translateX(20px); }

/* ── CHAT ────────────────────────────────────── */
.chat-layout {
  display: grid; grid-template-columns: 280px 1fr; gap: 0;
  border-radius: var(--rad); overflow: hidden; border: 1px solid var(--border);
}
.chat-sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.chat-search  { padding: 16px; border-bottom: 1px solid var(--border2); }
.chat-list    { flex: 1; overflow-y: auto; }
.chat-list::-webkit-scrollbar { width: 4px; }
.chat-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.chat-item {
  display: flex; gap: 12px; padding: 14px 16px;
  cursor: pointer; transition: var(--trans);
  border-bottom: 1px solid var(--border2);
}
.chat-item:hover, .chat-item.active { background: rgba(201,168,76,0.08); }
.chat-avatar  { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex-shrink: 0; }
.chat-info    { flex: 1; min-width: 0; }
.chat-name    { font-size: 13.5px; font-weight: 500; color: var(--text); }
.chat-preview { font-size: 12px; color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.chat-time    { font-size: 11px; color: var(--text3); }
.chat-main    { display: flex; flex-direction: column; background: var(--bg2); }
.chat-header  { padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; gap: 12px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.msg { max-width: 70%; display: flex; flex-direction: column; gap: 4px; }
.msg.sent { align-self: flex-end; align-items: flex-end; }
.msg.recv { align-self: flex-start; align-items: flex-start; }
.msg-bubble { padding: 10px 14px; border-radius: 16px; font-size: 13.5px; line-height: 1.5; }
.msg.sent .msg-bubble { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #1A1205; border-radius: 16px 16px 4px 16px; }
.msg.recv .msg-bubble { background: var(--card); border: 1px solid var(--border); color: var(--text); border-radius: 16px 16px 16px 4px; }
.msg-time     { font-size: 10.5px; color: var(--text3); }
.chat-input-bar {
  padding: 16px 20px; border-top: 1px solid var(--border);
  background: var(--surface); display: flex; gap: 12px; align-items: center;
}
.chat-input {
  flex: 1; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 50px; padding: 10px 18px; outline: none;
  color: var(--text); font-family: inherit; font-size: 13.5px; transition: var(--trans);
}
.chat-input:focus { border-color: var(--gold); }
.send-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  border: none; cursor: pointer; display: flex;
  align-items: center; justify-content: center; color: #1A1205; transition: var(--trans);
}
.send-btn:hover { transform: scale(1.1); box-shadow: 0 4px 16px var(--glow); }
.chat-no-select { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text3); }

/* ── METRIC RINGS ────────────────────────────── */
.metric-ring  { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ring-svg     { transform: rotate(-90deg); }

/* ── STAGE ROWS (Kitaab form) ────────────────── */
.stage-rows { display: flex; flex-direction: column; gap: 8px; }
.stage-row {
  display: grid; grid-template-columns: 24px 1fr 1.4fr; gap: 10px;
  align-items: center; padding: 8px 10px;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--rad3); transition: var(--trans);
}
.stage-row:hover { border-color: rgba(201,168,76,0.2); }
.stage-num  { font-size: 11px; font-weight: 600; color: var(--text3); text-align: right; }
.stage-name { font-size: 13px; font-weight: 500; color: var(--text); }
.stage-row select.form-input { padding: 7px 32px 7px 12px; font-size: 12.5px; margin: 0; }
.stage-row-status { display: flex; align-items: center; gap: 6px; }

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar { display: none; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  #sidebar { display: none; }
  #content { padding: 16px; }
}

/* ═══════════════════════════════════════════════
   ADDITIONS — Layout, components, fixes
═══════════════════════════════════════════════ */

/* Fix #main to be flex row (sidebar + app-inner) */
#main { flex: 1; display: flex; flex-direction: row; overflow: hidden; }
#app-inner { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ── TOPBAR (new structure) ──────────────────── */
#topbar {
  height: 64px; display: flex; align-items: center;
  padding: 0 24px; gap: 16px; flex-shrink: 0;
  background: var(--card); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 50;
}
.topbar-left  { flex: 1; display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-page-title {
  font-size: 15px; font-weight: 600; color: var(--text);
  letter-spacing: -0.1px;
}
.topbar-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .2s; position: relative;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text2);
}
.topbar-btn:hover { background: var(--card); border-color: var(--gold); color: var(--text); box-shadow: 0 0 10px var(--glow); }
.notif-btn-wrap { position: relative; }
.notif-badge {
  position: absolute; top: -2px; right: -2px;
  min-width: 17px; height: 17px; border-radius: 50px; padding: 0 4px;
  background: var(--gold); color: #fff; font-size: 10px;
  font-weight: 700; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
}
.topbar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #8B6914);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #1A1205; font-size: 13px;
  cursor: pointer; border: 2px solid rgba(201,168,76,0.5); transition: all .2s;
}
.topbar-avatar:hover { box-shadow: 0 0 14px var(--glow); transform: scale(1.05); }

/* ── CONTENT AREA ────────────────────────────── */
#content { flex: 1; overflow-y: auto; padding: 28px 32px 48px; }
.page { display: none; animation: fadeIn 0.4s ease; }
.page.active { display: block; }

/* ── SIDEBAR NEW CLASSES ─────────────────────── */
.sidebar-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 14px 14px; position: relative; z-index: 2;
  border-bottom: 1px solid rgba(201,168,76,0.12);
  flex-shrink: 0; overflow: hidden;
  transition: padding 0.28s ease;
}
/* When collapsed, centre the logo and still show the toggle */
#sidebar.collapsed .sidebar-top {
  justify-content: center;
  padding: 16px 6px 14px;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; overflow: hidden; flex: 1; }
.sidebar-logo {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold), #8B6914);
  display: flex; align-items: center; justify-content: center;
}
.sidebar-brand-text {
  color: #F0E8D0; font-size: 16px; font-weight: 600;
  white-space: nowrap; overflow: hidden;
  opacity: 1; max-width: 120px;
  transition: opacity 0.22s ease, max-width 0.28s ease;
}
#sidebar.collapsed .sidebar-brand-text {
  opacity: 0; max-width: 0; pointer-events: none;
}

/* Collapse button — ALWAYS visible, floats to right */
.sidebar-collapse-btn {
  background: none; border: none; cursor: pointer;
  color: rgba(201,168,76,0.6);
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
  transition: all .2s;
  position: relative; z-index: 3;
}
.sidebar-collapse-btn:hover { color: var(--gold); background: rgba(201,168,76,0.14); }
/* When collapsed: reposition as centred icon below the logo */
#sidebar.collapsed .sidebar-top { flex-direction: column; gap: 10px; }
#sidebar.collapsed .sidebar-brand { justify-content: center; flex: none; }
#sidebar.collapsed .sidebar-collapse-btn { margin: 0; }

.sidebar-nav { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; overflow-x: hidden; position: relative; z-index: 2; }
.sidebar-footer {
  padding: 12px 10px; border-top: 1px solid rgba(201,168,76,0.1);
  position: relative; z-index: 2; overflow: hidden;
}
.sidebar-user-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px;
  transition: justify-content 0.28s;
}
#sidebar.collapsed .sidebar-user-row { justify-content: center; }
.sidebar-user-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold), #8B6914);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #1A1205; font-size: 12px;
}
.sidebar-user-info {
  overflow: hidden;
  opacity: 1; max-width: 140px;
  transition: opacity 0.22s ease, max-width 0.28s ease;
}
.sidebar-user-name { font-size: 12px; font-weight: 600; color: rgba(240,232,208,0.9); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: rgba(201,168,76,0.7); margin-top: 1px; }
#sidebar.collapsed .sidebar-user-info { opacity: 0; max-width: 0; pointer-events: none; }

/* ── BUTTON WIDTH FIX ────────────────────────── */
.btn-primary { width: auto; }
.btn-primary.full { width: 100%; }

/* ── SEARCH / TABLE wrappers ─────────────────── */
.search-wrap { position: relative; display: inline-flex; }
.search-inp {
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card2, var(--card)); color: var(--text); font-family: inherit;
  font-size: 13px; outline: none; width: 200px; transition: all .2s;
}
.search-inp:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--glow); }
.search-inp::placeholder { color: var(--text3); }
.table-wrap { overflow-x: auto; background: var(--card); border-radius: 14px; border: 1px solid var(--border); }

/* ── STATS GRID ──────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 24px; }
/* Base stat-card sizing — override from component section above applies padding: 24px */
.stat-card {
  background: var(--card); border-radius: 16px;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.stat-card:hover {
  box-shadow: 0 6px 24px rgba(201,168,76,0.12), 0 2px 8px rgba(0,0,0,0.06);
  border-color: rgba(201,168,76,0.3);
}
@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(2,1fr); } }

/* ── VIEW TOGGLE ─────────────────────────────── */
.view-toggle { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--card2,var(--card)); }
.view-btn { padding: 7px 11px; background: none; border: none; cursor: pointer; color: var(--text3); display: flex; align-items: center; transition: all .15s; }
.view-btn.active, .view-btn:hover { background: rgba(201,168,76,0.14); color: var(--gold); }

/* ── SETTINGS CARD ───────────────────────────── */
.settings-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
.settings-card-title { font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: 0.4px; text-transform: uppercase; margin-bottom: 16px; color: var(--text3); }
.settings-sub { font-size: 12.5px; color: var(--text3); margin-top: -10px; margin-bottom: 6px; line-height: 1.5; }
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border2, rgba(255,255,255,0.06)); gap: 16px; }
.settings-row:last-child { border-bottom: none; }
.settings-label { font-size: 13px; color: var(--text2); font-weight: 500; }
.settings-value { font-size: 13px; color: var(--text); font-weight: 600; }
.year-editor-row { display: flex; align-items: center; gap: 8px; }

/* ── FILE UPLOAD ZONE ────────────────────────── */
.file-drop-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
}
.file-drop-zone:hover { border-color: var(--gold); background: rgba(201,168,76,0.05); }
.file-drop-label { font-size: 13px; color: var(--text2); font-weight: 500; }
.file-drop-types { font-size: 11px; color: var(--text3); }

/* Existing file preview inside form */
.file-existing {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
}
.file-existing-info { flex: 1; min-width: 0; }
.file-existing-name { font-size: 12.5px; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-existing-type { font-size: 11px; color: var(--text3); margin-top: 2px; }
.file-mini-thumb { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.file-type-icon {
  width: 48px; height: 48px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.file-type-icon.pdf-icon { background: rgba(220,60,60,0.12); color: #DC3C3C; }
.file-type-icon.ai-icon  { background: rgba(255,153,0,0.12);  color: #FF9900; }
.file-type-icon.img-icon { background: rgba(201,168,76,0.12); color: var(--gold); }

/* Preview cells in list view */
.file-list-preview {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 6px;
  background: rgba(201,168,76,0.08); border: 1px solid rgba(201,168,76,0.2);
  color: var(--gold); font-size: 12px; text-decoration: none; cursor: pointer;
  font-weight: 500; transition: background 0.15s;
}
.file-list-preview:hover { background: rgba(201,168,76,0.15); }

/* Image hover zoom in grid cards */
.file-img-wrap { position: relative; overflow: hidden; width: 100%; height: 100%; }
.file-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s; }
.file-img-wrap:hover img { transform: scale(1.08); }

/* PDF / AI icon cards in grid */
.file-icon-card {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; font-size: 12px; color: var(--text2);
}
.file-icon-card i { font-size: 28px; }

/* ── FILE PREVIEW MODAL ──────────────────────── */
.file-preview-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,0.75);
  display: none; align-items: center; justify-content: center;
}
.file-preview-overlay.open { display: flex; }
.file-preview-box {
  background: var(--card);
  border-radius: 14px;
  border: 1px solid var(--border);
  width: min(90vw, 960px);
  height: min(90vh, 720px);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
}
.file-preview-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.file-preview-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.file-preview-body { flex: 1; overflow: hidden; }
.file-preview-body iframe { width: 100%; height: 100%; border: none; }
.file-preview-body img   { width: 100%; height: 100%; object-fit: contain; }

/* ── PASSWORD CHANGE OVERLAY ─────────────────── */
.pw-change-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.85);
  display: none; align-items: center; justify-content: center;
}
.pw-change-overlay.open { display: flex; }
.pw-change-card {
  background: var(--card);
  border-radius: 18px;
  border: 1px solid var(--border);
  width: min(90vw, 420px);
  padding: 32px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
}
.pw-security-banner {
  background: rgba(255,153,0,0.12);
  border: 1px solid rgba(255,153,0,0.35);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 12.5px;
  color: #FFA500;
  line-height: 1.55;
}
.pw-security-banner strong { display: block; margin-bottom: 4px; font-size: 13px; }
.auth-error { color: #E06060; font-size: 12.5px; margin-top: 8px; min-height: 20px; }

/* ── PROFILE SIDE PANEL (shared base) ───────── */
.side-panel {
  position: fixed; top: 68px; right: 18px; z-index: 400;
  background: var(--card); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border); border-radius: var(--rad);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  max-height: calc(100vh - 90px); overflow: hidden;
  display: flex; flex-direction: column;
  /* Hidden by default — CSS class controls visibility */
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(-8px) scale(0.97);
  transform-origin: top right;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
.side-panel.open {
  opacity: 1; visibility: visible; pointer-events: all;
  transform: translateY(0) scale(1);
}
#profile-panel { width: 270px; }
.side-panel-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 600; color: var(--text); flex-shrink: 0;
}
.side-panel-body { overflow-y: auto; flex: 1; }
.side-panel-divider { height: 1px; background: var(--border); margin: 4px 0; }
.panel-close-btn {
  background: none; border: none; cursor: pointer; color: var(--text3);
  display: flex; align-items: center; padding: 3px; border-radius: 5px;
}
.panel-close-btn:hover { color: var(--text); background: var(--surface2); }
.panel-backdrop { position: fixed; inset: 0; z-index: 290; display: none; }
.panel-backdrop.open { display: block; }

/* ═══════════════════════════════════════════════
   NOTIFICATION CENTER (glassmorphism popup)
════════════════════════════════════════════════ */
.notif-center {
  position: fixed;
  top: 68px;
  right: 18px;
  z-index: 410;
  width: 420px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 88px);

  /* Glassmorphism */
  background: var(--card);
  backdrop-filter: blur(36px);
  -webkit-backdrop-filter: blur(36px);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow:
    0 32px 90px rgba(0,0,0,0.32),
    0 8px 24px  rgba(0,0,0,0.16),
    inset 0 1px 0 rgba(255,255,255,0.1);

  /* Layout */
  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* Entrance animation — hidden until .open */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-14px) scale(0.97);
  transform-origin: top right;
  transition:
    opacity     0.24s cubic-bezier(0.4,0,0.2,1),
    transform   0.24s cubic-bezier(0.34,1.25,0.64,1),
    visibility  0.24s;
}
.notif-center.open {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

/* ── NC HEADER (pinned, never scrolls) ────────── */
.nc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
}
.nc-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.nc-bell-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: rgba(201,168,76,0.13);
  border: 1px solid rgba(201,168,76,0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-size: 15px;
  flex-shrink: 0;
}
.nc-title-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.15px;
  white-space: nowrap;
}
.nc-unread-pill {
  background: var(--gold);
  color: #1a1205;
  font-size: 10px;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.3px;
  flex-shrink: 0;
}
/* Mark all as read button */
.nc-mark-all-btn {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text3);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.15s;
}
.nc-mark-all-btn:hover {
  background: rgba(201,168,76,0.1);
  color: var(--gold);
  border-color: rgba(201,168,76,0.5);
}
.nc-mark-all-btn:active { transform: scale(0.91); }

/* ── NC BODY (scrollable list) ────────────────── */
.nc-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.nc-body::-webkit-scrollbar { width: 4px; }
.nc-body::-webkit-scrollbar-track { background: transparent; }
.nc-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.nc-body::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── EMPTY STATE ──────────────────────────────── */
.nc-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 28px 60px;
  gap: 12px;
  text-align: center;
}
.nc-empty-icon-wrap {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--text3);
  margin-bottom: 4px;
  transition: background 0.2s;
}
.nc-empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text2);
  margin: 0;
  line-height: 1.4;
}
.nc-empty-sub {
  font-size: 12px;
  color: var(--text3);
  margin: 0;
  max-width: 200px;
  line-height: 1.6;
}

/* ── BACKDROP (transparent, closes NC on click) ── */
.notif-backdrop {
  position: fixed;
  inset: 0;
  z-index: 409;
  display: none;
  background: transparent;
  cursor: default;
}
.notif-backdrop.open { display: block; }

/* Profile panel elements */
.profile-avatar-lg {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #8B6914);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #1A1205; font-size: 20px; border: 2px solid var(--gold);
}

/* ── AUTH ALIAS ──────────────────────────────── */
.auth-brand-sub { font-size:13px; color:#8A7860; font-weight:400; letter-spacing:0.3px; }

/* ── DC STATS BAR ────────────────────────────── */
.dc-stats-bar { display: flex; gap: 12px; margin-bottom: 20px; }
.dc-stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 20px; min-width: 120px;
}
.dc-stat-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; font-weight: 600; }
.dc-stat-value { font-size: 26px; font-weight: 700; color: var(--gold); }

/* ── KANBAN (student tasks) ──────────────────── */
.kanban-board { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.kanban-col { background: var(--card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.kanban-col-header, .kanban-col-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.kanban-col-count { font-size: 11px; padding: 2px 9px; border-radius: 20px; font-weight: 700; background: rgba(201,168,76,0.12); color: var(--gold); }
.kanban-empty { padding: 24px; display: flex; justify-content: center; }
.task-card {
  background: var(--surface, rgba(255,255,255,0.08)); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; margin-bottom: 10px; margin: 0 12px 10px;
}
.task-title { font-weight: 600; font-size: 13.5px; color: var(--text); margin-bottom: 4px; }
.task-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

/* ── STAGE MANAGEMENT MODAL ──────────────────── */
.stage-mgmt-list { display: flex; flex-direction: column; gap: 8px; }
.stage-mgmt-row {
  display: grid; grid-template-columns: 20px 1fr 1fr auto; gap: 10px;
  align-items: center; padding: 10px 14px;
  background: var(--surface, rgba(255,255,255,0.06));
  border: 1px solid var(--border); border-radius: 8px;
}
.stage-mgmt-num  { font-size: 11px; font-weight: 600; color: var(--text3); text-align: right; }
.stage-mgmt-name { font-size: 13px; font-weight: 500; color: var(--text); }
.stage-mgmt-student { font-size: 12.5px; color: var(--text2); }
.stage-mgmt-status { display: flex; align-items: center; }
.stage-complete-btn {
  padding: 5px 12px; border-radius: 7px; border: 1px solid rgba(76,175,80,0.4);
  background: rgba(76,175,80,0.1); color: #4CAF50;
  font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all .15s;
}
.stage-complete-btn:hover { background: rgba(76,175,80,0.2); }

/* ── STUDENT DASHBOARD EXTENDED ──────────────── */
.std-stats-row1,
.std-stats-row2 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* Overall progress card */
.std-progress-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--rad);
  padding: 20px 22px;
  backdrop-filter: blur(12px);
}
.std-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.std-progress-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.std-progress-pct {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
}
.std-progress-track {
  height: 9px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}
.std-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, #f0c040 100%);
  border-radius: 99px;
  transition: width 0.5s ease;
}
.std-progress-note {
  font-size: 12px;
  color: var(--text3);
}

/* ── ADMIN DASHBOARD BLOCKS ───────────────────── */
.dash-section-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--rad);
  padding: 24px 28px;
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.05), 0 1px 4px rgba(0,0,0,0.04);
  margin-bottom: 40px;   /* ensures chart never hugs browser bottom */
}
.dash-block-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.dash-block-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
}
.dash-block-sub {
  font-size: 12px;
  color: var(--text3);
  margin-top: 3px;
}

/* ── LEADERBOARD VIEW TOGGLE ──────────────────── */
.lb-view-toggle {
  display: flex;
  gap: 4px;
  background: var(--surface, rgba(0,0,0,0.05));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}
.lb-toggle-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.lb-toggle-btn:hover { color: var(--text); }
.lb-toggle-btn.active {
  background: var(--gold);
  color: #1a1206;
  font-weight: 600;
}

/* ── LEADERBOARD GRID ─────────────────────────── */
.lb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.lb-card {
  background: var(--surface, rgba(255,255,255,0.04));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 14px 14px;
  text-align: center;
  transition: border-color .2s, box-shadow .2s;
}
.lb-card:hover {
  border-color: rgba(201,168,76,0.4);
  box-shadow: 0 4px 20px rgba(201,168,76,0.1);
}
.lb-card-rank {
  font-size: 18px;
  margin-bottom: 10px;
}
.lb-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(201,168,76,0.15);
  color: var(--gold);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
}
.lb-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-card-tr {
  font-size: 11px;
  color: var(--text3);
  margin-bottom: 2px;
}
.lb-card-branch {
  font-size: 11.5px;
  color: var(--text2);
  margin-bottom: 10px;
}
.lb-card-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.lb-card-stat {
  font-size: 12px;
  color: var(--text2);
}

/* ── STREAK & INACTIVITY BADGES ───────────────── */
.lb-streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
  color: #E07820;
  background: rgba(224,120,32,0.12);
  border-radius: 99px;
  padding: 2px 9px;
}
.lb-inactive-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: var(--text3);
  background: var(--surface, rgba(0,0,0,0.05));
  border-radius: 99px;
  padding: 2px 9px;
}
.lb-inactive-red {
  color: #E06060;
  background: rgba(224,96,96,0.1);
}

/* ── KITAAB ANALYTICS CHART ───────────────────── */
.ka-chart-wrap {
  position: relative;
  height: 240px;
  width: 100%;
}

/* modal-box reusable class */
.modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--rad);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeInUp .22s ease;
}

/* Responsive: stack rows on smaller screens */
@media (max-width: 720px) {
  .std-stats-row1,
  .std-stats-row2 {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 480px) {
  .std-stats-row1,
  .std-stats-row2 {
    grid-template-columns: 1fr;
  }
  .lb-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ═══════════════════════════════════════════════
   STUDENT AVATAR — image support + hover zoom
════════════════════════════════════════════════ */

/* Student table avatar: wrap for hover zoom context */
.student-avatar-cell {
  display: inline-flex;
  align-items: center;
  position: relative;
}

/* Generic image override on .student-avatar */
.student-avatar-img {
  background: none !important;
  overflow: hidden;
  display: inline-flex;
  padding: 0 !important;
  /* Remove text styling that doesn't apply to images */
  font-size: 0 !important;
}

/* Hover zoom — scales the avatar smoothly without affecting table layout */
.std-avatar-hover {
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s ease, z-index 0s;
  cursor: default;
  position: relative;
  z-index: 1;
}
.std-avatar-hover:hover {
  transform: scale(2.8);
  box-shadow: 0 8px 28px rgba(0,0,0,0.22);
  z-index: 100;
}

/* Leaderboard card avatar when profile picture is set */
.lb-card-avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 auto 10px;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════
   STUDENT PROFILE PICTURE — admin management UI
════════════════════════════════════════════════ */

/* Preview inside add/edit modal */
.std-pic-preview-wrap {
  display: flex;
  justify-content: center;
}
.std-pic-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
  display: block;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Upload label styled as a button */
.std-pic-upload-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
  user-select: none;
}
.std-pic-upload-btn:hover {
  background: rgba(201,168,76,0.12);
  border-color: rgba(201,168,76,0.4);
  color: var(--gold);
}

/* Remove button */
.std-pic-remove-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(220,38,38,0.08);
  border: 1px solid rgba(220,38,38,0.25);
  color: #dc2626;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.18s;
}
.std-pic-remove-btn:hover {
  background: rgba(220,38,38,0.15);
}

/* Dark mode */
.dark .std-pic-upload-btn {
  background: rgba(255,255,255,0.07);
  color: var(--text2);
}
.dark .std-pic-remove-btn {
  background: rgba(220,38,38,0.12);
}

/* ═══════════════════════════════════════════════
   ADD / EDIT STUDENT — two-column modal layout
════════════════════════════════════════════════ */

/* The modal body gets a max-width override (set via JS to 720px).
   Allow the content area to scroll without fighting the outer flex. */
.modal-body { overflow-y: auto; }

/* Two-column wrapper */
.std-form-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  min-height: 0;
}

/* LEFT: picture + class + branch */
.std-form-left {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* RIGHT: identity fields */
.std-form-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Notes textarea */
.std-form-notes {
  resize: vertical;
  min-height: 72px;
  max-height: 140px;
  font-family: inherit;
  line-height: 1.5;
}

/* ── Profile picture circle ── */
.std-form-pic-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.std-form-pic-circle {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 2.5px dashed rgba(201,168,76,0.55);
  background: rgba(201,168,76,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
}
.std-form-pic-circle:hover {
  border-color: var(--gold);
  background: rgba(201,168,76,0.12);
}

.std-form-pic-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.std-form-pic-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--gold);
  opacity: 0.7;
  pointer-events: none;
  user-select: none;
}
.std-form-pic-placeholder span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* Two action buttons under the circle */
.std-form-pic-actions {
  display: flex;
  gap: 8px;
}

.std-pic-action-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}
.std-pic-action-btn:hover {
  background: rgba(201,168,76,0.14);
  border-color: rgba(201,168,76,0.5);
  color: var(--gold);
}
.std-pic-action-del:hover {
  background: rgba(220,38,38,0.12);
  border-color: rgba(220,38,38,0.35);
  color: #dc2626;
}

/* Class dropdown: option colours are set inline; the select shows the selected colour */
.std-class-select option {
  font-weight: 500;
}

/* ── CLASS BADGE (used in table, chat, leaderboard) ── */
.std-class-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid transparent;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1px;
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1.6;
}

/* Responsive: stack columns on narrow screens */
@media (max-width: 600px) {
  .std-form-layout {
    flex-direction: column;
    gap: 16px;
  }
  .std-form-left {
    width: 100%;
    align-items: center;
  }
}
