:root {
    --bg: #f4efe6;
    --paper: rgba(255, 252, 248, 0.92);
    --text: #1f2933;
    --muted: #5f6c7b;
    --line: rgba(31, 41, 51, 0.12);
    --accent: #c9693a;
    --accent-deep: #8f4222;
    --girl-soft: linear-gradient(135deg, #ffe1ec, #ffc5d9);
    --boy-soft: linear-gradient(135deg, #dcecff, #bfdcff);
    --shadow: 0 20px 45px rgba(93, 63, 45, 0.15);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(201, 105, 58, 0.18), transparent 30%),
        radial-gradient(circle at bottom right, rgba(92, 107, 192, 0.18), transparent 24%),
        var(--bg);
}

.page-shell {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
}

.topbar,
.content {
    background: var(--paper);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 24px;
    position: sticky;
    top: 24px;
    z-index: 20;
}

.eyebrow {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.78rem;
    color: var(--accent-deep);
}

.brand h1,
.toolbar h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 4vw, 3.5rem);
}

.topbar .brand h1 {
    font-size: clamp(1.7rem, 2.8vw, 2.5rem);
}

.menu {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
}

.menu-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 16px;
    border-radius: 16px;
    text-decoration: none;
    color: var(--text);
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid transparent;
}

.menu-item.active {
    background: linear-gradient(135deg, #f7d8c8, #f0b18c);
    border-color: rgba(143, 66, 34, 0.25);
}

.menu-item.disabled {
    opacity: 0.45;
}

.content {
    padding: 28px;
    width: 100%;
}

.main-menu-content {
    min-height: min(520px, calc(100vh - 190px));
}

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: start;
}

.toolbar h1 {
    color: var(--accent-deep);
}

.main-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-top: 28px;
}

.version-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.64);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.92rem;
}

.version-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(31, 41, 51, 0.08);
    color: var(--accent-deep);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.main-choice-card {
    display: grid;
    gap: 12px;
    min-height: 210px;
    padding: 24px;
    border-radius: 24px;
    color: var(--text);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid var(--line);
    box-shadow: 0 14px 30px rgba(31, 41, 51, 0.08);
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.main-choice-card:hover {
    transform: translateY(-2px);
    border-color: rgba(143, 66, 34, 0.28);
    box-shadow: 0 20px 38px rgba(93, 63, 45, 0.14);
}

.main-choice-kicker {
    width: fit-content;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(31, 41, 51, 0.08);
    color: var(--accent-deep);
    font-weight: 800;
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.main-choice-card strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.main-choice-card span:last-child {
    color: var(--muted);
    line-height: 1.45;
}

.section-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 24px 0 0;
    padding: 8px;
    border-radius: 18px;
    background: rgba(31, 41, 51, 0.06);
    border: 1px solid rgba(31, 41, 51, 0.08);
}

.section-tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 12px;
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
}

.section-tabs a.active {
    background: white;
    color: var(--accent-deep);
    box-shadow: 0 8px 18px rgba(31, 41, 51, 0.08);
}

.muted {
    color: var(--muted);
}

.import-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
}

.toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
}

.file-input {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border-radius: 14px;
    background: white;
    border: 1px solid var(--line);
    cursor: pointer;
}

.file-input input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file-input-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
    border-color: transparent;
    color: white;
    font-weight: 700;
}

button {
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
    color: white;
    font-weight: 700;
    cursor: pointer;
}

button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.secondary-button {
    background: rgba(31, 41, 51, 0.08);
    color: var(--text);
}

.secondary-button.active {
    background: linear-gradient(135deg, #f7d8c8, #f0b18c);
    color: var(--accent-deep);
    border-color: rgba(143, 66, 34, 0.24);
    box-shadow: 0 10px 18px rgba(143, 66, 34, 0.12);
}

label {
    display: grid;
    gap: 8px;
}

label span {
    font-weight: 700;
}

select,
textarea,
input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.85);
    color: var(--text);
    font: inherit;
}

textarea {
    resize: vertical;
}

small {
    color: var(--muted);
}

.flash,
.empty-state {
    margin-top: 24px;
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
}

.flash-popup {
    width: min(520px, calc(100vw - 32px));
    padding: 0;
    border: 0;
    border-radius: 24px;
    background: transparent;
    box-shadow: none;
}

.flash-popup::backdrop {
    background: rgba(31, 41, 51, 0.42);
    backdrop-filter: blur(4px);
}

.flash-popup-body {
    display: grid;
    gap: 16px;
    padding: 24px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 248, 252, 0.98));
    border: 1px solid rgba(31, 41, 51, 0.08);
    box-shadow: 0 24px 60px rgba(31, 41, 51, 0.18);
}

.flash-popup-body p {
    margin: 0;
    color: var(--accent-deep);
    font-size: 1rem;
    line-height: 1.5;
}

.flash-popup-body form {
    display: flex;
    justify-content: flex-end;
}

.edt-loading-popup {
    width: min(360px, calc(100vw - 32px));
}

.edt-loading-popup::backdrop {
    background: rgba(31, 41, 51, 0.5);
    backdrop-filter: blur(5px);
}

.edt-loading-popup-body {
    justify-items: center;
    text-align: center;
    padding: 28px 24px;
}

.edt-loading-popup-body p {
    font-size: 1.05rem;
    font-weight: 700;
}

.edt-loading-spinner {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    border: 5px solid rgba(201, 105, 58, 0.18);
    border-top-color: var(--accent);
    animation: edt-loading-spin 0.9s linear infinite;
}

@keyframes edt-loading-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.impact-popup-body {
    gap: 18px;
}

.impact-popup-section {
    display: grid;
    gap: 8px;
}

.impact-popup-list {
    display: grid;
    gap: 8px;
}

.impact-popup-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(31, 41, 51, 0.06);
}

.impact-popup-row strong {
    min-width: 0;
}

.impact-popup-delta {
    min-width: 44px;
    text-align: right;
    font-weight: 800;
}

.impact-popup-delta.better {
    color: #1a7f37;
}

.impact-popup-delta.worse {
    color: #b42318;
}

.impact-popup-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.impact-sticky-panel {
    width: 100%;
    margin: 0 0 12px;
    pointer-events: auto;
}

.impact-sticky-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.impact-sticky-panel.is-collapsed .impact-popup-list {
    display: none;
}

.edt-move-inline-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.edt-move-inline-banner p {
    margin: 0;
}

.edt-preview-inline-banner p {
    margin: 0;
}

.edt-preview-savebar {
    position: sticky;
    bottom: 16px;
    z-index: 30;
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
    padding-bottom: 8px;
    pointer-events: none;
}

.edt-preview-savebar form {
    pointer-events: auto;
    padding: 10px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(31, 41, 51, 0.08);
    box-shadow: 0 16px 36px rgba(31, 41, 51, 0.18);
}

.edt-preview-savebar.edt-preview-savebar-tools {
    justify-content: flex-start;
    pointer-events: none;
}

.edt-preview-savebar.edt-preview-savebar-tools form {
    pointer-events: auto;
}

.edt-preview-toggle-form {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
}

.edt-preview-toggle-form .secondary-button {
    transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.edt-preview-toggle-form .secondary-button.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
    color: #fff;
    border: 1px solid rgba(143, 66, 34, 0.52);
    box-shadow:
        0 14px 28px rgba(143, 66, 34, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 0 0 4px rgba(201, 105, 58, 0.18);
    transform: translateY(-2px) scale(1.02);
    position: relative;
}

.edt-preview-toggle-form .secondary-button.active::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0));
    pointer-events: none;
}

.edt-global-score-banner {
    margin: 14px 0 18px;
    padding: 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(31, 41, 51, 0.08);
    box-shadow: 0 16px 36px rgba(31, 41, 51, 0.14);
    backdrop-filter: blur(10px);
}

