/* ==========================================================================
   MeiQ Genius — design system
   Classic editorial look: warm paper background, deep navy, muted gold accent,
   serif display headings over a neutral UI sans. Type is deliberately mid-scale
   — nothing shouts, nothing strains the eye.
   ========================================================================== */

/* --- Tokens --------------------------------------------------------------- */
:root {
    /* Palette — light (default) */
    --bg: #faf8f4;
    --bg-alt: #f3efe7;
    --surface: #ffffff;
    --surface-2: #f7f4ee;
    --surface-3: #efeae0;
    --line: #e3ddd1;
    --line-strong: #d3cbba;

    --ink: #17212f;
    --ink-soft: #414d61;
    --muted: #6d7889;

    --brand: #1b2a4a;
    --brand-soft: #e8ecf4;
    --brand-hover: #24365d;
    --gold: #a8792f;
    --gold-soft: #f5ecda;
    --gold-line: #e3d2ae;

    --success: #2c7355;
    --success-soft: #e4f1ea;
    --warning: #9a6c14;
    --warning-soft: #fbf0d9;
    --danger: #a93b2c;
    --danger-soft: #f8e6e2;

    --btn-primary-bg: var(--brand);
    --btn-primary-fg: #ffffff;
    --btn-primary-hover: var(--brand-hover);

    /* Typography */
    --font-display: "Playfair Display", "Georgia", "Times New Roman", serif;
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SFMono-Regular", ui-monospace, "Cascadia Mono", Consolas, monospace;

    --fs-xs: 0.75rem;      /* 12px */
    --fs-sm: 0.8125rem;    /* 13px */
    --fs-base: 0.9375rem;  /* 15px */
    --fs-md: 1rem;         /* 16px */
    --fs-lg: 1.125rem;     /* 18px */
    --fs-xl: 1.3125rem;    /* 21px */
    --fs-2xl: 1.5rem;      /* 24px */
    --fs-3xl: 1.875rem;    /* 30px */
    --fs-display: clamp(1.875rem, 1.35rem + 2.2vw, 2.625rem); /* 30–42px */

    --lh-tight: 1.22;
    --lh-snug: 1.4;
    --lh-normal: 1.62;

    /* Space / shape */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 24px;
    --sp-6: 32px;
    --sp-7: 48px;
    --sp-8: 64px;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(23, 33, 47, 0.06);
    --shadow: 0 4px 16px rgba(23, 33, 47, 0.07);
    --shadow-lg: 0 18px 46px rgba(23, 33, 47, 0.14);

    --container: 1180px;
    --sidebar-w: 244px;
    --header-h: 68px;

    --transition: 160ms ease;
}

[data-theme="dark"] {
    --bg: #0f141c;
    --bg-alt: #141a24;
    --surface: #171e29;
    --surface-2: #1d2531;
    --surface-3: #242d3b;
    --line: #2a3341;
    --line-strong: #384354;

    --ink: #e9edf4;
    --ink-soft: #b9c2d0;
    --muted: #8b95a6;

    --brand: #4a6ba8;
    --brand-soft: #1e2836;
    --brand-hover: #5a7cbd;
    --gold: #d3a75f;
    --gold-soft: #2a2317;
    --gold-line: #4a3d24;

    --success: #5cb98d;
    --success-soft: #16281f;
    --warning: #d9a94a;
    --warning-soft: #2a2113;
    --danger: #e08272;
    --danger-soft: #2c1a17;

    --btn-primary-bg: var(--gold);
    --btn-primary-fg: #17212f;
    --btn-primary-hover: #e0b774;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 18px 46px rgba(0, 0, 0, 0.55);
}

