@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('../fonts/open-sans-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Open Sans';
    font-style: italic;
    font-weight: 300 400;
    font-display: swap;
    src: url('../fonts/open-sans-italic.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    /* Brand — "Slate & Amber".
       Two roles, deliberately kept apart: `primary` is the near-black ink that
       carries solid fills (buttons, page headers, navbar), and `accent` is the
       amber that marks interactive *text*. Overloading one token for both would
       either make links indistinguishable from body copy, or force amber behind
       white text where it fails contrast. */
    --color-primary: #1C1917;
    --color-primary-hover: #292524;
    --color-primary-active: #0C0A09;
    --color-primary-tint: #F5F3F0;
    --color-accent: #B45309;
    --color-accent-hover: #92400E;
    --color-accent-tint: #FEF6E7;
    --color-navbar-bg: #1C1917;
    --color-navbar-border: #0C0A09;

    /* Label colour for things sitting on a background that does NOT follow the
       theme — the navbar, and any badge tinted from a course/category colour
       stored in the database. Those stay dark in both themes, so their text has
       to stay light in both. Deliberately not overridden under .dark-mode:
       using --color-surface here would flip it to near-black and make course
       badges unreadable in dark mode. */
    --color-on-dark: #fff;

    /* Neutrals — warm stone rather than cold grey, so white cards sit on a
       page that reads as paper instead of concrete. */
    --color-surface: #fff;
    --color-bg-page: #FAF9F7;
    --color-bg-subtle: #F5F3F0;
    --color-border: #EFEBE6;
    --color-border-strong: #DDD8D1;
    --color-text: #1C1917;
    --color-text-muted: #57534E;
    --color-text-faint: #6B635C;
    --color-text-subtle: #7D756F;

    /* Semantic status colors. Warning leans red-orange so it stays readable
       next to the amber accent. Every value clears 4.5:1 on white. */
    --color-success: #027A48;      --color-success-tint: #ECFDF3; --color-success-text: #027A48;
    --color-info: #175CD3;         --color-info-tint: #EFF8FF;    --color-info-text: #175CD3;
    --color-warning: #C2410C;      --color-warning-tint: #FFF4ED; --color-warning-text: #C2410C;
    --color-danger: #B42318;       --color-danger-tint: #FEF3F2;  --color-danger-text: #B42318;

    /* Spacing scale */
    --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
    --space-5: 20px; --space-6: 24px; --space-7: 32px; --space-8: 40px;

    /* Radius scale */
    --radius-xs: 3px; --radius-sm: 4px; --radius-md: 6px; --radius-lg: 8px; --radius-pill: 999px;

    /* Shadow scale (soft) */
    --shadow-sm: 0 1px 4px rgba(28,25,23,0.06);
    --shadow-md: 0 4px 14px rgba(28,25,23,0.10);
    --shadow-lg: 0 10px 28px rgba(28,25,23,0.14);

    /* Font-size scale */
    --font-xs: 11px; --font-sm: 12px; --font-base: 14px; --font-md: 15px;
    --font-lg: 16px; --font-xl: 18px; --font-2xl: 22px; --font-3xl: 26px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--color-bg-page);
    color: var(--color-text);
    min-height: 100vh;
}

a { color: inherit; }

/* Navbar */
.navbar-main {
    background-color: var(--color-navbar-bg);
    padding: 0 30px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--color-navbar-border);
}

.navbar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.navbar-brand .logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.navbar-brand .logo-icon svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.navbar-brand .brand-text {
    color: var(--color-on-dark);
    font-size: 20px;
    letter-spacing: 2px;
}

.navbar-brand .brand-text span {
    font-style: italic;
    font-weight: 300;
}

.navbar-brand .brand-sub {
    color: rgba(255,255,255,0.72);
    font-size: 9px;
    letter-spacing: 4px;
    text-transform: uppercase;
    display: block;
    margin-top: -2px;
}

.navbar-nav {
    display: flex;
    align-items: center;
    list-style: none;
    gap: 2px;
}

.navbar-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.navbar-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--color-surface);
    border-radius: var(--radius-xs);
    transition: transform var(--transition-base), opacity var(--transition-base);
}

.navbar-nav .nav-item {
    position: relative;
}

.navbar-nav .nav-link {
    color: var(--color-text-subtle);
    text-decoration: none;
    padding: 10px 14px;
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
    border-radius: 3px;
    font-weight: 500;
    white-space: nowrap;
}

.navbar-nav .nav-link:hover {
    color: var(--color-on-dark);
    background-color: rgba(255,255,255,0.08);
}

.navbar-nav .nav-link .nav-icon {
    font-size: 15px;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--color-surface);
    border-radius: 4px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
    min-width: 210px;
    padding: 6px 0;
    z-index: 1001;
}

.nav-item:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 10px 18px;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s;
}

.dropdown-menu a:hover {
    background-color: var(--color-bg-subtle);
    color: var(--color-accent);
}

.dropdown-menu .divider {
    height: 1px;
    background: var(--color-border);
    margin: 4px 0;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1C1917 0%, #292524 55%, #44372A 100%);
}

.login-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-card .login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-card .login-logo .logo-circle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.login-card .login-logo .logo-circle svg {
    width: 30px;
    height: 30px;
    fill: white;
}

.login-card .login-logo h2 {
    font-size: 22px;
    color: var(--color-text);
    letter-spacing: 2px;
}

.login-card .login-logo h2 span {
    font-style: italic;
    font-weight: 300;
}

.login-card .login-logo p {
    color: var(--color-text-faint);
    font-size: 10px;
    letter-spacing: 4px;
    text-transform: uppercase;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--color-text-muted);
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--color-border-strong);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    outline: none;
    background: var(--color-surface);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(192,57,43,0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 11px 22px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.4;
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-surface);
    width: 100%;
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
}

.btn-success {
    background-color: var(--color-primary);
    color: var(--color-surface);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 12px;
    padding: 14px 30px;
    border-radius: 25px;
}

.btn-success:hover {
    background-color: var(--color-primary-hover);
}

.btn-sm {
    padding: 7px 14px;
    font-size: 12px;
}

