:root {
    --page-bg: #fff8f2;
    --surface: #fffdfa;
    --surface-muted: #fff5ed;
    --text: #3e3029;
    --muted: #79685e;
    --line: #ead9cc;
    --line-strong: #d9bdab;
    --accent: #bb592e;
    --accent-hover: #a94c25;
    --accent-soft: #ffe5d2;
    --accent-pale: #fff0e5;
    --sage: #9caf84;
    --sage-soft: #edf2e6;
    --danger: #a64f4c;
    /* Keep every output-table column at 135px; wide schedules should scroll horizontally. */
    --schedule-column-width: 135px;
    --shadow: 0 12px 34px rgba(105, 61, 37, 0.08);
    --shadow-soft: 0 7px 20px rgba(105, 61, 37, 0.055);
    color: var(--text);
    background: var(--page-bg);
    font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
    line-height: 1.5;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 8% 0%, rgba(246, 177, 132, 0.26), transparent 30rem),
        radial-gradient(circle at 94% 12%, rgba(190, 207, 168, 0.24), transparent 25rem),
        var(--page-bg);
}

::selection {
    background: #f6c5a4;
    color: var(--text);
}

main {
    width: min(calc(100% - 32px), 1240px);
    margin: 0 auto;
    padding: 32px 0 56px;
}

h1,
h2 {
    margin: 0;
    line-height: 1.15;
}

h1 {
    font-size: 2rem;
    font-weight: 750;
    letter-spacing: -0.035em;
}

h2 {
    font-size: 1.15rem;
    font-weight: 750;
    letter-spacing: -0.015em;
}

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

button {
    border: 1px solid var(--accent);
    border-radius: 12px;
    background: var(--accent);
    box-shadow: 0 5px 12px rgba(187, 89, 46, 0.16);
    color: #ffffff;
    cursor: pointer;
    font-weight: 600;
    padding: 10px 16px;
    transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

button:hover {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
    box-shadow: 0 7px 16px rgba(169, 76, 37, 0.2);
    transform: translateY(-1px);
}

button:focus-visible {
    outline: 3px solid rgba(187, 89, 46, 0.22);
    outline-offset: 2px;
}

button:active {
    box-shadow: 0 3px 8px rgba(169, 76, 37, 0.16);
    transform: translateY(0);
}

button:disabled {
    cursor: wait;
    opacity: 0.65;
}

label {
    display: grid;
    gap: 6px;
    color: #625248;
    font-size: 0.9rem;
    font-weight: 600;
}

.field-label {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.field-help {
    position: relative;
    display: inline-grid;
    place-items: center;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: var(--accent-pale);
    color: var(--muted);
    cursor: help;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.field-help:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    color: var(--text);
    outline: 0;
}

.field-tooltip {
    position: absolute;
    z-index: 30;
    top: calc(100% + 8px);
    left: 50%;
    width: min(300px, calc(100vw - 32px));
    border-radius: 10px;
    background: var(--text);
    box-shadow: 0 10px 26px rgba(62, 48, 41, 0.2);
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.4;
    opacity: 0;
    padding: 11px 12px;
    pointer-events: none;
    text-align: left;
    transform: translate(-50%, -4px);
    transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
    visibility: hidden;
}

.field-tooltip-examples {
    display: grid;
    gap: 3px;
}

.field-tooltip-example-label {
    color: #f1b68f;
    font-size: 0.75rem;
    font-weight: 700;
}

.field-tooltip code {
    color: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: normal;
}

.field-tooltip hr {
    width: 100%;
    margin: 9px 0;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.24);
}

.field-help:hover .field-tooltip,
.field-help:focus .field-tooltip {
    opacity: 1;
    transform: translate(-50%, 0);
    visibility: visible;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--text);
    padding: 11px 12px;
    transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

input:hover,
select:hover,
textarea:hover {
    border-color: #cba58f;
    background: #ffffff;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(187, 89, 46, 0.14);
    outline: 0;
}

textarea {
    min-height: 320px;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9rem;
}

.page-header {
    display: grid;
    grid-template-columns: 168px minmax(0, 880px);
    justify-content: center;
    gap: 24px;
    width: 100%;
    margin: 0 auto 24px;
    padding-top: 6px;
}

.page-header > div {
    grid-column: 2;
}

.page-header h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 2.35rem;
}

