/* Các thành phần cũ là lớp nền; redesign.css quyết định bố cục mới. */
@layer legacy {
:root{font-family:system-ui,-apple-system,"Segoe UI",sans-serif;color:#182c40;background:#f3f6fa;line-height:1.6;font-size:16px;--primary:#155a88;--border:#d9e2ec}
*{box-sizing:border-box}body{margin:0}header{background:#133a58;color:#e1edf6;padding:20px max(24px,calc((100vw - 1152px)/2));display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px}.brand{color:#fff;font-weight:750;font-size:1.35rem;text-decoration:none}main{max-width:1200px;padding:24px;margin:auto}footer{text-align:center;font-size:.85rem;color:#52677b;padding:24px}h1{font-size:1.85rem;line-height:1.3;margin:28px 0 20px}h2{font-size:1.2rem;margin:0 0 12px}h3{font-size:1rem}a{color:var(--primary);text-underline-offset:3px}nav{display:flex;gap:16px;flex-wrap:wrap;border-bottom:1px solid var(--border);padding:0 0 18px;align-items:center}nav a{text-decoration:none;font-weight:600}nav form{margin-left:auto}.link{background:none;color:var(--primary);padding:0;font-size:1rem;border:0;border-radius:0;cursor:pointer}.card{background:#fff;border:1px solid var(--border);border-radius:12px;padding:24px;margin:18px 0;box-shadow:0 3px 14px #12345605}.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:18px}.grid .card{margin:0}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}.wide{grid-column:1/-1}.narrow{max-width:520px}.narrow label{margin-bottom:18px}label{display:block;font-weight:600}input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select{display:block;margin-top:7px;width:100%;border:1px solid #8ba2b5;border-radius:7px;background:#fff;padding:11px 12px;font:inherit;min-height:46px}input:focus,select:focus,button:focus,a:focus{outline:3px solid #55b2eb;outline-offset:3px}button,.button{background:var(--primary);color:#fff;border:1px solid var(--primary);border-radius:7px;font:inherit;font-weight:650;padding:11px 18px;cursor:pointer;display:inline-block;text-decoration:none}button:hover,.button:hover{background:#0d4267}.secondary{background:#fff;color:var(--primary)}.check{display:flex;align-items:center;gap:9px;font-weight:500}.check input{width:19px;height:19px;accent-color:var(--primary);flex:none}small{display:block;color:#556d81;font-weight:400;margin-top:7px;font-size:.85rem}.notice,.error{padding:16px 20px;border-radius:8px;background:#e5f2fc;border:1px solid #9fc6e2}.error{background:#fff0f0;color:#8b2323;border-color:#e4acac}.table-wrap{overflow-x:auto;border-radius:10px;border:1px solid var(--border);background:white}table{width:100%;border-collapse:collapse;text-align:left}th{background:#eaf1f7;font-weight:650}th,td{padding:13px 16px;border-bottom:1px solid var(--border);vertical-align:top}tr:last-child td{border-bottom:0}fieldset{border:1px solid var(--border);border-radius:8px;padding:18px}legend{padding:0 8px}.room-checks{display:flex;flex-wrap:wrap;gap:12px 24px;padding:14px 0}.toolbar{display:flex;align-items:end;gap:16px}.toolbar label{min-width:220px}.toolbar button{margin-bottom:0}ul,ol{padding-left:25px}li{margin:7px 0}
@media(max-width:650px){main{padding:16px}.form-grid{grid-template-columns:1fr}.wide{grid-column:auto}.card{padding:18px}nav form{margin-left:0}header{padding:18px}.toolbar{align-items:stretch;flex-direction:column}h1{font-size:1.5rem}th,td{padding:10px}button,.button{white-space:normal}}

.icon{width:1.15em;height:1.15em;flex:none;vertical-align:-.2em;margin-right:.45em}button,.button{display:inline-flex;align-items:center;justify-content:center}nav a,.link{display:inline-flex;align-items:center}.actions{display:flex;flex-wrap:wrap;gap:12px}.badge{display:inline-block;background:#dce9f5;color:#174f77;border-radius:12px;padding:0 7px;margin-left:5px;font-size:.8rem}.filter-grid{display:flex;flex-wrap:wrap;align-items:end;gap:18px}.filter-grid label{flex:1;min-width:200px}.filter-grid button{flex:none}.status{display:inline-block;font-size:.85rem;font-weight:650;border-radius:6px;padding:4px 8px;background:#e7eef4;color:#314a60}.status-new{background:#fff0d5;color:#7b4c05}.status-accepted,.status-repairing{background:#dfedff;color:#205388}.status-waiting_parts{background:#fae5d6;color:#814420}.status-resolved{background:#ede7ff;color:#594194}.status-closed{background:#dff4e7;color:#246340}.danger{color:#a42626}.issue-group{border:1px solid var(--border);border-radius:8px;margin:10px 0;padding:14px}.issue-group summary{font-weight:650;cursor:pointer}.issue-options{display:grid;grid-template-columns:1fr 1fr;gap:12px 20px;margin-top:14px}.issue-option{align-items:start;padding:7px;border-radius:6px}.issue-option input{margin-top:4px}.issue-option:has(input:checked){background:#e6f1fa}.muted{color:#6b8092;font-weight:400}textarea{display:block;resize:vertical;width:100%;margin-top:7px;border:1px solid #8ba2b5;border-radius:7px;padding:11px 12px;font:inherit;background:white}textarea:focus{outline:3px solid #55b2eb;outline-offset:3px}.preserve-lines{white-space:pre-wrap;overflow-wrap:anywhere}.section-gap{margin-top:28px}.pagination{display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin:20px 0}.notification.unread{border-left:5px solid #1976ad}.notification form{margin-top:12px}.table-wrap input[type=checkbox]{width:19px;height:19px;accent-color:var(--primary)}[hidden]{display:none!important}
@media(max-width:650px){.issue-options{grid-template-columns:1fr}.filter-grid{flex-direction:column;align-items:stretch}.filter-grid label{min-width:0}.table-wrap .button{padding:8px;font-size:.85rem}.actions .button{width:100%}}

.room-map{border:1px solid #d4e0e9;border-radius:16px;padding:22px;background:linear-gradient(180deg,#f0f7fc,#fff);margin:16px 0}.room-front{max-width:520px;margin:auto;padding:10px;background:#176b89;color:white;border-radius:5px 5px 14px 14px;text-align:center;font-size:.85rem;letter-spacing:.06em;font-weight:700}.teacher-desk{margin:16px auto;color:#35617a;background:#e1eef5;border:1px solid #a9c9da;border-radius:8px;padding:8px 20px;width:max-content;font-size:.85rem}.map-legend{display:flex;justify-content:center;flex-wrap:wrap;gap:8px 18px;margin:20px 0;font-size:.8rem}.map-legend span{display:flex;align-items:center;gap:6px}.map-dot{display:inline-block;width:12px;height:12px;border-radius:4px;background:var(--tile-line)}.map-unknown{--tile-bg:#f1f5f9;--tile-line:#a8b8c7;--tile-fg:#526679}.map-good{--tile-bg:#e7f7ee;--tile-line:#39a36c;--tile-fg:#216447}.map-limited{--tile-bg:#fff5dc;--tile-line:#dfaa32;--tile-fg:#895d0e}.map-broken{--tile-bg:#ffebe7;--tile-line:#e66b58;--tile-fg:#a13626}.map-pending{--tile-bg:#e6f1ff;--tile-line:#458acb;--tile-fg:#205388}.map-inactive{--tile-bg:#e9ecef;--tile-line:#b7bfc6;--tile-fg:#8b939b}.map-scroll{overflow:auto;padding:5px}.machine-rows{min-width:790px}.machine-row{display:grid;grid-template-columns:42px repeat(4,minmax(65px,1fr)) 34px repeat(4,minmax(65px,1fr));gap:9px;align-items:center;margin:10px 0}.row-number{font-size:.7rem;color:#667d8f;font-weight:600}.map-aisle{text-align:center;font-size:.65rem;align-self:stretch;border-left:1px dashed #cbd8e2;border-right:1px dashed #cbd8e2;padding-top:5px;color:#78909f}.machine-tile{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;border:2px solid var(--tile-line);border-radius:10px;padding:8px 3px;min-height:92px;background:var(--tile-bg);color:var(--tile-fg);text-decoration:none;cursor:pointer;transition:box-shadow .15s,transform .15s;font-weight:500;box-shadow:0 4px 0 #bacbd329}.machine-tile>.icon{width:27px;height:24px;margin:0}.machine-tile strong{font-size:.9rem;line-height:1.3}.machine-tile small{font-size:.64rem;line-height:1.3;margin:0;color:inherit;text-align:center}.machine-tile input[type=radio]{position:absolute;opacity:0;width:1px;height:1px;min-height:0;margin:0;padding:0}.machine-tile:hover{box-shadow:0 3px 12px #12345624;transform:translateY(-2px)}.machine-tile.is-selected,.machine-tile:has(input:checked){border-color:#176ab0;box-shadow:0 0 0 3px #3b98e93b}.machine-tile:focus-within{outline:3px solid #3297dc;outline-offset:3px}.tile-tick{display:none;position:absolute;right:2px;top:2px;color:#1269ac}.tile-tick .icon{width:16px;height:16px;margin:0}.is-selected .tile-tick,.machine-tile:has(input:checked) .tile-tick{display:block}.machine-tile:has(input:disabled){opacity:.6;cursor:not-allowed}.map-caption{text-align:center;font-size:.77rem;color:#667b8b;margin:18px 0 0}.machine-empty{min-height:92px;border:1px dashed #e2eaf0;border-radius:10px}.step-number{display:inline-flex;width:28px;height:28px;border-radius:50%;align-items:center;justify-content:center;background:#176b89;color:#fff;font-size:.85rem;margin-right:6px}.device-picker{display:grid;grid-template-columns:repeat(6,1fr);gap:10px;margin:16px 0}.device-card{display:flex;align-items:center;justify-content:center;flex-direction:column;text-align:center;gap:7px;padding:15px 8px;border:1px solid #c7d7e3;border-radius:10px;text-decoration:none;background:#f7fafc;font-weight:600;font-size:.85rem;color:#45637b}.device-card>.icon{width:28px;height:28px;margin:0}.device-card:hover,.device-card.selected{background:#e5f2fc;color:#125889;border-color:#3c91c9}.device-card.selected{box-shadow:0 0 0 2px #3297dc22}.more-devices>summary,.inventory-panel>summary,.machine-table>summary{cursor:pointer;color:#245c80;font-weight:600}.inventory-panel{margin:20px 0}.machine-table{margin:24px 0}.machine-table .table-wrap{margin-top:12px}.simple-issues{margin:20px 0}.machine-selection{padding:10px 14px;background:#eaf3fa;border-radius:8px;color:#285e84}.toast-region{position:fixed;right:22px;bottom:22px;z-index:1000;display:flex;flex-direction:column;gap:12px;width:min(380px,calc(100vw - 32px));pointer-events:none}.toast{--toast-color:#176aad;position:relative;border-radius:12px;border:1px solid #d1deea;border-left:7px solid var(--toast-color);background:#fff;box-shadow:0 8px 32px #1236532e;padding:16px 40px 16px 18px;pointer-events:auto;animation:toast-enter .25s ease-out}.toast-warning{--toast-color:#df841d;background:#fff8e9}.toast-pending{--toast-color:#8555c4;background:#f5efff}.toast-success{--toast-color:#249a67;background:#eaf9f0}.toast-kicker{font-size:.72rem;text-transform:uppercase;letter-spacing:.04em;font-weight:750;color:var(--toast-color)}.toast h2{font-size:1rem;line-height:1.4;margin:5px 0}.toast p{font-size:.84rem;margin:5px 0 10px;color:#3a5369}.toast a{font-size:.85rem;font-weight:700;color:var(--toast-color)}.toast-close{position:absolute;right:8px;top:8px;border:0;background:transparent;color:#576c7d;padding:5px;min-width:26px}.toast-close .icon{margin:0;width:18px;height:18px}.toast-close:hover{background:#e6edf3}.report-layout>.card{margin:20px 0}@keyframes toast-enter{from{opacity:0;transform:translateX(24px)}to{opacity:1;transform:translateX(0)}}@media(prefers-reduced-motion:reduce){.toast{animation:none}.machine-tile{transition:none}}
@media(max-width:800px){.device-picker{grid-template-columns:repeat(3,1fr)}.room-map{padding:14px}.map-legend{justify-content:start}.toast-region{right:16px;bottom:16px}}@media(max-width:450px){.device-picker{grid-template-columns:repeat(2,1fr)}.room-front{font-size:.75rem}}

/* Bước 4: màu giao diện, menu thích ứng và tổng quan theo quyền. */
:root{color-scheme:light;--page:#f3f6fa;--surface:#fff;--surface-soft:#edf3f8;--text:#182c40;--muted:#526b80;--input-border:#8ba2b5;--button-bg:#155a88;--button-hover:#0d4267;--header:#133a58;--blue:#287cb3;--red:#ce514d;--amber:#c48622;--purple:#875cbb;--green:#29916c;--gray:#9cabb9;--notice-bg:#e5f2fc;--notice-border:#9fc6e2;--error-bg:#fff0f0;--error-text:#8b2323}
:root[data-theme=dark]{color-scheme:dark;--page:#0b1722;--surface:#142637;--surface-soft:#1c3347;--text:#e0eaf3;--muted:#a0b5c6;--primary:#83c6f0;--border:#30475a;--input-border:#55768e;--button-bg:#246d9a;--button-hover:#3182b3;--header:#0f2233;--blue:#68b9eb;--red:#f3827d;--amber:#efbf63;--purple:#b99af0;--green:#73ceac;--gray:#8097aa;--notice-bg:#173851;--notice-border:#366685;--error-bg:#412329;--error-text:#ffb2b2}
body{background:var(--page);color:var(--text)}header{background:var(--header)}h1{overflow-wrap:anywhere}footer,small,.muted{color:var(--muted)}.card,.table-wrap{background:var(--surface)}th{background:var(--surface-soft)}input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea{background:var(--surface);color:var(--text);border-color:var(--input-border)}button,.button{background:var(--button-bg);border-color:var(--button-bg);color:#fff;min-height:44px;line-height:1.4;max-width:100%;gap:0;vertical-align:middle}button:hover,.button:hover{background:var(--button-hover);color:#fff}.secondary{background:var(--surface);color:var(--primary);border-color:var(--input-border)}.secondary:hover{background:var(--surface-soft);color:var(--primary)}.link,.link:hover{background:transparent;color:var(--primary);border:0}.notice{background:var(--notice-bg);border-color:var(--notice-border)}.error{background:var(--error-bg);color:var(--error-text)}.danger{color:var(--red)}.actions{gap:12px;margin:16px 0;align-items:center}.actions:empty{display:none}.button+.button,button+button{margin-inline-start:10px}.actions>.button+.button,.actions>button+button{margin-inline-start:0}.button-danger{background:#aa353d;border-color:#aa353d}.button-danger:hover{background:#85242b}.account-delete{border-color:var(--red)}.skip-link{position:fixed;top:-100px;left:12px;z-index:2000;background:var(--surface);padding:10px}.skip-link:focus{top:12px}
.header-tools{display:flex;align-items:center;gap:20px}.theme-toggle{background:#ffffff0e;border:1px solid #ffffff45;font-size:.8rem;min-height:38px;padding:7px 11px;color:#e8f2f8}.theme-toggle:hover{background:#ffffff22}.school-name{font-size:.9rem}.site-nav{display:block;padding-bottom:16px}.nav-heading{display:flex;align-items:center;gap:12px;margin-bottom:12px;flex-wrap:wrap}.nav-account{display:inline-flex;align-items:center;color:var(--muted);font-size:.85rem;overflow-wrap:anywhere}.site-nav .notification-link{margin-left:auto;background:#fff1d1;color:#80500a;border:1px solid #eac275;border-radius:9px;padding:9px 13px;min-height:44px;gap:0}.notification-link .badge{background:#ffe1a0;color:#71460a;font-weight:750;min-width:24px;text-align:center}.site-nav .notification-link.has-unread{background:#fff0bf;border-color:#d69a29;box-shadow:0 0 0 3px #eaa12a18}.notification-link.has-unread>.icon{color:#b4770c}.nav-toggle{display:none}.nav-links{display:flex;flex-wrap:wrap;gap:6px;align-items:center}.nav-links>a,.nav-links .link{border-radius:7px;padding:9px 10px;font-size:.85rem;min-height:42px}.nav-links>a:hover,.nav-links .link:hover{background:var(--surface-soft)}.nav-links>a[aria-current=page]{background:var(--surface-soft);box-shadow:inset 0 -3px var(--blue)}.nav-links form{margin-left:auto}.nav-links .icon{width:17px;height:17px}
.dashboard-welcome{display:flex;justify-content:space-between;gap:20px;align-items:center;margin:8px 0 18px}.dashboard-welcome h2{font-size:1.5rem;margin:7px 0}.dashboard-welcome p{color:var(--muted);margin:0}.eyebrow{display:inline-flex;align-items:center;font-size:.75rem;text-transform:uppercase;letter-spacing:.06em;font-weight:700;color:var(--primary)}.dashboard-date{display:flex;align-items:center;gap:9px;color:var(--muted);font-size:.75rem;white-space:nowrap}.dashboard-date>.icon{width:30px;height:30px}.dashboard-date strong{display:block;color:var(--text);font-size:.85rem}.dashboard-actions{margin:20px 0 24px}.metric-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.metric{--metric-color:var(--blue);display:flex;flex-direction:column;gap:8px;padding:20px;background:var(--surface);border:1px solid var(--border);border-top:4px solid var(--metric-color);border-radius:12px;text-decoration:none;color:var(--text);box-shadow:0 4px 12px #12345604}.metric-red{--metric-color:var(--red)}.metric-amber{--metric-color:var(--amber)}.metric-purple{--metric-color:var(--purple)}a.metric:hover{border-color:var(--metric-color);box-shadow:0 4px 16px #12345613}.metric-top{display:flex;align-items:center;justify-content:space-between;gap:9px;font-weight:600;font-size:.85rem}.metric-icon{display:inline-flex;align-items:center;justify-content:center;background:var(--surface-soft);color:var(--metric-color);width:36px;height:36px;border-radius:9px}.metric-icon .icon{margin:0;width:21px;height:21px}.metric-value{font-size:2.4rem;line-height:1.15;letter-spacing:-.03em;color:var(--metric-color)}.metric-note{color:var(--muted);font-size:.75rem}.dashboard-panels{display:grid;grid-template-columns:1.05fr 1fr;gap:18px;margin:22px 0}.dashboard-panels .card{margin:0;min-width:0}.section-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.section-heading h2,.section-heading h3{margin:0}.section-heading>.icon{color:var(--primary);width:24px;height:24px}.distribution-body{display:grid;grid-template-columns:minmax(145px,200px) 1fr;gap:10px;align-items:center;margin:16px 0}.chart-ring svg{display:block;width:100%;height:auto}.ring-track{stroke:var(--surface-soft)}.ring-number{fill:var(--text);font-weight:750;font-size:29px}.ring-label{fill:var(--muted);font-size:9px}.ring-broken{--chart-color:var(--red)}.ring-repairing{--chart-color:var(--blue)}.ring-waiting{--chart-color:var(--amber)}.ring-pending{--chart-color:var(--blue)}.ring-good{--chart-color:var(--green)}.ring-unknown{--chart-color:var(--gray)}.ring-segment{stroke:var(--chart-color)}.chart-legend{list-style:none;padding:0;margin:0}.chart-legend li{display:flex;align-items:center;gap:8px;font-size:.8rem;padding:4px 0;margin:0}.chart-legend strong{margin-left:auto}.chart-dot{width:9px;height:9px;border-radius:3px;background:var(--chart-color);flex:none}.task-list{display:flex;flex-direction:column;gap:10px;margin:16px 0}.task-list>a{display:flex;align-items:center;gap:12px;background:var(--surface-soft);border-radius:9px;padding:12px;text-decoration:none}.task-list>a:hover{outline:1px solid var(--blue)}.task-list .icon{width:22px;height:22px;margin:0}.task-list strong{font-size:.85rem;color:var(--text)}.task-list small{margin:3px 0 0;font-size:.75rem}.room-section-heading{margin:30px 0 18px}.room-summary{min-width:0}.room-summary h3{font-size:1rem}.room-total{font-size:.75rem;color:var(--primary);background:var(--surface-soft);padding:4px 9px;border-radius:20px;white-space:nowrap}.room-location{font-size:.8rem;color:var(--muted);margin:8px 0 18px}.room-numbers{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:16px 0 20px;font-size:.75rem;color:var(--muted)}.room-numbers strong{display:block;font-size:1.6rem;color:var(--red);line-height:1.3}.room-numbers span+span strong{color:var(--purple)}.room-summary .button{width:100%;font-size:.85rem}.admin-counts{display:flex;gap:26px;flex-wrap:wrap;margin:20px 0;font-size:.85rem;color:var(--muted)}.admin-counts strong{display:block;font-size:1.7rem;color:var(--text)}.access-summary summary{font-size:.85rem;font-weight:650;cursor:pointer}.access-summary li{font-size:.85rem}.account-bootstrap{border-left:5px solid var(--blue)}
:root[data-theme=dark] .site-nav .notification-link{background:#463519;color:#f4d08a;border-color:#8c6b30}:root[data-theme=dark] .notification-link .badge{background:#b97a1b;color:#fff}:root[data-theme=dark] .site-nav .notification-link.has-unread{background:#4b3718}:root[data-theme=dark] .notification-link.has-unread>.icon{color:#f4c46b}
:root[data-theme=dark] .status{background:#2c4357;color:#d2e2ee}:root[data-theme=dark] .status-new{background:#4b381b;color:#f5ca76}:root[data-theme=dark] .status-accepted,:root[data-theme=dark] .status-repairing{background:#173f65;color:#9dcbf8}:root[data-theme=dark] .status-waiting_parts{background:#50301f;color:#f4b38b}:root[data-theme=dark] .status-resolved{background:#392950;color:#cbb1f4}:root[data-theme=dark] .status-closed{background:#193e30;color:#92dbb5}
:root[data-theme=dark] .room-map{background:linear-gradient(180deg,#122e40,#142637);border-color:var(--border)}:root[data-theme=dark] .teacher-desk{background:#1f4052;color:#b0d2e7;border-color:#40697f}:root[data-theme=dark] .map-good{--tile-bg:#173d30;--tile-line:#469974;--tile-fg:#a4ddbc}:root[data-theme=dark] .map-unknown{--tile-bg:#233748;--tile-line:#617b91;--tile-fg:#b6c9d8}:root[data-theme=dark] .map-limited{--tile-bg:#44381e;--tile-line:#bca049;--tile-fg:#e9cb87}:root[data-theme=dark] .map-broken{--tile-bg:#4b2a2a;--tile-line:#c96a60;--tile-fg:#f2b1a8}:root[data-theme=dark] .map-pending{--tile-bg:#1d3652;--tile-line:#4c90c9;--tile-fg:#b5d8fa}:root[data-theme=dark] .map-inactive{--tile-bg:#28323a;--tile-line:#58656f;--tile-fg:#99a6b0}:root[data-theme=dark] .machine-empty{border-color:var(--border)}:root[data-theme=dark] .machine-tile.is-selected,:root[data-theme=dark] .machine-tile:has(input:checked){border-color:#79c8ff;box-shadow:0 0 0 3px #3b98e94a}:root[data-theme=dark] .tile-tick{color:#96d7ff}:root[data-theme=dark] .map-caption,:root[data-theme=dark] .row-number,:root[data-theme=dark] .map-aisle{color:var(--muted)}:root[data-theme=dark] .map-aisle{border-color:var(--border)}:root[data-theme=dark] .device-card{background:var(--surface-soft);border-color:var(--border);color:#b6cddd}:root[data-theme=dark] .device-card.selected,:root[data-theme=dark] .device-card:hover{background:#204a65;color:#afdefb;border-color:#4f98c9}:root[data-theme=dark] .machine-selection,:root[data-theme=dark] .issue-option:has(input:checked){background:#1e415b;color:#b8d8ed}:root[data-theme=dark] .more-devices>summary,:root[data-theme=dark] .inventory-panel>summary,:root[data-theme=dark] .machine-table>summary{color:var(--primary)}
:root[data-theme=dark] .toast{background:#183448;color:var(--text);border-color:var(--border);--toast-color:#7bc6f5}:root[data-theme=dark] .toast-warning{background:#3e311e;--toast-color:#f6c26a}:root[data-theme=dark] .toast-pending{background:#322947;--toast-color:#cbb1f4}:root[data-theme=dark] .toast-success{background:#1b3a30;--toast-color:#83d4b0}:root[data-theme=dark] .toast p,:root[data-theme=dark] .toast-close{color:#c4d2dd}.toast-close{min-height:30px;background:transparent;border:0}.toast-close:hover{background:var(--surface-soft);color:var(--text)}
@media(max-width:1000px){.metric-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.nav-links form{margin-left:0}.distribution-body{grid-template-columns:145px 1fr}.metric{padding:16px}.header-tools{gap:12px}}
@media(max-width:760px){header{padding:16px;gap:12px}.header-tools{width:100%;justify-content:space-between}.school-name{font-size:.75rem}.brand{font-size:1.15rem}.nav-heading{margin-bottom:8px;gap:8px}.nav-toggle{display:inline-flex}.nav-account{display:none}.site-nav .notification-link{font-size:.85rem;padding:9px 10px}.nav-links{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:10px 0 0}.nav-links>a,.nav-links .link{background:var(--surface);border:1px solid var(--border);padding:11px 9px;line-height:1.4;min-height:48px;overflow-wrap:anywhere}.nav-links form{margin:0}.nav-links .link{width:100%;height:100%;justify-content:flex-start;text-align:left}.has-nav-js .site-nav:not(.is-open) .nav-links{display:none}.dashboard-welcome{align-items:start}.dashboard-welcome h2{font-size:1.2rem}.dashboard-welcome p{font-size:.85rem}.dashboard-date{display:none}.dashboard-panels{grid-template-columns:1fr}.distribution-body{grid-template-columns:170px 1fr}.dashboard-actions .button{font-size:.85rem}.room-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.room-summary .section-heading{align-items:start;flex-direction:column;gap:5px}.room-summary .room-total{padding:2px 7px}.room-numbers{gap:10px}}
@media(max-width:520px){.metric-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.metric{padding:13px;gap:8px}.metric-top{align-items:start;font-size:.78rem;min-height:38px}.metric-icon{width:29px;height:29px}.metric-icon .icon{width:18px;height:18px}.metric-value{font-size:2rem}.metric-note{font-size:.7rem;line-height:1.5}.distribution-body{grid-template-columns:minmax(100px,145px) 1fr;gap:10px}.chart-legend li{font-size:.72rem}.room-summary-grid{grid-template-columns:1fr}.room-summary .section-heading{flex-direction:row;align-items:center}.dashboard-actions .button{width:100%}.dashboard-actions{gap:10px}.room-section-heading h2{font-size:1.05rem}.room-section-heading>.muted{white-space:nowrap;font-size:.8rem}.button+.button,button+button{margin-inline-start:0}.actions{align-items:stretch}.actions>.button,.actions>button{width:100%}.theme-toggle{font-size:.72rem}.form-grid>*{min-width:0}.toolbar label{min-width:0}.toast-region{bottom:16px;right:16px}}

.theme-icon-light{display:none}:root[data-theme=dark] .theme-icon-dark{display:none}:root[data-theme=dark] .theme-icon-light{display:inline-flex}.theme-icon-dark{display:inline-flex}
html{background:var(--page);color:var(--text)}
.report-tabs{display:flex;gap:12px;flex-wrap:wrap;margin:20px 0}.report-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.report-stats .card{margin:0;padding:18px}.report-stats strong{display:block;font-size:2rem;color:var(--primary)}.report-ready{border-left:5px solid var(--green)}.report-preview{margin-top:16px}.report-preview td{min-width:110px}.report-preview p{margin:6px 0 12px}.report-preview td:nth-child(3),.report-preview td:nth-child(5){min-width:230px}.report-preview td:first-child{min-width:45px}details>summary{cursor:pointer}
@media(max-width:520px){.report-tabs>.button{width:100%}.report-stats{grid-template-columns:1fr;gap:10px}.report-stats .card{display:flex;align-items:center;justify-content:space-between;gap:14px}.report-stats strong{font-size:1.8rem}}

.report-confirmation{width:min(580px,calc(100% - 32px));max-height:calc(100dvh - 40px);margin:auto;padding:26px;border:1px solid var(--border);border-radius:20px;background:var(--surface);color:var(--text);box-shadow:0 24px 90px #0005;overflow:auto}.report-confirmation::backdrop{background:#071e35a8;backdrop-filter:blur(3px)}.confirmation-heading{display:flex;gap:14px;align-items:center;margin-bottom:20px}.confirmation-heading h2{margin:0;font-size:1.25rem}.confirmation-heading p{margin:5px 0 0;color:var(--muted)}.confirmation-symbol{display:flex;padding:13px;border-radius:14px;background:var(--surface-soft);color:var(--amber)}.confirmation-symbol .icon{width:28px;height:28px}.confirmation-info{margin:0;border:1px solid var(--border);border-radius:14px;overflow:hidden}.confirmation-info>div{display:grid;grid-template-columns:minmax(150px,1fr) 1.2fr;gap:16px;padding:12px 16px;border-bottom:1px solid var(--border)}.confirmation-info>div:last-child{border:0}.confirmation-info>div:first-child{background:var(--notice-bg)}.confirmation-info dt{color:var(--muted);font-size:.9rem}.confirmation-info dd{margin:0;font-weight:700;overflow-wrap:anywhere}.confirmation-issues h3{font-size:1rem;margin:20px 0 8px}.confirmation-issues ul{margin:0;padding-left:22px}.confirmation-issues li{margin:6px 0}.confirmation-actions{margin-top:24px;justify-content:flex-end;gap:12px}.confirmation-actions button+button{margin-inline-start:0}
@media(max-width:520px){.report-confirmation{padding:20px;max-height:calc(100dvh - 24px)}.confirmation-heading{gap:10px}.confirmation-heading h2{font-size:1.08rem}.confirmation-heading p{font-size:.82rem}.confirmation-info>div{grid-template-columns:1fr;gap:4px;padding:10px 14px}.confirmation-actions{flex-direction:column-reverse}}

/* Quản lý học sinh: danh sách và sơ đồ luôn cuộn trong khung của mình. */
.student-hero{display:flex;justify-content:space-between;align-items:center;gap:24px;padding:26px 30px;border:1px solid var(--border);border-radius:18px;background:linear-gradient(115deg,var(--notice-bg),var(--surface));margin:20px 0}.student-hero h2{margin:6px 0;font-size:1.6rem}.student-hero p{margin:8px 0}.student-hero-icon{display:grid;place-items:center;background:#176b89;color:#fff;border-radius:20px;min-width:80px;height:80px}.student-hero-icon .icon{width:44px;height:44px;margin:0}.student-filters{grid-template-columns:repeat(3,minmax(0,1fr));align-items:end}.student-filters>.actions{grid-column:1/-1}.student-metrics{grid-template-columns:repeat(3,minmax(0,1fr));margin:20px 0}.student-metrics .metric{display:flex;flex-direction:column;gap:10px}.student-setup{margin:18px 0}.student-setup>summary{cursor:pointer;font-weight:700;color:var(--blue,#155a88)}.student-workspace{display:grid;grid-template-columns:260px minmax(0,1fr);gap:24px;margin:28px 0;align-items:start}.student-workspace>*{min-width:0}.student-roster{margin:0;padding:18px}.student-roster h2{font-size:1.15rem;margin:0 0 14px}.student-roster-list{display:flex;flex-direction:column;gap:8px;max-height:580px;overflow:auto;padding:2px}.roster-student{display:flex;flex-direction:column;flex:none;align-items:stretch;justify-content:flex-start;gap:5px;text-align:left;border:1px solid var(--border);border-radius:10px;padding:11px 12px;background:var(--surface-soft);color:var(--text);max-width:100%;min-width:0;cursor:grab;touch-action:pan-y}.roster-student[hidden]{display:none}.roster-name{font-size:.86rem;font-weight:650;overflow-wrap:anywhere}.roster-meta{font-size:.71rem;font-weight:400;color:var(--muted)}.roster-student:hover,.roster-student.is-selected{color:var(--text);border-color:#3297dc;background:var(--notice-bg);box-shadow:0 0 0 2px #3297dc22}.roster-student:disabled{cursor:default;opacity:1}.student-unassign{margin-top:16px;padding:16px 10px;border:2px dashed var(--border);border-radius:10px;font-size:.8rem;color:var(--muted);text-align:center}.student-map-column>.room-map{margin-top:10px}.student-map-column>h2{font-size:1.2rem;margin:0 0 12px}.student-room-map{padding:16px}.student-room-map .machine-rows{min-width:790px}.student-room-map .machine-tile{min-width:0;min-height:172px;justify-content:flex-start;padding:7px 4px;gap:4px}.student-machine-target{display:flex;flex-direction:column;align-items:center;gap:3px;color:inherit;background:transparent;border:0;border-radius:6px;padding:3px 1px;width:100%;min-width:0;box-shadow:none}.student-machine-target>.icon{width:25px;height:25px;margin:0}.student-machine-target:hover{background:#ffffff33;color:inherit}.student-machine-target:disabled{color:inherit;opacity:.7;cursor:default}.student-machine-target strong{font-size:.8rem}.student-machine-target small{font-size:.59rem}.machine-students{display:flex;flex-direction:column;gap:4px;width:100%;min-width:0;min-height:86px}.seat-student{display:block;max-width:100%;width:100%;min-width:0;padding:4px 3px;border:1px solid #ffffff70;border-radius:5px;color:inherit;background:#ffffff9e;text-align:center;cursor:grab;font-size:.67rem;font-weight:600;line-height:1.2;min-height:26px}.seat-student.is-long{font-size:.56rem}.seat-student .seat-name{display:block;white-space:normal;overflow-wrap:anywhere;max-width:100%;min-width:0}.seat-student:hover,.seat-student.is-selected{background:var(--notice-bg);color:var(--text);border-color:#3297dc}.seat-student:disabled{opacity:1;cursor:default}.seat-capacity{align-self:flex-end;font-size:.6rem;opacity:.85;margin-top:auto}.student-machine.is-drop-target,.student-unassign.is-drop-target{outline:3px solid #3297dc;outline-offset:2px;background:var(--notice-bg)}.student-workspace.is-saving [data-drag-student]{cursor:wait}.student-status{border-left:4px solid #176b89;padding:10px 14px;background:var(--notice-bg);font-size:.85rem;min-height:44px;border-radius:5px;color:var(--text);overflow-wrap:anywhere}.student-status.is-error{border-color:#c23c3c;background:var(--error-bg);color:var(--error-text)}.student-year-end{display:flex;justify-content:space-between;align-items:center;gap:20px;margin:24px 0}.student-year-end h2{font-size:1.2rem}.student-year-end p{margin:4px 0}.year-close-form h2{font-size:1.35rem;line-height:1.4}.year-close-warning{background:var(--notice-bg);border:1px solid var(--border);border-radius:10px;padding:4px 16px;font-size:.9rem;margin:16px 0}.year-close-warning li{margin:8px 0}.year-close-form .check{align-items:flex-start;margin:18px 0}.year-close-form .actions{margin-top:18px}.end-year-dialog{max-width:620px}.student-log td{vertical-align:top;font-size:.85rem;overflow-wrap:anywhere}.student-log th:first-child{width:150px}.audit-table td{vertical-align:top;overflow-wrap:anywhere}.audit-table .nowrap{white-space:nowrap;font-size:.8rem}.audit-action{display:inline-block;padding:5px 9px;border-radius:7px;background:var(--notice-bg);font-size:.8rem;font-weight:650}.import-preview{border-top:4px solid #176b89}.import-preview>.actions{margin-top:16px}.student-room-map .map-scroll{max-width:100%}:root[data-theme=dark] .seat-student{background:#ffffff12;border-color:#ffffff24}:root[data-theme=dark] .seat-student:hover,:root[data-theme=dark] .seat-student.is-selected{background:var(--notice-bg)}
@media(max-width:1050px){.student-workspace{grid-template-columns:1fr}.student-roster-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));max-height:230px}.student-unassign{max-width:360px}.student-filters{grid-template-columns:repeat(3,minmax(0,1fr))}}@media(max-width:600px){.student-hero{padding:20px;gap:12px}.student-hero h2{font-size:1.25rem}.student-hero-icon{min-width:48px;height:48px;border-radius:12px}.student-hero-icon .icon{width:28px;height:28px}.student-filters{grid-template-columns:1fr}.student-roster-list{grid-template-columns:repeat(2,minmax(0,1fr))}.student-metrics{grid-template-columns:1fr}.student-year-end{flex-direction:column;align-items:stretch}.student-year-end>button{width:100%}.student-room-map{padding:10px}.end-year-dialog .actions{flex-direction:column}.end-year-dialog .actions>button{width:100%}}

.roster-student+ .roster-student,.seat-student+ .seat-student{margin-inline-start:0}.roster-meta{overflow-wrap:anywhere}

.student-room-map .machine-row{align-items:stretch}.student-room-map .row-number{align-self:center}

.year-close-form button.danger,.student-year-end>button.danger{background:#b42332;border-color:#b42332;color:#fff}.year-close-form button.danger:hover,.student-year-end>button.danger:hover{background:#94182a;color:#fff}

/* Bước 8: menu cố định, tên đầy đủ và điều khiển phân trang. */
:root{--menu-height:140px}html{scroll-padding-top:calc(var(--menu-height) + 16px)}
.sticky-menu{position:sticky;top:0;z-index:100;background:var(--page);border-bottom:1px solid var(--border);box-shadow:0 4px 18px #152c4010}
.menu-inner{width:100%;max-width:1200px;margin-inline:auto;padding-inline:24px}
.sticky-menu .site-nav{width:100%;margin:0;padding:10px 0;border:0}
.sticky-menu .nav-links{justify-content:center}.sticky-menu .nav-links form{margin:0}
.pagination{border:0;padding:0;gap:7px}.pagination .page-number{min-width:36px;min-height:36px;padding:6px 10px;font-size:.8rem;margin:0}
.pagination [aria-current=page]{background:var(--primary);color:#fff;border-color:var(--primary)}
.roster-pagination{gap:5px;margin:12px 0 0}.roster-pagination>span{width:100%;font-size:.75rem;color:var(--muted)}
.roster-name{line-height:1.4}.student-roster>p{font-size:.8rem;line-height:1.5}
.student-room-map .machine-rows{min-width:790px}.student-room-map .machine-row{grid-template-columns:40px repeat(4,minmax(76px,1fr)) 26px repeat(4,minmax(76px,1fr));gap:8px}
.student-room-map .machine-tile{padding:8px 5px;min-height:180px}.seat-student{font-size:.7rem;line-height:1.35;padding:5px 4px;min-height:30px}
.seat-student.is-long{font-size:.64rem}.seat-name{hyphens:none}.machine-students{min-height:90px}.student-machine{cursor:default}
.report-receipt .confirmation-symbol{color:var(--green)}.report-receipt h2{color:var(--text)}

@media(max-width:760px){.menu-inner{padding-inline:16px}.sticky-menu .site-nav{padding:8px 0}.sticky-menu .nav-heading{margin-bottom:0}.sticky-menu .nav-links{max-height:55dvh;overflow:auto;padding-bottom:8px}.student-room-map .machine-rows{min-width:790px}.pagination .page-number{min-height:40px}.student-room-map .seat-student{font-size:.68rem}.student-room-map .seat-student.is-long{font-size:.62rem}}

/* Cấu hình tài khoản, menu cùng khung nội dung, xếp chỗ tức thời. */
.sticky-menu{position:static;width:100%;max-width:none}
.menu-spacer{display:none}
:root[data-menu-fixed="1"] .sticky-menu{position:sticky;top:0}
:root.has-menu-js[data-menu-fixed="1"] .sticky-menu{position:fixed;inset-inline:0;top:var(--menu-top,0px);width:var(--menu-width,100%)}
:root.has-menu-js[data-menu-fixed="1"] .menu-spacer{display:block;height:var(--menu-height)}
:root[data-menu-fixed="0"]{scroll-padding-top:16px}
.roster-student[data-placed="1"],.roster-student.is-pending{display:none!important}
.preferences-form{max-width:850px}
.theme-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
.theme-choice{position:relative;display:grid;gap:8px;padding:20px;border:2px solid var(--border);border-radius:12px;cursor:pointer;font-weight:400}
.theme-choice:has(input:checked){border-color:var(--blue);background:var(--surface-soft);box-shadow:0 0 0 3px #3297dc20}
.theme-choice input[type=radio]{position:absolute;top:15px;right:15px;width:18px;height:18px;min-height:0;margin:0;padding:0;border:0;accent-color:var(--primary)}
.theme-choice .muted{font-size:.85rem}
.theme-sample{display:flex;flex-direction:column;align-items:flex-start;gap:7px;padding:18px;border-radius:8px;min-height:100px}
.theme-sample-light{background:#f8fbff;color:#155a88;border:1px solid #d9e2ec}
.theme-sample-dark{background:#132739;color:#a7d5f6;border:1px solid #486279}
.theme-sample>.icon{margin:0;width:24px;height:24px}
.sample-line{height:6px;background:currentColor;opacity:.35;border-radius:4px;width:75%}.sample-line.short{width:48%}
.menu-choice{align-items:flex-start;margin-top:16px}.menu-choice input{margin-top:5px}.menu-choice small{max-width:600px}
@media(max-width:760px){.sticky-menu .site-nav{padding:8px 0}.theme-options{gap:12px}.theme-choice{padding:14px}.theme-choice input[type=radio]{top:10px;right:10px}}
@media(max-width:450px){.theme-options{grid-template-columns:1fr}.theme-sample{min-height:80px}.theme-choice{grid-template-columns:96px 1fr;column-gap:16px}.theme-sample{grid-row:1/3}.theme-choice>strong{align-self:end}.theme-choice .muted{align-self:start}.theme-choice input[type=radio]{right:8px}}
.student-drag-preview{position:fixed;z-index:1100;pointer-events:none;max-width:240px;padding:10px 14px;border:1px solid #83c6f0;border-radius:9px;background:#155a88;color:#fff;font-size:.85rem;font-weight:600;box-shadow:0 5px 18px #102b4940;overflow-wrap:anywhere}

/* Tiêu đề, biểu mẫu và hướng dẫn cùng nằm trong khối đăng nhập canh giữa. */
:root{background:var(--page)}
.login-page{width:100%;max-width:520px;margin-inline:auto}
.login-page .card{width:100%;max-width:none}

/* Thanh tài khoản và menu dùng chung một khung cố định. */
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.site-header{padding:0;display:block;background:var(--header,#133a58)}
.header-inner{max-width:1200px;margin-inline:auto;padding:16px 24px;display:flex;align-items:center;justify-content:space-between;gap:20px}
.site-header .brand{display:flex;align-items:center;gap:12px;font-size:1.25rem;line-height:1.3;min-width:0}
.brand-symbol{display:grid;place-items:center;width:44px;height:44px;flex:none;background:linear-gradient(145deg,#39a1f4,#176fc2);border-radius:10px;box-shadow:inset 0 1px 0 #ffffff40}
.brand-symbol .icon{width:28px;height:28px;margin:0}.brand small{margin-top:4px;color:#b8d6eb;font-size:.78rem;font-weight:400}
.site-header .header-tools{display:flex;align-items:center;gap:14px;flex:none;width:auto;justify-content:flex-end}
.site-header .notification-link{position:relative;display:grid;place-items:center;padding:8px;width:44px;height:44px;margin:0;border:0;border-radius:10px;background:#ffffff0c;color:#d8edfd;text-decoration:none}
.site-header .notification-link>.icon{width:27px;height:27px;margin:0}
.site-header .notification-link.has-unread{background:#ffffff10;color:#fff}
.site-header .notification-link .badge{position:absolute;right:-5px;top:-4px;margin:0;background:#fa665a;color:#fff;min-width:21px;text-align:center;line-height:21px;font-size:.7rem;padding:0 5px;border:2px solid var(--header,#133a58)}
.site-header .notification-link:not(.has-unread) .badge{background:#36596f;color:#d3e3ed}
.account-menu{position:relative;color:#e1edf6}.account-menu>summary{display:flex;align-items:center;gap:9px;list-style:none;cursor:pointer;padding:5px 8px;border-radius:9px;font-weight:650;max-width:280px}.account-menu>summary::-webkit-details-marker{display:none}.account-menu>summary:hover,.account-menu[open]>summary{background:#ffffff10}.account-menu>summary:focus-visible{outline:3px solid #55b2eb;outline-offset:3px}
.account-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.account-menu>summary>.icon{width:16px;height:16px;margin:0}.account-avatar{display:grid;place-items:center;width:36px;height:36px;flex:none;background:#ffffff18;border:1px solid #ffffff20;border-radius:50%}.account-avatar .icon{width:23px;height:23px;margin:0}
.account-panel{position:absolute;right:0;top:calc(100% + 10px);z-index:120;width:270px;max-width:calc(100vw - 32px);border:1px solid var(--border);border-radius:12px;background:var(--surface,#fff);color:var(--text);padding:8px;box-shadow:0 12px 40px #07192d40;max-height:70dvh;overflow:auto}
.account-identity{margin:0;padding:10px 12px 12px;font-size:.9rem;border-bottom:1px solid var(--border);overflow-wrap:anywhere}.account-identity small{color:var(--muted);font-size:.76rem;margin:2px 0 0}
.account-panel>a,.account-logout{display:flex;align-items:center;gap:8px;width:100%;padding:11px 12px;border:0;border-radius:7px;text-decoration:none;font-size:.9rem;font-weight:600;color:var(--text);background:transparent;justify-content:flex-start}.account-panel .icon{margin:0}.account-panel>a:hover{background:var(--surface-soft)}.account-panel form{margin:5px 0 0;padding-top:6px;border-top:1px solid var(--border)}.account-logout{color:var(--error-text,#b42332)}.account-panel .account-logout:hover,.account-panel .account-logout:focus-visible{background:var(--error-bg);color:var(--error-text,#b42332)}
/* Bước 18.1: nút Đăng xuất dễ thấy ở theme sáng, dùng chung trong menu tài khoản. */
:root:not([data-theme=dark]) .site-header .account-panel .account-logout{background:#fff0f0;color:#b42332;transition:background-color .15s,color .15s}
:root:not([data-theme=dark]) .site-header .account-panel .account-logout:hover,:root:not([data-theme=dark]) .site-header .account-panel .account-logout:focus-visible{background:#b42332;color:#fff}
.sticky-menu .nav-heading{display:none}.sticky-menu .nav-links{display:flex;flex-wrap:wrap;justify-content:center;gap:4px 8px;width:100%;margin:0}.sticky-menu .nav-links>a{font-size:.84rem;padding:9px 10px;white-space:nowrap}.sticky-menu .site-nav{display:block;padding:8px 0}
:root.has-menu-js[data-menu-fixed="1"] .sticky-menu{top:0}
.profile-card{max-width:760px}.profile-heading{display:flex;align-items:center;gap:18px}.profile-heading p{margin:4px 0;color:var(--muted)}.profile-avatar{display:grid;place-items:center;background:var(--notice-bg);color:var(--primary);width:64px;height:64px;border-radius:50%}.profile-avatar .icon{width:36px;height:36px;margin:0}.profile-details{display:grid;gap:12px;margin:24px 0}.profile-details>div{display:grid;grid-template-columns:170px 1fr;gap:12px;border-bottom:1px solid var(--border);padding-bottom:12px}.profile-details dt{color:var(--muted);font-size:.9rem}.profile-details dd{margin:0;overflow-wrap:anywhere}
.auto-seat-controls{margin:14px 0}.auto-preview{border-top:4px solid #176b89}.auto-preview .actions{margin-top:18px}.auto-preview .table-wrap{max-height:480px}.auto-preview th{position:sticky;top:0;z-index:1}.auto-preview td{font-size:.85rem}.auto-preview small{margin:2px 0 8px}.auto-preview h2{line-height:1.4}.auto-preview form>p{font-size:.9rem}.auto-preview .auto-summary{display:flex;flex-wrap:wrap;gap:10px 24px}.auto-summary strong{font-size:1.1rem}.auto-plan-student{display:block;margin:4px 0}.auto-empty{color:var(--muted)}
@media(max-width:760px){.header-inner{padding:12px 16px;gap:10px}.site-header .brand{font-size:1rem;gap:8px}.brand-symbol{width:36px;height:36px}.brand-symbol .icon{width:23px;height:23px}.brand small{font-size:.67rem}.site-header .header-tools{gap:8px}.account-menu>summary{gap:6px;padding:4px;max-width:140px}.account-name{max-width:80px;font-size:.8rem}.account-avatar{width:30px;height:30px}.site-header .notification-link{width:36px;height:36px}.site-header .notification-link>.icon{width:24px;height:24px}.sticky-menu .nav-heading{display:flex;justify-content:center}.sticky-menu .nav-toggle{padding:6px 12px;font-size:.8rem;min-height:36px}.sticky-menu .nav-links{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;max-height:50dvh;overflow:auto;padding:8px 0}.sticky-menu .nav-links>a{white-space:normal;justify-content:flex-start;min-height:42px}.has-nav-js .sticky-menu .site-nav:not(.is-open) .nav-links{display:none}.profile-details>div{grid-template-columns:1fr;gap:4px}.auto-preview .actions>*{width:100%}}
@media(max-width:420px){.account-name{display:none}.site-header .brand{font-size:.89rem}.brand small{font-size:.6rem}.account-menu>summary{gap:3px}.site-header .header-tools{gap:7px}.header-inner{gap:8px}.brand-symbol{width:32px;height:32px}}

/* Header sau đăng nhập có thêm nút đổi giao diện: các công cụ xuống dòng khi cần. */
@media(max-width:760px){.sticky-menu .header-inner{flex-wrap:wrap}.sticky-menu .header-tools{margin-left:auto}}

/* Bước 16: một bộ tình trạng dùng cho mọi sơ đồ và thống kê. */
.machine-tile small{white-space:normal;overflow-wrap:anywhere;line-height:1.35}.machine-safety{display:block;font-size:.66rem;font-weight:750;line-height:1.25;padding:4px 5px;border-radius:6px;background:var(--error-bg);color:var(--error-text);border:1px solid currentColor;white-space:normal;overflow-wrap:anywhere}.map-safety-note{display:flex;justify-content:center;align-items:center;gap:7px;font-size:.78rem;color:var(--muted);margin:0 0 18px}.ring-limited{stroke:#dda322}.chart-dot.ring-limited{background:#dda322}.confirmation-info dd{white-space:pre-wrap}.student-room-map .machine-safety{font-size:.58rem}.student-room-map .student-machine-target small{line-height:1.35}.room-numbers{flex-wrap:wrap}

.report-tabs{display:flex;flex-wrap:wrap;gap:10px;margin:12px 0 22px}.preserve-lines{white-space:pre-wrap;overflow-wrap:anywhere}.ring-limited{--chart-color:var(--amber)}.room-numbers span:nth-child(3) strong{color:var(--blue)}

.usability{display:inline-block;padding:.18rem .4rem;border-radius:.35rem;font-size:.78rem;font-weight:700;white-space:normal}.usability-none{background:#dcfce7;color:#166534}.usability-limited{background:#fef3c7;color:#92400e}.usability-unusable,.usability-unsafe{background:#fee2e2;color:#991b1b}.machine-tile .usability{margin-top:.25rem}

/* AI chỉ đề xuất; số liệu và nút hành động vẫn do hệ thống kiểm soát. */
.ai-panel {border:1px solid var(--border,#cadbe8);border-radius:12px;padding:18px;margin:18px 0;background:var(--surface,#fff)}
.ai-panel textarea {width:100%;box-sizing:border-box}
.ai-suggestion {border:1px solid var(--border,#cadbe8);border-left:4px solid #2789bd;border-radius:10px;padding:16px;margin:14px 0}
.ai-suggestion h3,.ai-suggestion h4 {margin:8px 0}
.ai-suggestion li {overflow-wrap:anywhere;margin:6px 0}
.ai-panel [data-ai-status]:empty {display:none}
[data-theme="dark"] .ai-panel {background:#172b3b;border-color:#355269}
[data-theme="dark"] .ai-suggestion {border-color:#355269;border-left-color:#64c7ec}
/* Bước 22: thao tác lớp, học sinh và chuyển sơ đồ. */
.class-management .section-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.class-management h2{margin:0}.student-inline-tool{flex:1;min-width:240px}.student-inline-tool>summary{font-weight:650;cursor:pointer;padding:10px 0}.student-inline-tool .toolbar{margin:14px 0;flex-wrap:wrap}.student-management-table{margin-top:18px}.student-management-table td:nth-child(3){min-width:180px;overflow-wrap:anywhere}.student-management-table td:last-child{min-width:260px}.student-management-table .actions{gap:8px;margin:0}.student-management-table form{margin:0}.student-edit-form{padding:18px 0;border-bottom:1px solid var(--border);margin-bottom:18px}.student-action-dialog{max-width:600px}.student-action-dialog h2{font-size:1.2rem}.student-action-dialog .check{margin:18px 0}.transfer-preview .check{margin:16px 0}.transfer-preview{border-top:4px solid var(--primary)}.class-management>.actions{margin-top:16px}
@media(max-width:600px){.student-inline-tool{min-width:0;width:100%;flex-basis:100%}.student-action-dialog .actions{flex-direction:column}.student-action-dialog .actions>*{width:100%}.class-management h2{font-size:1.1rem}.student-management-table .actions{align-items:flex-start}}

/* Máy giáo viên riêng; không phải ô xếp học sinh. */
.teacher-station{display:flex;justify-content:center;margin:0 0 12px}.teacher-station .teacher-machine{display:grid;grid-template-columns:22px minmax(0,1fr);align-items:center;justify-items:start;column-gap:8px;row-gap:4px;width:max-content;max-width:min(100%,230px);min-height:0;padding:10px 12px}.teacher-station .teacher-machine>.icon{grid-column:1;grid-row:1/span 3;width:22px;height:22px;align-self:center}.teacher-station .teacher-machine>strong,.teacher-station .teacher-machine>small,.teacher-station .teacher-machine>.usability,.teacher-station .teacher-machine>.machine-safety{grid-column:2;text-align:left}.teacher-station .teacher-machine strong{font-size:.9rem}.teacher-station .teacher-machine .usability{font-size:.7rem;margin-top:0}.teacher-warning{max-width:640px;margin:8px auto 12px;text-align:center;font-size:12px;line-height:1.4;padding:8px 12px}.machine-type-summary{color:var(--muted);font-size:.9rem;line-height:1.5}

/* Cảnh báo máy giáo viên trong thẻ phòng ở Tổng quan. */
.room-summary > .error {
    font-size: 12px;
    line-height: 1.4;
    padding: 8px 12px;
    margin: 8px 0;
}

/* Bước 25: màu Đã kiểm tra (Ổn) và nhãn canh giữa đã duyệt. */
.map-good{--tile-bg:#ccf6de;--tile-line:#15803d;--tile-fg:#14532d}
:root[data-theme=dark] .map-good{--tile-bg:#145a3b;--tile-line:#4ade80;--tile-fg:#dcfce7}
.machine-tile .usability,.machine-tile .machine-safety{text-align:center}
.teacher-station .teacher-machine>.usability,.teacher-station .teacher-machine>.machine-safety{text-align:center;justify-self:center}

/* Phiên đăng nhập kết thúc: thanh thông báo dưới menu, tách khỏi số trên chuông. */
.session-expired-banner{display:flex;align-items:center;gap:16px;max-width:1152px;margin:16px auto;padding:16px 18px;border:1px solid var(--notice-border);border-radius:14px;background:var(--surface);color:var(--text);box-shadow:0 5px 18px #102c4210}
.session-expired-icon{display:grid;place-items:center;flex:none;width:44px;height:44px;border-radius:12px;background:var(--notice-bg);color:var(--primary)}
.session-expired-icon svg{width:23px;height:23px}
.session-expired-copy{display:grid;gap:4px;min-width:0}
.session-expired-copy strong{font-size:.98rem}
.session-expired-copy small{font-size:.82rem;line-height:1.4;color:var(--muted)}
.session-expired-action{display:inline-flex;align-items:center;justify-content:center;margin-left:auto;padding:11px 16px;min-height:42px;border-radius:9px;background:var(--button-bg);color:#fff;font-size:.84rem;font-weight:700;text-decoration:none;white-space:nowrap}
.session-expired-action:hover,.session-expired-action:focus-visible{background:var(--button-hover);color:#fff}
@media(max-width:600px){.session-expired-banner{flex-wrap:wrap;margin:12px 16px}.session-expired-action{width:100%;margin-left:0}}

/* Bước 27: chọn máy gọn, tra cứu phiếu và công cụ sơ đồ lớp/kiểm tra. */
.report-machine-picker>summary{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px;cursor:pointer;list-style:none;font-size:1.15rem;font-weight:750}
.report-machine-picker>summary::-webkit-details-marker{display:none}.report-machine-picker>summary:after{content:'⌄';color:var(--primary)}
.report-machine-picker[open]>summary:after{content:'⌃'}.report-machine-picker>summary small{margin-left:auto;font-weight:500;font-size:.8rem;color:var(--primary)}
.report-machine-map{margin-top:18px}.report-selection-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.report-selection-row .machine-selection{flex:1;margin:0;min-width:180px}
#report-details,#report-machine-picker{scroll-margin-top:calc(var(--menu-height,140px) + 18px)}
.filter-grid>.wide{grid-column:1/-1;flex-basis:100%}.incident-filter-more>summary,.seating-tools details>summary{cursor:pointer;color:var(--primary);font-weight:650}.incident-filter-more .form-grid{margin-top:16px}.ticket-symptom{font-size:.88rem;margin:6px 0}.ticket-symptoms>summary{cursor:pointer;font-weight:650}
/* Cờ lưu ý chỉ dùng tam giác vàng ở góc phải, không chiếm chỗ nội dung. */
.machine-tile>.machine-flag{position:absolute;top:6px;right:6px;width:18px;height:18px;display:block;background:#ffc84f;border:0;border-radius:0 4px 0 0;padding:0;margin:0;clip-path:polygon(0 0,100% 0,100% 100%);z-index:2;cursor:help}
.student-machine>.machine-flag{width:14px;height:14px}
.teacher-station .teacher-machine:has(>.machine-flag){padding-right:30px}
.machine-tile:has(>.machine-flag) .tile-tick{left:6px;right:auto}
.flag-entry{padding:12px 0;border-top:1px solid var(--border)}.machine-flag-panel h2{font-size:1.12rem}.machine-flag-panel .muted{font-size:.85rem}
.seating-tools h2{font-size:1.12rem}.seating-tools details{margin-top:14px}.seating-tools .muted{font-size:.84rem}.auto-seat-controls label:not(.check){display:grid;gap:4px;font-size:.82rem}.auto-seat-controls select{min-width:150px}
@media(max-width:760px){.report-machine-picker>summary{font-size:.98rem}.report-machine-picker>summary small{margin-left:0;width:100%}.report-selection-row .machine-selection{width:100%}.incident-filter-more .form-grid{grid-template-columns:1fr}.machine-flag-panel .actions button{width:100%}}

/* Bước 28: đợt kiểm tra và phòng chờ. */
.exam-rounds{margin:12px 0}.exam-tested-label{display:block;font-size:.75rem;color:var(--muted);margin:2px 0 5px}.roster-student .exam-tested-label{width:100%;text-align:left}

/* Bước 30: desktop gọn, tận dụng chiều ngang Full HD; không thu nhỏ vùng chạm mobile. */
@media screen and (min-width:1200px){
 :root{font-size:15px;line-height:1.45}
 main,.header-inner,.menu-inner{max-width:1800px;padding-inline:24px}
 main{padding-block:14px}
 .header-inner{padding-block:10px}
 .site-header .brand{font-size:1.15rem;gap:10px}
 .brand-symbol{width:38px;height:38px}.brand-symbol .icon{width:25px;height:25px}
 .brand small{margin-top:2px;font-size:.8rem}
 .sticky-menu .site-nav{padding-block:4px}
 .sticky-menu .nav-links{gap:4px 8px}
 .sticky-menu .nav-links>a{font-size:.9rem;min-height:36px;padding:6px 10px}
 .site-header .notification-link{width:38px;height:38px;min-height:38px}
 .account-menu>summary{padding:3px 6px}.account-avatar{width:32px;height:32px}
 h1{font-size:1.65rem;line-height:1.25;margin:12px 0 14px}
 h2{font-size:1.15rem;line-height:1.35;margin-bottom:10px}
 h3{margin-block:10px}p{margin-block:10px}li{margin-block:4px}
 .card{padding:16px 18px;margin:12px 0;border-radius:10px}
 .grid,.form-grid{gap:12px 16px}
 label{line-height:1.4}
 input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select{min-height:38px;margin-top:5px;padding:7px 10px}
 textarea{margin-top:5px;padding:8px 10px;line-height:1.4}
 textarea[rows="4"]{min-height:76px;height:76px}
 textarea[rows="3"]{min-height:62px;height:62px}
 button,.button{min-height:36px;padding:7px 12px;font-size:.94rem;line-height:1.35}
 .check input,.table-wrap input[type=checkbox]{width:18px;height:18px}
 small{margin-top:4px;line-height:1.4}
 .notice,.error{padding:10px 14px;line-height:1.45}
 .actions{gap:8px;margin-block:10px}
 .filter-grid{gap:12px;}.filter-grid label{min-width:180px}
 .toolbar{gap:12px}.toolbar label{min-width:180px}
 fieldset{padding:12px 14px}
 th,td{padding:8px 12px;line-height:1.4;font-size:.9rem}
 td small{font-size:.82rem}
 .status{font-size:.8rem;padding:3px 7px}
 .pagination{margin:12px 0;gap:6px}.pagination .page-number{min-height:32px;min-width:32px;padding:4px 8px}
 .section-gap{margin-top:18px}
 footer{padding:14px 24px;font-size:.82rem}
 .dashboard-welcome{margin:0 0 10px;gap:12px}.dashboard-welcome h2{font-size:1.35rem;margin:4px 0}
 .dashboard-actions{margin:12px 0 16px}
 .metric-grid{grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px}
 .metric{padding:13px 15px;gap:5px}.metric-top{font-size:.9rem}
 .metric-value{font-size:2rem}.metric-icon{width:30px;height:30px}
 .metric-note{font-size:.8rem;line-height:1.4}
 .dashboard-panels{gap:14px;margin:16px 0}
 .distribution-body{grid-template-columns:minmax(120px,150px) 1fr;margin:10px 0;gap:16px}
 .chart-legend li{font-size:.85rem;padding:3px 0}
 .task-list{gap:7px;margin:10px 0}.task-list>a{padding:9px 10px}
 .task-list strong{font-size:.9rem}.task-list small{font-size:.8rem}
 .room-section-heading{margin:18px 0 12px}
 .room-location{margin:6px 0 10px}.room-numbers{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:10px 0 12px}
 .room-numbers strong{font-size:1.4rem}.admin-counts{margin:12px 0;gap:20px}
 .room-map{padding:14px 16px;margin:12px 0}
 .map-legend{gap:6px 14px;margin:12px 0;font-size:.84rem}
 .map-safety-note{font-size:.8rem;margin-bottom:10px}
 .machine-row{margin:6px 0;gap:8px;grid-template-columns:36px repeat(4,minmax(65px,1fr)) 28px repeat(4,minmax(65px,1fr))}
 .machine-tile{min-height:86px;padding:6px 5px;gap:2px}
 .machine-tile strong{font-size:.95rem}.machine-tile small{font-size:.76rem;line-height:1.3}
 .machine-tile>.icon{width:24px;height:22px}.machine-empty{min-height:86px}
 .machine-tile .usability{font-size:.8rem;margin-top:3px;padding:2px 6px}
 .machine-safety{font-size:.72rem;padding:3px 5px}.map-caption{margin-top:10px;font-size:.8rem}
 .teacher-station{margin-bottom:8px}.teacher-station .teacher-machine{padding-block:7px;row-gap:2px}
 .device-picker{margin:12px 0;gap:8px}.device-card{padding:10px 8px;gap:5px;font-size:.9rem}
 .device-card>.icon{width:24px;height:24px}
 .issue-options{gap:7px 16px;margin-top:10px}.issue-option{padding:4px 6px}
 .issue-group{padding:10px;margin:8px 0}.report-layout>.card{margin:12px 0}
 .report-machine-picker>summary{font-size:1.05rem}.machine-selection{padding:8px 12px}
 .student-hero{padding:16px 20px;gap:16px;margin:14px 0}
 .student-hero h2{font-size:1.4rem;margin:4px 0}.student-hero p{margin:4px 0}
 .student-hero-icon{min-width:56px;height:56px;border-radius:14px}.student-hero-icon .icon{width:32px;height:32px}
 .student-filters{grid-template-columns:repeat(3,minmax(0,1fr)) auto;align-items:end}
 .student-filters>.actions{grid-column:auto;margin:0;align-self:end}
 .student-metrics{grid-template-columns:repeat(3,minmax(0,1fr));margin:12px 0}
 .student-metrics .metric{gap:5px}.student-setup{margin:12px 0}
 .student-workspace{grid-template-columns:240px minmax(0,1fr);gap:18px;margin:18px 0}
 .student-roster{padding:14px}.student-roster h2{margin-bottom:10px}
 .student-roster-list{gap:6px;max-height:560px}.roster-student{padding:8px 10px;gap:3px}
 .roster-name{font-size:.9rem;line-height:1.3}.roster-meta{font-size:.78rem}
 .student-room-map .machine-tile{min-height:140px;padding:6px 5px;gap:3px}
 .student-machine-target{display:grid;grid-template-columns:22px minmax(0,1fr);align-items:center;justify-items:center;min-height:0;padding:2px 1px;gap:2px 4px}
 .student-machine-target>.icon{grid-column:1;grid-row:1/span 2}
 .student-machine-target>strong,.student-machine-target>small{grid-column:2}
 .student-machine-target>.usability,.student-machine-target>.machine-safety{grid-column:1/-1;justify-self:center}
 .student-room-map .teacher-station .teacher-machine{min-height:0;padding-block:7px}
 .student-machine-target>.icon{width:21px;height:21px}
 .student-machine-target strong{font-size:.9rem}.student-room-map .student-machine-target small{font-size:.72rem}
 .student-room-map .machine-safety{font-size:.7rem}
 .machine-students{min-height:0;gap:3px}
 .seat-student{font-size:.8rem;line-height:1.25;min-height:24px;padding:3px 4px}
 .seat-student.is-long{font-size:.75rem}.seat-capacity{font-size:.7rem}
 .student-status{padding:8px 12px;min-height:36px;margin-block:10px}
 .student-unassign{margin-top:10px;padding:10px}
 .auto-seat-controls{margin-block:10px}.student-year-end{margin:16px 0}
 .seating-tools h2{margin-bottom:8px}.exam-rounds{margin-block:8px}
 .session-expired-banner{margin-block:10px;padding-block:10px;max-width:1752px}
}
@media screen and (min-width:1600px){
 .metric-grid:not(.student-metrics){grid-template-columns:repeat(auto-fit,minmax(300px,1fr))}
}

/* Bước 31: các ô máy cân đối, nội dung xếp giữa theo cùng một trục. */
.room-map .machine-row{align-items:stretch}
.room-map .machine-row>.machine-tile{justify-content:flex-start}
.room-map .machine-row>.machine-tile>small,
.student-machine-target>small{display:flex;align-items:center;justify-content:center;min-height:2.6em;width:100%;text-align:center}
.student-machine-target{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:3px}
.student-machine-target>.icon,
.student-machine-target>strong,
.student-machine-target>small,
.student-machine-target>.usability,
.student-machine-target>.machine-safety{grid-column:auto;grid-row:auto;align-self:center;text-align:center}
.student-machine-target>.icon{margin:0}
.student-machine-target>.usability{margin-inline:auto}
.machine-students{width:100%}
@media screen and (min-width:1200px){
 .room-map .machine-rows{max-width:1480px;margin-inline:auto}
 .room-map .machine-row{gap:10px;margin-block:8px}
 .room-map .machine-row>.machine-tile{min-height:116px;padding:9px 7px;gap:3px}
 .room-map .machine-row>.machine-tile>.icon{width:24px;height:22px}
 .room-map .machine-row>.machine-tile>strong{font-size:.96rem;line-height:1.25}
 .room-map .machine-row>.machine-tile>small{font-size:.76rem;line-height:1.3}
 .room-map .machine-row>.machine-empty{min-height:116px}
 .student-room-map .machine-row>.student-machine{min-height:156px;padding:8px 6px;gap:4px}
 .student-room-map .student-machine-target{display:flex;min-height:100px;gap:3px;padding:0 2px}
 .student-room-map .student-machine-target>.icon{width:22px;height:20px}
 .student-room-map .student-machine-target>strong{font-size:.94rem;line-height:1.25}
 .student-room-map .student-machine-target>small{min-height:2.6em;font-size:.76rem;line-height:1.3}
 .student-room-map .student-machine-target>.usability{margin-top:0}
 .student-room-map .machine-students{min-height:0;gap:4px}
 .student-room-map .seat-student{min-height:26px;padding:4px;line-height:1.3}
 .student-room-map .seat-capacity{margin-top:auto;padding-top:2px;align-self:flex-end;line-height:1.2}
 .student-room-map .machine-row>.machine-empty{min-height:156px}
}

}