/* --- Reset ---------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: var(--lh-normal);
    color: var(--ink-soft);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

img, svg, video { display: block; max-width: 100%; }
img, video { height: auto; }

a {
    color: var(--brand);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover { color: var(--gold); }

button, input, select, textarea { font: inherit; color: inherit; }

ul, ol { padding-left: 1.15rem; }

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: var(--sp-5) 0;
}

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
    border-radius: 3px;
}

::selection { background: var(--gold-soft); color: var(--ink); }

/* --- Typography ----------------------------------------------------------- */
h1, h2, h3, h4, h5 {
    font-family: var(--font-display);
    color: var(--ink);
    line-height: var(--lh-tight);
    font-weight: 600;
    letter-spacing: -0.005em;
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
h5 { font-size: var(--fs-md); }

p { line-height: var(--lh-normal); }

.display {
    font-size: var(--fs-display);
    line-height: 1.14;
    letter-spacing: -0.015em;
}

.lead {
    font-size: var(--fs-md);
    color: var(--ink-soft);
    line-height: 1.7;
}

.eyebrow {
    display: inline-block;
    font-family: var(--font-body);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold);
}

.text-muted { color: var(--muted); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.strong { font-weight: 600; color: var(--ink); }
.mono { font-family: var(--font-mono); font-size: var(--fs-xs); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.clamp-3 { -webkit-line-clamp: 3; line-clamp: 3; }

/* --- Layout --------------------------------------------------------------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--sp-5);
}
.container-narrow { max-width: 780px; }

.section { padding-block: var(--sp-8); }
.section-tight { padding-block: var(--sp-7); }
.section-alt { background: var(--bg-alt); }

.section-head {
    max-width: 620px;
    margin-bottom: var(--sp-6);
}
.section-head.centered { margin-inline: auto; text-align: center; }
.section-head h2 { margin-block: var(--sp-2); }
.section-head p { color: var(--muted); }

.stack > * + * { margin-top: var(--sp-4); }
.stack-sm > * + * { margin-top: var(--sp-2); }
.stack-lg > * + * { margin-top: var(--sp-5); }

.row {
    display: flex;
    gap: var(--sp-3);
    align-items: center;
    flex-wrap: wrap;
}
.row-between { justify-content: space-between; }
.row-end { justify-content: flex-end; }
.row-top { align-items: flex-start; }
.row-tight { gap: var(--sp-2); }
.spacer { flex: 1 1 auto; }

.grid { display: grid; gap: var(--sp-5); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.divider {
    height: 1px;
    background: var(--line);
    margin-block: var(--sp-5);
}

/* --- Site header ---------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 900;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--line);
}

.site-header .container {
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: var(--sp-5);
}

.brand {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    font-family: var(--font-display);
    font-size: var(--fs-xl);
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.02em;
    white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand-mark { color: var(--gold); }
.brand-sub {
    font-family: var(--font-body);
    font-size: var(--fs-xs);
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: var(--sp-5);
    margin-left: auto;
}

.site-nav a:not(.btn) {
    font-size: var(--fs-base);
    font-weight: 500;
    color: var(--ink-soft);
    padding-block: var(--sp-2);
    position: relative;
}
.site-nav a:not(.btn)::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1.5px;
    background: var(--gold);
    transform: scaleX(0);
    transition: transform var(--transition);
}
.site-nav a:not(.btn):hover::after,
.site-nav a.is-active::after { transform: scaleX(1); }
.site-nav a.is-active { color: var(--ink); }

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 6px 9px;
    cursor: pointer;
    color: var(--ink);
    margin-left: auto;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-pill);
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    color: var(--ink-soft);
    transition: border-color var(--transition), color var(--transition);
}
.theme-toggle:hover { border-color: var(--gold); color: var(--gold); }

/* --- Buttons -------------------------------------------------------------- */
.btn {
    --btn-bg: transparent;
    --btn-fg: var(--ink);
    --btn-border: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1.15rem;
    font-family: var(--font-body);
    font-size: var(--fs-base);
    font-weight: 600;
    line-height: 1.2;
    border-radius: var(--radius-sm);
    border: 1px solid var(--btn-border);
    background: var(--btn-bg);
    color: var(--btn-fg);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition),
        border-color var(--transition), transform var(--transition);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    --btn-bg: var(--btn-primary-bg);
    --btn-fg: var(--btn-primary-fg);
    --btn-border: var(--btn-primary-bg);
}
.btn-primary:hover {
    --btn-bg: var(--btn-primary-hover);
    --btn-border: var(--btn-primary-hover);
    color: var(--btn-primary-fg);
}

.btn-gold {
    --btn-bg: var(--gold);
    --btn-fg: #ffffff;
    --btn-border: var(--gold);
}
.btn-gold:hover { filter: brightness(1.07); color: #fff; }

.btn-outline {
    --btn-bg: transparent;
    --btn-fg: var(--ink);
    --btn-border: var(--line-strong);
}
.btn-outline:hover {
    --btn-border: var(--gold);
    --btn-fg: var(--gold);
}

.btn-ghost {
    --btn-fg: var(--ink-soft);
    padding-inline: 0.7rem;
}
.btn-ghost:hover { --btn-bg: var(--surface-2); --btn-fg: var(--ink); }

.btn-danger {
    --btn-bg: transparent;
    --btn-fg: var(--danger);
    --btn-border: color-mix(in srgb, var(--danger) 35%, transparent);
}
.btn-danger:hover {
    --btn-bg: var(--danger);
    --btn-fg: #fff;
    --btn-border: var(--danger);
}

.btn-sm { padding: 0.4rem 0.75rem; font-size: var(--fs-sm); }
.btn-lg { padding: 0.78rem 1.6rem; font-size: var(--fs-md); }
.btn-block { width: 100%; }
.btn-icon { padding: 0.42rem 0.55rem; }

/* --- Badges & pills -------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
    background: var(--surface-3);
    color: var(--ink-soft);
    white-space: nowrap;
}
.badge-gold { background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold-line); }
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-3);
    font-size: var(--fs-sm);
    color: var(--muted);
}
.meta > * { display: inline-flex; align-items: center; gap: 0.3rem; }
.meta-dot::before { content: "·"; margin-right: 0.3rem; }

/* --- Cards ---------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-pad { padding: var(--sp-5); }
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--line);
}
.card-head h3, .card-head h4 { margin: 0; }
.card-body { padding: var(--sp-5); }
.card-foot {
    padding: var(--sp-4) var(--sp-5);
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    border-radius: 0 0 var(--radius) var(--radius);
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--sp-5);
}
.stat-label {
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}
.stat-value {
    font-family: var(--font-display);
    font-size: var(--fs-3xl);
    font-weight: 600;
    color: var(--ink);
    line-height: 1.1;
    margin-top: var(--sp-2);
}
.stat-note { font-size: var(--fs-sm); color: var(--muted); margin-top: var(--sp-1); }

/* --- Course card ---------------------------------------------------------- */
.course-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition),
        transform var(--transition);
}
.course-card:hover {
    border-color: var(--gold-line);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.course-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: linear-gradient(140deg, var(--brand) 0%, #2f4570 60%, var(--gold) 160%);
    overflow: hidden;
}
.course-thumb img { width: 100%; height: 100%; object-fit: cover; }
.course-thumb-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: var(--fs-2xl);
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.04em;
    text-align: center;
    padding: var(--sp-4);
}
.course-thumb .badge {
    position: absolute;
    top: var(--sp-3);
    left: var(--sp-3);
    background: rgba(255, 255, 255, 0.94);
    color: var(--brand);
}

