:root {
  --paper: #f6f2ec;
  --surface: #fffcf8;
  --ink: #302332;
  --muted: #665968;
  --plum: #43263e;
  --plum-light: #62465d;
  --berry: #783554;
  --rose: #f1e4e9;
  --apricot: #ffc086;
  --cream: #fff9f3;
  --line: #e0d5d6;
  --field-line: #8c7986;
  --error: #9c2d39;
  color-scheme: light;
}
* { box-sizing: border-box }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 system-ui, sans-serif }
header { background: var(--plum); color: var(--cream); padding: 14px max(5vw, calc((100vw - 1060px) / 2)); font-size: 22px }
.college-header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 16px }
.college-name { color: var(--rose); font-size: 16px }
.college-group { margin-left: auto; font-size: 14px; color: var(--apricot) }
main { width: min(1060px, 90%); margin: 40px auto }
.project-footer { width: min(1060px, 90%); margin: 0 auto 24px; padding-top: 12px; border-top: 1px solid var(--line) }
.top, .times { display: flex; align-items: center; gap: 16px; flex-wrap: wrap }
.top { justify-content: space-between; margin-bottom: 24px }
h1, h2 { margin: 0; line-height: 1.2 }
h1 { font-size: clamp(30px, 4vw, 46px); letter-spacing: -.035em }
h2 { font-size: 24px; margin-bottom: 16px }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 20px; align-items: start }
section { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; min-width: 0 }
ul { list-style: none; padding: 0; margin: 0 0 16px }
li { padding: 12px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere }
li strong, li small { display: block }
small { color: var(--muted) }
summary { color: var(--berry); cursor: pointer; font-weight: 650; padding: 8px 0 }
form { padding: 12px 0 }
label { display: block; font-size: 14px; font-weight: 600 }
input { font: inherit; margin: 4px 0 10px; padding: 8px; width: 100%; border: 1px solid var(--field-line); border-radius: 6px; background: var(--surface); color: var(--ink) }
button { font: inherit; cursor: pointer; border: 0; border-radius: 6px; padding: 7px 12px; color: var(--cream); background: var(--berry); margin: 5px 6px 0 0 }
button.secondary { background: var(--rose); color: var(--plum) }
li button { font-size: 14px }
#notice { color: var(--berry) }
#undo-panel { padding: 10px 16px; margin-bottom: 16px; border-radius: 10px; background: var(--rose); color: var(--ink) }
#lesson-time-error, #lesson-conflict { color: var(--error); margin: 0 0 8px }
.week-card { margin-bottom: 20px; background: var(--plum); color: var(--cream); border: 0 }
.week-head, .filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px }
.week-head { justify-content: space-between; margin-bottom: 16px }
.week-head h2, #week-range { margin: 0 }
#week-range { color: var(--rose); margin-top: 4px }
.week-controls button { background: var(--plum-light); color: var(--cream); margin: 0 0 0 4px }
.week-days { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 6px }
.week-days button { text-align: left; color: var(--cream); background: var(--plum-light); padding: 10px 12px; margin: 0 }
.week-days button[aria-pressed="true"] { color: var(--ink); background: var(--apricot) }
.week-days button > * { display: block; color: inherit }
.week-days strong { font-size: 24px }
.week-days span { font-size: 12px }
.filters { align-items: flex-start }
.filters label { flex: 1 1 140px }
select { display: block; width: 100%; font: inherit; padding: 8px; border: 1px solid var(--field-line); border-radius: 6px; background: var(--surface); color: inherit; margin: 4px 0 10px }
.backup { margin-top: 22px; background: var(--surface); padding: 12px 22px; border: 1px solid var(--line); border-radius: 12px }
.file-label { margin-top: 10px; max-width: 380px }
:is(button, summary, input, select):focus-visible { outline: 3px solid var(--berry); outline-offset: 2px }
html { scrollbar-gutter: stable; -webkit-text-size-adjust: 100% }
body { overflow-wrap: anywhere }
input, select, button { max-width: 100%; min-width: 0 }
input, select { font-size: 16px; min-height: 44px }
button, summary { min-height: 44px }
.week-controls { display: flex; flex: none }
.week-controls button { min-width: 44px }
label, .week-head > div { min-width: 0 }
.times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px }
#lesson-status { block-size: 3lh; overflow-y: auto; margin: 4px 0 12px }
#week-range, .week-days, #lesson-status { font-variant-numeric: tabular-nums }
@media (max-width: 760px) {
  main, .project-footer { width: calc(100% - 32px) }
  main { margin: 22px auto }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 16px }
  section { padding: 16px }
  .week-days { grid-template-columns: repeat(4, minmax(0, 1fr)) }
  .week-days button { padding: 8px; line-height: 1.3 }
  .week-days span { min-height: 1.3em }
}
@media (max-width: 480px) {
  .college-header { display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 12px 16px; gap: 0 8px }
  .college-name { grid-row: 2; font-size: 14px }
  .college-group { grid-area: 1 / 2 / span 2 }
  .top { display: grid; gap: 10px; margin-bottom: 14px }
  .week-head { display: grid; gap: 8px }
  .week-controls button:first-child { margin-left: 0 }
  .filters { display: grid; gap: 0 }
  #lesson-status { block-size: 4lh }
}

.week-card button:focus-visible { outline-color: var(--apricot) }
input[aria-invalid="true"] { border-color: var(--error) }
input::placeholder { color: var(--muted); opacity: 1 }
@media (hover: hover) {
  button.secondary:hover, summary:hover { color: var(--berry) }
  button.secondary:hover { background: #e8d5df }
  .week-card button:hover { box-shadow: inset 0 0 0 2px var(--apricot) }
}
