/* ============================================================
   Smartschool Stats Plus � MONO v1.0  (Black & White)
   Font: Inter  |  Palette: pure grayscale
   ============================================================ */

/* === DESIGN TOKENS === */
:root {
    --bg: #09090f;
    --surface: #0f0f1c;
    --surface-2: #141421;
    --surface-3: #1c1c2e;
    --border: rgba(255, 255, 255, 0.08);
    --border-2: rgba(255, 255, 255, 0.15);
    --border-3: rgba(255, 255, 255, 0.26);
    --border-donation: #4ade80;
    --t1: #f0f4ff;
    --t2: #8b9ab0;
    --t3: #4b5874;
    --sh-sm: 0 1px 6px rgba(0, 0, 0, 0.5);
    --sh-md: 0 4px 20px rgba(0, 0, 0, 0.55);
    --sh-lg: 0 12px 40px rgba(0, 0, 0, 0.55);
    --r4: 4px;
    --r6: 6px;
    --r8: 8px;
    --r12: 12px;
    --r16: 16px;
    --r99: 999px;
    /* Legacy aliases */
    --text-secondary: var(--t2);
    --glass-border: var(--border-2);
    --ss-primary: #818cf8;
    --ss-primary-dark: #6366f1;
    --ss-primary-soft: rgba(129, 140, 248, 0.12);
    --ss-blue: #818cf8;
    --ss-blue-dark: #6366f1;
    --ss-border: var(--border-2);
    --ss-text: var(--t1);
    --ss-text-soft: var(--t2);
    --ss-surface: var(--surface);
    --ss-surface-muted: var(--surface-2);
    --ss-success: #34d399;
    --ss-warning: #fbbf24;
    --ss-danger: #f87171;
    --radius-lg: var(--r12);
    --radius-md: var(--r8);
    --radius-sm: var(--r6);
    --shadow-sm: var(--sh-sm);
    --shadow-md: var(--sh-md);
    /* Color tokens — actual colors for visual clarity */
    --blue: #818cf8;
    --blue-2: #a5b4fc;
    --green: #34d399;
    --green-2: #6ee7b7;
    --yellow: #fbbf24;
    --orange: #f97316;
    --red: #f87171;
    --purple: #c084fc;
    --purple-2: #d8b4fe;
    --cyan: #67e8f9;
    --accent: #818cf8;
}

/* === DASHBOARD THEME OVERRIDES === */
body.theme-midnight-blue {
    --bg: #060d1a;
    --surface: #0d1728;
    --surface-2: #14243a;
    --surface-3: #1b2f4b;
    --border: rgba(79, 142, 247, 0.25);
    --border-2: rgba(79, 142, 247, 0.45);
    --border-3: rgba(79, 142, 247, 0.65);
    --t1: #e8f1ff;
    --t2: #9db8df;
    --t3: #6d88b2;
    --ss-primary: #4f8ef7;
    --ss-primary-dark: #3c79dc;
    --ss-primary-soft: rgba(79, 142, 247, 0.15);
    --ss-blue: #4f8ef7;
    --ss-blue-dark: #3c79dc;
    --blue: #4f8ef7;
    --blue-2: #86b2fb;
}

body.theme-emerald {
    --bg: #030f0a;
    --surface: #071a12;
    --surface-2: #0d271c;
    --surface-3: #143428;
    --border: rgba(52, 211, 153, 0.25);
    --border-2: rgba(52, 211, 153, 0.45);
    --border-3: rgba(52, 211, 153, 0.65);
    --t1: #e9fff6;
    --t2: #a2d9c6;
    --t3: #69b297;
    --ss-primary: #34d399;
    --ss-primary-dark: #22b983;
    --ss-primary-soft: rgba(52, 211, 153, 0.15);
    --green: #34d399;
    --green-2: #6ee7b7;
}

body.theme-crimson,
body.theme-elite-crimson {
    --bg: #0f0305;
    --surface: #1a070b;
    --surface-2: #280d13;
    --surface-3: #34131b;
    --border: rgba(248, 113, 113, 0.25);
    --border-2: rgba(248, 113, 113, 0.45);
    --border-3: rgba(248, 113, 113, 0.65);
    --t1: #ffeef0;
    --t2: #e4a7af;
    --t3: #bc7482;
    --ss-primary: #f87171;
    --ss-primary-dark: #e05555;
    --ss-primary-soft: rgba(248, 113, 113, 0.14);
    --red: #f87171;
}

body.theme-violet {
    --bg: #08040f;
    --surface: #120a1d;
    --surface-2: #1a1029;
    --surface-3: #241638;
    --border: rgba(167, 139, 250, 0.25);
    --border-2: rgba(167, 139, 250, 0.45);
    --border-3: rgba(167, 139, 250, 0.65);
    --t1: #f4eeff;
    --t2: #c6b4e7;
    --t3: #9f87c4;
    --ss-primary: #a78bfa;
    --ss-primary-dark: #8e74df;
    --ss-primary-soft: rgba(167, 139, 250, 0.15);
    --purple: #a78bfa;
    --purple-2: #c4b5fd;
}

body.theme-amber {
    --bg: #0d0800;
    --surface: #181004;
    --surface-2: #231806;
    --surface-3: #2e2008;
    --border: rgba(251, 191, 36, 0.25);
    --border-2: rgba(251, 191, 36, 0.45);
    --border-3: rgba(251, 191, 36, 0.65);
    --t1: #fff6df;
    --t2: #dfc188;
    --t3: #b69a63;
    --ss-primary: #fbbf24;
    --ss-primary-dark: #e3a50a;
    --ss-primary-soft: rgba(251, 191, 36, 0.17);
    --yellow: #fbbf24;
    --orange: #f59e0b;
}

body.theme-slate {
    --bg: #0f1117;
    --surface: #161c28;
    --surface-2: #1d2534;
    --surface-3: #263145;
    --border: rgba(125, 211, 252, 0.24);
    --border-2: rgba(125, 211, 252, 0.42);
    --border-3: rgba(125, 211, 252, 0.62);
    --t1: #ecf6ff;
    --t2: #a5bed5;
    --t3: #7b96ae;
    --ss-primary: #7dd3fc;
    --ss-primary-dark: #53b8e9;
    --ss-primary-soft: rgba(125, 211, 252, 0.14);
    --cyan: #7dd3fc;
}

body.theme-arctic,
body.theme-light-blue,
body.theme-smartschool,
body.theme-hybrid,
body.theme-parchment {
    --t1: #111827;
    --t2: #111827;
    --t3: #111827;
    --sh-sm: 0 1px 4px rgba(15, 23, 42, 0.1);
    --sh-md: 0 6px 24px rgba(15, 23, 42, 0.12);
    --sh-lg: 0 16px 42px rgba(15, 23, 42, 0.15);
}

body.theme-arctic {
    --bg: #f8f9fb;
    --surface: #ffffff;
    --surface-2: #eef2f7;
    --surface-3: #e4e9f2;
    --border: rgba(37, 99, 235, 0.17);
    --border-2: rgba(37, 99, 235, 0.3);
    --border-3: rgba(37, 99, 235, 0.45);
    --ss-primary: #2563eb;
    --ss-primary-dark: #1d4ed8;
    --ss-primary-soft: rgba(37, 99, 235, 0.12);
    --blue: #2563eb;
    --blue-2: #3b82f6;
}

body.theme-light-blue {
    --bg: #e8f0fe;
    --surface: #f5f9ff;
    --surface-2: #e7f0ff;
    --surface-3: #dce8ff;
    --border: rgba(29, 78, 216, 0.2);
    --border-2: rgba(29, 78, 216, 0.35);
    --border-3: rgba(29, 78, 216, 0.5);
    --ss-primary: #1d4ed8;
    --ss-primary-dark: #1e40af;
    --ss-primary-soft: rgba(29, 78, 216, 0.13);
    --blue: #1d4ed8;
    --blue-2: #60a5fa;
}

body.theme-parchment {
    --bg: #f5f0e8;
    --surface: #fdf9f3;
    --surface-2: #f2e8db;
    --surface-3: #e7d8c4;
    --border: rgba(139, 94, 60, 0.2);
    --border-2: rgba(139, 94, 60, 0.35);
    --border-3: rgba(139, 94, 60, 0.5);
    --ss-primary: #8b5e3c;
    --ss-primary-dark: #6f4a2f;
    --ss-primary-soft: rgba(139, 94, 60, 0.14);
    --orange: #8b5e3c;
}

body.theme-gradient-dark {
    --bg: #0c0c1e;
    --surface: #141431;
    --surface-2: #1b1b43;
    --surface-3: #25255a;
    --border: rgba(109, 156, 248, 0.28);
    --border-2: rgba(109, 156, 248, 0.45);
    --border-3: rgba(109, 156, 248, 0.65);
    --t1: #edf2ff;
    --t2: #acb9dc;
    --t3: #7c8ebc;
    --ss-primary: #6d9cf8;
    --ss-primary-dark: #4f7de1;
    --ss-primary-soft: rgba(109, 156, 248, 0.14);
    --blue: #6d9cf8;
    --purple: #8b8af7;
}

body.theme-neon {
    --bg: #000000;
    --surface: #07120d;
    --surface-2: #0d1c14;
    --surface-3: #13261a;
    --border: rgba(0, 255, 120, 0.28);
    --border-2: rgba(0, 255, 120, 0.48);
    --border-3: rgba(0, 255, 120, 0.68);
    --t1: #e7ffee;
    --t2: #8cd4a7;
    --t3: #56aa7c;
    --ss-primary: #00ff78;
    --ss-primary-dark: #00d766;
    --ss-primary-soft: rgba(0, 255, 120, 0.15);
    --green: #00ff78;
    --green-2: #5cffaf;
}

