#main { box-sizing: border-box; max-width: 1200px; margin: 0 auto; padding: 70px 16px 50px; }
#main [hidden] { display: none; }
#main button, #main a, #main input, #main select { min-height: 44px; box-sizing: border-box; }
#main button, #main select, #main input:not([type="checkbox"]):not([type="color"]) { font: inherit; }
#main select, #main input:not([type="checkbox"]):not([type="color"]) { width: 100%; padding: 8px; }
#main button { padding: 8px 12px; }
.timetable-toolbar { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 18px; }
.timetable-action { display: inline-flex; min-height: 44px; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid currentColor; border-radius: var(--border-radius); color: inherit; text-decoration: none; }
.timetable-management-navigation { display: flex; flex-wrap: wrap; gap: 12px 20px; margin: 8px 0 20px; }
.timetable-management-navigation a { min-height: 44px; display: inline-flex; align-items: center; color: inherit; text-underline-offset: 3px; }
.timetable-management-navigation a[aria-current="page"] { font-weight: 700; }
#timetable-views { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.timetable-view { min-width: 0; }
.manage-section { min-width: 0; padding: 16px; margin: 0 0 18px; border: 1px solid currentColor; border-radius: var(--border-radius-section); }
.timetable-selection { margin: 0 0 18px; }
.timetable-selection-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 0 20px; margin-bottom: 6px; }
.timetable-selection h2 { margin: 0; font-size: 1.15rem; }
.timetable-selection p { margin: 0 0 6px; }
.timetable-select-scroll { width: 100%; max-width: 520px; overflow-x: auto; overscroll-behavior-inline: contain; }
.timetable-select-scroll:focus-visible, .timetable-select-scroll:focus-within { outline: 2px solid currentColor; outline-offset: 3px; }
#main #timetable-select { display: block; width: max-content; min-width: 100%; height: auto; text-align: left; }
.inline-label { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.inline-label input { width: 24px; height: 24px; }
.timetable-table-scroll { width: 100%; min-width: 0; overflow-x: auto; margin: 12px 0 20px; overscroll-behavior-inline: contain; }
.timetable-table { min-width: 620px; width: 100%; border-collapse: collapse; }
.timetable-table caption { text-align: left; font-weight: 700; padding: 8px 0; }
.timetable-table th, .timetable-table td { border: 1px solid currentColor; padding: 8px; text-align: left; vertical-align: middle; overflow-wrap: anywhere; }
.timetable-table thead th { text-align: center; }
.timetable-table th[scope="row"] { min-width: 110px; }
.timetable-cell { min-width: 90px; }
.entry-label { display: block; margin: 0; padding: 0; }
.entry-code { position: relative; font-weight: 700; }
.screen-reader-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.legend-toggle { margin: 8px 0; }
.timetable-legend { padding: 10px; border: 1px solid currentColor; }
.timetable-legend ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 8px 16px; list-style: none; padding: 0; }
.legend-item { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.manage-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.manage-section h2 { margin: 0 0 6px; }
.manage-section form { display: grid; gap: 9px; max-width: 720px; }
.manage-section form > label, .manage-section > label { font-weight: 600; }
.manage-section fieldset { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.weekday-options label { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.weekday-options input { width: 22px; height: 22px; }
.slot-row { display: grid; grid-template-columns: minmax(110px, 1.5fr) repeat(2, minmax(100px, 1fr)) 50px; gap: 8px; align-items: end; margin: 8px 0; }
.slot-row label, .color-pair label, .date-pair label { display: grid; gap: 4px; font-weight: 600; }
.slot-remove { width: 40px; height: 40px; min-height: 40px !important; margin: 0 auto; padding: 0 !important; }
.color-pair, .date-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.color-pair input[type="color"] { width: 100%; height: 44px; }
.color-state { margin: 0; padding: 8px; border-left: 4px solid currentColor; }
.color-preview { display: inline-block; margin: 6px 12px 0 0; font-weight: 600; }
.color-contrast-warning { display: block; margin-top: 8px; font-weight: 600; }
.danger-button { justify-self: start; }
#assignment-editor { width: 100%; }
#assignment-editor .timetable-table { min-width: 620px; }
#assignment-editor select { min-width: 160px; }
#assignment-state { min-height: 1.4em; }
@media (max-width: 600px) {
   #main { padding: 70px 10px 50px; }
   .manage-section { padding: 12px; }
   .slot-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 46px; }
   .slot-row label:first-child { grid-column: 1 / -1; }
   .slot-remove { grid-column: 3; grid-row: 2; }
   .color-pair, .date-pair { grid-template-columns: minmax(0, 1fr); }
}
