/* ─────────────────────────────────────────────────────────────────────────
   後台共用設計系統。
   原本叫 product-admin.css，但它裝的是全後台共用的東西（色票變數、按鈕、
   輸入框、卡片、表格、頂端標題列、手機卡片式版面），不是商品頁專屬，
   所以正名成 admin-ui.css。每個後台頁面載入這一份，再各自載入自己的
   <頁名>-admin.css 放該頁特有的樣式。
   ───────────────────────────────────────────────────────────────────────── */
/* 新版產品管理樣式，從設計稿抽出來獨立成檔（設計稿原本整包內嵌在 .cshtml 裡）。
   相對設計稿修掉四個 Mike 實測抓到的問題：
   1. #productTable 改 table-layout:fixed + 明確欄寬（不再讓瀏覽器依內容自動決定寬度，短字串就不會被擠壓換行）
   2. 拿掉塞進「口味」欄的「已下架」badge——狀態本來就有自己的「上架狀態」欄（桌機是獨立欄位，手機版也排在系列/口味後面第三順位），沒必要在口味欄再擠一次
   3. .actions-cell 加 align-items:center，讓編輯／複製按鈕跟著列高垂直置中
   4. .table-wrap 拿掉會撐開容器的 min-width，1440px 下 14 欄改用固定百分比欄寬，不需要橫向捲動
*/
:root{
  /* 中性灰階為主體，全站只有一個彩色（赤陶橘）：它出現在哪裡就代表「這裡要注意」。
     綠色只在存檔成功、紅色只在刪除與錯誤，畫面上不存在第三種彩色。 */
  --primary:#b4530e;
  --primary-dark:#8c3f0a;
  --primary-light:#f6ede4;
  --danger:#a3231b;
  --danger-light:#f7eae9;
  /* 進行中／處理中屬於中性狀態，不配色，避免變成第三種彩色 */
  --warn:#6e6e67;
  --warn-light:#efefeb;
  --success:#2e6a41;
  --success-light:#e9f1eb;
  /* --bg 是頁面底、--surface 是卡片與表格面。這一版兩者同為白色，靠線與留白分層而不是靠底色深淺；
     它們仍然是兩個 token，因為改配色時「頁面底」與「內容面」是各自獨立的決定。 */
  --bg:#ffffff;
  --surface:#ffffff;
  --surface-2:#f7f7f5;
  --surface-3:#efefeb;
  --border:#e0e0da;
  --border-strong:#c7c7c0;
  --text:#141413;
  --text-muted:#6e6e67;
  --text-faint:#9a9a92;
  /* 分區改用線與留白，不用浮起來的圓角卡片，所以圓角一律收到近乎方角 */
  --radius:2px;
  --rule-heavy:2px solid var(--text);
  --fs-base:16px;
  --fs-md:18px;
  --fs-lg:20px;
  --fs-xl:24px;
  --fs-2xl:28px;
}
.pa-scope,.pa-scope *,.pa-scope *::before,.pa-scope *::after{box-sizing:border-box;}
.pa-scope{
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang TC","Microsoft JhengHei","Noto Sans TC",sans-serif;
  /* 這個站的 wwwroot/Content/bootstrap.css 把 html 的 font-size 定成 10px（不是瀏覽器預設的 16px），
     這個頁面只是額外連結它、不會去改它，所以整份樣式表一律不用 rem（rem 永遠對齊 html 根字級，會變成
     10px 為底、跌破 16px 下限），改用 px／em——em 是對齊「元素自己算出來的字級」，只要這裡先給一個
     px base，子層的 em 就會照正常的 cascade 往下算，不會被 html 的 10px 綁架。 */
  font-size:var(--fs-base);
  line-height:1.55;
}
.pa-scope h1,.pa-scope h2,.pa-scope h3,.pa-scope h4{margin:0 0 .5em;font-weight:700;}
.pa-scope h3{font-size:var(--fs-lg);}
.pa-scope button,.pa-scope input,.pa-scope select,.pa-scope textarea{font-family:inherit;font-size:16px;color:inherit;}
.pa-scope button{cursor:pointer;}
.pa-scope p{margin:0 0 .5em;}
.pa-scope input:focus-visible,.pa-scope select:focus-visible,.pa-scope textarea:focus-visible,.pa-scope button:focus-visible{
  outline:2px solid var(--primary);outline-offset:1px;box-shadow:none;
}

/* ---------- layout ---------- */
.pa-topbar{
  position:sticky;top:0;z-index:60;
  background:var(--surface);color:var(--text);
  padding:14px 24px;
  display:flex;align-items:center;gap:16px;flex-wrap:wrap;
  border-bottom:var(--rule-heavy);
  margin:-16px -16px 20px;
}
.pa-brand{font-size:var(--fs-lg);font-weight:700;letter-spacing:.06em;display:flex;align-items:center;gap:8px;white-space:nowrap;}
.pa-brand .paw{font-size:var(--fs-xl);}
.pa-brand small{display:block;font-weight:400;font-size:16px;color:var(--text-muted);letter-spacing:normal;}
.pa-topbar-meta{color:var(--text-muted);margin-left:auto;white-space:nowrap;}
.pa-main{padding:0 4px 32px;max-width:1520px;margin:0 auto;width:100%;}

/* _Layout 共用的 wwwroot/css/menu/demo.css 有一條全站套用的 .content{margin:0 0 0 300px}。
   那 300px 不是裝飾：這個後台的選單是「常駐」的固定側邊欄（position:fixed;left:0;width:300px），
   不是點了才滑出來的抽屜。把這個 margin 拿掉，內容就會整個被選單蓋住（舊版商品頁保留 300px 就是證明）。

   原本會橫向捲動是因為 bootstrap.css 把 .container 寫死 width:1170px，
   300px + 1170px = 1470px 超過 1440px 版面。正解是放掉那個寫死的寬度讓內容自適應，
   而不是把側邊欄的留白拿掉。表格本身寬度不夠時由 .table-wrap 自己橫向捲動，
   頁面層級不會出現橫向捲軸。

   demo.css 在 max-width:40em 會把 margin 收回 0（手機沒有側邊欄），
   但這裡的選擇器權重比它高，所以要自己再寫一次那個斷點。 */
.container.body-content.content{
  margin-left:300px;margin-right:0;
  width:auto;max-width:none;
  padding-left:16px;padding-right:16px;
}

@media screen and (max-width:40em){
  .container.body-content.content{margin-left:0;padding-left:8px;padding-right:8px;}
}

/* ---------- icons ---------- */
/* emoji 當圖示會隨作業系統與瀏覽器長得不一樣、列印也印不出來，而且是全彩的——在這套灰階配色裡
   它會變成畫面上唯一的異物。一律換成線性 SVG，用 currentColor 跟著所在文字的顏色走。 */
.pa-scope .icn{width:1.15em;height:1.15em;flex:none;vertical-align:-.2em;}
.pa-scope .pa-brand .paw{display:inline-flex;align-items:center;}
.pa-scope .pa-brand .paw .icn{width:26px;height:26px;}
.pa-scope .big-icon .icn,.pa-scope .dz-icon .icn{width:32px;height:32px;}
.pa-scope .drag-handle .icn{width:20px;height:20px;}

