:root {
  --accent: #6556f5;
  --accent-2: #7c6cff;
  --accent-soft: #eeebff;
  --page-bg: #efedf7;
  --surface: #ffffff;
  --surface-2: #f7f7fb;
  --surface-3: #f0eff8;
  --text: #171926;
  --muted: #747789;
  --border: #e8e7ef;
  --nav-bg: #171927;
  --nav-text: #d9dbe5;
  --shadow: 0 18px 48px rgba(44, 38, 90, .10);
  --card-shadow: 0 8px 28px rgba(34, 31, 70, .07);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

html[data-theme="dark"] {
  background: #080d14;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at top left, #f8f6ff 0, var(--page-bg) 38%, #eceaf3 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
  transition: background .25s ease, color .25s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #4e40df; }

.ui-svg { width: 18px; height: 18px; display: block; flex: 0 0 auto; }
.brand-svg { width: 28px; height: 28px; display: block; }
.button-svg { width: 21px; height: 21px; display: block; }

/* Authentication */
.auth-wrapper {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 1.05fr) minmax(420px, .95fr);
  background: #0a101a;
  overflow: hidden;
}
.auth-brand-panel {
  position: relative;
  display: flex;
  align-items: center;
  padding: clamp(48px, 7vw, 110px);
  color: #fff;
  background:
    radial-gradient(circle at 18% 20%, rgba(110, 82, 255, .9), transparent 32%),
    radial-gradient(circle at 80% 78%, rgba(29, 106, 255, .62), transparent 34%),
    linear-gradient(145deg, #12172b 0%, #1c2050 52%, #11172a 100%);
}
.auth-brand-panel::before,
.auth-brand-panel::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
  border: 1px solid rgba(255,255,255,.12);
}
.auth-brand-panel::before { width: 430px; height: 430px; left: -170px; top: -140px; }
.auth-brand-panel::after { width: 560px; height: 560px; right: -310px; bottom: -280px; }
.auth-brand-content { position: relative; z-index: 1; max-width: 610px; }
.auth-university-logo {
  width: 84px; height: 84px; display: grid; place-items: center; margin-bottom: 30px;
  border-radius: 25px; color: white; background: linear-gradient(145deg, #8878ff, #5141f0);
  box-shadow: 0 24px 55px rgba(47, 35, 174, .42), inset 0 1px 0 rgba(255,255,255,.3);
}
.auth-university-logo svg { width: 48px; height: 48px; }
.auth-eyebrow { margin: 0 0 12px; color: #c9c4ff; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .22em; }
.auth-brand-content h1 { margin: 0; font-size: clamp(46px, 5.7vw, 78px); line-height: .93; letter-spacing: -.055em; font-weight: 850; }
.auth-motto { margin: 23px 0 0; color: #d9d6ff; font-size: clamp(17px, 1.65vw, 23px); letter-spacing: .055em; font-weight: 650; }
.auth-intro { max-width: 540px; margin: 28px 0 0; color: rgba(255,255,255,.72); font-size: 16px; line-height: 1.75; }
.auth-brand-divider { width: 68px; height: 4px; margin: 34px 0 20px; border-radius: 99px; background: #8cff19; box-shadow: 0 0 24px rgba(140,255,25,.45); }
.auth-brand-content small { color: rgba(255,255,255,.62); font-size: 13px; letter-spacing: .13em; text-transform: uppercase; }
.auth-form-panel {
  display: grid; place-items: center; padding: clamp(28px, 6vw, 84px);
  background: radial-gradient(circle at 75% 15%, rgba(101,86,245,.16), transparent 28%), #f7f7fb;
}
.auth-card {
  width: 100%; max-width: 490px; border: 1px solid #e7e5f1; color: #171926;
  background: rgba(255,255,255,.96); border-radius: 28px; box-shadow: 0 28px 80px rgba(27,24,66,.14);
  padding: clamp(30px, 4.5vw, 48px) !important;
}
.auth-heading { margin-bottom: 30px; }
.auth-heading p { margin: 0 0 7px; color: #6556f5; font-weight: 750; font-size: 13px; text-transform: uppercase; letter-spacing: .12em; }
.auth-heading h2 { margin: 0; color: #11131d; font-size: 39px; font-weight: 820; letter-spacing: -.035em; }
.auth-heading span { display: block; margin-top: 9px; color: #747789; font-size: 14px; }
.auth-card .form-label { color: #272a38; font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.auth-input { min-height: 54px; padding: 14px 16px; color: #171926; background: #f4f4f8; border-color: #dedce9; border-radius: 14px; }
.auth-input::placeholder { color: #9a9dab; }
.auth-input:focus { background: #fff; color: #171926; border-color: #6556f5; box-shadow: 0 0 0 4px rgba(101,86,245,.12); }
.auth-submit { min-height: 54px; margin-top: 6px; border: 0; border-radius: 14px; font-weight: 800; letter-spacing: .01em; background: linear-gradient(135deg, #6959f7, #4f3ee9); box-shadow: 0 13px 26px rgba(90,72,235,.25); }
.auth-submit:hover { transform: translateY(-1px); background: linear-gradient(135deg, #7567ff, #5b49f0); box-shadow: 0 16px 30px rgba(90,72,235,.32); }
.auth-register { margin: 22px 0 0; text-align: center; color: #747789; font-size: 14px; }
.auth-register a { color: #5b4bea; font-weight: 800; }
.auth-mobile-brand { display: none; }

/* Main shell */
.app-shell {
  width: min(1500px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topbar {
  min-height: 88px;
  display: grid;
  grid-template-columns: auto minmax(420px, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 18px 28px;
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1025;
  backdrop-filter: blur(18px);
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); min-width: 190px; }
.brand:hover { color: var(--text); }
.brand-mark {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  color: white; background: linear-gradient(135deg, #8879ff, #4f40ed); box-shadow: 0 8px 20px rgba(101,86,245,.28);
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.05; }
.brand-copy strong { font-size: 16px; letter-spacing: .2px; color: var(--text); }
.brand-copy small { color: var(--muted); font-size: 10px; margin-top: 5px; }

.desktop-nav {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--nav-bg);
  border-radius: 16px;
  padding: 5px;
  max-width: 760px;
  overflow-x: auto;
  scrollbar-width: none;
}
.desktop-nav::-webkit-scrollbar { display: none; }
.desktop-nav a {
  color: var(--nav-text); padding: 10px 16px; border-radius: 12px; font-size: 13px; font-weight: 650; white-space: nowrap;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.desktop-nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.desktop-nav a.active { color: white; background: linear-gradient(135deg, var(--accent-2), var(--accent)); box-shadow: 0 5px 14px rgba(101,86,245,.4); }

.topbar-actions { display: flex; align-items: center; gap: 9px; justify-self: end; }
.icon-button {
  width: 40px; height: 40px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); display: inline-flex; align-items: center; justify-content: center; padding: 0; position: relative;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.icon-button:hover { transform: translateY(-1px); background: var(--surface-2); color: var(--accent); }
.notification-dot { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #ff4e67; top: 7px; right: 8px; border: 2px solid var(--surface); }
.theme-icon-sun { display: none; }
.profile-chip { display: inline-flex; align-items: center; gap: 9px; margin-left: 2px; }
.avatar-circle {
  width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(145deg, #1d2130, #4b5061);
  color: white; display: grid; place-items: center; font-weight: 800; font-size: 14px; border: 3px solid var(--surface-3);
}
.profile-text { display: none; flex-direction: column; }
.profile-text strong { font-size: 12px; color: var(--text); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-text small { color: var(--muted); font-size: 10px; text-transform: capitalize; }
.mobile-menu-button { display: none; width: 40px; height: 40px; border: 1px solid var(--border); background: var(--surface); border-radius: 13px; color: var(--text); align-items: center; justify-content: center; }

.app-main { min-height: calc(100vh - 120px); background: var(--surface); }
.app-main > .container, .app-main > .container-fluid { max-width: 100%; padding: 34px 30px 40px; }
.container, .container-fluid { max-width: 100%; }

.page-title { font-size: clamp(28px, 3vw, 40px); line-height: 1.05; font-weight: 760; letter-spacing: -1.2px; color: var(--text); }
.page-title::before { display: none; }
.text-muted, .small-muted { color: var(--muted) !important; }

.btn {
  border-radius: 12px; padding: .65rem 1rem; font-weight: 650; border-width: 1px; transition: transform .18s ease, box-shadow .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary, .btn-success {
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); border-color: var(--accent); box-shadow: 0 7px 18px rgba(101,86,245,.2);
}
.btn-primary:hover, .btn-success:hover { background: linear-gradient(135deg, #7161ff, #5545e9); border-color: #5545e9; }
.btn-outline-primary { color: var(--accent); border-color: #c7c1ff; }
.btn-outline-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn-light { background: var(--surface-2); border-color: var(--border); color: var(--text); }

/* Dashboard cards */
.row.g-3 > [class*="col-"] .card-stat {
  min-height: 150px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface) !important;
  color: var(--text); box-shadow: var(--card-shadow); position: relative; overflow: hidden; padding: 24px !important;
}
.card-stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
.card-stat::after {
  content: ""; position: absolute; right: 18px; bottom: 15px; width: 55px; height: 55px; opacity: .12;
  background: var(--accent); -webkit-mask: var(--stat-icon, url('../icons/chart.svg')) center/contain no-repeat; mask: var(--stat-icon, url('../icons/chart.svg')) center/contain no-repeat;
}
.card-stat h2 { color: var(--text); font-size: 36px; font-weight: 780; margin: 10px 0 0; letter-spacing: -1px; }
.card-stat .small-muted { font-size: 13px; font-weight: 650; color: var(--muted) !important; }
.card-stat:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(45,38,94,.1); }
.row.g-3 > [class*="col-"]:nth-child(1) .card-stat { --stat-icon: url('../icons/courses.svg'); }
.row.g-3 > [class*="col-"]:nth-child(2) .card-stat { --stat-icon: url('../icons/note.svg'); }
.row.g-3 > [class*="col-"]:nth-child(3) .card-stat { --stat-icon: url('../icons/download.svg'); }
.row.g-3 > [class*="col-"]:nth-child(4) .card-stat { --stat-icon: url('../icons/users.svg'); }

.card, .table-card, .form-card, .course-card, .search-result-card {
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--card-shadow); overflow: hidden;
}
.card-header, .card-header.bg-white {
  background: var(--surface) !important; color: var(--text); border-bottom: 1px solid var(--border); padding: 18px 20px; font-size: 14px;
}
.table { color: var(--text); margin: 0; --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--border); }
.table thead th { background: var(--surface-2); color: var(--muted); font-size: 11px; letter-spacing: .55px; text-transform: uppercase; font-weight: 760; border-color: var(--border); padding: 14px 18px; }
.table td, .table th { padding: 15px 18px; vertical-align: middle; border-color: var(--border); }
.table tbody tr { transition: background .18s ease; }
.table tbody tr:hover { background: var(--accent-soft); }
.badge { border-radius: 999px; padding: .5em .75em; }
.text-bg-primary { background: var(--accent) !important; }

.form-control, .form-select {
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); padding: .72rem .9rem;
}
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(101,86,245,.12); background: var(--surface); color: var(--text); }
.file-help { border: 1px dashed #c9c5dd; border-radius: 14px; padding: 16px; background: var(--surface-2); }
.notification-item { border-bottom: 1px solid var(--border); padding: 16px 0; }
.notification-item.unread { background: var(--accent-soft); border-radius: 14px; padding: 16px; margin-bottom: 9px; }
.course-card { transition: transform .2s ease, box-shadow .2s ease; }
.course-card:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(45,38,94,.11); }
.pdf-preview { width: 100%; min-height: 640px; border: 0; background: var(--surface-2); }
.pagination .page-link { border-radius: 10px; margin-right: 5px; color: var(--accent); border-color: var(--border); background: var(--surface); }
.alert { border-radius: 14px; }

/* Mobile drawer */
.mobile-drawer { position: fixed; top: 0; right: 0; width: min(330px, 88vw); height: 100vh; background: var(--surface); z-index: 1060; transform: translateX(102%); transition: transform .24s ease; padding: 18px; box-shadow: -20px 0 50px rgba(0,0,0,.18); display: flex; flex-direction: column; }
.mobile-drawer.show { transform: translateX(0); }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(10,12,20,.48); z-index: 1050; opacity: 0; visibility: hidden; transition: opacity .2s ease; }
.drawer-open .drawer-backdrop { opacity: 1; visibility: visible; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.drawer-links { display: grid; gap: 7px; padding: 18px 0; overflow-y: auto; }
.drawer-links a { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 12px; color: var(--muted); font-weight: 650; }
.drawer-links a.active, .drawer-links a:hover { background: var(--accent-soft); color: var(--accent); }
.drawer-links a span { width: 22px; }
.drawer-logout { margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 13px; border-radius: 12px; background: var(--nav-bg); color: white; }

/* Dark mode inspired by the supplied black/green interface */
body.dark-mode {
  --accent: #8cff19;
  --accent-2: #72e900;
  --accent-soft: rgba(140,255,25,.10);
  --page-bg: #070b11;
  --surface: #101722;
  --surface-2: #151e2b;
  --surface-3: #202a38;
  --text: #f5f7fb;
  --muted: #9099aa;
  --border: #263140;
  --nav-bg: #f5f7fa;
  --nav-text: #232936;
  --shadow: 0 22px 60px rgba(0,0,0,.38);
  --card-shadow: 0 10px 30px rgba(0,0,0,.22);
  background: radial-gradient(circle at top, #131b28 0, #090e15 50%, #05080c 100%);
}
body.dark-mode .app-shell { border-color: #202a37; background: var(--surface); }
body.dark-mode .topbar { background: rgba(13,19,28,.94); }
body.dark-mode .brand-mark { color: #0b1118; background: linear-gradient(135deg, #a4ff36, #70e600); box-shadow: 0 8px 22px rgba(140,255,25,.22); }
body.dark-mode .desktop-nav a.active { color: #081009; background: linear-gradient(135deg, #a2ff35, #72ed00); box-shadow: 0 5px 16px rgba(140,255,25,.3); }
body.dark-mode .theme-icon-moon { display: none; }
body.dark-mode .theme-icon-sun { display: inline-flex; }
body.dark-mode .icon-button:hover { color: var(--accent); }
body.dark-mode .avatar-circle { background: linear-gradient(145deg, #293446, #111821); }
body.dark-mode .btn-primary, body.dark-mode .btn-success { color: #081009; background: linear-gradient(135deg, #a2ff35, #72e900); border-color: #7cf200; box-shadow: 0 7px 18px rgba(140,255,25,.15); }
body.dark-mode .btn-primary:hover, body.dark-mode .btn-success:hover { color: #081009; background: linear-gradient(135deg, #b2ff58, #82f712); }
body.dark-mode .btn-outline-primary { color: var(--accent); border-color: #53782c; }
body.dark-mode .btn-outline-primary:hover { color: #081009; background: var(--accent); border-color: var(--accent); }
body.dark-mode .table tbody tr:hover { background: rgba(140,255,25,.06); }
body.dark-mode .text-bg-primary { color: #081009 !important; }
body.dark-mode .form-control::placeholder { color: #707b8b; }
body.dark-mode .btn-light { background: var(--surface-2); color: var(--text); border-color: var(--border); }
body.dark-mode .bg-white { background: var(--surface) !important; }
body.dark-mode .text-dark { color: var(--text) !important; }
body.dark-mode .modal-content, body.dark-mode .dropdown-menu { background: var(--surface); color: var(--text); border-color: var(--border); }
body.dark-mode .btn-close { filter: invert(1); }

@media (min-width: 1280px) {
  .profile-text { display: flex; }
}

@media (max-width: 1180px) {
  .topbar { grid-template-columns: auto 1fr auto; }
  .desktop-nav a { padding: 10px 12px; }
  .brand-copy { display: none; }
  .brand { min-width: auto; }
}

@media (max-width: 900px) {
  .app-shell { width: calc(100% - 18px); margin: 9px auto; min-height: calc(100vh - 18px); border-radius: 20px; }
  .topbar { min-height: 72px; padding: 13px 15px; grid-template-columns: auto 1fr; }
  .desktop-nav { display: none; }
  .topbar-actions { grid-column: 2; }
  .mobile-menu-button { display: inline-flex; }
  .app-main > .container, .app-main > .container-fluid { padding: 24px 16px 30px; }
  .page-title { font-size: 30px; }
}

@media (max-width: 575px) {
  .app-shell { width: 100%; margin: 0; min-height: 100vh; border-radius: 0; border: 0; }
  .topbar { border-radius: 0; }
  .topbar-actions .icon-button.d-none { display: none !important; }
  .profile-chip { display: none; }
  .icon-button, .mobile-menu-button { width: 38px; height: 38px; border-radius: 11px; }
  .row.g-3 > [class*="col-"] .card-stat { min-height: 125px; }
  .table td, .table th { padding: 12px 14px; }
  .pdf-preview { min-height: 420px; }
}

/* Account settings dropdown and profile actions */
.settings-menu { position: relative; }
.settings-dropdown {
  position: absolute; top: calc(100% + 12px); right: 0; width: 250px; padding: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 20px 50px rgba(21, 18, 50, .18); opacity: 0; visibility: hidden;
  transform: translateY(-8px); transition: opacity .18s ease, transform .18s ease, visibility .18s ease; z-index: 1100;
}
.settings-menu.open .settings-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.settings-account { display: flex; align-items: center; gap: 11px; padding: 9px 8px 13px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.settings-account > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.settings-account strong { color: var(--text); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.settings-account small { color: var(--muted); font-size: 11px; }
.settings-dropdown > a { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 11px; color: var(--text); font-size: 13px; font-weight: 650; }
.settings-dropdown > a:hover { background: var(--accent-soft); color: var(--accent); }
.settings-dropdown .settings-logout { color: #d83b50; }
.settings-dropdown .settings-logout:hover { background: rgba(216,59,80,.08); color: #bd263b; }
.profile-chip-button { border: 0; background: transparent; padding: 0; cursor: pointer; text-align: left; }
.drawer-profile { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 13px; margin-top: auto; border-radius: 12px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.drawer-profile + .drawer-logout { margin-top: 8px; }

/* Stronger light-mode contrast */
body:not(.dark-mode) { --text: #05070d; --muted: #555a68; }
body:not(.dark-mode) .page-title,
body:not(.dark-mode) .card-header,
body:not(.dark-mode) .table td,
body:not(.dark-mode) .table td a,
body:not(.dark-mode) .card-stat h2 { color: #05070d; }
body:not(.dark-mode) .table-card:first-child .table tbody td,
body:not(.dark-mode) .table-card:first-child .table tbody td a { color: #000 !important; }

.profile-preview-panel { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--border); }
.profile-preview-image, .profile-preview-placeholder { width: 126px; height: 126px; border-radius: 50%; object-fit: cover; margin-bottom: 16px; border: 5px solid var(--surface); box-shadow: 0 10px 30px rgba(25,22,55,.15); }
.profile-preview-placeholder { display: grid; place-items: center; background: linear-gradient(145deg, var(--accent-2), var(--accent)); color: white; font-size: 44px; font-weight: 800; }
.profile-preview-panel strong { color: var(--text); font-size: 17px; }
.profile-preview-panel span { color: var(--muted); font-size: 12px; margin-top: 4px; }

body.dark-mode .settings-dropdown { box-shadow: 0 20px 50px rgba(0,0,0,.42); }

/* Uploaded profile photos in the header and account menu */
.avatar-circle.avatar-has-image { overflow: hidden; padding: 0; }
.avatar-circle.avatar-has-image img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: inherit; }

/* Keep disabled/read-only profile fields consistent with editable fields. */
.form-control:disabled,
.form-control[readonly],
.form-select:disabled {
  background-color: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
  opacity: 1;
  -webkit-text-fill-color: var(--text);
}

body.dark-mode .form-control:disabled,
body.dark-mode .form-control[readonly],
body.dark-mode .form-select:disabled {
  background-color: var(--surface-2) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  opacity: 1;
  -webkit-text-fill-color: var(--text);
}


body.dark-mode .drawer-links a:not(.active):hover { color: var(--accent); background: rgba(140,255,25,.08); }

@media (max-width: 900px) {
  .auth-wrapper { grid-template-columns: 1fr; background: radial-gradient(circle at 30% 8%, rgba(101,86,245,.34), transparent 32%), #101522; padding: 22px; }
  .auth-brand-panel { display: none; }
  .auth-form-panel { padding: 0; background: transparent; }
  .auth-card { max-width: 520px; }
  .auth-mobile-brand { display: flex; align-items: center; gap: 12px; padding-bottom: 24px; margin-bottom: 27px; border-bottom: 1px solid #e8e6f0; }
  .auth-mobile-logo { width: 49px; height: 49px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 15px; color: #fff; background: linear-gradient(135deg, #8373ff, #4f40ed); }
  .auth-mobile-logo svg { width: 27px; height: 27px; }
  .auth-mobile-brand > span:last-child { display: flex; flex-direction: column; }
  .auth-mobile-brand strong { color: #171926; font-size: 14px; }
  .auth-mobile-brand small { margin-top: 4px; color: #747789; font-size: 10px; }
}
@media (max-width: 520px) {
  .auth-wrapper { padding: 0; background: #fff; }
  .auth-card { min-height: 100vh; max-width: none; border: 0; border-radius: 0; box-shadow: none; padding: 28px 22px !important; }
  .auth-heading h2 { font-size: 34px; }
}


/* Refined dark authentication UI and consistent contrast */
body.dark-mode .auth-wrapper {
  background: #070b11;
}
body.dark-mode .auth-brand-panel {
  color: #f8fafc;
  background:
    radial-gradient(circle at 18% 18%, rgba(140,255,25,.18), transparent 30%),
    radial-gradient(circle at 78% 78%, rgba(54,101,255,.28), transparent 34%),
    linear-gradient(145deg, #0a1018 0%, #101827 54%, #090e16 100%);
}
body.dark-mode .auth-brand-panel::before,
body.dark-mode .auth-brand-panel::after { border-color: rgba(255,255,255,.08); }
body.dark-mode .auth-university-logo {
  color: #09110a;
  background: linear-gradient(145deg, #b7ff55, #7bf000);
  box-shadow: 0 20px 48px rgba(140,255,25,.18), inset 0 1px 0 rgba(255,255,255,.35);
}
body.dark-mode .auth-eyebrow { color: #b7ff68; }
body.dark-mode .auth-motto { color: #e8fbd8; }
body.dark-mode .auth-intro { color: #b8c1cf; }
body.dark-mode .auth-brand-content small { color: #8f9aaa; }
body.dark-mode .auth-brand-divider { background: linear-gradient(90deg, #b7ff55, #79ed00); }
body.dark-mode .auth-form-panel {
  background:
    radial-gradient(circle at 75% 12%, rgba(140,255,25,.08), transparent 28%),
    radial-gradient(circle at 18% 88%, rgba(77,98,255,.10), transparent 32%),
    #0b1119;
}
body.dark-mode .auth-card {
  color: #f4f7fb;
  background: rgba(16,23,34,.96);
  border-color: #273243;
  box-shadow: 0 28px 80px rgba(0,0,0,.45);
}
body.dark-mode .auth-heading p { color: #9cff38; }
body.dark-mode .auth-heading h2 { color: #ffffff; }
body.dark-mode .auth-heading span { color: #a9b2c0; }
body.dark-mode .auth-card .form-label { color: #e8edf4; }
body.dark-mode .auth-input {
  color: #f7f9fc;
  background: #151e2a;
  border-color: #2d3949;
  -webkit-text-fill-color: #f7f9fc;
}
body.dark-mode .auth-input::placeholder { color: #7f8a99; }
body.dark-mode .auth-input:hover { border-color: #405064; background: #182331; }
body.dark-mode .auth-input:focus {
  color: #ffffff;
  background: #182331;
  border-color: #8cff19;
  box-shadow: 0 0 0 4px rgba(140,255,25,.12);
  -webkit-text-fill-color: #ffffff;
}
body.dark-mode .auth-submit {
  color: #09110a;
  background: linear-gradient(135deg, #b3ff4d, #78eb00);
  box-shadow: 0 13px 28px rgba(140,255,25,.18);
}
body.dark-mode .auth-submit:hover,
body.dark-mode .auth-submit:focus {
  color: #071007;
  background: linear-gradient(135deg, #c1ff6a, #8bf717);
  box-shadow: 0 16px 34px rgba(140,255,25,.25);
}
body.dark-mode .auth-register { color: #9ca7b6; }
body.dark-mode .auth-register a { color: #a9ff4d; }
body.dark-mode .auth-register a:hover { color: #c6ff83; }
body.dark-mode .auth-card .alert-danger {
  color: #ffd7dc;
  background: rgba(220,53,69,.13);
  border-color: rgba(255,100,118,.28);
}

/* Keep the dark navigation itself dark; avoid the bright white bar. */
body.dark-mode .desktop-nav {
  background: #151d29;
  border: 1px solid #273243;
}
body.dark-mode .desktop-nav a { color: #c1c9d5; }
body.dark-mode .desktop-nav a:not(.active):hover,
body.dark-mode .desktop-nav a:not(.active):focus-visible {
  color: #ffffff;
  background: #263140;
  box-shadow: inset 0 0 0 1px #364456;
}

@media (max-width: 900px) {
  body.dark-mode .auth-wrapper {
    background: radial-gradient(circle at 30% 8%, rgba(140,255,25,.10), transparent 32%), #090f17;
  }
  body.dark-mode .auth-mobile-brand { border-bottom-color: #2a3544; }
  body.dark-mode .auth-mobile-logo {
    color: #09110a;
    background: linear-gradient(135deg, #b2ff4d, #78eb00);
  }
  body.dark-mode .auth-mobile-brand strong { color: #f6f8fb; }
  body.dark-mode .auth-mobile-brand small { color: #9aa5b4; }
}
@media (max-width: 520px) {
  body.dark-mode .auth-wrapper { background: #0b1119; }
  body.dark-mode .auth-card { background: #0b1119; }
}

/* Final dark-login correction: prevent browser autofill from forcing white fields. */
body.dark-mode .auth-card input.auth-input,
body.dark-mode .auth-card input.form-control,
html[data-theme="dark"] .auth-card input.auth-input,
html[data-theme="dark"] .auth-card input.form-control {
  color: #f7f9fc !important;
  background-color: #151e2a !important;
  border-color: #344154 !important;
  caret-color: #b7ff55;
  -webkit-text-fill-color: #f7f9fc !important;
  box-shadow: inset 0 0 0 1000px #151e2a !important;
}

body.dark-mode .auth-card input.auth-input:hover,
body.dark-mode .auth-card input.form-control:hover,
html[data-theme="dark"] .auth-card input.auth-input:hover,
html[data-theme="dark"] .auth-card input.form-control:hover {
  background-color: #192433 !important;
  border-color: #506076 !important;
  box-shadow: inset 0 0 0 1000px #192433 !important;
}

body.dark-mode .auth-card input.auth-input:focus,
body.dark-mode .auth-card input.form-control:focus,
html[data-theme="dark"] .auth-card input.auth-input:focus,
html[data-theme="dark"] .auth-card input.form-control:focus {
  color: #ffffff !important;
  background-color: #192433 !important;
  border-color: #9cff38 !important;
  -webkit-text-fill-color: #ffffff !important;
  box-shadow: inset 0 0 0 1000px #192433 !important, 0 0 0 4px rgba(156,255,56,.14) !important;
}

body.dark-mode .auth-card input:-webkit-autofill,
body.dark-mode .auth-card input:-webkit-autofill:hover,
body.dark-mode .auth-card input:-webkit-autofill:focus,
body.dark-mode .auth-card input:-webkit-autofill:active,
html[data-theme="dark"] .auth-card input:-webkit-autofill,
html[data-theme="dark"] .auth-card input:-webkit-autofill:hover,
html[data-theme="dark"] .auth-card input:-webkit-autofill:focus,
html[data-theme="dark"] .auth-card input:-webkit-autofill:active {
  -webkit-text-fill-color: #f7f9fc !important;
  caret-color: #b7ff55 !important;
  -webkit-box-shadow: 0 0 0 1000px #151e2a inset !important;
  box-shadow: 0 0 0 1000px #151e2a inset !important;
  border-color: #344154 !important;
  transition: background-color 9999s ease-out 0s;
}


/* Definitive dark login field fix — overrides Bootstrap and browser autofill. */
.autofill-decoy {
  position: fixed !important;
  left: -10000px !important;
  top: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.dark-mode .login-form,
html[data-theme="dark"] .login-form {
  color-scheme: dark;
}

body.dark-mode .login-form .auth-input,
html[data-theme="dark"] .login-form .auth-input,
body.dark-mode .login-form input[type="email"],
body.dark-mode .login-form input[type="password"],
html[data-theme="dark"] .login-form input[type="email"],
html[data-theme="dark"] .login-form input[type="password"] {
  appearance: none !important;
  -webkit-appearance: none !important;
  color: #f8fafc !important;
  -webkit-text-fill-color: #f8fafc !important;
  caret-color: #b7ff55 !important;
  background-color: #121b27 !important;
  background-image: linear-gradient(#121b27, #121b27) !important;
  border: 1px solid #344154 !important;
  box-shadow: inset 0 0 0 1000px #121b27 !important;
}

body.dark-mode .login-form .auth-input:hover,
html[data-theme="dark"] .login-form .auth-input:hover {
  background-color: #172332 !important;
  background-image: linear-gradient(#172332, #172332) !important;
  border-color: #53647a !important;
  box-shadow: inset 0 0 0 1000px #172332 !important;
}

body.dark-mode .login-form .auth-input:focus,
html[data-theme="dark"] .login-form .auth-input:focus {
  background-color: #172332 !important;
  background-image: linear-gradient(#172332, #172332) !important;
  border-color: #9cff38 !important;
  outline: 0 !important;
  box-shadow: inset 0 0 0 1000px #172332 !important, 0 0 0 4px rgba(156,255,56,.15) !important;
}

body.dark-mode .login-form input:-webkit-autofill,
body.dark-mode .login-form input:-webkit-autofill:hover,
body.dark-mode .login-form input:-webkit-autofill:focus,
body.dark-mode .login-form input:-webkit-autofill:active,
html[data-theme="dark"] .login-form input:-webkit-autofill,
html[data-theme="dark"] .login-form input:-webkit-autofill:hover,
html[data-theme="dark"] .login-form input:-webkit-autofill:focus,
html[data-theme="dark"] .login-form input:-webkit-autofill:active {
  -webkit-text-fill-color: #f8fafc !important;
  caret-color: #b7ff55 !important;
  -webkit-box-shadow: 0 0 0 1000px #121b27 inset !important;
  box-shadow: 0 0 0 1000px #121b27 inset !important;
  background-color: #121b27 !important;
  background-image: linear-gradient(#121b27, #121b27) !important;
  border-color: #344154 !important;
  transition: background-color 999999s 0s, color 999999s 0s !important;
}

/* Register page aligned with the branded login interface. */
.auth-register-card { max-width: 650px; }
.auth-register-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.auth-register-grid .auth-field-full { grid-column: 1 / -1; }
.auth-select { appearance: auto; }

body.dark-mode .register-form .auth-input,
html[data-theme="dark"] .register-form .auth-input,
body.dark-mode .register-form .form-select,
html[data-theme="dark"] .register-form .form-select {
  color: #f4f7fb !important;
  background-color: #141f2c !important;
  border-color: #334255 !important;
  -webkit-text-fill-color: #f4f7fb !important;
  box-shadow: none !important;
}
body.dark-mode .register-form .auth-input:hover,
html[data-theme="dark"] .register-form .auth-input:hover,
body.dark-mode .register-form .form-select:hover,
html[data-theme="dark"] .register-form .form-select:hover {
  background-color: #182534 !important;
  border-color: #4a5d72 !important;
}
body.dark-mode .register-form .auth-input:focus,
html[data-theme="dark"] .register-form .auth-input:focus,
body.dark-mode .register-form .form-select:focus,
html[data-theme="dark"] .register-form .form-select:focus {
  color: #fff !important;
  background-color: #172433 !important;
  border-color: #9cff38 !important;
  box-shadow: 0 0 0 4px rgba(156,255,56,.13) !important;
}
body.dark-mode .register-form .form-select option,
html[data-theme="dark"] .register-form .form-select option {
  color: #f4f7fb;
  background: #141f2c;
}
body.dark-mode .auth-card .alert-success {
  color: #dfffc2;
  background: rgba(104, 220, 0, .12);
  border-color: rgba(156, 255, 56, .25);
}
@media (max-width: 620px) {
  .auth-register-grid { grid-template-columns: 1fr; }
  .auth-register-grid .auth-field-full { grid-column: auto; }
}


/* Student index-number workflow */
.student-index-result,
.student-index-preview strong {
  display: inline-flex;
  margin-top: .4rem;
  padding: .65rem 1rem;
  border-radius: 12px;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: .08em;
  background: rgba(82, 70, 255, .1);
  border: 1px solid rgba(82, 70, 255, .25);
  color: var(--text-color, #111827);
}
.student-index-preview { display:flex; flex-direction:column; align-items:flex-start; }
[data-theme="dark"] .student-index-result,
[data-theme="dark"] .student-index-preview strong {
  background: rgba(173, 255, 47, .10);
  border-color: rgba(173, 255, 47, .28);
  color: #dfff63;
}