.btn-danger {
    background-color: var(--color-danger);
    color: var(--color-surface);
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-warning {
    background-color: var(--color-accent);
    color: var(--color-text);
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-info {
    background-color: var(--color-primary);
    color: var(--color-surface);
}

.btn-info:hover {
    background-color: var(--color-primary-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--color-primary);
    color: var(--color-accent);
}

.btn-outline:hover {
    background: var(--color-primary);
    color: var(--color-surface);
}

.btn-outline-light {
    background: transparent;
    border: 1px solid var(--color-border-strong);
    color: var(--color-text-muted);
}

.btn-outline-light:hover {
    background: var(--color-bg-subtle);
    border-color: var(--color-text-subtle);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-danger {
    background-color: var(--color-danger-tint);
    color: #721c24;
    border: 1px solid var(--color-danger-tint);
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid var(--color-success-tint);
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Page Header */
.page-header {
    background-color: var(--color-primary);
    color: var(--color-surface);
    padding: 18px 28px;
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 0;
    border-radius: 6px 6px 0 0;
    letter-spacing: 0.5px;
}

/* Content Container */
.content-wrapper {
    max-width: 1100px;
    margin: 25px auto;
    padding: 0 20px;
}

.content-wrapper.wide {
    max-width: 1300px;
}

.content-wrapper.narrow {
    max-width: 800px;
}

.content-card {
    background: var(--color-surface);
    border-radius: 6px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
    overflow: hidden;
}

/* Course Grid */
.course-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
    padding: 28px;
}

.course-card {
    background: var(--color-surface);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: var(--color-text);
    display: block;
}

.course-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.13);
}

.course-thumbnail {
    width: 100%;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: var(--color-on-dark);
    padding: 15px;
    position: relative;
}

.course-thumbnail-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.course-thumbnail .course-abbr {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 2px;
}

.course-thumbnail .course-subtitle {
    font-size: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-align: center;
    margin-top: 4px;
    font-weight: 700;
}

.course-thumbnail .course-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.course-thumbnail .iw-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    background: rgba(255,255,255,0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.course-thumbnail .iw-badge svg {
    width: 12px;
    height: 12px;
    fill: white;
}

.course-card-body {
    padding: 14px;
    text-align: center;
}

.course-card-body h3 {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
    line-height: 1.4;
}

/* Course Detail */
.course-banner {
    text-align: center;
    padding: 30px;
    background: var(--color-surface);
}

.banner-placeholder {
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: var(--color-on-dark);
    font-weight: 700;
}

.course-banner img,
.course-banner .banner-placeholder {
    max-width: 250px;
    height: 180px;
    margin: 0 auto;
    border-radius: var(--radius-lg);
    object-fit: cover;
}

.course-description {
    padding: 0 40px 20px;
    line-height: 1.8;
    font-size: 14px;
    color: var(--color-text-muted);
}

.course-description a {
    color: #9b59b6;
    text-decoration: none;
}

.course-description a:hover {
    text-decoration: underline;
}

.completion-banner {
    text-align: center;
    padding: 20px;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: none;
    margin-top: 10px;
}

.tab {
    flex: 1;
    text-align: center;
    padding: 13px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
    color: var(--color-text-faint);
    background: var(--color-bg-subtle);
    transition: all 0.2s;
}

.tab.active {
    background: var(--color-primary);
    color: var(--color-surface);
}

.tab:hover:not(.active) {
    background: var(--color-border-strong);
}

/* Progress Bar */
.progress-section {
    padding: 30px 40px;
    text-align: center;
}

.progress-section h2 {
    font-size: 22px;
    font-weight: 400;
    color: var(--color-text);
    margin-bottom: 15px;
}

.progress-bar-container {
    width: 100%;
    height: 5px;
    background: var(--color-border-strong);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-success), #20c997);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 14px;
    color: var(--color-text-muted);
}

/* Unit & Lesson List */
.unit-list {
    padding: 0 40px 40px;
}

.unit-header {
    background: var(--color-bg-subtle);
    padding: 14px 20px;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: 0.5px;
    border-radius: 4px 4px 0 0;
    margin-top: 25px;
    border: 1px solid var(--color-border-strong);
}

.lesson-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border: 1px solid var(--color-border-strong);
    border-top: none;
    font-size: 13px;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: background 0.15s;
}

.lesson-item:hover {
    background: var(--color-bg-subtle);
}

.lesson-item .check-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    margin-right: 15px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lesson-item .check-icon.completed {
    background: var(--color-success);
}

.lesson-item .check-icon.completed svg {
    width: 12px;
    height: 12px;
    fill: white;
}

.lesson-item .check-icon.incomplete {
    border: 2px solid var(--color-border-strong);
    background: var(--color-surface);
}

.lesson-item.quiz-item {
    background: var(--color-warning-tint);
    border-left: 3px solid #f39c12;
}

.lesson-item.quiz-item .check-icon.incomplete {
    border-color: var(--color-accent);
}

.lesson-item .quiz-status {
    margin-left: auto;
    font-size: var(--font-xs);
    font-weight: 600;
}

.lesson-item .quiz-status.passed { color: var(--color-success-text); }
.lesson-item .quiz-status.pending { color: var(--color-accent); }

.notice-box {
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    margin: 0 var(--space-5) var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.notice-box.warning {
    background: var(--color-warning-tint);
    border: 1px solid #ffe0b2;
}

.notice-box .notice-icon {
    font-size: 24px;
}

.notice-box .notice-title {
    font-size: var(--font-base);
}

.notice-box.warning .notice-title { color: var(--color-warning-text); }

.notice-box p {
    font-size: var(--font-sm);
    color: var(--color-text-muted);
    margin-top: 3px;
}

.notice-box a {
    color: var(--color-accent);
    font-weight: 600;
}

/* Lesson Content Page */
.lesson-content {
    padding: 40px;
    line-height: 1.8;
    font-size: 15px;
}

.lesson-body-text {
    text-align: center;
}

.lesson-content h1 {
    font-size: 22px;
    margin-bottom: 20px;
    color: var(--color-text);
}

.lesson-nav {
    display: flex;
    justify-content: space-between;
    padding: 20px 40px;
    border-top: 1px solid var(--color-border);
}

.lesson-nav .btn {
    padding: 10px 20px;
}

/* Lesson Resources */
.resource-list {
    padding: 0 40px 30px;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-text);
    margin-bottom: var(--space-2);
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.resource-item:hover {
    background: var(--color-bg-subtle);
    border-color: var(--color-primary);
}

.resource-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--color-primary-tint);
    color: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-lg);
    flex-shrink: 0;
}

.resource-meta {
    flex: 1;
    min-width: 0;
}

.resource-meta .resource-name {
    font-size: var(--font-base);
    font-weight: 600;
    color: var(--color-text);
}

.resource-meta .resource-type {
    font-size: var(--font-xs);
    color: var(--color-text-faint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.resource-download-btn {
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--color-accent);
    flex-shrink: 0;
}

/* ========================
   DASHBOARD
   ======================== */
.welcome-banner {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
    border-radius: var(--radius-lg);
    padding: var(--space-7) var(--space-8);
    color: var(--color-surface);
    margin-bottom: var(--space-6);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.welcome-banner .welcome-title {
    font-size: var(--font-2xl);
    font-weight: 600;
    margin-bottom: 5px;
}

.welcome-banner .welcome-sub {
    font-size: var(--font-sm);
    opacity: 0.85;
}

.welcome-banner .welcome-progress {
    text-align: center;
}

.welcome-banner .welcome-progress .welcome-progress-value {
    font-size: 36px;
    font-weight: 700;
}

.welcome-banner .welcome-progress .welcome-progress-label {
    font-size: var(--font-xs);
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-6);
}

.dashboard-grid > div {
    min-width: 0;
}

.panel-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header strong {
    font-size: var(--font-md);
}

.panel-link {
    font-size: var(--font-sm);
    color: var(--color-accent);
    text-decoration: none;
}

.panel-link:hover {
    text-decoration: underline;
}

.empty-state {
    padding: var(--space-8);
    text-align: center;
    color: var(--color-text-faint);
}

.empty-state p {
    font-size: var(--font-md);
}

.empty-state.compact {
    padding: var(--space-6);
    font-size: var(--font-base);
}

.course-progress-row {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-bg-subtle);
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.course-progress-row:last-child {
    border-bottom: none;
}

.course-progress-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-on-dark);
    font-size: var(--font-base);
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}

