/*
 * BUniverse LMS Shell — buniverse-shell.css
 * Phase 27B: CSS variables, layout, components.
 * No CDN. No build step. Vanilla CSS only.
 * Dark theme by default; [data-theme="light"] overrides.
 */

/* ============================================================
   1. RESET & BOX MODEL
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ============================================================
   2. CSS VARIABLES — DARK THEME (DEFAULT)
   ============================================================ */
:root,
[data-theme="dark"] {
    /* Brand */
    --brand-primary:       #6366f1;
    --brand-primary-hover: #4f46e5;
    --brand-primary-muted: #3730a3;
    --brand-accent:        #a78bfa;
    --brand-accent-dim:    #7c3aed;

    /* Surface */
    --bg-base:         #0f1117;
    --bg-surface:      #1a1d27;
    --bg-elevated:     #22263a;
    --bg-overlay:      #2c3150;
    --bg-hover:        #313659;

    /* Borders */
    --border-subtle:   #2e3350;
    --border-default:  #3d4466;
    --border-focus:    #6366f1;

    /* Text */
    --text-primary:    #f1f3fa;
    --text-secondary:  #9ca3c0;
    --text-muted:      #6b7291;
    --text-inverse:    #0f1117;
    --text-link:       #818cf8;
    --text-link-hover: #a5b4fc;

    /* Status */
    --color-success:        #22c55e;
    --color-success-bg:     #052e16;
    --color-success-border: #15803d;
    --color-warning:        #f59e0b;
    --color-warning-bg:     #1c1300;
    --color-warning-border: #92400e;
    --color-error:          #ef4444;
    --color-error-bg:       #1a0a0a;
    --color-error-border:   #991b1b;
    --color-info:           #38bdf8;
    --color-info-bg:        #07192b;
    --color-info-border:    #0369a1;

    /* Badges */
    --badge-xp-bg:    #1e1b4b;
    --badge-xp-text:  #a78bfa;
    --badge-new-bg:   #052e16;
    --badge-new-text: #4ade80;

    /* Topbar */
    --topbar-bg:      #151827;
    --topbar-border:  #2e3350;
    --topbar-height:  56px;

    /* Sidebar */
    --sidebar-bg:        #13161f;
    --sidebar-border:    #2e3350;
    --sidebar-width:     240px;
    --sidebar-collapsed: 56px;
    --nav-item-hover:    rgba(99, 102, 241, 0.12);
    --nav-item-active:   rgba(99, 102, 241, 0.22);
    --nav-item-active-border: #6366f1;

    /* Cards */
    --card-bg:     #1a1d27;
    --card-border: #2e3350;
    --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);

    /* Inputs */
    --input-bg:          #0f1117;
    --input-border:      #3d4466;
    --input-border-focus:#6366f1;
    --input-text:        #f1f3fa;
    --input-placeholder: #6b7291;

    /* Buttons */
    --btn-primary-bg:     #6366f1;
    --btn-primary-hover:  #4f46e5;
    --btn-primary-text:   #ffffff;
    --btn-secondary-bg:   #22263a;
    --btn-secondary-hover:#2c3150;
    --btn-secondary-text: #c7d0f0;
    --btn-danger-bg:      #991b1b;
    --btn-danger-hover:   #7f1d1d;
    --btn-danger-text:    #fecaca;

    /* Scrollbar */
    --scrollbar-track: #1a1d27;
    --scrollbar-thumb: #3d4466;

    /* Misc */
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  16px;
    --transition: 0.18s ease;
}

/* ============================================================
   3. CSS VARIABLES — LIGHT THEME OVERRIDES
   ============================================================ */