.course-card-body {
    padding: var(--sp-4) var(--sp-5);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    flex: 1;
}
.course-card-body h3 {
    font-size: var(--fs-lg);
    line-height: 1.32;
}
.course-card-body h3 a { color: var(--ink); }
.course-card-body h3 a:hover { color: var(--gold); }
.course-card-desc { font-size: var(--fs-sm); color: var(--muted); }

.course-card-foot {
    margin-top: auto;
    padding: var(--sp-3) var(--sp-5) var(--sp-4);
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Wrap instead of pushing the action button past the card's clipped edge. */
    flex-wrap: wrap;
    gap: var(--sp-2) var(--sp-3);
}
.course-card-foot .price { flex: 1 1 auto; min-width: 0; }
.course-card-foot .btn { flex: 0 0 auto; }

.price {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.15rem 0.45rem;
    font-family: var(--font-display);
    font-size: var(--fs-xl);
    font-weight: 600;
    color: var(--ink);
}
.price-mrp {
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    font-weight: 400;
    color: var(--muted);
    text-decoration: line-through;
    white-space: nowrap;
}
.price-off {
    font-family: var(--font-body);
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--success);
    white-space: nowrap;
}

/* --- Hero ----------------------------------------------------------------- */
.hero {
    position: relative;
    padding-block: var(--sp-8) var(--sp-8);
    background:
        radial-gradient(900px 420px at 12% -10%, var(--gold-soft), transparent 65%),
        radial-gradient(760px 380px at 92% 0%, var(--brand-soft), transparent 60%),
        var(--bg);
    border-bottom: 1px solid var(--line);
    overflow: hidden;
}
.hero-grid {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: var(--sp-8);
    align-items: center;
}
.hero-copy { max-width: 560px; }
.hero-copy .display { margin-block: var(--sp-3) var(--sp-4); }
.hero-copy .lead { margin-bottom: var(--sp-5); }
.hero-actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; }