.course-progress-icon-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.course-progress-info {
    flex: 1;
    min-width: 0;
}

.course-progress-info .course-progress-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: var(--space-2);
}

.course-progress-info .course-progress-title {
    font-size: var(--font-base);
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.course-progress-info .course-progress-pct {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--color-text-faint);
    flex-shrink: 0;
}

.course-progress-info .course-progress-pct.complete {
    color: var(--color-success);
}

.course-progress-info .course-progress-bottom {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
}

.course-progress-info .course-progress-meta {
    font-size: var(--font-xs);
    color: var(--color-text-subtle);
}

.course-progress-info .course-progress-cert-link {
    font-size: var(--font-xs);
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
}

.activity-row {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-bg-subtle);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.activity-row:last-child {
    border-bottom: none;
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-text {
    font-size: var(--font-sm);
    color: var(--color-text-muted);
    line-height: 1.4;
}

.activity-meta {
    font-size: var(--font-xs);
    color: var(--color-text-subtle);
    margin-top: 2px;
}

.announcement-list-item {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-bg-subtle);
}

.announcement-list-item:last-child {
    border-bottom: none;
}

.announcement-list-item .announcement-title {
    font-size: var(--font-base);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
}

.announcement-list-item .announcement-excerpt {
    font-size: var(--font-sm);
    color: var(--color-text-muted);
    line-height: 1.5;
}

.announcement-list-item .announcement-date {
    font-size: var(--font-xs);
    color: var(--color-text-subtle);
    margin-top: 4px;
}

/* ========================
   FILTERS
   ======================== */
.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    padding: 7px var(--space-4);
    border-radius: var(--radius-pill);
    font-size: var(--font-sm);
    font-weight: 600;
    text-decoration: none;
    color: var(--color-text-muted);
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border-strong);
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.filter-pill:hover {
    border-color: var(--color-primary);
    color: var(--color-accent);
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.search-form {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    flex-wrap: wrap;
}

.search-input-wrap {
    position: relative;
}

.search-input-wrap input {
    padding: 8px 14px 8px 34px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    font-size: var(--font-sm);
    width: 220px;
    outline: none;
    font-family: inherit;
}

.search-input-wrap .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-subtle);
    font-size: var(--font-base);
}

.filter-select {
    padding: 8px var(--space-4);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    font-size: var(--font-sm);
    background: var(--color-surface);
    cursor: pointer;
    font-family: inherit;
}

.search-submit-btn {
    padding: 8px var(--space-4);
    background: var(--color-primary);
    color: var(--color-surface);
    border: none;
    border-radius: var(--radius-pill);
    font-size: var(--font-sm);
    cursor: pointer;
    font-family: inherit;
}

.search-submit-btn:hover {
    background: var(--color-primary-hover);
}

.search-clear-link {
    font-size: var(--font-xs);
    color: var(--color-accent);
    text-decoration: none;
}

.filter-pill.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-surface);
}

/* ========================
   NOTIFICATIONS
   ======================== */
.notification-list {
    padding: 0;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-bg-subtle);
    position: relative;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item.unread {
    background: var(--color-primary-tint);
    border-left: 3px solid var(--color-primary);
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-bg-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-lg);
    flex-shrink: 0;
}

.notification-item .notification-body {
    flex: 1;
    min-width: 0;
}

.notification-item .notification-text {
    font-size: var(--font-base);
    color: var(--color-text);
    line-height: 1.4;
}

.notification-item .notification-time {
    font-size: var(--font-xs);
    color: var(--color-text-subtle);
    margin-top: 3px;
}

.notification-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    flex-shrink: 0;
    margin-top: 6px;
}

/* ========================
   LEADERBOARD PODIUM
   ======================== */
.leaderboard-intro {
    text-align: center;
    margin-bottom: var(--space-6);
}

.leaderboard-intro h1 {
    font-size: var(--font-2xl);
    font-weight: 700;
}

.leaderboard-intro p {
    font-size: var(--font-sm);
    color: var(--color-text-faint);
}

.leaderboard-intro .my-rank {
    font-size: var(--font-base);
    margin-top: var(--space-2);
}

.leaderboard-intro .my-rank strong {
    color: var(--color-accent);
}

.rank-cell {
    text-align: center;
    font-weight: 700;
    color: var(--color-text-faint);
}

.rank-cell.top3 {
    color: var(--color-accent);
}

.table-row-me {
    background: var(--color-primary-tint);
    font-weight: 600;
}

.leaderboard-name {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.you-tag {
    font-size: var(--font-xs);
    color: var(--color-accent);
}

.points-cell {
    text-align: center;
    font-weight: 700;
    color: var(--color-accent);
}

.podium {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    align-items: end;
}

.podium-place {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-5) var(--space-4);
    text-align: center;
}

.podium-place.first {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: var(--color-surface);
    padding-top: var(--space-6);
    order: 2;
}

.podium-place.second {
    order: 1;
}

.podium-place.third {
    order: 3;
}

.podium-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto var(--space-3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-xl);
    font-weight: 700;
    background: var(--color-bg-subtle);
    color: var(--color-text);
}

.podium-place.first .podium-avatar {
    width: 72px;
    height: 72px;
    background: rgba(255,255,255,0.25);
    color: var(--color-surface);
}

.podium-rank {
    font-size: var(--font-xs);
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.85;
    margin-bottom: 2px;
}

.podium-name {
    font-size: var(--font-base);
    font-weight: 600;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.podium-points {
    font-size: var(--font-sm);
    opacity: 0.85;
}

/* ========================
   STATUS BADGES
   ======================== */
.status-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: var(--radius-pill);
    font-size: var(--font-xs);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.status-badge.completed { background: var(--color-success-tint); color: var(--color-success-text); }
.status-badge.pending { background: var(--color-warning-tint); color: var(--color-warning-text); }
.status-badge.failed { background: var(--color-danger-tint); color: var(--color-danger-text); }
.status-badge.rejected { background: var(--color-danger-tint); color: var(--color-danger-text); }
.status-badge.refunded { background: var(--color-info-tint); color: var(--color-info-text); }

/* ========================
   PROFILE
   ======================== */
.profile-body {
    padding: var(--space-7);
}

.profile-header-row {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    margin-bottom: var(--space-7);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--color-border);
}

.avatar-wrap {
    position: relative;
}

.avatar-wrap img {
    border: 3px solid var(--color-primary);
    object-fit: cover;
    border-radius: 50%;
}

.avatar-edit-btn {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 28px;
    height: 28px;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid var(--color-surface);
    font-size: var(--font-xs);
    color: var(--color-surface);
}

.profile-name {
    font-size: var(--font-xl);
    font-weight: 600;
    color: var(--color-text);
}

.profile-email {
    font-size: var(--font-sm);
    color: var(--color-text-faint);
    margin-top: 2px;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-7);
}

.profile-stat {
    text-align: center;
    padding: var(--space-4);
    background: var(--color-bg-subtle);
    border-radius: var(--radius-lg);
}

.profile-stat .profile-stat-value {
    font-size: 26px;
    font-weight: 700;
}