[data-theme="light"] {
    --brand-primary:       #4f46e5;
    --brand-primary-hover: #3730a3;
    --brand-primary-muted: #e0e7ff;
    --brand-accent:        #7c3aed;
    --brand-accent-dim:    #5b21b6;

    --bg-base:         #f0f2f9;
    --bg-surface:      #ffffff;
    --bg-elevated:     #f5f7ff;
    --bg-overlay:      #eef0fa;
    --bg-hover:        #e8ebfc;

    --border-subtle:   #e2e5f0;
    --border-default:  #c7d0e8;
    --border-focus:    #4f46e5;

    --text-primary:    #1a1d2e;
    --text-secondary:  #4b5677;
    --text-muted:      #7b87a6;
    --text-inverse:    #ffffff;
    --text-link:       #4f46e5;
    --text-link-hover: #3730a3;

    --color-success:        #15803d;
    --color-success-bg:     #f0fdf4;
    --color-success-border: #86efac;
    --color-warning:        #b45309;
    --color-warning-bg:     #fffbeb;
    --color-warning-border: #fcd34d;
    --color-error:          #dc2626;
    --color-error-bg:       #fef2f2;
    --color-error-border:   #fca5a5;
    --color-info:           #0369a1;
    --color-info-bg:        #eff6ff;
    --color-info-border:    #93c5fd;

    --badge-xp-bg:    #ede9fe;
    --badge-xp-text:  #5b21b6;
    --badge-new-bg:   #f0fdf4;
    --badge-new-text: #15803d;

    --topbar-bg:      #ffffff;
    --topbar-border:  #e2e5f0;

    --sidebar-bg:        #f8f9fe;
    --sidebar-border:    #e2e5f0;
    --nav-item-hover:    rgba(79, 70, 229, 0.08);
    --nav-item-active:   rgba(79, 70, 229, 0.14);
    --nav-item-active-border: #4f46e5;

    --card-bg:     #ffffff;
    --card-border: #e2e5f0;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);

    --input-bg:          #ffffff;
    --input-border:      #c7d0e8;
    --input-border-focus:#4f46e5;
    --input-text:        #1a1d2e;
    --input-placeholder: #9ca3af;

    --btn-primary-bg:     #4f46e5;
    --btn-primary-hover:  #3730a3;
    --btn-primary-text:   #ffffff;
    --btn-secondary-bg:   #f0f2f9;
    --btn-secondary-hover:#e8ebfc;
    --btn-secondary-text: #374151;
    --btn-danger-bg:      #dc2626;
    --btn-danger-hover:   #b91c1c;
    --btn-danger-text:    #ffffff;

    --scrollbar-track: #f0f2f9;
    --scrollbar-thumb: #c7d0e8;
}

/* ============================================================
   4. BASE TYPOGRAPHY & BODY
   ============================================================ */
html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition), color var(--transition);
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

p { margin-bottom: 0.75rem; }
p:last-child { margin-bottom: 0; }

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover { color: var(--text-link-hover); text-decoration: underline; }

code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.875em;
    background: var(--bg-overlay);
    padding: 0.15em 0.35em;
    border-radius: var(--radius-sm);
}

/* ============================================================
   5. SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-focus); }

/* ============================================================
   6. LAYOUT — APP SHELL
   ============================================================ */
.shell-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--topbar-height) 1fr;
    grid-template-areas:
        "topbar topbar"
        "sidebar main";
    min-height: 100vh;
}

.shell-topbar {
    grid-area: topbar;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: 1rem;
    z-index: 100;
    transition: background-color var(--transition), border-color var(--transition);
}

.shell-sidebar {
    grid-area: sidebar;
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 50;
    transition: background-color var(--transition), border-color var(--transition), transform 0.25s ease;
    display: flex;
    flex-direction: column;
}

.shell-main {
    grid-area: main;
    margin-top: var(--topbar-height);
    margin-left: var(--sidebar-width);
    padding: 1.75rem;
    min-height: calc(100vh - var(--topbar-height));
    transition: margin-left 0.25s ease;
}

/* ============================================================
   7. TOPBAR COMPONENTS
   ============================================================ */
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    text-decoration: none;
    flex-shrink: 0;
}

.topbar-brand-logo {
    width: 28px;
    height: 28px;
    background: var(--brand-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.topbar-brand:hover { text-decoration: none; color: var(--brand-primary); }

.topbar-area-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

.topbar-spacer { flex: 1; }

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.topbar-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--brand-primary-muted);
    border: 2px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--brand-accent);
    flex-shrink: 0;
}

.topbar-mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
    line-height: 1;
}

.topbar-mobile-toggle:hover { background: var(--bg-hover); }

/* ============================================================
   8. SIDEBAR NAVIGATION
   ============================================================ */
.sidebar-section {
    padding: 0.75rem 0.75rem 0.25rem;
}

.sidebar-section-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    padding: 0 0.5rem;
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    white-space: nowrap;
    overflow: hidden;
}

.nav-link:hover {
    background: var(--nav-item-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-link.active {
    background: var(--nav-item-active);
    color: var(--brand-primary);
    border-left-color: var(--nav-item-active-border);
    font-weight: 600;
}

.nav-link-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.sidebar-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 0.5rem 1rem;
}

.sidebar-footer {
    margin-top: auto;
    padding: 0.75rem;
    border-top: 1px solid var(--border-subtle);
}

/* ============================================================
   9. CARDS
   ============================================================ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    transition: background-color var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.card-body {
    padding: 1.25rem;
}

.card-header {
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.card-header-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-subtle);
}

/* Stat card variant */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    padding: 1.25rem;
    transition: background-color var(--transition), border-color var(--transition);
}

