:root {
    --bg: #f8f9fa;
    --panel: #ffffff;
    --surface: #f1f3f5;
    --surface-2: #e9ecef;
    --surface-3: #dee2e6;
    --border: rgba(15, 23, 42, 0.08);
    --border-md: rgba(15, 23, 42, 0.14);
    --border-hover: rgba(15, 23, 42, 0.22);
    --accent: #0f172a;
    --blue: #3b82f6;
    --blue-dim: rgba(59, 130, 246, 0.12);
    --blue-border: rgba(59, 130, 246, 0.25);
    --green: #10b981;
    --green-dim: rgba(16, 185, 129, 0.12);
    --green-border: rgba(16, 185, 129, 0.25);
    --amber: #f59e0b;
    --amber-dim: rgba(245, 158, 11, 0.12);
    --amber-border: rgba(245, 158, 11, 0.25);
    --red: #ef4444;
    --red-dim: rgba(239, 68, 68, 0.12);
    --red-border: rgba(239, 68, 68, 0.25);
    --purple: #8b5cf6;
    --purple-dim: rgba(139, 92, 246, 0.12);
    --purple-border: rgba(139, 92, 246, 0.25);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --sidebar-w: 228px;
    --header-h: 64px;
    --font: "Geist", -apple-system, sans-serif;
    --mono: "Geist Mono", monospace;
    --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --r: 12px;
    --r-lg: 16px;
}
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html {
    font-size: 16px;
}
body {
    background: var(--bg);
    color: var(--text-primary);
    font-family: var(--font);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}
a {
    text-decoration: none;
    color: inherit;
}
button {
    cursor: pointer;
    font-family: var(--font);
}
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(15, 23, 42, 0.018) 2px,
        rgba(15, 23, 42, 0.018) 4px
    );
}

/* ── Shell ── */
.shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--header-h) 1fr;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    grid-row: 1/-1;
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 1.25rem;
    height: var(--header-h);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-logo__mark {
    width: 32px;
    height: 32px;
    border-radius: 0;
    background: none;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.sidebar-logo__mark img {
    filter: invert(13%) sepia(94%) saturate(748%) hue-rotate(199deg)
        brightness(92%) contrast(102%);
}
.sidebar-logo__name {
    font-family: "Fraunces", Georgia, serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.6rem 0.85rem 0.3rem;
    margin-top: 0.25rem;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.65rem 0.85rem;
    border-radius: var(--r);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition:
        background 0.2s,
        color 0.2s;
    position: relative;
    cursor: pointer;
}
.nav-item:hover {
    background: var(--surface);
    color: var(--text-primary);
}
.nav-item.active {
    background: var(--surface-2);
    color: var(--text-primary);
}
.nav-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 22%;
    bottom: 22%;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}
.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.75;
}
.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
    opacity: 1;
}
.nav-badge {
    margin-left: auto;
    background: var(--surface-3);
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
    border: 1px solid var(--border);
}
.nav-item.active .nav-badge {
    background: rgba(15, 23, 42, 0.1);
    color: var(--text-primary);
    border-color: var(--border-md);
}
.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 0.75rem 0.85rem;
}
.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.65rem 0.85rem;
    border-radius: var(--r);
    transition: background 0.2s;
    cursor: pointer;
}
.sidebar-user:hover {
    background: var(--surface);
}
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border-md);
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    flex-shrink: 0;
    letter-spacing: 0.02em;
}
.user-info {
    flex: 1;
    min-width: 0;
}
.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Header ── */
.header {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.75rem;
    gap: 1.25rem;
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-left {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}
.header-page {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}
.header-sep {
    color: var(--text-muted);
    font-size: 0.85rem;
}
.header-sub {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.header-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 0.45rem 0.9rem;
    width: 240px;
    transition:
        border-color 0.2s,
        width 0.3s var(--ease);
}
.header-search:focus-within {
    border-color: var(--border-md);
    width: 280px;
}
.header-search svg {
    color: var(--text-muted);
    flex-shrink: 0;
}
.header-search input {
    background: none;
    border: none;
    outline: none;
    font-family: var(--font);
    font-size: 0.85rem;
    color: var(--text-primary);
    width: 100%;
}
.header-search input::placeholder {
    color: var(--text-muted);
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--r);
    background: var(--surface);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    color: var(--text-secondary);
    transition:
        border-color 0.2s,
        color 0.2s;
    position: relative;
}
.icon-btn:hover {
    border-color: var(--border-md);
    color: var(--text-primary);
}
.notif-pip {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--blue);
    border: 1.5px solid var(--panel);
}
.header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border-md);
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
}

/* ── Main ── */
.main {
    padding: 2rem;
    overflow-y: auto;
    background: var(--bg);
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* ── Section headers ── */
.sec-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.sec-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}
.sec-action {
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: color 0.2s;
    font-weight: 500;
    cursor: pointer;
}
.sec-action:hover {
    color: var(--text-primary);
}

/* ── Bento grid ── */
.bento {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.25rem;
}
.c-3 {
    grid-column: span 3;
}
.c-4 {
    grid-column: span 4;
}
.c-5 {
    grid-column: span 5;
}
.c-6 {
    grid-column: span 6;
}
.c-7 {
    grid-column: span 7;
}
.c-8 {
    grid-column: span 8;
}
.c-9 {
    grid-column: span 9;
}
.c-12 {
    grid-column: span 12;
}

