:root {
    --bg: #f7f7f8;
    --surface: #ffffff;
    --text: #171717;
    --muted: #666b73;
    --line: #e4e7eb;
    --accent: #a435f0;
    --accent-2: #f96816;
    --shadow: 0 10px 30px rgba(20, 20, 20, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: Arial, Helvetica, sans-serif; }
a { color: inherit; text-decoration: none; }
img { display: block; width: 100%; }
body { line-height: 1.45; }

.topbar {
    height: 68px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.logo, .brand-block { display: flex; align-items: center; gap: 12px; }
.logo-badge, .brand-mark {
    width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%); color: #fff; font-weight: 700;
}
.topnav { display: flex; gap: 18px; color: var(--muted); }
.container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }

.hero {
    width: min(1180px, calc(100% - 32px)); margin: 24px auto; border-radius: 20px; overflow: hidden;
    display: grid; grid-template-columns: 1.1fr .9fr; background: linear-gradient(135deg, #1c1d1f 0%, #2b2d33 100%); color: #fff; box-shadow: var(--shadow);
}
.hero-copy { padding: 52px; }
.hero-copy h1 { font-size: 44px; line-height: 1.08; margin: 8px 0 16px; max-width: 14ch; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; color: #d0d4dc; font-size: 12px; }
.hero-text { max-width: 56ch; color: #d4d7dd; }
.hero-actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.hero-visual { min-height: 380px; }
.hero-visual img, .course-card img, .course-hero-media img { height: 100%; object-fit: cover; }

.btn {
    border: 1px solid transparent; border-radius: 10px; padding: 12px 16px; display: inline-flex;
    align-items: center; justify-content: center; font-weight: 700; cursor: pointer;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.22); }
.btn.secondary { background: #fff; color: #26222c; border-color: #cfd2d8; }

.section-head, .page-head, .admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 24px 0 16px; }
.section-head h2, .page-head h1, .admin-head h1 { margin: 0; }
.searchbar { display: flex; gap: 10px; }
.searchbar input, .panel input, .panel select, .panel textarea {
    width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit;
}

.course-grid, .stats-grid, .integration-grid, .trust-row {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
}
.course-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow);
}
.course-card img { height: 190px; }
.course-body { padding: 16px; }
.course-body h3 { margin: 10px 0 8px; font-size: 18px; }
.course-body p { color: var(--muted); margin: 0 0 14px; min-height: 48px; }
.course-meta, .course-stats, .summary-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pill { display: inline-flex; padding: 6px 10px; border-radius: 999px; background: #f0e7fb; color: #6b2ab9; font-size: 12px; font-weight: 700; }

.trust-card, .stat-card, .integration-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow);
}
.trust-card span, .integration-card span, .stat-card span { display: block; color: var(--muted); margin-top: 6px; }
.stat-card strong { display: block; font-size: 30px; margin-top: 12px; }