body.theme-smartschool {
    --bg: #f5f5f5;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --surface-3: #e5e7eb;
    --border: rgba(255, 82, 14, 0.2);
    --border-2: rgba(255, 82, 14, 0.35);
    --border-3: rgba(255, 82, 14, 0.52);
    --ss-primary: #ff520e;
    --ss-primary-dark: #e4470a;
    --ss-primary-soft: rgba(255, 82, 14, 0.14);
    --orange: #ff520e;
}

body.theme-hybrid {
    --bg: #f0f2f5;
    --surface: #ffffff;
    --surface-2: #e9eef5;
    --surface-3: #dde4ef;
    --border: rgba(17, 24, 39, 0.18);
    --border-2: rgba(17, 24, 39, 0.32);
    --border-3: rgba(17, 24, 39, 0.48);
    --ss-primary: #111827;
    --ss-primary-dark: #030712;
    --ss-primary-soft: rgba(17, 24, 39, 0.1);
}

body.theme-super-friends {
    --bg: #1a0b2e;
    --surface: #261445;
    --surface-2: #341c5e;
    --surface-3: #432478;
    --border: rgba(251, 191, 36, 0.28);
    --border-2: rgba(251, 191, 36, 0.48);
    --border-3: rgba(251, 191, 36, 0.68);
    --t1: #fff8e7;
    --t2: #e0c8ff;
    --t3: #b08ee0;
    --ss-primary: #fbbf24;
    --ss-primary-dark: #f59e0b;
    --ss-primary-soft: rgba(251, 191, 36, 0.15);
    --yellow: #fbbf24;
    --purple: #d8b4fe;
}

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

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--t1);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.5;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px
}

::-webkit-scrollbar-track {
    background: transparent
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .12);
    border-radius: var(--r99)
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, .24)
}

/* -- LAYOUT ------------------------------------------------ */
.container {
    width: 100%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 0;
}

.glass {
    background: color-mix(in srgb, var(--surface) 85%, transparent);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
    border-radius: var(--r12);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

/* -- HERO HEADER ------------------------------------------- */
.hero-header {
    grid-column: 1/-1;
    padding: 18px 28px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    background: var(--surface) !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    border-bottom: 1px solid var(--border-2) !important;
    box-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}

.hero-header::after {
    display: none;
}

.hero-brand {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.hero-eyebrow {
    font-size: clamp(1.15rem, 2.4vw, 1.9rem);
    font-weight: 900;
    letter-spacing: -.3px;
    text-transform: none;
    color: var(--t1);
    line-height: 1.1;
}

.hero-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.hero-title-mark {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--t1);
    box-shadow: 0 0 0 4px var(--surface-2);
    animation: hero-mark-pulse 2s ease-in-out infinite;
}

.hero-title {
    font-size: 1.15rem;
    line-height: 1.1;
    font-weight: 900;
    color: var(--t1);
    letter-spacing: -.4px;
}

.hero-live-pill {
    font-size: .6rem;
    font-weight: 800;
    letter-spacing: .7px;
    text-transform: uppercase;
    color: var(--t1);
    border: 1px solid var(--border-2);
    background: var(--surface-2);
    padding: 2px 8px;
}

.hero-subtitle {
    font-size: .73rem;
    color: var(--t2);
    max-width: 520px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes hero-mark-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 3px var(--surface-2);
    }

    50% {
        box-shadow: 0 0 0 6px var(--surface-2);
    }
}

.profile-cluster {
    display: flex;
    align-items: center;
    gap: 14px
}

.profile-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--r12);
    border: 2px solid var(--border-2);
    background: var(--surface-2);
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.profile-text h1 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--t1);
    letter-spacing: -.3px
}

.profile-text>div {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 3px
}

.profile-text span {
    display: flex;
    align-items: center;
    font-size: .75rem;
    color: var(--t1)
}

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--t1);
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    animation: blink-dot 2.2s ease-in-out infinite;
}

@keyframes blink-dot {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .2
    }
}

.rank-badge {
    font-size: .64rem;
    font-weight: 700;
    background: transparent;
    color: var(--border-donation);
    padding: 2px 9px;
    border-radius: var(--r99);
    border: 1px solid var(--border-donation);
}

.rank-badge a {
    color: var(--border-donation);
    text-decoration: none
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    align-items: center
}

.header-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .75rem;
    font-weight: 700;
    font-family: inherit;
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid var(--border-2);
    border-radius: var(--r6);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s, transform .1s, box-shadow .15s;
    letter-spacing: .3px;
    white-space: nowrap;
}

.header-donate-btn {
    background: transparent;
    color: #f87171;
    border-color: #f87171;
}

.header-donate-btn:hover {
    background: #f87171;
    color: #000;
    transform: translateY(-1px);
}

.header-insta-btn {
    background: transparent;
    color: #e1306c;
    border-color: #e1306c;
}

.header-insta-btn:hover {
    background: #e1306c;
    color: var(--t1);
    transform: translateY(-1px);
}

.header-linktree-btn {
    background: transparent;
    color: #43e660;
    border-color: #43e660;
}

.header-linktree-btn:hover {
    background: #43e660;
    color: #04130a;
    transform: translateY(-1px);
}

/* ── Header Pro badge / upgrade button ──────────── */
.header-pro-btn {
    background: transparent;
    color: #fbbf24;
    border-color: #fbbf24;
    position: relative;
    order: -1;
}

.header-pro-btn:hover {
    background: #fbbf24;
    color: #000;
    transform: translateY(-1px);
}

.header-pro-btn.is-pro {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #000;
    border-color: #f59e0b;
    font-weight: 800;
    pointer-events: none;
}

.header-pro-btn.is-pro .fa-crown {
    filter: drop-shadow(0 0 4px rgba(251, 191, 36, .5));
}

/* ── Improved access card ──────────── */
.class-access-icon {
    font-size: 1.8rem;
    color: #fbbf24;
    flex-shrink: 0;
    width: 48px;
    text-align: center;
}

.class-access-card.is-unlocked .class-access-icon {
    color: var(--ss-success, #10b981);
}

.pro-upgrade-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    font-size: .78rem;
    font-weight: 800;
    font-family: inherit;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #000;
    transition: transform .1s, box-shadow .15s;
    white-space: nowrap;
}

.pro-upgrade-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(251, 191, 36, .3);
}

.pro-code-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 16px;
    font-size: .74rem;
    font-weight: 700;
    font-family: inherit;
    border: 1px solid var(--border-2);
    background: transparent;
    color: var(--t2);
    cursor: pointer;
    transition: border-color .12s, color .12s;
    white-space: nowrap;
}

.pro-code-btn:hover {
    border-color: var(--t2);
    color: var(--t1);
}

.made-by-credit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-align: center;
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.made-by-credit span {
    font-size: .68rem;
    color: var(--t2);
    letter-spacing: .3px;
}

.made-by-credit strong {
    color: var(--t2);
    font-weight: 700;
}

.btn-sync {
    background: var(--ss-primary);
    border: none;
    color: #fff;
    padding: 9px 20px;
    border-radius: var(--r6);
    font-weight: 700;
    font-size: .85rem;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background .15s, transform .12s, box-shadow .15s;
    box-shadow: 0 0 16px rgba(129, 140, 248, 0.22);
}

.btn-sync:hover {
    background: var(--ss-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(129, 140, 248, 0.38);
}

.btn-sync:active {
    transform: translateY(0)
}

/* -- BETA BAR ---------------------------------------------- */
.beta-status-bar {
    grid-column: 1/-1;
    padding: 11px 18px;
    background: var(--surface-2) !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border) !important;
    border-top: none !important;
    border-radius: 0 !important;
}

.beta-status-bar__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px
}

.beta-status-bar__title-wrap {
    display: flex;
    align-items: center;
    gap: 9px
}

.beta-badge {
    font-size: .57rem;
    font-weight: 800;
    letter-spacing: .9px;
    color: var(--t1);
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 0;
    padding: 2px 8px;
}

.beta-status-bar__title {
    font-size: .85rem;
    font-weight: 600;
    color: var(--t1)
}

.beta-status-bar__percent {
    font-size: .75rem;
    font-weight: 700;
    color: var(--t2)
}

.beta-progress-track {
    width: 100%;
    height: 2px;
    border-radius: 0;
    background: rgba(255, 255, 255, .07);
    overflow: hidden;
    margin-bottom: 8px;
}

.beta-progress-fill {
    height: 100%;
    background: #fff;
    border-radius: 0
}

.beta-credit {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .7rem;
    color: var(--t1);
    margin-bottom: 7px
}

.beta-credit a {
    color: var(--t1);
    font-weight: 600;
    text-decoration: none
}

.beta-credit a:hover {
    color: var(--t1)
}

.beta-todo-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px
}

.beta-todo-item {
    font-size: .64rem;
    color: var(--t2);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 3px 9px;
}

/* -- SIDEBAR ----------------------------------------------- */
.sidebar {
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 0;
    align-self: start;
    background: var(--surface) !important;
    border-radius: 0 !important;
    border-top: none !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: 1px solid var(--border) !important;
}

.stat-stack {
    display: flex;
    flex-direction: column
}

.stat-unit {
    margin-bottom: 0
}

.stat-label {
    font-size: .62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--t3);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: -4px;
    line-height: 1;
    color: var(--t1)
}

.text-blue {
    color: var(--blue)
}