.profile-stat .profile-stat-label {
    font-size: var(--font-sm);
    color: var(--color-text-faint);
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-title {
    font-size: var(--font-md);
    font-weight: 600;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 2px solid var(--color-primary);
}

.section-title.accent-purple { border-color: #6c63ff; }
.section-title.accent-warning { border-color: var(--color-accent); }

.pref-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.pref-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    font-size: var(--font-base);
}

.pref-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
}

.pref-item .pref-desc {
    font-size: var(--font-xs);
    color: var(--color-text-faint);
    margin-left: auto;
}

.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

/* ========================
   RESULT PAGES
   ======================== */
.result-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-5);
    font-size: 40px;
}

.result-icon.success { background: var(--color-success-tint); }
.result-icon.danger { background: var(--color-danger-tint); }
.result-icon.warning { background: var(--color-warning-tint); }

.result-heading {
    font-size: var(--font-2xl);
    font-weight: 600;
    margin-bottom: 8px;
}

.result-heading.success { color: var(--color-success-text); }
.result-heading.danger { color: var(--color-danger-text); }
.result-heading.warning { color: var(--color-warning-text); }

.result-message {
    font-size: var(--font-md);
    color: var(--color-text-muted);
    margin-bottom: var(--space-6);
}

.result-submessage {
    font-size: var(--font-sm);
    color: var(--color-text-faint);
    margin-top: 4px;
    margin-bottom: var(--space-7);
}

.receipt-box {
    background: var(--color-bg-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-6);
    text-align: left;
}

.receipt-box h3 {
    font-size: var(--font-base);
    font-weight: 600;
    margin-bottom: var(--space-3);
    color: var(--color-text);
}

.receipt-table {
    width: 100%;
    font-size: var(--font-sm);
}

.receipt-table td {
    padding: 6px 0;
    color: var(--color-text);
}

.receipt-table td:first-child {
    color: var(--color-text-faint);
}

.receipt-table td:last-child {
    text-align: right;
}

.receipt-table code {
    font-size: var(--font-xs);
    background: var(--color-border);
    padding: 2px 6px;
    border-radius: var(--radius-xs);
}

.result-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
}

.result-footnote {
    font-size: var(--font-xs);
    color: var(--color-text-subtle);
    margin-top: var(--space-5);
}

/* Printing a payment receipt: hide chrome, keep just the receipt box. */
@media print {
    .navbar-main, .footer, .result-icon, .result-heading, .result-message,
    .result-actions, .result-footnote {
        display: none !important;
    }
    .receipt-box {
        background: none !important;
        box-shadow: none !important;
    }
}

/* ========================
   DISCUSSIONS
   ======================== */
.discussion-topic {
    padding: var(--space-5) var(--space-6);
    margin-bottom: var(--space-3);
}

.discussion-topic-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
}

.discussion-topic-top {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: 6px;
}

.discussion-topic-title {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
}

.discussion-topic-meta {
    font-size: var(--font-sm);
    color: var(--color-text-faint);
}

.pinned-badge {
    font-size: var(--font-xs);
    background: var(--color-warning-tint);
    color: var(--color-warning-text);
    padding: 2px var(--space-2);
    border-radius: var(--radius-pill);
    font-weight: 600;
}

.discussion-reply-count {
    text-align: center;
    min-width: 60px;
}

.discussion-reply-count .count-value {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--color-accent);
}

.discussion-reply-count .count-label {
    font-size: var(--font-xs);
    color: var(--color-text-faint);
}

.discussion-post {
    padding: var(--space-6) var(--space-7);
    margin-bottom: var(--space-5);
}

.discussion-post h1 {
    font-size: var(--font-xl);
    font-weight: 600;
    margin-bottom: var(--space-3);
}

.discussion-meta-line {
    font-size: var(--font-xs);
    color: var(--color-text-faint);
    margin-bottom: var(--space-4);
}

.discussion-body {
    font-size: var(--font-base);
    color: var(--color-text-muted);
    line-height: 1.7;
    white-space: pre-wrap;
}

.discussion-reply {
    padding: var(--space-4) var(--space-6);
    margin-bottom: var(--space-3);
}

.discussion-reply-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-2);
    font-size: var(--font-sm);
}

.discussion-reply-time {
    font-size: var(--font-xs);
    color: var(--color-text-subtle);
}

.role-tag {
    font-size: 10px;
    color: var(--color-surface);
    padding: 1px 6px;
    border-radius: var(--radius-pill);
    margin-left: 4px;
}

.role-tag.admin { background: var(--color-primary); }
.role-tag.ambassador { background: var(--color-warning-text); }

/* ========================
   QUIZ
   ======================== */
.quiz-body {
    padding: 30px 35px;
}

.breadcrumb {
    margin-bottom: var(--space-4);
    font-size: var(--font-sm);
    color: var(--color-text-faint);
}

.breadcrumb a {
    color: var(--color-accent);
    text-decoration: none;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-5);
    gap: var(--space-3);
}

.quiz-header h1 {
    font-size: var(--font-2xl);
    font-weight: 600;
    margin-bottom: 4px;
}

.quiz-header .quiz-meta {
    font-size: var(--font-sm);
    color: var(--color-text-faint);
}

.quiz-best-score {
    text-align: right;
}

.quiz-best-score .quiz-best-score-label {
    font-size: var(--font-xs);
    color: var(--color-text-faint);
}

.quiz-best-score .quiz-best-score-value {
    font-size: var(--font-xl);
    font-weight: 700;
}

.quiz-best-score .quiz-best-score-value.passed { color: var(--color-success-text); }
.quiz-best-score .quiz-best-score-value.failed { color: var(--color-danger-text); }

.quiz-result-banner {
    text-align: center;
    padding: var(--space-7);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
}

.quiz-result-banner.passed { background: var(--color-success-tint); }
.quiz-result-banner.failed { background: var(--color-danger-tint); }

.quiz-result-banner .quiz-result-icon {
    font-size: 48px;
    margin-bottom: var(--space-2);
}

.quiz-result-banner h2 {
    font-size: var(--font-3xl);
    margin-bottom: 5px;
}

.quiz-result-banner.passed h2 { color: var(--color-success-text); }
.quiz-result-banner.failed h2 { color: var(--color-danger-text); }

.quiz-result-banner p {
    font-size: var(--font-lg);
    color: var(--color-text-muted);
}

.quiz-review-item {
    margin-bottom: var(--space-5);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--color-border-strong);
    background: var(--color-bg-subtle);
}

.quiz-review-item.correct { border-left-color: var(--color-success-text); }
.quiz-review-item.wrong { border-left-color: var(--color-danger-text); }

.quiz-review-question {
    font-weight: 600;
    margin-bottom: var(--space-3);
    font-size: var(--font-base);
    display: flex;
    justify-content: space-between;
}

.quiz-review-status {
    font-size: var(--font-sm);
}

.quiz-review-status.correct { color: var(--color-success-text); }
.quiz-review-status.wrong { color: var(--color-danger-text); }

.quiz-option-review {
    padding: var(--space-2) var(--space-3);
    margin: 4px 0;
    border-radius: 5px;
    font-size: var(--font-sm);
    border: 1px solid var(--color-border);
    background: transparent;
}

.quiz-option-review.correct-answer {
    background: var(--color-success-tint);
    border-color: #a5d6a7;
}

.quiz-option-review.wrong-selected {
    background: var(--color-danger-tint);
    border-color: #ef9a9a;
}