.edt-global-score-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.edt-global-score-card {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(31, 41, 51, 0.06);
}

.edt-global-score-card span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.edt-global-score-card strong {
    color: var(--accent-deep);
    font-size: 1.15rem;
    line-height: 1.2;
}

.edt-global-score-card.total {
    background: #1f2933;
}

.edt-global-score-card.total span,
.edt-global-score-card.total strong {
    color: white;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 24px 0;
}

.options-filters {
    display: block;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--line);
}

.filter-chip.active {
    background: #1f2933;
    color: white;
}

.filter-chip-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.8rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(31, 41, 51, 0.12);
    font-size: 0.84rem;
    font-weight: 800;
}

.filter-chip.active .filter-chip-count {
    background: rgba(255, 255, 255, 0.18);
}

.options-filter-form {
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
}

.planner-panel,
.saved-plans-panel,
.plan-constraints-panel,
.plan-quality-panel,
.legend-panel {
    margin-top: 24px;
    padding: 20px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
}

.collapsible-panel summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
}

.collapsible-panel summary::-webkit-details-marker {
    display: none;
}

.collapsible-panel summary::after {
    content: "+";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: rgba(31, 41, 51, 0.08);
    color: var(--accent-deep);
    font-size: 1.25rem;
    font-weight: 800;
    flex: 0 0 auto;
}

.collapsible-panel[open] summary {
    margin-bottom: 16px;
}

.collapsible-panel[open] summary::after {
    content: "−";
}

.collapsible-panel summary .section-label {
    margin: 0;
}

.plan-constraints-form,
.student-constraints-panel {
    display: grid;
    gap: 16px;
}

.plan-constraints-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.8fr);
    gap: 18px;
}

.plan-constraints-grid > :only-child {
    grid-column: 1 / -1;
}

.saved-class-constraints,
.score-order-list,
.student-constraints-list {
    display: grid;
    gap: 10px;
}

.saved-class-constraints {
    margin-bottom: 24px;
}

.student-constraint-form,
.student-constraint-item {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
}

.score-order-item {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr) auto 2rem;
    gap: 10px;
    align-items: center;
    padding: 11px 12px;
    border-radius: 12px;
    background: rgba(31, 41, 51, 0.06);
    border: 1px solid transparent;
    cursor: grab;
}

.score-order-item.dragging {
    opacity: 0.55;
    cursor: grabbing;
    border-color: rgba(31, 41, 51, 0.28);
}

.score-order-item:focus-visible {
    outline: 3px solid rgba(32, 111, 110, 0.28);
    outline-offset: 2px;
}

.score-order-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    font-weight: 800;
}

.score-order-actions {
    display: inline-flex;
    gap: 6px;
}

.score-order-move {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border-radius: 999px;
    font-size: 0.95rem;
    line-height: 1;
}

.score-order-move:disabled {
    cursor: not-allowed;
    opacity: 0.35;
}

.score-order-handle {
    color: var(--muted);
    font-weight: 900;
    text-align: center;
}

.student-constraint-form select,
.student-autocomplete-field input[type="text"] {
    min-width: 190px;
}

.student-autocomplete-field {
    display: grid;
    gap: 6px;
}

.student-constraint-item {
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(31, 41, 51, 0.06);
}

.modal-dialog {
    width: min(760px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    padding: 0;
    border: 0;
    border-radius: 24px;
    background: transparent;
    color: var(--text);
}

.modal-dialog::backdrop {
    background: rgba(31, 41, 51, 0.42);
    backdrop-filter: blur(4px);
}

.modal-panel {
    display: grid;
    gap: 16px;
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 22px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 24px;
    background: var(--paper);
    box-shadow: var(--shadow);
}

.student-constraints-dialog .student-constraint-form {
    align-items: end;
}

.student-import-preview-dialog {
    width: min(940px, calc(100vw - 32px));
}

.import-form {
    align-items: stretch;
}

.import-ignore-levels {
    display: grid;
    gap: 8px;
    min-width: min(320px, 100%);
}

.import-ignore-levels-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.edt-missing-subjects-dialog {
    width: min(980px, calc(100vw - 32px));
}

.import-preview-new-options,
.import-preview-list {
    display: grid;
    gap: 12px;
}

.import-preview-item {
    display: grid;
    gap: 10px;
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(31, 41, 51, 0.06);
    border: 1px solid rgba(31, 41, 51, 0.08);
}

.import-preview-item-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
}

.import-preview-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.import-preview-action-create {
    background: rgba(43, 138, 62, 0.12);
    color: #226134;
}

.import-preview-action-update {
    background: rgba(201, 105, 58, 0.14);
    color: var(--accent-deep);
}

.import-preview-action-delete {
    background: rgba(180, 43, 43, 0.12);
    color: #8f2020;
}

.import-preview-fields,
.import-preview-before {
    margin: 0;
}

.import-preview-before {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(31, 41, 51, 0.08);
    font-size: 0.92rem;
}

.import-preview-empty {
    margin: 0;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(31, 41, 51, 0.06);
}

.quality-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.quality-metric {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(31, 41, 51, 0.06);
}

.quality-metric span {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.quality-metric strong {
    font-size: 1.3rem;
}

.quality-alerts {
    display: grid;
    gap: 6px;
    margin-top: 14px;
}

.option-balance-details,
.settings-summary-grid {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.settings-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 18px;
}

.planner-settings-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.simulation-updated-at {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.78);
    color: var(--muted);
    font-weight: 600;
}

.saved-plan-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
}

.simulation-backup-grid {
    margin-bottom: 18px;
}

.simulation-backup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.backup-diff-preview-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 18px 0;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(201, 105, 58, 0.24);
    background: linear-gradient(135deg, rgba(255, 245, 236, 0.96), rgba(255, 250, 245, 0.98));
}

.backup-diff-preview-banner .section-label,
.backup-diff-preview-banner .muted {
    margin: 0;
}

.simulation-backup-list {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.settings-summary-item,
.option-balance-row {
    display: grid;
    gap: 5px;
    padding: 11px 13px;
    border-radius: 12px;
    background: rgba(31, 41, 51, 0.06);
}

.settings-summary-item span,
.option-balance-row span {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 800;
}

.settings-summary-item strong,
.option-balance-row strong {
    font-size: 0.95rem;
}

.quality-alerts p,
.quality-note {
    margin: 0;
}

.planner-form,
.planner-subsection {
    display: grid;
    gap: 18px;
}

.planner-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
}

.export-file-row {
    margin-bottom: 16px;
}

.planner-checkbox-field {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    align-self: end;
    min-height: 48px;
}

.planner-checkbox-field input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}

.planner-checkbox-field span {
    font-weight: 700;
}

.saved-plan-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}

.saved-plan-form label {
    flex: 1 1 360px;
}

.class-config-list {
    display: grid;
    gap: 14px;
}

.planner-constraints-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.class-config-row {
    display: grid;
    grid-template-columns: minmax(160px, 220px) 1fr;
    gap: 14px;
    align-items: end;
}

.saved-class-constraint-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    padding: 18px 20px 20px;
    border: 1px solid rgba(31, 41, 51, 0.14);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
}

.saved-class-name {
    display: grid;
    gap: 8px;
}

.saved-class-name span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.saved-class-name strong {
    min-height: 0;
    display: flex;
    align-items: center;
    font-size: 0.98rem;
    line-height: 1.1;
    white-space: nowrap;
}

.saved-class-name input[type="text"] {
    width: 100%;
}

.saved-class-constraint-separator {
    width: 100%;
    height: 0;
    border-top: 1px solid rgba(31, 41, 51, 0.16);
}