.distribution-box {
    margin-top: 12px
}

.dist-chart {
    height: 48px;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    margin: 6px 0 4px
}

.dist-bar {
    flex: 1;
    border-radius: 0;
    cursor: pointer;
    min-height: 6px;
    transition: opacity .15s, transform .15s;
    transform-origin: bottom;
}

.dist-bar:hover {
    opacity: .65;
    transform: scaleY(1.07)
}

.dist-bar-active {
    outline: 1px solid rgba(255, 255, 255, .4);
    outline-offset: 1px
}

.dist-fail {
    background: linear-gradient(to top, #f43f5e, #fb7185)
}

.dist-ok {
    background: linear-gradient(to top, #f59e0b, #fcd34d)
}

.dist-good {
    background: linear-gradient(to top, #3b82f6, #60a5fa)
}

.dist-pro {
    background: linear-gradient(to top, #10b981, #34d399)
}

.period-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-top: 7px
}

.period-btn {
    background: transparent;
    border: 1px solid var(--border-2);
    color: var(--t2);
    padding: 8px 12px;
    border-radius: var(--r6);
    cursor: pointer;
    font-size: .72rem;
    font-weight: 600;
    font-family: inherit;
    text-align: center;
    transition: all .15s;
}

.period-btn:hover {
    border-color: var(--border-3);
    color: var(--t1);
    background: var(--surface-2);
}

.period-btn:disabled {
    opacity: .3;
    cursor: not-allowed
}

.period-btn.active {
    background: var(--ss-primary);
    color: #fff;
    border-color: var(--ss-primary);
    box-shadow: 0 0 12px rgba(129, 140, 248, 0.25);
}

.period-note {
    font-size: .62rem;
    color: var(--t3);
    margin-top: 5px
}

.sidebar-weight-card {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid var(--border-2);
    background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
}

.sidebar-weight-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.sidebar-weight-status {
    margin-top: 3px;
    font-size: .64rem;
    color: var(--t2);
}

.sidebar-switch {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.sidebar-switch input {
    display: none;
}

.sidebar-switch-track {
    width: 40px;
    height: 22px;
    border: 1px solid var(--border-2);
    background: var(--surface-3);
    position: relative;
    transition: border-color .15s, background .15s;
}

.sidebar-switch-track::after {
    content: '';
    width: 16px;
    height: 16px;
    position: absolute;
    top: 2px;
    left: 2px;
    background: var(--t2);
    transition: transform .15s ease, background .15s ease;
}

.sidebar-switch input:checked+.sidebar-switch-track {
    border-color: var(--t1);
    background: rgba(255, 255, 255, .1);
}

.sidebar-switch input:checked+.sidebar-switch-track::after {
    transform: translateX(18px);
    background: var(--t1);
}

.sidebar-weight-grid {
    margin-top: 11px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.sidebar-weight-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .02);
}

.sidebar-weight-field>span {
    font-size: .58rem;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--t3);
    font-weight: 700;
}

.sidebar-weight-field input {
    width: 100%;
    height: 30px;
    border: 1px solid var(--border-2);
    background: var(--surface-3);
    color: var(--t1);
    font-family: inherit;
    font-size: .86rem;
    font-weight: 700;
    text-align: center;
    outline: none;
}

.sidebar-weight-field input:focus {
    border-color: var(--t2);
}

.sidebar-weight-meta-row {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: .66rem;
    color: var(--t2);
    flex-wrap: wrap;
}

#period-weights-sum {
    font-weight: 700;
    color: var(--t1);
}

.sidebar-mini-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border: 1px solid var(--border-2);
    background: var(--surface-3);
    color: var(--t2);
    font-size: .6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.sidebar-mini-pill {
    cursor: pointer;
}

.sidebar-mini-pill:hover {
    border-color: var(--t1);
    color: var(--t1);
}

.sidebar-weight-actions {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.sidebar-quick-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: .68rem;
    padding: 9px 8px;
    border-color: var(--border-2);
    color: var(--t2);
    background: var(--surface-2);
}

.sidebar-quick-btn:hover {
    color: var(--t1);
    border-color: var(--t1);
    background: var(--surface-3);
}

.sidebar-weight-divider {
    margin-top: 10px;
    border-top: 1px solid var(--border);
}

.sidebar-weight-lesson-row {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 8px;
}

.sidebar-weight-field-inline {
    margin: 0;
}

.sidebar-weight-field-inline input {
    text-align: left;
    padding: 0 8px;
}

.sidebar-weight-card .period-note {
    margin-top: 9px;
    line-height: 1.4;
    color: var(--t2);
}

.hours-setup-overlay {
    position: fixed;
    inset: 0;
    z-index: 10040;
    background: rgba(0, 0, 0, .78);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.hours-setup-modal {
    width: min(760px, calc(100vw - 36px));
    max-height: min(84vh, 780px);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-2);
    background: var(--surface);
}

.hours-setup-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
}

.hours-setup-eyebrow {
    font-size: .58rem;
    letter-spacing: .9px;
    text-transform: uppercase;
    color: var(--t3);
    font-weight: 800;
}

.hours-setup-title {
    margin-top: 4px;
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--t1);
}

.hours-setup-subtitle {
    margin-top: 6px;
    font-size: .74rem;
    color: var(--t2);
}

.hours-setup-body {
    padding: 12px 16px;
    overflow: auto;
}

.hours-setup-subject-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.hours-setup-row {
    border: 1px solid var(--border);
    background: var(--surface-2);
    padding: 9px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.hours-setup-row-label {
    font-size: .75rem;
    color: var(--t1);
    font-weight: 700;
    min-width: 0;
    word-break: break-word;
}

.hours-setup-input-wrap {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.hours-setup-input {
    width: 62px;
    height: 28px;
    border: 1px solid var(--border-2);
    background: var(--surface-3);
    color: var(--t1);
    font: inherit;
    font-size: .78rem;
    font-weight: 700;
    text-align: center;
    outline: none;
}

.hours-setup-input:focus {
    border-color: var(--t1);
}

.hours-setup-input-unit {
    font-size: .65rem;
    color: var(--t3);
}

.hours-setup-actions {
    border-top: 1px solid var(--border);
    padding: 11px 16px 14px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

#hours-setup-save {
    min-width: 150px;
}

.dev-mode {
    border: 1px dashed rgba(255, 255, 255, .12) !important;
    display: block !important;
    position: relative;
    background: transparent !important;
}

.dev-badge {
    position: absolute;
    top: -10px;
    right: 10px;
    background: #fff;
    color: #000;
    font-size: .54rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 0;
    letter-spacing: .5px;
}

/* AI box */
.ai-insight-box {
    margin-top: 14px !important;
    padding: 13px !important;
    background: rgba(129, 140, 248, 0.06) !important;
    border: 1px solid rgba(129, 140, 248, 0.2) !important;
    border-radius: var(--r8) !important;
}

.ai-insight-box .stat-label {
    color: var(--t2) !important
}

#ai-prediction {
    font-size: .8rem;
    font-weight: 600;
    margin-top: 5px;
    color: var(--t1) !important
}

#final-pred {
    color: var(--t2) !important;
    font-size: .7rem !important
}

/* Insights */
.insight-group {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border)
}

.insight-card {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r8);
    margin-top: 5px;
    transition: background .12s, border-color .15s;
}

.insight-card:hover {
    background: var(--surface-3);
    border-color: var(--border-2);
}

.insight-card i {
    font-size: .82rem;
    min-width: 17px;
    text-align: center;
    color: var(--t3)
}

.insight-name {
    font-size: .57rem;
    color: var(--t3);
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 700;
    margin-bottom: 2px
}

.insight-value {
    font-size: .78rem;
    font-weight: 600;
    color: var(--t1)
}

/* Terminal */
.log-panel {
    margin-top: 14px;
    background: #050810;
    border: 1px solid var(--border);
    border-radius: var(--r8);
    padding: 10px;
}

.log-panel .stat-label {
    color: var(--t3)
}

.terminal {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Courier New', monospace;
    font-size: .59rem;
    height: 76px;
    overflow-y: auto;
    margin-top: 6px;
    color: var(--t2);
}

.terminal::-webkit-scrollbar {
    width: 4px
}

.terminal::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .1);
    border-radius: 0
}

.term-line {
    padding: 1px 0;
    line-height: 1.5
}

.creator-widget {
    margin-top: 10px !important;
    padding: 12px 14px !important;
    border-radius: var(--r8) !important;
    background: var(--surface-2) !important;
    border: 1px solid var(--border) !important;
}

.creator-name {
    font-size: .85rem;
    font-weight: 700;
    color: var(--t1);
    margin-top: 3px
}

.creator-text {
    font-size: .7rem;
    color: var(--t2);
    line-height: 1.5;
    margin-top: 3px
}

/* -- MAIN CONTENT ------------------------------------------ */
.main-content {
    padding: 18px;
    background: transparent !important;
    border-radius: 0 !important;
    border: none !important;
}

.board-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-2);
    padding-bottom: 12px;
}

.board-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--t1);
    letter-spacing: 0
}

#sync-status {
    font-size: .7rem;
    color: var(--t1) !important;
    margin-top: 2px
}

.filter-actions {
    display: flex;
    gap: 7px
}

.search-box {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r8);
    padding: 7px 11px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--t3);
    transition: border-color .12s;
}

.search-box:focus-within {
    border-color: var(--ss-primary)
}

.search-box input {
    background: none;
    border: none;
    color: var(--t1);
    font-size: .82rem;
    outline: none;
    width: 190px;
    font-family: inherit;
}