/* Card */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: border-color 0.25s;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.card:hover {
    border-color: var(--border-md);
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08);
}

/* ── Welcome card ── */
.welcome-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--green-dim);
    border: 1px solid var(--green-border);
    border-radius: 9999px;
    padding: 3px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--green);
    margin-bottom: 0.75rem;
}
.welcome-pip {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: pip-pulse 2s ease-in-out infinite;
}
@keyframes pip-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.35;
    }
}
.welcome-title {
    font-size: clamp(1.85rem, 2.8vw, 2.5rem);
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1.1;
    color: var(--text-primary);
}
.welcome-sub {
    margin-top: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.55;
    max-width: 420px;
}
.welcome-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.7rem 1.25rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--r);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    transition:
        transform 0.2s var(--spring),
        box-shadow 0.25s,
        background 0.15s;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -4px rgba(15, 23, 42, 0.25);
    background: #1e2937;
}
.btn-primary.sm {
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
}
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.7rem 1.25rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-md);
    border-radius: var(--r);
    font-size: 0.9rem;
    font-weight: 500;
    transition:
        border-color 0.2s,
        color 0.2s,
        background 0.2s;
}
.btn-ghost:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--surface);
}
.btn-ghost.sm {
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
}

/* Current course in welcome */
.current-course {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
}
.cc-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--r);
    flex-shrink: 0;
    display: grid;
    place-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
}
.cc-info {
    flex: 1;
    min-width: 0;
}
.cc-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
    font-weight: 500;
}
.cc-id {
    font-size: 0.72rem;
    font-family: var(--mono);
    color: var(--blue);
    margin-bottom: 2px;
    font-weight: 500;
}
.cc-title {
    font-size: 1.05rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
    line-height: 1.3;
}
.cc-bar {
    height: 9px;
    background: var(--surface-3);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}
.cc-bar-fill {
    height: 100%;
    border-radius: 9999px;
    background: linear-gradient(90deg, #10b981, #3b82f6);
    box-shadow: 0 0 12px -2px rgba(16, 185, 129, 0.5);
    transition: width 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cc-pct {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 500;
}

/* ── Streak card ── */
.streak-number {
    font-family: var(--mono);
    font-size: 3.2rem;
    font-weight: 600;
    letter-spacing: -0.05em;
    color: var(--text-primary);
    line-height: 1;
}
.streak-label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 4px;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.streak-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-top: auto;
}
.streak-day-labels {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 6px;
}
.sdl {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: center;
    text-transform: uppercase;
    font-weight: 500;
}
.sd {
    aspect-ratio: 1;
    border-radius: 6px;
    background: var(--surface-2);
}
.sd.done {
    background: #10b981;
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 0.65rem;
}
.sd.today {
    background: var(--accent);
    color: #fff;
}
.streak-footer {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.streak-footer span {
    color: var(--text-primary);
    font-weight: 600;
}

/* ── Stat cards ── */
.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--r);
    display: grid;
    place-items: center;
    margin-bottom: 1rem;
}
.stat-icon--white {
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(15, 23, 42, 0.1);
    color: var(--accent);
}
.stat-icon--blue {
    background: var(--blue-dim);
    border: 1px solid var(--blue-border);
    color: var(--blue);
}
.stat-icon--green {
    background: var(--green-dim);
    border: 1px solid var(--green-border);
    color: var(--green);
}
.stat-icon--purple {
    background: var(--purple-dim);
    border: 1px solid var(--purple-border);
    color: var(--purple);
}
.stat-val {
    font-family: var(--mono);
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    line-height: 1;
}
.stat-name {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}
.stat-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.75rem;
    padding: 3px 8px;
    border-radius: 6px;
}
.up {
    background: var(--green-dim);
    color: var(--green);
}
.neutral {
    background: var(--surface-2);
    color: var(--text-secondary);
}

/* ── Progress bars ── */
.cc-bar,
.prog-item-bar,
.act-track,
.prog-bar {
    height: 9px;
    background: var(--surface-3);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}