.stat-card:hover {
    border-color: var(--border-focus);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.12);
}

.stat-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.375rem;
}

.stat-sub {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.stat-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

/* ============================================================
   10. BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1.125rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
    border-radius: var(--radius-sm);
    border: 1.5px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background-color var(--transition), color var(--transition),
                border-color var(--transition), box-shadow var(--transition);
    white-space: nowrap;
    user-select: none;
}

.btn:hover { text-decoration: none; }

.btn:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
}
.btn-primary:hover { background: var(--btn-primary-hover); color: var(--btn-primary-text); }

.btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border-color: var(--border-default);
}
.btn-secondary:hover { background: var(--btn-secondary-hover); color: var(--btn-secondary-text); }

.btn-danger {
    background: var(--btn-danger-bg);
    color: var(--btn-danger-text);
}
.btn-danger:hover { background: var(--btn-danger-hover); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm {
    padding: 0.3rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
}

.btn-full { width: 100%; }

/* Icon-only button */
.btn-icon {
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), color var(--transition);
    font-size: 1.1rem;
    line-height: 1;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ============================================================
   11. FORMS
   ============================================================ */
.form-group {
    margin-bottom: 1.125rem;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.form-label-required::after {
    content: " *";
    color: var(--color-error);
}

.form-input,
.form-select,
.form-textarea {
    display: block;
    width: 100%;
    padding: 0.5625rem 0.875rem;
    font-size: 0.9375rem;
    font-family: inherit;
    line-height: 1.5;
    color: var(--input-text);
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--input-placeholder); }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--input-border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: var(--color-error);
}

.form-textarea { min-height: 100px; resize: vertical; }

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.form-error {
    font-size: 0.8rem;
    color: var(--color-error);
    margin-top: 0.3rem;
}

/* Checkbox + Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--brand-primary);
    cursor: pointer;
    flex-shrink: 0;
}

/* ============================================================
   12. ALERTS
   ============================================================ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.alert-icon { flex-shrink: 0; font-size: 1rem; margin-top: 0.05em; }

.alert-success {
    background: var(--color-success-bg);
    border-color: var(--color-success-border);
    color: var(--color-success);
}

.alert-warning {
    background: var(--color-warning-bg);
    border-color: var(--color-warning-border);
    color: var(--color-warning);
}

.alert-error {
    background: var(--color-error-bg);
    border-color: var(--color-error-border);
    color: var(--color-error);
}

.alert-info {
    background: var(--color-info-bg);
    border-color: var(--color-info-border);
    color: var(--color-info);
}

/* ============================================================
   13. BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-primary {
    background: var(--brand-primary-muted);
    color: var(--brand-accent);
}

.badge-success {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.badge-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.badge-error {
    background: var(--color-error-bg);
    color: var(--color-error);
}

.badge-info {
    background: var(--color-info-bg);
    color: var(--color-info);
}

.badge-xp {
    background: var(--badge-xp-bg);
    color: var(--badge-xp-text);
}

.badge-new {
    background: var(--badge-new-bg);
    color: var(--badge-new-text);
}

/* ============================================================
   14. AUTH LAYOUT
   ============================================================ */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--bg-base);
    transition: background-color var(--transition);
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    padding: 2.5rem 2.25rem;
    width: 100%;
    max-width: 420px;
    transition: background-color var(--transition), border-color var(--transition);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 1.5rem;
}

.auth-brand-logo {
    width: 36px;
    height: 36px;
    background: var(--brand-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.auth-brand-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.auth-brand-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.auth-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.75rem;
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.auth-theme-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

/* ============================================================
   15. PAGE GRID UTILITIES
   ============================================================ */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.grid {
    display: grid;
    gap: 1rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.grid-auto-2 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-auto-3 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* Spacing */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* Text helpers */
.text-muted   { color: var(--text-muted); }
.text-primary { color: var(--text-primary); }
.text-accent  { color: var(--brand-accent); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error   { color: var(--color-error); }
.text-sm      { font-size: 0.875rem; }
.text-xs      { font-size: 0.8125rem; }
.text-bold    { font-weight: 600; }
.text-center  { text-align: center; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* ============================================================
   16. PROGRESS BAR
   ============================================================ */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-overlay);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
    border-radius: 999px;
    transition: width 0.4s ease;
}

/* ============================================================
   17. TABLE
   ============================================================ */
.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    text-align: left;
    padding: 0.625rem 0.875rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-default);
}

.table td {
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    vertical-align: middle;
}

.table tbody tr:hover td {
    background: var(--bg-hover);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================================
   18. THEME TOGGLE BUTTON
   ============================================================ */
.theme-toggle {
    background: var(--bg-elevated);
    border: 1.5px solid var(--border-default);
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    transition: background var(--transition), border-color var(--transition),
                color var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--border-focus);
    color: var(--text-primary);
}

.theme-toggle-icon { font-size: 0.9375rem; }

/* ============================================================
   19. NOTIFICATION BELL
   ============================================================ */
.notif-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.375rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 1.25rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    transition: background var(--transition), color var(--transition);
}