.search-box input::placeholder {
    color: var(--t3)
}

select.search-box {
    color: var(--t2);
    appearance: none;
    cursor: pointer;
    font-family: inherit;
    font-size: .82rem
}

select.search-box option {
    background: var(--surface-2);
    color: var(--t1)
}

.goal-bar {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 10px;
    background: var(--surface-2) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r12) !important;
}

#target-percent,
#bulk-score,
#bulk-max {
    background: transparent !important;
    border: 1px solid var(--border-2) !important;
    color: var(--t1) !important;
    border-radius: 0 !important;
    font-family: inherit !important;
    height: 27px;
    padding: 0 7px !important;
}

#goal-result {
    color: var(--t1) !important;
    font-size: .82rem;
    font-weight: 800
}

/* -- SUBJECT LIST � 2-col grid ----------------------------- */
#subject-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    background: transparent;
}

#total-points {
    margin-top: 8px;
    letter-spacing: 0;
    line-height: 1.2;
    font-weight: 800;
    white-space: nowrap;
}

.subject-card {
    background: var(--surface);
    overflow: hidden;
    border: 1px solid var(--border);
    border-left: 3px solid transparent;
    border-radius: var(--r8);
    transition: background .12s, box-shadow .15s, border-color .15s;
    box-shadow: var(--sh-sm);
}

.subject-card:hover {
    background: var(--surface-2);
    box-shadow: var(--sh-md);
}

/* Color-coded score tiers */
.subject-card.score-fail {
    border-left-color: #ef4444;
    border-left-width: 3px;
}

.subject-card.score-ok {
    border-left-color: #f59e0b;
    border-left-width: 3px;
}

.subject-card.score-good {
    border-left-color: #3b82f6;
    border-left-width: 3px;
}

.subject-card.score-pro {
    border-left-color: #10b981;
    border-left-width: 3px;
}

/* Active card spans full width */
.subject-card.active {
    grid-column: 1/-1;
    background: var(--surface-2)
}

.subject-trigger {
    padding: 13px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.subject-trigger:hover .subject-icon-box {
    transform: scale(1.05)
}

.subject-info {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    flex: 1
}

.subject-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .88rem;
    flex-shrink: 0;
    overflow: hidden;
    transition: transform .18s ease;
}

.subject-icon-letters {
    font-size: .68rem;
    font-weight: 900;
    letter-spacing: -.5px;
    line-height: 1;
    color: var(--t1)
}

.subject-name-tag {
    min-width: 0;
    flex: 1
}

.subject-name-tag h3 {
    font-size: .9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    color: var(--t1);
    line-height: 1.25;
}

.subject-name-tag p {
    font-size: .71rem;
    color: var(--t3);
    margin-top: 2px
}

.whatif-impact {
    font-size: .64rem;
    color: var(--t2);
    font-weight: 600;
    margin-top: 2px
}

.whatif-impact span {
    color: var(--t3);
    font-weight: 400
}

.score-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0
}

.subject-exclude-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--border-2);
    background: var(--surface-2);
    color: var(--t2);
    font-size: .62rem;
    font-weight: 700;
    padding: 4px 7px;
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}

.subject-exclude-btn:hover {
    background: var(--surface-3);
    color: var(--t1);
}

.subject-exclude-btn.is-excluded {
    border-color: var(--ss-primary);
    color: var(--ss-primary);
}

.score-badge {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -.5px;
    white-space: nowrap
}

.score-trend {
    font-size: .63rem;
    font-weight: 600
}

.trend-up {
    color: #cccccc
}

.trend-down {
    color: #666666
}

.trend-flat {
    color: var(--t3)
}

.priority-badge {
    font-size: .55rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 0;
    letter-spacing: .4px
}

.priority-warning {
    color: #ccc;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .12)
}

.priority-critical {
    color: var(--t1);
    background: rgba(255, 255, 255, .09);
    border: 1px solid rgba(255, 255, 255, .2)
}

.priority-muted {
    color: var(--t2);
    background: transparent;
    border: 1px solid var(--border-2);
}

/* -- DRAWER ------------------------------------------------ */
.drawer {
    height: 0;
    overflow: hidden;
    transition: height .26s cubic-bezier(.4, 0, .2, 1);
    padding: 0 16px;
    background: var(--surface-3);
}

.subject-card.active .drawer {
    height: auto;
    padding-top: 14px;
    padding-bottom: 18px;
    border-top: 1px solid var(--border);
}

.mini-progress {
    height: 2px;
    background: rgba(255, 255, 255, .07);
    border-radius: 0;
    margin-bottom: 14px;
    overflow: hidden
}

.mini-fill {
    height: 100%;
    border-radius: 0;
    transition: width .6s cubic-bezier(.4, 0, .2, 1)
}

.whatif-row {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 9px
}

.whatif-label {
    font-size: .7rem;
    color: var(--t2);
    font-weight: 500
}

.whatif-sep {
    color: var(--t3);
    font-weight: 700
}

.whatif-max {
    font-size: .67rem;
    color: var(--t3)
}

.whatif-input,
.whatif-max-input {
    width: 64px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--border);
    color: var(--t1);
    border-radius: 0;
    padding: 4px 7px;
    outline: none;
    font-family: inherit;
    font-size: .8rem;
    transition: border-color .12s;
}

.whatif-input:focus,
.whatif-max-input:focus {
    border-color: rgba(255, 255, 255, .3)
}

.period-btn.whatif-quick,
.period-btn.whatif-clear,
.period-btn.whatif-max-10,
.period-btn.whatif-max-20 {
    padding: 5px 9px;
    font-size: .64rem
}

.whatif-total {
    font-size: .7rem;
    font-weight: 700;
    color: var(--t2);
    margin-bottom: 12px
}

/* -- EVAL GRID --------------------------------------------- */
.eval-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 6px
}

.eval-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r8);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background .12s, border-color .15s;
}

.eval-card:hover {
    background: rgba(255, 255, 255, .04);
    border-color: var(--border-2);
}

.eval-card.eval-card-excluded {
    opacity: .6;
}

.eval-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 7px
}

.eval-title {
    font-size: .72rem;
    font-weight: 500;
    color: var(--t2);
    line-height: 1.3;
    flex: 1;
    word-break: break-word
}

.eval-score {
    font-size: .82rem;
    font-weight: 800;
    white-space: nowrap;
    flex-shrink: 0
}

.eval-bar-track {
    height: 2px;
    background: rgba(255, 255, 255, .07);
    border-radius: 0;
    overflow: hidden
}

.eval-bar-fill {
    height: 100%
}

.eval-footer {
    display: flex;
    align-items: center;
    justify-content: space-between
}

.eval-include-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    font-size: .62rem;
    color: var(--t2);
    user-select: none;
}

.eval-include-toggle input[type="checkbox"] {
    accent-color: var(--ss-primary);
}

.eval-percent {
    font-size: .61rem;
    font-weight: 600;
    color: var(--t3)
}

.eval-period-badge {
    font-size: .53rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 0;
    letter-spacing: .4px;
    text-transform: uppercase
}

.eval-period-1 {
    background: rgba(255, 255, 255, .07);
    color: #ddd;
    border: 1px solid rgba(255, 255, 255, .12)
}

.eval-period-2 {
    background: rgba(255, 255, 255, .04);
    color: #bbb;
    border: 1px solid rgba(255, 255, 255, .08)
}

.eval-period-3 {
    background: rgba(255, 255, 255, .02);
    color: #999;
    border: 1px solid rgba(255, 255, 255, .06)
}

.eval-period-unknown {
    background: transparent;
    color: var(--t3);
    border: 1px solid var(--border)
}

/* -- SUBJECT MODAL ----------------------------------------- */
.subject-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, .82);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.subject-modal-overlay.open {
    display: flex
}

.subject-modal {
    background: var(--surface);
    border: 1px solid var(--border-3);
    border-radius: var(--r16);
    width: 100%;
    max-width: 780px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modal-in .18s cubic-bezier(.4, 0, .2, 1);
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(16px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}

.modal-header-left {
    display: flex;
    align-items: center;
    gap: 13px
}

.modal-icon-box {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    overflow: hidden;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--t1)
}

.modal-subtitle {
    font-size: .75rem;
    color: var(--t3);
    margin-top: 2px
}

.modal-score-badge {
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: -1px
}

.modal-close {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--t2);
    width: 34px;
    height: 34px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, color .12s;
    flex-shrink: 0;
}

.modal-close:hover {
    background: rgba(255, 255, 255, .07);
    color: var(--t1)
}

.modal-body {
    padding: 18px 20px
}

.modal-progress {
    height: 2px;
    background: rgba(255, 255, 255, .07);
    margin-bottom: 18px;
    overflow: hidden
}

.modal-progress-fill {
    height: 100%;
    transition: width .6s cubic-bezier(.4, 0, .2, 1)
}

.modal-section-label {
    font-size: .57rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--t3);
    margin-bottom: 10px;
}

.modal-whatif-row {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 8px
}

.modal-whatif-total {
    font-size: .7rem;
    font-weight: 700;
    color: var(--t2);
    margin-bottom: 16px
}

.modal-divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0
}