.cc-bar-fill,
.prog-item-fill,
.act-fill,
.prog-fill {
    height: 100%;
    border-radius: 9999px;
    background: linear-gradient(90deg, var(--green), #3b82f6);
    box-shadow: 0 1px 4px -1px rgba(16, 185, 129, 0.4);
    transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.prog-item-fill {
    background: linear-gradient(90deg, #8b5cf6, #3b82f6);
}
.act-fill {
    background: linear-gradient(90deg, #10b981, #3b82f6);
}
.act-fill.today-bar {
    background: linear-gradient(90deg, #0f172a, #1e2937);
}

/* ── My Courses section ── */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}
.course-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition:
        border-color 0.25s,
        transform 0.25s var(--ease);
    cursor: pointer;
}
.course-card:hover {
    border-color: var(--border-md);
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -10px rgba(15, 23, 42, 0.12);
}
.course-card-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    display: block;
    position: relative;
    overflow: hidden;
    background: var(--accent);
}
.course-card-thumb svg {
    width: 100%;
    height: 100%;
    display: block;
}
.course-card-body {
    padding: 1.25rem;
}
.course-tag {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.course-id-label {
    font-size: 0.72rem;
    font-family: var(--mono);
    color: var(--blue);
    margin-bottom: 2px;
    font-weight: 500;
}
.course-title {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}
.course-author {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.course-progress-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.prog-bar {
    flex: 1;
}
.prog-pct {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 500;
}
.course-card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.course-modules {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}
.btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.45rem 1rem;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    transition:
        background 0.2s,
        border-color 0.2s;
}
.btn-sm:hover {
    background: var(--surface-2);
    border-color: var(--border-md);
}

/* ── Progress list ── */
.prog-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.prog-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    cursor: pointer;
    transition:
        border-color 0.2s,
        transform 0.2s;
}
.prog-item:hover {
    border-color: var(--border-md);
    transform: translateX(4px);
}
.prog-item-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--r);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: var(--panel);
    border: 1px solid var(--border);
}
.prog-item-info {
    flex: 1;
    min-width: 0;
}
.prog-item-id {
    font-size: 0.7rem;
    font-family: var(--mono);
    color: var(--blue);
    margin-bottom: 2px;
}
.prog-item-title {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
}
.prog-item-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.prog-item-pct {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}
.prog-item-bar {
    flex: 1;
}
.prog-item-resume {
    font-size: 0.85rem;
    color: var(--blue);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    font-weight: 500;
}
.prog-item:hover .prog-item-resume {
    opacity: 1;
}

/* ── Weekly activity ── */
.activity-bars {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}
.act-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}
.act-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    width: 32px;
    flex-shrink: 0;
    font-family: var(--mono);
}
.act-track {
    flex: 1;
    height: 9px;
}
.act-fill {
    height: 100%;
    border-radius: 9999px;
}
.act-mins {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    width: 36px;
    text-align: right;
}
.weekly-sum {
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.wsum-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.wsum-val {
    font-family: var(--mono);
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* ── Available courses / Explore ── */
.explore-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.explore-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    cursor: pointer;
    transition:
        border-color 0.2s,
        transform 0.2s;
}
.explore-item:hover {
    border-color: var(--border-md);
    transform: translateX(4px);
}
.explore-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--r);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: var(--panel);
    border: 1px solid var(--border);
}
.explore-info {
    flex: 1;
    min-width: 0;
}
.explore-cat {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.explore-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.3;
}
.explore-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.star {
    color: var(--amber);
}
.explore-price {
    font-family: var(--mono);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}
.explore-buy {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.6rem 1.1rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--r);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    transition:
        background 0.2s,
        transform 0.2s;
    flex-shrink: 0;
}
.explore-buy:hover {
    background: #1e2937;
    transform: translateY(-1px);
}

/* ── Category filter dropdown ── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.filter-chip {
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition:
        background 0.2s,
        color 0.2s,
        border-color 0.2s;
    white-space: nowrap;
}
.filter-chip:hover,
.filter-chip.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.filter-dropdown-wrap {
    position: relative;
    display: inline-block;
}
.filter-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition:
        background 0.2s,
        color 0.2s,
        border-color 0.2s;
    white-space: nowrap;
}
.filter-dropdown-btn:hover,
.filter-dropdown-btn.open {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.filter-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 200;
    background: var(--panel);
    border: 1px solid var(--border-md);
    border-radius: var(--r);
    box-shadow: 0 8px 24px -6px rgba(15, 23, 42, 0.15);
    padding: 0.4rem;
    min-width: 240px;
    display: none;
}
.filter-dropdown-menu.open {
    display: block;
}
.filter-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition:
        background 0.15s,
        color 0.15s;
}
.filter-dropdown-item:hover {
    background: var(--surface);
    color: var(--text-primary);
}
.filter-dropdown-item.selected {
    color: var(--text-primary);
    font-weight: 600;
}
.filter-dropdown-item .check {
    width: 14px;
    height: 14px;
    margin-left: auto;
    opacity: 0;
    flex-shrink: 0;
}
.filter-dropdown-item.selected .check {
    opacity: 1;
}

/* ── Learning path ── */
.path-list {
    display: flex;
    flex-direction: column;
}
.path-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    position: relative;
}
.path-item:last-child {
    border-bottom: none;
}
.path-num {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    width: 24px;
    flex-shrink: 0;
    text-align: right;
}
.path-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
}
.path-dot--done {
    background: var(--green-dim);
    border: 2px solid var(--green-border);
    color: var(--green);
}
.path-dot--active {
    background: #fff;
    border: 2px solid var(--accent);
    color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.1);
}
.path-dot--locked {
    background: var(--surface-2);
    border: 2px solid var(--border);
    color: var(--text-muted);
}
.path-info {
    flex: 1;
    min-width: 0;
}
.path-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2px;
}
.path-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.path-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}
.pb-done {
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid var(--green-border);
}
.pb-active {
    background: #fff;
    color: var(--accent);
    border: 1px solid var(--accent);
}
.pb-locked {
    background: var(--surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* ── Assignments ── */
.assignment-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.assignment-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
}
.asgn-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.asgn-dot--due {
    background: var(--amber);
}
.asgn-dot--done {
    background: var(--green);
}
.asgn-dot--new {
    background: var(--blue);
}
.asgn-info {
    flex: 1;
    min-width: 0;
}
.asgn-id {
    font-size: 0.7rem;
    font-family: var(--mono);
    color: var(--blue);
    margin-bottom: 2px;
}
.asgn-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.asgn-course {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.asgn-due {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.asgn-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
}
.ab-due {
    background: var(--amber-dim);
    color: var(--amber);
    border: 1px solid var(--amber-border);
}
.ab-done {
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid var(--green-border);
}
.ab-new {
    background: var(--blue-dim);
    color: var(--blue);
    border: 1px solid var(--blue-border);
}

/* ── Certificates ── */
.cert-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.cert-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
}
.cert-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--r);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: var(--panel);
    border: 1px solid var(--border);
}
.cert-info {
    flex: 1;
    min-width: 0;
}
.cert-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.cert-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.cert-action {
    font-size: 0.85rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: 8px;
    transition:
        color 0.2s,
        border-color 0.2s;
}
.cert-action:hover {
    color: var(--text-primary);
    border-color: var(--border-md);
}