.hero-proof {
    display: flex;
    gap: var(--sp-6);
    margin-top: var(--sp-6);
    padding-top: var(--sp-5);
    border-top: 1px solid var(--line);
}
.hero-proof strong {
    display: block;
    font-family: var(--font-display);
    font-size: var(--fs-2xl);
    color: var(--ink);
    line-height: 1.1;
}
.hero-proof span { font-size: var(--fs-sm); color: var(--muted); }

.hero-visual {
    position: relative;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-5);
}
.hero-visual::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    border-top: 3px solid var(--gold);
    pointer-events: none;
}
.hero-lesson {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) 0;
    border-bottom: 1px dashed var(--line);
}
.hero-lesson:last-child { border-bottom: 0; }
.hero-lesson-num {
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: var(--radius-pill);
    background: var(--brand-soft);
    color: var(--brand);
    display: grid;
    place-items: center;
    font-size: var(--fs-xs);
    font-weight: 700;
}
.hero-lesson-num.is-done { background: var(--success-soft); color: var(--success); }
.hero-lesson strong { font-size: var(--fs-base); color: var(--ink); font-weight: 500; }

/* --- Feature blocks ------------------------------------------------------- */
.feature {
    padding: var(--sp-5);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.feature-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: var(--gold-soft);
    color: var(--gold);
    display: grid;
    place-items: center;
    font-size: var(--fs-lg);
    margin-bottom: var(--sp-4);
}
.feature h3 { font-size: var(--fs-lg); margin-bottom: var(--sp-2); }
.feature p { font-size: var(--fs-sm); color: var(--muted); }

.step-num {
    font-family: var(--font-display);
    font-size: var(--fs-2xl);
    color: var(--gold);
    line-height: 1;
}

.quote {
    padding: var(--sp-5);
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius);
}
.quote p {
    font-family: var(--font-display);
    font-size: var(--fs-md);
    font-style: italic;
    color: var(--ink);
    line-height: 1.6;
}
.quote footer {
    margin-top: var(--sp-4);
    font-size: var(--fs-sm);
    color: var(--muted);
}
.quote footer strong { color: var(--ink); display: block; font-weight: 600; }

/* --- Forms ---------------------------------------------------------------- */
.field { display: block; margin-bottom: var(--sp-4); }
.field:last-child { margin-bottom: 0; }

.label {
    display: block;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--ink);
    margin-bottom: var(--sp-2);
}
.label .req { color: var(--danger); }

.hint {
    display: block;
    font-size: var(--fs-xs);
    color: var(--muted);
    margin-top: var(--sp-2);
    line-height: 1.5;
}

.input,
.select,
.textarea {
    width: 100%;
    padding: 0.62rem 0.8rem;
    font-size: var(--fs-base);
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-soft);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.6; }

.select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 17px) calc(50% + 1px), calc(100% - 12px) calc(50% + 1px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 2.2rem;
}

.input-file {
    width: 100%;
    padding: 0.5rem;
    font-size: var(--fs-sm);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    cursor: pointer;
}
.input-file::file-selector-button {
    margin-right: var(--sp-3);
    padding: 0.35rem 0.75rem;
    font-size: var(--fs-sm);
    font-weight: 600;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
}