/* -- FOOTER ------------------------------------------------ */
.dashboard-footer {
    width: 100%;
    margin: 12px auto 0;
    padding: 10px 16px;
    border-radius: 0;
    border: none;
    border-top: 1px solid var(--border);
    background: transparent;
    color: var(--t3);
    font-size: .7rem;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* -- RESPONSIVE -------------------------------------------- */
@media(max-width:1220px) {
    .container {
        grid-template-columns: 260px minmax(0, 1fr)
    }
}

@media(max-width:980px) {
    body {
        padding: 12px
    }

    .container {
        grid-template-columns: 1fr
    }

    .sidebar {
        order: 2;
        position: static;
        max-height: none;
        border-right: none !important;
        border-bottom: 1px solid var(--border-2) !important
    }

    .main-content {
        order: 3
    }

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

    .filter-actions {
        flex-direction: column
    }

    .search-box input {
        width: 100%
    }

    select.search-box {
        width: 100%
    }

    .goal-bar {
        flex-direction: column !important;
        align-items: stretch !important
    }

    .goal-bar>div {
        width: 100%;
        flex-wrap: wrap
    }

    .period-toggle {
        grid-template-columns: repeat(4, 1fr)
    }

    #subject-list {
        grid-template-columns: 1fr
    }
}

@media(max-width:640px) {
    .hero-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px
    }

    .hero-subtitle {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .hero-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .hours-setup-subject-list {
        grid-template-columns: 1fr;
    }

    .sidebar-weight-grid,
    .sidebar-weight-actions,
    .sidebar-weight-lesson-row {
        grid-template-columns: 1fr;
    }

    .btn-sync {
        width: 100%;
        justify-content: center
    }

    .eval-grid {
        grid-template-columns: 1fr
    }

    .board-header {
        gap: 8px
    }

    #subject-list {
        grid-template-columns: 1fr
    }
}

/* -- CLASS COMPARISON VIEW -------------------------------- */

/* Tab bar � bleeds edge-to-edge out of .main-content padding */
.view-tab-bar {
    display: flex;
    margin: -18px -18px 0;
    padding: 0 18px;
    border-bottom: 1px solid var(--border-2);
    background: var(--surface-2);
    border-radius: var(--r8) var(--r8) 0 0;
    overflow: hidden;
}

.view-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--t3);
    font-family: inherit;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .3px;
    padding: 12px 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: color .12s, border-color .12s;
    margin-bottom: -1px;
    white-space: nowrap;
}

.view-tab:hover {
    color: var(--t2);
}

.view-tab.active {
    color: var(--t1);
    border-bottom-color: var(--ss-primary);
}

/* My grades view � restore top spacing after tab bar */
#my-grades-view {
    padding-top: 14px;
}

/* Class view inner content */
.class-view-inner {
    padding-top: 18px;
}

/* Top two-panel row */
.class-top-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background: transparent;
    margin-bottom: 12px;
}

/* Panels � match .eval-card / .goal-bar style */
.class-panel {
    background: var(--surface-2);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-radius: var(--r8);
    border: 1px solid var(--border);
}

/* Panel title � exact .stat-label pattern */
.class-panel-title {
    font-size: .57rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--t3);
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 2px;
}

.class-panel-desc {
    font-size: .72rem;
    color: var(--t3);
    line-height: 1.55;
}

/* Code textarea � match .whatif-input look */
.class-code-textarea {
    width: 100%;
    min-height: 68px;
    background: rgba(255, 255, 255, .02);
    border: 1px solid var(--border);
    color: var(--t1);
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Courier New', monospace;
    font-size: .64rem;
    line-height: 1.6;
    padding: 9px 10px;
    resize: vertical;
    word-break: break-all;
    transition: border-color .12s;
}

.class-code-textarea:focus {
    outline: none;
    border-color: rgba(255, 255, 255, .3);
}

.class-code-textarea::placeholder {
    color: var(--t3);
}

.class-code-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: start;
}

.class-code-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 110px;
}

/* Section divider title � exact .stat-label */
.class-section-title {
    font-size: .57rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--t3);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding-top: 4px;
}

/* Classmates section wrapper */
#classmates-list-section {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r8);
    padding: 12px 14px;
}

/* Classmate chip � like .priority-badge but interactive */
.classmate-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--border-2);
    padding: 4px 6px 4px 6px;
    font-size: .7rem;
    font-weight: 600;
    margin: 3px 4px 3px 0;
    color: var(--t1);
    transition: background .12s;
}

.classmate-chip:hover {
    background: rgba(255, 255, 255, .03);
}

.classmate-chip-avatar {
    width: 18px;
    height: 18px;
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.classmate-chip-name {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.classmate-chip-remove {
    background: none;
    border: none;
    color: var(--t3);
    cursor: pointer;
    font-size: .65rem;
    padding: 0 2px;
    line-height: 1;
    transition: color .12s;
    margin-left: 2px;
}

.classmate-chip-remove:hover {
    color: var(--t1);
}

/* Comparison section wrapper */
#class-comparison-section {
    border: 1px solid var(--border);
    border-radius: var(--r12);
    background: var(--surface);
    overflow: hidden;
}

#class-comparison-section>.class-section-title {
    padding: 10px 14px 0;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

#class-table-hint {
    padding: 10px 14px;
    font-size: .72rem;
    color: var(--t3);
    border-bottom: 1px solid var(--border);
    margin-bottom: 0 !important;
}

/* Comparison table */
.ctable {
    width: 100%;
    border-collapse: collapse;
    font-size: .75rem;
    min-width: 600px;
}

.ctable th,
.ctable td {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 0;
    vertical-align: middle;
}

.ctable th:first-child,
.ctable td:first-child {
    border-left: none;
}

.ctable thead tr {
    background: var(--surface-2);
    border-bottom: 2px solid var(--border-2);
}

.ctable-th-name {
    min-width: 190px;
    padding: 9px 14px;
    font-size: .57rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--t3);
    text-align: left;
    white-space: nowrap;
}

.ctable-th-subject {
    min-width: 108px;
    max-width: 140px;
    padding: 9px 10px;
    font-size: .57rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--t3);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ctable-tr {
    background: var(--surface);
    transition: background .1s;
}

.ctable-tr:hover td {
    background: var(--surface-2);
}

.ctable-tr-me {
    background: var(--surface) !important;
}

.ctable-tr-me td {
    background: transparent !important;
}

.ctable-tr-me .ctable-td-name {
    border-left: 2px solid rgba(255, 255, 255, .55) !important;
}

.ctable-td-name {
    padding: 10px 14px;
    min-width: 190px;
}

.ctable-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Square avatar to match .subject-icon-box */
.ctable-avatar {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    object-fit: cover;
    border: 1px solid var(--border);
}

.ctable-avatar-placeholder {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    background: var(--surface-3);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 900;
    color: var(--t2);
    letter-spacing: -.5px;
}

.ctable-student-name {
    font-size: .84rem;
    font-weight: 700;
    color: var(--t1);
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.2;
}

/* JIJ badge � match .priority-critical */
.ctable-me-badge {
    font-size: .53rem;
    font-weight: 800;
    letter-spacing: .5px;
    color: var(--t1);
    background: rgba(255, 255, 255, .09);
    border: 1px solid rgba(255, 255, 255, .2);
    padding: 2px 6px;
}

.ctable-avg {
    font-size: .65rem;
    font-weight: 600;
    margin-top: 3px;
    color: var(--t3);
    display: flex;
    align-items: center;
    gap: 4px;
}

.ctable-td {
    padding: 9px 10px;
    text-align: center;
}

.ctable-td-empty {
    padding: 9px 10px;
    text-align: center;
    color: var(--t3);
    font-size: .68rem;
}

.ctable-cell-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

/* Crown � keep gold, used elsewhere on dashboard */
.ctable-crown {
    color: #e6a817;
    font-size: .6rem;
}

.ctable-pct {
    font-size: .84rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.3px;
}

.ctable-raw {
    font-size: .6rem;
    color: var(--t3);
    line-height: 1;
}

/* Bar � exact .eval-bar-track style */
.ctable-bar {
    width: 56px;
    height: 2px;
    background: rgba(255, 255, 255, .07);
    overflow: hidden;
    margin-top: 3px;
}

.ctable-bar-fill {
    height: 100%;
    transition: width .5s cubic-bezier(.4, 0, .2, 1);
}

/* Import result feedback */
#import-result {
    font-size: .7rem;
    min-height: 18px;
    font-weight: 600;
}

@media(max-width:980px) {
    .class-top-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .class-code-row {
        grid-template-columns: 1fr;
    }

    .class-code-actions {
        flex-direction: row;
    }
}

.view-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--t3);
    font-family: inherit;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .3px;
    padding: 13px 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: color .15s, border-color .15s;
    margin-bottom: -1px;
}

.view-tab:hover {
    color: var(--t1);
}

.view-tab.active {
    color: var(--t1);
    border-bottom-color: var(--ss-primary);
}

/* Class view wrapper */
.class-view-inner {
    padding: 24px;
}

.class-top-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.class-panel {
    padding: 20px;
    background: var(--surface-2) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r12) !important;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.class-panel-title {
    font-size: .75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--t1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.class-panel-desc {
    font-size: .75rem;
    color: var(--t2);
    line-height: 1.5;
}

.class-code-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: start;
}

.class-code-textarea {
    width: 100%;
    min-height: 72px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    color: var(--t1);
    font-family: 'Courier New', monospace;
    font-size: .68rem;
    line-height: 1.5;
    padding: 10px;
    resize: vertical;
    word-break: break-all;
}

.class-code-textarea:focus {
    outline: none;
    border-color: var(--border-3);
}

.class-code-textarea::placeholder {
    color: var(--t3);
}

.class-code-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 120px;
}

.class-section-title {
    font-size: .65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--t3);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 7px;
}

