.pipe-regions{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,640px),1fr));gap:12px}
.pipe-region h2{font-size:16px;margin:0 0 8px}
.pipe-region h2 small{font-weight:400;color:#667}
.pipe-table td,.pipe-table th{white-space:nowrap;font-size:13px;padding:4px 6px}
.pipe-site-saddle td{background:#e6deef}
.pipe-site-beam td{background:#fff7b8}
.pipe-site-around td{background:#efe9d8}
.pipe-site-water td{background:#ddf0f5}
.pipe-site-slide td{background:#ffe7c2}
.pipe-site-assembly td{background:#e2f0d9}
.pipe-site-column td{background:#dde7f7}
.pipe-site-head td{background:#fbe3e8}
.pipe-issue td:nth-child(3){outline:2px solid #c63b27;outline-offset:-2px}
/* Field rows: title on its own line, inputs and buttons aligned on their bottom edge. */
.pipe-compare{display:flex;gap:8px 14px;align-items:flex-end;flex-wrap:wrap;margin-top:10px}
.pipe-compare>strong,.pipe-compare>.sub,.pipe-compare>details{flex-basis:100%}
.pipe-compare .field,.pipe-form-row .field{margin:0;min-width:220px;flex:0 0 auto;width:auto}
.pipe-compare select,.pipe-compare input[type=text],.pipe-form-row select,.pipe-form-row input[type=text]{min-width:220px}
.pipe-compare button,.pipe-form-row button{height:40px;white-space:nowrap}
.pipe-form-cards{display:grid;grid-template-columns:1fr;gap:12px;margin-bottom:12px}   /* one card per row keeps fields on one line */
.pipe-form{margin:0}
.pipe-form h3{margin:0 0 10px;font-size:15px}
.pipe-form-row{display:flex;gap:8px 14px;align-items:flex-end;flex-wrap:wrap}
.pipe-form-row>p{margin:0}
.pipe-form>.sub{margin:8px 0 0}
.pipe-diff td{vertical-align:top;font-size:13px}
.pipe-status-新增 td:first-child,.pipe-status-變更 td:first-child,.pipe-status-刪除 td:first-child{border-left:4px solid #005ead}
.pipe-status-需人工處理 td{background:#fff0eb}
.pipe-catalog{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;align-items:center}
.pipe-editing .pipe-table input,.pipe-editing .pipe-table select{font-size:13px;padding:3px 4px;min-width:0}
.pipe-editing .pipe-region{grid-column:1/-1}
.pipe-new-part{color:#9a5b00}
.pipe-cycle input{width:5em}
.pipe-cmp-diff td:first-child{border-left:4px solid #c68a00}
.pipe-cmp-only td:first-child{border-left:4px solid #005ead}
.pipe-cmp-same td{color:#667}
.pipe-retired td{opacity:.55;text-decoration:line-through}
.pipe-retired td:last-child,.pipe-retired td:nth-last-child(2){text-decoration:none}
.pipe-reminder{border-left:5px solid #c63b27;background:#fff0eb}
.pipe-filterbar{display:flex;gap:8px 14px;align-items:center;flex-wrap:wrap;margin-bottom:10px}
.pipe-filterbar .search{flex:1 1 260px;max-width:420px}
.pipe-form[hidden]{display:none}
.pipe-tabs{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:12px}
.pipe-tabs button.active{background:#173f50;color:#fff;border-color:#173f50}
/* rdmsPipeLayout D1～D9：分頁列、標題按鈕群組標籤、E10 一行、審核前 E10 提醒；窄寬度都換行 */
/* 管長主分頁：各自獨立的按鈕外框，選取與未選取清楚區分。 */
.pipe-main-tabs{margin:4px 0 14px;padding:4px 0;background:transparent;gap:8px}
.pipe-main-tabs button{min-height:0;padding:7px 10px;font-size:.85rem;border:1px solid #7a98a8;border-radius:7px;background:#fff;color:#214e65;font-weight:600;box-shadow:0 1px 3px #173f501a}
.pipe-main-tabs button:hover{background:#e8f3f9;border-color:#276b8b;color:#173f50}
.pipe-main-tabs button.active{background:#173f50;border-color:#173f50;color:#fff;box-shadow:0 3px 7px #173f5033}
.pipe-main-tabs button.active:hover{background:#103242;border-color:#103242;color:#fff}
.pipe-main-tabs button:focus-visible{outline:3px solid #005ead;outline-offset:3px}

.pipe-action-group{display:inline-flex;align-items:center;flex-wrap:wrap;gap:10px;max-width:100%}
.pipe-action-label{display:inline-flex;align-items:center;font-size:13px;color:#445;line-height:1.3;max-width:100%}
.pipe-catalog-line{margin:0 0 12px;line-height:1.6;overflow-wrap:anywhere}
.pipe-catalog-line .link{margin-left:6px}
.pipe-review-e10{margin-top:6px;padding:6px 10px;border-left:4px solid #c77d00;background:#fff3dc;color:#5a3a00;font-size:13px;overflow-wrap:anywhere}
.pipe-headdb{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px}
.pipe-headdb .sub{flex:1 1 240px;min-width:0}
.pipe-ai-row td{box-shadow:inset 0 0 0 999px #fff3b0}
.pipe-photo-modal{width:min(1400px,96vw)}
.pipe-photo-layout{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;margin-top:10px}
.pipe-photo-files{display:flex;gap:10px;flex-wrap:wrap;align-items:flex-start}
.pipe-photo-files figure{margin:0;width:220px}
.pipe-photo-files img{width:100%;max-height:300px;object-fit:contain;border:1px solid #cbd3d8;border-radius:6px;background:#fff}
.pipe-photo-files figcaption{font-size:12px;color:#667;word-break:break-all}
.pipe-photo-check td{background:#fff0eb}
.pipe-save-bar{position:sticky;bottom:0;display:flex;gap:10px;align-items:end;flex-wrap:wrap;z-index:2}
.pipe-review-row td{background:#fff6d6}
.pipe-review-badge{background:#ffe08a;color:#6b4200;border:1px solid #d9a520;cursor:pointer}
.pipe-review-note{border-left:5px solid #d9a520;background:#fff8e1}
.pipe-review-note button{margin:2px 0}
/* r239ui：訂單管制「機台管長待審核」預設收成一行，點開才列機號（pipe-lengths.js pipeDecorateOrders） */
.pipe-review-fold>summary{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 10px;cursor:pointer;list-style:none}
.pipe-review-fold>summary::-webkit-details-marker{display:none}
.pipe-review-fold>summary::before{content:'▸';color:#8a6a00}
.pipe-review-fold[open]>summary::before{content:'▾'}
.pipe-review-fold[open] .pipe-review-hint{display:none}
.pipe-review-fold>p{margin:8px 0 6px}
/* r240ui（使用者 2026-11-26「版面問題 要涵蓋全部類似的頁面 ex 管長管制」）：一行提示（待審核）用較小的內距；
   管長頁分頁和 E10 一行（含逾期提醒）同一列，窄寬度自動換行 */
.note.pipe-note-line{padding:6px 14px;margin:0 0 10px;line-height:1.6}
.pipe-tabrow{display:flex;flex-wrap:wrap;align-items:center;gap:6px 16px;margin:4px 0 10px}
.pipe-tabrow>.pipe-main-tabs{margin:0;padding:0}
.pipe-tabrow>.pipe-catalog-line{margin:0;flex:1 1 320px;min-width:0}
.pipe-catalog-due{padding:5px 12px;border-left:4px solid #c63b27;border-radius:4px;background:#fff0eb;color:#7a2a1c}
.pipe-catalog-due .sub{color:#8a5a50}
/* r239ui：沒有範本的機台匯出空白管長清單（pipe-lengths.js pipeBlankExportHtml） */
.pipe-compare>.pipe-blank-export{flex-basis:100%}
.pipe-blank-export .field{flex:0 1 auto;min-width:0;max-width:100%}
.pipe-blank-export select{min-width:0;max-width:100%}   /* 範本選項字很長：手機不超出卡片 */
/* r239ui：手機（≤700px）管長分區頁籤一次看一區（pipe-lengths.js pipeRegionTabs）＋機台管長卡片精簡；桌機、iPad 不顯示頁籤、照舊全部列出 */
.pipe-region-tabs{display:none}
@media (max-width:700px),(max-height:500px) and (pointer:coarse){   /* 同 v12.js 表格改卡片的條件 */
 .pipe-region-tabs{display:flex;flex-wrap:wrap;gap:6px;position:sticky;top:0;z-index:20;margin:0 -12px 10px;padding:6px 12px;background:#f2f6f8;border-bottom:1px solid #d5e0e8}
 .pipe-region-tabs button{min-height:36px;margin:0;padding:4px 12px;border:1px solid #9fb6c3;border-radius:999px;background:#fff;color:#173f50;font-size:14px}
 .pipe-region-tabs button b{margin-left:2px;font-weight:600;color:#5a7380}
 .pipe-region-tabs button.active{background:#173f50;border-color:#173f50;color:#fff}
 .pipe-region-tabs button.active b{color:#d6e6ee}
 .pipe-regions.pipe-tabbed>.pipe-region:not(.pipe-region-active){display:none}
 /* 一條管路一張小卡（欄位順序：部位、品號、項目、長度、修正、名稱、管徑、數量、行程、說明）：項目｜長度第一行粗體，
    品號｜部位、名稱｜管徑、數量｜行程兩兩並排，修正、說明整行；空的欄位不顯示，整列上部位顏色（藏掉的格子不留白洞） */
 .pipe-view-table.rt-cards tr{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:0;padding:6px 0}
 .pipe-view-table.rt-cards td{display:flex;gap:6px;align-items:baseline;min-width:0;padding:2px 6px;font-size:13px}
 .pipe-view-table.rt-cards td::before{flex:none;font-size:11px}
 .pipe-view-table.rt-cards td:empty{display:none}
 .pipe-view-table.rt-cards td:nth-child(3){order:1;font-size:16px}
 .pipe-view-table.rt-cards td:nth-child(4){order:2;font-size:16px;font-weight:700}
 .pipe-view-table.rt-cards td:nth-child(2){order:3}
 .pipe-view-table.rt-cards td:nth-child(1){order:4}
 .pipe-view-table.rt-cards td:nth-child(6){order:5}
 .pipe-view-table.rt-cards td:nth-child(7){order:6}
 .pipe-view-table.rt-cards td:nth-child(8){order:7}
 .pipe-view-table.rt-cards td:nth-child(9){order:8}
 .pipe-view-table.rt-cards td:nth-child(5){order:9;grid-column:1/-1}
 .pipe-view-table.rt-cards td:nth-child(10){order:10;grid-column:1/-1}
 .pipe-view-table.rt-cards tr.pipe-site-saddle{background:#e6deef}
 .pipe-view-table.rt-cards tr.pipe-site-beam{background:#fff7b8}
 .pipe-view-table.rt-cards tr.pipe-site-around{background:#efe9d8}
 .pipe-view-table.rt-cards tr.pipe-site-water{background:#ddf0f5}
 .pipe-view-table.rt-cards tr.pipe-site-slide{background:#ffe7c2}
 .pipe-view-table.rt-cards tr.pipe-site-assembly{background:#e2f0d9}
 .pipe-view-table.rt-cards tr.pipe-site-column{background:#dde7f7}
 .pipe-view-table.rt-cards tr.pipe-site-head{background:#fbe3e8}
}
.pipe-special{background:#f3e5ff;color:#5b2a86;border:1px solid #c9a3e8}
.pipe-progress{display:flex;gap:10px;align-items:center;margin:6px 0 10px}
.pipe-progress progress{flex:1 1 auto;max-width:460px;height:14px;accent-color:#005ead}
.pipe-progress span{font-size:13px;color:#445;white-space:nowrap}
.pipe-ai-mode{display:flex;gap:6px 14px;flex-wrap:wrap;align-items:center}
.pipe-ai-mode .label{flex-basis:100%;font-size:13px;color:#445}
.pipe-ai-mode label{display:inline-flex;gap:4px;align-items:center;white-space:nowrap;margin:0}
.pipe-ai-mode input{width:auto;margin:0}
.pipe-webai-steps{margin:0;padding-left:20px;display:grid;gap:14px}
.pipe-webai-steps textarea{width:100%;box-sizing:border-box;margin:8px 0;font-family:inherit}
.pipe-webai-prompt{white-space:pre-wrap;max-height:30vh;overflow:auto;font-size:12px;background:#f6f8f9;padding:8px;border-radius:6px}
.pipe-webai figure button{margin-top:4px}
.pipe-batch-bar{position:sticky;top:0;z-index:3;display:flex;gap:8px 14px;align-items:flex-end;flex-wrap:wrap}
.pipe-batch-bar .field{min-width:180px;margin:0}
.pipe-picked td{box-shadow:inset 0 0 0 999px #dcefff}
.pipe-unsorted{border:2px dashed #c68a00}
.pipe-drop-hover{outline:3px dashed #005ead;outline-offset:-3px}
.pipe-editing tr.pipe-drop-before>td{box-shadow:inset 0 3px 0 #005ead}
.pipe-editing tr[draggable=true]{cursor:grab}
.pipe-flat{background:#fff1d6;color:#7a4b00;border:1px solid #c68a00}
[data-flat]{margin-top:6px}
[data-flat-box]:not(:empty){margin-top:12px}
.pipe-list td,.pipe-list th{padding:10px 14px}
.pipe-list td .sub{font-size:12px}
.pipe-cardrow{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,380px),1fr));gap:12px;margin-bottom:14px}
.pipe-cardrow>.card{margin:0;padding:16px 20px}
.pipe-cardrow .pipe-catalog{align-items:flex-start}
details.pipe-fold{padding:12px 20px;margin-bottom:12px}
details.pipe-fold[open]>summary{margin-bottom:8px}
.pipe-help{margin-top:8px}
.pipe-help>summary{font-size:13px;color:#445;cursor:pointer}
.pipe-help>p{margin:6px 0 0}
.pipe-export .field,.pipe-export select{min-width:170px}
.pipe-pending{margin-bottom:12px}
.pipe-pending .pipe-form-row{margin-top:8px}

.pipe-count-bar{display:flex;flex-wrap:wrap;gap:4px 18px;align-items:baseline;margin:8px 0;padding:8px 12px;background:#f5f7f9;border:1px solid #dde3e8;border-radius:6px;font-size:14px}.pipe-count-bar span{color:#4a5a66}.badge.pipe-needs{background:#fcf8e3;color:#8a6d3b;border:1px solid #f0ad4e}.pipe-tpl-update .pipe-form-row{align-items:flex-end}

.pd-legend{display:flex;flex-wrap:wrap;gap:6px 10px;align-items:center;font-size:13px}.pd-tag{display:inline-block;padding:1px 7px;border-radius:3px;font-size:12px;color:#fff;white-space:nowrap}.pd-add{background:#5cb85c}.pd-chg{background:#f0ad4e}.pd-back{background:#5bc0de}.pd-del{background:#d9534f}.pd-bad{background:#777}.pd-table td.pd-chg{background:#fcf8e3;color:inherit}.pd-table td.pd-chg b{display:block;color:#8a3b00}.pd-table td.pd-chg s{display:block;color:#999;font-size:12px}.pd-table td.pd-new{background:#eff8ef}.pd-table td.pd-fix{background:#fff1c2}.pd-table input[data-pd-edit]{font:inherit;padding:1px 3px;max-width:100%;box-sizing:border-box}.pd-table td.pd-edited{background:#dbeafe;box-shadow:inset 0 0 0 2px #3b82f6}.pd-fix-note.pd-edit-note{border-left-color:#3b82f6;background:#eef5ff}.pd-table td.pd-fix b{display:block;color:#8a3b00}.pd-fix-note{margin:4px 0 8px;padding:6px 10px;background:#fff8e1;border-left:4px solid #f0ad4e;font-size:13px}.pd-table tr.pd-row-del td{color:#a94442}.pd-table tr.pd-row-bad td{color:#777}.pd-regions h2 input{margin-right:4px}

.pipe-table td.pipe-no-e10{background:#f8cbc6}.pipe-no-e10-note{font-size:11px;color:#a94442;white-space:normal}

.pipe-module{margin:2px 0 6px;padding:5px 10px;border-left:4px solid #5bc0de;background:#f3f9fb;font-size:13px}.pipe-module-need{border-color:#d9534f;background:#fdf0ef}.pipe-module-k{display:inline-block;padding:0 6px;border-radius:3px;background:#2d6a7a;color:#fff;font-size:12px;margin-right:4px}.pipe-module-warn{color:#a94442;font-weight:600;margin-top:2px}.pipe-extra-h{font-size:14px;margin:10px 0 4px;color:#8e44ad}.pipe-module-form input{width:100%;box-sizing:border-box}