.class-options-builder {
    display: grid;
    gap: 10px;
    padding-bottom: 2px;
}

.saved-class-constraint-row .class-options-builder {
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
}

.saved-class-constraint-row .class-options-builder > .option-filter-section {
    align-content: start;
    min-height: 100%;
    padding: 10px 12px 12px;
    border-radius: 14px;
    background: rgba(31, 41, 51, 0.04);
    border: 1px solid rgba(31, 41, 51, 0.08);
}

.saved-class-constraint-row .class-options-builder > .option-filter-section.is-empty {
    opacity: 0.72;
}

.class-option-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.saved-class-constraint-row .class-option-pills {
    gap: 6px;
}

.saved-class-constraint-row .class-option-pills.compact {
    gap: 5px;
}

.saved-class-constraint-row .option-filter-section .section-label {
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(31, 41, 51, 0.08);
}

.saved-class-constraint-row .option-filter-section .option-filter-list {
    min-height: 2.25rem;
}

.planner-compatibility-panel {
    margin-top: 24px;
    margin-bottom: 24px;
}

.planner-compatibility-panel .section-label {
    margin-bottom: 8px;
}

.score-order-list {
    margin-top: 18px;
}

.plan-constraints-form + .student-constraints-panel {
    margin-top: 24px;
}

.planner-compatibility-list {
    display: grid;
    gap: 8px;
}

.planner-compatibility-list p,
.planner-compatibility-summary p {
    margin: 0;
}

.planner-compatibility-panel[data-state="error"] {
    border-color: rgba(159, 47, 47, 0.28);
    background: rgba(255, 239, 239, 0.92);
}

.planner-compatibility-panel[data-state="ok"] {
    border-color: rgba(58, 148, 90, 0.24);
    background: rgba(240, 255, 244, 0.9);
}

.planner-compatibility-panel[data-state="warning"] {
    border-color: rgba(179, 116, 28, 0.28);
    background: rgba(255, 248, 232, 0.94);
}

.option-filter-chip,
.class-option-pill {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    padding: 0;
    font-weight: 600;
}

.class-option-pill {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.class-option-pill .class-option-pill-content {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(31, 41, 51, 0.12);
    color: rgba(31, 41, 51, 0.62);
}

.class-option-pill .class-option-pill-label {
    min-width: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.class-option-pill .class-option-pill-count {
    display: inline-block;
    min-width: 3ch;
    text-align: right;
    font-size: 0.74rem;
    font-weight: 800;
    color: rgba(31, 41, 51, 0.68);
    white-space: nowrap;
}

.class-option-pill .class-option-pill-count.is-empty {
    visibility: hidden;
}

.class-option-pill .class-option-pill-content::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(31, 41, 51, 0.28);
}

.class-option-pill:hover .class-option-pill-content {
    background: rgba(255, 255, 255, 0.7);
    color: var(--text);
}

.class-option-pill.active .class-option-pill-content {
    outline: 2px solid rgba(31, 41, 51, 0.45);
    background: #fff;
    border-color: var(--line);
    color: var(--text);
}

.class-option-pill.active .class-option-pill-content::before {
    background: var(--badge-color);
}

.saved-class-constraint-row .class-option-pill .class-option-pill-content {
    gap: 6px;
    padding: 5px 8px;
}

.saved-class-constraint-row .class-option-pill .class-option-pill-label {
    font-size: 0.78rem;
}

.saved-class-constraint-row .class-option-pill .class-option-pill-count {
    font-size: 0.62rem;
}

.saved-class-constraint-row .class-option-pill .class-option-pill-content::before {
    width: 6px;
    height: 6px;
}

.class-option-pill.school-option .class-option-pill-content::before {
    border-radius: 2px;
}

.planner-submit-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.generation-status {
    min-height: 1em;
    color: var(--accent-deep);
    font-weight: 700;
}

.class-actions-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    align-items: flex-start;
    margin-top: 24px;
}

.class-search-diagnostic-layout {
    display: flex;
    flex: 1 1 780px;
    align-items: flex-start;
    gap: 12px;
    margin-right: auto;
}

.class-search-controls {
    display: grid;
    gap: 10px;
    flex: 0 0 1000px;
    max-width: 1000px;
}

.class-controls-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.class-preview-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 16px;
    background: rgba(201, 105, 58, 0.1);
    border: 1px solid rgba(201, 105, 58, 0.18);
}

.class-search-field {
    max-width: none;
    margin-right: 0;
}

.students-filter-toolbar {
    margin: 12px 0 16px;
}

.student-search-field {
    max-width: 360px;
}

.pending-students-panel {
    display: grid;
    gap: 14px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(31, 41, 51, 0.1);
}

.pending-students-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.pending-student-card {
    display: grid;
    gap: 10px;
    justify-items: start;
    text-align: left;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(31, 41, 51, 0.1);
    background: var(--student-card-bg, rgba(255, 255, 255, 0.8));
    color: var(--text);
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.pending-student-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(31, 41, 51, 0.1);
}

.pending-student-card.girl {
    --student-card-bg: linear-gradient(135deg, rgba(255, 225, 236, 0.92), rgba(255, 255, 255, 0.92));
}

.pending-student-card.boy {
    --student-card-bg: linear-gradient(135deg, rgba(220, 236, 255, 0.92), rgba(255, 255, 255, 0.92));
}

.pending-student-card.add-selected {
    border-color: rgba(201, 105, 58, 0.55);
    box-shadow: 0 0 0 3px rgba(201, 105, 58, 0.14), 0 18px 30px rgba(201, 105, 58, 0.16);
    animation: pending-student-bob 1s ease-in-out infinite;
}

.pending-student-card.incompatible {
    border-color: rgba(143, 66, 34, 0.2);
    box-shadow: inset 0 0 0 1px rgba(143, 66, 34, 0.06);
}

.pending-student-title {
    font-weight: 800;
}

.pending-student-tag {
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(201, 105, 58, 0.16);
    color: var(--accent-deep);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.pending-student-tag.incompatible {
    background: rgba(143, 66, 34, 0.14);
    color: #8f4222;
}

.plan-quality-inline {
    flex: 1 1 420px;
    min-width: 0;
    margin-top: 0;
}

.class-scope-actions,
.class-balance-actions,
.class-swap-actions,
.class-relation-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.class-scope-actions[hidden],
.class-balance-actions[hidden],
.class-swap-actions[hidden],
.class-relation-actions[hidden] {
    display: none;
}

.class-mode-toggle {
    justify-self: start;
}

.class-color-mode-toggle {
    justify-self: start;
}

@media (max-width: 980px) {
    .class-search-diagnostic-layout {
        flex-direction: column;
        flex-basis: 100%;
    }

    .class-search-controls,
    .plan-quality-inline {
        width: 100%;
        max-width: none;
    }

    .class-controls-inline {
        align-items: flex-start;
    }

    .plan-quality-inline {
        min-width: 0;
    }
}

.classes-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 20px;
    align-items: start;
    min-width: 0;
}

.group-results-board {
    margin-top: 0;
}

.group-summary-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.group-summary-actions > a.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(143, 66, 34, 0.18);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 232, 223, 0.96));
    box-shadow: 0 10px 22px rgba(93, 63, 45, 0.12);
    color: var(--accent-deep);
    font-weight: 800;
    text-decoration: none;
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.group-summary-actions > a.secondary-button:hover,
.group-summary-actions > a.secondary-button:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(143, 66, 34, 0.32);
    background: linear-gradient(180deg, #fffaf6, #f3ddcf);
    box-shadow: 0 14px 28px rgba(93, 63, 45, 0.18);
    outline: none;
}