/* Classmate chips */
.classmate-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    padding: 5px 10px 5px 7px;
    font-size: .75rem;
    font-weight: 600;
    margin: 3px 4px 3px 0;
    color: var(--t1);
}

.classmate-chip-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}

.classmate-chip-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.classmate-chip-remove {
    background: none;
    border: none;
    color: var(--t3);
    cursor: pointer;
    font-size: .7rem;
    padding: 0 0 0 4px;
    line-height: 1;
    transition: color .12s;
}

.classmate-chip-remove:hover {
    color: #f87171;
}

/* Comparison table */
.ctable {
    width: 100%;
    border-collapse: collapse;
    font-size: .75rem;
    min-width: 600px;
}

.ctable th,
.ctable td {
    border: 1px solid var(--border);
    padding: 0;
    vertical-align: middle;
}

.ctable thead {
    background: var(--surface-2);
    position: sticky;
    top: 0;
    z-index: 2;
}

.ctable-th-name {
    min-width: 180px;
    padding: 10px 14px;
    font-size: .62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--t2);
    text-align: left;
}

.ctable-th-subject {
    min-width: 100px;
    max-width: 130px;
    padding: 10px 10px;
    font-size: .62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--t2);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ctable-tr:hover td {
    background: rgba(255, 255, 255, .02);
}

.ctable-tr-me td {
    background: rgba(255, 255, 255, .03) !important;
}

.ctable-tr-me .ctable-td-name {
    border-left: 2px solid rgba(255, 255, 255, .4) !important;
}

.ctable-td-name {
    padding: 10px 14px;
    min-width: 180px;
}

.ctable-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ctable-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.ctable-avatar-placeholder {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface-3);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    font-weight: 800;
    color: var(--t2);
    flex-shrink: 0;
}

.ctable-student-name {
    font-weight: 700;
    font-size: .78rem;
    color: var(--t1);
    display: flex;
    align-items: center;
    gap: 5px;
}

.ctable-me-badge {
    font-size: .55rem;
    font-weight: 800;
    letter-spacing: .5px;
    background: #fff;
    color: #000;
    padding: 1px 5px;
}

.ctable-avg {
    font-size: .68rem;
    font-weight: 600;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ctable-td {
    padding: 8px 10px;
    text-align: center;
}

.ctable-td-empty {
    padding: 8px 10px;
    text-align: center;
    color: var(--t3);
    font-size: .7rem;
}

.ctable-cell-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.ctable-crown {
    color: #f59e0b;
    font-size: .62rem;
    margin-bottom: 1px;
}

.ctable-pct {
    font-size: .78rem;
    font-weight: 800;
    line-height: 1;
}

.ctable-raw {
    font-size: .62rem;
    color: var(--t3);
    line-height: 1;
}

.ctable-bar {
    width: 60px;
    height: 3px;
    background: var(--surface-3);
    overflow: hidden;
    margin-top: 2px;
}

.ctable-bar-fill {
    height: 100%;
    transition: width .4s ease;
}

@media(max-width:980px) {
    .class-top-row {
        grid-template-columns: 1fr;
    }

    .class-code-row {
        grid-template-columns: 1fr;
    }

    .class-code-actions {
        flex-direction: row;
    }
}

/* -- FOOTER IDEAS BUTTON ----------------------------------- */
.footer-ideas-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--t3);
    font-size: .7rem;
    padding: 3px 10px;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: .5px;
    transition: border-color .15s, color .15s;
}

.footer-ideas-btn:hover {
    border-color: var(--t2);
    color: var(--t1);
}

.footer-ad-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: 1px solid var(--border);
    color: var(--t3);
    font-size: .7rem;
    padding: 3px 10px;
    text-decoration: none;
    font-family: inherit;
    letter-spacing: .5px;
    transition: border-color .15s, color .15s;
}

.footer-ad-link:hover {
    border-color: #818cf8;
    color: #818cf8;
}

/* -- REVIEW POPUP ------------------------------------------ */
.review-popup {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9500;
    display: none;
    align-items: flex-end;
    justify-content: flex-end;
    pointer-events: none;
}

.review-popup[style*="flex"] {
    pointer-events: auto;
}

.review-popup-inner {
    background: var(--surface);
    border: 1px solid var(--border-3);
    border-radius: var(--r16);
    width: 300px;
    padding: 20px 20px 18px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .55);
    animation: modal-in .2s cubic-bezier(.4, 0, .2, 1);
}

.review-popup-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.review-popup-stars {
    font-size: 1.15rem;
    color: #f59e0b;
    letter-spacing: 2px;
}

.review-popup-dismiss {
    background: none;
    border: none;
    color: var(--t3);
    cursor: pointer;
    font-size: .85rem;
    padding: 0 2px;
    line-height: 1;
}

.review-popup-dismiss:hover {
    color: var(--t1);
}

.review-popup-title {
    font-size: .92rem;
    font-weight: 700;
    color: var(--t1);
    margin-bottom: 8px;
}

.review-popup-body {
    font-size: .78rem;
    color: var(--t2);
    line-height: 1.55;
    margin: 0 0 14px;
}

.review-popup-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.review-btn-primary {
    display: block;
    text-align: center;
    background: var(--surface-3);
    border: 1px solid var(--border-3);
    color: var(--t1);
    font-size: .82rem;
    font-weight: 700;
    padding: 8px 12px;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    letter-spacing: .3px;
    transition: background .15s;
}

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

.review-btn-secondary {
    background: none;
    border: 1px solid var(--border);
    color: var(--t3);
    font-size: .75rem;
    padding: 6px 10px;
    cursor: pointer;
    font-family: inherit;
    transition: border-color .15s, color .15s;
}

.review-btn-secondary:hover {
    border-color: var(--t2);
    color: var(--t1);
}

/* -- IDEAS MODAL ------------------------------------------- */
.ideas-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9200;
    background: rgba(0, 0, 0, .82);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ideas-modal {
    background: var(--surface);
    border: 1px solid var(--border-3);
    border-radius: var(--r16);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modal-in .18s cubic-bezier(.4, 0, .2, 1);
}

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

.ideas-modal-title {
    font-size: .9rem;
    font-weight: 700;
    color: var(--t1);
    letter-spacing: .3px;
}

.ideas-modal-body {
    padding: 20px;
}

.ideas-section-label {
    font-size: .57rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--t3);
    margin-bottom: 10px;
}

.ideas-list {
    list-style: none;
    padding: 0;
    margin: 0 0 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ideas-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .82rem;
    color: var(--t2);
    line-height: 1.4;
}

.ideas-body-text {
    font-size: .78rem;
    color: var(--t2);
    margin: 0 0 14px;
    line-height: 1.55;
}

.ideas-send-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--surface-3);
    border: 1px solid var(--border-3);
    color: var(--t1);
    font-size: .8rem;
    font-weight: 600;
    padding: 8px 14px;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
}

.ideas-send-btn:hover {
    background: var(--border);
}

/* -- PERIOD NO-DATA STATE ---------------------------------------------------- */
.period-nodata-state {
    padding: 60px 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.period-nodata-icon {
    font-size: 2.4rem;
    opacity: .45;
}

.period-nodata-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--t1);
}

.period-nodata-body {
    font-size: .82rem;
    color: var(--t2);
    max-width: 520px;
    line-height: 1.65;
    margin: 0;
}

.period-nodata-report-btn {
    display: none;
}

/* -- PERIOD REPORT MODAL ----------------------------------------------------- */
.period-report-overlay {
    position: fixed;
    inset: 0;
    z-index: 9300;
    background: rgba(0, 0, 0, .82);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.period-report-modal {
    background: var(--surface);
    border: 1px solid var(--border-3);
    border-radius: var(--r16);
    width: 100%;
    max-width: 600px;
    max-height: 92vh;
    overflow-y: auto;
    animation: modal-in .18s cubic-bezier(.4, 0, .2, 1);
}

.period-report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}

.period-report-title {
    font-size: .9rem;
    font-weight: 700;
    color: var(--t1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.period-report-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.period-report-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.period-report-slabel {
    font-size: .57rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--t3);
}

.period-report-text {
    font-size: .82rem;
    color: var(--t2);
    line-height: 1.65;
    margin: 0;
}

.period-report-hint {
    font-size: .72rem;
    color: var(--t3);
    font-style: italic;
    margin: 2px 0 0;
}

.report-detected-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 28px;
}

.report-label-chip {
    background: var(--surface-3);
    border: 1px solid var(--border-3);
    color: var(--t1);
    font-size: .75rem;
    font-family: monospace;
    padding: 3px 9px;
}

.report-label-loading,
.report-label-empty {
    font-size: .78rem;
    color: var(--t3);
    font-style: italic;
}

.report-input {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--t1);
    font-size: .83rem;
    font-family: inherit;
    padding: 8px 10px;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border-color .15s;
}

.report-input:focus {
    border-color: var(--border-3);
}

.report-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: .82rem;
    color: var(--t2);
    line-height: 1.55;
}