.page-header h1::before {
    width: 10px;
    height: 34px;
    border-radius: 999px;
    background: linear-gradient(180deg, #f2ad7f, var(--accent));
    box-shadow: 0 5px 12px rgba(187, 89, 46, 0.2);
    content: "";
}

.page-intro {
    display: grid;
    gap: 8px;
    margin-top: 14px;
    color: var(--muted);
}

.page-intro p,
.page-intro ul {
    margin: 0;
}

.page-intro ul {
    display: grid;
    gap: 3px;
    padding-left: 22px;
}

#import-spec-form {
    display: none;
}

.editor-layout {
    display: grid;
    grid-template-columns: 168px minmax(0, 880px);
    justify-content: center;
    gap: 24px;
    align-items: start;
}

.section-nav {
    position: sticky;
    top: 24px;
    display: grid;
    gap: 5px;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 253, 250, 0.88);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.section-nav a {
    border-radius: 12px;
    color: var(--muted);
    padding: 10px 12px;
    text-decoration: none;
    font-size: 0.94rem;
    font-weight: 600;
    transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.section-nav a:hover {
    background: var(--accent-soft);
    color: #8f3f20;
    transform: translateX(2px);
}

.section-nav a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.editor-form {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.editor-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 245, 237, 0.9);
    box-shadow: var(--shadow-soft);
}

.tab-button {
    position: relative;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    box-shadow: none;
    padding: 11px 12px;
    font-weight: 650;
}

.tab-button:hover {
    border-color: transparent;
    background: var(--accent-soft);
    color: var(--text);
    box-shadow: none;
    transform: none;
}

.tab-button.is-active {
    background: var(--surface);
    box-shadow: 0 3px 10px rgba(105, 61, 37, 0.1);
    color: #8f3f20;
}

.tab-button.is-active::after {
    content: none;
}

.tab-panel {
    display: grid;
    gap: 16px;
}

.tab-panel[hidden] {
    display: none;
}

