/* =====================================================================
   app.css — Vidhyagram premium theme.
   Blue-to-violet brand (from the logo) on cool white, dark navy sidebar, gradient hero
   banners, glass stat tiles, rounded cards with layered shadows.
   One class per UI role: pages compose these, they don't restyle them.
   ===================================================================== */

/* -------------------- TOKENS -------------------- */
:root {
    /* Brand: Vidhyagram blue → violet (from the logo) */
    --primary-50:  #F4F2FF;
    --primary-100: #E9E5FF;
    --primary-200: #D2C9FF;
    --primary-300: #AE9CFF;
    --primary-400: #8E7BFA;
    --primary-500: #6A5AF0;
    --primary-600: #5544DB;
    --primary-700: #4335B0;

    /* Ink & neutrals */
    --ink:      #0A0E27;   /* sidebar, hero depth */
    --ink-2:    #141A3D;
    --gunmetal: #1E2235;   /* primary text */
    --grey:     #6B7088;   /* muted text */
    --linen:    #EEF0F8;   /* subtle fills */
    --cream:    #F8F9FD;   /* lightest surface */
    --canvas:   #F3F4FA;   /* app ground */
    --white:    #FFFFFF;
    --border:   #E2E5F0;

    /* Semantic */
    --emerald-50: #ECFDF5; --emerald-200: #A7F3D0; --emerald-600: #059669; --emerald-700: #047857;
    --red-50:     #FEF2F2; --red-200:     #FECACA; --red-600:     #DC2626; --red-700:     #B91C1C;
    --amber-50:   #FFFBEB; --amber-200:   #FDE68A; --amber-500:   #F59E0B; --amber-700:   #B45309;
    --blue-50:    #EFF6FF; --blue-200:    #BFDBFE; --blue-700:    #1D4ED8;

    /* Gradients */
    --grad-brand: linear-gradient(135deg, #2F6BFF 0%, #6A5AF0 50%, #9B5CF6 100%);
    --grad-hero:  radial-gradient(1200px 400px at 0% 0%, rgba(139,92,246,.55), transparent 60%),
                  radial-gradient(900px 500px at 100% 0%, rgba(124,58,237,.35), transparent 60%),
                  linear-gradient(135deg, #0B1A4A 0%, #1F1458 55%, #1B1530 100%);
    --grad-gold:  linear-gradient(135deg, #F6D79B, #D9A441 50%, #F3CF8B);

    /* Shape & depth */
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --shadow-sm: 0 1px 2px rgba(20,24,52,.04), 0 2px 8px rgba(20,24,52,.05);
    --shadow-lg: 0 10px 30px -8px rgba(20,24,52,.18), 0 4px 10px -4px rgba(20,24,52,.08);
    --shadow-xl: 0 24px 60px -12px rgba(20,24,52,.28);
    --shadow-brand: 0 8px 20px -6px rgba(106,90,240,.55);

    --sidebar-w: 248px;
    --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --ease: cubic-bezier(.2,.8,.2,1);
}

/* -------------------- BASE -------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }   /* components set display:flex; hidden must still win */

body {
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.55;
    color: var(--gunmetal);
    background:
        radial-gradient(900px 500px at 100% -10%, rgba(139,92,246,.10), transparent 60%),
        radial-gradient(700px 400px at -10% 110%, rgba(124,58,237,.06), transparent 60%),
        var(--canvas);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0; color: var(--gunmetal); letter-spacing: -0.015em; }
p { margin: 0; }
a { color: var(--primary-600); text-decoration: none; transition: color 150ms; }
a:hover { color: var(--primary-700); }
img { max-width: 100%; }
::selection { background: var(--primary-200); }

.icon { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 2; }
.icon-5 { width: 20px; height: 20px; }
.icon-6 { width: 24px; height: 24px; }
.icon-8 { width: 32px; height: 32px; }

.text-muted { color: var(--grey); }
.text-xs { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Entrance: content rises in once per page load */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.main-inner > *, .main-inner > .stack > * { animation: rise 420ms var(--ease) both; }
.main-inner > .stack > *:nth-child(2) { animation-delay: 60ms; }
.main-inner > .stack > *:nth-child(3) { animation-delay: 120ms; }
.main-inner > .stack > *:nth-child(4) { animation-delay: 180ms; }
.main-inner > .stack > *:nth-child(5) { animation-delay: 240ms; }

/* -------------------- APP SHELL -------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    background:
        radial-gradient(300px 220px at 0% 0%, rgba(139,92,246,.22), transparent 70%),
        radial-gradient(260px 260px at 100% 100%, rgba(124,58,237,.18), transparent 70%),
        var(--ink);
    color: #E9E1DA;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 24px;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--white);
}
.sidebar-brand .logo {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    /* dark tile with a violet glow, like the logo artwork */
    background: radial-gradient(circle at 70% 30%, rgba(155,92,246,.45), transparent 65%), #0A0E27;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 18px -6px rgba(124,92,246,.7), inset 0 0 0 1px rgba(255,255,255,.08);
}
.sidebar-brand .logo svg { width: 76%; height: 76%; }
.sidebar-brand small {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: rgba(214,220,255,.6);
}

.nav-section {
    padding: 14px 10px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(233,225,218,.40);
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 3px;
    border-radius: 12px;
    color: rgba(233,225,218,.78);
    font-weight: 600;
    transition: background-color 200ms var(--ease), color 200ms, transform 200ms var(--ease);
}
.nav-item .icon { color: rgba(214,220,255,.6); transition: color 200ms; }
.nav-item:hover { background: rgba(255,255,255,.06); color: var(--white); }
.nav-item:hover .icon { color: var(--primary-300); }
.nav-item.is-active {
    background: linear-gradient(135deg, rgba(139,92,246,.95), rgba(85,68,219,.95));
    color: var(--white);
    box-shadow: var(--shadow-brand);
}
.nav-item.is-active .icon { color: var(--white); }

.nav-count {
    margin-left: auto;
    min-width: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--grad-brand);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    box-shadow: 0 0 0 3px rgba(23,17,14,.6);
}
.nav-item.is-active .nav-count { background: var(--white); color: var(--primary-600); box-shadow: none; }

.sidebar-footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 4px;
    min-width: 0;
    border-radius: 12px;
    background: rgba(255,255,255,.05);
}
.avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--grad-brand);
    color: var(--white);
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.user-chip .who { min-width: 0; }
.user-chip .who strong,
.user-chip .who span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who strong { font-size: 13px; font-weight: 700; color: var(--white); }
.user-chip .who span { font-size: 12px; color: rgba(214,220,255,.6); }

