/* =====================================================================
   Academy Management System — design system
   Vazirmatn (local) · logical properties for RTL/LTR · light/dark themes
   ===================================================================== */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700 900;
    font-style: normal;
    font-display: swap;
}

/* ---------------------------------------------------------------------
   Design tokens
   --------------------------------------------------------------------- */
:root {
    --bg: #f3f5fb;
    --bg-deep: #e9edf9;
    --surface: #ffffff;
    --surface-2: #f6f8fd;
    --surface-3: #eef2fb;
    --border: #e5eaf5;
    --border-strong: #d3dbee;
    --text: #101731;
    --text-2: #33405e;
    --muted: #6c7894;

    --brand: #3b5bff;
    --brand-2: #7b5cff;
    --brand-dark: #2947e0;
    --brand-50: #eef2ff;
    --brand-100: #e0e7ff;
    --brand-glow: rgba(59, 91, 255, .28);

    --success: #0f9d76;
    --success-bg: #e9fbf4;
    --warning: #b7791f;
    --warning-bg: #fff8e6;
    --danger: #d64545;
    --danger-bg: #fff0f0;
    --info: #2277c9;
    --info-bg: #eef7ff;

    --radius-lg: 22px;
    --radius: 16px;
    --radius-sm: 11px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px -12px rgba(23, 36, 74, .14);
    --shadow-lg: 0 30px 70px -30px rgba(23, 36, 74, .35);

    --sidebar: 268px;
    --topbar: 68px;
    --font: Vazirmatn, "Segoe UI", Tahoma, system-ui, -apple-system, sans-serif;
    color-scheme: light;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #080d1a;
    --bg-deep: #060a14;
    --surface: #0f1729;
    --surface-2: #141e36;
    --surface-3: #1a2543;
    --border: #1e2a47;
    --border-strong: #2c3b60;
    --text: #eef2ff;
    --text-2: #c6d0e8;
    --muted: #8e9cba;

    --brand: #7d93ff;
    --brand-2: #a78bfa;
    --brand-dark: #a9b9ff;
    --brand-50: #1b2547;
    --brand-100: #223060;
    --brand-glow: rgba(125, 147, 255, .3);

    --success: #3dd9a8;
    --success-bg: #0c2a23;
    --warning: #f5c05a;
    --warning-bg: #2a2210;
    --danger: #ff8080;
    --danger-bg: #2c1418;
    --info: #6fb6ff;
    --info-bg: #0d2237;

    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 18px 40px -18px rgba(0, 0, 0, .7);
    --shadow-lg: 0 40px 90px -40px rgba(0, 0, 0, .9);
}