/* ---------- buttons ---------- */
.pa-scope .btn{
  display:inline-flex;align-items:center;gap:6px;
  background:var(--surface);color:var(--text);border:1px solid var(--border-strong);
  border-radius:var(--radius);padding:10px 16px;font-weight:700;white-space:nowrap;
  transition:background .12s,border-color .12s,transform .06s;
  /* 驗這次改動時量到「編輯」連結只有 12px：.btn 是 <a> 不是 <button>，
     吃不到前面 .pa-scope button,input... 那條字級規則，落到 bootstrap.css 的
     .btn-sm{font-size:12px} / .btn{font-size:14px}（跟這頁全站共用、不能動那個檔）。
     這裡補一條 class 選擇器（specificity 0,2,0）蓋掉 bootstrap 的 0,1,0，全站硬規則
     字級不得低於 16px，「編輯」「複製」「開啟舊版」等連結型按鈕都在這條管到。 */
  font-size:16px;
}
.pa-scope .btn:hover{background:var(--surface-2);border-color:var(--text-muted);}
.pa-scope .btn:active{transform:none;background:var(--surface-3);}
.pa-scope .btn:disabled{opacity:.45;cursor:not-allowed;background:var(--surface-2);}
.pa-scope .btn-primary{background:var(--primary);border-color:var(--primary);color:var(--surface);}
.pa-scope .btn-primary:hover{background:var(--primary-dark);border-color:var(--primary-dark);}
.pa-scope .btn-primary:disabled{background:var(--border-strong);border-color:var(--border-strong);}
.pa-scope .btn-ghost{background:transparent;border-color:transparent;}
.pa-scope .btn-ghost:hover{background:var(--surface-2);}
.pa-scope .btn-danger{background:var(--surface);border-color:var(--danger);color:var(--danger);}
.pa-scope .btn-danger:hover{background:var(--danger-light);border-color:var(--danger);}
.pa-scope .btn-sm{padding:5px 10px;}
/* 表格動作欄的按鈕若維持 40px 高，會取代合併欄成為新的列高下限 */
.pa-scope .actions-cell .btn{padding:6px 12px;}
.pa-scope .btn-block{width:100%;justify-content:center;}
.pa-scope .link-btn{background:none;border:none;border-bottom:1px solid transparent;color:var(--text-muted);font-weight:400;text-decoration:none;padding:0;}
.pa-scope .link-btn:hover{color:var(--primary);border-bottom-color:var(--primary);}

.pa-topbar .btn-ghost{color:var(--text-muted);border-color:var(--border-strong);}
.pa-topbar .btn-ghost:hover{background:var(--surface-2);color:var(--text);}

.pa-scope input[type=text],.pa-scope input[type=number],.pa-scope input[type=search],.pa-scope input[type=date],.pa-scope input[type=datetime-local],.pa-scope input[type=email],.pa-scope input[type=password],.pa-scope select,.pa-scope textarea{
  border:1px solid var(--border-strong);border-radius:var(--radius);padding:9px 12px;
  background:var(--surface);width:100%;
  /* wwwroot/Content/Site.css 有一條全站 input,select,textarea{max-width:280px}。
     這裡的欄位寬度是由外層 grid 的欄寬決定的，那個 280px 上限會讓跨欄欄位（簡述、原料成分）
     只長到 280px，跟旁邊的欄位對不齊。權重夠但沒宣告 max-width 就蓋不掉，所以要明確解除。 */
  max-width:none;
}
.pa-scope textarea{resize:vertical;line-height:1.5;}
.pa-scope input:disabled{background:var(--surface-2);color:var(--text-muted);}
.pa-scope .field-hint{font-size:16px;color:var(--text-faint);}
.pa-scope .input-error{border-color:var(--danger) !important;background:var(--danger-light) !important;}

/* ---------- switches (pill toggle) ---------- */
.pa-scope .switch{
  display:inline-flex;align-items:center;gap:8px;border:1px solid var(--border-strong);border-radius:var(--radius);
  padding:7px 14px 7px 8px;background:var(--surface-2);font-weight:400;color:var(--text-muted);min-width:104px;
  transition:.15s;
}
.pa-scope .switch .dot{width:14px;height:14px;border-radius:0;background:var(--surface);border:1px solid var(--border-strong);flex-shrink:0;transition:.15s;position:relative;}
.pa-scope .switch.on{background:var(--surface);border-color:var(--border-strong);color:var(--text);font-weight:700;}
.pa-scope .switch.on .dot{background:var(--primary);border-color:var(--primary);}
.pa-scope .switch.on.danger-on{background:var(--danger-light);border-color:var(--danger);color:var(--danger);}
.pa-scope .switch.on.danger-on .dot{background:var(--danger);border-color:var(--danger);}
/* .switch.small 目前只有表格「上架狀態」「禁止加購」兩欄在用（Edit.cshtml 是純 .switch，沒有 .small），
   縮 min-width 只影響這兩欄，不會波及編輯頁。96px 縮到 90px：文字＋圓點＋padding 實測底線約 88px，
   90px 留 2px 緩衝，剛好省下的空間夠補去單價／庫存那幾欄。 */
.pa-scope .switch.small{min-width:90px;padding:5px 10px 5px 6px;font-size:16px;}
.pa-scope .switch.small .dot{width:12px;height:12px;}

.pa-scope .toggle-switch{display:inline-flex;align-items:center;gap:10px;cursor:pointer;}
.pa-scope .toggle-switch input{position:absolute;opacity:0;width:1px;height:1px;}
.pa-scope .toggle-track{width:50px;height:28px;border-radius:var(--radius);background:var(--border-strong);position:relative;transition:.15s;flex-shrink:0;}
.pa-scope .toggle-switch input:checked + .toggle-track{background:var(--primary);}
.pa-scope .toggle-switch.danger input:checked + .toggle-track{background:var(--danger);}
.pa-scope .toggle-thumb{position:absolute;top:3px;left:3px;width:22px;height:22px;border-radius:1px;background:var(--surface);transition:.15s;}
.pa-scope .toggle-switch input:checked + .toggle-track .toggle-thumb{transform:translateX(22px);}
.pa-scope .toggle-text{font-weight:700;}

/* 分類欄是壓縮優先欄位，tag 自己加 ellipsis：分類欄可能比 tag 的完整寬度窄，
   讓 tag 自己截字比讓外層 td 硬切掉一角乾淨（不會切到 border 中間變成一塊破圖） */
.pa-scope .tag{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;background:var(--surface-2);border:1px solid var(--border);border-radius:var(--radius);padding:0 8px;color:var(--text-muted);font-weight:400;white-space:nowrap;vertical-align:middle;}
.pa-scope .badge-count{background:var(--surface-3);color:var(--text);border:1px solid var(--border-strong);border-radius:var(--radius);padding:0 8px;margin-left:6px;font-variant-numeric:tabular-nums;}