.notif-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.notif-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--color-error);
    border-radius: 50%;
    border: 1.5px solid var(--topbar-bg);
}

/* ============================================================
   20. MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .shell-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "topbar"
            "main";
    }

    .shell-sidebar {
        transform: translateX(-100%);
        z-index: 200;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    }

    .shell-sidebar.open {
        transform: translateX(0);
    }

    .shell-main {
        margin-left: 0;
    }

    .topbar-mobile-toggle {
        display: inline-flex;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .grid-auto-2, .grid-auto-3 {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 600px) {
    .shell-main { padding: 1rem; }
    .auth-card { padding: 1.75rem 1.25rem; }
    .stat-value { font-size: 1.5rem; }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 190;
}

.sidebar-overlay.open {
    display: block;
}

/* ============================================================
   Phase 27V — Icon utility & auth polish
   ============================================================ */

/* Inline SVG icon baseline */
.icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Flip arrow icon for back-link (left-pointing) */
.icon-flip {
    transform: scaleX(-1);
}

/* Login page account-note */
.auth-note {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 0.75rem;
    text-align: center;
}

.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-link);
    font-size: 0.875rem;
    text-decoration: none;
}

.auth-back-link:hover {
    color: var(--text-link-hover);
    text-decoration: underline;
}

/* ============================================================
   Phase 29B.1 — Cosmic auth background + glass card + nav fixes
   ============================================================ */

/* Space background body */
.auth-body {
    overflow: hidden;
}

/* Auth background layers */
.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.auth-bg-image {
    position: absolute;
    inset: 0;
    background-image: url('../images/space-background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.65;
}

[data-theme="light"] .auth-bg-image {
    opacity: 0.18;
}

.auth-bg-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 60% 40%, rgba(99,102,241,0.22) 0%, transparent 60%),
                radial-gradient(ellipse at 20% 80%, rgba(167,139,250,0.18) 0%, transparent 50%),
                linear-gradient(180deg, rgba(15,17,23,0.55) 0%, rgba(15,17,23,0.75) 100%);
}

[data-theme="light"] .auth-bg-overlay {
    background: radial-gradient(ellipse at 60% 40%, rgba(79,70,229,0.08) 0%, transparent 60%),
                linear-gradient(180deg, rgba(240,242,249,0.28) 0%, rgba(240,242,249,0.42) 100%);
}

/* Twinkling star dots via pseudo-element pattern */
.auth-bg-stars {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 10% 15%, rgba(255,255,255,0.6) 0%, transparent 100%),
        radial-gradient(1px 1px at 30% 45%, rgba(255,255,255,0.4) 0%, transparent 100%),
        radial-gradient(1px 1px at 50% 25%, rgba(255,255,255,0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 70% 60%, rgba(255,255,255,0.3) 0%, transparent 100%),
        radial-gradient(1px 1px at 85% 10%, rgba(255,255,255,0.6) 0%, transparent 100%),
        radial-gradient(1px 1px at 20% 75%, rgba(255,255,255,0.4) 0%, transparent 100%),
        radial-gradient(1px 1px at 65% 85%, rgba(255,255,255,0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 45% 90%, rgba(255,255,255,0.3) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 90% 40%, rgba(167,139,250,0.7) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 5% 55%, rgba(99,102,241,0.7) 0%, transparent 100%);
}

[data-theme="light"] .auth-bg-stars {
    opacity: 0.1;
}

/* Auth shell must sit above background */
.auth-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

/* Override bg-base background on auth shell since we use space bg */
.auth-shell {
    background: transparent;
}

/* Glass card effect — Phase 29B.1A: cyan border glow matching legacy */
.auth-card {
    position: relative;
    background: rgba(17, 20, 34, 0.82);
    border: 1px solid rgba(0, 221, 255, 0.22);
    border-radius: var(--radius-lg);
    box-shadow:
        0 0 15px rgba(0, 221, 255, 0.12),
        0 0 30px rgba(0, 221, 255, 0.06),
        inset 0 0 15px rgba(0, 221, 255, 0.02),
        0 8px 40px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    padding: 2.5rem 2.25rem;
    width: 100%;
    max-width: 440px;
    transition: background-color var(--transition), border-color var(--transition);
}

[data-theme="light"] .auth-card {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(79, 70, 229, 0.25);
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(79, 70, 229, 0.08);
}

/* Brand logo image in auth */
.auth-brand-img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: contain;
    flex-shrink: 0;
}