.class-column {
    display: grid;
    grid-template-rows: auto minmax(2.6rem, auto) 1fr;
    gap: 10px;
    padding: 14px;
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--line);
    box-shadow: 0 12px 30px rgba(31, 41, 51, 0.08);
    transition: transform 140ms ease, box-shadow 140ms ease, outline-color 140ms ease, opacity 140ms ease;
}

.class-column.scope-dimmed {
    opacity: 0.46;
}

.class-column.scope-selected {
    outline: 2px solid rgba(31, 41, 51, 0.35);
    outline-offset: 4px;
}

.class-column.drop-allowed {
    outline: 2px dashed rgba(58, 148, 90, 0.55);
    outline-offset: 4px;
}

.class-column.drop-forbidden {
    opacity: 0.56;
}

.class-column.drop-target {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(58, 148, 90, 0.18);
    outline: 2px solid rgba(58, 148, 90, 0.75);
    outline-offset: 4px;
}

.class-column.pending-add-allowed {
    outline: 2px dashed rgba(201, 105, 58, 0.45);
    outline-offset: 4px;
    animation: pending-add-column-pulse 1.05s ease-in-out infinite;
}

.class-column.pending-add-forbidden {
    opacity: 0.5;
}

.class-column.pending-add-target {
    box-shadow: 0 20px 36px rgba(201, 105, 58, 0.18);
}

.class-column-header {
    display: grid;
    gap: 7px;
    min-height: 4.4rem;
    min-width: 0;
    align-content: start;
    cursor: pointer;
}

.class-column.pending-add-allowed .class-column-header::after {
    content: "Ajouter ici";
    display: inline-flex;
    width: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(201, 105, 58, 0.16);
    color: var(--accent-deep);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.class-column-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.class-column-header h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.3rem;
    line-height: 1.1;
}

.class-quality-alert {
    margin: 4px 0 0;
    color: #9f2f2f;
    font-size: 0.76rem;
    font-weight: 800;
}

.class-student-list {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.class-student-card {
    padding: 8px 10px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: var(--student-card-bg, rgba(255, 255, 255, 0.92));
    cursor: grab;
    font-size: 0.86rem;
    line-height: 1.2;
}

.class-student-card.selected {
    outline: 3px solid rgba(31, 94, 70, 0.28);
    outline-offset: 3px;
    box-shadow: 0 10px 20px rgba(31, 94, 70, 0.12);
}

.class-student-card.swap-selected {
    outline: 2px solid rgba(31, 41, 51, 0.48);
    outline-offset: 3px;
    box-shadow: 0 10px 20px rgba(31, 41, 51, 0.12);
}

.class-student-card.relation-selected {
    outline: 2px solid rgba(143, 66, 34, 0.55);
    outline-offset: 3px;
    box-shadow: 0 12px 24px rgba(143, 66, 34, 0.16);
}

.class-student-card.search-match {
    outline: 3px solid rgba(201, 105, 58, 0.72);
    outline-offset: 3px;
    box-shadow: 0 12px 24px rgba(201, 105, 58, 0.18);
}

.class-student-card.preview-moved {
    outline: 3px solid rgba(201, 105, 58, 0.72);
    outline-offset: 3px;
    box-shadow: 0 12px 24px rgba(201, 105, 58, 0.18);
}

.class-student-card.preview-grouped {
    background: linear-gradient(135deg, rgba(191, 235, 197, 0.95), rgba(247, 255, 249, 0.98));
    border-color: rgba(53, 122, 67, 0.35);
    outline: 3px solid rgba(53, 122, 67, 0.45);
    outline-offset: 3px;
    box-shadow: 0 12px 24px rgba(53, 122, 67, 0.16);
}

.class-student-card.preview-separated {
    background: linear-gradient(135deg, rgba(255, 216, 216, 0.96), rgba(255, 247, 247, 0.98));
    border-color: rgba(170, 54, 54, 0.35);
    outline: 3px solid rgba(170, 54, 54, 0.45);
    outline-offset: 3px;
    box-shadow: 0 12px 24px rgba(170, 54, 54, 0.16);
}

.class-student-card.preview-swapped {
    background: linear-gradient(135deg, rgba(255, 242, 204, 0.98), rgba(255, 250, 235, 0.98));
    border-color: rgba(184, 122, 26, 0.42);
    outline: 3px solid rgba(184, 122, 26, 0.5);
    outline-offset: 3px;
    box-shadow: 0 12px 24px rgba(184, 122, 26, 0.18);
}

.classes-board.backup-diff-preview-active .class-student-card {
    cursor: default;
}

.class-student-card.backup-diff-added {
    background: linear-gradient(135deg, rgba(219, 247, 225, 0.97), rgba(248, 255, 249, 0.98));
    border-color: rgba(54, 138, 78, 0.35);
    outline: 3px solid rgba(54, 138, 78, 0.28);
    outline-offset: 3px;
}

.class-student-card.backup-diff-moved {
    background: linear-gradient(135deg, rgba(219, 247, 225, 0.97), rgba(248, 255, 249, 0.98));
    border-color: rgba(54, 138, 78, 0.35);
    outline: 3px solid rgba(54, 138, 78, 0.28);
    outline-offset: 3px;
}

.class-student-card.backup-diff-removed {
    background: linear-gradient(135deg, rgba(232, 236, 240, 0.98), rgba(248, 250, 252, 0.98));
    border-color: rgba(115, 125, 138, 0.34);
    outline: 3px dashed rgba(115, 125, 138, 0.3);
    outline-offset: 3px;
}

.class-student-card.backup-diff-ghost {
    opacity: 0.9;
    cursor: default;
}

.class-student-card.backup-diff-ghost .student-lock {
    visibility: hidden;
}

.class-student-diff-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
}

.class-student-diff-tag {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    background: rgba(31, 41, 51, 0.08);
    color: rgba(31, 41, 51, 0.8);
}

.class-student-card.backup-diff-added .class-student-diff-tag {
    background: rgba(54, 138, 78, 0.16);
    color: rgba(31, 92, 50, 0.95);
}

.class-student-card.backup-diff-moved .class-student-diff-tag {
    background: rgba(54, 138, 78, 0.16);
    color: rgba(31, 92, 50, 0.95);
}

.class-student-card.backup-diff-removed .class-student-diff-tag {
    background: rgba(115, 125, 138, 0.16);
    color: rgba(71, 79, 92, 0.95);
}

.class-student-diff-note {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 600;
}

.class-student-card.search-muted {
    opacity: 0.34;
}

.classes-board.rerandomize-preview-active .class-column {
    transition: box-shadow 140ms ease, transform 140ms ease;
}

.student-card.search-match {
    outline: 3px solid rgba(201, 105, 58, 0.72);
    outline-offset: 3px;
    box-shadow: 0 12px 24px rgba(201, 105, 58, 0.18);
}

.student-card.search-muted {
    opacity: 0.4;
}

.class-student-card.dragging {
    opacity: 0.45;
    cursor: grabbing;
}

.class-student-card.girl {
    --student-card-bg: rgba(255, 225, 236, 0.95);
}

.class-student-card.boy {
    --student-card-bg: rgba(220, 236, 255, 0.95);
}

.class-student-card.color-edit-selected {
    outline: 3px solid rgba(44, 86, 44, 0.58);
    outline-offset: 3px;
    box-shadow: 0 12px 22px rgba(44, 86, 44, 0.16);
}

.group-editor-search-controls {
    margin-bottom: 1rem;
}

.group-editor-compatible-classes {
    margin-top: 0.25rem;
}

.group-editor-column-compatible {
    border-color: rgba(31, 94, 70, 0.36);
    box-shadow: 0 0 0 1px rgba(31, 94, 70, 0.08);
}

.group-editor-column-incompatible {
    opacity: 0.72;
}