.main { flex: 1; min-width: 0; padding: 32px 40px 56px; }
.main-inner { max-width: 1160px; margin: 0 auto; }
.main-inner.narrow { max-width: 820px; }

/* Mobile top bar (sidebar collapses) */
.topbar { display: none; }

@media (max-width: 860px) {
    .app { flex-direction: column; }
    .sidebar { display: none; }
    .topbar {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 10px 16px;
        background: var(--ink);
        overflow-x: auto;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    .topbar .sidebar-brand { padding: 0 8px 0 0; font-size: 15px; }
    .topbar .sidebar-brand .logo { width: 30px; height: 30px; border-radius: 10px; }
    .topbar .sidebar-brand small { display: none; }
    .topbar .nav-item { margin: 0; white-space: nowrap; padding: 8px 10px; }
    .topbar .nav-item span:not(.nav-count) { display: none; }
    .topbar .nav-count { margin-left: 0; }
    .main { padding: 22px 16px 44px; }
}

/* -------------------- PAGE HEADER -------------------- */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}
.page-header h1 { font-size: 30px; font-weight: 800; line-height: 1.15; letter-spacing: -0.025em; }
.page-header p { margin-top: 6px; color: var(--grey); font-weight: 500; font-size: 15px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.crumb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    padding: 5px 10px 5px 8px;
    border-radius: 999px;
    background: var(--white);
    border: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    color: var(--grey);
    cursor: pointer;
    font-family: inherit;
    transition: color 150ms, border-color 150ms;
}
.crumb:hover { color: var(--primary-600); border-color: var(--primary-200); }