/* Register notice bar below login form */
.auth-register-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    margin-top: 1.25rem;
    padding: 0.5rem 0.875rem;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
}

[data-theme="light"] .auth-register-notice {
    background: rgba(79, 70, 229, 0.06);
    border-color: rgba(79, 70, 229, 0.15);
}

/* Topbar logout button */
.topbar-logout-form {
    display: inline-flex;
    align-items: center;
}

/* Sidebar logout form button */
.sidebar-footer-form {
    width: 100%;
    display: block;
}

.sidebar-footer-form .nav-link {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}

.sidebar-footer-form .nav-link:hover {
    background: var(--nav-item-hover);
    color: var(--color-error);
}

/* Topbar user dropdown alignment */
.topbar-user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Auth brand name cosmic colour */
.auth-brand-name {
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--brand-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    font-size: 1.0625rem;
    letter-spacing: -0.02em;
}

[data-theme="light"] .auth-brand-name {
    background: linear-gradient(135deg, #1a1d2e 0%, #4f46e5 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

/* Mission-control accent on auth title */
.auth-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    letter-spacing: -0.015em;
}

/* Theme toggle SVG icon sizing */
.theme-toggle-icon svg {
    display: block;
}

/* ============================================================
   Phase 29B.1A — Exact Legacy Cosmic Login Theme Port
   Color tokens: space-cyan = hsl(188,100%,50%) = #00d9ff
                 space-purple = hsl(270,80%,55%) = #8b33e8
   ============================================================ */

/* Position theme toggle top-right inside card */
.auth-theme-row {
    position: absolute;
    top: 0.875rem;
    right: 1rem;
    z-index: 2;
}

/* Auth hero: centered stacked logo + title + subtitle (replaces auth-brand row) */
.auth-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

/* Large logo with cyan drop-shadow */
.auth-hero-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    filter: drop-shadow(0 0 14px rgba(0, 217, 255, 0.45));
    margin-bottom: 0.375rem;
    display: block;
}

/* "Behind The Universe" — large, uppercase, cyan glow */
.auth-hero-title {
    font-size: 1.625rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: hsl(188, 100%, 55%);
    text-shadow:
        0 0 10px rgba(0, 217, 255, 0.85),
        0 0 20px rgba(0, 217, 255, 0.65),
        0 0 35px rgba(0, 217, 255, 0.4),
        0 0 55px rgba(0, 217, 255, 0.2);
    margin: 0;
    line-height: 1.15;
}

[data-theme="light"] .auth-hero-title {
    color: hsl(270, 80%, 35%);
    text-shadow: none;
    letter-spacing: 0.04em;
}

/* Subtitle / mission tagline */
.auth-hero-sub {
    font-size: 0.8375rem;
    color: var(--text-muted);
    margin: 0;
    max-width: 300px;
    line-height: 1.4;
    opacity: 0.9;
}

/* ---- Segmented Login / Register tabs ---- */
.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: rgba(0, 0, 0, 0.35);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(0, 217, 255, 0.15);
    padding: 3px;
    margin-bottom: 1.25rem;
    gap: 3px;
}

[data-theme="light"] .auth-tabs {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(99, 102, 241, 0.18);
}

.auth-tab {
    padding: 0.5rem 1rem;
    border-radius: calc(var(--radius-sm) - 3px);
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    transition: all var(--transition);
    user-select: none;
    line-height: 1;
    cursor: default;
}

.auth-tab--active {
    background: rgba(0, 217, 255, 0.14);
    color: hsl(188, 100%, 65%);
    border-color: rgba(0, 217, 255, 0.28);
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.18);
}

[data-theme="light"] .auth-tab--active {
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
    border-color: rgba(99, 102, 241, 0.22);
    box-shadow: none;
}

.auth-tab--disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

/* ---- Launch Mission button: cyan-to-purple gradient ---- */
.btn-launch {
    background: linear-gradient(
        135deg,
        hsl(188, 100%, 50%) 0%,
        hsl(270, 80%, 55%) 100%
    );
    color: hsl(230, 35%, 8%);
    font-weight: 700;
    border: none;
    letter-spacing: 0.03em;
    font-size: 1rem;
    transition: opacity 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 4px 20px rgba(0, 217, 255, 0.28), 0 2px 10px rgba(139, 51, 232, 0.2);
    cursor: pointer;
}