/* ── Community/Forum ── */
.community-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.community-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    cursor: pointer;
    transition: border-color 0.2s;
}
.community-item:hover {
    border-color: var(--border-md);
}
.comm-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}
.comm-body {
    flex: 1;
    min-width: 0;
}
.comm-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
}
.comm-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.comm-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    row-gap: 4px;
}
.comm-tag {
    background: var(--surface-2);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
}
.comm-flag {
    background: var(--amber-dim);
    color: var(--amber);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.7rem;
    border: 1px solid var(--amber-border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

/* Forum compose */
.forum-compose-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.2s;
}
.forum-compose-box:focus-within {
    border-color: var(--border-md);
    background: var(--panel);
}
.forum-compose-box input.compose-title-input {
    background: none;
    border: none;
    outline: none;
    width: 100%;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.forum-compose-box input.compose-title-input::placeholder {
    color: var(--text-muted);
    font-weight: 500;
}
.forum-compose-box textarea {
    background: none;
    border: none;
    outline: none;
    width: 100%;
    font-family: var(--font);
    font-size: 0.9rem;
    color: var(--text-primary);
    resize: none;
    min-height: 72px;
    line-height: 1.5;
}
.forum-compose-box textarea::placeholder {
    color: var(--text-muted);
}
.forum-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}
.tag-select {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.38rem 0.7rem;
    font-family: var(--font);
    font-size: 0.8rem;
    color: var(--text-secondary);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}
.tag-select:focus {
    border-color: var(--border-md);
}
.attention-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.38rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition:
        background 0.2s,
        border-color 0.2s,
        color 0.2s;
    user-select: none;
}
.attention-toggle.active {
    background: var(--amber-dim);
    border-color: var(--amber-border);
    color: var(--amber);
}
.attention-toggle input {
    display: none;
}

/* ── Leaderboard ── */
.lb-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.lb-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--r);
    transition: background 0.2s;
    cursor: pointer;
}
.lb-item:hover {
    background: var(--surface);
}
.lb-item.me {
    background: var(--green-dim);
    border: 1px solid var(--green-border);
}
.lb-rank {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}
.lb-rank.top {
    color: var(--amber);
    font-weight: 600;
}
.lb-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}
.lb-name {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
}
.lb-name.me-name {
    color: var(--accent);
}
.lb-score {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Student points profile modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.modal-overlay.open {
    display: flex;
}
.modal-box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    width: 100%;
    max-width: 580px;
    max-height: 88vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    animation: modal-in 0.25s var(--ease) both;
}
@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.2s;
}
.modal-close:hover {
    background: var(--surface-2);
    border-color: var(--border-md);
}
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}
.modal-profile-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}
.modal-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
}
.modal-student-name {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.modal-student-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
}
.modal-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.modal-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 1rem;
    text-align: center;
}
.modal-stat-val {
    font-family: var(--mono);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.modal-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.points-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.points-row {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
}
.pts-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: var(--green-dim);
    border: 1px solid var(--green-border);
}
.pts-body {
    flex: 1;
    min-width: 0;
}
.pts-reason {
    font-size: 0.88rem;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 2px;
}
.pts-source {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.pts-right {
    text-align: right;
    flex-shrink: 0;
}
.pts-amount {
    font-family: var(--mono);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--green);
}
.pts-date {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--surface);
}
::-webkit-scrollbar-thumb {
    background: var(--border-md);
    border-radius: 6px;
}
@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.main {
    animation: fade-up 0.5s var(--ease) both;
}
.card {
    animation: fade-up 0.5s var(--ease) both;
}

/* ── Hamburger button (mobile only) ── */
.hamburger {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: var(--r);
    background: var(--surface);
    border: 1px solid var(--border);
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition:
        background 0.2s,
        border-color 0.2s;
}
.hamburger:hover {
    background: var(--surface-2);
    border-color: var(--border-md);
}