.editor-section,
.notice {
    border: 1px solid var(--line);
    border-radius: 20px;
    background: linear-gradient(180deg, var(--surface) 0%, #fffbf7 100%);
    padding: 20px;
    box-shadow: var(--shadow-soft);
}

.editor-section {
    display: grid;
    gap: 18px;
    scroll-margin-top: 24px;
}

.editor-section:target {
    border-color: #d89f7d;
    box-shadow: 0 10px 28px rgba(187, 89, 46, 0.1);
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-heading h2 {
    display: flex;
    align-items: center;
    gap: 9px;
}

.section-heading h2::before {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 5px var(--accent-soft);
    content: "";
}

.notice {
    border-color: #e7b9b4;
    background: #fff4f2;
    margin-bottom: 18px;
}

.notice h2 {
    margin-bottom: 8px;
}

.field-grid {
    display: grid;
    gap: 12px;
}

.row-list {
    display: grid;
    gap: 12px;
}

.editor-row {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-muted);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
    padding: 15px;
    transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.editor-row:focus-within {
    border-color: #daa88b;
    background: #fffaf6;
    box-shadow: 0 6px 18px rgba(105, 61, 37, 0.06);
}

.instructor-row {
    position: relative;
    border-left: 4px solid var(--sage);
}

.instructor-row .row-actions {
    position: absolute;
    z-index: 1;
    top: calc(15px + 1.35rem + 6px);
    right: 15px;
    display: flex;
    justify-content: flex-end;
    margin: 0;
}

.lesson-block-grid {
    grid-template-columns: minmax(180px, 1fr) minmax(120px, 160px) minmax(120px, 160px) auto;
}

.two-column {
    grid-template-columns: minmax(0, 1fr) 160px;
}

.with-remove {
    grid-template-columns: minmax(0, 1fr) 160px auto;
}

.location-grid {
    grid-template-columns: minmax(0, 1fr) 160px auto;
}

.room-reservation-grid {
    grid-template-columns: minmax(0, 1fr) 140px 140px auto;
}

.instructor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.instructor-grid > label:nth-of-type(2) {
    padding-right: 58px;
}

.instructor-details-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.instructor-can-teach-field {
    grid-template-rows: auto minmax(0, 1fr);
}

.instructor-can-teach-field textarea {
    height: auto;
    min-height: 0;
    line-height: 1.45;
}

.instructor-constraints {
    display: grid;
    gap: 12px;
}

.group-grid {
    grid-template-columns: calc(25% - 6px) calc(25% - 6px) minmax(0, 1fr) auto;
}

@media (min-width: 721px) {
    .room-reservation-grid > label:nth-of-type(1) {
        grid-column: 1 / 3;
        grid-row: 1;
    }

    .room-reservation-grid > label:nth-of-type(2) {
        grid-column: 3;
        grid-row: 1;
    }

    .room-reservation-grid > label:nth-of-type(3) {
        grid-column: 1;
        grid-row: 2;
    }

    .room-reservation-grid > label:nth-of-type(4) {
        grid-column: 2;
        grid-row: 2;
    }

    .room-reservation-grid > label:nth-of-type(5) {
        grid-column: 3;
        grid-row: 2;
    }

    .room-reservation-grid .remove-button {
        grid-column: 4;
        grid-row: 1;
    }

    .group-grid > label:nth-of-type(1) {
        grid-column: 1 / 3;
        grid-row: 1;
    }

    .group-grid > label:nth-of-type(2) {
        grid-column: 3;
        grid-row: 1;
    }

    .group-grid > label:nth-of-type(3) {
        grid-column: 1;
        grid-row: 2;
    }

    .group-grid > label:nth-of-type(4) {
        grid-column: 2;
        grid-row: 2;
    }

    .group-grid > label:nth-of-type(5) {
        grid-column: 3;
        grid-row: 2;
    }

    .group-grid > label:nth-of-type(6) {
        grid-column: 1 / 5;
        grid-row: 3;
    }
}

.stacked-fields {
    display: grid;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding-top: 16px;
}

.stacked-fields:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.secondary-button {
    justify-self: start;
    border-color: var(--line-strong);
    background: var(--surface);
    box-shadow: none;
    color: #7e3b22;
}

.secondary-button:hover {
    border-color: #d09674;
    background: var(--accent-soft);
    box-shadow: 0 5px 12px rgba(187, 89, 46, 0.1);
}

.remove-button {
    align-self: end;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
    width: calc(1.5em + 22px);
    height: calc(1.5em + 22px);
    border-color: var(--line-strong);
    background: #fffafa;
    box-shadow: none;
    color: var(--danger);
    padding: 0;
}

.remove-button:hover {
    border-color: #c9827d;
    background: #ffeae7;
    box-shadow: none;
    color: #923b38;
}

.remove-icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.group-grid .remove-button {
    grid-column: 4;
    grid-row: 1;
    align-self: end;
}

.extras-intro {
    margin: 0;
    color: var(--muted);
}

.extras-toggle-list {
    display: grid;
    gap: 10px;
}

.extras-toggle {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    border: 1px solid #efcdb7;
    border-radius: 12px;
    background: var(--accent-pale);
    padding: 12px 14px;
}

.extras-toggle-copy strong {
    display: block;
    color: var(--text);
}

.extras-toggle-copy > span {
    color: var(--muted);
    font-weight: 400;
}

.extras-toggle-control {
    position: relative;
    display: inline-flex;
    cursor: pointer;
}

.extras-toggle-control input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.extras-switch {
    position: relative;
    width: 48px;
    height: 28px;
    border: 1px solid #bda99d;
    border-radius: 999px;
    background: #cdbdb3;
    box-shadow: inset 0 1px 3px rgba(62, 48, 41, 0.12);
    transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.extras-switch::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 5px rgba(62, 48, 41, 0.24);
    content: "";
    transition: transform 140ms ease;
}

.extras-toggle-control input:checked + .extras-switch {
    border-color: var(--accent);
    background: var(--accent);
}

.extras-toggle-control input:checked + .extras-switch::after {
    transform: translateX(20px);
}

.extras-toggle-control input:focus-visible + .extras-switch {
    outline: 3px solid rgba(187, 89, 46, 0.22);
    outline-offset: 2px;
}

.extras-weight-section {
    display: grid;
    gap: 10px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 18px 0;
}

.extras-weight-section h3 {
    margin-bottom: 4px;
}

.extras-weight-list {
    display: grid;
    gap: 10px;
}

.extras-weight {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-muted);
    padding: 12px 14px;
}

.extras-weight-copy strong {
    display: block;
    color: var(--text);
}

.extras-weight-copy > span,
.extras-weight-control > span {
    color: var(--muted);
    font-weight: 400;
}

.extras-weight-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.extras-weight-control input {
    width: 74px;
}

.extras-weight-examples {
    display: grid;
    gap: 8px;
    margin: 0;
    border-left: 4px solid var(--accent);
    border-radius: 10px;
    background: var(--accent-pale);
    padding: 10px 12px;
    color: var(--muted);
}

.extras-weight-examples-title {
    margin: 0;
}

.extras-weight-examples-title strong,
.extras-weight-case summary {
    color: var(--text);
}

.extras-weight-case {
    border-top: 1px solid rgba(187, 89, 46, 0.18);
    padding-top: 8px;
}

.extras-weight-case summary {
    cursor: pointer;
    font-weight: 700;
}

.extras-weight-case-copy {
    display: grid;
    gap: 8px;
    padding: 8px 0 2px 18px;
}

.extras-weight-case-copy p {
    margin: 0;
}

.section-intro {
    margin: 0;
    color: var(--muted);
}

.extras-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.extras-list li {
    border-left: 4px solid var(--sage);
    border-radius: 12px;
    background: var(--surface-muted);
    padding: 12px 14px;
}

.extras-list strong {
    display: block;
    margin-bottom: 2px;
}

.raw-spec-status {
    border-radius: 999px;
    background: var(--sage-soft);
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    padding: 5px 10px;
}

.raw-editor-section {
    display: grid;
    gap: 16px;
}

.raw-tools {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
}

.raw-spec-actions {
    display: flex;
    justify-content: flex-end;
}

.file-picker {
    min-width: min(100%, 420px);
}

.file-picker input::file-selector-button {
    margin-right: 10px;
    border: 0;
    border-radius: 8px;
    background: var(--accent-soft);
    color: #7e3b22;
    cursor: pointer;
    font: inherit;
    font-weight: 650;
    padding: 7px 10px;
}

.form-actions {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    padding: 6px 2px;
}

.solver-time-limit {
    margin-right: auto;
}

.solver-time-limit-input {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-weight: 500;
}

.solver-time-limit input {
    width: 84px;
}

.form-actions button:not([data-run-scheduler]) {
    border-color: var(--line-strong);
    background: var(--surface);
    box-shadow: none;
    color: #7e3b22;
}

.form-actions button:not([data-run-scheduler]):hover {
    border-color: #d09674;
    background: var(--accent-soft);
}

main > form:not(#import-spec-form) {
    display: grid;
    width: min(100%, 880px);
    gap: 16px;
    margin: 24px auto 0;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: linear-gradient(180deg, var(--surface) 0%, #fffbf7 100%);
    box-shadow: var(--shadow-soft);
    padding: 20px;
}

main > form:not(#import-spec-form) > section {
    display: grid;
    gap: 10px;
}

main > form:not(#import-spec-form) > p {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0;
}

.solver-loading {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 10px;
    background: rgba(255, 248, 242, 0.94);
    backdrop-filter: blur(8px);
    color: var(--text);
    text-align: center;
}

.solver-loading[hidden] {
    display: none;
}

.solver-loading > span {
    color: var(--muted);
}

.solver-loading > .solver-queue-position,
.pending-page > .solver-queue-position {
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 650;
}

.solver-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--line-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: solver-spin 1s linear infinite;
}

@keyframes solver-spin {
    to {
        transform: rotate(360deg);
    }
}

.pending-page {
    display: grid;
    min-height: 60vh;
    place-content: center;
    justify-items: center;
    gap: 14px;
    text-align: center;
}

.pending-page p {
    margin: 0;
    color: var(--muted);
}

.queue-full-page {
    display: grid;
    min-height: calc(100vh - 88px);
    place-content: center;
}

.queue-full-card {
    display: grid;
    justify-items: center;
    width: min(100%, 560px);
    border: 1px solid var(--line);
    border-radius: 24px;
    background: linear-gradient(180deg, var(--surface) 0%, #fffbf7 100%);
    box-shadow: var(--shadow);
    padding: clamp(32px, 7vw, 52px);
    text-align: center;
}

.queue-full-mark {
    display: grid;
    gap: 7px;
    width: 76px;
    margin-bottom: 24px;
}

.queue-full-mark span {
    height: 12px;
    border: 1px solid var(--line-strong);
    border-left: 7px solid var(--accent);
    border-radius: 999px;
    background: var(--accent-pale);
    box-shadow: var(--shadow-soft);
}

.queue-full-mark span:nth-child(2) {
    border-left-color: var(--sage);
    transform: translateX(8px);
}

.queue-full-card h1 {
    font-size: clamp(2rem, 7vw, 2.75rem);
}

.queue-full-message {
    max-width: 390px;
    margin: 16px 0 28px;
    color: var(--muted);
    font-size: 1.05rem;
}

.queue-full-action {
    border: 1px solid var(--accent);
    border-radius: 12px;
    background: var(--accent);
    box-shadow: 0 5px 12px rgba(187, 89, 46, 0.16);
    color: #ffffff;
    font-weight: 600;
    padding: 10px 16px;
    text-decoration: none;
    transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.queue-full-action:hover {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
    box-shadow: 0 7px 16px rgba(169, 76, 37, 0.2);
    transform: translateY(-1px);
}

.queue-full-action:focus-visible {
    outline: 3px solid rgba(187, 89, 46, 0.22);
    outline-offset: 2px;
}

.schedule-grid {
    margin: 22px 0;
    width: min(calc(100vw - 64px), 1680px);
    margin-left: 50%;
    transform: translateX(-50%);
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.result-status {
    display: grid;
    gap: 2px;
    margin-top: 16px;
    border-left: 4px solid var(--sage);
    border-radius: 12px;
    background: var(--sage-soft);
    color: var(--muted);
    padding: 12px 14px;
}

.result-status strong {
    color: var(--text);
}

.schedule-table {
    width: calc(var(--schedule-column-count) * var(--schedule-column-width));
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.schedule-corner,
.schedule-time {
    width: var(--schedule-column-width);
    min-width: var(--schedule-column-width);
    max-width: var(--schedule-column-width);
    padding: 12px;
    color: #46515c;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: left;
    vertical-align: top;
}

.schedule-corner {
    background: #f8e4d5;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    vertical-align: bottom;
}

.schedule-time {
    background: #fff7f0;
    border-right: 1px solid var(--line);
}

/* Alternate two related warm pastels by day for scanability without a rainbow effect. */
.schedule-day-tone-0,
.schedule-day-tone-2,
.schedule-day-tone-4,
.schedule-day-tone-6 {
    --schedule-day-heading-bg: #f5d3bd;
    --schedule-day-room-bg: #fbe6d8;
    --schedule-day-cell-bg: #fff7f1;
    --schedule-day-stripe-bg: #f3e8df;
}

.schedule-day-tone-1,
.schedule-day-tone-3,
.schedule-day-tone-5 {
    --schedule-day-heading-bg: #eadfd5;
    --schedule-day-room-bg: #f3ebe4;
    --schedule-day-cell-bg: #fcfaf7;
    --schedule-day-stripe-bg: #eee9e3;
}

.schedule-day-heading {
    background: var(--schedule-day-heading-bg);
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
    text-align: left;
}

.schedule-room-heading {
    background: var(--schedule-day-room-bg);
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-align: left;
}

.schedule-room-heading,
.schedule-cell {
    width: var(--schedule-column-width);
    min-width: var(--schedule-column-width);
    max-width: var(--schedule-column-width);
}

.schedule-day-heading,
.schedule-room-heading,
.schedule-cell {
    border-left: 1px solid var(--line);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.schedule-table tbody tr + tr .schedule-time,
.schedule-table tbody tr + tr .schedule-cell {
    border-top: 1px solid var(--line);
}

.schedule-cell {
    height: 112px;
    padding: 6px;
    background: var(--schedule-day-cell-bg);
    vertical-align: top;
}

.schedule-cell.schedule-cell-unavailable {
    background: repeating-linear-gradient(
        -45deg,
        var(--schedule-day-stripe-bg),
        var(--schedule-day-stripe-bg) 8px,
        var(--schedule-day-cell-bg) 8px,
        var(--schedule-day-cell-bg) 16px
    );
}

.group-color-select:has(option[value="pink"]:checked),
.group-color-select option[value="pink"],
.lesson-card-pink {
    --group-color-bg: #f6d9df;
    --group-color-border: #ce8e9a;
}

.group-color-select:has(option[value="orange"]:checked),
.group-color-select option[value="orange"],
.lesson-card-orange {
    --group-color-bg: #f8dfcf;
    --group-color-border: #d69c78;
}

.group-color-select:has(option[value="yellow"]:checked),
.group-color-select option[value="yellow"],
.lesson-card-yellow {
    --group-color-bg: #f5e8bd;
    --group-color-border: #c9ad59;
}

.group-color-select:has(option[value="green"]:checked),
.group-color-select option[value="green"],
.lesson-card-green {
    --group-color-bg: #dcebd7;
    --group-color-border: #8eaf84;
}

.group-color-select:has(option[value="teal"]:checked),
.group-color-select option[value="teal"],
.lesson-card-teal {
    --group-color-bg: #d6e9e7;
    --group-color-border: #7faeaa;
}

.group-color-select:has(option[value="blue"]:checked),
.group-color-select option[value="blue"],
.lesson-card-blue {
    --group-color-bg: #dbe7f5;
    --group-color-border: #87a9d2;
}

.group-color-select:has(option[value="purple"]:checked),
.group-color-select option[value="purple"],
.lesson-card-purple {
    --group-color-bg: #e5def3;
    --group-color-border: #9f8cc7;
}

.group-color-select {
    background: var(--group-color-bg, rgba(255, 255, 255, 0.86));
    font-weight: 600;
}

.group-color-select option {
    background: var(--group-color-bg);
    color: var(--text);
}

.lesson-card {
    min-width: calc(var(--schedule-column-width) - 12px);
    border: 1px solid var(--group-color-border);
    border-left: 4px solid var(--group-color-border);
    border-radius: 10px;
    background: var(--group-color-bg);
    box-shadow: 0 4px 10px rgba(73, 91, 57, 0.07);
    padding: 9px 10px;
    overflow-wrap: break-word;
}

.lesson-card h3 {
    margin: 0 0 5px;
    font-size: 0.9rem;
    line-height: 1.2;
}

.lesson-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

@media (max-width: 720px) {
    main {
        width: min(calc(100% - 24px), 980px);
        padding-top: 24px;
    }

    .page-header {
        display: block;
        width: 100%;
    }

    .page-header h1 {
        font-size: 1.95rem;
    }

    .editor-layout {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .section-nav {
        position: static;
        display: flex;
        overflow-x: auto;
        padding: 6px;
    }

    .section-heading {
        display: grid;
    }

    .editor-tabs {
        border-radius: 16px;
    }

    .editor-section,
    .notice {
        padding: 16px;
    }

    .editor-row {
        padding: 13px;
    }

    .lesson-block-grid,
    .location-grid,
    .room-reservation-grid,
    .two-column,
    .with-remove,
    .instructor-grid,
    .group-grid {
        grid-template-columns: 1fr;
    }

    .group-grid .remove-button {
        grid-column: auto;
        grid-row: auto;
    }

    .instructor-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .instructor-row .instructor-grid {
        grid-column: 1;
        grid-row: 1;
    }

    .instructor-row .row-actions {
        position: static;
        grid-column: 1;
        grid-row: 2;
    }

    .instructor-grid > label:nth-of-type(2) {
        padding-right: 0;
    }

    .instructor-details-grid {
        grid-template-columns: 1fr;
    }

    .instructor-can-teach-field textarea {
        min-height: 220px;
    }

    .extras-toggle {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .extras-toggle-control {
        justify-self: start;
    }

    .extras-weight {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .schedule-grid {
        width: calc(100vw - 24px);
    }
}

@media (max-width: 440px) {
    .section-heading .secondary-button,
    .form-actions button,
    main > form:not(#import-spec-form) > p button {
        width: 100%;
    }

    .raw-spec-status {
        justify-self: start;
    }

    .solver-time-limit {
        width: 100%;
    }
}