.report-checkbox-label input[type="checkbox"] {
    margin-top: 2px;
    accent-color: var(--t1);
    flex-shrink: 0;
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.report-steps-list {
    margin: 4px 0 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.report-steps-list li {
    font-size: .80rem;
    color: var(--t2);
    line-height: 1.55;
}

.report-status {
    font-size: .78rem;
    padding: 8px 12px;
    border: 1px solid var(--border);
    color: var(--t2);
}

.report-status-ok {
    border-color: #10b981;
    color: #10b981;
}

.report-status-warn {
    border-color: #f59e0b;
    color: #f59e0b;
}

.report-status-info {
    border-color: var(--border-3);
    color: var(--t2);
}

.period-report-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 4px;
}

.report-btn-primary {
    background: var(--surface-3);
    border: 1px solid var(--border-3);
    color: var(--t1);
    font-size: .82rem;
    font-weight: 700;
    padding: 10px 16px;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background .15s;
}

.report-btn-primary:hover:not(:disabled) {
    background: var(--border);
}

.report-btn-primary:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.report-btn-secondary {
    background: none;
    border: 1px solid var(--border);
    color: var(--t3);
    font-size: .78rem;
    padding: 8px 14px;
    cursor: pointer;
    font-family: inherit;
    transition: border-color .15s, color .15s;
}

.report-btn-secondary:hover {
    border-color: var(--t2);
    color: var(--t1);
}

#theme-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 10010;
    background: rgba(0, 0, 0, .78);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

#theme-picker-panel {
    width: min(760px, calc(100vw - 36px));
    max-height: min(86vh, 780px);
    border: 1px solid var(--border-2);
    border-radius: var(--r16);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

.tp-header h3 {
    font-size: .9rem;
    font-weight: 800;
    color: var(--t1);
}

.tp-close-btn {
    border: 1px solid var(--border-2);
    background: var(--surface-2);
    color: var(--t1);
    width: 30px;
    height: 30px;
    cursor: pointer;
    font: inherit;
}

.tp-body {
    padding: 12px;
    overflow: auto;
}

.tp-live-section {
    border: 1px solid var(--border);
    background: var(--surface-2);
    padding: 10px;
    margin-bottom: 10px;
}

.tp-live-title {
    margin-top: 6px;
    font-size: .78rem;
    font-weight: 700;
    color: var(--t1);
}

.tp-live-text {
    margin-top: 4px;
    font-size: .7rem;
    color: var(--t2);
}

.tp-live-state {
    margin-top: 8px;
    font-size: .66rem;
    color: var(--t3);
}

.tp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.tp-swatch {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--t1);
    cursor: pointer;
    padding: 8px;
    text-align: left;
}

.tp-swatch.tp-active {
    border-color: var(--t1);
}

.tp-swatch-preview {
    height: 46px;
    border: 1px solid var(--border);
    display: grid;
    grid-template-columns: 2fr 1fr;
    overflow: hidden;
}

.tp-swatch-bg,
.tp-swatch-accent {
    width: 100%;
    height: 100%;
}

.tp-swatch-label {
    margin-top: 7px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tp-swatch-name {
    font-size: .7rem;
    color: var(--t2);
    font-weight: 700;
}

.tp-check {
    opacity: 0;
    color: var(--t1);
}

.tp-swatch.tp-active .tp-check {
    opacity: 1;
}

/* -- CUSTOM EXTENSIONS (2026) ----------------------------- */

.sidebar-audience-card {
    margin-top: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.audience-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.audience-stat {
    background: var(--surface-3);
    border: 1px solid var(--border);
    padding: 10px;
}

.audience-stat-label {
    font-size: .58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--t3);
}

.audience-stat-value {
    margin-top: 4px;
    font-size: 1rem;
    font-weight: 900;
    color: var(--t1);
}

.audience-meta {
    margin-top: 8px;
    font-size: .66rem;
    color: var(--t3);
}

.class-access-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid var(--border-3);
    background: var(--surface-2);
}