.input-group { display: flex; gap: var(--sp-2); }
.input-group .input { flex: 1; }

.check {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    font-size: var(--fs-sm);
    color: var(--ink-soft);
    cursor: pointer;
    padding: var(--sp-1) 0;
}
.check input[type="checkbox"],
.check input[type="radio"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--gold);
    flex: none;
    cursor: pointer;
}
.check-boxed {
    padding: var(--sp-3) var(--sp-4);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
}
.check-boxed:has(input:checked) {
    border-color: var(--gold);
    background: var(--gold-soft);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--sp-4);
}
.form-grid .field { margin-bottom: 0; }
.form-actions {
    display: flex;
    gap: var(--sp-3);
    align-items: center;
    flex-wrap: wrap;
    margin-top: var(--sp-5);
    padding-top: var(--sp-5);
    border-top: 1px solid var(--line);
}

/* --- Filter bar ----------------------------------------------------------- */
.filter-bar {
    display: flex;
    gap: var(--sp-3);
    align-items: center;
    flex-wrap: wrap;
    padding: var(--sp-4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: var(--sp-5);
}
.filter-bar .input { flex: 1 1 220px; }
.filter-bar .select { flex: 0 1 180px; }

.chip-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.chip {
    display: inline-block;
    padding: 0.32rem 0.8rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: var(--fs-sm);
    font-weight: 500;
    transition: all var(--transition);
}
.chip:hover { border-color: var(--gold); color: var(--gold); }
.chip.is-active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
[data-theme="dark"] .chip.is-active { color: #fff; }

/* --- Tables --------------------------------------------------------------- */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-sm);
    min-width: 640px;
}
.table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .cell-strong { color: var(--ink); font-weight: 600; }
.table .cell-actions { text-align: right; white-space: nowrap; }

/* --- Alerts / flash ------------------------------------------------------- */
.flash-stack {
    position: fixed;
    top: calc(var(--header-h) + 12px);
    right: 20px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    max-width: 380px;
    width: calc(100% - 40px);
    pointer-events: none;
}
.flash {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: 0.75rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 3px solid var(--muted);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    font-size: var(--fs-sm);
    color: var(--ink);
    animation: flash-in 220ms ease both;
}
.flash.is-leaving { animation: flash-out 200ms ease both; }
.flash-success { border-left-color: var(--success); }
.flash-error { border-left-color: var(--danger); }
.flash-warning { border-left-color: var(--warning); }
.flash-info { border-left-color: var(--brand); }
.flash-close {
    margin-left: auto;
    background: none;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    font-size: var(--fs-md);
    line-height: 1;
    padding: 0 2px;
}
.flash-close:hover { color: var(--ink); }

@keyframes flash-in {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: none; }
}
@keyframes flash-out {
    to { opacity: 0; transform: translateX(16px); }
}

.alert {
    display: flex;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface-2);
    font-size: var(--fs-sm);
    color: var(--ink-soft);
}
.alert-warning { background: var(--warning-soft); border-color: var(--warning); color: var(--warning); }
.alert-danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.alert-success { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.alert strong { display: block; margin-bottom: 2px; }

/* --- Empty state ---------------------------------------------------------- */
.empty {
    text-align: center;
    padding: var(--sp-8) var(--sp-5);
    background: var(--surface);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
}
.empty-icon { font-size: 2rem; margin-bottom: var(--sp-3); opacity: 0.6; }
.empty h3 { font-size: var(--fs-xl); margin-bottom: var(--sp-2); }
.empty p { color: var(--muted); font-size: var(--fs-sm); max-width: 420px; margin: 0 auto var(--sp-5); }

/* --- Progress ------------------------------------------------------------- */
.progress {
    height: 6px;
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: var(--gold);
    border-radius: inherit;
    transition: width 300ms ease;
}
.progress-bar.is-complete { background: var(--success); }

.progress-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--fs-xs);
    color: var(--muted);
    margin-bottom: var(--sp-2);
}

