/* 「管理 ▾ → 叫貨」分頁(public/proc-ui.js)。舊 WebView:不用 gap、不用 grid、不用 :has();觸控區 >= 44px;
 * 手機 375px 寬不出現整頁橫向捲動:表格加 rt-cards(public/table-cards.css)在手機變成一列一張卡,表單欄位一律 100% 寬。
 * 這個檔的前半段是「叫貨」分頁五個畫面(叫貨、檢收、盤點、庫存、叫貨設定)共用的外觀:分頁列、切換鈕、卡片、狀態標籤、分類標題、
 * 數量加減、黏在下緣的送出列、空狀態。各畫面自己的 css(proc-order-ui / proc-receive-ui / proc-count-ui / proc-stock-ui)只寫版面差異,
 * 顏色一律用 app.css 的色票(--line、--panel、--muted、--ink、--primary、--accent),標籤配色與 settings-kit.css 的 .ks-pill 同一套。 */

/* ---------- 外框:寬螢幕內容不拉滿(眼睛不用左右掃太遠) ---------- */
/* 白色底板跟著內容長:分頁本身是一排的 flex(app.css .tab),底板預設被拉成跟視窗一樣高,內容比較長時會超出白底 */
#tab-proc > #proc-root { align-self: flex-start; }
#tab-proc .proc-body { max-width: 980px; padding: 4px 2px 24px; }
#tab-proc .proc-pick select { display: block; width: 100%; max-width: 420px; min-height: 44px; margin-top: 4px; box-sizing: border-box; font-size: 16px; font-weight: 400; }
/* 第一層(日常 / 叫貨設定兩個入口、分店、分頁列)在 proc-theme.css */

/* ---------- 第二層:同一畫面裡的切換(待檢收 / 臨時進貨 / 檢收紀錄;盤點單 / 損耗紀錄;庫存 / 報廢紀錄;從原料看 / 從品項看) ---------- */
.proc-seg { margin: 0 0 12px; }
.proc-seg:after { content: ''; display: table; clear: both; }
/* 分段鈕本身是共用的 .ks-seg(settings-kit.css),這裡只排它旁邊的東西 */
.proc-seg > button:not(.pst-waste) { vertical-align: middle; }
#tab-proc .ks-seg + .proc-arch, #tab-proc .ks-seg + button { margin-left: 10px; }

/* ---------- 動作列:主要動作在前、其他是次要鈕 ---------- */
#tab-proc .proc-actions { margin: 0 0 10px; }
#tab-proc .proc-actions > button, #tab-proc .proc-actions > a.proc-dl { margin: 0 8px 8px 0; min-height: 44px; vertical-align: middle; }
#tab-proc .proc-actions .proc-arch { display: inline-block; vertical-align: middle; margin-bottom: 8px; }

/* ---------- 分類標題(原料分類、存放位置、廠商分區):跟品名分得出來 ---------- */
#tab-proc .proc-cat, .po-cat, #tab-proc .proc-body > h4 { margin: 16px 0 4px; padding: 0 0 4px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 800; color: var(--muted); letter-spacing: .5px; }
#tab-proc .proc-cat:first-child, .po-cat:first-child { margin-top: 4px; }
.proc-sub { margin: 20px 0 8px; font-size: 16.5px; font-weight: 800; color: var(--ink); }
.proc-form .proc-sub:first-child, .proc-rules h3 + .proc-sub { margin-top: 8px; }
#tab-proc .proc-pick { display: block; margin: 8px 0; font-size: 14px; font-weight: 700; }