.class-access-title {
    font-size: .78rem;
    font-weight: 800;
    color: var(--t1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.class-access-text {
    margin-top: 4px;
    font-size: .74rem;
    color: var(--t2);
}

.class-access-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.class-access-card.is-unlocked {
    border-color: color-mix(in srgb, var(--ss-success, #10b981) 50%, var(--border));
}

.class-compare-locked {
    opacity: .45;
    pointer-events: none;
    user-select: none;
}

.class-shortcode-box {
    border: 1px solid var(--border);
    background: var(--surface-2);
    padding: 9px;
}

.class-shortcode-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: .68rem;
    color: var(--t2);
    margin-bottom: 7px;
}

.class-shortcode-head i {
    color: var(--t1);
    margin-right: 5px;
}

.class-shortcode-timer {
    font-size: .64rem;
    color: var(--t3);
}

.class-shortcode-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.class-shortcode-value {
    border: 1px solid var(--border-2);
    background: var(--surface-3);
    color: var(--t1);
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: .16em;
    padding: 8px 10px;
    text-align: center;
}

.class-shortcode-import {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin-bottom: 8px;
}

.class-shortcode-row-tests {
    margin-bottom: 8px;
}

.classmate-requests-list {
    margin-top: 10px;
}

.class-request-title {
    font-size: .66rem;
    font-weight: 700;
    color: var(--t2);
    margin-bottom: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.class-request-list {
    display: grid;
    gap: 6px;
}

.class-request-item {
    border: 1px solid var(--border);
    background: var(--surface-2);
    padding: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.class-request-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: .68rem;
    color: var(--t2);
}

.class-request-copy strong {
    color: var(--t1);
    font-size: .72rem;
}

.class-request-actions {
    display: flex;
    gap: 6px;
}

.class-request-actions .period-btn {
    padding: 5px 8px;
    font-size: .68rem;
}

/* ── Directory & Privacy UI ─────────────────────────────── */
.class-directory-section {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
}

.directory-search-bar {
    display: flex;
    gap: 8px;
    margin: 10px 0 8px;
}

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

.directory-results {
    margin-top: 4px;
    display: grid;
    gap: 6px;
    max-height: 320px;
    overflow-y: auto;
}

.directory-no-results {
    text-align: center;
    padding: 20px;
    color: var(--t2);
    font-size: .78rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.directory-user-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    gap: 12px;
    transition: border-color .15s;
}

.directory-user-card:hover {
    border-color: var(--accent, #3b82f6);
}

.directory-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.directory-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent, #3b82f6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .82rem;
    font-weight: 700;
    flex-shrink: 0;
}

.directory-user-name {
    font-size: .82rem;
    font-weight: 600;
    color: var(--t1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.directory-user-school {
    font-size: .68rem;
    color: var(--t2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.directory-add-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

.directory-add-btn.directory-add-sent {
    pointer-events: none;
    opacity: .7;
    background: var(--accent, #10b981);
    color: #fff;
}

.directory-chip-school {
    font-size: .6rem;
    color: var(--t2);
    margin-left: 4px;
}

.directory-friend-chip {
    cursor: default;
}

.classmate-requests-section {
    margin-top: 8px;
}

/* ── Friends View Styles ─────────────────────────────────── */
.friends-section-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 14px;
}

.friends-section-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.friends-section-header>i {
    font-size: 1.1rem;
    color: var(--accent, #3b82f6);
    margin-top: 2px;
    flex-shrink: 0;
}

.friends-section-title {
    font-size: .85rem;
    font-weight: 700;
    color: var(--t1);
    margin-bottom: 2px;
}

.friends-section-desc {
    font-size: .72rem;
    color: var(--t2);
    line-height: 1.4;
    margin: 0;
}

.friends-empty-state {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 12px;
    color: var(--t2);
    font-size: .78rem;
}

.friends-empty-state>i {
    font-size: 1.3rem;
    opacity: .5;
}

.friend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 6px;
    transition: border-color .15s;
}

.friend-item:hover {
    border-color: var(--accent, #3b82f6);
}

.friend-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent, #3b82f6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    font-weight: 700;
    flex-shrink: 0;
}

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

.friend-name {
    font-size: .82rem;
    font-weight: 600;
    color: var(--t1);
    display: flex;
    align-items: center;
    gap: 6px;
}

.friend-meta {
    font-size: .68rem;
    color: var(--t2);
    margin-top: 1px;
}

.friends-shortcode-card {
    border-style: dashed;
    opacity: .9;
}

/* ── Improved Shortcode Card v2 ──────────────────────────── */
.friends-shortcode-card-v2 {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 14px;
}

.shortcode-split {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 18px;
    align-items: start;
}

.shortcode-divider {
    width: 1px;
    background: var(--border-2);
    align-self: stretch;
    min-height: 60px;
}

.shortcode-label {
    font-size: .68rem;
    font-weight: 700;
    color: var(--t2);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 8px;
}

.shortcode-display {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.shortcode-big {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: .2em;
    color: var(--t1);
    font-family: 'Courier New', monospace;
}

.shortcode-timer-badge {
    font-size: .62rem;
    color: var(--t3);
    background: var(--surface-3, var(--surface));
    border: 1px solid var(--border);
    padding: 3px 7px;
    border-radius: 10px;
    white-space: nowrap;
}

.shortcode-share-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.shortcode-copy-btn {
    flex: 1;
    justify-content: center;
}

.shortcode-whatsapp-btn {
    flex: 1;
    justify-content: center;
    background: #25d366 !important;
    border-color: #25d366 !important;
    color: #fff !important;
}

.shortcode-whatsapp-btn:hover {
    background: #1da851 !important;
}

.shortcode-share-hint {
    font-size: .65rem;
    color: var(--t3);
    margin: 4px 0 0;
    line-height: 1.4;
}

.shortcode-enter-side {
    display: flex;
    flex-direction: column;
}

.shortcode-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}

.shortcode-input {
    flex: 1;
    min-width: 0;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: .15em;
    text-transform: uppercase;
    text-align: center;
    padding: 8px 10px;
    background: var(--surface-3, var(--surface));
    border: 1px solid var(--border-2);
    color: var(--t1);
    font-family: 'Courier New', monospace;
}

.shortcode-input::placeholder {
    font-size: .75rem;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
    font-family: inherit;
    color: var(--t3);
}

.shortcode-result {
    font-size: .72rem;
    min-height: 1.2em;
}

.shortcode-result.is-success {
    color: #86efac;
}

.shortcode-result.is-error {
    color: #f87171;
}

.shortcode-test-hint {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: .7rem;
    color: var(--t3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.shortcode-test-hint strong {
    color: var(--t1);
    font-family: 'Courier New', monospace;
    letter-spacing: .1em;
}

.friends-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: .62rem;
    font-weight: 800;
    border-radius: 9px;
    background: var(--accent, #3b82f6);
    color: #fff;
    margin-left: 6px;
    vertical-align: middle;
}

.friends-badge:empty {
    display: none;
}

@media (max-width: 600px) {
    .shortcode-split {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .shortcode-divider {
        width: 100%;
        height: 1px;
        min-height: 0;
    }
}

.test-compare-toolbar {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(160px, 1fr) auto auto;
    gap: 8px;
    align-items: center;
}

.test-compare-select {
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    color: var(--t1);
    min-height: 33px;
    padding: 0 10px;
    font-family: inherit;
    font-size: .78rem;
}

.test-compare-license-note {
    margin-top: 8px;
    font-size: .72rem;
    color: var(--t2);
}

#test-compare-container {
    margin-top: 10px;
}

.tests-subject-list {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.tests-subject-btn {
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--t1);
    font-family: inherit;
    text-align: left;
    padding: 9px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tests-subject-btn:hover {
    border-color: var(--border-2);
    background: var(--surface-3);
}

.tests-subject-btn.is-active {
    border-color: var(--t1);
    background: var(--surface-3);
}

.tests-subject-name {
    font-size: .74rem;
    font-weight: 800;
    color: var(--t1);
}

.tests-subject-diff {
    font-size: .66rem;
    color: var(--t2);
}

.test-compare-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.test-compare-metrics span {
    font-size: .67rem;
    color: var(--t2);
    border: 1px solid var(--border);
    background: var(--surface-2);
    padding: 4px 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.test-compare-metrics i {
    color: var(--t1);
}

.test-compare-headline {
    font-size: .76rem;
    font-weight: 700;
    color: var(--t1);
    margin-bottom: 8px;
}

.test-compare-source {
    color: var(--t3);
    font-weight: 600;
}

.test-compare-grid {
    display: grid;
    gap: 8px;
}

.test-compare-card {
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.test-compare-card-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    padding: 9px 11px;
    border-bottom: 1px solid var(--border);
}

.test-compare-subject {
    font-size: .74rem;
    font-weight: 800;
    color: var(--t1);
}

.test-compare-avg-diff {
    font-size: .68rem;
    color: var(--t2);
}

.test-compare-table-wrap {
    overflow-x: auto;
}

.test-compare-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 460px;
}

.test-compare-table th,
.test-compare-table td {
    border: 1px solid var(--border);
    padding: 6px 8px;
    font-size: .7rem;
    text-align: left;
}

.test-compare-table th {
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--t2);
    background: var(--surface-3);
}

.test-compare-table td.is-pos {
    color: #86efac;
    font-weight: 700;
}

.test-compare-table td.is-neg {
    color: #fca5a5;
    font-weight: 700;
}

.test-compare-table td.is-even {
    color: var(--t2);
    font-weight: 700;
}

.test-compare-empty {
    border: 1px dashed var(--border-2);
    background: var(--surface-2);
    padding: 12px;
    font-size: .74rem;
    color: var(--t2);
}

.ghost-mode .ctable-avatar,
.ghost-mode .ctable-avatar-placeholder,
.ghost-mode .ctable-student-name,
.ghost-mode .classmate-chip-avatar,
.ghost-mode .classmate-chip-name {
    filter: blur(6px);
    user-select: none;
}

@media (max-width: 980px) {
    .class-access-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .class-access-actions {
        width: 100%;
        flex-wrap: wrap;
    }

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

    .test-compare-toolbar {
        grid-template-columns: 1fr;
    }

    .class-shortcode-row,
    .class-shortcode-import {
        grid-template-columns: 1fr;
    }

    .class-request-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .class-request-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .directory-user-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .directory-add-btn {
        width: 100%;
    }

    .directory-search-bar {
        flex-direction: column;
    }

    .friends-section-header {
        flex-direction: column;
        gap: 8px;
    }

    .friend-item {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================================
   ADVERTENTIE SYSTEEM
   ============================================================ */

/* --- Laadscherm (wacht op advertenties) --- */
.ad-loading-gate {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--bg, #0a0a0a);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .35s ease;
}

.ad-loading-gate.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.ad-loading-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--t2, #aaa);
}

/* --- Banner groot (main content, 2 naast elkaar) --- */
.ad-banner-container {
    margin-top: 20px;
    padding: 14px;
    border-radius: var(--r12);
    background: var(--surface);
    border: 1px solid var(--border);
}

.ad-groot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.ad-groot-slot {
    text-align: center;
}

.ad-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--t2);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ad-popup-title {
    font-size: 0.9rem;
    margin-bottom: 10px;
    color: var(--t1);
}

.ad-banner-wrapper {
    position: relative;
    display: block;
    width: 100%;
}

.ad-banner-img {
    display: block;
    border-radius: var(--r8);
    cursor: pointer;
    transition: opacity 0.2s;
    object-fit: cover;
}

.ad-banner-img:hover {
    opacity: 0.85;
}

/* Grote banner — halve breedte per slot, iets hogere hoogte */
.ad-banner-img.ad-size-groot {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--r8);
}

/* Kleine banner — uitrekken naar volle breedte sidebar, hoogte 60px */
.ad-banner-img.ad-size-klein {
    width: 100%;
    height: 60px;
    object-fit: cover;
}

.ad-banner-label {
    font-size: 0.6rem;
    color: var(--t3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* --- Sidebar banner (onder Totaal Punten, max 2 gestapeld) --- */
.ad-sidebar-container {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ad-sidebar-slot {
    padding: 8px;
    border-radius: var(--r12);
    background: var(--surface);
    border: 1px solid var(--border);
    text-align: center;
}

.ad-sidebar-wrapper {
    display: block;
    width: 100%;
}

/* --- Popup: 400×300 — exacte afmetingen --- */
.ad-popup-img {
    width: 400px;
    max-width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: var(--r8);
    cursor: pointer;
    transition: transform 0.2s;
}

/* --- Popup --- */
.ad-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: adPopupFadeIn 0.3s ease;
}

@keyframes adPopupFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.ad-popup-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--r16);
    padding: 24px;
    max-width: 520px;
    width: 90%;
    box-shadow: var(--sh-lg);
    text-align: center;
}

.ad-popup-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: var(--t2);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--r4);
    transition: color 0.15s, background 0.15s;
}

.ad-popup-close:hover {
    color: var(--t1);
    background: var(--surface-3);
}

/* ============================================================
   DESIGN POLISH — Extra verbeteringen
   ============================================================ */

/* Promo banner neemt volledige breedte in hero-grid */
#smpp-promo-banner {
    grid-column: 1 / -1;
    order: -1;
}

/* Betere container max-width voor brede schermen */
.container {
    max-width: 1680px;
    margin: 0 auto;
}

/* Kleurgecodeerde score badge tekst */
.subject-card.score-fail .score-badge {
    color: #ef4444;
}

.subject-card.score-ok .score-badge {
    color: #f59e0b;
}

.subject-card.score-good .score-badge {
    color: #60a5fa;
}

.subject-card.score-pro .score-badge {
    color: #34d399;
}

/* Gemiddelde percentage — grote gekleurd getal */
.stat-value.text-blue {
    background: linear-gradient(135deg, var(--blue), var(--blue-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Betere transitie op subject cards */
.subject-card {
    transition: background .15s ease, box-shadow .2s ease, border-color .15s ease, transform .12s ease;
}

.subject-card:hover {
    transform: translateY(-1px);
}

/* Verwijder transform op actieve kaart */
.subject-card.active {
    transform: none;
}

/* Donatie knop behoud rode kleur */
.header-donate-btn {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.45);
}

.header-donate-btn:hover {
    background: rgba(248, 113, 113, 0.15);
    color: #fca5a5;
    border-color: #f87171;
    transform: translateY(-1px);
}

/* Scrollbar voor sidebar verbeterd */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(129, 140, 248, 0.2);
    border-radius: var(--r99);
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(129, 140, 248, 0.4);
}

/* Footer links */
.dashboard-footer a,
.dashboard-footer button {
    border-radius: var(--r99);
}

/* Betere modal close buttons */
.modal-close {
    border-radius: var(--r99);
}

/* Toegang kaart afgerond */
.class-access-card {
    border-radius: var(--r12);
}

/* Vriend-items afgerond */
.friend-item {
    border-radius: var(--r12);
}

/* Test compare cards afgerond */
.test-compare-card {
    border-radius: var(--r8);
    overflow: hidden;
}

/* Hours setup modal afgerond */
.hours-setup-modal {
    border-radius: var(--r16);
    overflow: hidden;
}

/* TP swatches afgerond */
.tp-swatch {
    border-radius: var(--r8);
}

.tp-swatch-preview {
    border-radius: var(--r6);
    overflow: hidden;
}

/* Betere subject trigger hover */
.subject-trigger:hover .subject-icon-box {
    border-color: var(--border-2);
}


.ad-popup-link {
    display: block;
}

.ad-popup-img:hover {
    transform: scale(1.01);
}

.ad-popup-label {
    font-size: 0.6rem;
    color: var(--t3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 8px;
}