.course-editor {
    margin-top: 0;
    color: #18304d;
}

.course-editor-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.course-editor-topbar > div:first-child {
    min-width: 0;
}

.editor-eyebrow {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.editor-eyebrow span {
    color: #2a3f59;
    font-size: .69rem;
    font-weight: 900;
    letter-spacing: .12em;
}

.course-editor-topbar h1 {
    margin: 0;
    font-size: 1.9rem;
    line-height: 1.15;
    letter-spacing: -.03em;
}

.course-editor-topbar p {
    margin: 6px 0 0;
    color: #708196;
    font-size: .88rem;
}

.course-editor-topbar .text-button {
    border: 0;
    padding: 0 !important;
    background: transparent !important;
    color: #2f4b70 !important;
    font-weight: 800;
    cursor: pointer;
}

.course-editor-topbar .command-actions {
    display: flex;
    gap: 10px;
    padding-top: 16px;
}

.course-editor-topbar .command-actions button {
    border: 0;
    border-radius: 11px;
    padding: 11px 17px;
    font-weight: 850;
    cursor: pointer;
}

.course-editor-topbar .command-actions .primary {
    background: #0f4387;
    color: white;
    box-shadow: 0 8px 16px rgba(15, 67, 135, .15);
}

.course-editor-topbar .command-actions .danger {
    background: #fff2f2;
    color: #ba2d2d;
}

.course-editor .details-grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(360px, .95fr);
    gap: 18px;
    margin-top: 0;
}

.course-editor .form-card {
    padding: 24px;
    border-color: #dce5ee;
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(28, 51, 76, .07);
}

.course-editor .card-heading {
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 22px;
}

.course-editor .card-heading > span {
    flex: 0 0 auto;
    background: #e8eef7;
    color: #0f4387;
}

.course-editor .card-heading h3 {
    font-size: 1.5rem;
    line-height: 1.1;
    letter-spacing: -.02em;
}

.course-editor .card-heading p {
    margin-top: 4px;
    color: #708196;
}

.course-editor .fields,
.course-editor .registration-grid {
    gap: 16px 18px;
    margin-top: 0;
}

.course-editor .fields input,
.course-editor .fields textarea,
.course-editor .fields select,
.course-editor .registration-grid input:not(.toggle),
.course-editor .registration-grid select,
.course-editor .url-import input {
    border-color: #c8d5e2;
    border-radius: 10px;
    padding: 11px 12px;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.course-editor .fields input:focus,
.course-editor .fields textarea:focus,
.course-editor .fields select:focus,
.course-editor .registration-grid input:not(.toggle):focus,
.course-editor .registration-grid select:focus,
.course-editor .url-import input:focus {
    border-color: #f2a000;
    box-shadow: 0 0 0 3px rgba(242, 160, 0, .11);
}

.course-editor .slug-field {
    border-color: #c8d5e2;
    border-radius: 10px;
    background: white;
}

.course-editor .slug-field span {
    align-self: stretch;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border-right: 1px solid #dce5ee;
    background: #f8fafc;
    color: #8190a0;
    font-size: .8rem;
    white-space: nowrap;
}

.course-editor .drop-zone {
    min-height: 150px;
    border-width: 1.5px;
    border-color: #7f9cc3;
    background: #f7fcfc;
}

.course-editor .drop-zone::before {
    content: "↑";
    display: grid;
    width: 34px;
    height: 34px;
    margin-bottom: 8px;
    place-items: center;
    border-radius: 10px;
    background: #e4ebf5;
    color: #0f4387;
    font-size: 1.15rem;
    font-weight: 900;
}

.course-editor .drop-zone .cover-file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.course-editor .registration-card {
    grid-column: 1 / -1;
    padding-bottom: 26px;
}

.registration-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
}

.registration-grid > label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: #486078;
    font-size: .78rem;
    font-weight: 800;
}

.toggle-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 22px;
    margin-top: 2px;
}

.toggle-row {
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid #e8eef4;
    border-radius: 12px;
    padding: 13px 15px;
    background: #fbfcfe;
    color: #50677f;
    cursor: pointer;
}

.toggle-row span {
    max-width: 85%;
    font-size: .78rem;
    font-weight: 800;
    line-height: 1.35;
}

.toggle {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    flex: 0 0 auto;
    width: 42px;
    height: 24px;
    margin: 0;
    border: 0;
    border-radius: 999px;
    padding: 0;
    background: #cad5df;
    cursor: pointer;
    transition: background .2s ease;
}

.lesson-fields .toggle {
    width: 42px !important;
    height: 24px !important;
    padding: 0 !important;
}

.lesson-fields .toggle-row {
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    text-align: left;
}

