/**
 * gear-list.css — 裝備清單共用樣式（2026-08-10）
 *
 * 三個掛載點共用：/gear（母版編輯）、trip.html overlay（行程模式）、
 * tripPreview（隊員模式）。一份樣式三處長得一樣，是刻意的——
 * 使用者在三個地方看到的是同一份清單，長不一樣只會讓人以為是不同東西。
 *
 * ⚠️ 顏色紀律（memory feedback_darkmode_color_rules）：
 *   ① 所有顏色都在這裡定義成 token，**JS 生成的 markup 一律只給 class**，
 *      絕不 inline style 寫色 —— inline 贏過所有 CSS，日後要加暗化就追不上了。
 *   ② 等級色是「語意色」，與品牌 CTA 的 --pk-amber 刻意分開：
 *      畫面上同時有「重要度」與「主要動作」時，兩者不可以撞色。
 *   ③ 淡化不用 opacity（見規則四），用字級/字重撐層級。
 */

:root {
  /* ── 重要度色階（S 最高 → D 最低；N/L 是特殊標記不在光譜上）──
     取色原則：全部往土色調壓，跟 Dawn Spectrum 同一個世界；
     不用純紅/純橘那種警示色（清單上有 20 個 S 級時整片會太吵）。 */
  --gl-S:    #B0392E;  --gl-S-bg: rgba(176, 57, 46, 0.10);
  --gl-A:    #C07020;  --gl-A-bg: rgba(192, 112, 32, 0.10);
  --gl-B:    #94800F;  --gl-B-bg: rgba(148, 128, 15, 0.12);
  --gl-C:    #3B6FA0;  --gl-C-bg: rgba(59, 111, 160, 0.10);
  --gl-D:    #7C7668;  --gl-D-bg: rgba(124, 118, 104, 0.10);
  --gl-N:    #98A0AC;  --gl-N-bg: rgba(152, 160, 172, 0.12);
  --gl-L:    #3E7B7D;  --gl-L-bg: rgba(62, 123, 125, 0.10);

  /* ── 左側漸層長度＝重要度（創辦人 2026-08-11 選定「F 案」）──
     顏色之外多一條編碼通道：重要的東西「視覺重量」真的比較重，
     而且色弱也分得出來（色相看不出差異時，長度還在）。
     🔧 要微調就改這七個數字，其餘規則不必動。 */
  --gl-len-S: 60%;   /* 絕對必要 */
  --gl-len-A: 42%;   /* 相當重要 */
  --gl-len-B: 26%;   /* 必須有   */
  --gl-len-C: 14%;   /* 建議攜帶 */
  --gl-len-D: 7%;    /* 自行考量 */
  --gl-len-N: 20%;   /* 不建議帶：不在強度光譜上，但要看得見——它是「刻意告訴你別帶」
                        的資訊（氧氣罐那類），配合灰字讀成「已標記、但不重要」 */
  --gl-len-L: 26%;   /* 領隊協調：也不在光譜上，但這是**待辦**（有人得去協調），
                        所以給得到 B 級的存在感 */
  --gl-fade: 0.22;   /* 漸層起點濃度；再高會蓋到品名的可讀性 */

  /* N 級的文字色：比主文灰、但仍讀得清楚（對白底 4.7:1，過 WCAG AA）。
     🔴 不要直接用 --gl-N (#98A0AC) 當文字色——那個是給色塊用的，
        當文字時對比只有 2.5:1，等於把「別帶什麼」這條資訊藏起來。 */
  --gl-N-ink: #6E7480;

  --gl-line:   rgba(174, 189, 212, 0.32);
  --gl-line-2: rgba(174, 189, 212, 0.55);
  --gl-surface: #FFFFFF;
  --gl-surface-2: #F7F5F0;
  --gl-radius: 12px;
}

/* ══ 容器 ═════════════════════════════════════════════ */