/* ---------- list view ---------- */
.pa-scope .stat-row{display:flex;gap:12px;flex-wrap:wrap;margin-bottom:16px;}
.pa-scope .stat-chip{background:none;border:0;border-left:3px solid var(--border-strong);border-radius:0;padding:2px 20px;display:flex;flex-direction:column;min-width:126px;}
.pa-scope .stat-chip .num{font-size:var(--fs-xl);font-weight:700;font-variant-numeric:tabular-nums;}
.pa-scope .stat-chip .lbl{color:var(--text-muted);}
.pa-scope .stat-chip.warn .num{color:var(--text-muted);}
.pa-scope .stat-chip.danger{border-left-color:var(--danger);}
.pa-scope .stat-chip.danger .num{color:var(--danger);}
/* 主色只給「現在有東西在跑、值得看一眼」的那一格；原本是各頁自己寫 style="color:var(--primary-dark)"，
   於是「上架中 20」「可使用 32」這種正常狀態也被塗成橘色，跟真正要注意的「缺貨 49」搶同一個顏色。
   數值為 0 時更不該上色——首頁置頂圖那頁四格全 0，卻有一格橘色的 0 在喊人。 */
.pa-scope .stat-chip.accent{border-left-color:var(--primary);}
.pa-scope .stat-chip.accent .num{color:var(--primary-dark);}
.pa-scope .stat-chip.muted .num{color:var(--text-muted);}
.pa-scope .stat-chip.zero .num{color:var(--text-faint);}

.pa-scope .toolbar{
  display:flex;flex-wrap:wrap;gap:10px;align-items:center;
  background:none;border:0;border-bottom:1px solid var(--border);border-radius:0;
  padding:0 0 14px;margin-bottom:14px;
}
/* 解除全站 max-width:280px 是為了讓跨欄的多行輸入框長到該有的寬度；但搜尋框是工具列裡唯一
   會 flex-grow 的項目，沒有上限的話在篩選項目少的頁面會被撐成一條佔滿整列的單行輸入框。 */
.pa-scope .search-wrap{position:relative;flex:1 1 240px;min-width:200px;max-width:420px;}
.pa-scope .search-wrap input{padding-left:36px;}
.pa-scope .search-wrap .icon{position:absolute;left:11px;top:50%;transform:translateY(-50%);opacity:.55;}
.pa-scope .toolbar select{width:auto;min-width:150px;}
.pa-scope .chip-toggle{
  display:inline-flex;align-items:center;gap:6px;padding:9px 14px;border-radius:var(--radius);
  border:1px solid var(--border-strong);background:var(--surface-2);cursor:pointer;user-select:none;font-weight:700;color:var(--text-muted);
  white-space:nowrap;
}
.pa-scope .chip-toggle input{accent-color:var(--danger);width:17px;height:17px;}
.pa-scope .chip-toggle.active{background:var(--danger-light);border-color:var(--danger);color:var(--danger);}
.pa-scope .toolbar-actions{margin-left:auto;display:flex;gap:10px;}
.pa-scope .hint-line{color:var(--text-muted);margin:0 0 12px;}
.pa-scope .result-count{color:var(--text-muted);margin:0 0 10px;}

/* table-wrap 拿掉 min-width 撐開行為，讓 100% 寬 + fixed layout 的表格自己決定要不要捲動 */
/* 表格容器原本是 overflow:auto + max-height:72vh，等於在頁面中間開一個 648px 高的獨立捲動視窗：
   畫面上會有兩層捲軸（頁面一層、表格一層），表格下緣停在半途、被切到的那一列只露出上半截，
   下面再留一段白。改成不自己捲動、整頁一起捲，表頭則改成黏在頂欄（75px 高）下面——
   捲到第 300 列時欄位名稱仍在畫面上，而且畫面邊界就是內容邊界，不會再有「切一半」的觀感。
   欄寬是百分比＋table-layout:fixed，表格永遠等於容器寬度，拿掉 overflow 不會產生橫向捲動。 */
.pa-scope .table-wrap{border:0;border-radius:0;background:var(--surface);overflow:visible;max-height:none;}
.pa-scope table{width:100%;border-collapse:collapse;table-layout:fixed;}
.pa-scope thead th{
  position:sticky;top:75px;background:var(--surface);z-index:5;
  text-align:left;padding:10px 8px;font-weight:700;color:var(--text-muted);letter-spacing:.06em;
  border-bottom:var(--rule-heavy);white-space:nowrap;cursor:pointer;user-select:none;
  overflow:hidden;text-overflow:ellipsis;
}
.pa-scope thead th.nosort{cursor:default;}
.pa-scope thead th:hover{color:var(--text);}
.pa-scope thead th.sorted{color:var(--primary);}
/* 沒有在排序的欄位，箭頭 span 是空的：留著 margin 只會白佔 4px——「產品線」這個 3 字表頭
   算出來需要 54.9px、欄寬只有 54.7px，就是被這 4px 擠成「產品...」。 */
.pa-scope .sort-arrow{margin-left:4px;color:var(--primary);}
.pa-scope .sort-arrow:empty{margin-left:0;}
.pa-scope tbody td{padding:5px 8px;line-height:1.35;border-bottom:1px solid var(--border);vertical-align:middle;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.pa-scope tbody tr:nth-child(even) td{background:var(--surface-2);}
.pa-scope tbody tr.product-row:hover td{background:var(--primary-light);}
/* 停用的列改「文字降階＋首欄色條」，不用整列半透明：半透明會讓輸入框內的數字一起變淡到難讀 */
.pa-scope tbody tr.product-row.row-inactive td{color:var(--text-faint);}
.pa-scope tbody tr.product-row.row-inactive td:first-child{box-shadow:inset 3px 0 0 0 var(--border-strong);}
.pa-scope tbody tr.row-flash{animation:paRowFlash 1.3s ease;}
@keyframes paRowFlash{0%{background:var(--success-light);}100%{background:transparent;}}
.pa-scope .mono{font-variant-numeric:tabular-nums;}
.pa-scope .thumb{
  /* 縮圖是 14 欄裡優先度最低的一欄（純裝飾、不影響操作），1440px 版面欄寬吃緊時第一個縮：
     44px 改 34px，省下的寬度讓給單價／一箱價格／庫存／排序這四個要編輯的數字欄。 */
  width:34px;height:34px;border-radius:0;border:1px solid var(--border-strong);display:flex;align-items:center;justify-content:center;
  color:var(--surface);font-weight:700;flex-shrink:0;background-size:cover;background-position:center;
}
.pa-scope .cell-series{font-weight:700;}
.pa-scope .cell-flavor{color:var(--text-muted);}
/* cell-input 改成填滿欄寬（不是寫死 92px），欄寬由 <colgroup> 決定，兩邊不會打架撐出橫向捲動 */
.pa-scope input.cell-input{width:100%;min-width:0;padding:4px 6px;-moz-appearance:textfield;border:1px solid transparent;border-bottom:1px solid var(--border-strong);border-radius:0;background:transparent;text-align:right;font-weight:400;font-variant-numeric:tabular-nums;}
.pa-scope input.cell-input.cell-input-sm{width:100%;}
/* 1440px 下每欄能分到的寬度有限，數字輸入框的原生上下箭頭（spin button）在 Chromium 會佔掉約 20px，
   四位數（2700／999）在窄欄位下就是被這塊擠掉才只剩一位數。這裡拿掉箭頭，騰出的寬度全部還給數字本身；
   欄位本來就是用滑鼠點進去直接打字修改，不靠箭頭增減，拿掉不影響操作。 */
.pa-scope input.cell-input::-webkit-outer-spin-button,
.pa-scope input.cell-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}
.pa-scope input.cell-input:hover{border-color:var(--border-strong);background:var(--surface);}
.pa-scope input.cell-input:focus-visible{border:1px solid var(--primary);border-bottom-width:2px;background:var(--surface);outline:none;}
/* .cell-input 的 text-align:right 是為了讓表格裡上下相鄰的金額／數量對齊個位數；
   但展覽列表把同一個 class 用在展覽公司／地點／攤位這些文字欄上，短名稱（「展昭」）就會
   靠在欄位最右邊、跟左邊的欄位標題對不上。文字型的欄位改回靠左，數字維持靠右。 */