/* ---------------------------------------------------------------------
   Base
   --------------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; transition: color .15s; }
a:hover { color: var(--brand-2); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, h5 { margin: 0 0 .5rem; font-weight: 700; line-height: 1.5; letter-spacing: -.015em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.28rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .85rem; }
small, .text-sm { font-size: .82rem; }
.text-md { font-size: .95rem; }
.muted { color: var(--muted); }
.text-center { text-align: center; }
.text-end { text-align: end; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 1rem; }
.w-100 { width: 100%; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }
::selection { background: var(--brand); color: #fff; }

.icon { width: 20px; height: 20px; flex: 0 0 auto; }
.icon-sm { width: 16px; height: 16px; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
*::-webkit-scrollbar-track { background: transparent; }

/* Theme switch */
.theme-toggle {
    display: inline-grid; place-items: center;
    width: 36px; height: 36px; border-radius: 11px;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text-2); cursor: pointer; padding: 0; transition: .15s;
}
.theme-toggle:hover { color: var(--brand); border-color: var(--brand-100); background: var(--brand-50); }
.theme-toggle .icon { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---------------------------------------------------------------------
   Panel shell
   --------------------------------------------------------------------- */
.panel-body { min-height: 100vh; background: var(--bg); }

.sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0;
    width: var(--sidebar);
    background:
        radial-gradient(420px 240px at 15% 0%, rgba(123, 92, 255, .28), transparent 70%),
        linear-gradient(180deg, #0d1530 0%, #0a1126 100%);
    color: #c3cbe2;
    display: flex; flex-direction: column; z-index: 40;
    transition: transform .24s cubic-bezier(.4, 0, .2, 1);
    border-inline-end: 1px solid rgba(255, 255, 255, .05);
}
.sidebar-brand {
    display: flex; align-items: center; gap: .7rem;
    padding: 1.3rem 1.25rem 1.1rem;
    color: #fff; font-weight: 700; font-size: 1rem;
}
.sidebar-brand .logo-mark {
    width: 40px; height: 40px; border-radius: 13px; flex: 0 0 auto;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    display: grid; place-items: center; color: #fff; font-size: 1.05rem;
    box-shadow: 0 10px 24px -8px rgba(123, 92, 255, .9);
}
.sidebar-brand img {
    width: 40px; height: 40px; object-fit: contain; border-radius: 12px;
    background: #fff; padding: 4px;
}
.sidebar-brand small { display: block; font-size: .68rem; color: #8793b4; font-weight: 500; letter-spacing: .02em; }

.sidebar-nav { padding: .6rem .75rem 1.4rem; flex: 1; overflow-y: auto; }
.nav-group { margin-bottom: 1.1rem; }
.nav-group-title {
    font-size: .66rem; letter-spacing: .09em; text-transform: uppercase;
    color: #6f7c9f; padding: .3rem .7rem; margin-bottom: .2rem; font-weight: 600;
}
.nav-link {
    display: flex; align-items: center; gap: .7rem;
    padding: .58rem .75rem; border-radius: 12px; color: #b6c0da;
    font-size: .87rem; margin-bottom: 2px;
    transition: background .16s, color .16s, transform .16s;
    position: relative;
}
.nav-link:hover { background: rgba(255, 255, 255, .055); color: #fff; }
.nav-link.active {
    background: linear-gradient(100deg, rgba(59, 91, 255, .95), rgba(123, 92, 255, .8));
    color: #fff; font-weight: 600;
    box-shadow: 0 12px 26px -14px rgba(59, 91, 255, .95);
}
.nav-link.active::after {
    content: ""; position: absolute; inset-inline-end: -0.75rem; top: 50%;
    width: 3px; height: 18px; margin-top: -9px; border-radius: 3px;
    background: #fff; opacity: .9;
}
.nav-link .icon { width: 18px; height: 18px; opacity: .92; }
.nav-link .count {
    margin-inline-start: auto; background: rgba(255, 255, 255, .16);
    border-radius: 999px; padding: 0 .45rem; font-size: .7rem; line-height: 1.6;
}
.sidebar-foot {
    padding: .9rem; border-top: 1px solid rgba(255, 255, 255, .07);
    font-size: .72rem; color: #7c88a8;
}
.sidebar-user {
    display: flex; align-items: center; gap: .6rem;
    background: rgba(255, 255, 255, .055); border: 1px solid rgba(255, 255, 255, .07);
    padding: .55rem .6rem; border-radius: 14px; margin-bottom: .5rem;
}
.sidebar-user img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.sidebar-user strong { display: block; color: #f2f5ff; font-size: .8rem; line-height: 1.4; }
.sidebar-user span { display: block; color: #8793b4; font-size: .68rem; line-height: 1.4; }

.main { margin-inline-start: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: .75rem;
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    backdrop-filter: saturate(140%) blur(14px);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
    border-bottom: 1px solid var(--border);
    padding: .65rem clamp(.9rem, 2.4vw, 1.8rem);
    min-height: var(--topbar);
}
.topbar .page-crumb { font-size: .8rem; color: var(--muted); }
.topbar .page-crumb strong { color: var(--text); font-weight: 600; }
.burger { display: none; }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: .4rem; }
.content { padding: clamp(1rem, 2.4vw, 1.9rem); flex: 1; max-width: 1520px; width: 100%; margin-inline: auto; }
.sidebar-overlay { display: none; }

@media (max-width: 1024px) {
    .sidebar { transform: translateX(calc(var(--sidebar) * -1)); }
    [dir="rtl"] .sidebar { transform: translateX(var(--sidebar)); }
    .sidebar.is-open { transform: translateX(0) !important; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
    .main { margin-inline-start: 0; }
    .burger { display: inline-flex; }
    .sidebar-overlay.is-open {
        display: block; position: fixed; inset: 0; z-index: 35;
        background: rgba(8, 13, 26, .55); backdrop-filter: blur(2px);
    }
}

html[data-theme="dark"] .topbar { border-bottom-color: var(--border); }

/* ---------------------------------------------------------------------
   Page header
   --------------------------------------------------------------------- */
.page-head {
    display: flex; flex-wrap: wrap; align-items: flex-end; gap: .9rem;
    margin-bottom: 1.25rem;
}
.page-head .title { font-size: 1.42rem; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.page-head .subtitle { color: var(--muted); font-size: .86rem; margin: .25rem 0 0; }
.page-actions { margin-inline-start: auto; display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: .35rem; font-size: .77rem; color: var(--muted); margin-bottom: .5rem; align-items: center; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--brand); }

/* ---------------------------------------------------------------------
   Cards, grids, sections
   --------------------------------------------------------------------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    margin-bottom: 1.1rem; overflow: hidden;
}
.card-head {
    display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
    padding: .95rem 1.15rem; border-bottom: 1px solid var(--border);
}
.card-head h2, .card-head h3 { margin: 0; font-size: .98rem; }
.card-head .spacer { margin-inline-start: auto; }
.card-body { padding: 1.15rem; }
.card-body.tight { padding: .65rem; }
.card-foot { padding: .8rem 1.15rem; border-top: 1px solid var(--border); background: var(--surface-2); }
.section { padding: clamp(1.8rem, 4vw, 3rem) 0; }
.section-head { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: 1.3rem; }
.section-head h2 { margin: 0; font-size: 1.3rem; }
.section-head p { margin: .2rem 0 0; color: var(--muted); font-size: .86rem; }
.section-head .link { margin-inline-start: auto; font-size: .84rem; font-weight: 600; }

.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------------
   Stats
   --------------------------------------------------------------------- */
.stat {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.05rem 1.1rem; display: flex; gap: .85rem; align-items: flex-start;
    box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat::after {
    content: ""; position: absolute; inset-inline-end: -18px; top: -28px;
    width: 90px; height: 90px; border-radius: 50%;
    background: radial-gradient(circle, var(--brand-50), transparent 70%);
}
.stat-icon {
    width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
    background: var(--brand-50); color: var(--brand); flex: 0 0 auto;
}
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.amber { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.blue { background: var(--info-bg); color: var(--info); }
.stat-label { font-size: .79rem; color: var(--muted); margin-bottom: .1rem; }
.stat-value { font-size: 1.5rem; font-weight: 800; line-height: 1.3; letter-spacing: -.02em; }
.stat-note { font-size: .72rem; color: var(--muted); margin-top: .15rem; }

/* ---------------------------------------------------------------------
   Tables
   --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 540px; }
.table thead th {
    text-align: start; font-weight: 600; color: var(--muted); font-size: .75rem;
    background: var(--surface-2); padding: .7rem .9rem;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table tbody td { padding: .72rem .9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .actions { display: flex; gap: .25rem; justify-content: flex-end; }
.table.compact tbody td { padding: .45rem .65rem; }
.table .num { font-variant-numeric: tabular-nums; }
.table-actions { display: flex; gap: .25rem; flex-wrap: wrap; }

/* ---------------------------------------------------------------------
   Badges, chips, avatars
   --------------------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: .3rem;
    font-size: .72rem; font-weight: 600; padding: .14rem .6rem; border-radius: 999px;
    background: var(--surface-3); color: var(--text-2); white-space: nowrap; line-height: 1.8;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--surface-3); color: var(--muted); }
.badge-brand { background: var(--brand-50); color: var(--brand); }
.chip {
    display: inline-flex; align-items: center; gap: .35rem; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 999px; padding: .2rem .75rem;
    font-size: .76rem; color: var(--text-2);
}
.chip-soft { background: var(--brand-50); border-color: transparent; color: var(--brand); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }

.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--brand-50); border: 1px solid var(--border); }
.avatar.lg { width: 64px; height: 64px; }
.avatar.xl { width: 92px; height: 92px; }
.avatar-xs { width: 26px; height: 26px; border-width: 2px; border-color: var(--surface); }
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { margin-inline-start: -9px; border: 2px solid var(--surface); }
.avatar-stack .avatar:first-child { margin-inline-start: 0; }
.avatar-stack-lg .avatar { width: 44px; height: 44px; margin-inline-start: -12px; }
.user-chip {
    display: flex; align-items: center; gap: .55rem; background: none; border: 0;
    cursor: pointer; padding: .25rem .35rem; border-radius: 12px; font-family: inherit;
}
.user-chip:hover { background: var(--surface-2); }
.user-chip .name { font-size: .82rem; font-weight: 600; line-height: 1.4; color: var(--text); display: block; text-align: start; }
.user-chip .role { font-size: .7rem; color: var(--muted); line-height: 1.3; display: block; text-align: start; }

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    border: 1px solid var(--border-strong); border-radius: 12px; padding: .52rem .95rem;
    font-family: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
    background: var(--surface); color: var(--text-2);
    transition: background .15s, box-shadow .15s, border-color .15s, color .15s, transform .1s;
    line-height: 1.6; text-align: center; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    border-color: transparent; color: #fff;
    box-shadow: 0 10px 22px -12px var(--brand-glow);
}
.btn-primary:hover { color: #fff; filter: brightness(1.06); box-shadow: 0 14px 26px -12px var(--brand-glow); }
.btn-soft { background: var(--brand-50); border-color: transparent; color: var(--brand); }
.btn-soft:hover { background: var(--brand-100); color: var(--brand-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b93a3a; color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #0c8866; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: .32rem .65rem; font-size: .77rem; border-radius: 9px; gap: .3rem; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-block { width: 100%; }
.btn-arrow svg { transition: transform .15s; }
.btn-arrow:hover svg { transform: translateX(-3px); }
[dir="rtl"] .btn-arrow:hover svg { transform: translateX(3px) scaleX(-1); }
[dir="rtl"] .btn-arrow svg { transform: scaleX(-1); }
.btn:disabled, .btn.is-disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-group { display: flex; gap: .4rem; flex-wrap: wrap; }
.icon-btn {
    display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
    border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; position: relative;
    transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--brand); }
.icon-btn .badge-dot {
    position: absolute; inset-block-start: 3px; inset-inline-end: 3px;
    min-width: 16px; height: 16px; border-radius: 999px; background: var(--danger); color: #fff;
    font-size: .62rem; display: grid; place-items: center; padding: 0 3px; line-height: 1;
    border: 2px solid var(--surface);
}

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .9rem 1rem; }
.field { grid-column: span 12; }
.field.col-6 { grid-column: span 6; }
.field.col-4 { grid-column: span 4; }
.field.col-3 { grid-column: span 3; }
@media (max-width: 720px) { .field.col-6, .field.col-4, .field.col-3 { grid-column: span 12; } }
.label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: .32rem; color: var(--text-2); }
.label .req { color: var(--danger); }
.input, .select, .textarea {
    width: 100%; font-family: inherit; font-size: .875rem; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    padding: .58rem .8rem; outline: none; transition: border .15s, box-shadow .15s;
    line-height: 1.6;
}
.input:focus, .select:focus, .textarea:focus {
    border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .75; }
.textarea { min-height: 100px; resize: vertical; }
.select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236c7894' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .65rem center;
    padding-inline-end: 2.1rem;
}
[dir="rtl"] .select { background-position: left .65rem center; padding-inline-end: .8rem; padding-inline-start: 2.1rem; }
.help { font-size: .74rem; color: var(--muted); margin-top: .3rem; }
.error-text { font-size: .76rem; color: var(--danger); margin-top: .25rem; }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.check { display: inline-flex; align-items: center; gap: .45rem; font-size: .84rem; cursor: pointer; color: var(--text-2); }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.radio-row { display: flex; flex-wrap: wrap; gap: .9rem; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1.15rem; }
.file-input { font-size: .82rem; }
.file-input::file-selector-button {
    font-family: inherit; margin-inline-end: .7rem; padding: .42rem .75rem; border-radius: 9px;
    border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer;
}
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.filters .field { grid-column: auto; min-width: 150px; flex: 1 1 150px; }
.filters .field.grow { flex: 2 1 220px; }
select[multiple] { min-height: 120px; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .35rem .8rem; }

/* Teaching team pickers */
.team-picker { display: grid; gap: .65rem; }
.team-pick {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: .7rem .8rem; background: var(--surface-2); transition: .15s;
}
.team-pick.is-selected { border-color: var(--brand-100); background: var(--brand-50); }
.team-pick.is-primary { border-color: var(--brand); background: linear-gradient(180deg, var(--brand-50), var(--surface)); }
.team-pick-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.team-pick-head .grow { min-width: 120px; }
.team-pick-subjects { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .6rem; }
.team-pick:has(input[type="checkbox"]:not(:checked)) .team-pick-subjects { display: none; }
.team-pick:has(input[type="checkbox"]:checked) { border-color: var(--brand-100); background: var(--brand-50); }
@media (max-width: 620px) { .team-pick-subjects { grid-template-columns: 1fr; } }
.team-grid { display: grid; gap: .55rem; }
.team-card {
    display: flex; align-items: center; gap: .65rem; padding: .6rem .7rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
}
.team-card strong { font-size: .86rem; }
.assigned-teacher { display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--muted); }
.lesson-teacher {
    display: inline-flex; align-items: center; gap: .3rem;
    font-size: .73rem; color: var(--muted); background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 999px; padding: 0 .45rem 0 0;
}
[dir="rtl"] .lesson-teacher { padding: 0 0 0 .45rem; }

/* ---------------------------------------------------------------------
   Alerts, empty, progress
   --------------------------------------------------------------------- */
.alert {
    display: flex; gap: .6rem; align-items: flex-start;
    border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem .95rem;
    font-size: .85rem; margin-bottom: .85rem; background: var(--surface);
}
.alert .icon { width: 18px; height: 18px; margin-top: 2px; }
.alert-success { background: var(--success-bg); border-color: color-mix(in srgb, var(--success) 22%, transparent); color: var(--success); }
.alert-danger { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 22%, transparent); color: var(--danger); }
.alert-warning { background: var(--warning-bg); border-color: color-mix(in srgb, var(--warning) 25%, transparent); color: var(--warning); }
.alert-info { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 22%, transparent); color: var(--info); }
.alert .close { margin-inline-start: auto; background: none; border: 0; color: inherit; cursor: pointer; opacity: .6; padding: 0; }
.alert .close:hover { opacity: 1; }

.empty { text-align: center; padding: 2.6rem 1rem; color: var(--muted); }
.empty .icon { width: 42px; height: 42px; margin: 0 auto .6rem; color: var(--border-strong); }
.empty p { margin: .2rem 0 .9rem; font-size: .85rem; }
.progress { height: 7px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: inherit; }
.progress.sm { height: 4px; }
.progress-label { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); margin-bottom: .2rem; }

/* ---------------------------------------------------------------------
   Tabs & dropdowns
   --------------------------------------------------------------------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    padding: .55rem .9rem; font-size: .84rem; font-weight: 600; color: var(--muted);
    border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-color: var(--brand); }

.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; inset-block-start: calc(100% + 8px); inset-inline-end: 0;
    min-width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: var(--shadow-lg); padding: .4rem; z-index: 60; display: none;
}
.dropdown.open .dropdown-menu { display: block; animation: dropIn .16s ease; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.dropdown-item {
    display: flex; align-items: center; gap: .55rem; padding: .52rem .6rem; border-radius: 9px;
    color: var(--text-2); font-size: .84rem; width: 100%; background: none; border: 0;
    font-family: inherit; cursor: pointer; text-align: start;
}
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: .35rem 0; }
.dropdown-note { padding: .4rem .6rem; font-size: .72rem; color: var(--muted); }

.notif-list { max-height: 340px; overflow-y: auto; }
.notif-item { display: block; padding: .55rem .6rem; border-radius: 9px; border-bottom: 1px solid var(--border); }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--brand-50); }
.notif-item .t { font-size: .8rem; font-weight: 600; color: var(--text); }
.notif-item .b { font-size: .74rem; color: var(--muted); }

/* ---------------------------------------------------------------------
   Misc utility
   --------------------------------------------------------------------- */
.divider { height: 1px; background: var(--border); margin: 1rem 0; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: .35rem .8rem; font-size: .85rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); }
.kv > div { display: flex; flex-direction: column; gap: .1rem; }
.kv > div span { color: var(--muted); font-size: .76rem; }
.kv > div strong { font-weight: 600; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: .6rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--border); font-size: .85rem; }
.list > li:last-child { border-bottom: 0; }
.list .meta { margin-inline-start: auto; color: var(--muted); font-size: .76rem; }
.list-clean { list-style: none; padding: 0; margin: 0; }
.list-clean li { padding: .45rem 0; border-bottom: 1px dashed var(--border); font-size: .84rem; display: flex; gap: .5rem; }
.list-clean li:last-child { border-bottom: 0; }
.list-clean .meta { margin-inline-start: auto; color: var(--muted); font-size: .74rem; }
.dot-sep { color: var(--border-strong); margin: 0 .35rem; }
.scroll-y { max-height: 340px; overflow-y: auto; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; }
.code-box { background: #0b1226; color: #e2e8f0; padding: .8rem 1rem; border-radius: 12px; font-family: ui-monospace, monospace; font-size: .8rem; overflow-x: auto; direction: ltr; text-align: left; }
.hstack { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.vstack { display: flex; flex-direction: column; gap: .5rem; }
.grow { flex: 1 1 auto; }
.spacer { margin-inline-start: auto; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.row.wrap { flex-wrap: wrap; }
.row.gap-sm { gap: .45rem; }
.checkbox-inline { display: inline-flex; align-items: center; gap: .45rem; font-size: .84rem; color: var(--text-2); cursor: pointer; }
.checkbox-inline input { width: 16px; height: 16px; accent-color: var(--brand); }
.sidebar-user .icon-btn { background: transparent; }
.inline-form { display: inline-flex; gap: .35rem; align-items: center; }
.tag-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.detail-cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .detail-cols { grid-template-columns: 1fr; } }
.stars { color: #f59e0b; letter-spacing: .1em; }
.hr-label { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .76rem; margin: 1rem 0; }
.hr-label::before, .hr-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); border-radius: 8px; height: 14px; }

.pagination { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; padding: .7rem 1rem; }
.pagination a, .pagination span {
    min-width: 33px; height: 33px; display: inline-grid; place-items: center; padding: 0 .5rem;
    border-radius: 9px; font-size: .8rem; border: 1px solid transparent; color: var(--text-2);
}
.pagination a:hover { background: var(--surface-2); border-color: var(--border); }
.pagination .active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 600; }
.pagination .disabled { opacity: .4; }
.pagination .info { margin-inline-start: auto; font-size: .75rem; color: var(--muted); }

/* ---------------------------------------------------------------------
   Public site chrome
   --------------------------------------------------------------------- */
.site-body { background: var(--surface); }
.site-header {
    position: sticky; top: 0; z-index: 30;
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    backdrop-filter: saturate(150%) blur(14px);
    -webkit-backdrop-filter: saturate(150%) blur(14px);
    border-bottom: 1px solid var(--border);
}
.site-header::before {
    content: ""; display: block; height: 3px;
    background: linear-gradient(90deg, var(--brand), var(--brand-2) 55%, #36d1c4);
}
.site-header .inner { display: flex; align-items: center; gap: 1rem; padding: .78rem 0; }
.container { width: min(1200px, 100% - 2rem); margin-inline: auto; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; color: var(--text); font-size: 1.02rem; }
.brand .logo-mark {
    width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
    box-shadow: 0 10px 20px -10px var(--brand-glow);
}
.brand img { width: 36px; height: 36px; object-fit: contain; }
.site-nav { display: flex; gap: .25rem; margin-inline-start: auto; align-items: center; }
.site-nav a { color: var(--text-2); font-size: .87rem; padding: .45rem .8rem; border-radius: 9px; font-weight: 500; }
.site-nav a:hover, .site-nav a.active { background: var(--brand-50); color: var(--brand); }
.site-cta { display: flex; gap: .4rem; align-items: center; }

.hero {
    padding: clamp(2.6rem, 6vw, 4.6rem) 0 clamp(2.2rem, 5vw, 3.6rem);
    background:
        radial-gradient(900px 420px at 82% -10%, var(--brand-50) 0%, transparent 62%),
        radial-gradient(700px 320px at 8% 110%, #e9fbff 0%, transparent 60%),
        linear-gradient(180deg, var(--surface-2), var(--surface));
    border-bottom: 1px solid var(--border);
}
html[data-theme="dark"] .hero {
    background:
        radial-gradient(900px 420px at 82% -10%, #16214a 0%, transparent 62%),
        radial-gradient(700px 320px at 8% 110%, #0a2630 0%, transparent 60%),
        linear-gradient(180deg, #0b1224, var(--surface));
}
.hero-grid { display: grid; grid-template-columns: 1.08fr .92fr; gap: 2.4rem; align-items: center; }
.hero h1 { font-size: clamp(1.8rem, 3.8vw, 2.7rem); line-height: 1.35; margin-bottom: .9rem; letter-spacing: -.03em; }
.hero p.lead { font-size: 1.02rem; color: var(--muted); max-width: 48ch; }
.eyebrow, .hero .eyebrow {
    display: inline-flex; align-items: center; gap: .4rem;
    background: var(--brand-50); color: var(--brand);
    font-size: .76rem; font-weight: 700; padding: .3rem .75rem; border-radius: 999px; margin-bottom: 1rem;
}
.hero-stats { display: flex; gap: 1.8rem; margin-top: 1.5rem; flex-wrap: wrap; }
.hero-stats .n { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; }
.hero-stats .l { font-size: .76rem; color: var(--muted); }
.hero-art {
    background: linear-gradient(160deg, var(--brand-50), #f5f3ff 55%, #e9fbff);
    border-radius: 26px; padding: 1.2rem; border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
html[data-theme="dark"] .hero-art { background: linear-gradient(160deg, #16213f, #1a1a3d 60%, #0e2a33); }
.hero-card { background: var(--surface); border-radius: 16px; padding: .95rem; box-shadow: var(--shadow); margin-bottom: .7rem; }
.hero-card:last-child { margin-bottom: 0; }

.site-footer { background: #0a1124; color: #94a1bf; padding: 2.6rem 0 1.4rem; margin-top: 2rem; font-size: .85rem; }
.site-footer a { color: #c8d2e8; }
.site-footer h4 { color: #fff; font-size: .9rem; margin-bottom: .7rem; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 1.8rem; }
@media (max-width: 820px) { .footer-grid, .hero-grid { grid-template-columns: 1fr; } .site-nav { display: none; } }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .08); margin-top: 1.8rem; padding-top: 1rem; display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; font-size: .76rem; }

/* ---------------------------------------------------------------------
   Catalog
   --------------------------------------------------------------------- */
.catalog-hero {
    position: relative; overflow: hidden;
    padding: clamp(1.8rem, 4vw, 3rem) 0 clamp(2rem, 4vw, 3rem);
    background:
        radial-gradient(760px 380px at 88% 0%, rgba(123, 92, 255, .22), transparent 62%),
        radial-gradient(620px 320px at 0% 100%, rgba(59, 91, 255, .14), transparent 60%),
        linear-gradient(150deg, #0c1633 0%, #101d44 55%, #151a4a 100%);
    color: #eef2ff;
}
.catalog-hero::after {
    content: ""; position: absolute; inset: auto -10% -55% 40%; height: 380px;
    background: radial-gradient(closest-side, rgba(54, 209, 196, .18), transparent);
    pointer-events: none;
}
.catalog-hero-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 2rem; align-items: center; position: relative; z-index: 1; }
@media (max-width: 900px) { .catalog-hero-grid { grid-template-columns: 1fr; } }
.catalog-hero-copy h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); color: #fff; margin: 0 0 .5rem; letter-spacing: -.03em; }
.catalog-hero-copy .lead { color: #b9c5e4; max-width: 52ch; margin-bottom: 1.3rem; }
.catalog-hero .eyebrow { background: rgba(255, 255, 255, .1); color: #dfe6ff; }
.catalog-search {
    display: flex; align-items: center; gap: .5rem; background: #fff;
    border-radius: 16px; padding: .4rem .45rem .4rem .9rem; max-width: 560px;
    box-shadow: 0 26px 60px -30px rgba(0, 0, 0, .8);
}
html[dir="rtl"] .catalog-search { padding: .4rem .9rem .4rem .45rem; }
.catalog-search-icon { color: var(--muted); display: inline-flex; }
.catalog-search .input { border: 0; box-shadow: none; padding-inline-start: .4rem; font-size: .9rem; }
.catalog-search .input:focus { box-shadow: none; }
.catalog-search .btn { border-radius: 12px; }
.catalog-pills { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1.2rem; }
.pill {
    display: inline-flex; align-items: center; gap: .4rem;
    border: 1px solid rgba(255, 255, 255, .14); color: #d5ddf5;
    background: rgba(255, 255, 255, .05); border-radius: 999px;
    padding: .28rem .8rem; font-size: .78rem; transition: .15s;
}
.pill span { font-size: .68rem; color: #98a6cc; }
.pill:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.pill.is-active { background: #fff; color: #101b3c; border-color: #fff; font-weight: 700; }
.pill.is-active span { color: #5a6a94; }

.catalog-hero-panel {
    background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 22px; padding: 1.1rem; backdrop-filter: blur(6px);
}
.catalog-hero-stat { display: flex; align-items: center; gap: .7rem; margin-bottom: .9rem; }
.catalog-hero-stat .stat-icon { background: rgba(255, 255, 255, .12); color: #fff; }
.catalog-hero-stat strong { display: block; font-size: 1.5rem; color: #fff; line-height: 1.2; }
.catalog-hero-stat span { font-size: .8rem; color: #a9b6d8; }
.catalog-hero-art { background: rgba(8, 13, 30, .35); border: 1px solid rgba(255, 255, 255, .08); border-radius: 16px; padding: .9rem; }
.catalog-art-line { height: 7px; border-radius: 99px; background: rgba(255, 255, 255, .14); margin-bottom: .45rem; }
.catalog-art-line.w-70 { width: 70%; } .catalog-art-line.w-90 { width: 90%; } .catalog-art-line.w-50 { width: 50%; }
.catalog-art-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin-top: .8rem; }
.catalog-art-card { height: 52px; border-radius: 8px; background: linear-gradient(160deg, rgba(59, 91, 255, .55), rgba(123, 92, 255, .25)); }
.catalog-art-card:nth-child(2) { background: linear-gradient(160deg, rgba(54, 209, 196, .5), rgba(59, 91, 255, .25)); }
.catalog-art-card:nth-child(3) { background: linear-gradient(160deg, rgba(245, 192, 90, .45), rgba(123, 92, 255, .25)); }
.catalog-hero-note { display: flex; align-items: center; gap: .4rem; font-size: .74rem; color: #a9b6d8; margin-top: .85rem; }

.catalog-body { padding: 1.8rem 0 3rem; }
.catalog-layout { display: grid; grid-template-columns: 272px 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .catalog-layout { grid-template-columns: 1fr; } }
.filter-card { position: sticky; top: calc(var(--topbar) + 14px); border-radius: var(--radius); }
.filter-card .field { margin-bottom: .2rem; }
.catalog-results { min-width: 0; }
.catalog-toolbar { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.catalog-toolbar strong { font-size: 1.02rem; }
.course-grid { align-items: stretch; }

.course-tile {
    background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
    overflow: hidden; display: flex; flex-direction: column; height: 100%;
    box-shadow: var(--shadow-sm); transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}
.course-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.course-cover { position: relative; display: block; aspect-ratio: 16 / 9.6; overflow: hidden; background: var(--surface-3); }
.course-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.course-tile:hover .course-cover img { transform: scale(1.045); }
.course-cover-shade {
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(9, 15, 33, .05) 40%, rgba(9, 15, 33, .62));
}
.course-cat {
    position: absolute; inset-block-start: .7rem; inset-inline-start: .7rem;
    background: rgba(255, 255, 255, .94); color: #1a2442; font-size: .7rem; font-weight: 700;
    padding: .18rem .6rem; border-radius: 999px; backdrop-filter: blur(4px);
}
.course-delivery {
    position: absolute; inset-block-end: .7rem; inset-inline-start: .7rem;
    display: inline-flex; align-items: center; gap: .3rem;
    background: rgba(8, 13, 30, .55); color: #fff; font-size: .7rem; font-weight: 600;
    padding: .18rem .55rem; border-radius: 999px; backdrop-filter: blur(4px);
}
.course-tile-body { padding: .95rem 1rem 1.05rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.course-tile-topline { display: flex; align-items: center; gap: .4rem; }
.course-tile-title { margin: 0; font-size: .98rem; line-height: 1.65; font-weight: 700; }
.course-tile-title a { color: var(--text); }
.course-tile-title a:hover { color: var(--brand); }
.course-tile-summary { margin: 0; font-size: .81rem; color: var(--muted); line-height: 1.8; min-height: 2.6em; }
.course-team { display: flex; align-items: center; gap: .45rem; font-size: .78rem; min-height: 30px; }
.course-team-name { color: var(--text-2); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 16ch; }
.team-count {
    margin-inline-start: auto; font-size: .68rem; font-weight: 700;
    background: var(--brand-50); color: var(--brand); border-radius: 999px; padding: 0 .45rem;
}
.course-meta { display: flex; flex-wrap: wrap; gap: .3rem .75rem; font-size: .74rem; color: var(--muted); }
.course-meta span { display: inline-flex; align-items: center; gap: .25rem; }
.course-tile-foot {
    margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    padding-top: .75rem; border-top: 1px solid var(--border);
}
.price { font-weight: 800; color: var(--text); display: inline-flex; align-items: baseline; gap: .25rem; }
.price .old { font-size: .74rem; color: var(--muted); text-decoration: line-through; font-weight: 400; margin-inline-start: .3rem; }
.price.free { color: var(--success); }
.buy-price { display: flex; align-items: baseline; gap: .4rem; font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }

/* Course detail */
.course-hero {
    background:
        radial-gradient(800px 360px at 85% 0%, var(--brand-50), transparent 60%),
        linear-gradient(180deg, var(--surface-2), var(--surface));
    border-bottom: 1px solid var(--border);
    padding: 1.2rem 0 2rem;
}
html[data-theme="dark"] .course-hero {
    background: radial-gradient(800px 360px at 85% 0%, #16214a, transparent 60%), linear-gradient(180deg, #0b1224, var(--surface));
}
.course-hero-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 2.2rem; align-items: center; }
@media (max-width: 900px) { .course-hero-grid { grid-template-columns: 1fr; } }
.course-hero-copy h1 { font-size: clamp(1.55rem, 3.2vw, 2.3rem); margin: .7rem 0 .5rem; letter-spacing: -.03em; }
.course-hero-copy .lead { color: var(--muted); font-size: .95rem; max-width: 56ch; }
.course-hero-team {
    display: flex; align-items: center; gap: .8rem; margin-top: .9rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    padding: .55rem .8rem; width: fit-content; box-shadow: var(--shadow-sm);
}
.course-hero-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; margin-top: 1.1rem; font-size: .83rem; color: var(--text-2); }
.course-hero-meta span { display: inline-flex; align-items: center; gap: .35rem; }
.course-hero-cover { border-radius: 22px; overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.course-hero-cover img { width: 100%; aspect-ratio: 16 / 11; object-fit: cover; }
.course-detail { display: grid; grid-template-columns: 1fr 350px; gap: 1.5rem; align-items: start; margin-top: 1.6rem; }
@media (max-width: 960px) { .course-detail { grid-template-columns: 1fr; } }
.buy-box { position: sticky; top: calc(var(--topbar) + 14px); }
.teacher-list { display: grid; gap: .75rem; }
.teacher-card {
    display: flex; align-items: flex-start; gap: .85rem; padding: .85rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.teacher-card .avatar { flex: 0 0 auto; }
.teacher-subject { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--brand); margin-top: .15rem; }

.rich { line-height: 2; color: var(--text-2); font-size: .9rem; }
.rich p { margin-bottom: .8rem; }
.rich ul, .rich ol { padding-inline-start: 1.4rem; }
.accordion { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); }
.accordion + .accordion { margin-top: .55rem; }
.accordion summary {
    cursor: pointer; padding: .78rem 1rem; background: var(--surface-2);
    font-weight: 600; font-size: .88rem; display: flex; align-items: center; gap: .5rem;
    list-style: none;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary .spacer { margin-inline-start: auto; }
.accordion summary::after {
    content: "+"; margin-inline-start: auto; font-size: 1rem; color: var(--muted);
    transition: transform .15s; width: 1rem; text-align: center;
}
.accordion[open] summary::after { content: "−"; }
.accordion[open] summary { border-bottom: 1px solid var(--border); }
.lesson-row {
    display: flex; align-items: center; justify-content: space-between; gap: .6rem;
    padding: .62rem 1rem; border-bottom: 1px solid var(--border); font-size: .85rem;
}
.lesson-row:last-child { border-bottom: 0; }
.lesson-row:hover { background: var(--surface-2); }
.lesson-row .idx { color: var(--muted); font-size: .75rem; min-width: 22px; }
.lesson-row .meta { margin-inline-start: auto; font-size: .74rem; color: var(--muted); display: flex; gap: .5rem; align-items: center; }

/* ---------------------------------------------------------------------
   Learning / exam
   --------------------------------------------------------------------- */
.learn-layout { display: grid; grid-template-columns: 305px 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 980px) { .learn-layout { grid-template-columns: 1fr; } }
.learn-side { position: sticky; top: calc(var(--topbar) + 12px); max-height: calc(100vh - 110px); overflow-y: auto; }
.video-frame { aspect-ratio: 16 / 9; background: #0b1020; border-radius: 14px; overflow: hidden; display: grid; place-items: center; color: #94a3b8; }
.video-frame iframe, .video-frame video { width: 100%; height: 100%; border: 0; }
.lesson-link { display: flex; gap: .5rem; align-items: center; padding: .55rem .8rem; font-size: .82rem; color: var(--text-2); border-radius: 9px; }
.lesson-link:hover { background: var(--surface-2); }
.lesson-link.active { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.lesson-link .done { color: var(--success); }

.exam-body { background: var(--bg); }
.exam-shell { max-width: 880px; margin-inline: auto; padding: 1.2rem; }
.exam-timer {
    position: sticky; top: 0; z-index: 20; background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; padding: .65rem 1rem; display: flex; align-items: center; gap: .6rem;
    margin-bottom: 1rem; box-shadow: var(--shadow);
}
.exam-timer .time { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.exam-timer.urgent .time { color: var(--danger); }
.question { border: 1px solid var(--border); border-radius: 14px; padding: 1rem 1.1rem; margin-bottom: .9rem; background: var(--surface); box-shadow: var(--shadow-sm); }
.question .q-head { display: flex; gap: .6rem; align-items: flex-start; margin-bottom: .7rem; }
.question .q-no { background: var(--brand-50); color: var(--brand); font-weight: 700; font-size: .75rem; border-radius: 8px; padding: .1rem .5rem; }
.question .q-score { margin-inline-start: auto; font-size: .72rem; color: var(--muted); white-space: nowrap; }
.option { display: flex; gap: .55rem; align-items: flex-start; border: 1px solid var(--border); border-radius: 11px; padding: .55rem .75rem; margin-bottom: .45rem; cursor: pointer; font-size: .86rem; transition: .12s; }
.option:hover { border-color: var(--brand-100); background: var(--surface-2); }
.option input { margin-top: .3rem; accent-color: var(--brand); }
.option.correct { border-color: color-mix(in srgb, var(--success) 45%, transparent); background: var(--success-bg); }
.option.wrong { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: var(--danger-bg); }

/* ---------------------------------------------------------------------
   Auth
   --------------------------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); }
.auth-side {
    background:
        radial-gradient(500px 300px at 80% 10%, rgba(54, 209, 196, .28), transparent 60%),
        linear-gradient(155deg, #0b1533, #2536a8 55%, #6a4cff);
    color: #dbe3ff; padding: 3rem; display: flex; flex-direction: column; justify-content: center; gap: 1.2rem;
    position: relative; overflow: hidden;
}
.auth-side::after {
    content: ""; position: absolute; inset: auto -80px -120px auto; width: 340px; height: 340px;
    border-radius: 50%; background: rgba(255, 255, 255, .08);
}
.auth-side h2 { color: #fff; font-size: 1.65rem; line-height: 1.5; }
.auth-side ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; font-size: .9rem; }
.auth-side li { display: flex; gap: .5rem; align-items: center; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem 1.2rem; }
.auth-card { width: min(440px, 100%); }
.auth-card h1 { font-size: 1.5rem; margin-bottom: .25rem; }
.auth-card .sub { color: var(--muted); font-size: .87rem; margin-bottom: 1.4rem; }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } }
.auth-tabs { display: flex; background: var(--surface-2); padding: .28rem; border-radius: 12px; margin-bottom: 1.1rem; gap: .25rem; }
.auth-tabs button { flex: 1; padding: .45rem; border: 0; background: none; border-radius: 9px; font-family: inherit; font-size: .82rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.auth-tabs button.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }

/* ---------- App-style authentication ---------- */
.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2.5rem 1rem;
    background:
        radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 34rem),
        radial-gradient(circle at 85% 90%, color-mix(in srgb, var(--accent, #7c3aed) 13%, transparent), transparent 30rem),
        var(--surface-2);
}
.auth-theme { position: fixed; top: 1rem; left: 1rem; z-index: 5; }
.auth-app { width: min(440px, 100%); display: grid; gap: 1rem; }
.auth-app-brand { display: flex; align-items: center; justify-content: center; gap: .55rem; font-weight: 800; font-size: 1.05rem; }
.auth-app-brand img { height: 34px; width: auto; }
.auth-app-brand .logo-mark { width: 34px; height: 34px; font-size: 1rem; }
.auth-app-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .12);
    padding: 1.6rem 1.4rem;
    overflow: hidden;
}
.auth-app-card > .alert { margin-bottom: 1rem; }
.auth-screen-head { text-align: center; margin-bottom: 1.35rem; }
.auth-screen-icon {
    width: 54px; height: 54px; border-radius: 18px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-50); color: var(--brand); margin-bottom: .75rem;
}
.auth-screen-icon .icon { width: 25px; height: 25px; }
.auth-screen-head h1 { font-size: 1.35rem; margin: 0 0 .3rem; }
.auth-screen-head p { color: var(--muted); font-size: .84rem; margin: 0; line-height: 1.8; }
.auth-input { border-radius: 14px; min-height: 48px; background: var(--surface-2); }
.auth-submit { border-radius: 14px; min-height: 48px; font-size: .95rem; margin-top: .45rem; }
.auth-inline { display: flex; justify-content: flex-end; margin: -.2rem 0 .4rem; font-size: .8rem; }
.auth-inline a, .auth-app-alt a { color: var(--brand); font-weight: 700; }
.auth-note {
    display: flex; gap: .55rem; align-items: flex-start;
    padding: .8rem .9rem; border-radius: 14px;
    background: var(--info-50, var(--brand-50)); color: var(--text);
    font-size: .84rem; line-height: 1.8; margin-bottom: 1rem;
}
.auth-note .icon { color: var(--brand); flex: 0 0 auto; }
.auth-terms { align-items: flex-start; line-height: 1.7; margin: .35rem 0 .7rem; font-size: .82rem; }
.auth-app-alt { margin-top: 1.15rem; text-align: center; font-size: .84rem; color: var(--muted); display: flex; gap: .35rem; justify-content: center; flex-wrap: wrap; }
.auth-catalog-link { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; color: var(--muted); font-size: .82rem; }
.auth-catalog-link:hover { color: var(--brand); }
.auth-app .auth-tabs { margin-bottom: 1.1rem; }
@media (max-width: 520px) {
    .auth-body { padding: 1.25rem .75rem; align-items: start; }
    .auth-app { margin-top: 1.2rem; }
    .auth-app-card { border-radius: 24px; padding: 1.35rem 1.05rem; }
    .auth-theme { top: .6rem; left: .6rem; }
}
.otp-input { letter-spacing: .5em; text-align: center; font-size: 1.2rem; font-weight: 700; direction: ltr; }

/* ---------------------------------------------------------------------
   Certificate
   --------------------------------------------------------------------- */
.cert-frame {
    border: 12px solid var(--brand-50); border-radius: 20px; padding: clamp(1.4rem, 4vw, 3rem); background:
        radial-gradient(circle at 10% 10%, #f5f3ff 0, transparent 55%),
        radial-gradient(circle at 90% 90%, #ecfeff 0, transparent 55%), #fff;
    text-align: center; position: relative;
}
.cert-frame .cert-mark { width: 62px; height: 62px; margin: 0 auto .8rem; border-radius: 50%; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.cert-title { text-align: center; margin-top: 1.2rem; }
.cert-frame h1 { font-size: clamp(1.3rem, 3vw, 2rem); margin-bottom: .2rem; }
.stamp {
    width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center;
    border: 2px dashed var(--brand-100); color: var(--brand); background: var(--brand-50);
    font-size: .68rem; font-weight: 700; text-align: center; padding: .6rem; line-height: 1.5;
}
.cert-frame .cert-name { font-size: clamp(1.3rem, 3.4vw, 2.1rem); font-weight: 800; margin: 1rem 0 .4rem; color: var(--brand-dark); }
.cert-frame .cert-course { font-size: clamp(1rem, 2.2vw, 1.3rem); font-weight: 700; }
.cert-meta { display: flex; justify-content: center; gap: 2rem; flex-wrap: wrap; margin-top: 1.6rem; font-size: .8rem; color: var(--muted); }
.cert-meta strong { display: block; color: var(--text); font-size: .85rem; }
.cert-code { margin-top: 1.4rem; display: inline-flex; gap: .5rem; align-items: center; font-size: .8rem; background: var(--surface-2); border: 1px dashed var(--border-strong); padding: .4rem .8rem; border-radius: 10px; }
.cert-sign { display: flex; justify-content: space-around; margin-top: 2rem; gap: 1rem; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }
.cert-sign .line { border-top: 1px solid var(--border-strong); padding-top: .4rem; min-width: 150px; }

/* ---------------------------------------------------------------------
   Chat & tickets
   --------------------------------------------------------------------- */
.chat { display: flex; flex-direction: column; gap: .6rem; max-height: 520px; overflow-y: auto; padding: .3rem; }
.bubble { max-width: 78%; padding: .65rem .85rem; border-radius: 14px; font-size: .85rem; background: var(--surface-2); border: 1px solid var(--border); }
.bubble .meta { font-size: .68rem; color: var(--muted); margin-top: .25rem; }
.bubble.me { margin-inline-start: auto; background: var(--brand-50); border-color: var(--brand-100); }
.bubble.staff { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 22%, transparent); }
.chat-form { display: flex; gap: .5rem; margin-top: .8rem; align-items: flex-end; }
.chat-form .textarea { min-height: 46px; }
.ticket-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---------------------------------------------------------------------
   Print
   --------------------------------------------------------------------- */
.print-body { background: #fff; }
.print-toolbar { display: flex; justify-content: flex-end; gap: .5rem; padding: 1rem; }
.print-sheet { width: min(1000px, 100%); margin-inline: auto; padding: 1.5rem; background: #fff; }
.invoice-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.invoice-table th, .invoice-table td { padding: .55rem .7rem; border-bottom: 1px solid var(--border); text-align: start; }
.invoice-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.invoice-total { margin-top: 1rem; display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; }
.invoice-total > div { display: flex; justify-content: space-between; gap: 2rem; min-width: 260px; font-size: .86rem; color: var(--muted); }
.invoice-total > .grand { border-top: 1px solid var(--border); margin-top: .25rem; padding-top: .45rem; color: var(--text); font-weight: 700; }
.invoice-total table { min-width: 260px; }
@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
    .print-sheet { padding: 0; }
}

/* Instructor choice on course / checkout pages */
.teacher-choice { display: grid; gap: .5rem; margin-top: .3rem; }
.teacher-option {
    display: flex; align-items: center; gap: .6rem; padding: .55rem .65rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s;
}
.teacher-option:hover { border-color: var(--brand-100); }
.teacher-option:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }
.teacher-option input { accent-color: var(--brand); margin: 0; }
.teacher-option strong, .teacher-option small { display: block; line-height: 1.45; }
.teacher-option small { font-size: .76rem; }
.teacher-option.is-static { cursor: default; margin-bottom: .6rem; }
.input-sm { min-height: 34px; padding: .35rem .55rem; font-size: .8rem; }

/* ---------- Simple course editor ---------- */
.course-editor { padding-bottom: 5.5rem; }
.course-details {
    margin-top: .9rem;
    border: 1px dashed var(--border);
    border-radius: 14px;
    padding: .15rem .9rem .9rem;
    background: var(--surface-2);
}
.course-details > summary {
    cursor: pointer;
    padding: .75rem 0;
    font-weight: 700;
    font-size: .86rem;
    list-style: none;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.course-details > summary::-webkit-details-marker { display: none; }
.course-details > summary::before { content: '+'; color: var(--brand); font-weight: 800; }
.course-details[open] > summary::before { content: '−'; }
.course-details .form-grid { margin-top: .15rem; }
.course-savebar {
    position: sticky;
    bottom: .75rem;
    z-index: 25;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding: .75rem .9rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 30px rgba(15, 23, 42, .10);
}
.course-savebar .hstack { gap: .45rem; }
.course-quick-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
@media (max-width: 620px) {
    .course-savebar { bottom: .35rem; }
    .course-savebar > .text-sm { display: none; }
    .course-savebar .hstack { width: 100%; }
    .course-savebar .btn { flex: 1; }
}

/* ---------- Independent offerings, file manager, mobile fixes ---------- */
.catalog-filter-toggle { display: none; }
.offering-list { display: grid; gap: .8rem; }
.offering-card { border: 1px solid var(--border); border-radius: 16px; padding: .9rem; background: var(--surface); }
.offering-person { display: flex; align-items: flex-start; gap: .65rem; }
.offering-meta { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .35rem; color: var(--muted); font-size: .8rem; }
.offering-meta span { display: inline-flex; align-items: center; gap: .25rem; }
.offering-foot { display: flex; align-items: center; justify-content: space-between; gap: .7rem; flex-wrap: wrap; margin-top: .7rem; padding-top: .65rem; border-top: 1px solid var(--border); }
.offering-picker { display: grid; gap: .5rem; }
.offering-pick { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .55rem .65rem; border: 1px solid var(--border); border-radius: 12px; flex-wrap: wrap; }
.offering-pick small { display: block; }
.offering-catalog { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.offering-catalog-card { padding: 1rem; }
.offering-cover { width: 104px; height: 72px; object-fit: cover; border-radius: 10px; flex: 0 0 auto; }
.file-pick-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
.file-pick { display: flex; align-items: flex-start; gap: .45rem; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 10px; }
.file-pick small { display: block; margin-inline-start: 1.3rem; }
.offering-catalog .price strong { font-size: .95rem; }

@media (max-width: 900px) {
    .catalog-filter-toggle { display: flex; width: 100%; justify-content: center; margin-bottom: .7rem; }
    .catalog-layout { grid-template-columns: 1fr !important; }
    [data-filter-panel] { display: none; }
    [data-filter-panel].is-open { display: block; }
    .offering-catalog { grid-template-columns: 1fr; }
    .course-detail { grid-template-columns: minmax(0, 1fr) !important; }
    .buy-box { position: static; }
    .course-hero-cover img { max-width: 100%; }
    .course-hero-grid { gap: 1.2rem; }
    .course-hero-copy h1 { overflow-wrap: anywhere; }
    .course-hero-cover { order: -1; }
    .course-hero-cover img { width: 100%; max-height: 320px; object-fit: cover; border-radius: 18px; }
}
@media (max-width: 680px) {
    .site-header .inner { gap: .5rem; padding: .55rem 0; }
    .site-nav { display: none; }
    .site-cta { margin-inline-start: auto; gap: .3rem; }
    .site-cta .theme-toggle { display: none; }
    .site-cta .btn { padding: .4rem .6rem; font-size: .78rem; }
    .site-header .brand span { max-width: 128px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .course-hero-copy h1 { font-size: 1.45rem; line-height: 1.6; }
    .course-hero-meta { flex-wrap: wrap; gap: .45rem .8rem; }
    .course-hero-team { flex-wrap: wrap; }
    .course-detail { gap: 1rem; }
    .course-detail .card { max-width: 100%; overflow: hidden; }
    .course-detail .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .course-detail .table { min-width: 520px; }
    .teacher-card, .team-card { align-items: flex-start; }
    .teacher-card .avatar.lg { width: 44px; height: 44px; }
    .buy-box .card-body { padding: .9rem; }
    .buy-box .btn { width: 100%; }
    .file-pick-list { grid-template-columns: 1fr; }
    .offering-cover { width: 78px; height: 58px; }
    .offering-foot .btn, .offering-pick .btn { flex: 1; }
}

/* Mobile public header menu */
.site-menu-toggle {
    display: none; width: 38px; height: 38px; border: 1px solid var(--border);
    border-radius: 10px; background: var(--surface); padding: 9px 8px;
    flex-direction: column; justify-content: space-between; cursor: pointer;
}
.site-menu-toggle span { display: block; height: 2px; width: 100%; background: var(--text); border-radius: 2px; }
@media (max-width: 900px) {
    .site-header .inner { position: relative; }
    .site-menu-toggle { display: flex; }
    .site-nav {
        display: none; position: absolute; top: calc(100% + .35rem); inset-inline: 1rem;
        z-index: 60; flex-direction: column; align-items: stretch; gap: .2rem;
        padding: .6rem; background: var(--surface); border: 1px solid var(--border);
        border-radius: 14px; box-shadow: var(--shadow-lg); margin: 0;
    }
    .site-nav.is-open { display: flex; }
    .site-nav a { padding: .6rem .7rem; }
}
@media (max-width: 680px) {
    .site-cta .site-menu-toggle { display: flex; }
}
