/* V16.3: query tools and one inventory workspace at a time. */
#page-energy .energy-room-panel{padding:16px 18px}
#page-energy .energy-room-toolbar{display:block;margin:0}
#page-energy .energy-room-filters{display:grid;width:100%;min-width:0;grid-template-columns:minmax(240px,2fr) minmax(140px,1fr) minmax(140px,1fr) auto;gap:12px;align-items:end}
#page-energy .energy-room-filters label{min-width:0;margin:0;font-size:14px}
#page-energy .energy-room-filters label>span{display:block;margin:0 0 6px}
#page-energy .energy-room-filters input,#page-energy .energy-room-filters select{width:100%;min-width:0;min-height:44px;height:44px;margin:0;font-size:16px;box-sizing:border-box}
#page-energy .energy-room-filter-actions{display:flex;gap:8px}
#page-energy .energy-room-filter-actions .btn{height:44px;min-height:44px;margin:0}
#page-energy #energyRoomList>.empty-state{grid-column:1/-1;min-height:0;padding:12px 0 0;border:0;text-align:left;background:none;font-size:14px}
#page-energy #energyRoomList:empty{display:none}
#page-energy .energy-room-summary:not(.hidden){margin-top:14px}
.prep-history-filterbar{grid-template-columns:minmax(220px,1.5fr) minmax(235px,1.2fr) minmax(160px,1fr) minmax(160px,1fr) auto;padding:12px;gap:10px}
.prep-history-filterbar .task-filter-field>span{font-size:14px;margin-bottom:4px}
.prep-history-filterbar input,.prep-history-filterbar select{font-size:16px;height:44px;min-height:44px;box-sizing:border-box}
.prep-history-filterbar .prep-history-actions .btn{font-size:16px;height:44px;min-height:44px}
.prep-history-count{grid-column:1/-1;justify-self:end;font-size:14px}
.prep-progress-panel .demand-history-table th:nth-child(n){min-width:0}
.prep-progress-panel .demand-history-table th:nth-child(4){min-width:230px}
#inventoryAssetPane .inventory-workspace{padding:18px;margin-top:12px}
.inventory-workspace-bar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:16px}
.inventory-workspace-bar h3{margin:0;font-size:20px}
#inventoryListScreen .inventory-workspace-bar{justify-content:space-between}
.inventory-workspace-bar .inv-status{margin-left:auto}
.inventory-note{font-size:14px;color:#65778e;margin:10px 0 16px;line-height:1.5}
.inventory-location-field{display:block;max-width:680px;margin:18px 0 10px;font-size:15px}
.inventory-location-field .location-picker{margin-top:8px}
.inventory-location-field input{width:100%;min-height:46px;font-size:16px}
#inventoryActive .inventory-head{margin:0 0 8px;display:block}
#inventoryActive .inventory-head h4{margin:0 0 6px;font-size:22px}
#invTaskMeta,#invRecordMeta{font-size:14px;line-height:1.6;overflow-wrap:anywhere}
.inventory-record{margin:8px 0 14px;color:#65778e;font-size:14px}
.inventory-record summary{cursor:pointer;min-height:28px;width:max-content}
#inventoryActive .inventory-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;max-width:720px;margin:12px 0}
#inventoryActive .inventory-metrics>div{width:auto;min-width:0;padding:12px;text-align:left;border:1px solid #d8e4f0;border-radius:10px;background:#f5f8fd}
#inventoryActive .inventory-metrics small{display:block;font-size:14px}
#inventoryActive .inventory-metrics b{display:block;margin-top:4px;font-size:26px}
.inventory-work-actions{display:flex;flex-wrap:wrap;gap:8px;margin:16px 0}
.inventory-result-tabs{display:flex;flex-wrap:wrap;gap:6px;margin:18px 0 10px;border-bottom:1px solid #d8e4ef;padding-bottom:10px}
.inventory-result-tabs button{min-height:42px;padding:8px 16px;border:1px solid #d2deee;border-radius:9px;background:#fff;color:#315475;font-size:15px;font-weight:700;cursor:pointer}
.inventory-result-tabs button.active{background:#125cda;border-color:#125cda;color:#fff}
.inventory-result-tabs button:focus-visible{outline:3px solid #8eb9ef;outline-offset:2px}
#invResultCount{font-size:14px;margin:8px 0}
#invAssetList{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
#invAssetList .inv-item{min-width:0;margin:0;padding:12px;gap:12px}
#invAssetList .inv-item strong{font-size:16px;overflow-wrap:anywhere}
#invAssetList .inv-item small{font-size:13px;line-height:1.5}
#invAssetList .inv-state{font-size:13px;flex:0 0 auto}
.inventory-empty{grid-column:1/-1;padding:22px 4px;color:#65778e;font-size:15px}
#inventoryAssetPane .task-filter-field>span{font-size:14px}
#inventoryAssetPane .task-filter-field input,#inventoryAssetPane .task-filter-field select{font-size:16px;min-width:0;width:100%;box-sizing:border-box}
#inventoryAssetPane .inventory-history-table{min-width:0;width:100%;font-size:15px}
#inventoryAssetPane .inventory-history-table th,#inventoryAssetPane .inventory-history-table td{padding:12px 10px}
@media(max-width:1200px){
 .prep-history-filterbar{grid-template-columns:repeat(2,minmax(0,1fr))}
 .prep-history-filterbar .prep-history-actions{grid-column:1}.prep-history-count{grid-column:2;align-self:center}
}
@media(max-width:1100px){
 #page-energy .energy-room-filters{grid-template-columns:repeat(2,minmax(0,1fr))}
 #page-energy .energy-room-query{grid-column:1/-1}
 #page-energy .energy-room-filter-actions{grid-column:1/-1}
 #inventoryAssetPane .inventory-history-filters{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:620px){
 #page-energy .energy-room-panel,#inventoryAssetPane .inventory-workspace{padding:12px}
 #page-energy .energy-room-filter-actions .btn{flex:1}
 .prep-history-filterbar{grid-template-columns:minmax(0,1fr);padding:10px}
 .prep-history-filterbar .prep-history-actions,.prep-history-count{grid-column:1}
 .prep-history-filterbar .prep-history-actions{display:flex}.prep-history-actions .btn{flex:1}
 #inventoryAssetPane .inventory-history-filters{grid-template-columns:repeat(2,minmax(0,1fr));padding:10px}
 #inventoryAssetPane .inventory-history-filters label:first-child{grid-column:1/-1}
 #inventoryAssetPane .inventory-history-filters label:nth-child(2){grid-column:1/-1}
 #inventoryActive .inventory-metrics{gap:6px}
 #inventoryActive .inventory-metrics>div{padding:8px 6px}
 #inventoryActive .inventory-metrics small{font-size:12px}
 #inventoryActive .inventory-metrics b{font-size:22px}
 .inventory-work-actions .btn{flex:1 1 42%;min-height:44px}
 .inventory-result-tabs{display:grid;grid-template-columns:1fr 1fr}
 .inventory-result-tabs button{padding:8px;font-size:14px}
 #invAssetList{grid-template-columns:minmax(0,1fr)}
 #inventoryAssetPane .inventory-history-table thead{display:none}
 #inventoryAssetPane .inventory-history-table,#inventoryAssetPane .inventory-history-table tbody{display:block}
 #inventoryAssetPane .inventory-history-table tr{display:grid;grid-template-columns:1fr 1fr;border:1px solid #d8e4ef;border-radius:10px;padding:10px;margin-bottom:10px;gap:8px}
 #inventoryAssetPane .inventory-history-table td{display:block;min-width:0;border:0;padding:0;overflow-wrap:anywhere;white-space:normal}
 #inventoryAssetPane .inventory-history-table td:first-child{grid-column:1/-1;font-size:18px}
 #inventoryAssetPane .inventory-history-table td[data-label]:not(:first-child):not(:last-child)::before{content:attr(data-label);display:block;font-size:12px;color:#65778e;margin-bottom:4px}
 #inventoryAssetPane .inventory-history-table td:last-child{grid-column:1/-1}
 #inventoryAssetPane .inventory-history-table td:last-child .btn{width:100%;min-height:42px}
}

/* V16.9 preparation sheet: all rows expand with the document; horizontal scroll only. */
#demandDetailList .config-prep-expanded{height:auto;max-height:none;overflow-x:auto;overflow-y:hidden}
#demandDetailList .config-prep-expanded table{table-layout:fixed;width:1456px;min-width:1456px;font-size:15px}
#demandDetailList .config-prep-expanded td{min-width:0;width:auto;height:auto;padding:7px 5px;overflow-wrap:anywhere}
#demandDetailList .config-prep-expanded thead th{font-size:14px;padding:8px 5px;white-space:nowrap}
#demandDetailList .config-prep-expanded input,#demandDetailList .config-prep-expanded select{font-size:15px;padding:5px 4px;min-height:36px;width:100%;min-width:0;box-sizing:border-box}
#demandDetailList .config-prep-expanded input[type=checkbox]{width:18px;min-height:18px}
#demandDetailList .config-prep-expanded .config-select-head,#demandDetailList .config-prep-expanded .config-select-cell{width:36px!important;min-width:36px!important}
#demandDetailList .config-prep-expanded td.config-sticky.category{left:36px}
#demandDetailList .config-prep-expanded td.config-sticky.priority{left:126px}
#demandDetailList .config-prep-expanded td.config-sticky.code{left:190px}
#demandDetailList .config-prep-expanded td.config-sticky.name{left:238px}
#demandDetailList .config-prep-expanded thead tr:nth-child(2) th:nth-child(1){left:36px}
#demandDetailList .config-prep-expanded thead tr:nth-child(2) th:nth-child(2){left:126px}
#demandDetailList .config-prep-expanded thead tr:nth-child(2) th:nth-child(3){left:190px}
#demandDetailList .config-prep-expanded thead tr:nth-child(2) th:nth-child(4){left:238px}
#demandDetailList .config-prep-expanded .config-sticky.name b{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}
#demandDetailList .config-prep-expanded .config-sticky.name b:focus{outline:2px solid #1260d5}
#demandDetailList .config-prep-expanded .config-sheet-action{min-width:0;padding:6px 4px}
#demandDetailList .config-prep-expanded .btn.mini{font-size:13px;padding:7px 5px;white-space:normal;min-width:0}
#demandDetailList .config-prep-expanded .config-source-pill{font-size:12px;white-space:normal}
@media(max-width:760px){#demandDetailList .config-prep-expanded .config-sticky,#demandDetailList .config-prep-expanded thead tr:nth-child(2) th{position:static}}

/* V17.1.1: readable permission audit, bounded columns on every viewport. */
#logsTable .operation-log-table{width:100%;min-width:1080px;table-layout:fixed}
#logsTable .operation-log-table th,#logsTable .operation-log-table td{white-space:normal;overflow-wrap:anywhere;vertical-align:top;font-size:15px;line-height:1.55;padding:12px 10px}
#logsTable .operation-log-table th:nth-child(1){width:142px}
#logsTable .operation-log-table th:nth-child(2){width:110px}
#logsTable .operation-log-table th:nth-child(3){width:80px}
#logsTable .operation-log-table th:nth-child(4){width:92px}
#logsTable .operation-log-table th:nth-child(5){width:96px}
#logsTable .operation-log-table th:nth-child(9){width:112px}
.log-permission-change{display:grid;gap:6px}
.log-permission-change strong{font-size:15px;color:#244f85}
.log-permission-change details{margin-top:4px}
.log-permission-change summary{cursor:pointer;color:#345e91;padding:6px 0;min-height:32px}
.log-permission-label{display:inline-block;margin:3px 4px 3px 0;padding:2px 6px;background:#eef4fc;border-radius:5px;font-size:14px}