.quiz-option-review .correct-tag {
    color: var(--color-success-text);
    font-size: var(--font-xs);
}

.quiz-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    margin-top: var(--space-5);
}

.quiz-question {
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--color-border);
}

.quiz-question-text {
    font-weight: 600;
    margin-bottom: var(--space-3);
    font-size: var(--font-base);
}

.quiz-question-number {
    display: inline-block;
    width: 28px;
    height: 28px;
    background: var(--color-primary);
    color: var(--color-surface);
    border-radius: 50%;
    text-align: center;
    line-height: 28px;
    font-size: var(--font-sm);
    margin-right: var(--space-2);
}

.quiz-option-label {
    display: block;
    padding: 10px var(--space-4);
    margin: 6px 0;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--font-sm);
    transition: all var(--transition-fast);
}

.quiz-option-label:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-tint);
}

.quiz-option-label input[type="radio"] {
    margin-right: var(--space-3);
}

/* ========================
   ADMIN PANEL STYLES
   ======================== */
.admin-layout {
    display: flex;
    min-height: calc(100vh - 56px);
}

.admin-sidebar {
    width: 240px;
    background: #292524;
    color: #A8A29E;
    padding: 20px 0;
    flex-shrink: 0;
}

.admin-sidebar .sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 10px;
}

.admin-sidebar .sidebar-header h3 {
    color: var(--color-on-dark);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 1px;
}

.admin-sidebar .sidebar-header p {
    font-size: 11px;
    color: #A8A29E;
    margin-top: 3px;
}

.admin-sidebar .sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: #A8A29E;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.admin-sidebar .sidebar-nav a:hover,
.admin-sidebar .sidebar-nav a.active {
    color: var(--color-on-dark);
    background: rgba(255,255,255,0.04);
    border-left-color: var(--color-primary);
}

.admin-sidebar .sidebar-nav a .sidebar-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.admin-content {
    flex: 1;
    padding: 25px 30px;
    background: var(--color-bg-page);
    overflow-y: auto;
}

.admin-content h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 20px;
}

/* Stat Cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--color-surface);
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-card .stat-icon.blue { background: var(--color-info-tint); }
.stat-card .stat-icon.green { background: var(--color-success-tint); }
.stat-card .stat-icon.orange { background: var(--color-warning-tint); }
.stat-card .stat-icon.purple { background: #f3e5f5; }

.stat-card .stat-info h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
}

.stat-card .stat-info p {
    font-size: 12px;
    color: var(--color-text-faint);
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Admin Navigation Hub */
.nav-hub-banner {
    background: linear-gradient(135deg, var(--color-navbar-bg), #1a1a1a);
    border-radius: var(--radius-lg);
    padding: var(--space-7) var(--space-6);
    text-align: center;
    color: var(--color-on-dark);
    margin-bottom: var(--space-6);
}

.nav-hub-banner-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin: 0 auto var(--space-3);
}

.nav-hub-banner h1 {
    font-size: var(--font-3xl);
    margin: 0 0 var(--space-2);
    color: var(--color-on-dark);
}

.nav-hub-banner p {
    color: rgba(255,255,255,0.75);
    font-size: var(--font-base);
    margin: 0 0 var(--space-5);
}

.nav-hub-banner-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.nav-hub-stat-pill {
    background: rgba(255,255,255,0.1);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-pill);
    font-size: var(--font-sm);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.nav-hub-stat-pill.live {
    background: rgba(40,167,69,0.2);
    color: #6fdc8c;
}

.nav-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-5);
}

.nav-hub-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.nav-hub-card-header {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.nav-hub-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--color-primary-tint);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.nav-hub-card h3 {
    font-size: var(--font-md);
    margin: 0 0 2px;
    color: var(--color-text);
}

.nav-hub-card p {
    font-size: var(--font-sm);
    color: var(--color-text-faint);
    margin: 0;
    line-height: 1.4;
}

.nav-hub-card-badges {
    display: flex;
    gap: var(--space-3);
    font-size: var(--font-xs);
    color: var(--color-text-subtle);
    margin-bottom: var(--space-4);
}

.nav-hub-card-btn {
    margin-top: auto;
    display: block;
    text-align: center;
    background: var(--color-primary-tint);
    color: var(--color-accent);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--font-sm);
    font-weight: 600;
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-hub-card-btn:hover {
    background: var(--color-primary);
    color: var(--color-surface);
}

.quick-links-bar, .system-info-bar {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-5);
}

.quick-links-bar h4, .system-info-bar h4 {
    font-size: var(--font-base);
    margin: 0 0 var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.quick-links-pills, .system-info-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.quick-link-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    font-size: var(--font-sm);
    color: var(--color-text);
    text-decoration: none;
    transition: border-color var(--transition-fast), color var(--transition-fast);
}

.quick-link-pill:hover {
    border-color: var(--color-primary);
    color: var(--color-accent);
}

.system-info-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--color-bg-subtle);
    border-radius: var(--radius-pill);
    font-size: var(--font-sm);
    color: var(--color-text-muted);
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: var(--color-bg-subtle);
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--color-border-strong);
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--color-bg-subtle);
    color: var(--color-text-muted);
    vertical-align: middle;
}

.data-table tr:hover {
    background: var(--color-bg-subtle);
}

.data-table .actions {
    display: flex;
    gap: 6px;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-student { background: var(--color-info-tint); color: var(--color-info); }
.badge-ambassador { background: var(--color-warning-tint); color: var(--color-warning); }
.badge-admin { background: #f3e5f5; color: #7b1fa2; }
.badge-active { background: var(--color-success-tint); color: var(--color-success-text); }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--color-surface);
    border-radius: 8px;
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal.fullscreen-editor {
    position: fixed;
    inset: 0;
    max-width: none;
    width: auto;
    max-height: none;
    height: auto;
    margin: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal.fullscreen-editor > form {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.modal.fullscreen-editor .modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
}

.modal.fullscreen-editor .lesson-content-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 0;
}

.modal.fullscreen-editor .lesson-content-group > div[id$="LessonEditor"] {
    flex: 1;
    min-height: 0;
    height: auto !important;
}

.editor-image-resize-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    line-height: 0;
}

.editor-image-resize-wrapper.is-selected {
    outline: 1px dashed var(--color-accent);
}

.editor-image-resize-wrapper img {
    max-width: 100%;
    height: auto;
}

.editor-image-resize-handle {
    display: none;
    position: absolute;
    width: 12px;
    height: 12px;
    right: -6px;
    bottom: -6px;
    background: var(--color-accent);
    border: 2px solid var(--color-surface);
    border-radius: 50%;
    cursor: nwse-resize;
    box-shadow: 0 0 2px rgba(0,0,0,0.4);
}

.editor-image-resize-wrapper.is-selected .editor-image-resize-handle {
    display: block;
}

/* Tiptap editor */
.tiptap-editor-wrapper {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border-strong);
}

.tiptap-toolbar {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 6px;
    border-bottom: 1px solid var(--color-border-strong);
    background: var(--color-bg-subtle);
}

.tiptap-toolbar-divider {
    width: 1px;
    align-self: stretch;
    margin: 2px 4px;
    background: var(--color-border-strong);
    flex-shrink: 0;
}

.tiptap-btn {
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    color: var(--color-text-muted);
}