.group-editor-empty {
    margin: 0;
    padding: 0.75rem;
}

.group-editor-column .class-student-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.group-editor-column .class-student-last-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-editor-column .class-student-first-name {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 7ch;
    justify-self: end;
}

.class-student-card[data-color-mode="niveau"][data-color-value="5"],
.class-student-card[data-color-mode="comportement"][data-color-value="5"],
.pending-student-card[data-color-mode="niveau"][data-color-value="5"],
.pending-student-card[data-color-mode="comportement"][data-color-value="5"] {
    --student-card-bg: linear-gradient(135deg, rgba(51, 107, 58, 0.94), rgba(233, 247, 235, 0.95));
}

.class-student-card[data-color-mode="niveau"][data-color-value="4"],
.class-student-card[data-color-mode="comportement"][data-color-value="4"],
.pending-student-card[data-color-mode="niveau"][data-color-value="4"],
.pending-student-card[data-color-mode="comportement"][data-color-value="4"] {
    --student-card-bg: linear-gradient(135deg, rgba(142, 203, 116, 0.92), rgba(244, 250, 239, 0.96));
}

.class-student-card[data-color-mode="niveau"][data-color-value="3"],
.class-student-card[data-color-mode="comportement"][data-color-value="3"],
.pending-student-card[data-color-mode="niveau"][data-color-value="3"],
.pending-student-card[data-color-mode="comportement"][data-color-value="3"] {
    --student-card-bg: linear-gradient(135deg, rgba(242, 216, 96, 0.92), rgba(255, 250, 228, 0.98));
}

.class-student-card[data-color-mode="niveau"][data-color-value="2"],
.class-student-card[data-color-mode="comportement"][data-color-value="2"],
.pending-student-card[data-color-mode="niveau"][data-color-value="2"],
.pending-student-card[data-color-mode="comportement"][data-color-value="2"] {
    --student-card-bg: linear-gradient(135deg, rgba(242, 164, 79, 0.92), rgba(255, 244, 229, 0.98));
}

.class-student-card[data-color-mode="niveau"][data-color-value="1"],
.class-student-card[data-color-mode="comportement"][data-color-value="1"],
.pending-student-card[data-color-mode="niveau"][data-color-value="1"],
.pending-student-card[data-color-mode="comportement"][data-color-value="1"] {
    --student-card-bg: linear-gradient(135deg, rgba(216, 91, 82, 0.94), rgba(255, 238, 237, 0.98));
}

@keyframes pending-student-bob {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-2px);
    }
}

@keyframes pending-add-column-pulse {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-2px);
    }
}

.class-student-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    font-weight: 700;
    white-space: nowrap;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.class-student-name-row {
    display: grid;
    grid-template-columns: 1rem minmax(0, 12ch) minmax(0, 9ch);
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

@media (min-width: 1800px) {
    .class-student-name-row {
        grid-template-columns: 1rem minmax(0, 15ch) minmax(0, 11ch);
    }
}

@media (min-width: 2200px) {
    .class-student-name-row {
        grid-template-columns: 1rem minmax(0, 18ch) minmax(0, 13ch);
    }
}

@media (max-width: 1400px) {
    .class-student-name-row {
        grid-template-columns: 1rem minmax(0, 10ch) minmax(0, 8ch);
    }
}

@media (max-width: 1100px) {
    .class-student-name-row {
        grid-template-columns: 1rem minmax(0, 8ch) minmax(0, 7ch);
    }
}

.class-student-last-name {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.class-student-first-name {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.student-lock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border-radius: 999px;
    background: transparent;
    color: var(--accent-deep);
    font-size: 0.68rem;
    line-height: 1;
    flex: 0 0 auto;
}

.student-lock.placeholder {
    visibility: hidden;
}

.option-dots {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
    flex: 0 0 auto;
}

.option-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--badge-color);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.option-dot-large {
    width: 11px;
    height: 11px;
}

.option-dot.school-option {
    border-radius: 2px;
}

.class-required-dots {
    min-height: 11px;
}

.class-column-header .muted {
    font-size: 0.79rem;
    line-height: 1.15;
}

.repartition-board {
    align-items: start;
}

.repartition-column {
    gap: 18px;
}

.repartition-column-body {
    display: grid;
    gap: 18px;
}

.repartition-column-heading {
    display: grid;
    gap: 6px;
}

.repartition-stat {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(31, 41, 51, 0.05);
    border: 1px solid rgba(31, 41, 51, 0.08);
}

.repartition-stat span {
    color: var(--muted);
    font-weight: 700;
}

.repartition-stat strong {
    font-size: 1rem;
}

.repartition-option-section {
    display: grid;
    gap: 10px;
}

.repartition-option-section .section-label {
    margin-bottom: 0;
}

.repartition-option-badges {
    gap: 10px;
}

.repartition-option-badge {
    justify-content: space-between;
    min-width: 0;
    width: 100%;
}

button.repartition-option-badge {
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    box-sizing: border-box;
}

.repartition-option-badge strong {
    font-size: 0.88rem;
}

.barrette-option-badge.is-selected {
    outline: 2px solid rgba(31, 41, 51, 0.45);
    transform: translateY(-1px);
}

.barrette-option-badge.is-synced {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72), 0 8px 18px rgba(31, 41, 51, 0.12);
}

.barrette-option-badge.is-disabled {
    opacity: 0.42;
    cursor: not-allowed;
    filter: saturate(0.25);
}

.barrette-option-badge::before {
    display: none;
}

.barrette-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.repartition-option-badge.is-empty {
    opacity: 0.56;
}

.repartition-plan-label {
    margin: -4px 0 18px;
}

@media (min-width: 1700px) {
    .classes-board {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

.option-filter-chip.static {
    cursor: pointer;
    appearance: none;
}

.option-filter-chip.static span {
    cursor: pointer;
}

.option-badges.compact .badge {
    font-size: 0.85rem;
}

.filter-row-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.filter-title-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filter-count {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(31, 41, 51, 0.08);
    color: var(--text);
    font-weight: 700;
    font-size: 0.92rem;
}

.reset-link {
    color: var(--accent-deep);
    text-decoration: none;
    font-weight: 700;
}

.option-filter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.option-filter-groups {
    display: grid;
    gap: 16px;
}

.option-filter-section {
    display: grid;
    gap: 10px;
}

.option-filter-section .section-label {
    margin-bottom: 0;
}

.filter-mode-toggle {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(31, 41, 51, 0.08);
    border: 1px solid rgba(31, 41, 51, 0.08);
}

.transfer-mode-toggle {
    margin-top: 24px;
}

.transfer-form {
    align-items: flex-start;
    justify-content: flex-start;
}

.transfer-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: flex-start;
}

.transfer-file-button {
    width: 180px;
    min-width: 180px;
    justify-self: start;
    flex: 0 0 180px;
}

.transfer-file-name {
    margin: 0;
    color: var(--text);
    font-size: 0.95rem;
}

.transfer-file-name.is-empty {
    color: var(--muted);
}

.filter-mode-chip {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: pointer;
    color: inherit;
    font: inherit;
    box-shadow: none;
}

.filter-mode-chip input {
    display: none;
}

.filter-mode-chip span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 7px 12px;
    border-radius: 999px;
    background: transparent;
    border: 1px solid transparent;
    font-weight: 800;
    font-size: 0.88rem;
    color: var(--muted);
    transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.filter-mode-chip.active span,
.filter-mode-chip input:checked + span {
    background: linear-gradient(135deg, #f7d8c8, #f0b18c);
    border-color: rgba(143, 66, 34, 0.22);
    color: var(--accent-deep);
    box-shadow: 0 6px 16px rgba(143, 66, 34, 0.14);
}

.filter-mode-chip:hover span {
    background: rgba(255, 255, 255, 0.7);
    color: var(--text);
}

.option-filter-chip {
    cursor: pointer;
}

.option-filter-chip input {
    display: none;
}

.option-filter-chip span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
}

.option-filter-chip span::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--badge-color);
}

