:root { color-scheme: light; }
body { font-family: system-ui, sans-serif; font-size: 14px; margin: 0; color: #222; background: #fff; }
header { background: #f3f3f3; border-bottom: 1px solid #ccc; padding: 6px 12px; position: sticky; top: 0; z-index: 2; }
h1 { font-size: 18px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 16px 0 6px; }
nav a { margin-right: 12px; color: #1a5fb4; text-decoration: none; }
nav a.active { font-weight: bold; text-decoration: underline; }
main { padding: 12px; }

table { border-collapse: collapse; margin-bottom: 12px; }
th, td { border: 1px solid #bbb; padding: 2px 4px; vertical-align: top; text-align: left; }
th { background: #e8e8e8; font-weight: 600; }
thead th { position: sticky; top: 58px; }
tbody.cls { border-top: 3px solid #666; }
td input, td select { font: inherit; border: 1px solid transparent; background: transparent; padding: 1px 2px; width: 100%; box-sizing: border-box; }
td input:hover, td select:hover { border-color: #ccc; }
td input:focus, td select:focus { border-color: #1a5fb4; background: #fff; outline: none; }
td input.num { width: 3.5em; }
td input.room { width: 4.5em; }
td input.subj { width: 4.5em; }
td input.flag { width: 2.5em; text-align: center; }
td.num { text-align: right; }
.wide { min-width: 11em; }
.controls { display: flex; gap: 16px; align-items: end; flex-wrap: wrap; margin-bottom: 10px; }
.controls label { display: flex; flex-direction: column; font-weight: 600; gap: 2px; }
.controls input, .controls select { font: inherit; padding: 2px; min-width: 10em; }
button { font: inherit; cursor: pointer; }
button.del { border: none; background: none; color: #a00; }
small.status { display: block; font-size: 11px; font-weight: normal; color: inherit; }
.grid td { min-width: 7em; height: 2.4em; }
.grid td span.code { display: block; font-weight: 600; padding: 1px 3px; margin-bottom: 1px; }
.legend td { padding: 2px 8px; }

/* Colors copied from the spreadsheet's conditional formatting */
.c-green  { background: #b7e1cd; }
.c-orange { background: #ff9900; }
.c-red    { background: #ff0000; color: #fff; }
.c-rose   { background: #e06666; }
.c-peach  { background: #f9cb9c; }
.c-yellow { background: #ffff00; }
.c-lav    { background: #8e7cc3; color: #fff; }
.c-purple { background: #9900ff; color: #fff; }
.c-magenta{ background: #ff00ff; color: #fff; }
.chosen   { background: #b7e1cd; }
.c-red input, .c-lav input, .c-purple input, .c-magenta input,
.c-red select, .c-lav select, .c-purple select, .c-magenta select { color: inherit; }

#toast { position: fixed; bottom: 16px; right: 16px; padding: 8px 12px; border-radius: 4px; background: #333; color: #fff; max-width: 40em; }
#toast.err { background: #b00020; }
td select { min-width: 9em; }
td select.flag { min-width: 3.5em; width: 3.5em; }
.timetable td { min-width: 8.5em; height: auto; }
.timetable td input { display: block; }
.timetable td input.subj { font-weight: 600; width: 100%; }
.timetable td input::placeholder { color: #ccc; font-weight: normal; }
.report { white-space: pre-line; margin-bottom: 10px; font-family: ui-monospace, monospace; font-size: 13px; }
.timetable td select.group { min-width: 8em; font-size: 12px; }
/* Several presentations in the same hour */
.clash { background: #cfe2f3; box-shadow: inset 0 0 0 3px #3d85c6; }
.clash-label { display: block; font-size: 11px; font-weight: 700; color: #1c4587; margin-bottom: 2px; }
.timetable .flags { display: flex; gap: 6px; align-items: center; font-size: 11px; margin-top: 2px; }
.timetable .flags label { display: flex; align-items: center; gap: 2px; }
.timetable .flags select.flag { min-width: 3em; width: 3em; font-size: 11px; }
.timetable .flags input[type=checkbox] { width: auto; display: inline; }
.timetable td.focus { outline: 3px solid #1a5fb4; outline-offset: -3px; }
label.inline { flex-direction: row !important; align-items: center; gap: 4px; }
.controls input[type=checkbox] { min-width: 0; width: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; font-family: system-ui, sans-serif; }
.chip { padding: 2px 6px; border-radius: 3px; font-weight: 600; font-size: 13px; }