.toggle::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
    transition: left .2s ease;
}

.toggle:checked {
    background: #0f4387;
}

.toggle:checked::before {
    left: 21px;
}

.toggle:focus-visible {
    outline: 3px solid rgba(242, 160, 0, .25);
    outline-offset: 2px;
}

@media (max-width: 1100px) {
    .course-editor .details-grid,
    .registration-grid,
    .toggle-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .course-editor .registration-card,
    .toggle-grid {
        grid-column: auto;
    }
}

@media (max-width: 700px) {
    .course-editor-topbar {
        flex-direction: column;
    }

    .course-editor-topbar .command-actions {
        width: 100%;
        padding-top: 0;
    }

    .course-editor-topbar .command-actions button {
        flex: 1;
    }

    .editor-eyebrow {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .course-editor .form-card {
        padding: 18px;
    }

    .course-editor .card-heading h3 {
        font-size: 1.3rem;
    }
}


.lesson-toggles {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}

/* Shared "course player" shell: curriculum rail on the left, content on the right. */
.course-player-rail {
    position: sticky;
    top: 88px;
    align-self: start;
    max-height: calc(100vh - 108px);
    overflow-y: auto;
    padding: 16px;
    border: 1px solid #dbe5ec;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(28, 60, 84, .07);
}

@media (max-width: 900px) {
    .course-player-rail {
        position: static;
        max-height: none;
    }
}

.lesson-row {
    align-items: stretch;
    padding: 0;
    cursor: grab;
    transition: border-color .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.lesson-row:active {
    cursor: grabbing;
}

.lesson-row.dragging {
    opacity: .55;
}

.lesson-row.drop-target {
    border-color: #f2a000;
    box-shadow: 0 -3px 0 #f2a000;
}

.lesson-row .drag-handle {
    display: grid;
    width: 34px;
    min-width: 34px;
    height: auto;
    place-items: center;
    border-radius: 10px 0 0 10px;
    background: #e8eef7;
    color: #0f4387;
    font-size: 1.05rem;
    font-weight: 900;
}

.lesson-select {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: flex-start;
    gap: 10px;
    border: 0;
    padding: 12px;
    background: transparent;
    color: #18304d;
    text-align: left;
    cursor: pointer;
}

.lesson-select > span {
    display: grid;
    min-width: 27px;
    height: 27px;
    place-items: center;
    border-radius: 8px;
    background: #e6ecf3;
    color: #0d3d7b;
    font-size: .74rem;
    font-weight: 900;
}

.lesson-select > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.lesson-select strong {
    overflow: hidden;
    text-overflow: ellipsis;
}

.lesson-select small {
    margin-top: 3px;
    color: #718497;
}

.reorder-help {
    margin: 10px 4px 0;
    color: #708196;
    font-size: .72rem;
    line-height: 1.4;
}

@media (max-width: 700px) {
    .lesson-toggles {
        grid-column: auto;
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Course curriculum: Course -> Chapter -> Lesson */
.curriculum-library {
    width: 100%;
    padding: 14px;
    background: #f8fbfc;
}

.module-block {
    margin-top: 14px;
    padding: 8px 8px 12px;
    border: 1px solid #cfe0c8;
    border-radius: 16px;
    background: #f4faf1;
    transition: border-color .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.module-block.dragging { opacity: .55; }
.module-block.drop-target { border-color: #f2a000; box-shadow: 0 -3px 0 #f2a000; }
.module-block .chapter-block:first-of-type { margin-top: 8px; }

.module-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    align-items: stretch;
    border-radius: 10px;
    background: #e5f3df;
}

.module-row > .drag-handle {
    display: grid;
    place-items: center;
    color: #3f8d3a;
    cursor: grab;
}

.module-select {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    border: 0;
    padding: 12px 8px;
    background: transparent;
    color: #18304d;
    text-align: left;
    cursor: pointer;
}

.module-select.active { color: #276b23; }
.module-select small { color: #3f8d3a; font-size: .64rem; font-weight: 900; letter-spacing: .09em; }
.module-select strong { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.module-select span { color: #708196; font-size: .7rem; }

.chapter-block {
    margin-top: 14px;
    overflow: hidden;
    border: 1px solid #dce6ec;
    border-radius: 14px;
    background: #fff;
    transition: border-color .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.chapter-block.active {
    border-color: #6a8cb9;
    box-shadow: 0 0 0 2px rgba(15, 67, 135, .09);
}

.chapter-block.dragging { opacity: .55; }
.chapter-block.drop-target { border-color: #f2a000; box-shadow: 0 -3px 0 #f2a000; }

.chapter-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px 34px;
    align-items: stretch;
    border-bottom: 1px solid #e8eef2;
    background: #eef2f7;
}

.chapter-row > .drag-handle {
    display: grid;
    place-items: center;
    color: #0f4387;
    cursor: grab;
}

.chapter-select {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    border: 0;
    padding: 12px 8px;
    background: transparent;
    color: #18304d;
    text-align: left;
    cursor: pointer;
}

.chapter-select small { color: #0f4387; font-size: .64rem; font-weight: 900; letter-spacing: .09em; }
.chapter-select strong { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-select span { color: #708196; font-size: .7rem; }

.chapter-add {
    align-self: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: #fff;
    color: #0f4387;
    font-size: 1.05rem;
    font-weight: 900;
    cursor: pointer;
}

.chapter-toggle {
    align-self: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: #fff;
    color: #0f4387;
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
    transition: transform .15s ease;
}

.chapter-toggle.open { transform: rotate(180deg); }

.chapter-lessons { padding: 4px 8px 10px 18px; }
.chapter-lessons .lesson-row { margin-top: 7px; background: #fff; }

.chapter-quiz-row {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 9px;
    margin-top: 8px;
    border: 1px dashed #b9c5d5;
    border-radius: 10px;
    padding: 9px 10px;
    background: #fbfdfe;
    color: #25455e;
    text-align: left;
    cursor: pointer;
}

.chapter-quiz-row > span { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 50%; background: #fff0cf; color: #a96b00; font-weight: 900; }
.chapter-quiz-row > div { display: flex; flex-direction: column; }
.chapter-quiz-row small { color: #708196; }
.chapter-quiz-row.active { border-color: #f2a000; background: #fff8e9; }

.curriculum-empty { padding: 28px 14px !important; }
.curriculum-empty p { margin: 6px 0 14px; }
.curriculum-empty button { display: inline-flex; }

.chapter-fields {
    display: grid;
    gap: 18px;
    margin-top: 22px;
    padding: 22px;
    border: 1px solid #e0e8ee;
    border-radius: 16px;
    background: #f8fafc;
}

.chapter-fields label { display: flex; flex-direction: column; gap: 7px; color: #486078; font-size: .79rem; font-weight: 850; }
.chapter-fields input, .chapter-fields textarea, .chapter-fields select { width: 100%; box-sizing: border-box; border: 1px solid #c8d5e2; border-radius: 10px; padding: 12px; background: #fff; color: #18304d; font: inherit; }
.chapter-fields input:focus, .chapter-fields textarea:focus, .chapter-fields select:focus { outline: none; border-color: #f2a000; box-shadow: 0 0 0 3px rgba(242, 160, 0, .11); }

.chapter-next-actions { display: flex; gap: 10px; margin-top: 18px; }
.chapter-next-actions button { border: 0; border-radius: 10px; padding: 11px 14px; background: #eaeff5; color: #31556c; font-weight: 850; cursor: pointer; }
.chapter-next-actions .primary { background: #0f4387; color: #fff; }

.lesson-command-bar { display: flex; gap: 8px; }
.lesson-command-bar button { border: 0; border-radius: 10px; padding: 10px 14px; background: #eaeef4; color: #31556c; font-weight: 850; cursor: pointer; }
.lesson-command-bar .publish-button { background: #17824f; color: #fff; box-shadow: 0 7px 16px rgba(23, 130, 79, .18); }
.lesson-command-bar button:disabled { opacity: .55; cursor: wait; }

.lesson-fields.streamlined { grid-template-columns: 1fr 1fr; }
.lesson-fields.streamlined .demo-row { grid-column: 1 / -1; min-height: 68px; }
.demo-row > span { display: flex; flex-direction: column; gap: 3px; }
.demo-row small { color: #708196; font-weight: 500; }
.toggle.demo-toggle:checked { background: #20a663 !important; }

.assessment-empty { padding: 42px 20px; border: 1px dashed #c7d6de; border-radius: 14px; color: #60788b; text-align: center; }
.assessment-empty strong { color: #284a62; font-size: 1.05rem; }
.assessment-empty p { margin: 5px 0 0; }

@media (min-width: 1051px) {
    .content-layout { grid-template-columns: 360px minmax(0, 1fr); }
}

@media (max-width: 1050px) {
    .curriculum-library { display: block; }
    .chapter-block { display: block; }
}

@media (max-width: 700px) {
    .lesson-fields.streamlined { grid-template-columns: minmax(0, 1fr); }
    .lesson-fields.streamlined .demo-row { grid-column: auto; }
    .lesson-heading, .lesson-command-bar, .chapter-next-actions { align-items: stretch; flex-direction: column; }
    .lesson-command-bar button, .chapter-next-actions button { width: 100%; }
}