/* ── Sidebar mobile overlay ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 300;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.active {
    display: block;
}

/* ── Btn danger ── */
.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.7rem 1.25rem;
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid var(--red-border);
    border-radius: var(--r);
    font-size: 0.9rem;
    font-weight: 600;
    transition:
        background 0.2s,
        border-color 0.2s,
        transform 0.15s;
    cursor: pointer;
    font-family: var(--font);
}
.btn-danger:hover {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
    transform: translateY(-1px);
}
.btn-danger.sm {
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
}

/* ── Filter bar (used in assignments & available) ── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.45rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition:
        background 0.2s,
        border-color 0.2s,
        color 0.2s;
    font-family: var(--font);
}
.filter-btn:hover,
.filter-btn.active {
    background: var(--surface-2);
    border-color: var(--border-md);
    color: var(--text-primary);
}

/* ══════════════════════════════════════════════════════════════
   PROFILE TAB
══════════════════════════════════════════════════════════════ */
.profile-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1.25rem;
    align-items: start;
}
.profile-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.profile-card--full {
    grid-column: 1 / -1;
}
.profile-card-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.015em;
    margin-bottom: 1.25rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Avatar section */
.profile-avatar-wrap {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.profile-avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 2px solid var(--border-md);
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    flex-shrink: 0;
    letter-spacing: 0.02em;
    position: relative;
    overflow: hidden;
}
.profile-avatar-lg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.profile-avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.profile-avatar-hint {
    font-size: 0.73rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.avatar-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.52rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border-md);
    border-radius: var(--r);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition:
        background 0.2s,
        border-color 0.2s,
        color 0.2s;
    font-family: var(--font);
    width: fit-content;
}
.avatar-upload-btn:hover {
    background: var(--surface-2);
    border-color: var(--border-hover);
    color: var(--text-primary);
}
.avatar-upload-btn input[type="file"] {
    display: none;
}

/* Form fields */
.profile-field {
    margin-bottom: 1rem;
}
.profile-field:last-of-type {
    margin-bottom: 0;
}
.profile-field label {
    display: block;
    font-size: 0.73rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 0.42rem;
    transition: color 0.2s;
    text-transform: uppercase;
}
.profile-field:focus-within label {
    color: var(--text-primary);
}
.profile-field input,
.profile-field select {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 0.78rem 1rem;
    font-family: var(--font);
    font-size: 0.88rem;
    color: var(--text-primary);
    outline: none;
    appearance: none;
    transition:
        border-color 0.2s,
        box-shadow 0.2s,
        background 0.2s;
}
.profile-field input::placeholder {
    color: var(--text-muted);
}
.profile-field input:focus,
.profile-field select:focus {
    border-color: var(--border-hover);
    background: var(--panel);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.05);
}
.profile-field input[readonly],
.profile-field input[disabled] {
    background: var(--surface);
    color: var(--text-muted);
    cursor: not-allowed;
    border-style: dashed;
}
.profile-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.profile-field-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

/* Password field with toggle */
.profile-pw-wrap {
    position: relative;
}
.profile-pw-wrap input {
    padding-right: 3rem;
}
.profile-pw-toggle {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
    display: flex;
    padding: 4px;
}
.profile-pw-toggle:hover {
    color: var(--text-secondary);
}

/* Save actions */
.profile-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}
.profile-save-hint {
    font-size: 0.73rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* Danger zone */
.danger-zone {
    background: var(--red-dim);
    border: 1px solid var(--red-border);
    border-radius: var(--r);
    padding: 1.25rem;
    margin-top: 1.5rem;
}
.danger-zone-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--red);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}
.danger-zone-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.55;
}
.danger-zone-btns {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
}

/* Logout row */
.logout-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    border-radius: var(--r);
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}
.logout-row:last-child {
    border-bottom: none;
}
.logout-row:hover {
    background: var(--surface);
}
.logout-row-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}
.logout-row-label svg {
    color: var(--text-muted);
    flex-shrink: 0;
}
.logout-row-label.danger {
    color: var(--red);
}
.logout-row-label.danger svg {
    color: var(--red);
}
.logout-row-arrow {
    color: var(--text-muted);
}

/* Password strength meter */
.pw-strength {
    display: flex;
    gap: 4px;
    margin-top: 0.5rem;
}
.pw-strength-bar {
    flex: 1;
    height: 3px;
    border-radius: 9999px;
    background: var(--surface-3);
    transition: background 0.3s;
}
.pw-strength-bar.weak {
    background: var(--red);
}
.pw-strength-bar.fair {
    background: var(--amber);
}
.pw-strength-bar.good {
    background: var(--green);
}
.pw-strength-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ══════════════════════════════════════════════════════════════
   TABLET  (768px – 1024px)
   ──────────────────────────────────────────────────────────────
   Sidebar stays visible but narrower. Bento recomposes to 2-col.
   Typography and spacing tighten gracefully.
