.auto-page{max-width:1440px;margin:auto;padding:24px;color:#234764}header{display:flex;justify-content:space-between;align-items:center;gap:16px;flex-wrap:wrap}h1{margin:8px 0;font-size:28px;color:#174b76}h2{font-size:19px;margin:0 0 14px}h3{font-size:16px}p{margin:6px 0 12px}.panel,.result-room{background:#fff;border:1px solid #d6e5f1;border-radius:18px;padding:22px;margin:18px 0;box-shadow:0 6px 22px #174b7608}.fields,.day-fields{display:flex;gap:12px;flex-wrap:wrap}.fields label{min-width:180px}.day-fields label{width:120px}label{display:grid;gap:6px}input,select{font:inherit;border:1px solid #c5d8e8;border-radius:8px;padding:9px;min-width:0;width:100%;background:white}input[type=checkbox]{width:auto}.class-choices,.actions{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin:14px 0}.actions>*{width:auto}.class-choices label,.check{display:flex;align-items:center;gap:8px}.class-choices label{padding:8px 14px;background:#edf6fc;border-radius:9px}.hint{font-size:13px;color:#647f94}.notice{background:#edf7ff;border-radius:12px;padding:14px;margin:16px 0;white-space:pre-line}.notice.error{background:#fff0ed;color:#a03c32}.scroll{overflow:auto}table{width:100%;border-collapse:collapse;min-width:780px}th,td{text-align:left;padding:9px;border-bottom:1px solid #e0eaf2;vertical-align:top}th{font-size:13px;color:#587991}td input[type=number]{width:85px}td select{min-width:150px}td input[type=text]{min-width:130px}.busy-row{display:flex;gap:8px;align-items:center;margin:10px 0}.busy-row select{max-width:250px}.result-room table{table-layout:fixed;min-width:800px}.result-room td{height:76px;background:#f6fafe;border:4px solid white;border-radius:10px}.result-room td small{display:block;color:#647f94;font-size:12px;margin-top:5px}.reserved{color:#946c32;background:#fff7e9!important}.empty{color:#97aabb}.result-room h2{margin-bottom:5px}fieldset{border:0;padding:0;margin:0}button:disabled{opacity:.45;cursor:not-allowed}button{cursor:pointer}.remove{border:0;background:#fff0ed;color:#a03c32;border-radius:8px;padding:8px 12px}@media(max-width:700px){.auto-page{padding:12px}.panel{padding:14px}.busy-row{flex-wrap:wrap}h1{font-size:24px}}@media print{@page{size:A4 landscape;margin:10mm}.app-topbar,header,#notice,#controls{display:none!important}.auto-page{padding:0}.result-room{break-after:page;border:0;box-shadow:none;margin:0;padding:0}.result-room:last-child{break-after:auto}.scroll{overflow:visible}.result-room table{min-width:0}.result-room td{height:22mm;font-size:12px}}
.auto-page [hidden]{display:none!important}

/* ภาระสอนจากฝ่ายวัดผล (ข้อมูลกลาง แก้ที่ระบบรายงานผลการเรียน) */
tr.from-master { background: #f3f6ff; }
.auto-page tr.from-master input[readonly], .auto-page tr.from-master select:disabled { background: transparent !important; border-color: transparent !important; box-shadow: none !important; color: inherit; font-weight: 600; cursor: default; appearance: none; -webkit-appearance: none; }
.master-tag { display: inline-block; margin-top: 2px; font-size: 11px; color: #3949ab; background: #e3e8fb; border-radius: 6px; padding: 0 6px; }

/* ผลลงไม่ครบ / ตารางเดิมของครูในห้องอื่น */
.auto-page .warn{color:#a03c32}
.auto-page .unplaced{margin-top:12px;background:#fff6ed;border:1px solid #f3d3b4;border-radius:12px;padding:12px 16px;color:#7a4a1c}
.auto-page .unplaced ul{margin:8px 0 0;padding-left:20px}.auto-page .unplaced li{margin:6px 0}.auto-page .unplaced small{display:block;color:#946c32;font-size:12px;margin-top:2px}
.result-room td.other{background:#eef1f5!important;color:#6b7c8c}.result-room td.other strong{font-weight:500}
@media print{.auto-page .unplaced{break-inside:avoid}}
.result-room th small{display:block;font-weight:400;color:#8aa0b2;font-size:11px}
/* fieldset มี min-width: min-content โดยค่าเริ่มต้น ทำให้ตารางกว้างดันทั้งหน้าล้นจอมือถือ */
.auto-page fieldset{min-width:0}.auto-page .panel{min-width:0}

/* โครงเวลาเรียน */
.structure{min-width:900px}.structure th,.structure td{padding:6px;vertical-align:middle;text-align:center}.structure th:first-child,.structure td:first-child{text-align:left}
.structure .times{display:flex;gap:4px;align-items:center;justify-content:center}.structure .times input{padding:5px;font-size:12px;width:76px}
.structure td.subj{color:#587991;background:#edf6fc;border-radius:8px;font-size:13px}.structure td.lunch,.structure th.lunch{background:#f3f5f7;color:#8aa0b2;font-size:12px}
.structure td.act-cell{background:#fff7e9;color:#946c32;font-size:13px;border-radius:8px}.structure th small{display:block;font-weight:400;color:#8aa0b2;font-size:11px}
.bands{display:grid;gap:16px}.band h4{margin:6px 0}
.time-grid{display:flex;flex-wrap:wrap;gap:12px}.time-grid label{min-width:190px}.time-grid .times{display:flex;gap:4px;align-items:center}.time-grid .lunch-box{background:#f3f5f7;border-radius:10px;padding:6px 8px;color:#6b7c8c}
.structure td.cell{padding:3px}.structure td.cell input{font-size:13px;padding:7px;background:#f6fafe;border-color:#dbe7f1;text-align:center}.structure td.cell input::placeholder{color:#a3b7c7}.structure td.cell.on input{background:#fff7e9;border-color:#ecd2a6;color:#7a5520;font-weight:600}
.warn{color:#a03c32}