/* --- Pagination ----------------------------------------------------------- */
.pagination {
    display: flex;
    gap: var(--sp-2);
    justify-content: center;
    align-items: center;
    margin-top: var(--sp-6);
    flex-wrap: wrap;
}
.pagination a,
.pagination span {
    min-width: 36px;
    height: 36px;
    padding-inline: 0.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: var(--fs-sm);
    color: var(--ink-soft);
}
.pagination a:hover { border-color: var(--gold); color: var(--gold); }
.pagination .is-current {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 600;
}
.pagination .is-gap { border: 0; background: none; }

/* --- Accordion / curriculum ----------------------------------------------- */
.accordion {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}
.accordion + .accordion { margin-top: var(--sp-3); }
.accordion > summary {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-5);
    cursor: pointer;
    background: var(--surface-2);
    font-weight: 600;
    color: var(--ink);
    font-size: var(--fs-base);
    list-style: none;
}
.accordion > summary::-webkit-details-marker { display: none; }
.accordion > summary::after {
    content: "▾";
    margin-left: auto;
    color: var(--muted);
    transition: transform var(--transition);
}
.accordion[open] > summary::after { transform: rotate(180deg); }
.accordion > summary .badge { font-weight: 600; }

.lesson-row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 0.7rem var(--sp-5);
    border-top: 1px solid var(--line);
    font-size: var(--fs-sm);
}
.lesson-row-icon { color: var(--muted); flex: none; }
.lesson-row-title { color: var(--ink-soft); flex: 1; min-width: 0; }
.lesson-row .badge { flex: none; }
.lesson-row-time { color: var(--muted); font-size: var(--fs-xs); flex: none; }

/* Whole row is the hit target for lessons the visitor may actually watch. */
a.lesson-row { text-decoration: none; }
.lesson-row.is-playable {
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.lesson-row.is-playable:hover { background: var(--surface-2); }
.lesson-row.is-playable:hover .lesson-row-title { color: var(--gold); }
.lesson-row.is-playable:hover .lesson-row-icon { color: var(--gold); }
.lesson-row.is-playable:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: -2px;
}
.lesson-row.is-locked { cursor: default; }

/* --- Auth pages ----------------------------------------------------------- */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.auth-aside {
    background:
        radial-gradient(600px 300px at 20% 10%, rgba(168, 121, 47, 0.28), transparent 70%),
        var(--brand);
    color: #fff;
    padding: var(--sp-8) var(--sp-7);
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.auth-aside .brand,
.auth-aside h2 { color: #fff; }
.auth-aside p { color: rgba(255, 255, 255, 0.78); }
.auth-aside .brand-sub { color: rgba(255, 255, 255, 0.6); }
.auth-points { list-style: none; padding: 0; margin-top: var(--sp-6); }
.auth-points li {
    display: flex;
    gap: var(--sp-3);
    padding: var(--sp-3) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.86);
    font-size: var(--fs-sm);
}
.auth-points li::before { content: "✦"; color: var(--gold); }

.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-7) var(--sp-5);
    background: var(--bg);
}
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: var(--fs-2xl); margin-bottom: var(--sp-2); }
.auth-card > p { color: var(--muted); font-size: var(--fs-sm); margin-bottom: var(--sp-5); }
.auth-foot {
    margin-top: var(--sp-5);
    padding-top: var(--sp-4);
    border-top: 1px solid var(--line);
    font-size: var(--fs-sm);
    color: var(--muted);
    text-align: center;
}
.auth-foot a { font-weight: 600; }

/* --- App shell (student + admin) ------------------------------------------ */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--sidebar-w);
    flex: none;
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: var(--sp-5) var(--sp-4);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.app-sidebar .brand { font-size: var(--fs-lg); padding-inline: var(--sp-2); margin-bottom: var(--sp-4); }

.side-label {
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    padding: var(--sp-4) var(--sp-2) var(--sp-2);
}
.side-link {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 0.55rem var(--sp-3);
    border-radius: var(--radius-sm);
    font-size: var(--fs-base);
    font-weight: 500;
    color: var(--ink-soft);
    transition: background var(--transition), color var(--transition);
}
.side-link:hover { background: var(--surface-2); color: var(--ink); }
.side-link.is-active {
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 600;
}
[data-theme="dark"] .side-link.is-active { color: var(--ink); }
.side-link-icon { width: 18px; text-align: center; flex: none; opacity: 0.8; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding-inline: var(--sp-5);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 800;
}
.app-topbar h1 { font-size: var(--fs-xl); }
.app-content { padding: var(--sp-6) var(--sp-5) var(--sp-8); flex: 1; }
.app-content > .page-head { margin-bottom: var(--sp-5); }