.tiptap-btn:hover {
    background: var(--color-border);
    border-color: var(--color-border-strong);
}

.tiptap-btn.active {
    background: var(--color-accent-tint);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.tiptap-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tiptap-color-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    color: var(--color-text-muted);
}

.tiptap-color-btn:hover {
    background: var(--color-border);
}

.tiptap-color-btn input[type="color"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.tiptap-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: var(--color-surface);
}

.tiptap-content .ProseMirror {
    height: 100%;
    padding: 12px 15px;
    outline: none;
}

.rich-text-content h1, .course-description h1, .lesson-body-text h1 { font-size: 1.6em; margin: 0.6em 0 0.3em; }
.rich-text-content h2, .course-description h2, .lesson-body-text h2 { font-size: 1.35em; margin: 0.6em 0 0.3em; }
.rich-text-content h3, .course-description h3, .lesson-body-text h3 { font-size: 1.15em; margin: 0.6em 0 0.3em; }
.rich-text-content p, .course-description p, .lesson-body-text p { margin: 0 0 0.75em; }
.rich-text-content ul, .rich-text-content ol,
.course-description ul, .course-description ol,
.lesson-body-text ul, .lesson-body-text ol { padding-left: 1.5em; margin: 0 0 0.75em; }
.rich-text-content blockquote, .course-description blockquote, .lesson-body-text blockquote { border-left: 3px solid var(--color-border-strong); margin: 0 0 0.75em; padding-left: 1em; color: var(--color-text-muted); }
.rich-text-content pre, .course-description pre, .lesson-body-text pre { background: var(--color-bg-subtle); border-radius: 4px; padding: 10px 12px; overflow-x: auto; }
.rich-text-content code, .course-description code, .lesson-body-text code { background: var(--color-bg-subtle); border-radius: 3px; padding: 1px 4px; }
.rich-text-content pre code, .course-description pre code, .lesson-body-text pre code { background: none; padding: 0; }
.rich-text-content img, .course-description img, .lesson-body-text img { max-width: 100%; height: auto; }
.rich-text-content a { color: var(--color-accent); }

/* Indent levels from content authored in the old Quill editor (class-based
   rather than TinyMCE's inline margin-left), kept so existing content still
   displays indented. */
.course-description [class*="ql-indent-"], .lesson-body-text [class*="ql-indent-"] { margin-left: 0; }
.course-description .ql-indent-1, .lesson-body-text .ql-indent-1 { margin-left: 2em; }
.course-description .ql-indent-2, .lesson-body-text .ql-indent-2 { margin-left: 4em; }
.course-description .ql-indent-3, .lesson-body-text .ql-indent-3 { margin-left: 6em; }
.course-description .ql-indent-4, .lesson-body-text .ql-indent-4 { margin-left: 8em; }
.course-description .ql-indent-5, .lesson-body-text .ql-indent-5 { margin-left: 10em; }
.course-description .ql-indent-6, .lesson-body-text .ql-indent-6 { margin-left: 12em; }
.course-description .ql-indent-7, .lesson-body-text .ql-indent-7 { margin-left: 14em; }
.course-description .ql-indent-8, .lesson-body-text .ql-indent-8 { margin-left: 16em; }
.course-description .ql-video, .lesson-body-text .ql-video { display: block; max-width: 100%; width: 100%; height: 400px; margin: 0.75em 0; }

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 17px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--color-text-faint);
    padding: 0;
    line-height: 1;
}

.modal-close:hover { color: var(--color-text); }

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ========================
   AMBASSADOR STYLES
   ======================== */
.ambassador-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.amb-card {
    background: var(--color-surface);
    border-radius: 6px;
    padding: 22px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.amb-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-primary);
}

.team-member {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
    gap: 12px;
}

.team-member:last-child {
    border-bottom: none;
}

.member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-surface);
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}

.member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.member-avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.member-avatar.md { width: 48px; height: 48px; font-size: 16px; }
.member-avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.member-avatar.xl { width: 80px; height: 80px; font-size: 28px; }

.member-info h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.member-info p {
    font-size: 11px;
    color: var(--color-text-faint);
    margin-top: 1px;
}

.progress-mini {
    width: 100%;
    height: 4px;
    background: var(--color-border-strong);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.progress-mini .fill {
    height: 100%;
    background: var(--color-success);
    border-radius: 2px;
}

.announcement-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--color-bg-subtle);
}

.announcement-item:last-child {
    border-bottom: none;
}

.announcement-item h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 5px;
}

.announcement-item p {
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.announcement-item .date {
    font-size: 11px;
    color: var(--color-text-subtle);
    margin-top: 5px;
}

/* (Responsive rules moved below loading spinner section) */

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--color-text-faint);
    font-size: 11px;
    margin-top: 40px;
    letter-spacing: 0.5px;
}

/* ========================
   COURSE PRICING
   ======================== */
.course-price-tag {
    margin-top: 10px;
    font-size: 13px;
    font-weight: 700;
}

.price-free {
    color: var(--color-success);
    background: var(--color-success-tint);
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 11px;
    letter-spacing: 1px;
}

.price-paid {
    color: var(--color-info);
    background: var(--color-info-tint);
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 11px;
    letter-spacing: 1px;
}

.price-pending {
    color: var(--color-warning);
    background: var(--color-warning-tint);
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.price-amount {
    color: var(--color-surface);
    background: var(--color-primary);
    padding: 4px 14px;
    border-radius: 12px;
    font-size: 13px;
    letter-spacing: 0.5px;
}

/* ========================
   CHECKOUT PAGE
   ======================== */
.checkout-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.checkout-course-info {
    padding: 30px;
    border-right: 1px solid var(--color-border);
}

.checkout-payment-form {
    padding: 30px;
}

.checkout-price-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--color-bg-subtle);
    border-radius: 6px;
    margin-top: 15px;
    border: 1px solid var(--color-border-strong);
}

.checkout-label {
    font-size: 14px;
    color: var(--color-text-muted);
    font-weight: 500;
}

.checkout-amount {
    font-size: 26px;
    font-weight: 700;
    color: var(--color-accent);
}

.payment-instructions {
    background: var(--color-bg-subtle);
    border-radius: 6px;
    padding: 18px;
    margin-bottom: 22px;
    border: 1px solid var(--color-border-strong);
}

.payment-instructions h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 10px;
}

.payment-instructions ol {
    padding-left: 18px;
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.8;
}

.payment-methods-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 22px;
}

.pay-method-option {
    padding: 14px;
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
    text-align: center;
}

.pay-method-option strong {
    display: block;
    font-size: 12px;
    color: var(--color-text);
    margin-bottom: 4px;
}

.pay-method-option span {
    font-size: 12px;
    color: var(--color-text-faint);
}

.pay-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}

.pay-method-card {
    padding: var(--space-4);
    border: 2px solid var(--color-border-strong);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: center;
}

.pay-method-card:hover {
    border-color: var(--color-primary);
}

.pay-method-card.active {
    border-color: var(--color-primary);
    background: var(--color-primary-tint);
}

.pay-method-card .pay-method-icon {
    font-size: 28px;
    margin-bottom: var(--space-2);
}

.pay-method-card strong {
    display: block;
    font-size: var(--font-sm);
    color: var(--color-text);
    margin-bottom: 3px;
}