.stack > * + * { margin-top: 24px; }
.stack-sm > * + * { margin-top: 16px; }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title h2 { font-size: 18px; font-weight: 800; }

/* -------------------- HERO BANNER -------------------- */
.hero {
    position: relative;
    overflow: hidden;
    padding: 32px;
    border-radius: var(--radius-xl);
    background: var(--grad-hero);
    color: var(--white);
    box-shadow: var(--shadow-xl);
    isolation: isolate;
}
.hero::before, .hero::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    z-index: -1;
    filter: blur(2px);
}
.hero::before { width: 320px; height: 320px; right: -80px; top: -120px; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 65%); }
.hero::after  { width: 220px; height: 220px; left: 38%; bottom: -140px; background: radial-gradient(circle, rgba(139,92,246,.45), transparent 65%); }
.hero h1, .hero h2 { color: var(--white); }
.hero-eyebrow {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px;
    background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18);
    font-size: 12px; font-weight: 700; letter-spacing: .02em;
    backdrop-filter: blur(8px);
}
.hero-title { margin-top: 14px; font-size: 32px; font-weight: 800; line-height: 1.15; letter-spacing: -0.03em; }
.hero-sub { margin-top: 8px; font-size: 15px; color: rgba(255,255,255,.75); max-width: 560px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 26px; }

.glass {
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255,255,255,.09);
    border: 1px solid rgba(255,255,255,.16);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.glass .glass-value { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.glass .glass-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: rgba(255,255,255,.68); }
.glass .glass-label .icon { width: 14px; height: 14px; color: var(--primary-300); }

