:root {
    --primary-dark: #101c3e;
    --primary-blue: #2563eb;
    --bg-light: #f8f9fc;
    --text-dark: #1f2937;
    --text-gray: #6b7280;
    --border-radius: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    height: 100vh;
    height: 100dvh;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* Authentication forms can be taller than the viewport, especially on phones. */
html.auth-page,
body.auth-page {
    height: auto;
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    overflow-y: auto !important;
    overscroll-behavior-y: auto;
    -webkit-overflow-scrolling: touch;
}

.auth-page-content {
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
}

/* --- Layout Grid --- */
.app-wrapper { display: flex; height: 100vh; height: 100dvh; width: 100%; max-width: 100%; overflow-x: clip; }

/* --- Sidebar --- */
.sidebar {
    width: 260px; background-color: var(--primary-dark); color: #fff;
    display: flex; flex-direction: column; flex-shrink: 0;
    transition: all 0.3s ease; z-index: 1000;
}
.sidebar-brand { padding: 24px; display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 700; }
.sidebar-brand i { font-size: 28px; color: #60a5fa; }
.sidebar-brand-logo { width: 36px; height: 36px; min-width: 36px; max-width: 36px; object-fit: contain; flex-shrink: 0; }
.sidebar-brand small { font-size: 11px; font-weight: 400; color: #9ca3af; display: block; margin-top: -4px; }
.sidebar-menu { padding: 0 16px; flex-grow: 1; overflow-y: auto; }
.sidebar-menu .nav-link {
    color: #cbd5e1; padding: 12px 16px; border-radius: 8px; margin-bottom: 4px;
    display: flex; align-items: center; gap: 14px; font-size: 14px; font-weight: 500; transition: 0.2s; cursor: pointer;
}
.sidebar-menu .nav-link:hover, .sidebar-menu .nav-link.active { background-color: rgba(255, 255, 255, 0.1); color: #fff; }
.sidebar-menu .nav-link i { font-size: 20px; }
.sidebar-menu .nav-link-locked { cursor: not-allowed; opacity: 0.55; pointer-events: none; }
.sidebar-menu .nav-link-locked:hover { background: transparent; color: #cbd5e1; }
.nav-premium-label { margin-left: auto; color: #fbbf24; font-size: 9px; font-weight: 700; text-transform: uppercase; line-height: 1; }
.premium-box { margin: 16px; background: linear-gradient(135deg, #1e3a8a, #312e81); padding: 20px; border-radius: var(--border-radius); text-align: center; }
.premium-box .btn-upgrade { background: #fff; color: var(--primary-dark); font-weight: 600; font-size: 13px; width: 100%; padding: 8px; border-radius: 6px; }

/* --- Main Content --- */
.main-content-area { flex-grow: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background-color: var(--bg-light); }
.topbar {
    padding: 16px 32px; background: #fff; border-bottom: 1px solid #e5e7eb;
    display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
}
.search-box { background: var(--bg-light); border-radius: 8px; padding: 8px 16px; display: flex; align-items: center; width: 320px; }
.search-box input { border: none; background: transparent; outline: none; width: 100%; padding: 0 10px; font-size: 14px; }
.search-box span { font-size: 11px; color: #9ca3af; border-left: 1px solid #d1d5db; padding-left: 10px; }
.user-area { display: flex; align-items: center; gap: 20px; }
.user-area img { width: 36px; height: 36px; border-radius: 50%; }
.notification-bell { position: relative; padding: 0; border: 0; background: transparent; color: var(--text-gray); font-size: 20px; line-height: 1; cursor: pointer; }
.notification-bell:hover { color: var(--text-dark); }
.login-streak { display: inline-flex; align-items: center; gap: 3px; transform: translateY(-5px); color: #f97316; font-size: 18px; font-weight: 700; line-height: 1; text-decoration: none; }
.login-streak:hover { color: #ea580c; }
.login-streak span { font-size: 13px; }
.theme-toggle { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text-gray); font-size: 20px; cursor: pointer; transition: color .2s ease, background .2s ease, border-color .2s ease; }
.theme-toggle:hover { color: var(--primary-blue); background: #eff6ff; border-color: #dbeafe; }
.theme-toggle:focus-visible { outline: 3px solid rgba(37, 99, 235, .35); outline-offset: 2px; }
.notification-count { position: absolute; top: -8px; right: -10px; min-width: 17px; height: 17px; padding: 0 4px; border: 2px solid #fff; border-radius: 999px; background: #dc2626; color: #fff; font-size: 10px; font-weight: 700; line-height: 13px; }
.notification-menu { min-width: min(360px, calc(100vw - 2rem)); max-height: min(460px, calc(100vh - 5rem)); overflow-y: auto; padding: 10px 0; }
.notification-badge-image { width: 28px; height: 28px; object-fit: contain; flex: 0 0 auto; }

/* --- Page Content Container --- */
.page-container { flex-grow: 1; min-height: 0; overflow-y: auto; padding: 24px 32px; -webkit-overflow-scrolling: touch; }

/* --- Pages (Hidden by default) --- */
.app-page { display: none; animation: fadeIn 0.3s ease; }
.app-page.active-page { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- Dashboard specific --- */
.welcome-banner { background: linear-gradient(135deg, #0f1638, #1a2b6b); padding: 32px; border-radius: var(--border-radius); color: #fff; display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.progress-ring-small { width: 60px; height: 60px; border-radius: 50%; background: conic-gradient(#2563eb 0% 32%, rgba(255,255,255,0.2) 32% 100%); display: flex; align-items: center; justify-content: center; }
.progress-ring-small .inner { width: 46px; height: 46px; background: #0f1638; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }

/* --- Year Cards --- */
.year-card { position: relative; background: #fff; padding: 16px; border-radius: var(--border-radius); text-align: center; border: 2px solid transparent; box-shadow: var(--shadow); transition: 0.3s; cursor: pointer; }
.year-card.active { border-color: var(--primary-blue); background: #f8faff; }
.year-card.active i, .year-card.active h6 { color: var(--primary-blue) !important; }
.year-card i { font-size: 24px; color: #6b7280; margin-bottom: 8px; }
.year-card h6 { font-size: 14px; font-weight: 600; margin: 0; color: var(--text-dark); }
.year-card small { font-size: 11px; color: var(--text-gray); }
.year-card.locked { cursor: not-allowed; overflow: hidden; background: rgba(255, 255, 255, .75); isolation: isolate; }
.year-card.locked .year-card-content { filter: blur(0px); opacity: 0.45; user-select: none; }
.year-card.locked::after { content: ''; position: absolute; inset: 0; z-index: 1; background: rgba(255, 255, 255, .22); backdrop-filter: blur(1px); }
.year-card-lock { position: absolute; top: 50%; left: 50%; z-index: 2; margin: 0 !important; transform: translate(-50%, -50%); padding: 9px; border-radius: 50%; background: rgba(255, 255, 255, .92); color: #4b5563 !important; font-size: 25px !important; line-height: 1; box-shadow: 0 2px 8px rgba(0, 0, 0, .14); }

/* --- Modules --- */
.module-card { background: #fff; padding: 20px; border-radius: var(--border-radius); box-shadow: var(--shadow); margin-bottom: 20px; height: 100%; display: flex; flex-direction: column; justify-content: space-between; }
.module-icon-box { width: 50px; height: 50px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 0; flex-shrink: 0; }

/* --- All Modules List --- */
.modules-list-container { background: #fff; border-radius: var(--border-radius); box-shadow: var(--shadow); padding: 20px; margin-top: 24px; }
.modules-list-header { display: grid; grid-template-columns: 30px 2fr 1.5fr 1.2fr 1.2fr 20px; padding-bottom: 12px; border-bottom: 2px solid #e5e7eb; font-size: 13px; font-weight: 600; color: var(--text-gray); }
.modules-list-row { display: grid; grid-template-columns: 30px 2fr 1.5fr 1.2fr 1.2fr 20px; padding: 14px 0; border-bottom: 1px solid #f3f4f6; align-items: center; font-size: 14px; }
.modules-list-row:last-child { border-bottom: none; }
.ml-module { display: flex; align-items: center; gap: 12px; }
.ml-icon { width: 32px; height: 32px; background: #f3f4f6; border-radius: 6px; display: flex; align-items: center; justify-content: center; }

/* --- Right Panel --- */
.right-panel { width: 320px; background: #fff; border-left: 1px solid #e5e7eb; padding: 20px; overflow-y: auto; flex-shrink: 0; }
.right-panel-toggle { display: none; border: 0; padding: 0; background: transparent; color: var(--text-gray); font-size: 24px; line-height: 1; cursor: pointer; }
.right-panel-toggle:hover { color: var(--text-dark); }
.year-question-total { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid #dbeafe; border-radius: 12px; background: #eff6ff; }
.year-question-total__icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: #2563eb; color: #fff; font-size: 22px; }
.year-question-total strong { color: #1e3a8a; font-size: 24px; line-height: 1; }
.year-question-total span { font-size: 12px; }
.premium-locked-section { position: relative; min-height: 120px; display: grid; place-items: center; }
.premium-locked-section .premium-lock-content { filter: blur(4px); opacity: .55; pointer-events: none; user-select: none; width: 100%; }
.premium-lock-label { position: absolute; z-index: 1; display: inline-flex; align-items: center; gap: 5px; padding: 7px 13px; border-radius: 999px; background: #1e3a8a; color: #fff; font-size: 13px; font-weight: 700; box-shadow: 0 4px 14px rgba(30, 58, 138, .3); }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
.quick-item { background: var(--bg-light); padding: 16px; border-radius: var(--border-radius); text-align: center; font-size: 12px; font-weight: 500; transition: 0.2s; cursor: pointer; }
.quick-item:hover { background: #e5e7eb; }
.quick-item i { font-size: 24px; display: block; margin-bottom: 6px; }

/* --- Custom Arrow Button Styling --- */
.module-nav-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; padding: 0; }
.module-nav-btn:disabled { opacity: 0.5; }

/* --- Academic Progress Custom Styles --- */
.acad-stat-card { background: #fff; border-radius: var(--border-radius); padding: 16px; box-shadow: var(--shadow); text-align: center; height: 100%; display: flex; flex-direction: column; justify-content: center; border: 1px solid transparent; }
.acad-stat-card .stat-val { font-size: 24px; font-weight: 700; margin: 0; line-height: 1.2; }
.acad-stat-card .stat-label { font-size: 12px; color: var(--text-gray); margin-bottom: 8px; display: block; }
.acad-stat-card .stat-change { font-size: 11px; margin-top: 4px; display: block; }
.acad-stat-card .progress { height: 4px; margin-top: 6px; }

/* Donut Chart */
.donut-wrap { position: relative; width: 130px; height: 130px; margin: 0 auto; }
.donut-chart { width: 100%; height: 100%; border-radius: 50%; background: conic-gradient(#3b82f6 0% 78%, #ef4444 78% 97.5%, #10b981 97.5% 100%); position: relative; }
.donut-inner { position: absolute; top: 15px; left: 15px; right: 15px; bottom: 15px; background: #fff; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-text-num { font-size: 28px; font-weight: 700; color: var(--text-dark); line-height: 1; }
.donut-text-label { font-size: 12px; color: var(--text-gray); }
.donut-legend { display: flex; flex-direction: column; gap: 6px; font-size: 13px; margin-top: 16px; }
.donut-legend-item { display: flex; justify-content: space-between; align-items: center; }
.donut-legend-item span:first-child { display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Activity List */
.activity-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f3f4f6; }
.activity-item:last-child { border-bottom: none; }
.act-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 14px; color: #fff; }
.act-text { flex-grow: 1; font-size: 13px; }
.act-text strong { font-weight: 600; color: var(--text-dark); display: block; }
.act-text small { color: var(--text-gray); display: block; }
.act-time { font-size: 11px; color: #9ca3af; white-space: nowrap; margin-top: 4px; }

/* Subject Bars */
.subj-bar-item { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.subj-bar-item:last-child { margin-bottom: 0; }
.subj-header { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; color: var(--text-dark); }
.subj-track { height: 6px; border-radius: 4px; background: #f3f4f6; overflow: hidden; width: 100%; }
.subj-fill { height: 100%; border-radius: 4px; }

/* Badges Grid */
.badge-box { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; margin: 0 auto 6px; }
.badge-card { background: #fff; border-radius: 12px; padding: 14px; text-align: center; box-shadow: var(--shadow); }
.badge-card-button { border: 0; color: inherit; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.badge-card-button:hover, .badge-card-button:focus-visible { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(15, 23, 42, .14); outline: 2px solid #2563eb; outline-offset: 2px; }
.badge-detail-icon { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.badge-detail-icon img { width: 40px; height: 40px; object-fit: contain; }
.badge-detail-stat { background: #f8fafc; border-radius: 10px; padding: 12px 8px; min-height: 68px; }

/* --- Responsive --- */
@media (max-width: 1200px) {
    .right-panel {
        position: fixed;
        z-index: 1000;
        top: 0;
        right: -340px;
        height: 100vh;
        height: 100dvh;
        box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
        transition: right 0.3s ease;
    }
    .right-panel.open { right: 0; }
    .right-panel-overlay { display: none; position: fixed; z-index: 999; inset: 0; background: rgba(0, 0, 0, 0.5); }
    .right-panel-overlay.show { display: block; }
    .right-panel-toggle { display: block; }
}
@media (max-width: 992px) { 
    .sidebar { position: fixed; left: -260px; top: 0; height: 100vh; height: 100dvh; box-shadow: 0 0 20px rgba(0,0,0,0.2); }
    .sidebar.open { left: 0; }
    .sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 999; }
    .sidebar-overlay.show { display: block; }
    .topbar .menu-toggle { display: block !important; }
}
@media (max-width: 768px) {
    /* Use the document as the scroller on phones. Nested viewport-height
       scrollers can clip the first or last section when mobile browser bars
       expand or collapse. */
    html,
    body {
        height: auto;
        min-height: 100vh;
        min-height: 100svh;
        min-height: 100dvh;
        overflow-x: clip;
        overflow-y: auto;
        overscroll-behavior-y: auto;
    }
    .app-wrapper {
        height: auto;
        min-height: 100vh;
        min-height: 100svh;
        min-height: 100dvh;
        overflow-x: clip;
    }
    .main-content-area {
        height: auto;
        overflow: visible;
    }
    .topbar { flex-direction: row; justify-content: space-between; gap: 8px; align-items: center; padding: 16px; }
    .topbar > .d-flex { flex: 0 0 auto; gap: 12px !important; }
    .user-area { min-width: 0; margin-left: auto; gap: 12px; }
    .user-area .d-md-block { display: block !important; max-width: 72px; }
    .user-area .lh-1 h6 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px !important; }
    .user-area .lh-1 small { display: none; }
    .search-box { width: 100%; }
    .page-container { flex: 0 0 auto; overflow: visible; padding: 16px; padding-bottom: max(32px, env(safe-area-inset-bottom)); }
    .topbar, .page-container { width: 100%; max-width: 100%; }
    .page-container img, .page-container video, .page-container canvas { max-width: 100%; height: auto; }
    .page-container input, .page-container select, .page-container textarea, .page-container button { max-width: 100%; }
    .right-panel { width: min(320px, 100vw); }
    .welcome-banner { flex-direction: row; align-items: center; gap: 16px; padding: 24px; }
    .welcome-user-name { display: block; }
    .overall-progress { align-self: flex-end; }
    .auth-page-content { min-height: 100vh; min-height: 100svh; min-height: 100dvh; padding-top: 1.5rem !important; padding-bottom: max(1.5rem, env(safe-area-inset-bottom)) !important; }
    .auth-card { margin: 0 auto; padding: 24px; }
    .modules-list-container { padding: 16px; }
    #dynamic-table { overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
    .modules-list-header, .modules-list-row { min-width: 680px; font-size: 12px; }
}
.menu-toggle { display: none; font-size: 24px; cursor: pointer; }

/* Server-rendered visual deterrent for authenticated protected pages. The
   fixed, pointer-inert layer never participates in document scrolling. */
.security-watermark-layer {
    position: fixed;
    inset: 0;
    z-index: 1040;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
    pointer-events: none;
    user-select: none;
    mix-blend-mode: difference;
}
.security-watermark-cell { position: relative; min-width: 0; }
.security-watermark {
    --watermark-x: 0%;
    --watermark-y: 0%;
    --watermark-rotation: -15deg;
    position: absolute;
    top: 50%;
    left: 50%;
    color: #fff;
    font-size: clamp(12px, 1.5vw, 18px);
    font-weight: 600;
    letter-spacing: .08em;
    line-height: 1;
    opacity: .12;
    white-space: nowrap;
    transform: translate3d(var(--watermark-x), var(--watermark-y), 0) rotate(var(--watermark-rotation));
}
.security-watermark-cell:nth-child(4n + 2) .security-watermark { --watermark-rotation: -25deg; }
.security-watermark-cell:nth-child(4n + 3) .security-watermark { --watermark-rotation: 10deg; }
.security-watermark-cell:nth-child(4n) .security-watermark { --watermark-rotation: 20deg; }
@media (max-width: 768px) {
    .security-watermark-layer { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(7, minmax(0, 1fr)); }
    .security-watermark { font-size: clamp(12px, 3.5vw, 16px); }
}

/* Utilities */
.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 500; display: inline-block; }
.status-progress { background: #dbeafe; color: #2563eb; }
.status-completed { background: #d1fae5; color: #059669; }
.status-locked { background: #f3f4f6; color: #6b7280; }
.status-not-started { background: #f3f4f6; color: #6b7280; }
.progress-bar-custom { height: 6px; background: #e5e7eb; border-radius: 4px; width: 85%; }
.progress-bar-custom .fill { height: 100%; border-radius: 4px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }

/* Module tabs */
.nav-tabs .nav-link {
    color: var(--text-gray);
    border: none;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    padding: 12px 20px;
    transition: 0.2s;
}
.nav-tabs .nav-link:hover { border-color: transparent; color: var(--text-dark); }
.nav-tabs .nav-link.active {
    color: var(--primary-blue);
    border: none;
    border-bottom: 2px solid var(--primary-blue);
    background: transparent;
}
.module-tab-pane { padding: 24px 0 0 0; }

/* Published text content keeps the existing modal layout while making medical
   articles, tables, images, and reusable callouts easy to study. */
#textContentModal .modal-dialog { max-width: min(1140px, calc(100vw - 2rem)); }
#textContentModal .modal-content { min-height: min(82vh, 860px); }
#textContentModalBody { max-width: 940px; margin: 0 auto; line-height: 1.8; overflow-wrap: anywhere; word-break: break-word; white-space: normal; }
#textContentModalBody h1, #textContentModalBody h2, #textContentModalBody h3 { color: var(--text-dark); font-weight: 700; margin: 1.4rem 0 .7rem; }
#textContentModalBody h1 { font-size: 1.8rem; } #textContentModalBody h2 { font-size: 1.45rem; } #textContentModalBody h3 { font-size: 1.2rem; }
#textContentModalBody img { display: block; width: auto; max-width: 100%; height: auto; margin: 1rem auto; border-radius: 8px; }
#textContentModalBody table { width: 100%; margin: 1rem 0; border-collapse: collapse; background: #fff; color: var(--text-dark); } #textContentModalBody th, #textContentModalBody td { padding: .65rem; border: 1px solid #dbe2ea; background: #fff; color: var(--text-dark); } #textContentModalBody th { background: #eff6ff; color: #1e3a8a; font-weight: 700; }
#textContentModalBody blockquote { margin: 1rem 0; padding-left: 1rem; color: var(--text-gray); border-left: 4px solid #93c5fd; }
#textContentModalBody .medical-callout { margin: 1rem 0; padding: 1rem; border-left: 4px solid #2563eb; border-radius: 8px; background: #eff6ff; }
#textContentModalBody .medical-callout p { margin: .5rem 0 0; } #textContentModalBody .medical-clinical-pearl { border-color: #059669; background: #ecfdf5; } #textContentModalBody .medical-warning { border-color: #d97706; background: #fffbeb; } #textContentModalBody .medical-clinical-case { border-color: #7c3aed; background: #f5f3ff; } #textContentModalBody .medical-diagnosis { border-color: #dc2626; background: #fef2f2; } #textContentModalBody .medical-treatment { border-color: #0891b2; background: #ecfeff; } #textContentModalBody .medical-pathophysiology { border-color: #4f46e5; background: #eef2ff; }

/* Auth Page */
.auth-card {
    max-width: 520px;
    width: 100%;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.08);
    padding: 32px;
    margin: 40px auto;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.auth-logo img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.auth-logo h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.auth-logo span {
    color: var(--text-gray);
    font-size: 13px;
}

.auth-form {
    display: block;
}

.auth-form.hidden {
    display: none !important;
}

.auth-toggle {
    margin-top: 16px;
    text-align: center;
    color: var(--text-gray);
    font-size: 14px;
}

.auth-toggle a {
    color: var(--primary-blue);
    font-weight: 600;
    cursor: pointer;
}

/* --- Highest Score / Latest Score --- */

.score-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.score-card {
    width: 100%;
    min-height: 145px;

    background: #f8f9fc;
    border: 1px solid #dfe3ea;
    border-radius: 12px;

    padding: 14px 8px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    text-align: center;
}

.score-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;

    background: #eff6ff;
    color: #2563eb;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 22px;
    margin-bottom: 8px;
}

.score-label {
    font-size: 11px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.score-value {
    font-size: 25px;
    line-height: 1;
    font-weight: 700;
    color: #111827;
    margin-bottom: 7px;
}

.score-date {
    display: block;
    font-size: 9px;
    color: #9ca3af;
}

/* --- Dark mode ---------------------------------------------------------- */
html.dark-mode {
    color-scheme: dark;
    --primary-dark: #101a32;
    --primary-blue: #79a9ff;
    --bg-light: #111827;
    --text-dark: #e6edf7;
    --text-gray: #a7b3c7;
    --shadow: 0 8px 24px rgba(0, 0, 0, .22);
}

.dark-mode body { background: var(--bg-light); }
.dark-mode .main-content-area { background: var(--bg-light); }
.dark-mode .topbar, .dark-mode .right-panel { background: #172033; border-color: #2a3952; }
.dark-mode .year-question-total { background: #1e3a5f; border-color: #315783; }
.dark-mode .year-question-total strong { color: #bfdbfe; }
.dark-mode .sidebar { background: #10182a; }
.dark-mode .sidebar-menu .nav-link { color: #bcc9dc; }
.dark-mode .sidebar-menu .nav-link:hover, .dark-mode .sidebar-menu .nav-link.active { background: #253552; color: #fff; }
.dark-mode .theme-toggle { color: #f8c56b; background: #26324a; border-color: #3a4b6b; }
.dark-mode .theme-toggle:hover { background: #324363; border-color: #5774a9; }
.dark-mode .notification-count { border-color: #172033; }

/* Bootstrap components and the few page-specific white surfaces. */
.dark-mode .card, .dark-mode .modal-content, .dark-mode .dropdown-menu,
.dark-mode .year-card, .dark-mode .module-card, .dark-mode .modules-list-container,
.dark-mode .acad-stat-card, .dark-mode .badge-card, .dark-mode .auth-card {
    background-color: #172033 !important;
    color: var(--text-dark);
    border-color: #2a3952 !important;
}
.dark-mode .bg-white, .dark-mode .bg-light, .dark-mode .list-group-item { background-color: #1d293d !important; color: var(--text-dark) !important; }
.dark-mode .text-dark { color: var(--text-dark) !important; }
.dark-mode .text-muted, .dark-mode .form-text { color: var(--text-gray) !important; }
.dark-mode .border, .dark-mode .border-bottom, .dark-mode .border-top, .dark-mode hr, .dark-mode .dropdown-divider { border-color: #2a3952 !important; }
.dark-mode .dropdown-item, .dark-mode .dropdown-header { color: var(--text-dark); }
.dark-mode .dropdown-item:hover, .dark-mode .dropdown-item:focus { background: #263552; color: #fff; }
.dark-mode .table { --bs-table-color: var(--text-dark); --bs-table-bg: #172033; --bs-table-border-color: #2a3952; --bs-table-striped-bg: #1d293d; --bs-table-hover-bg: #253552; }
.dark-mode .form-control, .dark-mode .form-select, .dark-mode textarea,
.dark-mode .input-group-text { background-color: #111a2b; color: var(--text-dark); border-color: #3a4a66; }
.dark-mode .form-control::placeholder { color: #8391a8; }
.dark-mode .form-control:focus, .dark-mode .form-select:focus { background-color: #111a2b; color: var(--text-dark); border-color: #79a9ff; box-shadow: 0 0 0 .25rem rgba(121, 169, 255, .18); }
.dark-mode .form-control:read-only, .dark-mode .form-select:disabled { background-color: #202d42; }
.dark-mode .btn-light { --bs-btn-color: var(--text-dark); --bs-btn-bg: #263552; --bs-btn-border-color: #3a4a66; --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #324363; }
.dark-mode .progress, .dark-mode .progress-bar-custom, .dark-mode .subj-track { background-color: #2a3952; }
.dark-mode .quick-item, .dark-mode .badge-detail-stat, .dark-mode .score-card { background: #1d293d; border-color: #2a3952; }
.dark-mode .quick-item:hover { background: #263552; }
.dark-mode .year-card.active { background: #1a2d4d; }
.dark-mode .year-card.locked, .dark-mode .year-card.locked::after { background: rgba(23, 32, 51, .82); }
.dark-mode .year-card-lock { background: #2a3952; color: #c8d5e9 !important; }
.dark-mode .modules-list-header { border-color: #3a4a66; }
.dark-mode .modules-list-row, .dark-mode .activity-item { border-color: #2a3952; }
.dark-mode .ml-icon { background: #263552; }
.dark-mode .donut-inner { background: #172033; }
.dark-mode #textContentModalBody table, .dark-mode #textContentModalBody th, .dark-mode #textContentModalBody td { background: #172033; color: var(--text-dark); border-color: #3a4a66; }
.dark-mode #textContentModalBody th { background: #1d3358; color: #cfe0ff; }
.dark-mode #textContentModalBody .medical-callout { background: #172b4a; }
.dark-mode #textContentModalBody .medical-clinical-pearl { background: #12372f; }
.dark-mode #textContentModalBody .medical-warning { background: #3a2d15; }
.dark-mode #textContentModalBody .medical-clinical-case { background: #2c2149; }
.dark-mode #textContentModalBody .medical-diagnosis { background: #421f2a; }
.dark-mode #textContentModalBody .medical-treatment { background: #123640; }
.dark-mode #textContentModalBody .medical-pathophysiology { background: #202b50; }
.dark-mode .status-progress { background: #173a66; color: #a8c9ff; }
.dark-mode .status-completed { background: #123d35; color: #8ee5c3; }
.dark-mode .status-locked, .dark-mode .status-not-started { background: #2a3952; color: #b8c5d8; }