.pay-method-card span {
    font-size: var(--font-xs);
    color: var(--color-text-faint);
}

.checkout-security-note {
    margin-top: var(--space-5);
    padding: var(--space-3) var(--space-4);
    background: var(--color-success-tint);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-success-tint);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-sm);
    color: var(--color-success-text);
}

.checkout-benefits-list {
    margin-top: var(--space-3);
    font-size: var(--font-sm);
    color: var(--color-text-subtle);
}

.checkout-benefits-list ul {
    margin-top: 5px;
    padding-left: var(--space-4);
    line-height: 2;
}

@media (max-width: 768px) {
    .checkout-layout {
        grid-template-columns: 1fr;
    }
    .checkout-course-info {
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }
    .payment-methods-display {
        grid-template-columns: 1fr;
    }
}

/* ========================
   LOADING SPINNER
   ======================== */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: var(--color-surface);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.page-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--color-text-faint);
    gap: 10px;
}

.page-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border-strong);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ========================
   ENHANCED MOBILE RESPONSIVE
   ======================== */
@media (max-width: 992px) {
    .course-grid { grid-template-columns: repeat(3, 1fr); }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .ambassador-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .course-grid { grid-template-columns: repeat(2, 1fr); }

    .navbar-main {
        padding: 0 10px;
        flex-wrap: wrap;
        height: auto;
        min-height: 56px;
    }

    .navbar-brand {
        font-size: 13px;
    }

    .navbar-toggle {
        display: flex;
    }

    .navbar-nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--color-navbar-bg);
        box-shadow: var(--shadow-lg);
        padding: 6px 0;
        z-index: 1001;
    }

    .navbar-nav.open {
        display: flex;
    }

    .navbar-nav .nav-item {
        width: 100%;
    }

    .navbar-nav .nav-link {
        padding: 12px 20px;
        font-size: 12px;
        letter-spacing: 0.5px;
    }

    .navbar-nav .dropdown-menu {
        display: none;
        position: static;
        box-shadow: none;
        background: rgba(0,0,0,0.15);
        border-radius: 0;
        min-width: 0;
        padding: 0;
    }

    .navbar-nav .nav-item.open .dropdown-menu {
        display: block;
    }

    .navbar-nav .dropdown-menu a {
        color: var(--color-border-strong);
        padding: 10px 34px;
    }

    .navbar-nav .dropdown-menu a:hover {
        background-color: rgba(255,255,255,0.08);
    }

    .content-wrapper {
        padding: 10px;
        margin-top: 10px;
    }

    .content-wrapper.wide {
        padding: 10px;
    }

    .course-description,
    .unit-list,
    .progress-section {
        padding-left: 15px;
        padding-right: 15px;
    }

    .lesson-content {
        padding: 20px 15px;
    }

    .lesson-nav {
        padding: 15px;
        flex-direction: column;
        gap: 10px;
    }

    .lesson-nav .btn {
        text-align: center;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab {
        flex: unset;
        padding: 10px 14px;
        font-size: 11px;
        letter-spacing: 0.5px;
    }

    .admin-sidebar {
        width: 54px;
    }

    .admin-sidebar .sidebar-header h3,
    .admin-sidebar .sidebar-header p,
    .admin-sidebar .sidebar-nav a span:not(.sidebar-icon) {
        display: none;
    }

    .admin-sidebar .sidebar-nav a {
        justify-content: center;
        padding: 12px;
    }

    .admin-content {
        padding: 15px;
    }

    .admin-content h1 {
        font-size: 18px;
    }

    .ambassador-grid { grid-template-columns: 1fr; }

    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }

    /* Mobile-friendly data tables */
    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-content, .modal {
        max-width: 92vw;
        margin: 16px;
    }

    /* Learner UI mobile fixes */
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .welcome-banner {
        text-align: center;
        justify-content: center;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-form {
        width: 100%;
    }

    .search-input-wrap {
        flex: 1;
        min-width: 0;
    }

    .search-input-wrap input {
        width: 100%;
    }

    .quiz-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .quiz-best-score {
        text-align: left;
    }

    .profile-header-row {
        flex-wrap: wrap;
    }

    .discussion-topic-row {
        flex-wrap: wrap;
    }

    .discussion-reply-count {
        text-align: left;
        min-width: 0;
    }

    .leaderboard-intro h1 {
        font-size: 20px;
    }

    .checkout-course-info,
    .checkout-payment-form {
        padding: 20px;
    }

    .pay-methods,
    .payment-methods-display {
        grid-template-columns: 1fr;
    }

    .course-banner .banner-placeholder,
    .course-banner img {
        max-width: 100%;
    }

    .notification-item .notification-text,
    .resource-meta .resource-name {
        word-break: break-word;
    }

    .quiz-body {
        padding: 20px !important;
    }
}

@media (max-width: 480px) {
    .course-grid { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr; }

    .navbar-nav .nav-link {
        padding: 8px 5px;
        font-size: 9px;
    }

    .login-card, .register-card {
        padding: 25px 20px;
    }

    .checkout-layout {
        grid-template-columns: 1fr;
    }

    .checkout-course-info {
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        padding: 20px;
    }

    .checkout-payment-form {
        padding: 20px;
    }

    .profile-stats,
    .two-col-grid,
    .podium {
        grid-template-columns: 1fr;
    }

    .podium-place.first,
    .podium-place.second,
    .podium-place.third {
        order: 0;
    }
}

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* ========================
   DARK MODE
   ======================== */
/* Dark mode is expressed by re-pointing the same tokens rather than by
   restating every rule. Anything already written as var(--color-*) flips
   automatically; only genuinely dark-specific rules need to appear below.

   Two inversions worth noting:
   - `primary` becomes the amber fill. In light mode it is near-black carrying
     white text; on a dark page a near-black fill would vanish. Because buttons
     set their label to var(--color-surface), which is dark here, an amber fill
     lands dark-on-light and stays legible.
   - status colours lighten and their tints darken, so a tinted badge still
     reads as a badge instead of a bright block. */
body.dark-mode {
    --color-primary: #D97706;
    --color-primary-hover: #B45309;
    --color-primary-active: #92400E;
    --color-primary-tint: #332A1E;
    --color-accent: #FBBF24;
    --color-accent-hover: #FCD34D;
    --color-accent-tint: #332A1E;
    --color-navbar-bg: #14110F;
    --color-navbar-border: #0C0A09;

    --color-surface: #292524;
    --color-bg-page: #1C1917;
    --color-bg-subtle: #332E2B;
    --color-border: #3F3A36;
    --color-border-strong: #57534E;
    --color-text: #E7E5E4;
    --color-text-muted: #D6D3D1;
    --color-text-faint: #B5AEA8;
    --color-text-subtle: #A39B94;

    --color-success: #6FDC8C;  --color-success-tint: #14321F; --color-success-text: #81C784;
    --color-info: #64B5F6;     --color-info-tint: #16283D;    --color-info-text: #64B5F6;
    --color-warning: #FBBF24;  --color-warning-tint: #3A2A12; --color-warning-text: #FFB74D;
    --color-danger: #EF9A9A;   --color-danger-tint: #3D1C1C;  --color-danger-text: #EF9A9A;

    --shadow-sm: 0 1px 4px rgba(0,0,0,0.35);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.45);
    --shadow-lg: 0 10px 28px rgba(0,0,0,0.55);

    background-color: var(--color-bg-page);
    color: var(--color-text);
}