.course-detail, .checkout-grid, .settings-stack, .login-wrap { padding-bottom: 32px; }
.course-hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 18px; }
.course-hero-copy, .course-hero-media { background: var(--surface); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.course-hero-copy { padding: 28px; }
.course-hero-copy h1 { margin: 12px 0; font-size: 36px; }
.course-hero-media img { height: 100%; min-height: 340px; }
.content-grid, .checkout-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; margin-top: 18px; }
.panel {
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 22px;
}
.lesson-list { list-style: none; padding: 0; margin: 0; }
.lesson-list li, .summary-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.lesson-list li:last-child, .summary-row:last-child { border-bottom: 0; }
.lesson-list li { display: grid; grid-template-columns: 1fr auto; gap: 6px 18px; align-items: center; }
.lesson-list li > small { color: var(--muted); }
.lesson-preview { grid-column: 1 / -1; width: min(720px, 100%); aspect-ratio: 16 / 9; margin-top: 10px; background: #111; }
.lesson-preview iframe, .lesson-preview video { width: 100%; height: 100%; border: 0; display: block; }
.quiz-row .text-link { grid-column: 1 / -1; width: max-content; }
.text-link { color: #6b21a8; font-weight: 700; }
.price-box { font-size: 34px; font-weight: 800; color: var(--accent-2); margin-top: 12px; }

.login-wrap { display: grid; place-items: center; min-height: calc(100vh - 80px); }
.login-panel { width: min(420px, 100%); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; align-items: center; grid-column: 1 / -1; }
.settings-stack { display: grid; gap: 18px; }
.stack-form { display: grid; gap: 14px; }
.stack-form label, .form-grid label { font-weight: 700; }
.stack-form input, .stack-form select, .stack-form textarea { margin-top: 6px; }
.form-grid.compact { gap: 10px; }
.check-line { display: flex; align-items: center; gap: 9px; }
.check-line input { width: auto; margin: 0; }
.muted, .empty-state, .last-update { color: var(--muted); }
.checkout-form { display: grid; gap: 14px; }
.checkout-form h1, .checkout-form p { margin: 0; }
.checkout-form label { display: grid; gap: 6px; font-weight: 700; }
.checkout-form label small { color: var(--muted); font-weight: 400; }
.notice { padding: 14px; border: 1px solid var(--line); background: #f6f7f8; }
.notice.error { border-color: #e5aaa7; background: #fff1f0; color: #8d1d18; }
.payment-page, .payment-result { padding: 28px 0 48px; }
.payment-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.payment-heading h1 { margin: 4px 0; }
.payment-heading .eyebrow, .payment-result .eyebrow { color: #6b21a8; }
.payment-heading > strong { font-size: 24px; }
.payment-frame { display: block; width: 100%; min-height: 720px; border: 1px solid var(--line); background: #fff; }
.payment-result { display: grid; place-items: center; min-height: calc(100vh - 68px); }
.payment-result > .panel { width: min(620px, 100%); }
.payment-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.status-pill { display: inline-flex; padding: 5px 8px; border-radius: 4px; background: #eceef2; color: #4d5158; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status-pill.paid { background: #e3f5e9; color: #176b34; }
.status-pill.failed { background: #fdecec; color: #9a1a1a; }
.status-pill.sent { background: #e3f5e9; color: #176b34; }
.status-pill.queued, .status-pill.retry { background: #fff4d6; color: #805b00; }
.status-pill.processing { background: #e8eefc; color: #294f9b; }
.status-pill.awaiting_payment { background: #fff4d6; color: #805b00; }
.coupon-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; margin-top: 18px; }
.coupon-form label { display: grid; gap: 6px; font-weight: 700; }
.coupon-form .btn { min-height: 46px; }
.discount-row { color: #176b34; }
.total-row strong { font-size: 20px; }
.coupon-error, .coupon-success { padding: 10px 12px; margin: 10px 0 0; font-size: 13px; }
.coupon-error { background: #fdecec; color: #9a1a1a; }
.coupon-success { background: #e9f9ef; color: #176b34; }
.course-scope { margin: 4px 0; padding: 14px; border: 1px solid var(--line); }
.course-scope legend { padding: 0 6px; font-weight: 800; }
.course-scope p { margin: 0 0 10px; }
.course-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; max-height: 220px; overflow: auto; }
.coupon-list { display: grid; gap: 0; }
.coupon-item { padding: 16px 0; border-bottom: 1px solid var(--line); }
.coupon-item:last-child { border-bottom: 0; }
.coupon-item-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.coupon-item-head > strong { font-size: 18px; }
.coupon-item h3 { margin: 8px 0 4px; font-size: 16px; }
.coupon-item p { margin: 4px 0; color: var(--muted); }
.course-rating { color: #b26b00; font-weight: 700; white-space: nowrap; }
.course-rating small { color: var(--muted); font-weight: 400; }
.reviews-section { margin-top: 24px; padding-bottom: 36px; }
.reviews-section .section-head { margin-top: 0; }
.reviews-section .eyebrow { color: #6b21a8; margin-bottom: 4px; }
.rating-large { color: #b26b00; font-size: 24px; }
.review-form { display: grid; gap: 12px; margin-bottom: 18px; }
.review-form h3 { margin: 0; }
.review-form label { display: grid; gap: 6px; font-weight: 700; }
.review-list { background: #fff; border-top: 1px solid var(--line); }
.review-item { padding: 18px 0; border-bottom: 1px solid var(--line); }
.review-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.review-meta span { color: #b26b00; }
.review-meta small { color: var(--muted); font-weight: 400; }
.review-item p { margin: 8px 0 0; white-space: normal; }
.qa-answer { margin: 14px 0 0 20px; padding: 12px 14px; border-left: 3px solid #6b21a8; background: #f7f5fa; }
.qa-answer p { margin: 5px 0; }
.review-admin-list { display: grid; }
.review-admin-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.review-admin-item:last-child { border-bottom: 0; }
.review-admin-item p { margin: 8px 0; }
.review-admin-item small { color: var(--muted); }
.certificate-page { min-height: calc(100vh - 68px); display: grid; place-items: center; padding: 40px 16px; background: #f0f1f3; }
.certificate-paper { width: min(900px, 100%); min-height: 600px; padding: 72px; text-align: center; background: #fff; border: 14px solid #292b31; box-shadow: var(--shadow); }
.certificate-paper .eyebrow, .certificate-verify-page .eyebrow { color: #6b21a8; }
.certificate-paper h1 { margin: 26px 0 12px; font-size: 38px; }
.certificate-paper h2 { margin: 42px 0 8px; font-size: 32px; }
.certificate-lead, .certificate-course { color: var(--muted); }
.certificate-course { font-size: 20px; font-weight: 700; }
.certificate-meta { display: flex; justify-content: center; gap: 80px; margin: 48px 0 24px; }
.certificate-meta span { color: var(--muted); }
.certificate-meta strong { display: block; margin-top: 5px; color: var(--text); }
.certificate-verify { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.certificate-verify a { color: #6b21a8; }
.print-button { margin-top: 16px; }
.certificate-verify-page { min-height: calc(100vh - 68px); display: grid; place-items: center; padding: 40px 0; }
.certificate-verify-page > .panel { width: min(650px, 100%); }
.verify-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin-top: 24px; }
.verify-form label { display: grid; gap: 6px; font-weight: 700; }
.verification-success, .verification-error { margin-top: 24px; padding: 18px; }
.verification-success { background: #e9f9ef; color: #176b34; }
.verification-error { background: #fdecec; color: #9a1a1a; }

.admin-layout { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: #141417; color: #fff; padding: 22px; }
.brand-sub, .side-nav { color: #a7abb5; }
.side-nav { display: grid; gap: 10px; margin-top: 24px; }
.side-nav a { padding: 12px 14px; border-radius: 10px; background: rgba(255,255,255,.04); }
.main-stage { padding: 24px; }
.flash { padding: 14px 16px; border-radius: 12px; margin-bottom: 16px; }
.flash.success { background: #e9f9ef; color: #176b34; }
.flash.error { background: #fdecec; color: #9a1a1a; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.actions { display: flex; gap: 10px; align-items: center; }
.actions form { margin: 0; }
.actions button { border: 0; background: transparent; color: #b91c1c; cursor: pointer; }

.admin-content-grid, .update-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.content-list-panel { margin-top: 18px; }
.content-items { display: grid; }
.content-item, .question-admin, .backup-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.content-item:last-child, .question-admin:last-child, .backup-row:last-child { border-bottom: 0; }
.content-item > div:first-child { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 10px; }
.content-item small { grid-column: 2; color: var(--muted); }
.content-kind { background: #e8f2ff; color: #165a98; border-radius: 4px; padding: 4px 7px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.content-kind.test { background: #f0e7fb; color: #6b2ab9; }
.item-actions { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.item-actions a { font-weight: 700; color: #5b2494; }
.danger-link { border: 0; padding: 0; background: transparent; color: #b42318; font: inherit; cursor: pointer; }
.question-admin { align-items: flex-start; justify-content: flex-start; }
.question-admin > div:nth-child(2) { flex: 1; }
.question-admin p { margin: 6px 0; color: var(--muted); }
.question-number { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #eee8f5; font-weight: 800; flex: 0 0 auto; }
.count-badge, .version-chip { display: inline-flex; align-items: center; border-radius: 4px; padding: 5px 9px; background: #eceef2; color: #4d5158; font-size: 13px; }
.version-chip { font-weight: 800; padding: 8px 12px; }

.quiz-page { padding-bottom: 44px; }
.quiz-page .page-head { align-items: flex-start; }
.quiz-page .eyebrow { color: #6b21a8; }
.quiz-form { display: grid; gap: 16px; }
.quiz-question { margin: 0; min-width: 0; }
.quiz-question legend { padding: 0 8px; font-size: 17px; font-weight: 800; }
.answer-option { display: block; margin: 9px 0; cursor: pointer; }
.answer-option input { position: absolute; opacity: 0; }
.answer-option span { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; }
.answer-option input:checked + span { border-color: #7c3aed; background: #f5f0fb; }
.answer-feedback { margin-top: 12px; color: var(--muted); font-weight: 700; }
.answer-correct { border-color: #53a877; }
.answer-wrong { border-color: #d47770; }
.result-banner { display: flex; align-items: center; gap: 14px; margin: 18px 0; padding: 18px; border-left: 5px solid; background: #fff; }
.result-banner strong { font-size: 28px; }
.result-banner small { margin-left: auto; }
.result-banner.passed { border-color: #238451; }
.result-banner.failed { border-color: #bd3e35; }
.safe-list { margin: 0; padding-left: 20px; }
.safe-list li { padding: 7px 0; }
.update-upload p { color: var(--muted); }
.backup-row span { color: var(--muted); }

.auth-page { min-height: calc(100vh - 68px); display: grid; place-items: center; padding: 36px 16px; }
.auth-panel { width: min(520px, 100%); }
.auth-panel h1 { margin: 5px 0 8px; font-size: 30px; }
.auth-panel > p { color: var(--muted); }
.auth-panel > label { display: block; margin: 15px 0; font-weight: 700; }
.auth-panel .eyebrow, .student-page .eyebrow, .lesson-info .eyebrow { color: #6b21a8; }
.auth-actions { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 18px; }
.auth-actions a, .auth-foot a { color: #6b21a8; font-weight: 700; }
.auth-foot { padding-top: 16px; border-top: 1px solid var(--line); }
.terms-line { font-size: 13px; color: var(--muted); }

.student-page { padding: 30px 0 50px; }
.student-welcome { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.student-welcome h1 { margin: 5px 0; font-size: 32px; }
.student-welcome p { margin: 0; color: var(--muted); }
.student-course-list { display: grid; gap: 16px; }
.student-course { display: grid; grid-template-columns: 260px 1fr; min-height: 190px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.student-course > img { height: 100%; object-fit: cover; }
.student-course-body { padding: 20px; }
.student-course-body h2 { margin: 9px 0 6px; }
.student-course-body p { color: var(--muted); }
.student-course-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.progress-track { height: 8px; overflow: hidden; border-radius: 4px; background: #e7e9ed; }
.progress-track span { display: block; height: 100%; background: #6d28d9; }
.empty-courses { padding: 50px 20px; text-align: center; background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.empty-courses p { color: var(--muted); }

.learning-shell { min-height: calc(100vh - 68px); display: grid; grid-template-columns: 330px 1fr; background: #111216; color: #fff; }
.curriculum-panel { background: #fff; color: var(--text); border-right: 1px solid var(--line); }
.curriculum-panel > h2, .curriculum-panel > .progress-track, .curriculum-panel > small { margin-left: 20px; margin-right: 20px; }
.curriculum-panel > h2 { font-size: 18px; margin-top: 18px; margin-bottom: 14px; }
.curriculum-panel > small { display: block; color: var(--muted); margin-top: 7px; }
.learning-back { display: block; padding: 16px 20px; border-bottom: 1px solid var(--line); color: #6b21a8; font-weight: 700; }
.curriculum-list { display: grid; margin-top: 18px; border-top: 1px solid var(--line); }
.curriculum-list > a { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: center; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.curriculum-list > a.active { background: #f3edf9; border-left: 4px solid #6d28d9; padding-left: 14px; }
.curriculum-list small { display: block; color: var(--muted); margin-top: 2px; }
.lesson-state { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid #c9ccd2; border-radius: 50%; font-size: 12px; font-weight: 800; }
.lesson-state.done { background: #238451; border-color: #238451; color: #fff; }
.lesson-stage { min-width: 0; }
.lesson-player { width: 100%; aspect-ratio: 16 / 9; max-height: calc(100vh - 220px); background: #08090b; }
.lesson-player iframe, .lesson-player video { width: 100%; height: 100%; display: block; border: 0; }
.video-placeholder { min-height: 420px; display: grid; place-items: center; color: #b7bac2; background: #0b0c0f; }
.lesson-info { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 28px; }
.lesson-info h1 { margin: 4px 0; font-size: 25px; }
.lesson-info p { margin: 0; color: #b7bac2; }
.complete-badge { padding: 9px 12px; border: 1px solid #3f9b68; color: #72d29c; border-radius: 4px; font-weight: 700; }
.enroll-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.enroll-form label { font-weight: 700; }

.homepage-editor-section { position: relative; }
.editor-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.editor-section-head h2 { margin: 0 0 4px; }
.editor-section-head p { margin: 0; color: var(--muted); }
.switch-line { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-weight: 700; }
.switch-line input { width: 18px; height: 18px; margin: 0; }
.homepage-editor-section label small { display: block; margin-top: 6px; color: var(--muted); font-weight: 400; }
.homepage-image-preview { width: min(560px, 100%); aspect-ratio: 16 / 7; margin-top: 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #f0f1f3; }
.homepage-image-preview img { width: 100%; height: 100%; object-fit: cover; }
.trust-editor-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.trust-editor { border-left: 3px solid #d7c2ea; padding-left: 14px; }
.trust-editor > strong { display: block; margin-bottom: 10px; }
.trust-editor label { display: block; margin-top: 10px; font-weight: 700; }
.sticky-save { position: sticky; bottom: 0; z-index: 3; display: flex; justify-content: flex-end; padding: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.96); box-shadow: 0 -8px 24px rgba(20,20,20,.07); }

@media (max-width: 960px) {
    .hero, .course-hero, .content-grid, .checkout-grid, .admin-layout, .course-grid, .stats-grid, .integration-grid, .trust-row, .form-grid, .admin-content-grid, .update-grid, .trust-editor-grid {
        grid-template-columns: 1fr;
    }
    .hero-copy h1 { font-size: 34px; }
    .topbar { position: static; }
    .content-item, .backup-row { align-items: flex-start; flex-direction: column; }
    .result-banner { align-items: flex-start; flex-direction: column; }
    .result-banner small { margin-left: 0; }
    .editor-section-head { flex-direction: column; }
    .student-course, .learning-shell, .enroll-form { grid-template-columns: 1fr; }
    .student-course > img { height: 210px; }
    .student-welcome, .lesson-info { align-items: flex-start; flex-direction: column; }
    .curriculum-panel { border-right: 0; }
    .lesson-player { max-height: none; }
    .video-placeholder { min-height: 240px; }
    .topnav { gap: 12px; font-size: 13px; }
    .payment-heading { align-items: flex-start; flex-direction: column; }
    .payment-frame { min-height: 660px; }
    .coupon-form, .course-checks { grid-template-columns: 1fr; }
.review-admin-item, .review-meta { align-items: flex-start; flex-direction: column; }
    .certificate-paper { min-height: 0; padding: 38px 20px; border-width: 8px; }
    .certificate-paper h1 { font-size: 28px; }
    .certificate-paper h2 { font-size: 25px; margin-top: 30px; }
    .certificate-meta, .verify-form { grid-template-columns: 1fr; flex-direction: column; gap: 18px; }
}