/* -------------------- BUTTON -------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 20px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), background-color 150ms, color 150ms, border-color 150ms, filter 150ms;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--white), 0 0 0 5px var(--primary-400); }
.btn:disabled, .btn.is-disabled { opacity: .5; pointer-events: none; }

.btn-primary { background: var(--grad-brand); color: var(--white); box-shadow: var(--shadow-brand), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-primary:hover { color: var(--white); filter: brightness(1.05); box-shadow: 0 12px 26px -8px rgba(106,90,240,.65), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-secondary { background: var(--white); border-color: var(--border); color: var(--gunmetal); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { color: var(--gunmetal); border-color: var(--primary-200); box-shadow: var(--shadow-lg); }
.btn-ghost { background: transparent; color: var(--grey); }
.btn-ghost:hover { background: var(--linen); color: var(--gunmetal); transform: none; }
.btn-destructive { background: linear-gradient(135deg, #EF4444, #B91C1C); color: var(--white); box-shadow: 0 8px 20px -8px rgba(220,38,38,.6); }
.btn-destructive:hover { color: var(--white); filter: brightness(1.06); }
.btn-success { background: linear-gradient(135deg, #10B981, #047857); color: var(--white); box-shadow: 0 8px 20px -8px rgba(5,150,105,.6); }
.btn-success:hover { color: var(--white); filter: brightness(1.06); }
.btn-light { background: var(--white); color: var(--gunmetal); box-shadow: 0 10px 24px -10px rgba(0,0,0,.5); }
.btn-light:hover { color: var(--primary-700); }
.btn-glass { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.22); color: var(--white); backdrop-filter: blur(8px); }
.btn-glass:hover { background: rgba(255,255,255,.2); color: var(--white); }

.btn-sm { padding: 6px 12px; font-size: 12px; line-height: 18px; border-radius: 10px; }
.btn-icon { padding: 0; width: 38px; height: 38px; }
.btn-block { width: 100%; }

/* -------------------- CARD -------------------- */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.card-body { padding: 20px; }
.card-body-lg { padding: 28px; }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.card-title { font-size: 17px; font-weight: 800; letter-spacing: -0.015em; }
.card-sub { font-size: 13px; color: var(--grey); font-weight: 500; margin-top: 3px; }
a.card { display: block; color: inherit; transition: transform 250ms var(--ease), box-shadow 250ms var(--ease), border-color 200ms; }
a.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary-200); color: inherit; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
@media (max-width: 980px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* -------------------- STAT TILE -------------------- */
.stat { padding: 20px; position: relative; overflow: hidden; }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--grey); font-size: 13px; font-weight: 600; }
.stat-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-50), var(--primary-100));
    color: var(--primary-600);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(106,90,240,.12);
}
.stat-value { margin-top: 12px; font-size: 28px; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* -------------------- COURSE COVER (topic art) -------------------- */
.cover {
    position: relative;
    height: 132px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 16px;
    color: var(--white);
    isolation: isolate;
}
.cover::before {               /* soft light */
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: radial-gradient(260px 160px at 85% 10%, rgba(255,255,255,.35), transparent 60%);
}
.cover::after {                /* fine pattern */
    content: ""; position: absolute; inset: 0; z-index: -1; opacity: .18;
    background-image: radial-gradient(rgba(255,255,255,.9) 1px, transparent 1.4px);
    background-size: 16px 16px;
    mask-image: linear-gradient(120deg, transparent 30%, #000 100%);
    -webkit-mask-image: linear-gradient(120deg, transparent 30%, #000 100%);
}
.cover-icon {
    width: 52px; height: 52px; border-radius: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.3);
    backdrop-filter: blur(6px);
}
.cover-icon .icon { width: 26px; height: 26px; }
.cover-tag {
    padding: 4px 10px; border-radius: 999px;
    background: rgba(0,0,0,.22); backdrop-filter: blur(6px);
    font-size: 11px; font-weight: 700; letter-spacing: .03em;
}
.cover-1 { background: linear-gradient(135deg, #2F6BFF, #5544DB 60%, #2A1F8F); }
.cover-2 { background: linear-gradient(135deg, #7C3AED, #4F46E5 60%, #312E81); }
.cover-3 { background: linear-gradient(135deg, #0EA5E9, #2563EB 60%, #1E3A8A); }
.cover-4 { background: linear-gradient(135deg, #10B981, #0D9488 60%, #134E4A); }
.cover-5 { background: linear-gradient(135deg, #F59E0B, #EA580C 60%, #9A3412); }
.cover-6 { background: linear-gradient(135deg, #EC4899, #BE185D 60%, #831843); }
.cover-7 { background: linear-gradient(135deg, #64748B, #334155 60%, #0F172A); }
.cover-8 { background: linear-gradient(135deg, #14B8A6, #0891B2 60%, #164E63); }

.course-card { display: flex; flex-direction: column; overflow: hidden; transition: transform 250ms var(--ease), box-shadow 250ms var(--ease); }
.course-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.course-card .card-body { flex: 1; }

/* -------------------- STARS / RATINGS -------------------- */
.stars { display: inline-flex; gap: 1px; line-height: 1; font-size: 15px; }
.stars.lg { font-size: 22px; gap: 2px; }
.star { color: #E6DCD2; }
.star.is-on { color: #F5A524; text-shadow: 0 1px 6px rgba(245,165,36,.35); }
.rating-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 999px;
    background: rgba(0,0,0,.28); backdrop-filter: blur(6px);
    color: #fff; font-size: 11px; font-weight: 700;
}
.rating-chip .star-glyph { color: #FBBF24; }
.rating-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
.rating-inline .star-glyph { color: #F5A524; }

/* Star picker: radios in reverse order so hovering a star lights it and the ones before it */
.star-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label { font-size: 34px; line-height: 1; color: #E6DCD2; cursor: pointer; transition: color 120ms, transform 160ms var(--ease); }
.star-input label:hover { transform: scale(1.12); }
.star-input input:checked ~ label,
.star-input label:hover,
.star-input label:hover ~ label { color: #F5A524; }
.star-input input:focus-visible + label { outline: 2px solid var(--primary-400); outline-offset: 2px; border-radius: 6px; }

.rating-bars { display: grid; gap: 6px; }
.rating-bar { display: grid; grid-template-columns: 28px 1fr 28px; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--grey); }
.rating-bar .progress { height: 6px; }
.rating-bar .progress-fill { background: linear-gradient(90deg, #FBBF24, #F59E0B); box-shadow: none; }

.review { padding: 16px 20px; border-bottom: 1px solid var(--linen); }
.review:last-child { border-bottom: 0; }
.review-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.review-head .avatar { width: 30px; height: 30px; font-size: 11px; }
.review-body { margin-top: 8px; font-weight: 500; line-height: 1.65; overflow-wrap: anywhere; }

/* -------------------- BADGE (status tone) -------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid;
    font-size: 12px;
    font-weight: 700;
    line-height: 18px;
    white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.tone-success { background: var(--emerald-50); color: var(--emerald-700); border-color: var(--emerald-200); }
.tone-error   { background: var(--red-50);     color: var(--red-700);     border-color: var(--red-200); }
.tone-warning { background: var(--amber-50);   color: var(--amber-700);   border-color: var(--amber-200); }
.tone-info    { background: var(--blue-50);    color: var(--blue-700);    border-color: var(--blue-200); }
.tone-neutral { background: var(--linen);      color: var(--gunmetal);    border-color: var(--border); }

/* -------------------- ALERT / BANNER -------------------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    border-width: 1px;
    border-style: solid; /* colour comes from the .tone-* class */
    font-size: 14px;
}
.alert .icon { margin-top: 2px; }
.alert-body { flex: 1; }
.alert-title { font-weight: 800; }
.alert-text { font-weight: 500; margin-top: 2px; opacity: .9; }

/* -------------------- FORM -------------------- */
.field + .field { margin-top: 18px; }
.label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; color: var(--gunmetal); }
.hint { margin-top: 6px; font-size: 12px; color: var(--grey); font-weight: 500; }

.input, .textarea {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--cream);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--gunmetal);
    transition: border-color 150ms, box-shadow 200ms, background-color 150ms;
}
.textarea { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: #A89D96; }
.input:hover, .textarea:hover { border-color: #DCCFC3; }
.input:focus, .textarea:focus {
    outline: none;
    background: var(--white);
    border-color: var(--primary-400);
    box-shadow: 0 0 0 4px rgba(106,90,240,.14);
}
select.input { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237A706B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input-file { height: auto; padding: 10px; }
.input-file::file-selector-button {
    margin-right: 12px;
    padding: 7px 12px;
    border: 0;
    border-radius: 8px;
    background: var(--grad-brand);
    color: var(--white);
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: linear-gradient(180deg, var(--cream), var(--white));
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; font-size: 12px; font-weight: 600; color: var(--grey); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* -------------------- TABLE -------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    padding: 12px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--grey);
    background: var(--cream);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td { padding: 14px 20px; border-bottom: 1px solid var(--linen); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color 150ms; }
.table tbody tr:hover td { background: var(--primary-50); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn + .btn,
.table .actions .btn + .inline-form,
.table .actions .inline-form + .inline-form { margin-left: 6px; }
.inline-form { display: inline; margin: 0; }
.cell-user { display: flex; align-items: center; gap: 12px; }
.cell-user div > strong { display: block; font-weight: 700; }
.cell-user div > span { display: block; font-size: 12px; color: var(--grey); }

.thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); background: var(--linen); display: block; }

/* -------------------- PROGRESS -------------------- */
.progress { height: 8px; border-radius: 999px; background: var(--linen); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--grad-brand); transition: width 400ms var(--ease); box-shadow: 0 0 12px rgba(106,90,240,.45); }
.progress-meta { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 12px; font-weight: 600; color: var(--grey); }
.hero .progress { background: rgba(255,255,255,.16); }

/* -------------------- LIST ROWS -------------------- */
.list-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--linen);
    color: var(--gunmetal);
    transition: background-color 150ms;
}
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { background: var(--primary-50); color: var(--gunmetal); }
.list-row.is-locked { color: var(--grey); }
.list-index {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: var(--grad-brand);
    color: var(--white);
    font-size: 13px;
    font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-brand);
}
.list-row.is-locked .list-index { background: var(--linen); color: var(--grey); box-shadow: none; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 700; }
.list-sub { font-size: 12px; color: var(--grey); margin-top: 2px; font-weight: 500; }

/* -------------------- DEFINITION LIST -------------------- */
.dl { display: grid; grid-template-columns: 170px 1fr; }
.dl dt, .dl dd { margin: 0; padding: 14px 20px; border-bottom: 1px solid var(--linen); }
.dl dt { color: var(--grey); font-size: 13px; font-weight: 600; }
.dl dt:last-of-type, .dl dd:last-of-type { border-bottom: 0; }
@media (max-width: 520px) { .dl { grid-template-columns: 1fr; } .dl dt { border-bottom: 0; padding-bottom: 0; } }

/* -------------------- TABS / SEGMENTED / CHIPS -------------------- */
.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    padding: 4px;
    gap: 4px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
}
.segmented a, .segmented button {
    padding: 7px 14px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--grey);
    cursor: pointer;
    transition: background-color 150ms, color 150ms;
}
.segmented a:hover, .segmented button:hover { color: var(--gunmetal); }
.segmented a.is-active, .segmented button.is-active { background: var(--grad-brand); color: var(--white); box-shadow: var(--shadow-brand); }

/* Category chips: wrap on wide screens, scroll sideways on phones */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--white);
    font-family: inherit; font-size: 13px; font-weight: 700; color: var(--gunmetal);
    white-space: nowrap; cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background-color 150ms, color 150ms, border-color 150ms, box-shadow 200ms;
}
.chip span { padding: 1px 7px; border-radius: 999px; background: var(--linen); color: var(--grey); font-size: 11px; }
.chip:hover { border-color: var(--primary-300); color: var(--primary-700); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--white); box-shadow: var(--shadow-lg); }
.chip.is-active span { background: var(--grad-brand); color: var(--white); }
@media (max-width: 640px) {
    .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
    .chips::-webkit-scrollbar { display: none; }
}

.card-eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--primary-600); margin-bottom: 3px; }

.searchbar { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.searchbar .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--grey); }
.searchbar .input { padding-left: 40px; background: var(--white); }

/* -------------------- EMPTY STATE -------------------- */
.empty { padding: 48px 20px; text-align: center; }
.empty > .icon {
    width: 56px; height: 56px; padding: 14px; margin-bottom: 14px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary-50), var(--primary-100));
    color: var(--primary-600);
}
.empty-title { font-size: 16px; font-weight: 800; }
.empty-text { font-size: 13px; color: var(--grey); margin-top: 4px; font-weight: 500; }
.empty .btn { margin-top: 16px; }

/* -------------------- NAV COUNT / MESSAGE THREAD (support) -------------------- */
.thread { display: flex; flex-direction: column; gap: 14px; padding: 20px; background: linear-gradient(180deg, var(--cream), var(--white)); border-radius: var(--radius-lg); }
.msg {
    max-width: 82%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 18px 18px 18px 6px;
    background: var(--white);
    box-shadow: var(--shadow-sm);
}
.msg.is-mine { align-self: flex-end; border-radius: 18px 18px 6px 18px; background: linear-gradient(135deg, #FFF3EC, #FDE5D9); border-color: var(--primary-200); }
.msg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.msg-head .avatar { width: 26px; height: 26px; font-size: 11px; }
.msg-head strong { font-size: 13px; font-weight: 800; }
.msg-body { font-weight: 500; line-height: 1.65; overflow-wrap: anywhere; }
@media (max-width: 620px) { .msg { max-width: 100%; } }

/* -------------------- TOAST -------------------- */
.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; gap: 10px; }
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 400px;
    padding: 14px 16px;
    background: rgba(23,17,14,.92);
    color: #F5EFEA;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    font-size: 14px;
    font-weight: 600;
    animation: toast-in 260ms var(--ease);
}
.toast .dot { width: 10px; height: 10px; border-radius: 999px; flex-shrink: 0; }
.toast.success .dot { background: #34D399; box-shadow: 0 0 0 4px rgba(52,211,153,.2); }
.toast.error .dot   { background: #F87171; box-shadow: 0 0 0 4px rgba(248,113,113,.2); }
.toast.info .dot    { background: var(--primary-400); box-shadow: 0 0 0 4px rgba(232,138,104,.2); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

/* -------------------- AUTH (split screen) -------------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px;
    background: var(--grad-hero);
    color: var(--white);
    isolation: isolate;
}
.auth-art::before { content: ""; position: absolute; width: 520px; height: 520px; right: -180px; top: -160px; border-radius: 999px; z-index: -1; background: radial-gradient(circle, rgba(255,255,255,.14), transparent 65%); }
.auth-art::after  { content: ""; position: absolute; width: 420px; height: 420px; left: -140px; bottom: -160px; border-radius: 999px; z-index: -1; background: radial-gradient(circle, rgba(139,92,246,.5), transparent 65%); }
.auth-art .sidebar-brand { padding: 0; }
.auth-art h2 { font-size: 40px; font-weight: 800; line-height: 1.1; letter-spacing: -0.035em; color: var(--white); max-width: 460px; }
.auth-art h2 span { background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-art p { margin-top: 14px; font-size: 16px; color: rgba(255,255,255,.72); max-width: 440px; }
.auth-points { display: grid; gap: 10px; margin-top: 28px; max-width: 440px; }
.auth-points .glass { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.auth-points .glass .icon { color: var(--primary-300); }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-brand { display: none; justify-content: center; margin-bottom: 24px; }
.auth-brand .sidebar-brand { padding: 0; color: var(--gunmetal); }
.auth-brand .sidebar-brand small { color: var(--grey); }
.auth h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.025em; }
.auth .lead { color: var(--grey); font-weight: 500; margin: 6px 0 24px; font-size: 15px; }
.auth-foot { margin-top: 18px; text-align: center; font-size: 13px; color: var(--grey); }
@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .auth-art { display: none; }
    .auth-brand { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
    .btn:hover, a.card:hover, .course-card:hover { transform: none; }
}

/* -------------------- Public policy pages (privacy, terms, refund, contact) -------------------- */
.legal-body { background: var(--canvas); min-height: 100vh; }
.legal-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 880px; margin: 0 auto; padding: 20px 16px 8px; }
.legal-brand { text-decoration: none; }
.legal-top .sidebar-brand { padding: 0; color: var(--gunmetal); }
.legal-top .sidebar-brand small { color: var(--grey); }
.legal { max-width: 880px; margin: 0 auto; padding: 8px 16px 48px; }
.legal-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 16px; }
.legal-tabs a { padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--grey); text-decoration: none; border: 1px solid var(--border); background: var(--white); }
.legal-tabs a:hover { color: var(--gunmetal); }
.legal-tabs a.is-active { background: var(--ink); border-color: var(--ink); color: var(--white); }
.legal-card { padding: 36px 40px; line-height: 1.7; color: var(--gunmetal); }
.legal-card h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.legal-updated { color: var(--grey); font-size: 13px; margin-top: 4px; }
.legal-card h2 { font-size: 18px; font-weight: 700; margin: 28px 0 8px; }
.legal-card p, .legal-card ul { margin: 8px 0; }
.legal-card ul { padding-left: 20px; }
.legal-card li { margin: 4px 0; }
.legal-card a { color: var(--primary-600); }
.legal-card .dl { margin-top: 16px; }
.legal-foot { text-align: center; color: var(--grey); font-size: 13px; margin-top: 20px; }
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin-top: 14px; font-size: 12px; }
.legal-links a { color: var(--grey); }
.legal-links a:hover { color: var(--gunmetal); }
@media (max-width: 640px) { .legal-card { padding: 24px 20px; } .legal-card h1 { font-size: 24px; } }
.app-foot { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--border); }
.app-foot .legal-links { margin-top: 0; }

