/* Only the added scheduler screen and its dialogs are styled here. */
.hms{--hms-blue:#1855b2;--hms-ink:#183351;--hms-muted:#61738b;--hms-line:#dce5f0;font-family:'Plus Jakarta Sans','Segoe UI',Arial,sans-serif;font-size:15px;line-height:1.55;color:var(--hms-ink);min-width:0;width:100%;box-sizing:border-box}
.hms *{box-sizing:border-box}.hms.hidden,.hms [hidden]{display:none!important}.hms h2,.hms h3,.hms h4,.hms p{margin:0}.hms h2{font-size:27px;line-height:1.25;font-weight:800;margin:6px 0 9px}.hms h3{font-size:18px;line-height:1.4;font-weight:800}.hms h4{font-size:15px;font-weight:800;margin:12px 0 8px}.hms small{display:block;font-size:12px;line-height:1.5;color:var(--hms-muted);white-space:normal}.hms b,.hms strong{font-weight:750}
.hms button{font:inherit;font-size:13px;font-weight:650;line-height:1.3;border:1px solid #d4dfed;border-radius:9px;padding:10px 13px;min-height:42px;color:#1e4676;background:#fff;cursor:pointer;transition:background .12s,border-color .12s}.hms button:hover{background:#edf5ff;border-color:#8caedd}.hms button:focus-visible,.hms input:focus-visible,.hms select:focus-visible{outline:3px solid #63a7fa;outline-offset:2px}.hms button:disabled{opacity:.45;cursor:not-allowed}.hms button.hms-primary{background:var(--hms-blue);color:#fff;border-color:var(--hms-blue)}.hms button.hms-apply{background:#e9f5ef;border-color:#9dd1b7;color:#196340}.hms button.hms-danger{color:#9c3040;border-color:#e6c0c7}
.hms label{display:flex;flex-direction:column;gap:7px;font-size:13px;font-weight:650;min-width:0}.hms input:not([type=checkbox]),.hms select{font:inherit;font-size:14px;color:#183351;border:1px solid #cfdae8;border-radius:8px;background:#fff;padding:8px 9px;min-height:42px;width:100%;max-width:100%;box-shadow:none;min-width:0}.hms input[type=checkbox]{width:18px;height:18px;accent-color:var(--hms-blue);flex:0 0 18px}.hms input[type=number]{min-width:65px}.hms select{background-image:none}.hms input[type=time]{min-width:108px}
.hms-hero{display:flex;gap:20px;justify-content:space-between;align-items:center;border:1px solid #cddff3;border-radius:18px;padding:24px 28px;background:linear-gradient(112deg,#e8f2ff,#f7fbff);margin-bottom:16px}.hms-hero p{font-size:14px;color:#52708e;max-width:740px}.hms-kicker{font-size:11px;letter-spacing:.12em;font-weight:800;color:#376ca6}.hms-badge{white-space:nowrap;border:1px solid #b8cfea;background:#fff;border-radius:20px;padding:7px 12px;font-size:12px;flex-shrink:0}.hms-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:14px 0}.hms-stats>div{padding:14px 18px;background:#fff;border:1px solid var(--hms-line);border-radius:12px}.hms-stats span{font-size:12px;display:block;color:var(--hms-muted)}.hms-stats strong{display:block;margin-top:3px;font-size:23px;line-height:1.4;color:#214c84}.hms-stats>div:last-child strong{font-size:18px}
.hms-notice{background:#eef6ff;border:1px solid #bdd6f1;border-radius:10px;padding:12px 16px;margin-bottom:14px;font-size:14px;overflow-wrap:anywhere}.hms-notice.is-error{background:#fff1f1;border-color:#edc5cc;color:#a43846}.hms-tabs{display:flex;gap:5px;background:#edf1f7;padding:5px;border-radius:11px;margin-bottom:18px}.hms-tabs button{background:transparent;border-color:transparent;flex:1;padding:11px 8px;box-shadow:none}.hms-tabs button.active{background:#fff;color:#1952a0;border-color:#d5e3f4;box-shadow:0 2px 5px #19385e09}
.hms-card{background:#fff;border:1px solid var(--hms-line);border-radius:14px;padding:20px;margin-bottom:16px;min-width:0}.hms-help{font-size:13px!important;line-height:1.65!important;color:var(--hms-muted);margin:7px 0 14px!important}.hms-grid2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.hms-grid2>.hms-card{height:auto}.hms-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(165px,1fr));gap:13px;margin:16px 0}.hms-checks{display:flex;flex-wrap:wrap;gap:7px;margin:12px 0}.hms-checks label{display:inline-flex;flex-direction:row;align-items:center;gap:7px;border:1px solid #dbe5f0;border-radius:8px;padding:8px 10px;background:#f9fbfe;font-size:13px}.hms label.hms-checkbox,.hms label.hms-confirm{flex-direction:row;align-items:flex-start;gap:10px;font-size:14px;font-weight:500}.hms label.hms-checkbox input,.hms label.hms-confirm input{margin-top:3px}.hms-confirm{padding:15px 18px;background:#eef5fd;border:1px solid #c7dbf4;border-radius:10px;margin-bottom:14px}
.hms-table-wrap{max-width:100%;overflow:auto;-webkit-overflow-scrolling:touch;margin:12px 0 14px}.hms table{width:100%;border-collapse:collapse;font-size:13px}.hms th{font-weight:750;color:#405b7d;background:#f4f7fb;text-align:left;white-space:nowrap}.hms td,.hms th{padding:10px 9px;border-bottom:1px solid #e4ebf2;vertical-align:middle}.hms td:first-child{max-width:270px}.hms table input[type=number]{width:80px}.hms table input[type=time]{width:113px}.hms-class-table{min-width:675px}.hms-class-table td:first-child{min-width:195px}.hms-class-table td small{margin-top:4px}.hms button.hms-add{background:#f4f8fd;border-style:dashed;width:100%}
.hms-section-head{display:flex;gap:14px;align-items:flex-start;justify-content:space-between}.hms-section-head>select{width:auto;min-width:150px;flex:0 0 auto}.hms-section-head .hms-help{margin-bottom:0!important}.hms-inline{display:flex;gap:7px;flex-wrap:wrap}.hms-group-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:10px}.hms-group{background:#f7faff;border:1px solid #dae7f6;border-radius:10px;padding:14px}.hms-group>div:first-child{display:flex;align-items:center;gap:12px;justify-content:space-between;margin-bottom:6px}.hms-group p{font-size:13px;margin-top:3px}.hms-group small{margin-top:7px}.hms-chip{font-size:11px;font-weight:750;padding:4px 9px;border-radius:20px;background:#e5effd;color:#215593;white-space:nowrap}.hms-check-result{padding:12px 15px;margin:15px 0;border-radius:9px;font-size:14px;border:1px solid}.hms-check-result.ok{background:#ecf8f1;border-color:#b9dfc9;color:#216846}.hms-check-result.warn{background:#fff6ec;border-color:#f0d5ad;color:#905c27}.hms-issues{background:#fff7f6;border:1px solid #efd4d0;border-radius:10px;padding:12px 16px}.hms-issues summary{font-weight:750;cursor:pointer}.hms-issues ul{margin:10px 0 0;padding-left:20px;color:#94493c;font-size:13px;max-height:230px;overflow:auto}.hms-issues li{padding:3px 0}
.hms-week table{min-width:970px;table-layout:fixed}.hms-week td{vertical-align:top;padding:7px;background:#fbfcfe;border:1px solid #e2eaf3}.hms-week th{border:1px solid #e2eaf3;padding:12px;text-align:center}.hms-week th:first-child{width:85px}.hms .hms-event{display:flex;flex-direction:column;align-items:flex-start;text-align:left;width:100%;white-space:normal;padding:10px;border-radius:8px;margin:0 0 7px;min-height:92px;background:#e9f2ff;border-color:#c5d8f3;color:#244a80;overflow-wrap:anywhere}.hms-event strong{font-size:12px}.hms-event span{font-size:11px}.hms-event small{font-size:10px;color:inherit;opacity:.85}.hms .subject-physics{background:#e9f7f2;border-color:#cae7dc;color:#2a6853}.hms .subject-chemistry{background:#fff5e5;border-color:#f0dfbf;color:#896029}.hms .subject-english{background:#f2edfc;border-color:#e1d5f4;color:#745297}.hms .subject-other{background:#eff2f5;border-color:#d6dce4;color:#516373}.hms-unplaced{display:flex;gap:8px;flex-wrap:wrap}.hms-unplaced button{border-style:dashed;color:#a4572a;background:#fff9f2}.hms-history{display:flex;gap:15px;align-items:center;justify-content:space-between;padding:13px 0;border-bottom:1px solid var(--hms-line)}.hms-history:last-child{border-bottom:0}.hms-history button{flex-shrink:0}.hms-history small{margin-top:4px}
.hms-actions{display:flex;gap:9px;flex-wrap:wrap;padding:15px;background:#fff;border:1px solid var(--hms-line);border-radius:12px;margin-top:16px}.hms-actions button{flex:1 1 auto;font-size:13px}.hms-footnote{font-size:12px;color:var(--hms-muted);margin:12px 0 20px!important}.hms-empty{padding:35px;text-align:center;color:var(--hms-muted)}
.hms-dialog{margin:auto;padding:0;width:min(760px,calc(100vw - 28px));max-height:calc(100dvh - 36px);border:1px solid #ccd9e9;border-radius:16px;background:#fff;color:var(--hms-ink);box-shadow:0 24px 80px #14315233;overflow:auto}.hms-dialog::backdrop{background:#10284388;backdrop-filter:blur(2px)}.hms-dialog header{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:17px 22px;border-bottom:1px solid var(--hms-line)}.hms-dialog h3{font-size:18px}.hms-dialog header button{font-size:20px;min-width:42px}.hms-dialog-body{padding:20px 22px}.hms-dialog footer{display:flex;justify-content:flex-end;gap:9px;padding:15px 22px;border-top:1px solid var(--hms-line)}.hms-availability{min-width:535px}.hms-availability td,.hms-availability th{text-align:center}.hms-availability input{min-height:24px;min-width:24px}
@media(max-width:1100px){.hms-grid2{grid-template-columns:1fr}.hms h2{font-size:24px}.hms-stats strong{font-size:22px}}
@media(max-width:640px){.hms{font-size:14px}.hms-hero{padding:19px 17px;display:block}.hms h2{font-size:23px}.hms-hero p{font-size:13px}.hms-badge{display:inline-flex;margin-top:12px;font-size:11px}.hms-stats{grid-template-columns:1fr 1fr;gap:8px}.hms-stats>div{padding:12px}.hms-stats span{font-size:11px}.hms-stats strong{font-size:22px}.hms-stats>div:last-child strong{font-size:14px}.hms-card{padding:15px;border-radius:12px}.hms h3{font-size:16px}.hms-tabs{gap:1px;padding:4px}.hms-tabs button{font-size:11px;padding:9px 5px;line-height:1.4}.hms-fields{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.hms input:not([type=checkbox]),.hms select{font-size:16px;min-height:44px}.hms button{min-height:44px;font-size:12px}.hms td,.hms th{padding:8px 7px}.hms label{font-size:12px}.hms-checks{gap:5px}.hms-checks label{padding:7px 8px;font-size:12px}.hms-section-head{flex-wrap:wrap}.hms-section-head>select{width:100%}.hms-actions{padding:10px;display:grid;grid-template-columns:1fr 1fr}.hms-actions button{padding:11px 8px;font-size:12px}.hms-group-grid{grid-template-columns:1fr}.hms-dialog-body{padding:15px}.hms-dialog header,.hms-dialog footer{padding:12px 15px}.hms-dialog h3{font-size:16px}.hms-history{align-items:flex-start}.hms-history b{font-size:13px}.hms-help{font-size:12px!important}.hms-notice{font-size:13px;padding:11px 13px}.hms-footnote{padding-bottom:16px}}
@media(prefers-reduced-motion:reduce){.hms button{transition:none}}
/* V15: pointer drag is limited to a handle; the rest of the board still scrolls on touch. */
.hms-sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap;border:0!important}
.hms-notice{white-space:pre-line}
.hms .hms-event{padding:7px 8px;min-height:116px;display:block}
.hms-event-top{display:flex;align-items:center;justify-content:space-between;gap:4px}
.hms .hms-drag-handle{touch-action:none;cursor:grab;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;min-width:44px;min-height:44px;padding:5px;font-size:21px;line-height:1;background:transparent;color:inherit;border-color:transparent;flex:0 0 44px}
.hms .hms-drag-handle:hover{background:#ffffffaa;border-color:currentColor}
.hms .hms-drag-handle:disabled{cursor:not-allowed}
.hms .hms-event-edit{width:100%;padding:3px 0;background:transparent!important;border:0;box-shadow:none;text-align:left;color:inherit;min-height:55px}
.hms .hms-event-edit span,.hms .hms-event-edit small{display:block;color:inherit;white-space:normal}
.hms .hms-event-edit span{font-size:13px;line-height:1.5}
.hms .hms-event-edit small{font-size:12px;line-height:1.5}
.hms .hms-week td.hms-drop-hover{background:#e5f1ff;box-shadow:inset 0 0 0 3px #2468be}
.hms .hms-event.is-dragging{opacity:.45;outline:2px dashed currentColor}
.hms-drag-ghost{position:fixed;left:0;top:0;z-index:2147483647;pointer-events:none!important;max-width:245px;width:auto;padding:12px 15px;border:2px solid #2468be;border-radius:10px;background:#fff;color:#174888;box-shadow:0 8px 24px #12345b33;font-size:14px}
body.hms-dragging{cursor:grabbing;user-select:none;-webkit-user-select:none}
.hms-spacing-warning{padding:14px 16px;margin:14px 0;border:1px solid #e9ce91;background:#fff9eb;border-radius:10px;color:#785520}
.hms-spacing-warning summary{font-weight:750;cursor:pointer}
.hms-spacing-warning p{font-size:13px;margin-top:8px}
.hms-spacing-warning ul{padding-left:20px;font-size:13px;max-height:220px;overflow:auto}
.hms-teacher-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:9px}
.hms-teacher-list button{display:flex;align-items:center;justify-content:space-between;gap:10px;text-align:left}
.hms-teacher-list span{font-size:12px;font-weight:500;white-space:nowrap;color:#667b96}
.hms-busy-table{min-width:620px}
.hms-busy-table th button{min-height:44px;min-width:44px;padding:8px}
.hms-busy-table td{padding:4px!important;background:#f3faf6;border:1px solid #d9e6dd}
.hms-busy-table td label{align-items:center;justify-content:center;gap:3px;min-height:58px;cursor:pointer}
.hms-busy-table td.is-busy{background:#fff0ef;border-color:#eeb9b9}
.hms-busy-table td.is-busy .hms-busy-label{color:#ae3340;font-weight:700}
.hms-busy-table td.is-unavailable{background:#eef0f3;color:#798391}
.hms-busy-table input{accent-color:#b73949!important}
.hms-busy-label{font-size:11px;font-weight:500;white-space:nowrap}
@media(max-width:640px){.hms-teacher-list{grid-template-columns:1fr}.hms .hms-event{padding:5px 6px}.hms .hms-event strong{font-size:12px}.hms .hms-event-edit span{font-size:13px}.hms .hms-event-edit small{font-size:12px}.hms-spacing-warning{padding:12px}.hms-drag-ghost{max-width:190px;font-size:12px}.hms .hms-fields:has([data-global="spacing_mode"]){grid-template-columns:1fr}}
/* Keep dialog actions reachable on short mobile viewports. */
.hms-dialog>form{margin:0}
.hms-dialog>form>header{position:sticky;top:0;z-index:4;background:#fff}
.hms-dialog>form>footer{position:sticky;bottom:0;z-index:4;background:#fff}

/* V15.1: inline diagnostics, scoped to the scheduler only. */
#appScreen #viewScheduler table {font-size:14px;line-height:1.5}
.hms-toolbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:0 0 16px}
.hms-diagnostics{border-color:#eed8a7}
.hms-diagnostics summary{cursor:pointer;font-weight:700;margin:12px 0}
.hms-diagnostic-list{max-height:480px;overflow:auto;border:1px solid #e1e8f1;border-radius:12px}
.hms-diagnostic-item{display:grid;grid-template-columns:110px minmax(0,1fr) 180px;gap:12px;padding:16px;border-bottom:1px solid #e1e8f1;background:#fff}
.hms-diagnostic-item:last-child{border-bottom:0}
.hms-diagnostic-item span{color:#637792;font-size:13px}
.hms-diagnostic-item p{margin:6px 0;font-size:14px;line-height:1.6}
.hms-diagnostic-buttons{display:flex;flex-direction:column;gap:8px;align-self:center}
.hms-diagnostic-buttons button{white-space:normal}
@media(max-width:700px){.hms-toolbar>button{flex:1 1 140px;min-height:44px;white-space:normal}.hms-diagnostic-item{grid-template-columns:1fr;gap:8px}.hms-diagnostic-buttons{flex-direction:row;flex-wrap:wrap}.hms-diagnostic-buttons button{flex:1 1 120px}.hms-diagnostic-item p{font-size:15px}}

/* V15.2 - persistent room master */
.hms-room-master{margin-bottom:16px}
.hms-room-master .hms-section-head{align-items:flex-start;gap:12px}
.hms-room-master .hms-badge.is-ready{background:#ecfdf5;color:#047857;border-color:#a7f3d0}
.hms-room-master .hms-badge.is-warn{background:#fff7ed;color:#c2410c;border-color:#fed7aa}
.hms-room-master table{min-width:780px}
.hms-room-master td:nth-child(1){white-space:nowrap;font-weight:700}
.hms-room-master input,.hms-room-master select{min-width:110px}
.hms-room-master td:nth-child(5) input{min-width:180px}
.hms-room-actions{margin-top:12px;justify-content:flex-end;flex-wrap:wrap}
@media(max-width:640px){
  .hms-room-master .hms-section-head{display:block}
  .hms-room-master .hms-badge{display:inline-flex;margin-top:8px}
  .hms-room-actions{justify-content:stretch}
  .hms-room-actions button{flex:1 1 160px}
}


/* V15.3 - completion optimizer + linked weekly-class highlight */
.hms .hms-optimize{background:#fff7d6;border-color:#e7b928;color:#805b00;font-weight:800}
.hms .hms-optimize:hover{background:#ffefaa}
.hms .hms-week.has-class-highlight .hms-event:not(.is-same-class){opacity:.24;filter:saturate(.45)}
.hms .hms-event.is-same-class{opacity:1!important;filter:none!important;outline:3px solid #1d65d8;outline-offset:2px;box-shadow:0 0 0 5px #dbeafe,0 10px 24px #1d4ed833;transform:translateY(-2px);position:relative;z-index:5}
.hms .hms-event.is-same-class .hms-event-top strong{text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:3px}
@media(max-width:640px){.hms .hms-week.has-class-highlight .hms-event:not(.is-same-class){opacity:.18}.hms .hms-event.is-same-class{outline-width:2px;box-shadow:0 0 0 3px #dbeafe,0 7px 18px #1d4ed82b}}

/* V16 - independent weekly sessions, unassigned tray and per-session locks. */
.hms-unassigned-tray{margin:14px 0 16px;padding:12px;border:1px solid #f1c5c5;border-radius:12px;background:#fff8f8}
.hms-unassigned-tray .hms-section-head{align-items:center;margin-bottom:9px}
.hms-unassigned-tray .hms-section-head small{margin-top:2px}
.hms-unassigned-tray .hms-unplaced{max-height:260px;overflow:auto;padding:3px;align-items:flex-start}
.hms-unassigned-tray .hms-event{width:min(230px,100%);min-height:108px;margin:0;background:#fff;border-style:dashed}
.hms-unassigned-tray .hms-event button{border-style:solid;color:inherit;background:transparent}
.hms-unassigned-tray .hms-event-edit{border:0!important}
.hms .hms-lock-btn{min-width:36px;min-height:36px;padding:4px 6px;background:#ffffffaa;border-color:#d5dfec;font-size:14px}
.hms .hms-event.is-locked{box-shadow:inset 0 0 0 2px #d49a20}
.hms .hms-event.is-locked .hms-drag-handle{opacity:.35}
.hms-unassigned-tray.has-class-highlight .hms-event:not(.is-same-class){opacity:.24;filter:saturate(.45)}
.hms .hms-event-top>.hms-inline{flex-wrap:nowrap;gap:2px;align-items:center}
@media(max-width:640px){
  .hms-unassigned-tray .hms-event{width:100%}
  .hms-unassigned-tray .hms-unplaced{display:grid;grid-template-columns:1fr;max-height:300px}
  .hms .hms-lock-btn{min-width:40px;min-height:40px}
}

/* V16.1 */
.hms-auto-value{display:inline-block;font-weight:800;color:#1d4ed8;background:#eff6ff;border:1px solid #bfdbfe;border-radius:999px;padding:3px 8px;white-space:nowrap}