.page-head h1 { font-size: var(--fs-2xl); }
.page-head p { color: var(--muted); font-size: var(--fs-sm); margin-top: var(--sp-1); }

.avatar {
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: var(--radius-pill);
    background: var(--brand-soft);
    color: var(--brand);
    display: grid;
    place-items: center;
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.02em;
}
.avatar-lg { width: 52px; height: 52px; font-size: var(--fs-md); }

.sidebar-backdrop { display: none; }

/* --- Video player --------------------------------------------------------- */
.player-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: var(--sp-5);
    align-items: start;
}

.player-stage {
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--line);
    aspect-ratio: 16 / 9;
}
.player-stage video,
.player-stage iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
}
.player-missing {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--fs-sm);
    text-align: center;
    padding: var(--sp-5);
}

.player-bar {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    flex-wrap: wrap;
    margin-top: var(--sp-4);
}

.playlist {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    position: sticky;
    top: calc(var(--header-h) + var(--sp-4));
    max-height: calc(100vh - var(--header-h) - var(--sp-6));
    display: flex;
    flex-direction: column;
}
.playlist-head {
    padding: var(--sp-4);
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}
.playlist-scroll { overflow-y: auto; }
.playlist-section {
    padding: var(--sp-3) var(--sp-4) var(--sp-1);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
}
.playlist-item {
    display: flex;
    gap: var(--sp-3);
    align-items: flex-start;
    padding: 0.65rem var(--sp-4);
    border-bottom: 1px solid var(--line);
    font-size: var(--fs-sm);
    color: var(--ink-soft);
    transition: background var(--transition);
}
.playlist-item:hover { background: var(--surface-2); color: var(--ink); }
.playlist-item.is-active {
    background: var(--gold-soft);
    color: var(--ink);
    box-shadow: inset 3px 0 0 var(--gold);
}
.playlist-item-mark {
    width: 18px;
    height: 18px;
    flex: none;
    margin-top: 2px;
    border-radius: var(--radius-pill);
    border: 1.5px solid var(--line-strong);
    display: grid;
    place-items: center;
    font-size: 10px;
    color: transparent;
}
.playlist-item.is-done .playlist-item-mark {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.playlist-item-time { font-size: var(--fs-xs); color: var(--muted); }

/* --- Curriculum builder (admin) ------------------------------------------- */
.builder-section {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    margin-bottom: var(--sp-4);
    overflow: hidden;
}
.builder-head {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.builder-head h4 { font-size: var(--fs-md); }
.builder-lesson {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 0.6rem var(--sp-4);
    border-bottom: 1px solid var(--line);
    font-size: var(--fs-sm);
}
.builder-lesson:last-child { border-bottom: 0; }
.builder-lesson-title { flex: 1; min-width: 0; color: var(--ink); font-weight: 500; }
.order-btns { display: inline-flex; gap: 2px; }
.order-btns button {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
}
.order-btns button:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.order-btns button:disabled { opacity: 0.35; cursor: not-allowed; }

.inline-form { display: inline-flex; gap: var(--sp-2); align-items: center; }

/* --- Checkout ------------------------------------------------------------- */
.checkout-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: var(--sp-6);
    align-items: start;
}
.summary-line {
    display: flex;
    justify-content: space-between;
    gap: var(--sp-4);
    padding: var(--sp-3) 0;
    font-size: var(--fs-sm);
    border-bottom: 1px dashed var(--line);
}
.summary-line:last-of-type { border-bottom: 0; }
.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-top: var(--sp-4);
    margin-top: var(--sp-2);
    border-top: 1px solid var(--line-strong);
}
.summary-total .price { font-size: var(--fs-2xl); }

