/* 教室調度表樣式（共用元件見 ../../assets/tools-ui.css） */
:root{--ink:#172033;--muted:#667085;--line:#dfe3ea;--blue:#2563eb;--bg:#f5f7fb}
*{box-sizing:border-box}
body{margin:0;font-family:system-ui,-apple-system,"Segoe UI","Noto Sans TC",sans-serif;color:var(--ink);background:var(--bg)}
button,input,select{font:inherit}
.bar{height:60px;display:flex;align-items:center;gap:14px;padding:0 max(18px,calc((100% - 1450px)/2));background:#fff;border-bottom:1px solid var(--line)}
.bar a{color:var(--muted);text-decoration:none;font-weight:700}
main{max-width:1450px;margin:auto;padding:24px 18px 60px}
.head{display:flex;align-items:end;justify-content:space-between;gap:18px;margin-bottom:18px}
h1{margin:0 0 4px;font-size:28px}
.sub,.muted{color:var(--muted)}
.controls,.segmented{display:flex;gap:6px;align-items:center}
.btn,.controls input,.segmented button{border:1px solid var(--line);border-radius:8px;background:#fff;padding:9px 12px;cursor:pointer}
.btn:hover,.segmented button:hover{border-color:#98a2b3}
.segmented{margin-bottom:14px}
.segmented button.active{color:#fff;background:var(--blue);border-color:var(--blue)}
.summary{margin-left:auto;color:var(--muted);font-size:13px}
.table-wrap{overflow:auto;max-height:calc(100vh - 220px);background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:0 5px 18px #1018280a}
.week-grid{display:grid;grid-template-columns:120px repeat(7,minmax(150px,1fr));min-width:1120px}
.cell{padding:8px;border-right:1px solid var(--line);border-bottom:1px solid var(--line);background:#fff}
.corner,.day-head{position:sticky;top:0;z-index:3;min-height:62px;background:#f8fafc;text-align:center;font-size:12px;font-weight:700}
.corner{left:0;z-index:5}
.day-head.today{background:#dbeafe;color:#174ea6}
.day-head.weekend{box-shadow:inset 0 4px #facc15}
.date-num{font-size:19px}
.room{position:sticky;left:0;z-index:2;min-height:152px}
.room strong{display:block;font-size:18px}
.room small{color:var(--muted)}
.room-slots{min-height:152px;display:grid;grid-template-rows:repeat(3,1fr);padding:0}
.slot{position:relative;padding:7px 8px 7px 39px;border-bottom:1px dashed var(--line);cursor:pointer;min-height:50px}
.slot:last-child{border:0}
.slot:hover{background:#eff6ff}
.shift-label{position:absolute;left:7px;top:8px;width:24px;height:24px;display:grid;place-items:center;border-radius:6px;background:#f2f4f7;color:#475467;font-size:11px;font-weight:800}
.slot.busy{background:var(--type-bg,#7dd3fc);box-shadow:inset 4px 0 var(--type,#075985)}
.slot.busy .shift-label{color:#fff;background:var(--type,#2563eb)}
.course{font-size:13px;font-weight:800;color:#1d2939}
.meta{font-size:11px;color:#475467;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.empty{font-size:12px;color:#b0b7c3}
.loading,.error{padding:60px;text-align:center;color:var(--muted)}
.error{color:#b42318}
dialog{border:0;border-radius:14px;padding:0;width:min(500px,calc(100% - 28px));box-shadow:0 24px 70px #10182844}
dialog::backdrop{background:#10182888}
.modal-head{padding:18px 20px;border-bottom:1px solid var(--line)}
.modal-head h2{margin:0;font-size:19px}
.modal-body{padding:18px 20px}
.row{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.field{margin-bottom:13px}
.field label{display:block;margin-bottom:5px;color:#475467;font-size:12px;font-weight:700}
.field input,.field select{width:100%;padding:10px 12px;border:1px solid var(--line);border-radius:8px}
.field input:focus,.field select:focus{outline:3px solid #dbeafe;border-color:#60a5fa}
.repeat{display:flex;align-items:center;gap:8px;padding:10px;background:#f8fafc;border-radius:8px}
.repeat input[type=checkbox]{width:auto}
.repeat-until{display:none;margin-top:10px}
.modal-foot{display:flex;gap:8px;padding:14px 20px;background:#f8fafc}
.spacer{flex:1}
.primary{color:#fff;background:var(--blue);border-color:var(--blue)}
.danger{display:none;color:#b42318;border-color:#fda29b;background:#fff}
.toast{position:fixed;right:20px;bottom:20px;z-index:20;padding:12px 16px;border-radius:9px;color:#fff;background:#101828;box-shadow:0 10px 30px #10182833;transform:translateY(20px);opacity:0;pointer-events:none;transition:.2s}
.toast.show{transform:none;opacity:1}
.legend{display:flex;gap:12px;flex-wrap:wrap;margin:0 0 13px;color:var(--muted);font-size:12px}
.dot{display:inline-block;width:9px;height:9px;margin-right:4px;border-radius:3px}
@media(max-width:700px){.head{display:block}
.controls{margin-top:14px;flex-wrap:wrap}
.summary{display:none}
.table-wrap{max-height:calc(100vh - 250px)}
.row{grid-template-columns:1fr}
.week-grid{grid-template-columns:88px repeat(7,145px)}
.room{min-height:167px}
.room-slots{min-height:167px}}
.slot.last{background:#fffbeb;box-shadow:inset 4px 0 #f59e0b}
.slot[draggable=true]{cursor:grab}
.slot.dragging{opacity:.35}
.slot.drag-over{outline:3px solid #2563eb;outline-offset:-3px;background:#dbeafe!important}
.slot.selected{outline:3px solid #dc2626;outline-offset:-3px}
.room[data-room-edit]{cursor:pointer}
.room[data-room-edit]:hover{background:#eff6ff}
.room-edit-tip{display:block;margin-top:8px;color:#2563eb;font-size:10px}
.line{font-size:12px;color:#344054;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.note-preview{margin-top:2px;color:#6941c6;font-size:var(--note-size,12px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.edge-tag{float:right;padding:1px 4px;border-radius:4px;background:#fff;font-size:9px;color:#475467}
.note-mark{margin-left:4px;color:#7c3aed}
.series-fields{display:none;margin-top:10px;padding:12px;background:#f8fafc;border-radius:8px}
.choice-row{display:flex;gap:6px;flex-wrap:wrap}
.choice{display:flex;align-items:center;gap:4px;padding:7px 9px;border:1px solid var(--line);border-radius:7px;background:#fff;font-size:12px}
.help{margin-top:5px;color:var(--muted);font-size:11px}
.one-hint{display:none;margin:-4px 0 12px;padding:9px 11px;color:#0e7490;background:#ecfeff;border-radius:7px;font-size:12px}
.field textarea{width:100%;padding:10px 12px;border:1px solid var(--line);border-radius:8px;resize:vertical;font:inherit}
.field textarea:focus{outline:3px solid #dbeafe;border-color:#60a5fa}
.slot.one-to-one{--type:#065f46!important;--type-bg:#6ee7b7!important}
.room,.room-slots{border-top:8px solid #e9eef5}
.room{box-shadow:inset 0 1px #cbd5e1}
.room-slots{box-shadow:inset 0 1px #cbd5e1}
.slot.busy{border-bottom-color:#cbd5e1}
.note-preview{display:none}
.schedule-tooltip{position:fixed;display:none;z-index:100;max-width:min(420px,calc(100vw - 24px));padding:10px 12px;border:1px solid #475467;border-radius:7px;background:#fff;color:#101828;font-size:var(--note-size,12px);line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere;box-shadow:0 8px 24px #1018282e;pointer-events:none}
.segmented{flex-wrap:wrap}
.batch-dialog{width:min(760px,calc(100% - 28px))}
.batch-find{width:100%;padding:12px 14px;border:1px solid var(--line);border-radius:9px;font-size:15px}
.batch-results{max-height:55vh;overflow:auto;margin-top:12px;border:1px solid var(--line);border-radius:9px}
.batch-result{display:grid;grid-template-columns:auto 105px 70px 1fr;gap:10px;align-items:center;padding:10px 12px;border-bottom:1px solid var(--line);cursor:pointer}
.batch-result:last-child{border:0}
.batch-result:hover{background:#f8fafc}
.batch-result:has(input:checked){background:#eff6ff}
.batch-result small{color:var(--muted)}
.batch-course{min-width:0}
.batch-course strong,.batch-course small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@media(max-width:700px){.batch-result{grid-template-columns:auto 82px 1fr}
.batch-result>small{display:none}}
.slot.first{--type:#075985!important;--type-bg:#38bdf8!important;background:#38bdf8!important;box-shadow:inset 4px 0 #0369a1!important}
.slot.first .shift-label{background:#0369a1!important}
.week-grid{grid-template-columns:120px repeat(14,minmax(150px,1fr));min-width:2220px}
@media(max-width:700px){.week-grid{grid-template-columns:88px repeat(14,145px);min-width:2118px}}
.sheet-month{background:#fff}
.sm-table{border-collapse:separate;border-spacing:0;table-layout:fixed;width:max-content;font-size:var(--sm-font,10px)}
.sm-table col{width:var(--sm-col,42px)}
.sm-table col.sm-room-col{width:var(--sm-room,70px)}
.sm-table th,.sm-table td{padding:0;border-right:1px solid #cbd5e1;border-bottom:1px solid #cbd5e1;text-align:center;vertical-align:middle;background:#fff}
.sm-title{padding:6px 0!important;text-align:left!important;background:#fef9c3!important;border-bottom:2px solid #94a3b8!important}
.sm-title span{position:sticky;left:12px;font-size:15px;font-weight:900}
.sm-block tr:first-child>th{border-top:6px solid #e9eef5}
.sm-days th{padding:3px 0;background:#f1f5f9;font-size:calc(var(--sm-font,10px) + 2px);font-weight:800;cursor:pointer}
.sm-days th:hover{text-decoration:underline}
.sm-weekdays th{padding:2px 0;background:#f8fafc;color:#475467;font-weight:600}
.sm-table .sm-shift,.sm-table .sm-room{position:sticky;left:0;z-index:2}
.sm-table .sm-shift{background:#fde047;font-size:calc(var(--sm-font,10px) + 4px);font-weight:900;cursor:default}
.sm-room{padding:2px!important;line-height:1.2;cursor:pointer}
.sm-room:hover{background:#eff6ff!important}
.sm-room b{display:block;font-size:calc(var(--sm-font,10px) + 3px)}
.sm-room span{display:block;color:#475467}
.sm-table td.sm-weekend,.sm-weekdays th.sm-weekend{background:#fef9c3}
.sm-days th.sm-weekend{background:#fde047}
.sm-table td.sm-closed{background:#fce7f3}
.sm-days th.sm-closed,.sm-weekdays th.sm-closed{background:#f9a8d4}
.sm-days th.sm-today{background:#2563eb;color:#fff}
.sheet-month .slot{display:flex;flex-direction:column;justify-content:center;gap:1px;min-height:var(--sm-row,38px);padding:2px 1px;border:0;line-height:1.2;background:transparent}
.sheet-month .slot:hover{background:#dbeafe}
.sheet-month .slot.busy{background:var(--type-bg);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--type) 38%,transparent)!important}
.sheet-month .slot.first{box-shadow:inset 0 0 0 1px #0284c7!important}
.sm-line{overflow:hidden;color:#1d2939;white-space:nowrap;text-overflow:ellipsis}
.sm-course{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;color:var(--type);font-weight:800;white-space:normal;word-break:normal;overflow-wrap:break-word}
.sm-meta{display:flex;flex-direction:column;align-items:center;gap:1px;min-width:0;max-width:100%}
.sm-meta .sm-line{max-width:100%}
body.print-tight .sm-meta{flex-direction:row;flex-wrap:wrap;justify-content:center;column-gap:3px}
body.print-tight .sheet-month .slot{gap:0;padding:1px;line-height:1.1}
body.print-tight{--sm-row:18px}
.sheet-month .slot.sm-closure{background:transparent;color:#dc2626;font-size:calc(var(--sm-font,10px) + 1px);font-weight:800}
.sm-closure-fill{display:flex;align-items:center;justify-content:center;min-height:var(--sm-row,38px);color:#dc2626;font-size:calc(var(--sm-font,10px) + 1px);font-weight:800}
.slot-closed-fill{position:relative;min-height:50px;padding:7px 8px 7px 39px;border-bottom:1px dashed var(--line);background:#fef2f2}
.slot-closed-fill:last-child{border:0}
.closed-text{color:#dc2626;font-size:12px;font-weight:800}
.drag-confirm{width:min(440px,calc(100% - 28px))}
.drag-course{margin-bottom:12px;font-size:17px;font-weight:800}
.drag-route{display:flex;align-items:center;gap:10px}
.drag-route>div{flex:1;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:#f8fafc}
.drag-route small{display:block;margin-bottom:2px;color:var(--muted);font-size:11px}
.drag-route b{font-size:14px}
.drag-arrow{color:var(--muted)}
.drag-hint{margin:12px 0 0;color:#b42318;font-size:13px}
.drag-hint.is-copy{color:#067647}
body.suite-picking .slot:not(.busy){outline:2px dashed var(--tool-accent);outline-offset:-4px}
body.suite-picking .slot:not(.busy):hover{background:var(--tool-accent-soft)}
.sm-zoom{display:none}
body.month-mode .sm-zoom{display:inline-block}
body.month-mode main{max-width:none;padding-top:14px}
body.month-mode .table-wrap{max-height:calc(100vh - 175px)}
.focus-toggle i{font-size:16px}
body.schedule-focus{overflow:hidden}
body.schedule-focus .suite-bar{display:none}
body.schedule-focus main{position:fixed;inset:0;z-index:15;display:flex;flex-direction:column;max-width:none;padding:10px;background:var(--bg)}
body.schedule-focus .head{align-items:center;margin-bottom:8px}
body.schedule-focus .head .sub{display:none}
body.schedule-focus .segmented{flex:0 0 auto;margin-bottom:8px}
body.schedule-focus .legend{flex:0 0 auto;margin-bottom:8px}
body.schedule-focus .table-wrap{flex:1 1 auto;min-height:0;max-height:none;border-radius:6px}
body.schedule-focus .focus-toggle{color:#fff;background:var(--tool-accent);border-color:var(--tool-accent)}
@media(max-width:700px){body.schedule-focus main{padding:6px}body.schedule-focus .head{margin-bottom:6px}body.schedule-focus .legend{display:none}.focus-toggle span{display:none}}
html[data-sm-zoom=compact] .wk-full{display:none}
body.printing{background:#fff;--sm-col:40px;--sm-room:84px;--sm-row:26px;--sm-font:9px}
body.printing .bar,body.printing .suite-bar,body.printing .suite-toasts,body.printing .suite-banner,body.printing main>:not(.table-wrap),body.printing .toast,body.printing .schedule-tooltip{display:none!important}
body.printing main{position:static;display:block;max-width:none;padding:0}
body.printing .table-wrap{overflow:visible;max-height:none;border:0;border-radius:0;box-shadow:none}
body.printing .wk-full{display:none}
body.printing .sm-table .sm-shift,body.printing .sm-table .sm-room,body.printing .sm-title span{position:static}
body.printing .sm-block tr:first-child>th{border-top-width:3px}
body.printing .sm-days th.sm-today{background:#f1f5f9;color:inherit}
@page{size:A4 landscape;margin:7mm}
@media print{*{-webkit-print-color-adjust:exact;print-color-adjust:exact}}
.sm-room span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body[data-tool="schedule"]{--blue:var(--tool-accent)}
.primary:hover{background:var(--tool-accent-dark);border-color:var(--tool-accent-dark)}
