:root {
  --blue: #003f7f;
  --gold: #b9975b;
  --line: #e3e6ea;
  --ghost: rgba(0, 63, 127, 0.12);
  --ghost-hot: rgba(185, 151, 91, 0.55);
  --pick: #1f5fa8;
  --bad: #c0392b;
  --ppm: 1.1px; /* pixels per minute */
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.35 system-ui, sans-serif; color: #1d2430; height: 100vh; display: flex; flex-direction: column; }
header { display: flex; gap: 20px; align-items: center; padding: 10px 20px; color: #fff; background: linear-gradient(90deg, #00264d, var(--blue) 60%, #0b4f96); box-shadow: 0 2px 6px rgba(0,0,0,.18); z-index: 10; }
.brand { display: flex; gap: 12px; align-items: center; }
.logo { width: 38px; height: 38px; border-radius: 9px; background: var(--gold); display: grid; place-items: center; }
.logo svg { width: 24px; height: 24px; fill: none; stroke: #00264d; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
header h1 { font-size: 19px; margin: 0; letter-spacing: .2px; }
header nav { margin-left: 16px; display: flex; gap: 6px; }
/* Raised buttons: 4px radius, top light, bottom shadow. */
.btn, header select { font: inherit; font-size: 13px; padding: 6px 14px; border-radius: 4px; cursor: pointer; text-decoration: none; white-space: nowrap;
  color: #1d2430; background: linear-gradient(#ffffff, #e9edf2); border: 1px solid #aab4c0; border-bottom-color: #8e99a6;
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 1px 2px rgba(0,0,0,.25); }
.btn:hover, header select:hover { background: linear-gradient(#ffffff, #dde3ea); }
.btn:active { box-shadow: 0 1px 3px rgba(0,0,0,.3) inset; transform: translateY(1px); }
header .btn { color: #fff; background: linear-gradient(#1c5a9c, #0d3f75); border-color: #0a2f58; border-bottom-color: #061f3b;
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 2px 3px rgba(0,0,0,.35); }
header .btn:hover { background: linear-gradient(#2468b0, #114a87); }
header .btn.active { color: #00264d; font-weight: 600; background: linear-gradient(#d8bf8a, var(--gold)); border-color: #8a6d2f; border-bottom-color: #6f5626; }
header .term { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; opacity: .95; }
header select { text-transform: none; letter-spacing: 0; padding-right: 30px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d2430' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 16px; background-color: #f4f6f9; }
header select option { color: #1d2430; }
#credits { font-size: 14px; font-weight: 600; color: var(--gold); white-space: nowrap; }
main { flex: 1; display: flex; min-height: 0; }

aside { width: 480px; flex-shrink: 0; overflow: hidden; padding: 10px; border-right: 1px solid var(--line); background: #f7f8fa; display: flex; flex-direction: column; gap: 8px; }
aside select, aside input { font: inherit; padding: 5px 6px; border: 1px solid #ccd3db; border-radius: 4px; width: 100%; }
#reset { font: inherit; font-size: 12px; padding: 3px 10px; border: 1px solid #ccd3db; border-radius: 4px; background: #fff; cursor: pointer; }
#reset:hover { border-color: var(--bad); color: var(--bad); }
aside .panel { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1; }
aside .panel[hidden] { display: none; }
#ibar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
#ibar[hidden] { display: none; }
.isearch { position: relative; flex: 0 1 420px; }
#iname { width: 100%; font: inherit; padding: 6px 10px; border: 1px solid #aab4c0; border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.12) inset; }
#ilist { position: absolute; top: calc(100% + 2px); left: 0; right: 0; z-index: 20; background: #fff; border: 1px solid #aab4c0; border-radius: 4px; box-shadow: 0 6px 16px rgba(0,0,0,.18); max-height: 320px; overflow-y: auto; }
#ilist[hidden] { display: none; }
#ilist div { padding: 6px 10px; cursor: pointer; display: flex; justify-content: space-between; }
#ilist div:hover, #ilist div.on { background: #e6eef8; }
#ilist small { color: #545b67; }
#ilist p { margin: 0; padding: 6px 10px; color: #545b67; }
body.instructors aside { display: none; }
#current { border: 2px solid var(--blue); border-radius: 8px; padding: 8px; background: #fff; }
#current h2 { font-size: 14px; margin: 0 0 6px; color: var(--blue); display: flex; justify-content: space-between; align-items: center; }
#current h2 .actions { display: flex; gap: 10px; align-items: center; }
#current h2 #reset { color: #1d2430; font-weight: 400; }
button.link { font: inherit; font-size: 12px; font-weight: 400; border: 0; background: none; color: var(--blue); cursor: pointer; padding: 0; text-decoration: underline; }
button.link:hover { color: #0b4f96; }
#printhead { display: none; }
/* On screen the class table is for screen readers only. */
#printlist, .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#printlist caption { text-align: left; font-weight: 600; }
:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }
.ilabel { font-weight: 600; color: var(--blue); }
.ctitle { all: unset; display: block; cursor: pointer; }
.ctitle:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }
.block .tag { font-weight: 700; letter-spacing: .5px; }

#mtabs, #daypick { display: none; }


#picks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
#picks .hint { grid-column: 1 / -1; margin: 0; }
.chip.mine { position: relative; border-left-color: var(--pick); cursor: default; padding-right: 18px; }
.chip.mine .x { position: absolute; top: 3px; right: 4px; cursor: pointer; font: inherit; font-weight: 700; color: #545b67; background: none; border: 0; padding: 0 3px; }
.chip.mine .x:hover { color: var(--bad); }
.chip.mine.pending { border-left-color: var(--gold); background: #fbf5e8; }
.chip.mine.pending button { font-size: 11px; margin-left: 3px; }
#drop .icon { width: 18px; height: 18px; vertical-align: -4px; margin-right: 6px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#drop { margin-top: 6px; border: 2px dashed #9aa9bb; border-radius: 6px; padding: 12px; text-align: center; color: #545b67; }
#current.over { border-color: var(--gold); background: #fffaf0; }
#current.over #drop { border-color: var(--gold); background: #fbf5e8; color: #1d2430; }
.hint { color: #545b67; }
.empty { grid-column: 1 / -1; text-align: center; color: #445; padding: 28px 18px; margin-top: 8px; border: 1px dashed #ccd3db; border-radius: 10px; background: #fff; }
.empty-icon { width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 50%; background: #e6eef8; display: grid; place-items: center; }
.empty-icon svg { width: 26px; height: 26px; fill: none; stroke: var(--blue); stroke-width: 2.2; stroke-linecap: round; }
.empty h3 { margin: 0 0 10px; color: var(--blue); font-size: 17px; }
.empty ol { text-align: left; display: inline-block; margin: 0 0 14px; padding-left: 20px; line-height: 1.7; }
.empty .quick-label { margin: 0 0 6px; color: #545b67; font-size: 12px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.quick button { font: inherit; font-size: 12px; padding: 3px 10px; border-radius: 12px; border: 1px solid #ccd3db; background: #f4f6f9; cursor: pointer; }
.quick button:hover { border-color: var(--blue); background: #e6eef8; }
.quick button.try { border-left: 3px solid var(--gold); }
#finders { display: flex; gap: 6px; }
#finders input { flex: 3; min-width: 0; }
#finders select { flex: 2; min-width: 0; }
#current { flex-shrink: 0; max-height: 45vh; overflow-y: auto; }
#courses { flex: 1; min-height: 0; overflow-y: auto; padding-right: 2px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; align-content: start; }
#courses .hint { grid-column: 1 / -1; }
.chip { background: #fff; border: 1px solid #ccd3db; border-left: 4px solid var(--gold); border-radius: 6px; padding: 6px 8px; cursor: grab; user-select: none; }
.chip:hover { border-color: var(--blue); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.chip.added { border-left-color: var(--pick); background: #eef3fa; }
.chip b { display: block; }
.chip small { color: #556; display: block; }
.schips { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }
.schip { font: inherit; font-size: 11px; color: #1d2430; padding: 1px 5px; border: 1px solid #ccd3db; border-radius: 10px; background: #f4f6f9; cursor: grab; white-space: nowrap; }
.schip:hover { border-color: var(--blue); background: #e6eef8; }
.schip.added { background: var(--pick); border-color: var(--pick); color: #fff; }
.chip .who { color: #335; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#schedule { flex: 1; overflow: auto; padding: 10px 16px; }
#grid { display: grid; grid-template-columns: 52px repeat(5, minmax(110px, 1fr)) minmax(220px, 1.6fr); position: relative; }
.colhead { position: sticky; top: 0; z-index: 5; background: #fff; text-align: center; font-weight: 600; padding: 4px 0; border-bottom: 1px solid var(--line); }
.colhead .sub { display: flex; font-weight: 400; font-size: 11px; color: #556; }
.colhead .sub span { flex: 1; }
.times, .day { position: relative; }
.times div { position: absolute; right: 6px; font-size: 11px; color: #545b67; transform: translateY(-50%); }
.day { border-left: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px calc(var(--ppm) * 60)); }
.day.finals { background-color: #fbf8f1; display: flex; }
.day.finals .lane { flex: 1; position: relative; border-left: 1px dashed var(--line); }

.block { position: absolute; border-radius: 4px; padding: 2px 4px; font-size: 11px; overflow: hidden; line-height: 1.2; }
.block.ghost { background: var(--ghost); border: 1px dashed var(--blue); color: var(--blue); }
.block.ghost.hot { background: var(--ghost-hot); border-style: solid; }
.block.pick { background: var(--pick); color: #fff; }
.block.pick.conflict { background: var(--bad); }
.block .x { position: absolute; top: 1px; right: 3px; cursor: pointer; font-weight: 700; }
.walk { position: absolute; left: 2px; right: 2px; text-align: center; font-size: 10px; color: #445; z-index: 2; pointer-events: none; }
.walk span { background: #fff; border: 1px solid #ccd3db; border-radius: 8px; padding: 0 5px; }
.walk.late span { color: #fff; background: var(--bad); border-color: var(--bad); }

#unscheduled { margin-top: 10px; font-size: 13px; }
#unscheduled .pickrow { display: inline-block; background: var(--pick); color: #fff; border-radius: 4px; padding: 2px 6px; margin: 2px; }
#unscheduled .x { cursor: pointer; margin-left: 4px; font-weight: 700; }

/* Phones: two tabs and a one-day calendar. */
@media (max-width: 760px) {
  header { flex-wrap: wrap; gap: 8px 10px; padding: 8px 12px; }
  .logo { width: 30px; height: 30px; }
  .logo svg { width: 19px; height: 19px; }
  header h1 { font-size: 16px; }
  header nav { margin-left: auto; }
  header .btn { padding: 5px 9px; font-size: 12px; }
  header .term { margin-left: 0; flex: 1; font-size: 11px; }
  header .term select { flex: 1; }
  #mtabs { display: block; border-bottom: 1px solid var(--line); background: #fff; }
  #mtabs [role=tablist] { display: flex; }
  #mtabs button { flex: 1; font: inherit; font-weight: 600; padding: 10px; border: 0; background: none; color: #545b67; border-bottom: 3px solid transparent; }
  #mtabs button[aria-selected=true] { color: var(--blue); border-bottom-color: var(--gold); }
  body.instructors #mtabs { display: none; }
  aside { width: 100%; border-right: 0; }
  body[data-tab=calendar]:not(.instructors) aside { display: none; }
  body[data-tab=classes]:not(.instructors) #schedule { display: none; }
  #schedule { padding: 8px; }
  #ibar { flex-wrap: wrap; }
  .isearch { flex: 1 1 100%; }
  #daypick { display: flex; gap: 4px; margin-bottom: 8px; }
  #daypick button { flex: 1; font: inherit; font-size: 13px; padding: 6px 0; border-radius: 4px; border: 1px solid #aab4c0; background: linear-gradient(#fff, #e9edf2); }
  #daypick button[aria-pressed=true] { background: var(--blue); color: #fff; border-color: var(--blue); }
  #grid { grid-template-columns: 44px 1fr; }
  body[data-day="0"] #grid [data-col]:not([data-col="0"]), body[data-day="1"] #grid [data-col]:not([data-col="1"]),
  body[data-day="2"] #grid [data-col]:not([data-col="2"]), body[data-day="3"] #grid [data-col]:not([data-col="3"]),
  body[data-day="4"] #grid [data-col]:not([data-col="4"]), body[data-day="5"] #grid [data-col]:not([data-col="5"]) { display: none; }
  .block { font-size: 12px; }
}

@media print {
  #mtabs, #daypick { display: none !important; }
  #schedule, aside { display: block; }
  #grid { grid-template-columns: 52px repeat(5, minmax(110px, 1fr)) minmax(220px, 1.6fr) !important; }
  #grid [data-col] { display: block !important; }
  #grid .day.finals { display: flex !important; }
  #printlist { position: static; width: auto; height: auto; margin: 10px 0 0; overflow: visible; clip: auto; white-space: normal; }
  @page { size: landscape; margin: 0.4in; }
  body { height: auto; display: block; }
  header, aside, #unscheduled, .block.ghost, .block .x, .walk { display: none !important; }
  main, #schedule { display: block; overflow: visible; padding: 0; }
  .colhead { position: static; }
  .block, .day, .day.finals { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #printhead { display: block; font-size: 16px; font-weight: 700; margin-bottom: 6px; }
  #printlist { display: table; width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 11px; break-inside: avoid; }
  #printlist th, #printlist td { text-align: left; border-bottom: 1px solid #ccc; padding: 3px 6px; }
}