.gl-root {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--pk-dusk, #4A5168);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.gl-root *, .gl-sheet * { box-sizing: border-box; }

/* ── 子版切換列 ─────────────────────────────────────── */
.gl-variants {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
}
.gl-variants::-webkit-scrollbar { display: none; }

.gl-vchip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border: 1.5px solid var(--gl-line-2);
  border-radius: 999px;
  background: var(--gl-surface);
  color: var(--pk-dusk, #4A5168);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.gl-vchip:hover { border-color: var(--pk-amber, #C4845A); }
.gl-vchip.is-on {
  background: var(--pk-night, #1E2330);
  border-color: var(--pk-night, #1E2330);
  color: #fff;
}
.gl-vchip__wt { font-size: 12px; font-weight: 600; opacity: .78; font-variant-numeric: tabular-nums; }
/* 選中的子版 chip 內的 ✎（2026-08-19 創辦人：「編輯子版名稱的方式有點怪，很不直觀」）。
   編輯入口原本是排在整列最後的獨立鉛筆 chip —— 和它要編輯的對象隔著其他 chip、
   而且這一列橫向捲動時常整個捲出畫面外。改成長在選中的那顆上：**看得到就點得到**。
   ⚠️ 不用巢狀 <button>（HTML 不合法）⇒ 這是純視覺提示，點擊由 chip 自己處理。 */
.gl-vchip__edit {
  display: inline-flex; align-items: center; margin-left: 1px; padding-left: 7px;
  border-left: 1px solid rgba(255, 255, 255, .28); opacity: .85;
}
.gl-vchip__edit svg { width: 13px; height: 13px; display: block; }
.gl-vchip.is-on:hover .gl-vchip__edit { opacity: 1; }
.gl-vchip--add { border-style: dashed; color: var(--pk-amber, #C4845A); }

/* ── 總覽（總重 + 打包進度 + 等級分佈）────────────────
   .gl-sum 是總覽與分佈條的共同外層：勾選時整包替換，避免分佈條被重複插入
   （見 gear-list-editor.js 的 _refreshSummary 註解）。 */
.gl-sum { display: flex; flex-direction: column; gap: 6px; }

.gl-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  background: var(--pk-night, #1E2330);
  color: #fff;
  border-radius: var(--gl-radius);
}
.gl-summary__weight {
  font-size: 21px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  display: block;
}
.gl-summary__sub { font-size: 12px; font-weight: 600; color: rgba(255,255,255,.72); display: block; margin-top: 1px; }
.gl-summary__right { text-align: right; flex: none; }
.gl-summary__prog { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.gl-summary__prog-sub { font-size: 11.5px; font-weight: 600; color: rgba(255,255,255,.72); }

.gl-dist {
  display: flex;
  height: 7px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--gl-surface-2);
}
.gl-dist__seg { display: block; height: 100%; min-width: 0; }
.gl-dist__seg--S { background: var(--gl-S); }
.gl-dist__seg--A { background: var(--gl-A); }
.gl-dist__seg--B { background: var(--gl-B); }
.gl-dist__seg--C { background: var(--gl-C); }
.gl-dist__seg--D { background: var(--gl-D); }
.gl-dist__seg--N { background: var(--gl-N); }
.gl-dist__seg--L { background: var(--gl-L); }

/* ── 篩選列 ─────────────────────────────────────────── */
.gl-filters { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.gl-chip {
  padding: 5px 12px;
  border: 1.5px solid var(--gl-line-2);
  border-radius: 999px;
  background: var(--gl-surface);
  color: var(--pk-dusk, #4A5168);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.gl-chip.is-on { background: var(--pk-night, #1E2330); border-color: var(--pk-night, #1E2330); color: #fff; }
.gl-search {
  flex: 1;
  min-width: 110px;
  padding: 7px 12px;
  border: 1.5px solid var(--gl-line-2);
  border-radius: 999px;
  /* 🔴 16px 硬地板：低於 16px 時 iOS Safari 聚焦會自動放大整頁（見 project_form_density_standard） */
  font-size: 16px;
  color: var(--pk-night, #1E2330);
  background: var(--gl-surface);
}
.gl-search:focus { outline: 2px solid var(--pk-amber, #C4845A); outline-offset: 1px; border-color: transparent; }

/* ── 分類群組 ───────────────────────────────────────── */
.gl-body { display: flex; flex-direction: column; gap: 12px; }

.gl-group { border: 1px solid var(--gl-line); border-radius: var(--gl-radius); background: var(--gl-surface); overflow: hidden; }
.gl-group__hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 13px;
  background: var(--gl-surface-2);
  border-bottom: 1px solid var(--gl-line);
  cursor: pointer;
  user-select: none;
}
.gl-group__name { font-size: 14px; font-weight: 800; color: var(--pk-night, #1E2330); display: flex; align-items: center; gap: 7px; }
.gl-group__code {
  display: inline-flex; align-items: center; justify-content: center;
  width: 19px; height: 19px; border-radius: 5px;
  background: var(--pk-night, #1E2330); color: #fff;
  font-size: 11px; font-weight: 800; text-transform: uppercase;
}
.gl-group__meta { font-size: 12px; font-weight: 600; color: var(--pk-dusk, #4A5168); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gl-group__caret { transition: transform .18s ease; }
.gl-group.is-collapsed .gl-group__caret { transform: rotate(-90deg); }
.gl-group.is-collapsed .gl-items { display: none; }

/* ── 品項列 ─────────────────────────────────────────── */
.gl-items { list-style: none; margin: 0; padding: 0; }

.gl-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--gl-line);
  position: relative;
  /* 🔴 isolation 不可省：漸層是 z-index:-1 的 ::before，沒有自己的堆疊脈絡的話
     會沉到分類卡的白底底下、整個看不見。isolate 讓它畫在「本列背景之上、文字之下」。 */
  isolation: isolate;
}

/* ── 左側漸層：長度＝重要度 ──────────────────────────
   等級由 data-lv 決定（值已在 core 白名單化，不會被外來清單汙染）。
   沒有 data-lv 的列（例如「＋加到某某」那一列）拿不到 --gl-len，寬度 0＝不畫。 */
.gl-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: var(--gl-len, 0);
  background: linear-gradient(90deg, var(--gl-hue, transparent) 0%, transparent 100%);
  opacity: var(--gl-fade);
  z-index: -1;
  pointer-events: none;
}
.gl-item[data-lv="S"] { --gl-hue: var(--gl-S); --gl-len: var(--gl-len-S); }
.gl-item[data-lv="A"] { --gl-hue: var(--gl-A); --gl-len: var(--gl-len-A); }
.gl-item[data-lv="B"] { --gl-hue: var(--gl-B); --gl-len: var(--gl-len-B); }
.gl-item[data-lv="C"] { --gl-hue: var(--gl-C); --gl-len: var(--gl-len-C); }
.gl-item[data-lv="D"] { --gl-hue: var(--gl-D); --gl-len: var(--gl-len-D); }
.gl-item[data-lv="N"] { --gl-hue: var(--gl-N); --gl-len: var(--gl-len-N); }
.gl-item[data-lv="L"] { --gl-hue: var(--gl-L); --gl-len: var(--gl-len-L); }

/* N＝這趟不需要帶：整列往後退（文字調灰），但仍讀得到——
   那句「不要帶，沒用的東西」本身就是要傳達的知識。 */
.gl-item[data-lv="N"] .gl-item__name { color: var(--gl-N-ink); font-weight: 500; }
.gl-item[data-lv="N"] .gl-item__note,
.gl-item[data-lv="N"] .gl-item__wt,
.gl-item[data-lv="N"] .gl-item__code { color: var(--gl-N-ink); }
.gl-item:last-child { border-bottom: none; }
.gl-item.is-off { background: var(--gl-surface-2); }
.gl-item.is-off .gl-item__name { text-decoration: line-through; font-weight: 500; }
/* 子版關掉的品項要連漸層一起退掉：它這趟不帶，卻掛著 S 級的長漸層會誤導掃視。
   保留一點點（而不是歸零）是為了讓「它原本是什麼等級」仍看得出來。 */
.gl-item.is-off::before { opacity: calc(var(--gl-fade) * 0.3); }

/* 左側等級色條：4px 直條，掃視時一眼看出必備密度 */
.gl-item__stripe { flex: none; width: 4px; align-self: stretch; margin-right: 4px; }
.gl-lvbg-S { background: var(--gl-S); } .gl-lvbg-A { background: var(--gl-A); }
.gl-lvbg-B { background: var(--gl-B); } .gl-lvbg-C { background: var(--gl-C); }
.gl-lvbg-D { background: var(--gl-D); } .gl-lvbg-N { background: var(--gl-N); }
.gl-lvbg-L { background: var(--gl-L); }

.gl-item__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
  background: none;
  border: none;
  padding: 2px 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.gl-item__row1 { display: flex; align-items: center; gap: 6px; min-width: 0; }
.gl-item__name {
  font-size: 14.5px; font-weight: 600; color: var(--pk-night, #1E2330);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.gl-item__note {
  font-size: 12px; color: var(--pk-dusk, #4A5168);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gl-item__wt {
  flex: none; font-size: 12.5px; font-weight: 700; color: var(--pk-dusk, #4A5168);
  font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 46px; text-align: right;
}
.gl-item__wt--none { font-weight: 600; font-size: 11.5px; }
.gl-item__qty {
  flex: none; font-size: 11.5px; font-weight: 800; color: var(--pk-night, #1E2330);
  background: var(--gl-surface-2); border-radius: 5px; padding: 0 5px;
}

/* 等級圓標（列上的小圈 + sheet 的選擇器共用） */
.gl-lv {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  font-size: 10.5px; font-weight: 800; color: #fff; line-height: 1;
  cursor: default;
}
.gl-lv--S { background: var(--gl-S); } .gl-lv--A { background: var(--gl-A); }
.gl-lv--B { background: var(--gl-B); } .gl-lv--C { background: var(--gl-C); }
.gl-lv--D { background: var(--gl-D); } .gl-lv--N { background: var(--gl-N); }
.gl-lv--L { background: var(--gl-L); }
/* 被子版覆蓋過的等級：加圈提示「這格跟母版不一樣」 */
.gl-lv.is-ovr { box-shadow: 0 0 0 2px var(--gl-surface), 0 0 0 3.5px var(--pk-amber, #C4845A); }

/* ── 雙輪打包勾選 ───────────────────────────────────── */
.gl-cks { display: flex; gap: 4px; flex: none; padding-left: 4px; }
.gl-ck {
  width: 26px; height: 26px;
  border: 1.5px solid var(--gl-line-2);
  border-radius: 7px;
  background: var(--gl-surface);
  color: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background .14s ease, border-color .14s ease;
}
.gl-ck::after {
  content: attr(data-label);
  position: absolute; top: -1px; right: 1px;
  font-size: 8.5px; font-weight: 800; color: var(--pk-dusk, #4A5168);
  opacity: .55; pointer-events: none;
}
.gl-ck.is-on { background: var(--pk-summit, #4A8B8D); border-color: var(--pk-summit, #4A8B8D); color: #fff; }
.gl-ck.is-on::after { color: #fff; opacity: .8; }
.gl-ck .pk-i { width: 15px; height: 15px; }

/* ── 子版開關（母版列在子版檢視時的 on/off）────────── */
.gl-toggle {
  flex: none; width: 40px; height: 23px; border-radius: 999px;
  border: none; background: var(--gl-line-2); position: relative; cursor: pointer;
  transition: background .16s ease;
}
.gl-toggle::after {
  content: ''; position: absolute; top: 2.5px; left: 2.5px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform .16s ease;
  box-shadow: 0 1px 3px rgba(30,35,48,.28);
}
.gl-toggle.is-on { background: var(--pk-summit, #4A8B8D); }
.gl-toggle.is-on::after { transform: translateX(17px); }

/* ── 動作按鈕 ───────────────────────────────────────── */
.gl-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.gl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 15px;
  border-radius: 9px;
  border: 1.5px solid var(--gl-line-2);
  background: var(--gl-surface);
  color: var(--pk-dusk, #4A5168);
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .12s ease;
}
.gl-btn:hover { border-color: var(--pk-amber, #C4845A); }
.gl-btn:active { transform: translateY(1px); }
.gl-btn--pri { background: var(--pk-amber-btn, #A16743); border-color: var(--pk-amber, #C4845A); color: #fff; }
.gl-btn--pri:hover { background: color-mix(in srgb, var(--pk-amber-btn, #A16743) 92%, #000); border-color: var(--pk-ember, #A56B45); }
.gl-btn--danger { color: var(--pk-error, #B43C3C); border-color: rgba(180, 60, 60, .4); }
.gl-btn--danger:hover { border-color: var(--pk-error, #B43C3C); }
.gl-btn--block { width: 100%; }
.gl-btn--dashed { border-style: dashed; }
.gl-btn:disabled { opacity: .5; cursor: not-allowed; }
/* .gl-btn 也套在 <a> 上（trip overlay 的「去打包這趟」直達連結）——
   anchor 的 UA 預設會帶底線與藍字，兩者都要蓋掉才長得跟按鈕一樣。 */
a.gl-btn { text-decoration: none; }
a.gl-btn:visited { color: var(--pk-dusk, #4A5168); }

/* ── 空狀態 ─────────────────────────────────────────── */
.gl-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 30px 18px;
  border: 1.5px dashed var(--gl-line-2);
  border-radius: var(--gl-radius);
  text-align: center;
  background: var(--gl-surface);
}
.gl-empty__icon { color: var(--pk-sky, #AEBDD4); }
.gl-empty__icon .pk-i { width: 34px; height: 34px; }
.gl-empty__title { font-size: 15.5px; font-weight: 800; color: var(--pk-night, #1E2330); }
.gl-empty__desc { font-size: 13px; color: var(--pk-dusk, #4A5168); max-width: 30em; }

/* ── 提示條 ─────────────────────────────────────────── */
.gl-hint {
  font-size: 12.5px;
  color: var(--pk-dusk, #4A5168);
  background: var(--pk-glow, #FCF3DB);
  border-left: 3px solid var(--pk-amber, #C4845A);
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
}
.gl-hint--teal { background: rgba(74,139,141,.10); border-left-color: var(--pk-summit, #4A8B8D); }

/* ── 圖例 ───────────────────────────────────────────── */
.gl-legend { display: flex; flex-direction: column; gap: 6px; }
.gl-legend__row { display: flex; align-items: center; gap: 9px; }
.gl-legend__text { font-size: 13px; flex: 1; min-width: 0; }
.gl-legend__input {
  flex: 1; min-width: 0;
  font-size: 16px;               /* 16px 硬地板（iOS 聚焦不放大） */
  padding: 6px 10px;
  border: 1.5px solid var(--gl-line-2);
  border-radius: 8px;
  color: var(--pk-night, #1E2330);
  background: var(--gl-surface);
}

/* ══ Bottom sheet（品項編輯 / 詳情）══════════════════════
   掛在 <body> 底下而非清單容器內：清單常常活在 overflow:auto 的
   overlay 裡，掛在裡面會被裁掉，而且 z-index 會跟 overlay 打架。 */
.gl-sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(30, 35, 48, .45);
  z-index: 100000;               /* 高於 trip overlay(1000)，低於登入閘(1e9) */
  display: flex; align-items: flex-end; justify-content: center;
  animation: gl-fade .16s ease;
}
.gl-sheet {
  width: 100%; max-width: 560px;
  background: var(--gl-surface);
  border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  max-height: 88dvh; overflow-y: auto;
  box-shadow: 0 -6px 30px rgba(30,35,48,.28);
  animation: gl-rise .2s cubic-bezier(.22,.8,.3,1);
}
@keyframes gl-fade { from { opacity: 0; } }
@keyframes gl-rise { from { transform: translateY(16px); opacity: .4; } }
@media (prefers-reduced-motion: reduce) {
  .gl-sheet-backdrop, .gl-sheet { animation: none; }
  .gl-vchip, .gl-ck, .gl-toggle, .gl-btn, .gl-group__caret { transition: none; }
}
@media (min-width: 600px) {
  .gl-sheet-backdrop { align-items: center; }
  .gl-sheet { border-radius: 18px; max-height: 82dvh; }
}

.gl-sheet__hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.gl-sheet__title { font-size: 17px; font-weight: 800; color: var(--pk-night, #1E2330); margin: 0; }
.gl-sheet__close {
  background: none; border: none; cursor: pointer; padding: 6px;
  color: var(--pk-dusk, #4A5168); line-height: 0; border-radius: 8px;
}
.gl-sheet__close:hover { background: var(--gl-surface-2); }

.gl-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.gl-field__label { font-size: 12.5px; font-weight: 800; color: var(--pk-dusk, #4A5168); letter-spacing: .02em; }
.gl-field__row { display: flex; gap: 8px; align-items: center; }
.gl-input, .gl-select, .gl-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--gl-line-2);
  border-radius: 9px;
  font-size: 16px;               /* 16px 硬地板 */
  font-family: inherit;
  color: var(--pk-night, #1E2330);
  background: var(--gl-surface);
}
.gl-input:focus, .gl-select:focus, .gl-textarea:focus {
  outline: 2px solid var(--pk-amber, #C4845A); outline-offset: 1px; border-color: transparent;
}
.gl-textarea { min-height: 62px; resize: vertical; line-height: 1.5; }
.gl-input--num { font-variant-numeric: tabular-nums; }
.gl-suffix { font-size: 13px; font-weight: 700; color: var(--pk-dusk, #4A5168); flex: none; }

/* 等級選擇器 */
.gl-lvpick { display: flex; gap: 7px; flex-wrap: wrap; }
.gl-lvpick__btn {
  display: inline-flex; flex-direction: column; align-items: center; gap: 3px;
  border: none; background: none; cursor: pointer; padding: 2px;
}
.gl-lvpick__dot {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #fff;
}
.gl-lvpick__cap { font-size: 10px; font-weight: 700; color: var(--pk-dusk, #4A5168); }
.gl-lvpick__btn.is-sel .gl-lvpick__dot { box-shadow: 0 0 0 2px var(--gl-surface), 0 0 0 4px var(--pk-night, #1E2330); }
.gl-lvpick__desc { font-size: 12.5px; color: var(--pk-dusk, #4A5168); margin-top: 6px; min-height: 1.4em; }

.gl-sheet__actions { display: flex; gap: 8px; margin-top: 16px; }
.gl-sheet__actions .gl-btn { flex: 1; }

/* ══ 隊員模式微調 ════════════════════════════════════ */
.gl-root[data-mode="member"] .gl-item__main { cursor: pointer; }
.gl-root[data-mode="member"] .gl-add { display: none; }

/* ══ 檢視密度切換（列表／表格）═══════════════════════ */
.gl-seg {
  display: inline-flex;
  margin-left: auto;              /* 靠右，跟篩選 chips 分開 */
  border: 1.5px solid var(--gl-line-2);
  border-radius: 999px;
  overflow: hidden;
  flex: none;
}
.gl-seg button {
  border: none;
  background: var(--gl-surface);
  color: var(--pk-dusk, #4A5168);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 5px 12px;
  cursor: pointer;
}
.gl-seg button.is-on { background: var(--pk-night, #1E2330); color: #fff; }

.gl-chip--add { border-color: var(--pk-amber, #C4845A); color: var(--pk-amber, #C4845A); display: inline-flex; align-items: center; gap: 4px; }
.gl-chip--add .pk-i { width: 13px; height: 13px; }
.gl-chip { display: inline-flex; align-items: center; gap: 4px; }
.gl-chip .pk-i { width: 12px; height: 12px; }
.gl-chip--clear { padding: 5px 9px; }

/* ── 篩選視窗：每一級一列，直接列出「這份清單自己的圖例說法」供比對 ── */
.gl-flt { display: flex; flex-direction: column; gap: 5px; }
.gl-flt__row {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  border: 1.5px solid var(--gl-line-2); border-radius: 9px;
  cursor: pointer;
}
.gl-flt__row:has(input:checked) { border-color: var(--pk-amber, #C4845A); background: var(--pk-glow, #FCF3DB); }
.gl-flt__row.is-empty { opacity: .55; }        /* 這份清單沒有這一級 */
.gl-flt__row input { flex: none; width: 17px; height: 17px; accent-color: var(--pk-amber, #C4845A); }
.gl-flt__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.gl-flt__legend { font-size: 11.5px; color: var(--pk-dusk, #4A5168); }
.gl-flt__count {
  flex: none; font-size: 12px; font-weight: 800; color: var(--pk-dusk, #4A5168);
  font-variant-numeric: tabular-nums; min-width: 26px; text-align: right;
}

/* 子版改寫過的備註：加底線提示「這句跟母版不一樣」 */
.gl-item__note.is-ovr {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--pk-amber, #C4845A);
  text-underline-offset: 2px;
}

/* ── 就地新增列（每個分類尾端）── */
.gl-item--add { border-bottom: none; padding: 0; }
.gl-item__addbtn {
  width: 100%;
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 700;
  color: var(--pk-amber, #C4845A);
  padding: 7px 12px;
  text-align: left;
}
.gl-item__addbtn:hover { background: var(--gl-surface-2); }
.gl-item__addbtn .pk-i { width: 14px; height: 14px; }

/* ── 品項代碼（a01…）：只在表格模式現身，對齊母版的口頭溝通習慣 ── */
.gl-item__code { display: none; }

/* ══ 拖拉重排 ════════════════════════════════════════
   握把是唯一能起手的地方（整列點擊＝開編輯，兩者不能搶）。
   🔴 touch-action:none 不可省 —— 少了它，手指在握把上滑動會被瀏覽器
   判成頁面捲動，pointermove 直接斷掉、拖不動。 */
.gl-grip {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 22px;
  color: var(--gl-N);
  cursor: grab;
  touch-action: none;
  border-radius: 5px;
  -webkit-user-select: none; user-select: none;
}
.gl-grip:hover { color: var(--pk-dusk, #4A5168); background: var(--gl-surface-2); }
.gl-grip:active { cursor: grabbing; }
.gl-grip:focus-visible { outline: 2px solid var(--pk-amber, #C4845A); outline-offset: 1px; }
.gl-grip .pk-i { width: 14px; height: 14px; }

.gl-item.is-dragging, .gl-group.is-dragging { opacity: .45; }
/* 拖曳中禁掉 hover 效果，否則滑過每一列都在閃 */
.gl-root.is-reordering .gl-item__main:hover,
.gl-root.is-reordering .gl-group__hd:hover { background: none; }
.gl-root.is-reordering * { cursor: grabbing !important; }

/* 落點指示線：不即時搬 DOM（表格模式是 CSS columns，搬一次整份重新分欄會狂跳） */
.gl-drop-before, .gl-drop-after { position: relative; }
.gl-drop-before::before, .gl-drop-after::after {
  content: '';
  position: absolute; left: 0; right: 0;
  height: 3px;
  background: var(--pk-amber, #C4845A);
  border-radius: 2px;
  z-index: 3;
  pointer-events: none;
}
.gl-drop-before::before { top: -2px; }
.gl-drop-after::after { bottom: -2px; }
.gl-group.gl-drop-before::before { top: -5px; }
.gl-group.gl-drop-after::after { bottom: -5px; }

/* ── 分類標頭：編輯種類鈕 ── */
.gl-group__hd { gap: 6px; }
.gl-group__name { flex: 1; min-width: 0; cursor: pointer; }
.gl-group__meta { cursor: pointer; }
.gl-group__edit {
  flex: none;
  background: none; border: none; cursor: pointer;
  color: var(--gl-N); padding: 3px 4px; border-radius: 6px; line-height: 0;
}
.gl-group__edit:hover { color: var(--pk-amber, #C4845A); background: var(--gl-surface); }
.gl-group__edit .pk-i { width: 14px; height: 14px; }

/* ── sheet 裡的單選列（種類性質）── */
.gl-radio {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 9px 11px; margin-bottom: 6px;
  border: 1.5px solid var(--gl-line-2); border-radius: 9px;
  cursor: pointer; font-size: 13.5px;
}
.gl-radio:has(input:checked) { border-color: var(--pk-amber, #C4845A); background: var(--pk-glow, #FCF3DB); }
.gl-radio input { margin-top: 2px; flex: none; width: 17px; height: 17px; accent-color: var(--pk-amber, #C4845A); }
.gl-radio__desc { font-size: 11.5px; color: var(--pk-dusk, #4A5168); }

/* ══ 表格模式（預設；創辦人 08-11 回饋）══════════════════
   目標＝「一眼看超多項、同時評估」：行高壓密、備註併同一行、
   分類用 CSS columns 多欄並排——讀序上到下再下一欄，跟他的
   Excel 四直欄同一種讀法。寬容器（/gear 撐到 1240、trip 視窗
   撐到 1160）自動長出 2~4 欄；手機單欄但一屏能看 ~15 行。 */
.gl-root[data-density="table"] .gl-body {
  display: block;
  columns: 300px 4;               /* 欄寬 300px、最多 4 欄，數量隨容器自動 */
  column-gap: 12px;
}
.gl-root[data-density="table"] .gl-group {
  break-inside: avoid;            /* 分類永不被攔腰切進下一欄 */
  margin-bottom: 12px;
}
.gl-root[data-density="table"] .gl-group__hd { padding: 5px 10px; }
.gl-root[data-density="table"] .gl-group__name { font-size: 13px; }
.gl-root[data-density="table"] .gl-item { padding: 1px 8px 1px 0; gap: 6px; }
.gl-root[data-density="table"] .gl-item__stripe { width: 3px; margin-right: 2px; }
.gl-root[data-density="table"] .gl-item__code {
  display: inline-block; flex: none;
  width: 25px;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 10px; font-weight: 700;
  color: var(--gl-N);
  font-variant-numeric: tabular-nums;
}
.gl-root[data-density="table"] .gl-item__main { flex-direction: row; align-items: center; gap: 6px; padding: 2px 0; }
.gl-root[data-density="table"] .gl-item__row1 { flex: 1 1 auto; }
.gl-root[data-density="table"] .gl-item__name { font-size: 13px; }
/* 備註併到同一行右側（母版原本就是寫在同一格裡的碎念） */
.gl-root[data-density="table"] .gl-item__note { flex: 0 1 auto; max-width: 52%; font-size: 11px; }
.gl-root[data-density="table"] .gl-lv { width: 15px; height: 15px; font-size: 9.5px; }
.gl-root[data-density="table"] .gl-item__wt { font-size: 11.5px; min-width: 50px; }
.gl-root[data-density="table"] .gl-item__qty { font-size: 10.5px; }
.gl-root[data-density="table"] .gl-cks { gap: 3px; padding-left: 2px; }
.gl-root[data-density="table"] .gl-ck { width: 23px; height: 23px; border-radius: 6px; }
.gl-root[data-density="table"] .gl-ck .pk-i { width: 13px; height: 13px; }
.gl-root[data-density="table"] .gl-toggle { width: 34px; height: 20px; }
.gl-root[data-density="table"] .gl-toggle::after { width: 15px; height: 15px; top: 2px; left: 2px; }
.gl-root[data-density="table"] .gl-toggle.is-on::after { transform: translateX(14px); }
.gl-root[data-density="table"] .gl-item__addbtn { padding: 4px 10px; font-size: 11.5px; }
.gl-root[data-density="table"] .gl-grip { width: 16px; height: 18px; }
.gl-root[data-density="table"] .gl-grip .pk-i { width: 12px; height: 12px; }

/* ══ 列印（計畫書裝備區塊）═══════════════════════════
   紙本沿用創辦人母版的版式：代碼 / 品名 / 重量 / 兩個空勾選格。
   螢幕上的勾選狀態**不印**——紙本是拿去現場一項項打勾用的。 */
@media print {
  .gl-root { font-size: 10.5pt; gap: 6px; }
  .gl-variants, .gl-filters, .gl-add, .gl-actions, .gl-sheet-backdrop,
  .gl-seg, .gl-item--add, .gl-grip, .gl-group__edit { display: none !important; }
  /* 紙本維持單欄流式（columns 在分頁列印時的斷欄行為各瀏覽器不一，不賭） */
  .gl-root .gl-body { columns: auto !important; }
  .gl-summary { background: none !important; color: #000 !important; border: 1pt solid #000; padding: 5pt 8pt; }
  .gl-summary__sub, .gl-summary__prog-sub { color: #333 !important; }
  .gl-group { break-inside: avoid; border: 1pt solid #999; }
  .gl-group__hd { background: #eee !important; padding: 3pt 6pt; }
  .gl-group__code { background: #000 !important; color: #fff !important; }
  .gl-item { padding: 2pt 6pt 2pt 0; break-inside: avoid; }
  .gl-item__stripe { width: 3pt; }
  /* 紙本不印左側漸層：噴墨/雷射把淡色漸層印成一片灰髒，反而干擾讀字。
     紙上的等級靠色條與等級圈就夠了。 */
  .gl-item::before { display: none !important; }
  /* N 級在紙上維持可讀（螢幕上的灰是「往後退」，印出來會直接糊掉） */
  .gl-item[data-lv="N"] .gl-item__name,
  .gl-item[data-lv="N"] .gl-item__note,
  .gl-item[data-lv="N"] .gl-item__wt,
  .gl-item[data-lv="N"] .gl-item__code { color: #333 !important; }
  /* 勾選格印成空框：帶著紙本上山，現場自己打勾 */
  .gl-ck, .gl-ck.is-on { background: #fff !important; border: 1pt solid #666 !important; color: transparent !important; }
  .gl-ck .pk-i { display: none !important; }
  .gl-ck::after { color: #666 !important; opacity: 1 !important; }
  .gl-toggle { display: none !important; }
}