.btn-launch:hover:not(:disabled) {
    opacity: 0.88;
    transform: translateY(-1px);
    box-shadow: 0 6px 28px rgba(0, 217, 255, 0.38), 0 3px 14px rgba(139, 51, 232, 0.3);
}

.btn-launch:active:not(:disabled) {
    transform: translateY(0);
    opacity: 0.95;
}

.btn-launch:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

[data-theme="light"] .btn-launch {
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 150, 200, 0.25);
}

/* ---- Starfield dots overlay on auth bg (phase 29B.1A: more colored dots) ---- */
.auth-bg-stars::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1.5px 1.5px at 12% 18%, hsl(188, 100%, 70%, 0.7), transparent),
        radial-gradient(1.5px 1.5px at 42% 82%, hsl(280, 80%, 70%, 0.7), transparent),
        radial-gradient(1px 1px at 72% 44%, hsl(320, 100%, 70%, 0.55), transparent),
        radial-gradient(2px 2px at 87% 92%, hsl(188, 100%, 60%, 0.65), transparent),
        radial-gradient(1px 1px at 27% 52%, hsl(280, 80%, 65%, 0.5), transparent),
        radial-gradient(1.5px 1.5px at 60% 28%, hsl(188, 100%, 75%, 0.6), transparent),
        radial-gradient(1px 1px at 33% 70%, hsl(270, 80%, 70%, 0.45), transparent);
    pointer-events: none;
}

/* Tighten overlay darkness to let bg image breathe more */
.auth-bg-overlay {
    background:
        radial-gradient(ellipse at 60% 40%, rgba(0, 217, 255, 0.08) 0%, transparent 55%),
        radial-gradient(ellipse at 20% 80%, rgba(139, 51, 232, 0.12) 0%, transparent 50%),
        linear-gradient(180deg, rgba(11, 14, 30, 0.50) 0%, rgba(11, 14, 30, 0.70) 100%);
}

[data-theme="light"] .auth-bg-overlay {
    background:
        radial-gradient(ellipse at 60% 40%, rgba(79, 70, 229, 0.07) 0%, transparent 60%),
        linear-gradient(180deg, rgba(240, 242, 249, 0.20) 0%, rgba(240, 242, 249, 0.32) 100%);
}

/* Input fields: dark semi-transparent matching legacy */
.auth-card .form-input {
    background: rgba(0, 0, 0, 0.35);
    border-color: rgba(0, 217, 255, 0.18);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.auth-card .form-input:focus {
    border-color: rgba(0, 217, 255, 0.55);
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.12);
    outline: none;
}

.auth-card .form-input::placeholder {
    color: rgba(180, 200, 220, 0.4);
}

[data-theme="light"] .auth-card .form-input {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(99, 102, 241, 0.25);
}

[data-theme="light"] .auth-card .form-input:focus {
    border-color: rgba(99, 102, 241, 0.55);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Form label color in auth card */
.auth-card .form-label {
    color: rgba(180, 220, 240, 0.85);
    font-size: 0.8125rem;
    font-weight: 500;
}

[data-theme="light"] .auth-card .form-label {
    color: var(--text-secondary);
}

/* ============================================================
   Phase 29B.1C — Student cosmic shell background
   Applies to body.shell-cosmic-bg (student role pages only).
   Does not affect admin/instructor/parent layouts.
   ============================================================ */

body.shell-cosmic-bg {
    background-color: #090c18;
}

/* Fixed space-photo layer — behind everything */
body.shell-cosmic-bg::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url('../images/space-background.jpg');
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    opacity: 0.32;
    z-index: 0;
    pointer-events: none;
}

/* Subtle radial glow accents */
body.shell-cosmic-bg::after {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 80% 10%, rgba(0, 217, 255, 0.07) 0%, transparent 45%),
        radial-gradient(ellipse at 10% 90%, rgba(139, 51, 232, 0.08) 0%, transparent 45%);
    z-index: 0;
    pointer-events: none;
}

/* Shell sits above the background layers */
body.shell-cosmic-bg .shell-layout,
body.shell-cosmic-bg .sidebar-overlay {
    position: relative;
    z-index: 1;
}