.trust-row {
    display: flex;
    gap: var(--sp-4);
    flex-wrap: wrap;
    font-size: var(--fs-xs);
    color: var(--muted);
    margin-top: var(--sp-4);
}

/* --- Footer --------------------------------------------------------------- */
.site-footer {
    background: var(--brand);
    color: rgba(255, 255, 255, 0.72);
    padding-block: var(--sp-7) var(--sp-5);
    margin-top: var(--sp-8);
    font-size: var(--fs-sm);
}
[data-theme="dark"] .site-footer { background: var(--surface); border-top: 1px solid var(--line); }
.site-footer .brand { color: #fff; }
.site-footer h4 {
    color: #fff;
    font-family: var(--font-body);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: var(--sp-3);
}
.site-footer a { color: rgba(255, 255, 255, 0.72); display: block; padding: 3px 0; }
.site-footer a:hover { color: var(--gold); }
.footer-grid {
    display: grid;
    grid-template-columns: 1.6fr repeat(3, 1fr);
    gap: var(--sp-6);
}
.footer-bottom {
    margin-top: var(--sp-6);
    padding-top: var(--sp-4);
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    display: flex;
    justify-content: space-between;
    gap: var(--sp-4);
    flex-wrap: wrap;
    font-size: var(--fs-xs);
    color: rgba(255, 255, 255, 0.55);
}
[data-theme="dark"] .site-footer a,
[data-theme="dark"] .footer-bottom { color: var(--muted); }
[data-theme="dark"] .site-footer h4,
[data-theme="dark"] .site-footer .brand { color: var(--ink); }

/* --- Error page ----------------------------------------------------------- */
.error-page {
    min-height: 70vh;
    display: grid;
    place-items: center;
    text-align: center;
    padding: var(--sp-8) var(--sp-5);
}
.error-code {
    font-family: var(--font-display);
    font-size: clamp(3.5rem, 10vw, 6rem);
    line-height: 1;
    color: var(--gold);
    opacity: 0.7;
}

/* --- Utilities ------------------------------------------------------------ */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-5 { margin-bottom: var(--sp-5); }
.hidden { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 1024px) {
    .player-layout { grid-template-columns: 1fr; }
    .playlist { position: static; max-height: 460px; }
    .checkout-layout { grid-template-columns: 1fr; }
    .hero-grid { grid-template-columns: 1fr; gap: var(--sp-6); }
    .hero-visual { display: none; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
    :root { --header-h: 60px; }

    .nav-toggle { display: inline-flex; }
    .site-nav {
        position: fixed;
        inset: var(--header-h) 0 auto 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: var(--sp-3) var(--sp-5) var(--sp-5);
        background: var(--surface);
        border-bottom: 1px solid var(--line);
        box-shadow: var(--shadow);
        display: none;
    }
    .site-nav.is-open { display: flex; }
    .site-nav a:not(.btn) { padding-block: var(--sp-3); border-bottom: 1px solid var(--line); }
    .site-nav a:not(.btn)::after { display: none; }
    .site-nav .btn { margin-top: var(--sp-3); justify-content: center; }
    .site-nav-actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-3); }

    .auth-shell { grid-template-columns: 1fr; }
    .auth-aside { display: none; }

    .app-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 220ms ease;
        box-shadow: var(--shadow-lg);
    }
    .app-sidebar.is-open { transform: none; }
    .sidebar-backdrop.is-open {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 20, 28, 0.5);
        z-index: 999;
    }
    .app-content { padding: var(--sp-5) var(--sp-4) var(--sp-7); }
    .app-topbar { padding-inline: var(--sp-4); }
}

@media (max-width: 560px) {
    .container { padding-inline: var(--sp-4); }
    .section { padding-block: var(--sp-7); }
    .footer-grid { grid-template-columns: 1fr; gap: var(--sp-5); }
    .hero-proof { gap: var(--sp-5); }
    .flash-stack { right: 12px; left: 12px; width: auto; max-width: none; }
    .form-actions .btn { flex: 1 1 auto; }
    .card-pad, .card-body { padding: var(--sp-4); }
}

@media print {
    .site-header, .site-footer, .app-sidebar, .flash-stack, .btn { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