body.dark-mode .navbar-main {
    background-color: var(--color-surface);
    border-bottom-color: var(--color-bg-subtle);
}

body.dark-mode .content-card,
body.dark-mode .amb-card,
body.dark-mode .stat-card {
    background: var(--color-surface);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    color: var(--color-text);
}

body.dark-mode .content-card a { color: var(--color-danger-text); }

/* In light mode the header band is the near-black ink. Left alone it would
   inherit the amber that `primary` becomes here, which is far too loud for a
   full-width band on a dark page — so it gets its own elevated surface, with
   the amber kept for buttons and links. */
body.dark-mode .page-header {
    background-color: var(--color-bg-subtle);
    background-image: none;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
}

/* Anything explicitly coloured for the light header band needs to follow it. */
body.dark-mode .page-header a,
body.dark-mode .page-header .btn-outline-light {
    color: var(--color-text) !important;
    border-color: var(--color-border-strong) !important;
}

body.dark-mode .course-card {
    background: var(--color-surface);
}

body.dark-mode .course-card-body h3 {
    color: var(--color-text);
}

body.dark-mode .unit-header {
    background: var(--color-bg-subtle);
    color: var(--color-text);
    border-color: var(--color-border);
}

body.dark-mode .lesson-item {
    border-color: var(--color-border);
    color: var(--color-text);
}

body.dark-mode .lesson-item:hover {
    background: var(--color-bg-subtle);
}

body.dark-mode .lesson-item.quiz-item {
    background: var(--color-warning-tint);
}

body.dark-mode .notice-box.warning {
    background: var(--color-warning-tint);
    border-color: var(--color-warning-tint);
}

body.dark-mode .tabs {
    background: var(--color-bg-subtle);
}

body.dark-mode .tab {
    background: var(--color-surface);
    color: var(--color-text-subtle);
}

body.dark-mode .tab:hover:not(.active) {
    background: var(--color-border);
}

body.dark-mode .data-table th {
    background: var(--color-bg-subtle);
    color: var(--color-text-subtle);
    border-bottom-color: var(--color-border);
}

body.dark-mode .data-table td {
    color: var(--color-text);
    border-bottom-color: var(--color-border);
}

body.dark-mode .data-table tr:hover {
    background: var(--color-bg-subtle);
}

body.dark-mode .admin-content {
    background: var(--color-navbar-bg);
}

body.dark-mode .modal-content,
body.dark-mode .modal {
    background: var(--color-surface);
    color: var(--color-text);
}

body.dark-mode .modal-header {
    border-bottom-color: var(--color-border);
}

body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea {
    background: var(--color-bg-subtle);
    border-color: var(--color-border);
    color: var(--color-text);
}

body.dark-mode .form-group label {
    color: var(--color-text-subtle);
}

body.dark-mode .dropdown-menu {
    background: var(--color-surface);
    border-color: var(--color-bg-subtle);
}

body.dark-mode .dropdown-menu a {
    color: var(--color-text);
}

body.dark-mode .dropdown-menu a:hover {
    background: var(--color-bg-subtle);
}

body.dark-mode .progress-bar-container {
    background: var(--color-bg-subtle);
}

body.dark-mode .course-description {
    color: var(--color-text-subtle);
}

body.dark-mode .footer {
    color: var(--color-text-muted);
}

body.dark-mode .alert-danger {
    background: var(--color-danger-tint);
    color: var(--color-danger-text);
    border-color: var(--color-danger-tint);
}

body.dark-mode .badge-student { background: var(--color-bg-subtle); color: var(--color-info-text); }
body.dark-mode .badge-ambassador { background: var(--color-warning-tint); color: var(--color-warning-text); }
body.dark-mode .badge-admin { background: var(--color-primary-tint); color: var(--color-accent); }

body.dark-mode .status-badge.completed { background: var(--color-success-tint); color: var(--color-success-text); }
body.dark-mode .status-badge.pending { background: var(--color-warning-tint); color: var(--color-warning-text); }
body.dark-mode .status-badge.failed,
body.dark-mode .status-badge.rejected { background: var(--color-danger-tint); color: var(--color-danger-text); }
body.dark-mode .status-badge.refunded { background: var(--color-bg-subtle); color: var(--color-info-text); }

body.dark-mode .panel-header,
body.dark-mode .course-progress-row,
body.dark-mode .activity-row,
body.dark-mode .announcement-list-item,
body.dark-mode .notification-item,
body.dark-mode .resource-item {
    border-color: var(--color-border);
}

body.dark-mode .resource-item:hover {
    background: var(--color-bg-subtle);
}

body.dark-mode .notification-item.unread {
    background: rgba(192,57,43,0.15);
}

body.dark-mode .empty-state {
    color: var(--color-text-faint);
}

body.dark-mode .filter-pill {
    background: var(--color-bg-subtle);
    border-color: var(--color-border);
    color: var(--color-text);
}

body.dark-mode .search-input-wrap input,
body.dark-mode .filter-select {
    background: var(--color-bg-subtle);
    border-color: var(--color-border);
    color: var(--color-text);
}

body.dark-mode .podium-place {
    background: var(--color-surface);
}

body.dark-mode .podium-avatar {
    background: var(--color-bg-subtle);
    color: var(--color-text);
}

body.dark-mode .pay-method-card {
    background: var(--color-surface);
    border-color: var(--color-border);
}

body.dark-mode .pay-method-card strong {
    color: var(--color-text);
}

body.dark-mode .pay-method-option {
    border-color: var(--color-border);
}

body.dark-mode .quiz-review-item {
    background: var(--color-bg-subtle);
}

body.dark-mode .quiz-option-review {
    border-color: var(--color-border);
    color: var(--color-text);
}

body.dark-mode .quiz-question {
    border-color: var(--color-border);
}

body.dark-mode .quiz-option-label {
    border-color: var(--color-border);
    color: var(--color-text);
}

body.dark-mode .quiz-option-label:hover {
    background: rgba(192,57,43,0.15);
}

body.dark-mode .profile-header-row {
    border-color: var(--color-border);
}

body.dark-mode .profile-stat {
    background: var(--color-bg-subtle);
}

body.dark-mode .profile-name {
    color: var(--color-text);
}

body.dark-mode .table-row-me {
    background: rgba(192,57,43,0.15);
}

body.dark-mode .discussion-body,
body.dark-mode .discussion-topic-title {
    color: var(--color-text);
}

body.dark-mode .pinned-badge {
    background: var(--color-warning-tint);
    color: var(--color-warning-text);
}

body.dark-mode .receipt-box {
    background: var(--color-bg-subtle);
}

body.dark-mode .receipt-box h3,
body.dark-mode .receipt-table td {
    color: var(--color-text);
}

body.dark-mode .receipt-table code {
    background: var(--color-border);
}

/* Dark mode toggle switch */
.dark-mode-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.toggle-switch {
    width: 44px;
    height: 24px;
    background: var(--color-border-strong);
    border-radius: 12px;
    position: relative;
    transition: background 0.3s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch.active {
    background: var(--color-primary);
}

.toggle-switch.active::after {
    transform: translateX(20px);
}