/* Sidebar: dark glass in student mode */
body.shell-cosmic-bg .shell-sidebar {
    background: rgba(10, 13, 26, 0.88);
    border-right-color: rgba(0, 217, 255, 0.12);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* Topbar: matching glass */
body.shell-cosmic-bg .shell-topbar {
    background: rgba(10, 13, 26, 0.82);
    border-bottom-color: rgba(0, 217, 255, 0.10);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Content cards: glass morphism */
body.shell-cosmic-bg .card {
    background: rgba(14, 17, 32, 0.72);
    border-color: rgba(0, 217, 255, 0.11);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Stat cards: slightly more opaque for readability */
body.shell-cosmic-bg .stat-card {
    background: rgba(14, 17, 32, 0.78);
    border-color: rgba(0, 217, 255, 0.14);
}

/* Accent: cyan nav-link active indicator */
body.shell-cosmic-bg .nav-link.active {
    color: hsl(188, 100%, 65%);
    background: rgba(0, 217, 255, 0.10);
}

/* Light mode overrides — keep space photo subtle but visible */
[data-theme="light"] body.shell-cosmic-bg {
    background-color: #e8ecf8;
}

[data-theme="light"] body.shell-cosmic-bg::before {
    opacity: 0.16;
    filter: brightness(1.2) saturate(0.6);
}

[data-theme="light"] body.shell-cosmic-bg::after {
    background:
        radial-gradient(ellipse at 80% 10%, rgba(99, 102, 241, 0.05) 0%, transparent 45%),
        radial-gradient(ellipse at 10% 90%, rgba(139, 51, 232, 0.04) 0%, transparent 45%);
}

[data-theme="light"] body.shell-cosmic-bg .shell-sidebar {
    background: rgba(235, 238, 252, 0.92);
    border-right-color: rgba(99, 102, 241, 0.14);
}

[data-theme="light"] body.shell-cosmic-bg .shell-topbar {
    background: rgba(235, 238, 252, 0.90);
    border-bottom-color: rgba(99, 102, 241, 0.12);
}

[data-theme="light"] body.shell-cosmic-bg .card {
    background: rgba(248, 250, 255, 0.82);
    border-color: rgba(99, 102, 241, 0.12);
}

[data-theme="light"] body.shell-cosmic-bg .stat-card {
    background: rgba(245, 247, 255, 0.88);
    border-color: rgba(99, 102, 241, 0.14);
}

/* ============================================================
   Phase 29B.2 — Student Cosmic Shell Theme Alignment
   Scope: body.shell-cosmic-bg (student pages only).
   Appended after Phase 29B.1C block — later rules override earlier ones.
   Admin / instructor / parent layouts are not affected.
   ============================================================ */

/* Sidebar: deeper space glass + nebula gradient top accent */
body.shell-cosmic-bg .shell-sidebar {
    background: rgba(7, 9, 20, 0.92);
    border-right-color: rgba(0, 217, 255, 0.18);
    background-image: linear-gradient(
        180deg,
        rgba(0, 217, 255, 0.05) 0%,
        rgba(139, 51, 232, 0.06) 38%,
        transparent 70%
    );
}

/* Sidebar section labels: cosmic cyan styling */
body.shell-cosmic-bg .sidebar-section-label {
    color: rgba(0, 217, 255, 0.52);
    letter-spacing: 0.10em;
}

/* Nav link hover: subtle cyan tint */
body.shell-cosmic-bg .nav-link:hover:not(.active) {
    background: rgba(0, 217, 255, 0.08);
    color: rgba(180, 240, 255, 0.92);
    border-left-color: rgba(0, 217, 255, 0.22);
}

/* Active nav link: cyan glow + left border */
body.shell-cosmic-bg .nav-link.active {
    color: hsl(188, 100%, 72%);
    background: rgba(0, 217, 255, 0.13);
    border-left-color: hsl(188, 100%, 65%);
    text-shadow: 0 0 10px rgba(0, 217, 255, 0.45);
    box-shadow: inset 0 0 14px rgba(0, 217, 255, 0.06);
}

/* Topbar: deeper glass */
body.shell-cosmic-bg .shell-topbar {
    background: rgba(7, 9, 20, 0.88);
    border-bottom-color: rgba(0, 217, 255, 0.13);
}

/* Topbar brand logo: cyan-to-purple gradient */
body.shell-cosmic-bg .topbar-brand-logo {
    background: linear-gradient(135deg, hsl(188, 100%, 38%) 0%, hsl(270, 72%, 50%) 100%);
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.32);
}

/* Topbar brand text: soft cyan */
body.shell-cosmic-bg .topbar-brand {
    color: hsl(188, 60%, 85%);
}

/* Topbar area label pill: cyan tint */
body.shell-cosmic-bg .topbar-area-label {
    background: rgba(0, 217, 255, 0.09);
    border-color: rgba(0, 217, 255, 0.22);
    color: rgba(0, 217, 255, 0.82);
}

/* Progress bar fill: gold-to-cyan cosmic gradient */
body.shell-cosmic-bg .progress-fill {
    background: linear-gradient(90deg, hsl(42, 100%, 58%) 0%, hsl(188, 100%, 52%) 100%);
    box-shadow: 0 0 6px rgba(0, 217, 255, 0.28);
}

/* Stat card hover: cyan border glow */
body.shell-cosmic-bg .stat-card:hover {
    border-color: rgba(0, 217, 255, 0.30);
    box-shadow: 0 4px 24px rgba(0, 217, 255, 0.13), 0 0 0 1px rgba(0, 217, 255, 0.20);
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

/* Stat icon: subtle cyan glow */
body.shell-cosmic-bg .stat-icon {
    filter: drop-shadow(0 0 6px rgba(0, 217, 255, 0.42));
}

/* Stat value: bright space-white with faint glow */
body.shell-cosmic-bg .stat-value {
    color: #d8eeff;
    text-shadow: 0 0 14px rgba(0, 217, 255, 0.18);
}

/* Page title: cosmic blue-white */
body.shell-cosmic-bg .page-title {
    color: #cee6ff;
    text-shadow: 0 0 18px rgba(0, 217, 255, 0.13);
}

/* Page subtitle: muted space-blue */
body.shell-cosmic-bg .page-subtitle {
    color: rgba(180, 210, 240, 0.68);
}

/* Notification bell: cyan hover */
body.shell-cosmic-bg .notif-btn:hover {
    background: rgba(0, 217, 255, 0.10);
    color: hsl(188, 100%, 72%);
}

/* Badge XP: gold glow variant for student */
body.shell-cosmic-bg .badge-xp {
    background: rgba(255, 183, 3, 0.14);
    color: hsl(42, 100%, 62%);
    border: 1px solid rgba(255, 183, 3, 0.28);
}

/* ── Light mode overrides for Phase 29B.2 student enhancements ── */

[data-theme="light"] body.shell-cosmic-bg .shell-sidebar {
    background: rgba(238, 241, 255, 0.95);
    background-image: linear-gradient(180deg, rgba(99, 102, 241, 0.04) 0%, transparent 55%);
    border-right-color: rgba(99, 102, 241, 0.16);
}

[data-theme="light"] body.shell-cosmic-bg .sidebar-section-label {
    color: rgba(99, 102, 241, 0.58);
    letter-spacing: 0.08em;
}

[data-theme="light"] body.shell-cosmic-bg .nav-link:hover:not(.active) {
    background: rgba(99, 102, 241, 0.07);
    color: #3730a3;
    border-left-color: rgba(99, 102, 241, 0.20);
}

[data-theme="light"] body.shell-cosmic-bg .nav-link.active {
    color: #4f46e5;
    background: rgba(99, 102, 241, 0.12);
    border-left-color: #4f46e5;
    text-shadow: none;
    box-shadow: none;
}

[data-theme="light"] body.shell-cosmic-bg .shell-topbar {
    background: rgba(240, 242, 255, 0.96);
    border-bottom-color: rgba(99, 102, 241, 0.14);
}

[data-theme="light"] body.shell-cosmic-bg .topbar-brand-logo {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    box-shadow: 0 0 8px rgba(79, 70, 229, 0.25);
}

[data-theme="light"] body.shell-cosmic-bg .topbar-brand {
    color: #1a1d2e;
}

[data-theme="light"] body.shell-cosmic-bg .topbar-area-label {
    background: rgba(79, 70, 229, 0.07);
    border-color: rgba(79, 70, 229, 0.18);
    color: #4f46e5;
}

[data-theme="light"] body.shell-cosmic-bg .progress-fill {
    background: linear-gradient(90deg, #f59e0b 0%, #4f46e5 100%);
    box-shadow: none;
}

[data-theme="light"] body.shell-cosmic-bg .stat-card:hover {
    border-color: rgba(99, 102, 241, 0.28);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.10), 0 0 0 1px rgba(99, 102, 241, 0.16);
}

[data-theme="light"] body.shell-cosmic-bg .stat-icon {
    filter: none;
}

[data-theme="light"] body.shell-cosmic-bg .stat-value {
    color: #1a1d2e;
    text-shadow: none;
}

[data-theme="light"] body.shell-cosmic-bg .page-title {
    color: #1a1d2e;
    text-shadow: none;
}

[data-theme="light"] body.shell-cosmic-bg .page-subtitle {
    color: #4b5677;
}

[data-theme="light"] body.shell-cosmic-bg .badge-xp {
    background: rgba(217, 119, 6, 0.10);
    color: #92400e;
    border-color: rgba(217, 119, 6, 0.20);
}