══════════════════════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1024px) {
    :root {
        --sidebar-w: 200px;
        --header-h: 58px;
    }

    /* Sidebar: narrower, hide logo text */
    .sidebar-logo__name {
        font-size: 0.88rem;
    }
    .nav-item {
        font-size: 0.82rem;
        padding: 0.58rem 0.75rem;
    }
    .nav-section-label {
        font-size: 0.6rem;
        padding: 0.55rem 0.75rem 0.22rem;
    }

    /* Header */
    .header {
        padding: 0 1.25rem;
    }
    .header-search {
        width: 180px;
    }
    .header-search:focus-within {
        width: 220px;
    }

    /* Main */
    .main {
        padding: 1.4rem 1.25rem;
    }

    /* Bento: true 2-col recomposition */
    .bento {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    /* Welcome: full width */
    .c-8 {
        grid-column: 1 / -1;
    }
    /* Streak + 4 stats: balanced */
    .c-4 {
        grid-column: span 1;
    }
    .c-3 {
        grid-column: span 1;
    }
    /* Full-width cards */
    .c-12 {
        grid-column: 1 / -1;
    }
    /* Side-by-side halves */
    .c-6 {
        grid-column: span 1;
    }
    .c-5 {
        grid-column: span 1;
    }
    .c-7 {
        grid-column: span 1;
    }
    .c-9 {
        grid-column: 1 / -1;
    }

    /* Welcome card compact */
    .welcome-title {
        font-size: 1.65rem;
        letter-spacing: -0.04em;
    }
    .welcome-sub {
        font-size: 0.88rem;
        max-width: 100%;
    }
    .welcome-actions {
        gap: 0.55rem;
        margin-top: 1rem;
    }
    .welcome-actions .btn-primary,
    .welcome-actions .btn-ghost {
        padding: 0.58rem 1rem;
        font-size: 0.84rem;
    }

    /* Stat cards */
    .stat-val {
        font-size: 1.65rem;
    }
    .stat-icon {
        width: 34px;
        height: 34px;
        margin-bottom: 0.75rem;
    }

    /* Streak compact */
    .streak-number {
        font-size: 2.6rem;
    }

    /* Modals: centred */
    .modal-overlay {
        align-items: center;
        padding: 1.5rem;
    }
    .modal-box {
        max-width: 520px;
        width: 100%;
    }

    /* Profile tab: 2-col */
    .profile-grid {
        grid-template-columns: 1fr 1fr;
    }
    .profile-grid .profile-card--full {
        grid-column: 1 / -1;
    }

    /* Assignments: horizontal scroll filter bar */
    .filter-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    .filter-bar::-webkit-scrollbar {
        display: none;
    }
    .filter-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* ══════════════════════════════════════════════════════════════
   MOBILE  (< 768px)
   ──────────────────────────────────────────────────────────────
   Off-canvas drawer navigation. Full-width cards. Touch-first
   targets. Modals become bottom sheets.
══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
    /* ── Layout tokens ── */
    :root {
        --sidebar-w: 290px;
        --header-h: 56px;
    }

    /* ── Shell: single-column ── */
    .shell {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: var(--header-h) 1fr;
        min-height: 100dvh;
    }

    /* ══ SIDEBAR: Full off-canvas drawer ══ */
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--sidebar-w);
        height: 100dvh;
        z-index: 400;
        transform: translateX(-100%);
        box-shadow: none;
        display: flex;
        flex-direction: column;
        transition:
            transform 0.32s cubic-bezier(0.32, 0.72, 0, 1),
            box-shadow 0.32s;
        grid-row: unset;
        overflow-y: auto;
        overflow-x: hidden;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 56px rgba(15, 23, 42, 0.18);
    }

    /* Sidebar logo, nav fully restored in drawer */
    .sidebar-logo {
        padding: 0 1.25rem;
        justify-content: flex-start;
        gap: 10px;
    }
    .sidebar-logo__name {
        display: block;
    }
    .sidebar-nav {
        padding: 0.65rem;
        align-items: stretch;
        gap: 2px;
    }
    .nav-section-label {
        display: block;
        font-size: 0.6rem;
        padding: 0.6rem 0.85rem 0.2rem;
        margin-top: 0.1rem;
    }
    .nav-item {
        width: auto;
        height: auto;
        padding: 0.72rem 0.9rem;
        justify-content: flex-start;
        gap: 11px;
        border-radius: 10px;
        font-size: 0.88rem;
    }
    .nav-item::after {
        display: none !important;
    }
    .nav-badge {
        position: static;
        top: unset;
        right: unset;
        margin-left: auto;
        font-size: 0.67rem;
        padding: 1px 7px;
        min-width: auto;
        height: auto;
        border-radius: 6px;
    }
    .nav-icon {
        width: 18px;
        height: 18px;
        opacity: 0.7;
    }
    .nav-item.active .nav-icon {
        opacity: 1;
    }

    /* Sidebar footer user row */
    .sidebar-footer {
        padding: 0.9rem;
    }
    .sidebar-user {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        cursor: pointer;
    }
    .user-info {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-width: 0;
    }

    /* ══ HEADER: mobile command bar ══ */
    .hamburger {
        display: flex;
        flex-shrink: 0;
    }
    .header {
        padding: 0 1rem;
        gap: 0.75rem;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    .header-left {
        flex: 1;
        flex-direction: column;
        justify-content: center;
        gap: 0;
        line-height: 1;
        min-width: 0;
    }
    .header-page {
        font-size: 0.58rem;
        font-weight: 600;
        color: var(--text-muted);
        letter-spacing: 0.09em;
        text-transform: uppercase;
        line-height: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .header-sep {
        display: none;
    }
    .header-sub {
        display: block;
        font-size: 0.94rem;
        font-weight: 700;
        color: var(--text-primary);
        letter-spacing: -0.025em;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .header-search {
        display: none;
    }
    .header-actions {
        gap: 6px;
        flex-shrink: 0;
    }

    /* ── Main ── */
    .main {
        padding: 1rem;
        padding-bottom: 2.5rem;
    }
    .tab-content.active {
        animation: fade-up 0.3s var(--ease) both;
    }

    /* ══ BENTO: Purposeful 2-col dashboard ══ */
    #tab-dashboard .bento {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    #tab-dashboard .c-8 {
        grid-column: 1 / -1;
    }
    #tab-dashboard .c-4 {
        grid-column: 1 / -1;
    }
    #tab-dashboard .c-3 {
        grid-column: span 1;
    }
    #tab-dashboard .c-6 {
        grid-column: 1 / -1;
    }

    /* Other tabs: single column stack */
    .bento {
        display: flex;
        flex-direction: column;
        gap: 0.85rem;
    }
    .c-3,
    .c-4,
    .c-5,
    .c-6,
    .c-7,
    .c-8,
    .c-9,
    .c-12 {
        width: 100%;
    }

    /* Card radius */
    .card {
        border-radius: 14px;
        padding: 1.25rem;
    }

    /* ── Welcome card ── */
    .welcome-eyebrow {
        font-size: 0.62rem;
        padding: 3px 9px;
        margin-bottom: 0.6rem;
    }
    .welcome-title {
        font-size: 1.55rem;
        letter-spacing: -0.04em;
        line-height: 1.15;
    }
    .welcome-sub {
        font-size: 0.85rem;
        margin-top: 0.4rem;
        max-width: 100%;
        line-height: 1.5;
    }
    .welcome-actions {
        display: flex;
        gap: 0.5rem;
        margin-top: 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
        flex-wrap: nowrap;
    }
    .welcome-actions::-webkit-scrollbar {
        display: none;
    }
    .welcome-actions .btn-primary,
    .welcome-actions .btn-ghost {
        flex-shrink: 0;
        padding: 0.55rem 1.1rem;
        font-size: 0.82rem;
        border-radius: 99px;
        white-space: nowrap;
    }

    /* Current course: compact */
    .current-course {
        gap: 0.85rem;
        margin-top: 1.25rem;
        padding-top: 1.25rem;
    }
    .cc-icon {
        width: 44px;
        height: 44px;
    }
    .cc-title {
        font-size: 0.92rem;
        white-space: normal;
        line-height: 1.35;
    }

    /* Stats: compact */
    .stat-val {
        font-size: 1.55rem;
    }
    .stat-icon {
        width: 32px;
        height: 32px;
        margin-bottom: 0.65rem;
    }
    .stat-name {
        font-size: 0.7rem;
    }
    .stat-delta {
        font-size: 0.68rem;
        margin-top: 0.45rem;
        padding: 2px 7px;
    }

    /* Streak: compact */
    .streak-number {
        font-size: 2.6rem;
    }
    .streak-label {
        font-size: 0.88rem;
        margin-bottom: 1rem;
    }

    /* Upcoming assignments: wrapping layout */
    .assignment-item {
        display: grid;
        grid-template-columns: 10px 1fr auto;
        grid-template-rows: auto auto;
        gap: 0 10px;
        padding: 1rem;
        border-radius: 12px;
        align-items: start;
    }
    .asgn-dot {
        margin-top: 4px;
    }
    .asgn-info {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
    }
    .asgn-due {
        grid-column: 3;
        grid-row: 1;
        font-size: 0.72rem;
        white-space: nowrap;
    }
    .asgn-badge {
        grid-column: 2;
        grid-row: 2;
        margin-top: 0.4rem;
        width: fit-content;
    }
    .asgn-id {
        font-size: 0.72rem;
    }
    .asgn-title {
        font-size: 0.88rem;
        font-weight: 600;
        margin-top: 1px;
        line-height: 1.4;
    }
    .asgn-course {
        font-size: 0.73rem;
        margin-top: 2px;
    }

    /* Progress items */
    .prog-item {
        display: grid;
        grid-template-columns: 40px 1fr auto;
        gap: 0.75rem;
        align-items: center;
    }
    .prog-item-icon {
        width: 40px;
        height: 40px;
    }
    .prog-item-title {
        font-size: 0.88rem;
        line-height: 1.35;
    }

    /* Courses grid: single column */
    .courses-grid {
        grid-template-columns: 1fr;
    }

    /* Explore/available: single column */
    #available-list .explore-item {
        flex-direction: column;
        align-items: stretch;
    }

    /* Filter bar: horizontal scroll */
    .filter-bar {
        display: flex;
        flex-wrap: nowrap;
        gap: 0.5rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
        margin-bottom: 0.9rem;
    }
    .filter-bar::-webkit-scrollbar {
        display: none;
    }
    .filter-dropdown-wrap {
        flex-shrink: 0;
    }
    .filter-btn {
        flex-shrink: 0;
        padding: 0.48rem 0.9rem;
        font-size: 0.8rem;
        border-radius: 99px;
        white-space: nowrap;
    }
    .filter-dropdown-menu {
        left: unset;
        right: 0;
        min-width: 140px;
    }

    /* ── Path list ── */
    .path-item {
        display: grid;
        grid-template-columns: 26px 22px 1fr auto;
        gap: 0 8px;
        padding: 0.7rem 0;
        align-items: center;
    }
    .path-num {
        font-size: 0.62rem;
    }
    .path-title {
        font-size: 0.85rem;
    }
    .path-sub {
        font-size: 0.72rem;
    }

    /* ── Leaderboard ── */
    .lb-item {
        padding: 0.7rem 0.85rem;
        gap: 0.75rem;
    }
    .lb-name {
        font-size: 0.88rem;
    }
    .lb-score {
        font-size: 0.8rem;
    }

    /* ── Forum compose ── */
    .forum-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .tag-select {
        width: 100%;
    }
    .attention-toggle {
        flex: 1;
        justify-content: center;
    }

    /* ── Certificate cards ── */
    .cert-card {
        display: grid;
        grid-template-columns: 52px 1fr auto;
        gap: 0.75rem;
        align-items: center;
        padding: 1rem;
        border-radius: 12px;
    }

    /* ══ MODALS: Bottom sheet ══ */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
    .modal-overlay.open {
        display: flex;
    }
    .modal-box {
        width: 100%;
        max-width: 100%;
        border-radius: 22px 22px 0 0;
        padding: 0 1.35rem 1.5rem;
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 1.5rem));
        max-height: 94dvh;
        overflow-y: auto;
        animation: sheet-up 0.3s cubic-bezier(0.32, 0.72, 0, 1) both;
        animation-name: sheet-up;
        box-shadow: none;
    }
    @keyframes sheet-up {
        from {
            transform: translateY(100%);
            opacity: 0.9;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    /* Drag handle pill */
    .modal-box::before {
        content: "";
        display: block;
        width: 36px;
        height: 4px;
        background: var(--surface-3);
        border-radius: 2px;
        margin: 1rem auto 1.25rem;
        flex-shrink: 0;
    }
    .modal-stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.6rem;
    }
    .modal-stat {
        padding: 0.85rem 0.75rem;
    }
    .modal-stat-val {
        font-size: 1rem;
    }
    .modal-profile-row {
        gap: 1rem;
    }

    /* Profile tab: single column */
    .profile-grid {
        grid-template-columns: 1fr;
    }
    .profile-card--full {
        grid-column: 1;
    }
    .profile-avatar-wrap {
        gap: 1.25rem;
    }
    .profile-avatar-lg {
        width: 72px;
        height: 72px;
        font-size: 1.35rem;
    }
    .profile-field {
        margin-bottom: 0.9rem;
    }
    .profile-field label {
        font-size: 0.72rem;
        margin-bottom: 0.38rem;
    }
    .profile-field input,
    .profile-field select {
        padding: 0.82rem 1rem;
        font-size: 0.92rem;
        border-radius: 11px;
    }
    .profile-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    .profile-actions .btn-primary,
    .profile-actions .btn-ghost {
        width: 100%;
        justify-content: center;
        padding: 0.82rem 1rem;
        font-size: 0.88rem;
        border-radius: 12px;
    }
    .danger-zone {
        padding: 1.1rem;
        border-radius: 12px;
    }
    .danger-zone-btns {
        flex-direction: column;
        gap: 0.5rem;
    }
    .danger-zone-btns .btn-danger,
    .danger-zone-btns .btn-ghost {
        width: 100%;
        justify-content: center;
    }

    /* ── Sec header on mobile ── */
    .sec-title {
        font-size: 0.96rem;
    }
    .sec-action {
        font-size: 0.8rem;
    }
}