.pa-scope input.cell-input[type=text]{text-align:left;}
.pa-scope input.cell-input.input-danger{color:var(--danger);border-color:var(--danger);background:var(--danger-light);}
.pa-scope input.cell-input.cell-saved{border-bottom-color:var(--success);border-bottom-width:2px;}
/* 存檔指示器平時不佔位。原本每個數字欄都固定留 16px + 4px margin 給它，四個欄位等於
   白白吃掉 80px；表格總寬只有 1098px，這 80px 正是「產品線／分類／系列」被截字的原因。
   改成絕對定位疊在輸入框右側，只有存檔中與成功那一秒才看得到。 */
.pa-scope tbody td{position:relative;}
.pa-scope .save-indicator{
  position:absolute;right:6px;top:50%;transform:translateY(-50%);
  width:16px;height:16px;display:inline-flex;align-items:center;justify-content:center;
  margin:0;pointer-events:none;
}
.pa-scope .save-indicator .spin{width:14px;height:14px;border:2px solid var(--border);border-top-color:var(--text-muted);border-radius:50%;display:inline-block;animation:paSpin .6s linear infinite;}
.pa-scope .save-indicator .check{color:var(--success);font-weight:700;opacity:0;animation:paPopCheck 1s ease forwards;}
@keyframes paSpin{to{transform:rotate(360deg);}}
@keyframes paPopCheck{0%{opacity:0;transform:scale(.5);}20%{opacity:1;transform:scale(1.15);}70%{opacity:1;transform:scale(1);}100%{opacity:0;}}
/* 庫存欄的欄寬只夠放輸入框本身，警示圖示接在後面會被 td 的 overflow:hidden 切掉。
   輸入框的數字是靠右對齊的，左側那塊空白永遠空著，把圖示疊上去不佔欄寬也不擋操作。 */
.pa-scope .stock-flag{
  position:absolute;left:10px;top:50%;transform:translateY(-50%);
  margin:0;pointer-events:none;color:var(--danger);line-height:0;
}
.pa-scope .stock-flag .icn{width:17px;height:17px;vertical-align:middle;}
/* 修掉編輯／複製按鈕沒有跟列垂直置中：align-items:center 讓 flex 子項在這個 td 的完整列高中置中 */
/* 動作欄原本是 display:flex 的 <td>。td 一旦不是 table-cell，它的下框線就不再跟同列其他儲存格
   對齊（實測整條列的分隔線走到動作欄會往下錯開幾 px），而且裡面的按鈕不會換行、只會整顆溢出
   儲存格外被裁掉（折價券的「刪除」就是這樣整顆不見的）。改回一般儲存格＋行內排列：
   垂直置中交給 td 本來就有的 vertical-align:middle。 */
.pa-scope .actions-cell{white-space:nowrap;font-size:0;}
/* font-size:0 是為了吃掉標記裡按鈕之間的換行空白（三顆按鈕的折價券欄會因此多佔十幾 px 而被裁到）；
   按鈕間距改由下面的 margin-left 提供，字級由 .btn 自己的 16px 還原。 */
.pa-scope .actions-cell > *{vertical-align:middle;font-size:16px;}
.pa-scope .actions-cell > * + *{margin-left:8px;}
.pa-scope .empty-row td{padding:44px 16px;text-align:center;color:var(--text-muted);white-space:normal;}
.pa-scope .empty-row .big-icon{font-size:var(--fs-2xl);display:block;margin-bottom:6px;}
.pa-scope .skeleton-row td{padding:12px 10px;}
.pa-scope .skeleton-bar{height:16px;border-radius:0;background:linear-gradient(90deg,var(--surface-3) 25%,var(--surface-2) 37%,var(--surface-3) 63%);background-size:400% 100%;animation:paShimmer 1.4s ease infinite;}
@keyframes paShimmer{0%{background-position:100% 0;}100%{background-position:0 0;}}

.pa-scope .fab-add{display:none;}

/* ---------- editor view ---------- */
.pa-editor-header{
  position:sticky;top:60px;z-index:40;background:var(--bg);
  display:flex;align-items:center;gap:16px;flex-wrap:wrap;padding:10px 0 16px;
}
.pa-editor-header-inner{
  display:flex;align-items:center;gap:16px;flex-wrap:wrap;width:100%;
  background:var(--surface);border:0;border-bottom:1px solid var(--border-strong);border-radius:0;padding:10px 0 14px;
}
.pa-scope .editor-title{display:flex;align-items:baseline;gap:10px;font-size:var(--fs-lg);font-weight:700;flex:1 1 240px;min-width:0;}
.pa-scope .editor-title span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.pa-scope .id-badge{font-size:16px;font-weight:400;color:var(--text-muted);background:none;border:1px solid var(--border);padding:2px 8px;border-radius:var(--radius);flex-shrink:0;font-variant-numeric:tabular-nums;}
.pa-scope .editor-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center;}

.pa-scope .editor-tabs{display:flex;gap:0;border-bottom:1px solid var(--border-strong);margin-bottom:22px;overflow-x:auto;}
.pa-scope .tab-btn{
  background:transparent;border:none;padding:12px 18px;font-weight:400;color:var(--text-muted);letter-spacing:.04em;
  border-bottom:2px solid transparent;margin-bottom:-1px;white-space:nowrap;text-decoration:none;display:inline-block;
}
.pa-scope .tab-btn.active{color:var(--text);font-weight:700;border-bottom-color:var(--primary);}
.pa-scope .tab-btn:hover{color:var(--text);}
.pa-scope .tab-panel{display:none;}
.pa-scope .tab-panel.active{display:block;}