.option-filter-chip.school-option span::before {
    border-radius: 2px;
}

.option-filter-chip.active span,
.option-filter-chip input:checked + span {
    outline: 2px solid rgba(143, 66, 34, 0.28);
    border-color: rgba(143, 66, 34, 0.24);
    background: linear-gradient(135deg, #f7d8c8, #f0b18c);
    color: var(--accent-deep);
}

.students-grid {
    display: grid;
    gap: 18px;
}

.student-card {
    border: 1px solid transparent;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(31, 41, 51, 0.08);
}

.student-card.girl {
    background: var(--girl-soft);
}

.student-card.boy {
    background: var(--boy-soft);
}

.student-card summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px 22px;
    cursor: pointer;
}

.student-card summary::-webkit-details-marker {
    display: none;
}

.student-name {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
}

.student-meta {
    margin: 6px 0 0;
    color: var(--muted);
}

.option-badges,
.options-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.badge,
.option-pill span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.badge::before,
.option-pill span::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--badge-color);
}

.badge.school-option::before,
.option-pill span.school-option::before {
    border-radius: 2px;
}

.student-details {
    padding: 0 22px 22px;
}

.section-label {
    margin: 0 0 12px;
    font-weight: 700;
}

.option-pill input {
    display: none;
}

.option-pill input:checked + span {
    outline: 2px solid rgba(31, 41, 51, 0.4);
}

.inline-create {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
    align-items: center;
}

.inline-create input[type="text"] {
    min-width: 240px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.85);
}

.save-status {
    min-height: 1em;
    color: var(--accent-deep);
    font-weight: 700;
}

.student-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(31, 41, 51, 0.12);
}

.danger-button {
    background: linear-gradient(135deg, #d95050, #9f2f2f);
}

.delete-status {
    min-height: 1em;
    color: #9f2f2f;
    font-weight: 700;
}

.options-admin-list {
    display: grid;
    gap: 16px;
}

.option-admin-card {
    display: grid;
    gap: 0;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
    overflow: hidden;
}

.option-admin-card summary {
    list-style: none;
}

.option-admin-card summary::-webkit-details-marker {
    display: none;
}

.option-admin-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 18px;
    cursor: pointer;
}

.option-admin-summary::after {
    content: "+";
    margin-left: auto;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-deep);
}

.option-admin-card[open] .option-admin-summary::after {
    content: "−";
}

.option-admin-heading {
    display: grid;
    gap: 8px;
}

.option-admin-heading .muted {
    margin: 0;
}

.option-admin-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}

.option-create-form {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(31, 41, 51, 0.08);
}

.option-admin-body {
    display: grid;
    gap: 16px;
    padding: 0 18px 18px;
    border-top: 1px solid rgba(31, 41, 51, 0.08);
}

.option-admin-form label {
    flex: 1 1 320px;
}

.option-color-field {
    flex: 0 0 140px;
}

.option-color-field input[type="color"] {
    width: 100%;
    min-height: 48px;
    padding: 6px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.85);
    cursor: pointer;
}

.option-admin-tools {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.option-constraint-field {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    align-self: end;
    min-height: 48px;
}

.option-constraint-field input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}

.option-constraint-field span {
    font-weight: 600;
}

.option-delete-form {
    display: flex;
    justify-content: flex-end;
}

.teacher-panel {
    margin-top: 24px;
    padding: 20px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
}

.edt-reset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.edt-reset-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid var(--line);
}

.edt-reset-item span {
    color: var(--muted);
    font-weight: 700;
}

.edt-class-filters {
    margin-bottom: 18px;
}

.teacher-form,
.teacher-list,
.teacher-card-body {
    display: grid;
    gap: 16px;
}

.teacher-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
}

.teacher-form label:has(input[name="service_hours"]) {
    min-width: 220px;
}

.subject-form-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(120px, 160px) auto;
    gap: 14px;
    align-items: end;
}

.subject-room-select {
    min-height: 9rem;
}

.edt-class-form-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px);
    gap: 14px;
}

.edt-room-form-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px);
    gap: 14px;
}

.subject-pill-list,
.edt-hours-list {
    display: grid;
    gap: 10px;
}

.subject-pill-list {
    display: flex;
    flex-wrap: wrap;
}

.subject-summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--line);
    font-weight: 800;
}

.subject-summary-pill::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--badge-color);
}

.edt-hours-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 11px 13px;
    border-radius: 12px;
    background: rgba(31, 41, 51, 0.06);
}

.edt-hours-row span {
    min-width: 0;
}

.edt-group-settings-form,
.edt-group-list,
.edt-group-card {
    display: grid;
    gap: 14px;
}

.edt-group-card {
    padding: 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
}

.edt-manual-group-form-grid {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(220px, 1fr);
    gap: 14px;
    align-items: end;
}

.edt-group-main {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr);
    gap: 12px;
    align-items: start;
}

.edt-group-mode-grid {
    display: grid;
    grid-template-columns: minmax(160px, max-content) minmax(220px, max-content) minmax(150px, 180px);
    gap: 12px;
    align-items: end;
}

.edt-constraint-form-grid {
    display: grid;
    grid-template-columns: minmax(140px, 180px) minmax(180px, 1fr) minmax(150px, 220px) minmax(180px, 1fr) minmax(110px, 140px) minmax(110px, 140px);
    gap: 14px;
    align-items: end;
}

.edt-constraint-form-grid.level-range {
    grid-template-columns: minmax(140px, 180px) minmax(120px, 160px) minmax(180px, 1fr) minmax(110px, 140px) minmax(110px, 140px) minmax(130px, 160px);
}

.edt-constraint-form-grid .span-all {
    grid-column: 1 / -1;
}

.teacher-mini-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(90px, 1fr));
    gap: 10px;
}

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

.edt-constraint-card {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
}

.edt-constraint-card.is-disabled {
    opacity: 0.62;
    background: rgba(31, 41, 51, 0.05);
}

.edt-constraint-summary {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    width: 100%;
}

.edt-constraint-summary-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.edt-badge.inactive {
    background: rgba(31, 41, 51, 0.08);
    color: var(--text-muted);
}

.edt-group-hours-field {
    display: grid;
    gap: 6px;
}

.edt-group-hours-field span {
    font-weight: 700;
}

.subject-option-field {
    min-height: 48px;
    align-content: center;
}

.subject-color-dot {
    display: inline-block;
    width: 0.9rem;
    height: 0.9rem;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--badge-color);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14);
    vertical-align: -0.08rem;
}

.subject-option-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(31, 41, 51, 0.08);
    color: var(--accent-deep);
    font-size: 0.78rem;
    font-weight: 800;
    vertical-align: 0.08rem;
}

.subject-option-badge.moved {
    background: #d7263d;
    color: #fff;
    box-shadow: 0 6px 14px rgba(215, 38, 61, 0.28);
}

.subject-option-badge.removed {
    background: rgba(120, 53, 15, 0.12);
    color: #78350f;
}

.teacher-preference-block {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(31, 41, 51, 0.05);
}

.teacher-preference-block .section-label {
    margin-bottom: 0;
}

.teacher-level-grid,
.teacher-priority-grid {
    display: grid;
    gap: 10px;
}

.teacher-level-grid {
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}

.teacher-priority-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.teacher-class-choice-grid {
    display: grid;
    gap: 12px;
}

.teacher-subject-blocks,
.teacher-subject-block {
    display: grid;
    gap: 14px;
}

