header{padding:9px 14px 8px}header h1{font-size:21px;margin:3px 0 0}header>p{display:none}.header-top{font-size:11px}.header-top .school-logo{width:140px}
#systemNav{display:grid;grid-template-columns:1fr 1fr;gap:6px;padding:6px 8px;max-width:960px;margin:auto;background:#f1f5f9;position:sticky;top:0;z-index:8}
#systemNav button{min-height:42px;font-size:15px;padding:9px 3px;border:1px solid transparent;white-space:nowrap;border-radius:9px;font-weight:700}
#systemNav [data-system=zhuke]{color:#075985;background:#e0f2fe;border-color:#add8ee}#systemNav [data-system=zhuke][aria-current=page]{background:#075985;color:#fff;border-color:#075985}
#systemNav [data-system=gaokao]{color:#9a3f0d;background:#fff0e0;border-color:#efc69f}#systemNav [data-system=gaokao][aria-current=page]{background:#a44813;color:#fff;border-color:#a44813}
#zhukeNav{position:static;margin:0 auto;padding-top:0;padding-bottom:6px;gap:5px}#zhukeNav button{padding:8px 3px;min-height:36px;font-size:13px;background:#fff;color:#46647b;border-radius:5px;border:1px solid #d5e1ec}#zhukeNav button[aria-current=page]{background:#e3f3fc;color:#075985;border-color:#93c6e4;box-shadow:inset 0 -2px #075985}
body[data-system=gaokao]{background:#faf6f0}body[data-system=gaokao]>header{background:#8c3b13}body[data-system=gaokao] #systemNav{background:#faf6f0}
#gaokaoPanel{max-width:960px;margin:auto;padding:0 8px 8px}.hub-frame-tools{display:flex;align-items:center;gap:8px;margin:0 2px 5px;font-size:12px}.hub-frame-tools a{color:#914010;white-space:nowrap}.hub-frame-tools button{padding:4px 8px;min-height:30px;background:#fff0df;color:#8a3d10;border:1px solid #e9c6a8;font-size:12px}.hub-frame-tools #hubFrameStatus{flex:1;margin:0;font-size:11px;line-height:1.4}.hub-unavailable{color:#9b5217}
#gaokaoFrame{display:block;width:100%;height:calc(100vh - 154px);height:calc(100dvh - 154px);min-height:400px;border:1px solid #ead9ca;border-radius:8px;background:#fff}
@media(max-width:400px){header h1{font-size:19px}.header-top .school-logo{width:126px}#systemNav button{font-size:14px}#zhukeNav button{font-size:12px}.hub-frame-tools{gap:5px}#gaokaoFrame{height:calc(100dvh - 150px)}}

.pending-front{margin-top:8px;padding-top:7px}.pending-front>h3{font-size:15px;margin:0 0 7px;color:#94510c}#pendingPreview,.archive-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}#pendingPreview>p,.archive-grid>p{grid-column:1/-1;margin:4px 0;font-size:12px}.slot-tile{min-width:0;padding:7px 6px;border:1px solid #e8d9be;border-top:3px solid #e5a239;border-radius:7px;background:#fff8e9;display:flex;flex-direction:column;align-items:stretch;gap:3px;text-align:center}.slot-tile .slot-date{font-size:12px;line-height:1.35}.slot-time{display:flex;justify-content:center;flex-wrap:wrap;font-size:11px;font-weight:650;line-height:1.35;white-space:nowrap}.slot-tile p{margin:0;overflow-wrap:anywhere;font-size:11px;line-height:1.4}.slot-team{color:#647487}.slot-people{flex:1;font-weight:600}.slot-tile button{font-size:11px;padding:5px 1px;min-height:29px;border-radius:4px;margin-top:3px;width:100%}.archive-tile{background:#f5fafc;border-color:#d5e4ed;border-top-color:#8bbad3}.archive-tile button{background:#e1edf4;color:#1b5775}
#archivePage>section{padding:11px;margin-bottom:7px}#archiveTitle{font-size:17px}#archivePage .row>button{font-size:12px;padding:6px 9px;min-height:32px}.archive-filter{display:flex;align-items:center;gap:7px;margin-top:6px}.archive-filter label{font-size:12px;margin:0;white-space:nowrap}.archive-filter select{font-size:12px;padding:6px 8px;margin:0;max-width:245px;min-height:33px}#archiveFreshness{font-size:11px;margin:6px 0}.archive-metrics{gap:6px;margin:7px 0 10px}.archive-metric{padding:7px 4px;border-radius:6px}.archive-metric strong{font-size:24px;margin:0;line-height:1.2}.archive-metric span{font-size:11px}#archivePage h3{font-size:14px;margin:7px 0}#archiveChart .overview-row{grid-template-columns:70px 1fr 42px;gap:7px;margin:9px 0;font-size:12px}#archiveChart .overview-row b{font-size:13px}#archiveChart .overview-track{height:12px}#archivePage #archiveScale,#archivePage section>p.muted{font-size:11px;line-height:1.45;margin:6px 0}#archivePage>section>h2{font-size:16px;margin:0 0 6px}#archivePage .archive-group{padding:0;border:0;border-radius:0;background:transparent;margin:10px 0}#archivePage .archive-group h3{font-size:13px;margin:0 0 6px}
#slotDetailDialog{width:min(540px,94vw);padding:13px;border:1px solid #d8e3ec;border-radius:10px;max-height:90dvh;overflow:auto}#slotDetailDialog::backdrop{background:#102c4599}#slotDetailTitle{font-size:15px;margin:0}#slotDetailClose{padding:6px 9px;font-size:12px}#slotDetailBody .card{margin:8px 0 0;padding:10px;font-size:13px}#slotDetailBody .card p{font-size:12px;line-height:1.45}#slotDetailBody .actions{flex-wrap:wrap;gap:6px}#slotDetailBody button{font-size:12px;padding:7px 9px}
@media(max-width:600px){#pendingPreview,.archive-grid{gap:5px}.slot-tile{padding:5px 3px;gap:3px;border-top-width:2px;border-radius:5px}.slot-tile .slot-date{font-size:11px}.slot-tile p,.slot-time{font-size:10.5px}.slot-tile button{font-size:10px;min-height:28px;padding:4px 0}.archive-metric strong{font-size:23px}#archivePage>section{padding:9px}#archiveTitle{font-size:16px}}
@media(max-width:359px){.slot-tile .slot-date{font-size:10px}.slot-tile p,.slot-time{font-size:10px}.slot-tile button{font-size:9px}#pendingPreview,.archive-grid{gap:4px}}

/* Compact vertical rhythm, November update */
#bookingPage section,#archivePage>section{padding:8px;margin-bottom:6px}#bookingPage h2{font-size:16px;margin:0 0 5px}#bookingPage p{margin-top:4px;margin-bottom:4px}#bookingPage .row{gap:5px}#bookingPage label{margin-top:5px;margin-bottom:3px;font-size:12px}#bookingPage select,#bookingPage input,#bookingPage textarea{padding:6px 7px;font-size:12px}#bookingPage .stats{gap:5px;margin:6px 0}#bookingPage .stats>div{padding:7px}.pending-front{margin-top:5px;padding-top:4px}#pendingPreview,.archive-grid{row-gap:4px}.slot-tile{padding-top:4px;padding-bottom:4px;gap:2px}.slot-tile p{line-height:1.2}.slot-tile button{margin-top:1px;min-height:26px;padding:3px 0}#archivePage .archive-group{margin:6px 0}#archiveChart .overview-row{margin:6px 0}#archivePage h3{margin:5px 0}.archive-metrics{margin:5px 0 6px}.archive-metric{padding:5px 3px}#countsPage section>.row{justify-content:flex-end;margin-bottom:4px}

/* Keep the weekly schedule compact; archive details open only when requested. */
#bookingPage .week-front .sync-row{margin:2px 0;min-height:28px}
#bookingPage .week-front .sync-row p{margin:0;font-size:11px;line-height:1.25}
#bookingPage .week-front .sync-row button{min-height:28px;padding:4px 8px;font-size:12px;line-height:1.25}
#bookingPage #rotation{padding:5px 7px;margin:3px 0;font-size:12px;line-height:1.35}
#bookingPage #rotation.rotation-assigned {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 3px 12px;
  padding: 7px 10px;
  border-inline-start: 4px solid #45c3a5;
  background: #104e54;
  color: #fff;
}
#rotation .rotation-heading {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
#rotation .rotation-label { color: #bdf7e9; font-size: 13px; font-weight: 650; white-space: nowrap; }
#rotation .rotation-team { font-size: 17px; font-weight: 750; white-space: nowrap; }
#rotation .rotation-when { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
#bookingPage .week-front .stats{align-items:start;margin:4px 0;gap:5px}
#bookingPage .week-front .stat{padding:6px;line-height:1.25}
#bookingPage .week-front .stat p{margin:2px 0;line-height:1.3}
#bookingPage .week-front .stat .group-times{margin:2px 0;font-size:11px;line-height:1.3}
#bookingPage .week-front .stat>b{margin-top:3px;font-size:14px;line-height:1.3}
#bookingPage .week-front .stat .muted{font-size:11px;line-height:1.35}
#bookingPage .week-front .stat>details{margin:2px 0 3px;font-size:11px;line-height:1.3}
#bookingPage .week-front .stat summary{padding:2px 0;font-size:11px;line-height:1.3}
#bookingPage .week-front .stat>button{margin-top:3px;min-height:32px;padding:5px 2px;font-size:12px;line-height:1.25}
#archivePage details.archive-group{margin:5px 0;padding:0;border:1px solid #d5e4ed;border-radius:6px;background:#f7fafc}
#archivePage .archive-group>summary{padding:8px;font-size:13px;line-height:1.3}
#archivePage .archive-group[open]>summary{border-bottom:1px solid #d5e4ed;margin-bottom:6px}
#archivePage .archive-group>.archive-grid{padding:0 6px 6px}

#countsPage .counts-toolbar{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:stretch;gap:5px;margin-bottom:5px}
#countsPage .counts-toolbar .group-buttons{margin:0;gap:5px}
#countsPage .counts-toolbar button{min-height:36px;padding:7px 3px;font-size:13px;line-height:1.3;white-space:nowrap}
#countsPage .counts-toolbar .counts-refresh{padding:7px 9px;background:#15803d;color:#fff;border:1px solid #15803d;border-radius:7px}
@media(max-width:400px){#countsPage .counts-toolbar button{font-size:12px}#countsPage .counts-toolbar .counts-refresh{padding:7px}}

/* Wrap between whole times, names and actions on a narrow screen. */
.keep-unit,
.slot-tile .slot-date,
.slot-tile .slot-time,
.slot-tile .slot-team,
.teacher-chart-row .row strong,
#zhukeNav button,
.view-page button,
dialog button {
  white-space: nowrap;
  overflow-wrap: normal;
}
#pendingPreview,
.archive-grid {
  --columns: 6;
  --tile-gap: 4px;
  font-size: .75rem;
  display: grid;
  gap: var(--tile-gap);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, max(7em, calc((100% + var(--tile-gap)) / var(--columns) - var(--tile-gap)))), 1fr));
}
.archive-grid { --columns: 4; }
.slot-tile .slot-time { display: block; font-variant-numeric: tabular-nums; }
.slot-tile .slot-date,
.slot-tile .slot-time,
.slot-tile p,
.slot-tile button { font-size: 1em; }
.slot-tile .slot-time { font-size: .925em; }
.slot-tile p { overflow-wrap: normal; }
.slot-tile button { min-height: 32px; }
#bookingPage .week-front .stat summary { white-space: nowrap; }
#bookingPage #form { scroll-margin-top: 4rem; }
#slotDetailDialog .row > button { flex: none; }
@media (max-width: 600px) {
  #bookingPage .week-front .stat { padding-inline: 4px; }
  #bookingPage .week-front .stat .group-times { line-height: 1.45; }
  #bookingPage .slot-tile p { margin: 0; }
  #bookingPage .form-field label { line-height: 1.35; }
  #bookingPage #form select { padding-inline: 3px; }
}
@media (max-width: 369px) {
  #bookingPage #form { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 600px) {
  #form .form-field:has(#slot option[data-note]:checked) { grid-column: span 2; }
}