.pa-scope .form-error-banner{
  display:none;background:var(--danger-light);color:var(--danger);border:0;border-left:4px solid var(--danger);
  border-radius:0;padding:10px 14px;margin-bottom:16px;font-weight:700;
}
.pa-scope .form-message{background:var(--success-light);color:var(--success);border:0;border-left:4px solid var(--success);border-radius:0;padding:10px 14px;margin-bottom:16px;font-weight:700;}
.pa-scope .form-message.err{background:var(--danger-light);color:var(--danger);border-left-color:var(--danger);}

.pa-scope fieldset{border:0;border-top:var(--rule-heavy);border-radius:0;padding:16px 0 26px;margin:0 0 4px;background:none;}
.pa-scope legend{font-weight:700;padding:0 12px 0 0;color:var(--text);font-size:var(--fs-md);letter-spacing:.06em;}
.pa-scope legend .hint{font-weight:400;color:var(--text-muted);font-size:16px;letter-spacing:normal;}
.pa-scope .form-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:16px;}
.pa-scope .form-grid.cols-3{grid-template-columns:repeat(3,1fr);}
.pa-scope .form-field{display:flex;flex-direction:column;gap:6px;}
.pa-scope .form-field.full{grid-column:1/-1;}
.pa-scope .form-field label{font-weight:400;color:var(--text-muted);}
.pa-scope .nutrition-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:14px;}
.pa-scope .switch-row{display:flex;flex-wrap:wrap;gap:26px;align-items:flex-start;}
.pa-scope .switch-field{display:flex;flex-direction:column;gap:6px;}
.pa-scope .switch-row-note{margin-top:14px;}

/* 跨整列的單行輸入框（標題、GoogleMap 連結、SEO 關鍵字這一類）原本會長到 1100px：
   一行文字拉這麼寬，游標跑到哪裡都要找。textarea 不在此限——多行內容本來就需要寬。
   選擇器帶 .full 才蓋得過前面那條解除 Site.css 280px 上限的 max-width:none。 */
.pa-scope .form-field.full > input[type=text],
.pa-scope .form-field.full > input[type=email],
.pa-scope .form-field.full > input[type=number],
.pa-scope .form-field.full > input[type=search]{max-width:760px;}

/* ---------- image manager ---------- */
.pa-scope .img-tip{margin:0 0 16px;color:var(--text-muted);background:none;border:0;border-left:3px solid var(--border-strong);border-radius:0;padding:2px 14px;}
.pa-scope .dropzone{
  border:1px dashed var(--border-strong);border-radius:var(--radius);background:var(--surface-2);
  padding:32px 18px;text-align:center;cursor:pointer;transition:.15s;margin-bottom:16px;
}
.pa-scope .dropzone:hover,.pa-scope .dropzone.drag-active{border-color:var(--primary);background:var(--primary-light);}
.pa-scope .dropzone strong{color:var(--text);}
.pa-scope .dropzone .dz-icon{font-size:var(--fs-2xl);display:block;margin-bottom:6px;}
.pa-scope .dropzone .dz-sub{color:var(--text-muted);margin-top:6px;}

.pa-scope .upload-queue{display:flex;flex-direction:column;gap:10px;margin-bottom:6px;}
.pa-scope .upload-item{border:1px solid var(--border);border-radius:var(--radius);padding:10px 14px;background:var(--surface);}
.pa-scope .upload-item-name{font-weight:700;margin-bottom:6px;}
.pa-scope .upload-item-bar{height:6px;border-radius:0;background:var(--border);overflow:hidden;}
.pa-scope .upload-item-bar-fill{height:100%;background:var(--primary);width:0;transition:width .2s;}
.pa-scope .upload-item-status{color:var(--text-muted);margin-top:6px;}
.pa-scope .upload-item-error{border-color:var(--danger);background:var(--danger-light);}
.pa-scope .upload-item-error .upload-item-bar-fill{background:var(--danger);}
.pa-scope .upload-item-error .upload-item-status{color:var(--danger);font-weight:700;}
.pa-scope .upload-item-actions{margin-top:8px;}

.pa-scope .image-list{display:flex;flex-wrap:wrap;gap:16px;margin-top:18px;}
.pa-scope .image-empty{color:var(--text-muted);padding:24px;text-align:center;width:100%;border:1px dashed var(--border);border-radius:var(--radius);}
.pa-scope .image-card{
  width:180px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);
  padding:8px;position:relative;cursor:grab;transition:border-color .15s;
}
.pa-scope .image-card.dragging{opacity:.4;}
.pa-scope .image-card.drag-over{border-color:var(--primary);border-width:2px;padding:7px;}
.pa-scope .image-card.error-card{border-color:var(--danger);background:var(--danger-light);}
.pa-scope .image-card .thumb-square{width:100%;height:128px;border-radius:0;object-fit:cover;display:block;background:var(--surface-2);}
.pa-scope .image-card-drag{position:absolute;top:9px;left:9px;background:var(--text);color:var(--surface);border-radius:0;padding:1px 6px;font-size:16px;}
.pa-scope .image-main-badge{position:absolute;top:9px;right:9px;background:var(--primary);color:var(--surface);font-weight:700;padding:2px 9px;border-radius:0;}
.pa-scope .image-order-badge{position:absolute;bottom:78px;right:9px;background:var(--text);color:var(--surface);font-weight:400;padding:1px 7px;border-radius:0;font-variant-numeric:tabular-nums;}
.pa-scope .image-card-name{margin-top:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:700;}
.pa-scope .image-card-status{margin-top:2px;color:var(--text-muted);}
.pa-scope .image-card-status.status-processing{color:var(--text-muted);display:flex;align-items:center;gap:6px;}
.pa-scope .image-card-status.status-error{color:var(--danger);font-weight:700;}
.pa-scope .image-card-del{margin-top:8px;width:100%;padding:7px;border:1px solid var(--danger);color:var(--danger);background:var(--surface);border-radius:var(--radius);font-weight:400;}
.pa-scope .image-card-del:hover{background:var(--danger-light);}
.pa-scope .spinner{width:14px;height:14px;border:2px solid var(--border-strong);border-top-color:transparent;border-radius:50%;display:inline-block;animation:paSpin .8s linear infinite;}