.teacher-subject-block {
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.58);
}

.teacher-subject-header {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.teacher-subject-actions {
    justify-content: flex-start;
}

.teacher-class-choice-level,
.teacher-class-hours-level {
    display: grid;
    grid-template-columns: minmax(58px, 78px) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.teacher-class-choice-level p,
.teacher-class-hours-level-title {
    margin: 0;
    font-weight: 800;
}

.teacher-class-hours-table {
    width: max-content;
    max-width: none;
    border-collapse: separate;
    border-spacing: 20px 10px;
    table-layout: auto;
}

.teacher-class-hours-level {
    overflow-x: auto;
    padding-bottom: 4px;
}

.teacher-class-hours-table th {
    padding: 0;
    border-radius: 10px;
    background: rgba(31, 41, 51, 0.08);
    font-weight: 900;
}

.teacher-class-fill-button {
    width: 100%;
    min-height: 2.6rem;
    min-width: 96px;
    padding: 8px 12px;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font-weight: 900;
}

.teacher-class-fill-button:hover {
    background: rgba(255, 255, 255, 0.72);
}

.teacher-class-hours-table td {
    padding: 0;
}

.teacher-class-hours-table input {
    min-width: 96px;
    min-height: 46px;
    padding: 10px 16px;
    text-align: center;
}

.teacher-mini-field {
    gap: 6px;
}

.teacher-mini-field span {
    font-size: 0.9rem;
}

.teacher-mini-field input[type="number"],
.teacher-mini-field select {
    min-height: 44px;
}

.teacher-form-actions,
.teacher-delete-form {
    display: flex;
    justify-content: flex-end;
}

.edt-inline-form:has(#assign-services-button) {
    gap: 32px;
}

#assign-services-button,
#clear-services-button {
    min-width: 220px;
    padding-inline: 22px;
}

.edt-generation-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
}

.edt-generation-toggle-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.edt-generation-output {
    margin: 0;
    padding: 16px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.92);
    color: #e2e8f0;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
}

.teacher-card {
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
    overflow: hidden;
}

.teacher-card summary {
    list-style: none;
}

.teacher-card summary::-webkit-details-marker {
    display: none;
}

.teacher-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px;
    cursor: pointer;
}

.teacher-summary::after {
    content: "+";
    margin-left: auto;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-deep);
}

.teacher-card[open] .teacher-summary::after {
    content: "−";
}

.teacher-card-body {
    padding: 0 18px 18px;
    border-top: 1px solid rgba(31, 41, 51, 0.08);
}

.teacher-alert {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(217, 80, 80, 0.12);
    color: #9f2f2f;
    font-size: 0.84rem;
    font-weight: 800;
}

.edt-diagnostic-ok,
.edt-diagnostic-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
}

.edt-diagnostic-ok {
    border-color: rgba(58, 148, 90, 0.24);
    background: rgba(240, 255, 244, 0.9);
}

.edt-diagnostic-list.error {
    border-color: rgba(159, 47, 47, 0.28);
    background: rgba(255, 239, 239, 0.92);
}

.edt-diagnostic-list.warning {
    border-color: rgba(179, 116, 28, 0.28);
    background: rgba(255, 248, 232, 0.94);
}

.edt-diagnostic-ok p,
.edt-diagnostic-list p {
    margin: 0;
}

.edt-view-toggle {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0;
    padding: 6px;
    border-radius: 16px;
    background: rgba(31, 41, 51, 0.06);
    border: 1px solid rgba(31, 41, 51, 0.08);
}

.edt-test-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 18px;
}

.edt-generation-progress {
    display: grid;
    gap: 8px;
}

.edt-generation-progress[hidden] {
    display: none;
}

.edt-generation-progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.edt-generation-progress-meta strong {
    color: var(--text);
}

.edt-generation-progress-track {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(31, 41, 51, 0.1);
}

.edt-generation-progress-track div {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
    transition: width 0.18s ease;
}

.edt-view-toggle .secondary-button {
    transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.edt-view-toggle .secondary-button.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
    color: #fff;
    border: 1px solid rgba(143, 66, 34, 0.52);
    box-shadow:
        0 14px 28px rgba(143, 66, 34, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 0 0 4px rgba(201, 105, 58, 0.18);
    transform: translateY(-2px) scale(1.02);
    position: relative;
}

.edt-view-toggle .secondary-button.active::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0));
    pointer-events: none;
}

.edt-results {
    display: grid;
    gap: 22px;
}

.edt-results[hidden] {
    display: none;
}

.edt-result-card {
    display: grid;
    gap: 12px;
}

.edt-result-card.edt-move-dimmed {
    opacity: 0.32;
    filter: grayscale(0.18);
}

.edt-result-card.edt-move-target .edt-table-wrap {
    border-color: rgba(26, 127, 55, 0.3);
    box-shadow: 0 18px 40px rgba(26, 127, 55, 0.12);
}

.edt-result-card.edt-move-no-candidate .edt-table-wrap {
    border-color: rgba(159, 47, 47, 0.22);
    box-shadow: 0 18px 40px rgba(159, 47, 47, 0.08);
}

.edt-result-header h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.55rem;
}

.edt-table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
}

.edt-table {
    --edt-row-height: 42px;
    width: 100%;
    min-width: 880px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.edt-table th,
.edt-table td {
    box-sizing: border-box;
    height: var(--edt-row-height);
    padding: 6px;
    border-right: 1px solid rgba(31, 41, 51, 0.08);
    border-bottom: 1px solid rgba(31, 41, 51, 0.08);
    vertical-align: top;
}

.edt-table tbody tr {
    height: var(--edt-row-height);
}

.edt-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(255, 255, 255, 0.96);
    color: var(--accent-deep);
}

.edt-table tbody th {
    width: 82px;
    background: rgba(31, 41, 51, 0.04);
    color: var(--muted);
    font-size: 0.86rem;
}

.edt-afternoon-start th,
.edt-afternoon-start td {
    border-top: 3px solid rgba(31, 41, 51, 0.16);
}

.edt-course-cell {
    position: relative;
    height: calc(var(--edt-rowspan, 1) * var(--edt-row-height));
    padding: 4px;
}

.edt-course-cell.is-constraint-selecting,
.edt-table td.is-constraint-selecting {
    box-shadow: inset 0 0 0 3px rgba(201, 105, 58, 0.48);
    background: rgba(247, 216, 200, 0.42);
}

.edt-course-cell.edt-teacher-forbidden-cell,
.edt-table td.edt-teacher-forbidden-cell {
    position: relative;
    overflow: visible;
    background: rgba(214, 60, 60, 0.18);
    box-shadow: inset 0 0 0 2px rgba(180, 43, 43, 0.28);
}

.edt-forbidden-delete-stack {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 6;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}

.edt-course-stack {
    position: absolute;
    inset: 4px;
    display: block;
    overflow: hidden;
}

.edt-course-stack.subject-view {
    display: grid;
    gap: 5px;
}

.edt-course-stack.subject-view.fortnight {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
}

.edt-course-switcher {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    justify-content: flex-end;
}

.edt-course-switcher button {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1px solid rgba(31, 41, 51, 0.22);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.edt-course-switcher button.active {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.edt-course-block {
    position: absolute;
    display: grid;
    align-content: start;
    gap: 3px;
    box-sizing: border-box;
    height: calc((var(--event-rowspan, 1) * var(--edt-row-height)) - 8px);
    min-height: calc((var(--event-rowspan, 1) * var(--edt-row-height)) - 8px);
    overflow: hidden;
    inset-inline: 0;
    top: calc(var(--event-offset-units, 0) * var(--edt-row-height));
    padding: 8px 10px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--subject-color) 26%, white);
    border: 2px solid color-mix(in srgb, var(--subject-color) 72%, rgba(31, 41, 51, 0.18));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.62);
}