/* ---------- 卡片:所有畫面同一種外框(圓角、框線、內距);左邊色條表示狀態 ---------- */
.proc-card, .po-card, .rv-card, .ct-card, .pst-card, .pst-head, .pst-rec, .rv-batch, .proc-vr, .po-pending {
  box-sizing: border-box; margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel, #fff); }
.rv-card, .ct-card, .pst-card, .pst-head { border-left: 4px solid #98a2b3; }
.proc-card > b, .rv-card-h, .ct-card-h { font-size: 15.5px; line-height: 1.5; }
.proc-btns { display: block; margin-top: 8px; }
.proc-btns button { margin: 0 8px 6px 0; min-height: 44px; }

/* ---------- 狀態標籤:形狀一種,顏色五種(灰 = 一般、綠 = 好了、黃 = 提醒、紅 = 要處理、藍 = 資訊) ---------- */
.proc-tag, .proc-st, .rv-due, .ct-st, .pst-tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 700; line-height: 1.6; white-space: nowrap; vertical-align: middle; background: #eef1f5; color: #4b5563; }
.proc-tag { background: #e7f1fb; color: #1864ab; }
.proc-tag-store, .pst-tag-low { background: #fff4e0; color: #9a5b00; }
.proc-tag-main, .proc-st-on { background: #e6f4ea; color: #1e7b34; }
.proc-st-off { background: #eef1f5; color: #667085; }
.proc-st-note { background: #fff4e0; color: #9a5b00; }
.pst-tag-neg { background: #fdecea; color: #b42318; }

/* 已停用的資料(勾「顯示已停用」才出現):整列變淡,還原鈕照常可按 */
.proc-off td, li.proc-off .proc-loc-n, .proc-card.proc-off > b, .proc-card.proc-off > div:not(.proc-btns) { color: #98a2b3; }
.proc-off { background: #f8fafc; }
.proc-arch { margin-left: 4px; font-size: 15px; }
.proc-arch input { width: 20px; height: 20px; margin: 0 6px 0 0; vertical-align: middle; }
.proc-notice { margin: 6px 0 10px; padding: 8px 12px; border-radius: 10px; background: #fff4e0; color: #9a5b00; }
a.proc-dl { display: inline-block; min-height: 44px; line-height: 42px; padding: 0 16px; margin: 0 8px 6px 0; border: 1px solid var(--line); border-radius: 9px; background: #eef1f5; color: inherit; text-decoration: none; vertical-align: top; box-sizing: border-box; }

/* ---------- 說明字:一句話、淡色,不跟欄位標題搶 ---------- */
#tab-proc .hint, .proc-m .hint { font-size: 13px; line-height: 1.55; }
/* 表單裡欄位下方的說明:貼著上面的欄位,跟下一個欄位隔開 */
.proc-form > .hint, .proc-form > div > .hint { margin: -6px 0 14px; }
/* 欄位標題後面括號裡的補充(例:「基本單位(庫存與配方都用它)」):換到下一行、淡色小字 */
.proc-ln { display: block; margin-top: 1px; font-size: 12.5px; font-weight: 400; line-height: 1.5; color: var(--muted); }
/* 沒有資料時:說清楚是空的、下一步做什麼 */
.proc-empty { margin: 8px 0 12px; padding: 18px 14px; border: 1px dashed #cfd6e0; border-radius: 12px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6; white-space: normal; }

/* ---------- 表格:寬螢幕照表格,手機由 table-cards 變成一列一張卡 ---------- */
.proc-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.proc-table { width: 100%; border-collapse: collapse; margin: 4px 0 12px; }
.proc-table th { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.proc-table th, .proc-table td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
/* 原料清單:每個分類一張表,欄寬固定,上下對齊 */
@media (min-width: 701px) {
  .proc-mats { table-layout: fixed; }
  .proc-mats th:nth-child(1) { width: 30%; }
  .proc-mats th:nth-child(2) { width: 22%; }
  .proc-mats th:nth-child(3) { width: 18%; }
  .proc-mats th:last-child { width: 96px; }
}
.proc-audit td { min-width: 72px; }
.proc-units input { width: 100%; min-height: 44px; box-sizing: border-box; }
.proc-units button { white-space: nowrap; min-height: 44px; }

/* ---------- 數量:減號、數字、加號、單位,四個畫面同一種大小 ---------- */
.po-pm, .rv-pm { min-width: 48px; min-height: 48px; padding: 0 8px; font-size: 22px; line-height: 1; vertical-align: middle; }
.po-num, .rv-num, .ct-num { width: 72px; min-height: 48px; margin: 0 4px; text-align: center; font-size: 18px; box-sizing: border-box; vertical-align: middle; }
/* 填了數字的格子用主色框起來,一眼看出哪些已經填了(空白時顯示的 0 / ? 是提示字,不算填;沒有提示字的格子不套) */
.po-num[placeholder]:not(:placeholder-shown), .rv-num[placeholder]:not(:placeholder-shown), .ct-num[placeholder]:not(:placeholder-shown) { border-color: var(--primary); background: #fff7f0; font-weight: 700; }
.po-unit, .rv-unit { display: inline-block; min-width: 24px; margin-left: 6px; vertical-align: middle; color: var(--ink); }
.rv-usel, .ct-usel { min-height: 48px; min-width: 64px; max-width: 120px; margin-left: 4px; font-size: 16px; vertical-align: middle; }

/* ---------- 黏在畫面下緣的送出列(叫貨、點收、盤點):單手拇指按得到 ---------- */
.po-bar, .rv-bar, .ct-bar { position: -webkit-sticky; position: sticky; bottom: 0; z-index: 5; margin: 12px -2px 0; padding: 10px 10px 8px; background: var(--panel, #fff); border-top: 1px solid var(--line); border-radius: 12px 12px 0 0; box-shadow: 0 -6px 16px rgba(15, 23, 42, .1); }
.po-submit, .rv-submit, .ct-submit, .ct-big { display: block; width: 100%; min-height: 52px; font-size: 18px; }

/* ---------- 編輯視窗與表單 ---------- */
.proc-form label { display: block; margin: 0 0 12px; font-size: 14px; font-weight: 700; color: var(--ink); }
.proc-form input, .proc-form select, .proc-form textarea { display: block; width: 100%; min-height: 44px; margin-top: 4px; box-sizing: border-box; font-size: 16px; font-weight: 400; }
.proc-form button { min-height: 44px; margin: 0 8px 6px 0; }
.proc-form label.proc-check { display: inline-block; margin: 0 14px 0 0; font-size: 15px; font-weight: 400; }
.proc-form .proc-check input, .proc-vr .proc-check input, .proc-picker .proc-check input { display: inline-block; width: 20px; height: 20px; min-height: 0; margin: 0 6px 0 0; vertical-align: middle; }
.proc-check { display: inline-block; min-height: 44px; padding: 11px 0; line-height: 22px; box-sizing: border-box; margin-right: 14px; font-weight: 400; cursor: pointer; }
.proc-pair { display: flex; flex-wrap: wrap; align-items: flex-end; margin: 0 -4px; }
.proc-pair > label, .proc-pair > input, .proc-pair > button { flex: 1 1 140px; margin: 0 4px 10px; min-width: 0; }
.proc-pair > button { flex: 0 0 auto; min-height: 44px; }
.proc-pair > input { min-height: 44px; box-sizing: border-box; font-size: 16px; }
.proc-vr { padding: 4px 12px; margin: 6px 0 10px; }
.proc-vr-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.proc-vr-row:last-child { border-bottom: 0; }
.proc-vr-h { font-weight: 700; }
.proc-vr-h .proc-same { font-weight: 400; margin-left: 8px; }
.proc-vr-b select, .proc-vr-b input { display: block; width: 100%; max-width: 360px; min-height: 44px; margin-top: 4px; box-sizing: border-box; font-size: 16px; }
.proc-vr-b input[type="checkbox"] { display: inline-block; width: 20px; height: 20px; min-height: 0; }
.proc-vr-b .proc-pair > input { max-width: none; }
.proc-wd { margin-right: 8px; }
.proc-dates { margin: 4px 0; }
.proc-chip { display: inline-block; padding: 4px 10px; margin: 0 6px 6px 0; border-radius: 999px; background: #eef1f5; line-height: 28px; font-weight: 400; }
.proc-x { min-width: 44px; min-height: 44px; margin: -8px -10px -8px 0; padding: 0; border: 0; background: transparent; cursor: pointer; }
.proc-uses .proc-chip { background: #e7f1fb; }
.proc-picker { border: 1px solid var(--line); border-radius: 12px; padding: 4px 10px; margin: 4px 0 8px; max-height: 320px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.proc-pk-cat { padding: 4px 0; border-bottom: 1px solid var(--line); }
.proc-pk-cat:last-child { border-bottom: 0; }
.proc-ex summary { min-height: 44px; line-height: 44px; cursor: pointer; color: var(--accent, #1971c2); font-weight: 700; }
.proc-list { margin: 6px 0; padding-left: 18px; }
.proc-list li { margin: 0 0 6px; }
.proc-locs { max-width: 640px; padding-left: 0; list-style: none; }
.proc-locs li { margin: 0; padding: 4px 0; border-bottom: 1px solid var(--line); }
.proc-locs li.hint { padding: 10px 0; }
.proc-locs + .proc-pair { max-width: 648px; }
.proc-loc-n { display: inline-block; min-width: 120px; margin-right: 8px; line-height: 44px; font-weight: 700; }
.proc-locs .proc-btns { display: inline-block; margin-top: 0; }
.proc-try { border: 1px dashed #cfd6e0; border-radius: 12px; padding: 8px 12px; max-width: 640px; }
.proc-try-out { margin-top: 6px; }
.proc-try-ok { color: #1e7b34; font-weight: 700; }
.proc-try-bad { color: #b42318; font-weight: 700; }
.proc-m > h3 { margin: 0 0 14px; }
.proc-m h3 .proc-tag, .proc-m h3 .proc-st { vertical-align: middle; }
.proc-m button { min-height: 44px; }
.proc-m .pv-c, .proc-m .pv-send { border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; margin: 0 0 10px; }
.proc-m .m-actions button { margin: 0 0 6px 8px; }
/* 叫貨規則(公司設定)與廠商的「給廠商傳單」 */
.proc-rules { max-width: 600px; }
.proc-rules h3 { margin: 0 0 6px; }
.proc-rules .m-actions button { margin: 4px 0 0; }

/* 從舊員工系統匯入:名單(收合)、按鈕旁的數量句(跟確認框同一句) */
.proc-imp-lists { margin: 12px 0; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.proc-imp-lists > summary { cursor: pointer; font-weight: 700; min-height: 44px; line-height: 44px; }
.proc-imp-lists textarea { min-height: 72px; }
.proc-imp-n { display: inline-block; margin: 0 12px 6px 0; vertical-align: middle; font-weight: 700; color: var(--ink); }

/* 原料視窗:少用的欄位收在「其他設定」;剛新增完的「下一步」 */
.proc-more { margin: 10px 0 4px; border-top: 1px solid var(--line, #e3e7ee); }
.proc-more > summary { cursor: pointer; min-height: 44px; padding: 10px 0; font-weight: 700; font-size: 15px; line-height: 1.5; }
.proc-more > summary small { display: block; font-weight: 400; font-size: 13px; color: var(--muted, #6a7180); }
.proc-next { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: #f3f8f2; border: 1px solid #cfe5cc; font-weight: 700; line-height: 1.6; }
.proc-next button { min-height: 44px; margin: 6px 0 0; }
.proc-next small { display: block; font-weight: 400; color: var(--muted, #6a7180); margin-top: 4px; }

/* 廠商:這家供應哪些原料(一次勾、填價格) */
.pv-mats td { vertical-align: middle; }
.pv-mats select, .pv-mats input[data-pv-price] { min-height: 44px; font-size: 16px; }
.pv-mats input[data-pv-price] { width: 110px; }
.pv-mats select { min-width: 96px; }
/* 送貨條件:少用的收在「其他送貨條件」 */
.proc-vr-more { margin: 4px 0 0; }
.proc-vr-more > summary { cursor: pointer; min-height: 44px; padding: 10px 0; font-weight: 700; font-size: 15px; line-height: 1.5; }
.proc-vr-more > summary small { display: block; font-weight: 400; font-size: 13px; color: var(--muted, #6a7180); }
/* 進階設定:每一張卡點標題打開 */
.prs-acc > summary { cursor: pointer; list-style: none; min-height: 44px; }
.prs-acc > summary::-webkit-details-marker { display: none; }
.prs-acc > summary h4 { display: inline-block; margin-right: 8px; }
.prs-acc > summary h4::before { content: '▸ '; color: var(--muted, #6a7180); }
.prs-acc[open] > summary h4::before { content: '▾ '; }
.prs-acc:not([open]) > summary .prs-ex { margin-bottom: 0; }