/* ---------- description tab ---------- */
.pa-scope .desc-actions{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px;flex-wrap:wrap;gap:10px;}
.pa-scope .desc-hint{color:var(--text-muted);}
.pa-scope .desc-toolbar{display:flex;flex-wrap:wrap;gap:6px;border:1px solid var(--border-strong);border-bottom:none;border-radius:var(--radius) var(--radius) 0 0;background:var(--surface-2);padding:9px;}
.pa-scope .desc-toolbar button{padding:8px 12px;border:1px solid transparent;border-radius:var(--radius);background:transparent;font-weight:400;}
.pa-scope .desc-toolbar button:hover{background:var(--surface);border-color:var(--border-strong);}
.pa-scope .desc-toolbar .sep{width:1px;background:var(--border);margin:4px 4px;}
.pa-scope #descEditable{
  border:1px solid var(--border-strong);border-radius:0 0 var(--radius) var(--radius);padding:20px;min-height:340px;
  background:var(--surface);line-height:1.8;
}
.pa-scope #descEditable:focus{outline:2px solid var(--primary);outline-offset:-2px;}
.pa-scope #descEditable img{max-width:100%;border-radius:0;margin:8px 0;}
.pa-scope #descEditable h3{color:var(--text);}
.pa-scope #descEditable ul{padding-left:1.3em;}
.pa-scope #descPreviewPanel{display:none;border:1px solid var(--border-strong);border-radius:var(--radius);padding:26px;background:var(--surface);}
.pa-scope .fp-mock-frame{max-width:660px;margin:0 auto;}
.pa-scope .fp-breadcrumb{color:var(--text-muted);margin-bottom:10px;}
.pa-scope .fp-gallery{display:flex;gap:10px;overflow-x:auto;margin-bottom:16px;}
.pa-scope .fp-gallery img{width:120px;height:120px;object-fit:cover;border-radius:0;flex-shrink:0;border:1px solid var(--border);}
.pa-scope .fp-price{margin:8px 0;}
.pa-scope .fp-price-now{font-size:var(--fs-xl);font-weight:700;color:var(--text);font-variant-numeric:tabular-nums;}
.pa-scope .fp-price-old{font-size:var(--fs-md);color:var(--text-muted);text-decoration:line-through;margin-left:10px;}
.pa-scope .fp-stock{font-weight:700;margin-bottom:16px;color:var(--text);}
.pa-scope .fp-stock.oos{color:var(--danger);}
.pa-scope .fp-noimg{color:var(--text-muted);padding:20px;border:1px dashed var(--border-strong);border-radius:var(--radius);}

/* ---------- modal / toast ---------- */
/* toast 與確認視窗刻意「不」限定在 .pa-scope 底下。
   這兩者是 position:fixed 的整頁覆蓋層，實務上大家都會把它們放在頁面最外層（.pa-scope 之外），
   選擇器若要求祖先是 .pa-scope，樣式就完全吃不到——畫面平常看不出異狀，按下刪除才發現
   確認視窗變成一坨沒有定位的文字卡在頁尾。我實測 14 個後台頁面裡有 12 頁中這個問題。
   類別名稱夠特殊（.toast-wrap / .modal-overlay / .modal-box …），與既有的 bootstrap 不衝突。 */