.edt-course-block.subject-view {
    position: relative;
    inset-inline: auto;
    top: auto;
}

.edt-course-block.has-switcher {
    padding-right: 76px;
}

.edt-course-delete-button {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid rgba(31, 41, 51, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    color: rgba(31, 41, 51, 0.7);
    font-size: 0.95rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.edt-course-delete-button:hover,
.edt-course-delete-button:focus-visible {
    background: rgba(180, 43, 43, 0.92);
    border-color: rgba(180, 43, 43, 0.48);
    color: #fff;
}

.edt-forbidden-delete-button {
    position: static;
    width: 20px;
    height: 20px;
    font-size: 0.9rem;
    border-color: rgba(180, 43, 43, 0.36);
    background: rgba(255, 255, 255, 0.98);
    color: rgba(180, 43, 43, 0.92);
    box-shadow: 0 2px 6px rgba(31, 41, 51, 0.16);
}

.edt-course-block.fortnight {
    padding: 7px 8px;
}

.edt-course-block.week-a {
    right: calc(50% + 2.5px);
}

.edt-course-block.week-b {
    left: calc(50% + 2.5px);
}

.edt-course-block.full-week {
    inset-inline: 0;
}

.edt-course-block.subject-view.week-a {
    grid-column: 1;
    right: auto;
}

.edt-course-block.subject-view.week-b {
    grid-column: 2;
    left: auto;
}

.edt-course-block.subject-view.full-week {
    grid-column: 1 / -1;
}

.edt-course-block[hidden] {
    display: none;
}

.edt-course-title {
    display: flex;
    gap: 5px;
    align-items: center;
}

.edt-course-title span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.edt-course-block em {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: max-content;
    max-width: 100%;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--accent-deep);
    font-size: 0.68rem;
    font-style: normal;
    font-weight: 800;
    line-height: 1.1;
}

.edt-course-block strong,
.edt-course-block span,
.edt-course-block small {
    min-width: 0;
    overflow-wrap: anywhere;
}

.edt-course-block strong {
    font-size: 0.94rem;
}

.edt-course-block.is-highlighted {
    border-color: #d7263d;
    background: linear-gradient(135deg, color-mix(in srgb, var(--subject-color) 36%, white), rgba(215, 38, 61, 0.26));
    box-shadow: 0 0 0 4px rgba(215, 38, 61, 0.28), 0 18px 30px rgba(215, 38, 61, 0.18);
    opacity: 1;
    filter: none;
    transform: translateY(-1px);
}

.edt-course-block.is-highlighted::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 10px;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.48);
    pointer-events: none;
}

.edt-course-block.is-preview-removed {
    border-style: dashed;
    border-color: rgba(120, 53, 15, 0.55);
    background: linear-gradient(135deg, rgba(255, 244, 214, 0.95), rgba(255, 230, 230, 0.9));
    box-shadow: inset 0 0 0 1px rgba(120, 53, 15, 0.14);
    opacity: 0.9;
}

.edt-course-block.edt-move-muted-course {
    opacity: 0.26;
    filter: grayscale(0.25);
}

.edt-course-block.edt-move-current-course {
    opacity: 1;
    filter: none;
}

.edt-course-block.edt-preview-muted-course {
    opacity: 0.34;
    filter: saturate(0.7);
}

.edt-course-block span,
.edt-course-block small {
    color: var(--text);
    font-size: 0.8rem;
}

.edt-course-actions {
    position: absolute;
    bottom: 5px;
    right: 5px;
    z-index: 2;
}

.edt-course-actions .secondary-button {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    min-height: 24px;
    padding: 0;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
}

.edt-move-slot-cell {
    padding: 4px;
    background: rgba(26, 127, 55, 0.08);
}

.edt-move-slot-form {
    height: 100%;
}

.edt-move-slot-form-overlay {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 4;
    width: min(118px, calc(100% - 12px));
    height: auto;
}

.edt-move-slot-form-overlay.edt-move-slot-form-overlay-week-a,
.edt-move-slot-form-overlay.edt-move-slot-form-overlay-week-b {
    width: calc(50% - 9px);
}

.edt-move-slot-form-overlay.edt-move-slot-form-overlay-week-b {
    left: calc(50% + 3px);
}

.edt-move-slot-form-overlay .edt-move-slot-button {
    min-height: 0;
    height: auto;
    padding: 5px 6px;
    font-size: 0.7rem;
    line-height: 1.15;
    box-shadow: 0 10px 20px rgba(31, 41, 51, 0.18);
}

.edt-move-slot-form-overlay .edt-move-slot-button strong {
    font-size: 0.82rem;
}

.edt-move-slot-button {
    display: grid;
    place-items: center;
    gap: 4px;
    width: 100%;
    height: 100%;
    min-height: calc(var(--edt-row-height) - 8px);
    padding: 6px;
    border: 1px solid rgba(26, 127, 55, 0.32);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(240, 255, 244, 0.98), rgba(220, 252, 231, 0.96));
    color: #166534;
    cursor: pointer;
    text-align: center;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.edt-move-slot-button strong {
    font-size: 0.94rem;
}

.edt-move-slot-button.non-improving {
    border-color: rgba(180, 35, 24, 0.28);
    background: linear-gradient(180deg, rgba(255, 245, 245, 0.98), rgba(254, 226, 226, 0.96));
    color: #9f2f2f;
}

.edt-move-slot-button:hover,
.edt-move-slot-button:focus-visible {
    background: linear-gradient(180deg, rgba(220, 252, 231, 1), rgba(187, 247, 208, 0.98));
    border-color: rgba(26, 127, 55, 0.5);
    outline: 2px solid rgba(26, 127, 55, 0.18);
    outline-offset: 2px;
}

.edt-move-slot-button.non-improving:hover,
.edt-move-slot-button.non-improving:focus-visible {
    background: linear-gradient(180deg, rgba(254, 226, 226, 1), rgba(254, 202, 202, 0.98));
    border-color: rgba(180, 35, 24, 0.42);
    outline: 2px solid rgba(180, 35, 24, 0.16);
}

.edt-closed-slot {
    text-align: center;
    vertical-align: middle;
    color: var(--muted);
    background: rgba(31, 41, 51, 0.05);
    font-weight: 800;
}

.edt-score-grid {
    margin-bottom: 4px;
}

@media (max-width: 920px) {
    .page-shell {
        padding: 16px;
    }

    .topbar {
        position: static;
        align-items: stretch;
        flex-direction: column;
    }

    .menu {
        justify-content: stretch;
    }

    .menu-item {
        flex: 1 1 140px;
    }

    .toolbar {
        flex-direction: column;
    }

    .student-card summary {
        flex-direction: column;
        align-items: start;
    }

    .planner-grid,
    .class-config-row,
    .planner-constraints-layout,
    .subject-form-grid,
    .edt-class-form-grid,
    .edt-manual-group-form-grid,
    .edt-group-main,
    .edt-group-mode-grid,
    .edt-constraint-form-grid,
    .edt-constraint-form-grid.level-range,
    .teacher-subject-header,
    .teacher-class-choice-level,
    .teacher-class-hours-level {
        grid-template-columns: 1fr;
    }

    .saved-class-constraint-row .class-options-builder {
        grid-template-columns: 1fr;
    }

    .edt-constraint-card {
        align-items: stretch;
        flex-direction: column;
    }

    .option-admin-form,
    .option-delete-form,
    .teacher-form-actions,
    .teacher-delete-form {
        justify-content: stretch;
    }

    .planner-compatibility-panel {
        position: static;
    }
}