/* ══════════════════════════════════════════════════════════════
   SMALL MOBILE  (< 480px)
   ──────────────────────────────────────────────────────────────
   Tighter still: stats single-column.
══════════════════════════════════════════════════════════════ */
@media (max-width: 479px) {
    :root {
        --header-h: 52px;
    }
    .main {
        padding: 0.875rem;
        padding-bottom: 2.5rem;
    }

    .welcome-title {
        font-size: 1.35rem;
    }
    .welcome-sub {
        font-size: 0.82rem;
    }

    /* Dashboard: single-column stat cards */
    #tab-dashboard .bento {
        grid-template-columns: 1fr;
    }
    #tab-dashboard .c-3,
    #tab-dashboard .c-4,
    #tab-dashboard .c-8,
    #tab-dashboard .c-6 {
        grid-column: 1 / -1;
    }

    .stat-val {
        font-size: 1.45rem;
    }
    .stat-icon {
        width: 30px;
        height: 30px;
        margin-bottom: 0.55rem;
    }

    .modal-box {
        max-height: 97dvh;
    }
    .modal-stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    .modal-stat {
        padding: 0.65rem 0.5rem;
    }
    .modal-stat-val {
        font-size: 0.88rem;
    }
    .modal-stat-label {
        font-size: 0.62rem;
    }
}