.modal-overlay{color:var(--text);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang TC","Microsoft JhengHei","Noto Sans TC",sans-serif;font-size:16px;line-height:1.55;position:fixed;inset:0;background:rgba(20,20,19,.55);display:flex;align-items:center;justify-content:center;z-index:300;padding:20px;}
.modal-overlay[hidden]{display:none;}
.modal-box{background:var(--surface);border:2px solid var(--text);border-radius:var(--radius);max-width:440px;width:100%;padding:0;overflow:hidden;}
.modal-head{padding:18px 22px;border-bottom:1px solid var(--border-strong);}
.modal-head h3{margin:0;}
.modal-body{padding:20px 22px;}
.modal-body p{color:var(--text-muted);margin:0;}
.modal-foot{display:flex;justify-content:flex-end;gap:10px;padding:14px 22px;border-top:1px solid var(--border-strong);}

.toast-wrap{color:var(--text);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang TC","Microsoft JhengHei","Noto Sans TC",sans-serif;font-size:16px;line-height:1.55;position:fixed;top:20px;right:20px;z-index:400;display:flex;flex-direction:column;gap:10px;align-items:flex-end;}
.toast{
  background:var(--surface);color:var(--text);padding:12px 18px;border:1px solid var(--text);border-left:6px solid var(--success);
  border-radius:var(--radius);font-weight:400;max-width:340px;animation:paToastIn .2s ease, paToastOut .3s ease 2.5s forwards;
}
.toast.err{border-left-color:var(--danger);color:var(--danger);}
@keyframes paToastIn{from{opacity:0;transform:translateY(-8px);}to{opacity:1;transform:none;}}
@keyframes paToastOut{to{opacity:0;transform:translateY(-6px);}}

.pa-scope .mobile-only{display:none;}
.pa-scope .mobile-save-bar{display:none;}

/* ================= responsive ================= */
@media (max-width:980px){
  .pa-scope .form-grid{grid-template-columns:repeat(auto-fill,minmax(190px,1fr));}
  .pa-scope .form-grid.cols-3{grid-template-columns:repeat(2,1fr);}
}

@media (max-width:760px){
  .pa-topbar{padding:12px 16px;}
  .pa-topbar-meta{display:none;}
  .pa-main{padding:0 0 110px;}
  .pa-editor-header{top:56px;}
  .pa-scope .toolbar{gap:8px;}
  /* 桌機的下拉選單用 width:auto 讓它只佔內容寬度；手機一行一個，寬度不齊會讓工具列看起來歪掉 */
  .pa-scope .toolbar select{width:100%;min-width:0;}
  .pa-scope .toolbar-actions{margin-left:0;width:100%;}
  .pa-scope .toolbar-actions .btn{flex:1;}
  .pa-scope .desktop-only{display:none;}
  .pa-scope .mobile-only{display:block;}

  .pa-scope .fab-add{
    display:flex;align-items:center;justify-content:center;position:fixed;right:18px;bottom:22px;z-index:70;
    width:58px;height:58px;border-radius:50%;background:var(--primary);color:var(--surface);font-size:var(--fs-xl);
    border:2px solid var(--surface);
  }
  .pa-scope .fab-add:active{transform:scale(.95);}

  .pa-scope .table-wrap{border:none;background:transparent;max-height:none;overflow:visible;}
  .pa-scope table{table-layout:auto;}
  .pa-scope thead{display:none;}
  .pa-scope tbody{display:block;}
  .pa-scope tr.product-row{
    display:flex;flex-direction:column;border:1px solid var(--border-strong);border-radius:var(--radius);
    margin-bottom:12px;padding:12px 16px 16px;background:var(--surface);
  }
  .pa-scope tr.product-row.row-inactive{background:var(--surface-2);}
  /* 卡片式版面每張卡本來就有邊框分隔，桌機表格的斑馬紋在這裡只會讓卡片底色不一致 */
  .pa-scope tbody tr:nth-child(even) td{background:transparent;}
  .pa-scope tr.empty-row{display:block;}
  .pa-scope tr.product-row td{display:block;border:none;padding:6px 0;white-space:normal;overflow:visible;text-overflow:clip;}
  .pa-scope tr.product-row td[data-label]::before{content:attr(data-label) "：";font-weight:700;color:var(--text-muted);margin-right:6px;}
  /* 14→12 欄合併後 tbody 每列剩 12 個 <td>（colspan 只影響桌機欄寬計算，不影響 DOM 子項順序，
     手機版 nth-child 照樣數到「第幾個 <td>」）：
     1縮圖 2ID 3分類/產品線(合併) 4系列/口味(合併) 5一箱數量 6單價 7一箱價格 8庫存 9排序 10上架狀態 11禁止加購 12動作 */
  tr.product-row td:nth-child(1){display:none;}
  tr.product-row td:nth-child(4){order:1;padding-top:0;padding-bottom:10px;border-bottom:1px solid var(--border);}
  tr.product-row td:nth-child(4)::before{content:none;}
  tr.product-row td:nth-child(4) .cell-series{font-size:var(--fs-lg);font-weight:800;}
  tr.product-row td:nth-child(10){order:2;}
  tr.product-row td:nth-child(8){order:3;}
  tr.product-row td:nth-child(6){order:4;}
  tr.product-row td:nth-child(7){order:5;}
  tr.product-row td:nth-child(9){order:6;}
  tr.product-row td:nth-child(3){order:7;}
  tr.product-row td:nth-child(5){order:8;}
  tr.product-row td:nth-child(2){order:9;}
  tr.product-row td:nth-child(11){order:10;}
  tr.product-row td:nth-child(12){order:11;display:flex;gap:8px;padding-top:12px;}
  /* 「複製」按鈕外面包了一個 <form>（POST 需要），form 本身不是 flex 子項不會撐開；
     這裡讓 form 也吃 flex:1，裡面的按鈕才會跟旁邊的「編輯」連結一樣寬，不會一個大一個小。 */
  tr.product-row td:nth-child(12) .btn,tr.product-row td:nth-child(12) form{flex:1;padding:0;}
  tr.product-row td:nth-child(12) form .btn{width:100%;padding:12px;}
  tr.product-row td:nth-child(12) > .btn{padding:12px;}
  /* 合併欄（.cell-merge）刻意不在這裡改回 display:block：內層是兩個 <span>（inline 元素），
     手機版若改成 block，兩個 span 會擠在同一行不換行，「一格兩行」會在手機版直接消失。
     .cell-merge 的 flex-direction:column 定義在下面 media(min-width:761px) 之外、不分斷點一體適用，
     桌機和手機都靠它讓兩行分開；這裡只需要蓋掉 padding，不動 display。 */
  .pa-scope tr.product-row td.cell-merge{padding-top:6px;padding-bottom:6px;}
  .pa-scope input.cell-input{width:100%;min-height:46px;font-size:var(--fs-md);padding:8px 10px;border:1px solid var(--border-strong);}
  .pa-scope input.cell-input.cell-input-sm{width:100%;}

  .pa-editor-header-inner{flex-direction:column;align-items:flex-start;}
  .pa-scope .editor-title{flex:none;width:100%;}
  .pa-scope .editor-actions{width:100%;}
  .pa-scope .editor-actions .btn{flex:1;min-width:110px;}
  .pa-scope .editor-actions .switch{flex:1 1 100%;justify-content:center;}
  .pa-scope .editor-tabs{overflow-x:auto;}
  .pa-scope fieldset{padding:14px;}
  .pa-scope .form-grid,.pa-scope .form-grid.cols-3{grid-template-columns:1fr 1fr;}
  .pa-scope .form-field.full{grid-column:1/-1;}
  .pa-scope .mobile-save-bar{
    display:block;position:fixed;left:0;right:0;bottom:0;background:var(--surface);
    border-top:var(--rule-heavy);padding:10px 16px calc(10px + env(safe-area-inset-bottom));
    z-index:80;
  }
  .pa-scope .mobile-save-bar .btn{padding:14px;font-size:var(--fs-md);}
  .pa-scope .image-list{justify-content:center;}
  .pa-scope .image-card{width:150px;}
  .pa-scope .desc-toolbar{position:sticky;top:0;z-index:5;}
}
@media (min-width:761px){
  .pa-scope .mobile-only{display:none !important;}
}

/* #productTable 明確欄寬（配合 table-layout:fixed）。桌機（>760px）才生效，手機版表格改卡片式不吃這組欄寬。 */
@media (min-width:761px){
  /* 2026-08-25 二次重算緣由：14 欄裡「產品線／分類」「系列／口味」四欄被截到不能用
   （「6・寵物零食」剩「6・…」、「寵物零食」剩「寵.」、「Chee凍乾」剩「Chee…」、「狗所有系列」剩「狗所…」）——
   系列／口味是老闆辨識商品的主要依據，截字等於這張表沒用。改成 14 欄併成 12 欄的「一格兩行」結構：
   分類＋產品線合併一欄（分類在上、產品線在下）、系列＋口味合併一欄（系列在上、口味在下），
   對齊 Index.cshtml 的 <td colspan="2" class="cell-merge">。

   底層仍保留 14 個 <col>（col-cata/col-line 各自留寬給 thead 兩個獨立排序連結），
   但 tbody 用 colspan="2" 把兩個 <col> 併成一格——併格後這格的可用寬度＝兩個 col 寬度總和，
   兩行文字都吃得到完整寬度（不是各自只有原本一半欄寬），這就是「省下來的欄寬分配給合併欄」的實作方式。

   14 個 col px 目標值（沿用前一版單價/庫存/排序/動作/上架狀態/禁止加購的驗證結果，不重新推導）：
   縮圖40 / ID40 / 分類66 / 產品線70 / 系列70 / 口味90 / 一箱數量40 / 單價78 / 一箱價格78 /
   庫存90 / 排序82 / 上架狀態106 / 禁止加購106 / 動作132，總和 1088px（略小於實測可用寬 1098px，留緩衝）。
   分類/產品線合併後可用 136px、系列/口味合併後可用 160px——用來對照驗收條件裡「Chee凍乾」
   「免運試吃組合」「狗所有系列」「6・寵物零食」「寵物零食」是否完整顯示不截字（Playwright 實測見交付回報）。
   分類/產品線一開始按 56/80 分配，Playwright 實測發現 thead 表頭文字本身「分類」在 56px 只夠放窄體
   ellipsis 成「分…」，改成 66/70（同組合併總寬不變，不影響資料格）；「產品線」在 70px 仍完整顯示
   （原本 80px 有 13px 左右空白可以讓出來）。thead 的分類／系列兩個 th 只需要放得下表頭文字本身，
   不代表資料格只有那麼窄——資料格是 colspan="2" 後的合併寬度。 */
  /* 縮圖是 34px 見方，儲存格左右內距各 8px，欄寬 3.68%（1440 版面下 40px）只給得出 24px 的內容區，
     縮圖會壓出格線、貼到 ID 欄上。改成 4.6%＝50px（34+16 剛好），寬度從口味欄調過來
     （口味欄本來就是靠 ellipsis 截斷的長字串，少 10px 不影響能讀到的資訊量）。 */
  #productTable col.col-thumb{width:4.6%;}
  #productTable col.col-id{width:3.68%;}
  #productTable col.col-cata{width:6.07%;}
  #productTable col.col-line{width:6.43%;}
  #productTable col.col-series{width:6.43%;}
  #productTable col.col-flavor{width:7.35%;}
  #productTable col.col-boxqty{width:3.68%;}
  #productTable col.col-price{width:7.17%;}
  #productTable col.col-boxprice{width:7.17%;}
  #productTable col.col-stock{width:7.81%;}
  #productTable col.col-sort{width:7.08%;}
  /* 上架狀態／禁止加購欄放的是 .switch small（min-width:90px），加上儲存格左右內距共需 106px。
     原本 9.24%＝102px，內容區只有 86px：開關被切掉 4px，而 td 有 text-overflow:ellipsis，
     於是每一列的開關右側都多出一個省略號被裁剩的小黑點（70 列 ×2 欄＝畫面上 140 個雜點）。 */
  #productTable col.col-active{width:9.7%;}
  #productTable col.col-cart{width:9.7%;}
  /* 12.13%＝1440 版面下 133px，但「編輯」「複製」兩顆按鈕加間距需要 140px：
     按鈕會頂到儲存格右緣、與表格框線之間沒有任何留白。 */
  #productTable col.col-actions{width:13.13%;}
}

/* ---------- 合併欄「一格兩行」（分類/產品線、系列/口味） ---------- */
/* 一般 tbody td 是 overflow:hidden + white-space:nowrap 的單行截字規則（見上面 .pa-scope tbody td），
   合併欄改成兩行堆疊，單行截字規則下放到內層的兩個 span 各自處理。
   flex 直排刻意包一層 .cell-merge-inner，不直接放在 <td colspan="2"> 上：
   Playwright 實測發現 Chromium 對 display:flex 的 <td> 會整個跳過 colspan 的欄寬加總
   （量到只有第一個 <col> 的寬度，第二個 <col> 的寬度完全沒吃到），td 本身維持預設的
   table-cell 顯示才能正常吃滿 colspan="2" 的合併寬度，flex 排版交給裡面這層 div。 */
.pa-scope tbody td.cell-merge{
  white-space:normal;overflow:visible;padding-top:4px;padding-bottom:4px;
}
.pa-scope tbody td.cell-merge .cell-merge-inner{
  display:flex;flex-direction:column;justify-content:center;gap:0;
}
.pa-scope tbody td.cell-merge .cell-merge-inner > *{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;}
.pa-scope .cell-line-sub{color:var(--text-muted);}

/* ================= 全站外框（body.admin-shell） =================
   _Layout.cshtml 是 55 個頁面共用的，直接改會動到還沒重做的 42 個舊頁面。
   新版頁面改成在 ViewBag.BodyClass 放 "admin-shell"，下面這一段只有帶這個 class 的
   body 選得到，舊頁面一行都吃不到。
   ───────────────────────────────────────────────────────────────────────── */

/* Content/Site.css 第 1 行的 body{padding-top:50px} 是 ASP.NET 樣板留給固定 navbar 的空位，
   這個站沒有 navbar，於是每一頁最上面都固定空著 50px 的 #ddd 灰帶（實測 .pa-topbar 起點在 y=56）。
   Site.css 本身不能改：舊頁面右上角那個絕對定位的登出連結正是靠這 50px 才不會壓到內容。 */
body.admin-shell{padding-top:0;padding-bottom:0;background:var(--surface-2);}

/* _Layout 在 @RenderBody() 前面寫死一個 <br />。新版頁面的頂欄是 sticky，
   那一行空白會卡在頂欄上方，捲動時尤其明顯。 */
body.admin-shell .body-content > br:first-child{display:none;}

/* 登出連結原本絕對定位在整頁右上角（浮在那條灰帶上）。灰帶收掉之後它會壓到頂欄，
   而且裸連結的藍底線跟這套配色格格不入。改放到常駐側邊欄底部——那裡本來就是整片空的深色區，
   而且「登出」放在選單腳位符合一般後台的習慣位置。 */
body.admin-shell .login-slot{
  position:fixed;left:0;right:auto;top:auto;bottom:0;width:300px;
  padding:0;z-index:1001;background:#1c1d22;
}
/* 內距與上框線都掛在連結上，_LoginPartial 沒有輸出東西時（未登入）整塊就是 0 高度，
   不會在側邊欄底部留一條沒有內容的深色橫槓。 */
body.admin-shell .login-slot a{
  display:block;padding:16px 24px;
  border-top:1px solid rgba(255,255,255,.14);
  color:#bdbdbd;font-size:16px;text-decoration:none;
}
body.admin-shell .login-slot a:hover,body.admin-shell .login-slot a:focus{color:#fff;text-decoration:underline;}

/* 選單麵包屑（ALL → 後台管理）原本是 10.4px 的紫藍色 #5c5edc：字級跌破 16px 下限，
   顏色也是整套灰階＋赤陶橘裡唯一的紫色。 */
body.admin-shell .menu__breadcrumbs{font-size:16px;line-height:1.2;padding:22px 30px 14px 24px;}
body.admin-shell .menu__breadcrumbs a{color:#8a8a83;font-weight:400;letter-spacing:.04em;}
body.admin-shell .menu__breadcrumbs a:last-child{color:#e6e6e0;}
body.admin-shell .menu__breadcrumbs a:hover,
body.admin-shell .menu__breadcrumbs a:focus{color:#e6e6e0;}

/* 手機版（沒有側邊欄，只有一顆漢堡鈕）。原本 component.css 把 .action--open 定成
   position:fixed 的白色圖示、沒有底色，捲動時它會直接壓在白底卡片的文字上，看不清也點不準。
   這裡把它安置在同樣固定在頂端的 .pa-topbar 左側（漢堡 z-index 1000 > 頂欄 60，永遠在最上層），
   頂欄則補左內距讓出位置——不另外增加一條 bar，垂直空間一點都不多花。 */
@media screen and (max-width:40em){
  body.admin-shell .action--open{
    top:0;left:0;width:48px;height:74px;
    display:flex;align-items:center;justify-content:center;
    padding:0;font-size:22px;line-height:1;background:none;
  }
  /* _Layout 的漢堡圖示是 <span style="color:#338FFF">，行內樣式只能用 !important 蓋掉；
     那個藍色是這套灰階＋赤陶橘配色裡唯一的藍。 */
  body.admin-shell .action--open .icon{color:var(--text)!important;}
  body.admin-shell .pa-topbar{padding-left:52px;}
  /* .pa-brand 是 white-space:nowrap 的單行：桌機夠寬沒問題，390px 手機扣掉漢堡鈕的 52px 之後
     「青川淺後台管理 商品管理・petfood.city」會被切成「…petfood.cit」。讓副標自己換一行。 */
  body.admin-shell .pa-brand{flex-wrap:wrap;white-space:normal;min-width:0;}
  body.admin-shell .pa-brand small{flex-basis:100%;}

  /* demo.css 在這個斷點給 .bp-header 一個 padding-top:3em——那是留給示範站頁首的位置，
     這裡的頁首是側邊欄裡的 logo（手機版根本不顯示），只剩 48px 的灰色空白卡在畫面最上面。 */
  body.admin-shell .bp-header{padding-top:0;}

  body.admin-shell .login-slot{position:static;width:auto;background:none;}
  body.admin-shell .login-slot a{border-top:0;padding:12px 16px;}
}
