/* ============================================================
   BARDSHOP ARGO — style.css
   Design: Industrial HMI Terminal  v3.0
   ============================================================ */

/* ── 1. Design Tokens ─────────────────────────────────────── */
:root {
  /* Core palette — dark industrial */
  --c-bg:        #0b0f18;
  --c-panel:     #111827;
  --c-panel-2:   #1a2235;
  --c-panel-3:   #1e2a3f;

  /* Accents */
  --c-amber:     #f59e0b;
  --c-amber-dim: rgba(245,158,11,.12);
  --c-amber-glow:rgba(245,158,11,.25);
  --c-electric:  #38bdf8;
  --c-electric-dim:rgba(56,189,248,.10);

  /* Function zone colors */
  --c-stock:     #38bdf8;   /* 繳庫 — electric blue */
  --c-purchase:  #34d399;   /* 入庫 — terminal green */
  --c-sales:     #a78bfa;   /* 銷貨 — violet */
  --c-print:     #f472b6;   /* 列印 — pink */
  --c-work:      #fb923c;   /* 報工 — construction orange */

  /* Status */
  --c-danger:    #ef4444;
  --c-warn:      #f59e0b;
  --c-success:   #22c55e;
  --c-primary:   #38bdf8;

  /* Text — 2026-06-14 二次提亮（Snow 反映明細頁仍難讀）。
     明細頁暗字橫跨 text-2/text-3/muted 三個變數，上次只動 text-3 不夠。
     於卡片底 #1a2235 量測對比（WCAG AA 門檻 4.5:1）：
       text   #e2e8f0 ≈ 13:1（主要）
       text-2 #bcc8d8 ≈ 9.4:1（次要：收件人/電話/地址 .oq-d-kv）  原 #94a3b8 僅 6.2:1
       text-3 #aab5c8 ≈ 7.6:1（說明：規格行/欄位 key .oq-item-spec/.oq-ck）原 #8492ab 僅 5.1:1
       muted  #8d99ad ≈ 5.5:1（最弱：提示/placeholder）            原 #64748b 僅 3.3:1（不及格）
     四階亮度遞減維持層級，全部過 AA、主要內容達 AAA。 */
  --c-text:      #e2e8f0;
  --c-text-2:    #bcc8d8;
  --c-text-3:    #aab5c8;
  --c-muted:     #8d99ad;

  /* Borders — industrial grid lines */
  --c-border:    rgba(148,163,184,.12);
  --c-border-2:  rgba(148,163,184,.22);
  --c-border-accent: rgba(56,189,248,.3);

  /* Layout */
  --radius-sm:  3px;
  --radius-md:  6px;
  --radius-lg:  8px;
  --radius-xl:  10px;

  /* Shadows — glow-based */
  --glow-blue:   0 0 16px rgba(56,189,248,.20);
  --glow-amber:  0 0 16px rgba(245,158,11,.20);
  --glow-green:  0 0 16px rgba(52,211,153,.20);

  /* Header */
  --header-h: 52px;
  --tap-min:  52px;

  /* Easing */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Font */
  --font: "PingFang TC", "Microsoft JhengHei UI", "蘋方-繁",
          system-ui, -apple-system, sans-serif;
  --font-mono: "SF Mono", "Menlo", "Cascadia Code", "Consolas", monospace;
}

/* ── 2. Reset & Base ──────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
  /* Subtle scanline texture */
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,.04) 2px,
    rgba(0,0,0,.04) 4px
  );
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--c-electric); text-decoration: none; }

pre {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--c-bg);
  border: 1px solid var(--c-border-2);
  border-radius: var(--radius-md);
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--c-success);
}

/* ── 3. Header ────────────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: #070b12;
  border-bottom: 1px solid var(--c-border-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
}

/* Top accent stripe */
header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--c-electric) 20%,
    var(--c-amber) 50%,
    var(--c-electric) 80%,
    transparent 100%
  );
}

header h1 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: .12em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Pulsing power indicator */
header h1::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-success);
  box-shadow: 0 0 0 2px rgba(34,197,94,.2), 0 0 8px rgba(34,197,94,.5);
  animation: blink 3s ease infinite;
}

@keyframes blink {
  0%,90%,100% { opacity: 1; }
  95%          { opacity: .3; }
}

/* Connection status */
.conn-status {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.04);
  color: var(--c-muted);
  border: 1px solid var(--c-border-2);
}

.conn-status.ok {
  background: rgba(34,197,94,.08);
  color: var(--c-success);
  border-color: rgba(34,197,94,.3);
  box-shadow: 0 0 8px rgba(34,197,94,.15);
  animation: pulse-ok 2.5s ease infinite;
}

@keyframes pulse-ok {
  0%,100% { box-shadow: 0 0 8px rgba(34,197,94,.15); }
  50%      { box-shadow: 0 0 14px rgba(34,197,94,.30); }
}



/* ── 5. Main & Screens ────────────────────────────────────── */
main {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 14px 32px;
  position: relative;
}

.screen { display: none; }
.screen.active {
  display: block;
  animation: screen-in .18s var(--ease-out);
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── 6. Typography ────────────────────────────────────────── */
.hint {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--c-electric);
  font-family: var(--font-mono);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.hint::before {
  content: '//';
  color: var(--c-muted);
  font-size: 0.7rem;
}

h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 12px;
}

small {
  font-size: 0.75rem;
  opacity: .6;
  display: block;
  margin-top: 3px;
  font-weight: 400;
}

.required { color: var(--c-danger); }
.small-hint { font-size: 0.76rem; color: var(--c-muted); margin-top: 4px; }

/* ── 7. HOME — User bar ───────────────────────────────────── */
#home-user-bar {
  background: var(--c-panel) !important;
  border: 1px solid var(--c-border-2) !important;
  border-radius: var(--radius-md) !important;
  padding: 10px 14px !important;
  font-size: 0.82rem !important;
  margin-bottom: 14px !important;
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  color: var(--c-text-2);
}

/* ── 8. BIG BUTTONS — Industrial panels ───────────────────── */
button.big {
  display: block;
  width: 100%;
  padding: 0;
  margin-bottom: 8px;
  border: 1px solid var(--c-border-2);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s, transform .12s;
  color: var(--c-text);
  background: var(--c-panel);
  -webkit-font-smoothing: antialiased;
}

/* Left accent bar */
button.big::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--c-electric);
  transition: width .2s;
}

/* Inner padding wrapper */
button.big > span,
button.big {
  padding: 15px 16px 15px 20px;
}

button.big:active {
  transform: scale(.985);
  border-color: var(--c-electric);
  box-shadow: var(--glow-blue);
}

button.big:focus-visible {
  outline: 1px solid var(--c-electric);
  outline-offset: 2px;
}

/* Primary: electric blue zone */
button.big.primary {
  background: var(--c-panel);
  border-color: rgba(56,189,248,.25);
  box-shadow: inset 0 0 0 0 transparent;
}

button.big.primary:hover {
  border-color: rgba(56,189,248,.5);
  box-shadow: inset 0 0 30px rgba(56,189,248,.04), var(--glow-blue);
}

/* Color-coded left bars */
button.big[style*="#059669"]::before,
button.big[style*="#10b981"]::before  { background: var(--c-purchase); }
button.big[style*="#0d9488"]::before  { background: var(--c-sales); }
button.big[style*="#7c3aed"]::before,
button.big[style*="#8b5cf6"]::before  { background: var(--c-print); }
button.big[style*="#ea580c"]::before,
button.big[style*="#fed7aa"]::before  { background: var(--c-work); }
button.big[style*="#0ea5e9"]::before  { background: #7dd3fc; }
button.big[style*="#6366f1"]::before  { background: #a5b4fc; }
button.big[style*="#f59e0b"]::before  { background: var(--c-amber); }

/* Override inline bg — force dark panel */
button.big[style*="background"] {
  background: var(--c-panel) !important;
  color: var(--c-text) !important;
}

/* Ghost/soon buttons */
button.ghost-big {
  display: block;
  width: 100%;
  padding: 14px 16px 14px 20px;
  margin-bottom: 8px;
  border: 1px dashed var(--c-border-2);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--c-muted);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s, color .2s, transform .12s;
  line-height: 1.35;
  position: relative;
}

button.ghost-big::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--c-border-2);
  border-radius: 2px 0 0 2px;
}

button.ghost-big:active { transform: scale(.985); }

/* ── 9. SMALL BUTTONS ─────────────────────────────────────── */
button.small {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1px solid var(--c-border-2);
  border-radius: var(--radius-sm);
  background: var(--c-panel-2);
  color: var(--c-text-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s, transform .1s;
  white-space: nowrap;
  min-height: 30px;
  letter-spacing: .04em;
}

button.small:active { transform: scale(.95); }
button.small:hover  { border-color: var(--c-electric); color: var(--c-electric); }

button.small.primary {
  background: rgba(56,189,248,.1);
  border-color: rgba(56,189,248,.4);
  color: var(--c-electric);
}

/* ── 10. ACTION ROW BUTTONS ───────────────────────────────── */
.actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.actions > button {
  flex: 1;
  display: flex;            /* 文字 H+V 正中央（含「取消」等所有動作鈕）*/
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 90px;
  min-height: var(--tap-min);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--c-border-2);
  transition: transform .12s, border-color .2s, box-shadow .2s;
  position: relative;
}

.actions > button:active { transform: scale(.96); }

/* 主行動鈕（下一步 / 確認 / 送出）全網統一：實心綠底 + 白字，對比鮮明 */
.actions > button.primary {
  background: var(--c-success);
  border-color: var(--c-success);
  color: #fff;
  font-weight: 700;
  box-shadow: inset 0 0 0 0 transparent;
}

.actions > button.primary:hover {
  background: #16a34a;
  border-color: #16a34a;
  box-shadow: var(--glow-green);
}

.actions > button.primary:disabled {
  background: var(--c-panel-2);
  border-color: transparent;
  color: var(--c-muted);
  font-weight: 400;
}

.actions > button.secondary {
  background: var(--c-panel-2);
  color: var(--c-muted);
}

.actions > button.secondary:hover { color: var(--c-text-2); }

.actions > button.danger {
  background: rgba(239,68,68,.1);
  border-color: rgba(239,68,68,.4);
  color: var(--c-danger);
}

.actions > button.danger:hover {
  background: rgba(239,68,68,.16);
  border-color: var(--c-danger);
  box-shadow: 0 0 12px rgba(239,68,68,.2);
}

.actions > button:disabled {
  opacity: .3;
  cursor: not-allowed;
  transform: none !important;
}

/* Ghost back */
button.ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--c-electric);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background .15s;
  min-height: var(--tap-min);
  letter-spacing: .04em;
}
button.ghost:hover { background: rgba(56,189,248,.06); }

button.back-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--c-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
  min-height: var(--tap-min);
  margin-top: 4px;
  letter-spacing: .04em;
}
button.back-home:hover { color: var(--c-text); background: var(--c-panel-2); }

/* ── 11. FORMS ────────────────────────────────────────────── */
label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--c-muted);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  margin-bottom: 14px;
}

label input,
label select,
label textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  background: var(--c-bg);
  border: 1px solid var(--c-border-2);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--c-text);
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  min-height: var(--tap-min);
}

label input[type="number"] {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--c-amber);
  letter-spacing: .05em;
}

label input:focus,
label select:focus,
label textarea:focus {
  outline: none;
  border-color: var(--c-electric);
  box-shadow: 0 0 0 2px rgba(56,189,248,.12), var(--glow-blue);
}

label input::placeholder,
label textarea::placeholder { color: var(--c-text-3); font-style: italic; }

label select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%2338bdf8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  color: var(--c-electric);
}

label textarea { min-height: 80px; resize: vertical; }

/* Checkbox */
label.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--c-text-2);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  margin-bottom: 10px;
}
label.checkbox-row input[type="checkbox"] {
  /* 蓋掉通用 `label input` 的 -webkit-appearance:none + padding，否則 native 勾選框被拔掉、點不到 */
  -webkit-appearance: auto;
  appearance: auto;
  width: 18px; height: 18px;
  min-height: unset; margin: 0; padding: 0;
  cursor: pointer;
  accent-color: var(--c-electric);
}

/* Standalone inputs */
input[type="text"]:not(label *),
input[type="url"]:not(label *),
input[type="number"]:not(label *),
input[type="password"]:not(label *),
input[type="email"]:not(label *),
select:not(label *),
textarea:not(label *) {
  display: block; width: 100%;
  padding: 12px 14px;
  background: var(--c-bg);
  border: 1px solid var(--c-border-2);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.95rem; color: var(--c-text);
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  min-height: var(--tap-min);
}

input[type="text"]:not(label *):focus,
input[type="url"]:not(label *):focus,
input[type="number"]:not(label *):focus,
input[type="password"]:not(label *):focus,
select:not(label *):focus,
textarea:not(label *):focus {
  outline: none;
  border-color: var(--c-electric);
  box-shadow: 0 0 0 2px rgba(56,189,248,.12);
}

/* ── 12. INFO BOX / PANEL ─────────────────────────────────── */
.info-box {
  background: var(--c-panel);
  border: 1px solid var(--c-border-2);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  line-height: 1.65;
  position: relative;
  overflow: hidden;
}

/* Top indicator line */
.info-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--c-electric), transparent);
}

.info-box > div + div { margin-top: 6px; }
.info-box strong {
  color: var(--c-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-family: var(--font-mono);
}

/* ── 13. CAMERA BUTTON ────────────────────────────────────── */
.camera-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100px;
  border: 1px dashed rgba(56,189,248,.3);
  border-radius: var(--radius-md);
  background: rgba(56,189,248,.03);
  cursor: pointer;
  transition: border-color .2s, background .2s;
  margin-bottom: 12px;
  position: relative;  /* 給內部 visually-hidden input 當定位 anchor */
}

.camera-btn:active {
  background: rgba(56,189,248,.08);
  border-color: var(--c-electric);
  box-shadow: var(--glow-blue);
}

/* Snow 2026-06-08：Android Chrome 對 display:none 的 file input 會忽略 capture
   屬性 → 拍照按鈕跳出檔案管理員而非相機。改用 visually-hidden 技巧讓 input
   留在 layout 中（占 1px²、定位 absolute、clip 視覺），capture="environment"
   才會被尊重，Android 才會直接開後置相機。iOS 兩種方式都吃。 */
.camera-btn input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

.camera-btn span {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--c-electric);
  font-family: var(--font-mono);
  letter-spacing: .04em;
}

/* ── 14. PREVIEW IMAGE ────────────────────────────────────── */
#preview-wrap, #pur-preview-wrap,
#wrk-preview-wrap, #print-preview-wrap {
  margin-top: 12px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--c-border-2);
  box-shadow: 0 0 20px rgba(0,0,0,.4);
}

#preview, #pur-preview, #wrk-preview, #print-preview {
  width: 100%; display: block;
}

/* ── 15. SETTINGS BOX ─────────────────────────────────────── */
.token-box {
  background: var(--c-panel);
  border: 1px solid var(--c-border-2);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-top: 20px;
}

.token-box summary {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--c-muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.token-box summary::before {
  content: '▶';
  font-size: 0.55rem;
  color: var(--c-electric);
  transition: transform .2s;
}

.token-box[open] summary::before { transform: rotate(90deg); }
.token-box label { margin-top: 12px; }

/* ── 16. HISTORY ──────────────────────────────────────────── */
.history-tabs {
  display: flex;
  gap: 2px;
  background: var(--c-bg);
  border: 1px solid var(--c-border-2);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: 12px;
}

.history-tab {
  flex: 1;
  padding: 8px 4px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--c-muted);
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.history-tab.active {
  background: var(--c-panel-2);
  color: var(--c-electric);
  border-color: rgba(56,189,248,.3);
  box-shadow: var(--glow-blue);
}

.history-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.history-filter select {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--c-border-2);
  border-radius: var(--radius-sm);
  background: var(--c-panel);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--c-text-2);
  min-height: 38px;
}

.history-stats {
  font-size: 0.75rem;
  color: var(--c-electric);
  font-family: var(--font-mono);
  margin-bottom: 10px;
  padding: 8px 12px;
  background: rgba(56,189,248,.05);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(56,189,248,.15);
  letter-spacing: .04em;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.history-list > * {
  background: var(--c-panel);
  border: 1px solid var(--c-border-2);
  border-left: 2px solid var(--c-electric);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  line-height: 1.55;
}

/* ── 17. ITEM LIST ────────────────────────────────────────── */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

/* 逐列輸入 / 明細卡片的統一深色底（Snow 2026-07-09 全站風格統一）。
   ⚠️ 規則：新卡片一律用深色變數（var(--c-panel-2/3)、var(--c-border-2)），
   絕不要寫死 background:#fff / #f3f4f6 / #ddd 這類淺色（那是舊淺色主題殘留）。
   例外：印在紙上的文件、或黑線白底的示意圖（.dp-card img、.order-preview-pages img）
   才保留白底以維持可讀性。 */
.item-card {
  padding: 10px;
  border: 1px solid var(--c-border-2);
  border-radius: 8px;
  background: var(--c-panel-2);
  margin-bottom: 8px;
}
.item-card.selected {
  border-color: var(--c-border-accent);
  background: var(--c-panel-3);
}

/* ── 18. CONFIRM MODAL — Bottom Sheet ────────────────────── */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(7, 11, 18, .80);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: modal-bg-in .2s ease;
}

@keyframes modal-bg-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.confirm-modal[hidden] { display: none !important; }

.confirm-box {
  width: 100%;
  max-width: 600px;
  background: #0f1724;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border-top: 1px solid var(--c-border-2);
  border-left: 1px solid var(--c-border-2);
  border-right: 1px solid var(--c-border-2);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -12px 48px rgba(0,0,0,.5);
  animation: sheet-up .25s var(--ease-out);
  overflow: hidden;
  position: relative;
}

.confirm-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-warn), transparent);
}

@keyframes sheet-up {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.confirm-header {
  padding: 16px 20px 13px;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--c-warn);
  border-bottom: 1px solid var(--c-border-2);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 8px;
}

.overissue-header {
  color: var(--c-danger);
}

.confirm-body {
  padding: 16px 20px;
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.confirm-question {
  font-size: 0.82rem;
  color: var(--c-text-2);
  margin-bottom: 12px;
  font-family: var(--font-mono);
  letter-spacing: .03em;
}

.confirm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-bottom: 14px;
  font-family: var(--font-mono);
}

.confirm-table th {
  padding: 7px 0;
  color: var(--c-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-align: left;
  width: 40%;
  border-bottom: 1px solid var(--c-border);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.confirm-table td {
  padding: 7px 0;
  font-weight: 700;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text);
}

/* 含稅總額列 highlight */
.q-cf-total-row th, .q-cf-total-row td {
  padding-top: 10px;
  font-size: 1.05rem;
  color: var(--c-amber) !important;
  border-bottom: none;
}
.q-cf-total-row td { font-weight: 800; font-size: 1.2rem; }

.confirm-warning {
  font-size: 0.8rem;
  color: var(--c-warn);
  background: rgba(245,158,11,.06);
  border: 1px solid rgba(245,158,11,.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  line-height: 1.6;
  font-family: var(--font-mono);
  letter-spacing: .02em;
}

.big-num {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--c-amber);
  letter-spacing: .06em;
}

.confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--c-border);
}

.confirm-actions button {
  width: 100%;
  min-height: 50px;
  padding: 12px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s, box-shadow .2s;
  letter-spacing: .04em;
}

.confirm-actions button:active { transform: scale(.97); }

.confirm-actions button.primary,
.confirm-actions button.big-cancel {
  background: var(--c-panel-2);
  border: 1px solid var(--c-border-2);
  color: var(--c-text-2);
}

.confirm-actions button.danger {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.4);
  color: var(--c-danger);
  box-shadow: inset 0 0 0 0 transparent;
}

.confirm-actions button.danger:hover {
  background: rgba(239,68,68,.16);
  box-shadow: 0 0 16px rgba(239,68,68,.2);
}

/* ── 19. RESULT SCREEN ────────────────────────────────────── */
.result-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: transparent;
  color: var(--c-success);
  font-size: 2.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 32px auto 16px;
  border: 2px solid var(--c-success);
  box-shadow: 0 0 0 8px rgba(34,197,94,.08),
              0 0 32px rgba(34,197,94,.25);
  animation: pop-in .35s var(--ease-out);
}

@keyframes pop-in {
  from { transform: scale(.4); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

#screen-result h2 {
  text-align: center;
  color: var(--c-success);
  font-family: var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 1.1rem;
  margin-bottom: 24px;
}

/* ── 20. LOADING ──────────────────────────────────────────── */
.loading {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(7,11,18,.75);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.loading[hidden] { display: none !important; }

.spinner {
  width: 44px;
  height: 44px;
  border: 2px solid rgba(56,189,248,.15);
  border-top-color: var(--c-electric);
  border-right-color: rgba(56,189,248,.4);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  box-shadow: 0 0 16px rgba(56,189,248,.25);
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading p {
  color: var(--c-electric);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

/* ── 21. LOGIN ────────────────────────────────────────────── */
#screen-login { padding-top: 8px; }

#screen-login .hint {
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--c-text);
  margin-bottom: 16px;
  border-bottom: none;
  padding-bottom: 0;
}
#screen-login .hint::before { display: none; }

#login-error {
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

/* ── 22. DATA BADGES ──────────────────────────────────────── */
#sir-data-source-badge,
#wrk-data-source-badge,
#picker-data-source-badge {
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: .06em;
}

/* ── 23. DETAILS/SUMMARY ──────────────────────────────────── */
details summary {
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--c-electric);
  font-weight: 700;
  padding: 6px 0;
  user-select: none;
  list-style: none;
  font-family: var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}

details summary::-webkit-details-marker { display: none; }
details summary::before {
  content: '▶ ';
  font-size: 0.55rem;
  display: inline-block;
  transition: transform .2s;
  vertical-align: middle;
  margin-right: 4px;
}
details[open] summary::before { transform: rotate(90deg); }

details textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--c-border-2);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-top: 8px;
  min-height: 100px;
  resize: vertical;
  background: var(--c-bg);
  color: var(--c-success);
}

/* ── 24. EDIT PANELS ──────────────────────────────────────── */
#sir-edit-panel {
  background: rgba(245,158,11,.06);
  border: 1px solid rgba(245,158,11,.25);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
}

/* ── 25. MANUAL LOOKUP ────────────────────────────────────── */
#m-result {
  background: var(--c-panel) !important;
  border: 1px solid var(--c-border-2) !important;
  border-left: 2px solid var(--c-electric) !important;
  border-radius: var(--radius-md) !important;
  padding: 14px !important;
}

#m-result table td, #m-result table th {
  font-size: 0.82rem;
  padding: 6px 0;
  border-bottom: 1px solid var(--c-border);
  font-family: var(--font-mono);
}

/* ── 26. MONO OVERRIDES ───────────────────────────────────── */
#sir-so, #wrk-so, #pur-multi-so, #pur-picker-po,
#print-confirm-order, #print-picker-order, #pur-cf-po {
  font-family: var(--font-mono);
  color: var(--c-electric);
  letter-spacing: .06em;
}

/* ── 27. PICKER INFO ──────────────────────────────────────── */
#screen-item-picker .info-box,
#screen-purchase-picker .info-box {
  border-left: 2px solid var(--c-stock);
}

/* ── 28. STATUS ───────────────────────────────────────────── */
#wrk-status-info {
  background: var(--c-panel) !important;
  border: 1px solid var(--c-border-2) !important;
  border-radius: var(--radius-sm) !important;
  font-family: var(--font-mono) !important;
  font-size: 0.82rem !important;
  color: var(--c-text-2) !important;
}

/* ── 29. PRINT RESULT ─────────────────────────────────────── */
#screen-print-result h2 {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 24px 0 8px;
  color: var(--c-print);
}

/* ── 30. OVERISSUE QTY ────────────────────────────────────── */
#oi-new-qty {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  border: 1px solid rgba(56,189,248,.4);
  border-radius: var(--radius-sm);
  padding: 12px;
  width: 100%;
  margin-top: 8px;
  font-family: var(--font-mono);
  color: var(--c-amber);
  background: var(--c-bg);
  box-shadow: 0 0 0 2px rgba(56,189,248,.08);
}

/* ── 31. SPECIFIC BUTTONS ─────────────────────────────────── */
#login-submit {
  background: rgba(56,189,248,.1);
  color: var(--c-electric);
  font-size: 0.9rem;
  font-weight: 800;
  border: 1px solid rgba(56,189,248,.35);
  border-radius: var(--radius-md);
  padding: 14px;
  width: 100%;
  min-height: 52px;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(56,189,248,.1);
  transition: border-color .2s, box-shadow .2s, transform .12s;
  font-family: var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}

#login-submit:active {
  transform: scale(.98);
  box-shadow: 0 0 28px rgba(56,189,248,.2);
}

#logout-btn {
  background: rgba(239,68,68,.1) !important;
  color: var(--c-danger) !important;
  border: 1px solid rgba(239,68,68,.3) !important;
  border-radius: var(--radius-sm) !important;
  padding: 4px 12px !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  min-height: 28px;
  font-family: var(--font-mono) !important;
  letter-spacing: .06em;
}

#force-update {
  background: rgba(239,68,68,.1) !important;
  color: var(--c-danger) !important;
  border: 1px solid rgba(239,68,68,.3) !important;
}

#m-fill-all {
  background: rgba(245,158,11,.08);
  color: var(--c-amber);
  border-color: rgba(245,158,11,.25);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: .04em;
}

#sir-so {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--c-electric);
  letter-spacing: .08em;
  font-family: var(--font-mono);
}

/* ── 32. RESPONSIVE ───────────────────────────────────────── */
@media (min-width: 480px) {
  main   { padding: 18px 20px 40px; }
  header { padding: 0 20px; }
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  body { padding-bottom: env(safe-area-inset-bottom); }
}

/* ── 33. SCROLLBAR ────────────────────────────────────────── */
::-webkit-scrollbar       { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border-2); border-radius: 2px; }

/* ── 34. PWA STATUS BAR ───────────────────────────────────── */
@media (display-mode: standalone) {
  header {
    padding-top: calc(env(safe-area-inset-top) + 8px);
    height: calc(var(--header-h) + env(safe-area-inset-top));
  }
}

/* ── 35. FOCUS ────────────────────────────────────────────── */
:focus-visible {
  outline: 1px solid var(--c-electric);
  outline-offset: 2px;
}

/* ── 36. SELECTION ────────────────────────────────────────── */
::selection {
  background: rgba(56,189,248,.2);
  color: var(--c-electric);
}

/* ── 37. READ-ONLY INPUTS (app-layer additions) ─────────────
   2026-05-31 Snow + Claude：JS 將不可改的欄位（如 #api-base）加上
   .input-readonly class，用主題色微弱呈現「鎖定」狀態，避免之前
   inline background=#f3f4f6 撞色看不清。
   未來重設計可整段移除/合併到 inputs 區。
─────────────────────────────────────────────────────────────── */
input.input-readonly,
input.input-readonly:focus {
  background: var(--c-panel-2, rgba(148,163,184,.08));
  color: var(--c-text-2);
  border-style: dashed;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── 38. STATUS BADGES / SUMMARY BANNERS (app-layer additions) ─
   2026-05-31 Snow + Claude：app.js 多處用 inline 亮色 bg/color 表達
   ok/warn/err 狀態（badge、結果摘要等），暗主題下與亮底撞色。
   抽成三條 class — JS 只切狀態、顏色全交給 CSS 管。
   用同色系半透明底 + 淺色文字 + 實心左邊框，暗主題不刺眼。
─────────────────────────────────────────────────────────────── */
.status-ok,
.status-warn,
.status-err {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm, 4px);
  border-left: 3px solid currentColor;
  font-size: 0.85rem;
  line-height: 1.45;
}
.status-ok    { background: rgba(16,185,129,.10); color: #6ee7b7; }
.status-warn  { background: rgba(245,158,11,.10); color: #fcd34d; }
.status-err   { background: rgba(239,68,68,.10);  color: #fca5a5; }

/* ── 39. INFO-BOX COLOR VARIANTS (app-layer additions) ──────
   2026-05-31：HTML 多處 .info-box 用 inline 亮色背景（亮主題遺物），
   在暗主題下會把 Copilot 寫的 .info-box 基底 (var(--c-panel)) 蓋掉、
   再跟繼承的亮文字撞色看不見。改用 .info-{color} variant 接管，
   inline style 全移除 → 落回 .info-box 暗底 + variant 變色。
─────────────────────────────────────────────────────────────── */
.info-box.info-blue {
  background: linear-gradient(180deg, rgba(56,189,248,.10), rgba(56,189,248,.03));
  border-left: 4px solid var(--c-electric, #38bdf8);
}
.info-box.info-green {
  background: linear-gradient(180deg, rgba(16,185,129,.10), rgba(16,185,129,.03));
  border-left: 4px solid #10b981;
}
.info-box.info-yellow {
  background: linear-gradient(180deg, rgba(245,158,11,.10), rgba(245,158,11,.03));
  border-left: 4px solid #f59e0b;
}
.info-box.info-purple {
  background: linear-gradient(180deg, rgba(139,92,246,.10), rgba(139,92,246,.03));
  border-left: 4px solid #8b5cf6;
}
.info-box.info-neutral {
  background: var(--c-panel-2, rgba(148,163,184,.05));
  border-left: 4px solid var(--c-border-2, rgba(148,163,184,.22));
}

/* 通用「資訊小條」— 用在 user-bar、wrk-status-info、edit-panel 等
   非完整 info-box 的內嵌訊息容器。與 .info-box 結構不同（不全寬、不裝飾線）。*/
.info-pill {
  padding: 8px 10px;
  border-radius: var(--radius-sm, 4px);
  font-size: 0.85rem;
  background: var(--c-panel-2, rgba(148,163,184,.06));
  border: 1px solid var(--c-border-2, rgba(148,163,184,.22));
}
.info-pill.info-yellow {
  background: linear-gradient(180deg, rgba(245,158,11,.10), rgba(245,158,11,.03));
  border: 1px solid rgba(245,158,11,.3);
}
.info-pill.info-purple {
  background: linear-gradient(180deg, rgba(139,92,246,.10), rgba(139,92,246,.03));
  border: 1px solid rgba(139,92,246,.3);
  font-weight: 600;
}

/* ── 40. SEMANTIC ACTION BUTTONS (app-layer additions) ─────
   Snow 2026-05-31：用色彩語意統一按鈕意圖，減少使用者誤點。
   工業 HMI 視覺語言（框 + 半透明底 + 亮字），疊在 .primary/.secondary 上覆蓋色彩。
     .btn-cancel    → 紅框：取消/捨棄（destructive）
     .btn-back      → 橘框：返回上一步（neutral nav）
     .btn-go        → 藍框：標準確認/前進
     .btn-go-quick  → 綠框：快速送出（如「全部繳庫」直接送）
   用法：<button class="secondary btn-cancel">取消</button>
─────────────────────────────────────────────────────────────── */
button.btn-cancel {
  background: rgba(239,68,68,.10);
  color: #fca5a5;
  border: 1px solid #ef4444;
  font-weight: 600;
}
button.btn-cancel:hover { background: rgba(239,68,68,.20); }

button.btn-back {
  background: rgba(245,158,11,.10);
  color: #fcd34d;
  border: 1px solid #f59e0b;
  font-weight: 600;
}
button.btn-back:hover { background: rgba(245,158,11,.20); }

/* 主前進/確認鈕全網統一：實心綠底 + 白字 + 流動發亮邊框（Snow 2026-06-01 定案）
   流動邊框只給「綠色前進鈕」用，引導使用者點這裡；紅取消/橘返回不加 */
button.btn-go {
  position: relative;
  background: var(--c-success, #22c55e);
  color: #fff;
  border: 1px solid var(--c-success, #22c55e);
  font-weight: 700;
  /* 呼吸式發光：邊框光暈強弱循環 */
  animation: btn-go-pulse 1.8s ease-in-out infinite;
}
button.btn-go:hover { background: #16a34a; border-color: #16a34a; }
button.btn-go:disabled {
  background: var(--c-panel-2);
  color: var(--c-muted);
  border-color: transparent;
  font-weight: 400;
  animation: none;   /* disabled 不發光 */
}

@keyframes btn-go-pulse {
  0%, 100% { box-shadow: 0 0 4px 0 rgba(34,197,94,.5), 0 0 0 0 rgba(34,197,94,.35); }
  50%      { box-shadow: 0 0 16px 3px rgba(34,197,94,.85), 0 0 0 3px rgba(34,197,94,.18); }
}

/* 流動光點繞邊框跑（conic-gradient 旋轉），更明顯引導點擊 */
button.btn-go::after {
  content: "";
  position: absolute;
  inset: 0;            /* 光環貼齊按鈕邊，不外擴 → 綠框與紅框一樣大（Snow 2026-06-02）*/
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(from var(--btn-go-angle, 0deg),
              transparent 0deg, transparent 270deg,
              #bbf7d0 300deg, #ffffff 330deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  animation: btn-go-rotate 2.4s linear infinite;
  pointer-events: none;
}
button.btn-go:disabled::after { animation: none; background: none; }

@property --btn-go-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
@keyframes btn-go-rotate {
  to { --btn-go-angle: 360deg; }
}

button.btn-go-quick {
  background: rgba(16,185,129,.12);
  color: #6ee7b7;
  border: 1px solid #10b981;
  font-weight: 600;
}
button.btn-go-quick:hover { background: rgba(16,185,129,.22); }

/* ── 41. CONFIRM-MODAL OVERRIDES (Snow's button semantics) ──
   Snow 2026-05-31 三個改動：
   (1) 表格標籤 --c-muted (#64748b) 對比 3.3:1 不達 WCAG AA
       → 改 --c-text-2 (#94a3b8) 5.4:1，工業場景可讀性優先
   (2) 按鈕語意對齊全站規則：執行=藍 btn-go、取消=紅 btn-cancel
       （覆蓋 Copilot 原本用 .danger 給「確認送出」的危險警示設計）
   (3) 「取消」鈕放執行下方、間距加大避免誤觸 destructive cancel
─────────────────────────────────────────────────────────────── */
.confirm-table th {
  color: var(--c-text-2);
  font-size: 0.78rem;             /* 從 0.72 微放大 */
  letter-spacing: .04em;          /* 從 .08em 微縮 */
}

.confirm-actions { gap: 14px; }    /* 之前 8px → 14px */

.confirm-actions button.btn-go {
  background: rgba(56,189,248,.12);
  border: 1px solid var(--c-electric, #38bdf8);
  color: #7dd3fc;
}
.confirm-actions button.btn-go:hover { background: rgba(56,189,248,.22); }

.confirm-actions button.btn-cancel {
  background: rgba(239,68,68,.10);
  border: 1px solid #ef4444;
  color: #fca5a5;
  margin-top: 8px;                  /* 額外間距，視覺上「逃生口在底」感 */
}
.confirm-actions button.btn-cancel:hover { background: rgba(239,68,68,.20); }

/* ── 42. 訂單表列印前預覽 ──
   伺服器把訂單表 PDF 渲成 PNG（iOS PWA 內嵌 PDF 不穩，改用 <img> 最可靠），
   一頁一張直向堆疊。白紙圖配深色底，加白框+陰影像「一張紙」。
─────────────────────────────────────────────────────────────── */
.order-preview-pages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}
.order-preview-pages img {
  width: 100%;
  height: auto;
  display: block;
  background: #fff;
  border: 1px solid rgba(148,163,184,.35);
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
}
.order-preview-loading {
  text-align: center;
  color: var(--c-text-2, #94a3b8);
  padding: 28px 0;
  font-size: 0.9rem;
}

/* ── 23. 報價單（IFAF060 / PJAF119）────────────────────────── */
/* 桌機寬版：進入報價單畫面時 body 加 .q-wide，把容器放寬到可容三欄表頭 */
body.q-wide main { max-width: 1340px; }

.q-legend { color: var(--c-electric); font-weight: 700; }

/* 必填欄位標籤 = 藍色高亮（label 與 表身欄 th 共用；對應 IFAF060 必填V）*/
label.q-f.q-req,
.q-item-table th.q-req { color: var(--c-electric); }

/* 區塊 fieldset */
.q-section {
  border: 1px solid var(--c-border-2);
  border-radius: var(--radius-md);
  padding: 14px 16px 6px;
  margin: 14px 0;
  background: var(--c-panel);
}
.q-section > legend {
  padding: 2px 10px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--c-text);
  font-family: var(--font-mono);
}
.q-section > legend small { color: var(--c-muted); font-weight: 400; }

/* 表頭三欄 grid（窄螢幕自動堆疊）*/
.q-head-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 22px; }
.q-col { min-width: 0; }

/* 報價單欄位：比預設小、不要 uppercase（要顯示中文標籤）*/
.q-f {
  font-size: 0.72rem;
  text-transform: none;
  letter-spacing: .02em;
  margin-bottom: 10px;
}
.q-f input,
.q-f select,
.q-f textarea {
  margin-top: 4px;
  padding: 8px 10px;
  font-size: 0.9rem;
  min-height: 0;
}
/* 表單內數字不要放大成儀表板 amber 風格 */
.q-f input[type="number"] {
  font-size: 0.9rem; font-weight: 400; color: var(--c-text); letter-spacing: 0;
}
.q-f select { color: var(--c-text); }
/* 兩欄並排（幣別/匯率、電話/傳真…）*/
.q-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }

/* 分頁 */
.q-tabs {
  display: flex; gap: 4px; flex-wrap: wrap; align-items: center;
  border-bottom: 1px solid var(--c-border-2); margin-bottom: 12px;
}
.q-tab {
  padding: 8px 14px;
  background: transparent;
  border: 1px solid transparent; border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--c-text-2);
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.q-tab.active { color: var(--c-electric); border-color: var(--c-border-2); background: var(--c-panel-2); }
.q-tabpane { display: none; }
.q-tabpane.active { display: block; }

/* 表身明細表格（橫向可捲動）*/
.q-table-wrap { overflow-x: auto; border: 1px solid var(--c-border); border-radius: var(--radius-sm); }
.q-item-table { border-collapse: collapse; width: 100%; min-width: 980px; font-family: var(--font-mono); }
.q-item-table th, .q-item-table td {
  border: 1px solid var(--c-border);
  padding: 4px 6px; text-align: left; vertical-align: middle;
}
.q-item-table th {
  font-size: 0.7rem; font-weight: 700; color: var(--c-text-2);
  background: var(--c-panel-2); white-space: nowrap;
}
.q-item-table td input,
.q-item-table td select {
  width: 100%; margin: 0; padding: 6px; min-height: 0;
  font-size: 0.85rem; background: var(--c-bg);
  border: 1px solid var(--c-border-2); border-radius: var(--radius-sm);
  color: var(--c-text); font-family: var(--font-mono);
}
.q-item-table td input[type="number"] { font-size: 0.85rem; font-weight: 400; color: var(--c-text); letter-spacing: 0; }
.q-item-table td.q-line-no { text-align: center; color: var(--c-muted); }
.q-item-table .q-del-row {
  background: transparent; border: none; color: var(--c-danger);
  font-size: 1rem; cursor: pointer; padding: 2px 6px;
}
.q-add-row { margin-top: 10px; }

/* 表身欄寬 */
.q-col-no { width: 44px; } .q-col-part { min-width: 150px; } .q-col-ver { width: 56px; }
.q-col-date { width: 140px; } .q-col-qty { width: 88px; } .q-col-unit { width: 88px; }
.q-col-price { width: 96px; } .q-col-grade { width: 120px; } .q-col-del { width: 36px; }

/* 窄螢幕（手機）：三欄改單欄堆疊，仍可用 */
@media (max-width: 760px) {
  body.q-wide main { max-width: 480px; }
  .q-head-grid { grid-template-columns: 1fr; gap: 0; }
}

/* 報價單：客戶查詢結果下拉 */
.q-search-results {
  border: 1px solid var(--c-border-2);
  border-radius: var(--radius-sm);
  background: var(--c-panel-2);
  max-height: 240px; overflow-y: auto;
  margin: -4px 0 10px;
  overscroll-behavior: contain;   /* 面板滾到邊界不帶動背景（防捲動穿透）*/
}
/* 搜尋面板開啟時鎖住整頁背景捲動 */
body.q-scroll-lock { overflow: hidden; }
/* 結果筆數列（置頂，捲動時不消失）*/
.q-search-count {
  position: sticky; top: 0; z-index: 2;
  padding: 7px 12px; font-size: 0.8rem; font-weight: 700;
  color: var(--c-text-2); background: var(--c-panel-2);
  border-bottom: 1px solid var(--c-border-2);
}
.q-search-item {
  display: flex; gap: 10px; align-items: flex-start;
  width: 100%; text-align: left;
  padding: 8px 10px;
  background: transparent; border: none;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text); cursor: pointer;
  font-family: var(--font-mono); font-size: 0.85rem;
}
.q-search-item:last-child { border-bottom: none; }
.q-search-item:hover { background: var(--c-electric-dim); }
/* 固定欄寬，讓每列的品名、規格頭部對齊；品名自動換行顯示全部 */
.q-si-code { color: var(--c-electric); font-weight: 700; flex: 0 0 130px; width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-si-name { color: var(--c-text); font-weight: 600; flex: 0 0 220px; width: 220px; word-break: break-all; white-space: normal; }
.q-si-desc { color: var(--c-muted); flex: 1 1 auto; word-break: break-all; }
.q-search-hint { padding: 8px 10px; color: var(--c-muted); font-size: 0.8rem; }

/* 表身：兩行卡片（取代單行表格，參照 PJAF119 截圖）*/
.q-items-wrap { font-family: var(--font-mono); overflow-x: auto; }
.q-items-head, .q-row1 {
  display: grid;
  grid-template-columns: 30px minmax(94px, 1fr) 52px 162px 124px 60px 88px 74px 152px 26px;
  gap: 6px; align-items: center; min-width: 760px;
}
.q-items-head { padding: 2px 8px 6px; font-size: 0.68rem; font-weight: 700; color: var(--c-text-2); }
.q-items-head .q-req { color: var(--c-electric); }
.q-item-card {
  border: 1px solid var(--c-border-2); border-radius: var(--radius-sm);
  background: var(--c-panel-2); padding: 6px 8px; margin-bottom: 8px; min-width: 760px;
}
.q-row1 { margin-bottom: 6px; }
.q-row2 { display: grid; grid-template-columns: 2fr 2fr 1fr auto; gap: 6px; min-width: 760px; align-items: center; }
.q-row2 .qg-inv { white-space: nowrap; cursor: pointer; width: auto; }
.q-item-card input, .q-item-card select, .q-item-card textarea {
  width: 100%; margin: 0; padding: 6px 8px; min-height: 0;
  font-size: 0.85rem; background: var(--c-bg);
  border: 1px solid var(--c-border-2); border-radius: var(--radius-sm);
  color: var(--c-text); font-family: var(--font-mono);
}
.q-item-card textarea { line-height: 1.4; overflow: hidden; }
.q-item-card input[type="number"] { font-size: 0.85rem; font-weight: 400; color: var(--c-text); letter-spacing: 0; -moz-appearance: textfield; }
.q-item-card input[type="number"]::-webkit-inner-spin-button,
.q-item-card input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.q-item-card .q-line-no { text-align: center; color: var(--c-muted); font-weight: 700; }
.q-item-card .qg-amount {
  color: var(--c-amber); font-weight: 700; font-size: 0.85rem;
  background: var(--c-bg); border: 1px solid var(--c-border-2); border-radius: var(--radius-sm);
  padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.q-item-card .q-del-row {
  background: transparent; border: none; color: var(--c-danger);
  font-size: 1rem; cursor: pointer; padding: 0;
}
/* 料號搜尋下拉（卡片內絕對定位，浮在下方）*/
.q-part-wrap { position: relative; }
.q-part-results {
  position: fixed; z-index: 1000;
  max-height: 74vh; min-width: 320px;
  margin: 0; box-shadow: 0 10px 32px rgba(0,0,0,.65);
  border-radius: var(--radius-md);
}

/* 庫存查詢彈窗 */
.q-inv-box { max-width: 700px; }
.q-inv-part { font-family: var(--font-mono); font-weight: 700; color: var(--c-electric); font-size: 1.05rem; }
.q-inv-desc { color: var(--c-text-2); font-size: 0.85rem; margin: 4px 0 12px; }
.q-inv-boh { font-size: 1rem; color: var(--c-text); }
.q-inv-boh strong { font-size: 1.7rem; color: var(--c-amber); margin: 0 6px; letter-spacing: .03em; }
.q-inv-sub { color: var(--c-text-2); font-size: 0.82rem; margin-top: 6px; }
.q-inv-bom-title { margin: 14px 0 6px; font-weight: 700; color: var(--c-text); font-size: 0.9rem; }
.q-inv-bom { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 0.82rem; }
.q-inv-bom th, .q-inv-bom td { border: 1px solid var(--c-border); padding: 5px 7px; text-align: left; vertical-align: top; }
.q-inv-bom th { background: var(--c-panel-2); color: var(--c-text-2); white-space: nowrap; }
.q-inv-bohcell { text-align: right; color: var(--c-amber); font-weight: 700; }
.q-inv-cdesc { color: var(--c-text-2); }

/* ── v132 報價單調整：字體放大 / 表身切齊 / 日期日曆 / 唯讀視覺 ── */
/* 6. 字體放大 */
.q-f { font-size: 0.82rem; }
.q-f input, .q-f select, .q-f textarea { font-size: 0.98rem; padding: 9px 11px; }
.q-items-head { font-size: 0.78rem; }
.q-item-card input, .q-item-card select { font-size: 0.95rem; padding: 7px 9px; }
.q-item-card input[type="number"] { font-size: 0.95rem; }
.q-item-card .qg-amount { font-size: 0.98rem; }
.q-search-item { font-size: 0.92rem; }
.q-inv-bom { font-size: 0.9rem; }
/* 7. 表身第一行所有格子等高切齊 */
.q-row1 { align-items: stretch; }
.q-row1 > *, .q-row1 input, .q-row1 select, .q-row1 .qg-part { height: 38px; box-sizing: border-box; }
.q-row1 .q-line-no { display: flex; align-items: center; justify-content: center; }
.q-row1 .qg-amount { display: flex; align-items: center; justify-content: flex-end; }
.q-row1 .q-del-row { display: flex; align-items: center; justify-content: center; }
.q-row2 input { height: 36px; box-sizing: border-box; }
/* 版本/單位 唯讀視覺（料件檔帶出、不給改）*/
.q-item-card input[readonly] { background: var(--c-panel); color: var(--c-text-2); cursor: not-allowed; }
/* 5. 出貨日期等日期欄在暗色主題顯示日曆 icon（可點） */
.quotation-screen input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1); opacity: 0.65; cursor: pointer;
}

/* 庫存查詢面板（圖一 IVAF180 風格：兩大數字 + 多格數字）*/
.q-inv-kpis { display: flex; gap: 12px; margin: 10px 0; }
.q-inv-kpi {
  flex: 1; background: var(--c-panel-2); border: 1px solid var(--c-border-2);
  border-radius: var(--radius-md); padding: 10px 12px; text-align: center;
}
.q-inv-kpi span { display: block; color: var(--c-text-2); font-size: 0.78rem; margin-bottom: 2px; }
.q-inv-kpi strong { font-size: 1.7rem; color: var(--c-amber); letter-spacing: .02em; }
.q-inv-kpi em { color: var(--c-text-2); font-style: normal; font-size: 0.8rem; margin-left: 3px; }
.q-inv-kpi.q-inv-neg strong { color: var(--c-danger); }
.q-inv-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.q-inv-cell {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  background: var(--c-bg); border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); padding: 6px 9px;
  font-family: var(--font-mono); font-size: 0.85rem;
}
.q-inv-cell span { color: var(--c-text-2); white-space: nowrap; }
.q-inv-cell b { color: var(--c-text); }

/* ── v135 修正：表身 input 被全域 input[type=...]:not(label *){min-height:52px;padding:12px} 蓋過 ──
   用更高特異度(.quotation-screen .q-row1 input = 0,2,1 > 全域 0,1,2)強制等高切齊 + 再放大字體 */
.quotation-screen .q-row1 input,
.quotation-screen .q-row1 select {
  height: 38px; min-height: 38px; padding: 2px 8px; box-sizing: border-box; font-size: 1rem;
}
/* textarea（料號）：起始38px，JS 輸入時自動撐高 */
.quotation-screen .q-row1 .qg-part {
  min-height: 38px; height: 38px; padding: 2px 8px; box-sizing: border-box; font-size: 1rem; overflow: hidden;
}
.quotation-screen .q-row2 input,
.quotation-screen .q-row2 textarea {
  min-height: 36px; height: 36px; padding: 2px 8px; box-sizing: border-box; font-size: 0.95rem; overflow: hidden;
}
.quotation-screen .q-items-head { font-size: 0.97rem; }  /* 原 0.84rem + ~2pt */

/* 統一出貨日期工具列 */
/* 統一出貨日期：tab 列右上角緊湊版（ml:auto 推到最右）*/
.q-unified-date-bar {
  display: flex; align-items: center; gap: 6px;
  margin-left: auto; padding-bottom: 4px; font-family: var(--font-mono);
}
.q-unified-date-label { font-size: 0.78rem; color: var(--c-text-2); white-space: nowrap; }
.q-unified-date-input {
  width: 130px; padding: 3px 6px; font-size: 0.82rem;
  background: var(--c-bg); border: 1px solid var(--c-border-2);
  border-radius: var(--radius-sm); color: var(--c-text); font-family: var(--font-mono);
  height: 30px;
}
.quotation-screen .q-item-card .qg-amount { font-size: 1rem; }
/* 表頭欄位也一起放大、並修正同一個全域 min-height 造成的高（維持可點高度即可）*/
.quotation-screen .q-f { font-size: 0.99rem; margin-bottom: 6px; }  /* 原 0.86rem + ~2pt */
.quotation-screen .q-f input,
.quotation-screen .q-f select { font-size: 0.98rem; height: 36px; min-height: 36px; padding: 2px 10px; margin-top: 3px; }
.quotation-screen .q-f textarea { min-height: 46px; padding: 6px 10px; margin-top: 3px; }

/* ===== 請購單(IFAF105) 表單：修白底突兀，全部對齊深色主題（Snow 2026-06-17）===== */
/* 表身列 .reqg-row 的料號/版本/數量/交期 input 套深色（date 原本沒被全域規則涵蓋＝白底） */
.quotation-screen .reqg-row input {
  display: block; width: 100%;
  background: var(--c-bg); color: var(--c-text);
  border: 1px solid var(--c-border-2); border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 0.95rem;
  padding: 7px 9px; min-height: 36px; -webkit-appearance: none;
}
.quotation-screen .reqg-row input:focus {
  outline: none; border-color: var(--c-electric); box-shadow: 0 0 0 2px rgba(56,189,248,.12);
}
.quotation-screen .reqg-row .reqg-ver { background: var(--c-panel); color: var(--c-text); opacity: .7; cursor: default; }
/* 所有 date 輸入（表頭開立日期 + 表身預計交期）：深色底 + 月曆 icon 反白才看得見 */
.quotation-screen input[type="date"] { background: var(--c-bg); color: var(--c-text); }
.quotation-screen input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.85); opacity: .7; cursor: pointer; }

/* ===== 查詢訂單（order-query）===== */

/* 寬版容器（桌機）*/
body.oq-wide main { max-width: 900px; }
@media (max-width: 760px) { body.oq-wide main { max-width: 480px; } }

/* ===== 缺料狀況分析（shortage / MRP）— 桌機寬版、寬鬆易讀 ===== */
body.sh-wide main { max-width: 1200px; }
@media (max-width: 900px) { body.sh-wide main { max-width: 480px; } }

.sh-bar-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 10px;
}
.sh-top-actions { display: flex; gap: 8px; }
.sh-top-actions button { width: auto; padding: 8px 16px; font-size: 0.95rem; }

.sh-meta {
  font-size: 0.85rem; color: #94a3b8;
  background: var(--c-panel, #111827); border: 1px solid var(--c-border-2, #1f2937);
  border-radius: var(--radius-lg, 10px); padding: 8px 12px; margin-bottom: 10px; line-height: 1.7;
}
.sh-meta b { color: var(--c-electric, #38bdf8); }

.sh-progress { margin: 10px 0; }
.sh-track { height: 18px; background: #0b1220; border: 1px solid #1f2937; border-radius: 999px; overflow: hidden; }
.sh-fill { height: 100%; width: 2%; background: linear-gradient(90deg, #2563eb, #38bdf8); transition: width .4s ease; }
.sh-ptext { font-size: 0.85rem; color: #cbd5e1; margin-top: 6px; text-align: center; }

.sh-summary { margin: 6px 0 12px; font-size: 1.05rem; color: #e2e8f0; }
.sh-summary .sh-cnt { color: #f87171; font-size: 1.3rem; }
.sh-note { color: #fbbf24; font-size: 0.85rem; }

.sh-empty {
  text-align: center; color: #94a3b8; padding: 40px 16px;
  background: var(--c-panel, #111827); border: 1px dashed #334155;
  border-radius: var(--radius-lg, 10px); font-size: 0.95rem; line-height: 1.8;
}
.sh-empty.sh-ok { color: #4ade80; border-color: #166534; }

.sh-table {
  width: 100%; border-collapse: collapse; font-size: 0.92rem;
  background: var(--c-panel, #111827); border-radius: var(--radius-lg, 10px); overflow: hidden;
}
.sh-table th, .sh-table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid #1f2937; vertical-align: top; }
.sh-table thead th {
  position: sticky; top: 0; z-index: 1; background: #16203a; color: #cbd5e1;
  font-weight: 600; white-space: nowrap; font-size: 0.86rem;
}
.sh-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }
.sh-table tbody tr:hover { background: rgba(56,189,248,0.07); }
.sh-table .sh-n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sh-table .sh-n small { color: #64748b; font-size: 0.78rem; }
.sh-part { font-family: ui-monospace, monospace; color: #93c5fd; font-weight: 600; white-space: nowrap; }
.sh-name { color: #e2e8f0; min-width: 180px; }
.sh-u { color: #94a3b8; }
.sh-short { color: #f87171; font-weight: 700; }
.sh-issued { color: #38bdf8; }
.sh-chk { width: 28px; text-align: center; padding: 2px; }
.sh-excl-cnt { color: #94a3b8; }
.sh-excl-bar {
  padding: 7px 12px; margin: 6px 0 10px;
  background: #1e293b; border-radius: 6px;
  font-size: 0.85rem; color: #94a3b8; display: flex; align-items: center; gap: 10px;
}
.sh-excl-btn { font-size: 0.78rem; padding: 3px 10px; }
.sh-excl-mgmt {
  margin-top: 16px; padding: 10px 14px;
  background: #111827; border: 1px solid #1e293b; border-radius: 8px;
}
.sh-excl-mgmt-label { font-size: 0.8rem; color: #64748b; display: block; margin-bottom: 6px; }
.sh-excl-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.sh-excl-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: #1e293b; color: #94a3b8; border-radius: 4px;
  padding: 2px 6px; font-size: 0.78rem;
}
.sh-excl-rm-btn {
  background: none; border: none; color: #475569;
  cursor: pointer; font-size: 0.9rem; padding: 0 1px; line-height: 1;
}
.sh-excl-rm-btn:hover { color: #f87171; }
.sh-excl-clear-all { font-size: 0.78rem; padding: 3px 10px; }
.sh-suggest { color: #4ade80; font-weight: 700; }
.sh-orders { max-width: 320px; }
.sh-oid {
  display: inline-block; background: #1e293b; color: #cbd5e1; border-radius: 6px;
  padding: 2px 7px; margin: 2px 3px 2px 0; font-size: 0.8rem; font-family: ui-monospace, monospace;
}
.sh-oid small { color: #64748b; margin-left: 3px; }
.sh-more { color: #94a3b8; font-size: 0.8rem; }
@media (max-width: 900px) {
  .sh-table { font-size: 0.82rem; }
  .sh-table th, .sh-table td { padding: 8px 7px; }
  .sh-orders { max-width: none; }
}
.sh-filter-row {
  padding: 6px 0 10px; font-size: 0.85rem; color: #94a3b8;
}
.sh-filter-row input[type="number"] {
  background: #0b1220; color: #e2e8f0;
}
.sh-section-title {
  margin: 20px 0 8px; font-size: 0.95rem; font-weight: 600;
  padding: 6px 10px; border-radius: 6px; background: #1e293b;
}
.sh-warn-title { color: #fbbf24; border-left: 3px solid #f59e0b; }
.sh-summary .sh-warn { color: #fbbf24; }

/* === 缺料表格 v2：訂單移到料號正下方（料號主列 + 訂單子列）=== */
.sh-table-v2 tbody tr:nth-child(even) { background: transparent; }   /* 取消斑馬紋（改兩列一組）*/
.sh-table-v2 .sh-row-main td { border-bottom: none; }
.sh-table-v2 .sh-row-main { border-top: 2px solid #1f2937; }
.sh-table-v2 tbody .sh-row-main:hover { background: rgba(56,189,248,0.07); }
.sh-row-orders td {
  padding: 4px 12px 12px !important; background: rgba(255,255,255,0.015);
  border-bottom: 1px solid #1f2937;
}
/* 等寬網格：每格一樣大、自動填滿換行、整齊對齊 */
.sh-orders-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; align-items: stretch; }
.sh-orders-lead { grid-column: 1 / -1; color: #64748b; font-size: 0.8rem; margin: 0 0 2px; }
/* 訂單號 chip → 可點按鈕（佔滿格子：單號靠左、數量/交期靠右）*/
button.sh-oid {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px; width: 100%; cursor: pointer;
  background: #1e293b; color: #93c5fd; border: 1px solid #334155; border-radius: 6px;
  padding: 5px 10px; margin: 0; font-size: 0.82rem; font-family: ui-monospace, monospace;
  transition: background .15s, border-color .15s; text-align: left;
}
button.sh-oid:hover { background: #2c3e5c; border-color: #38bdf8; color: #e0f2fe; }
button.sh-oid small { color: #64748b; white-space: nowrap; flex-shrink: 0; }

/* === 缺料訂單明細彈窗 === */
.sh-modal { display: flex; align-items: center; justify-content: center; padding: 16px; }
.sh-modal-box {
  width: 100%; max-width: 760px; max-height: 88vh; display: flex; flex-direction: column;
  background: #0f1724; border: 1px solid #1f2937; border-radius: 14px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.sh-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid #1f2937; color: #e2e8f0; font-weight: 600; background: #16203a;
}
.sh-modal-close {
  width: auto; background: transparent; color: #94a3b8; border: none;
  font-size: 1.1rem; cursor: pointer; padding: 4px 9px; border-radius: 6px;
}
.sh-modal-close:hover { background: #1f2937; color: #f1f5f9; }
.sh-modal-body { padding: 16px 18px; overflow-y: auto; color: #cbd5e1; }
.sh-modal-loading { text-align: center; color: #94a3b8; padding: 24px; }
.sh-modal-err { color: #f87171; }
.sh-d-cust { color: #e2e8f0; font-size: 0.92rem; margin-bottom: 12px; line-height: 1.6; }
.sh-d-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.sh-d-table th, .sh-d-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #1f2937; }
.sh-d-table thead th { color: #94a3b8; font-weight: 600; background: #16203a; white-space: nowrap; }
.sh-d-table .sh-n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sh-dp { font-family: ui-monospace, monospace; color: #93c5fd; white-space: nowrap; }
.sh-dn { color: #cbd5e1; }
.sh-d-shipped { color: #4ade80; font-size: 0.8rem; }
.sh-d-empty { color: #64748b; text-align: center; }

/* === 排除設定面板（規則：品名關鍵字 + 料號前綴）=== */
.sh-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px; border-top: 1px solid #1f2937; background: #0b1220; }
.sh-modal-foot button { width: auto; padding: 8px 20px; }
.sh-ex-btn { width: auto; padding: 6px 14px; font-size: 0.85rem; white-space: nowrap; }
.sh-filter-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sh-ex-hint { color: #94a3b8; font-size: 0.84rem; margin: 0 0 14px; line-height: 1.6; }
.sh-ex-group { margin-bottom: 16px; }
.sh-ex-label { color: #e2e8f0; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.sh-ex-label small { color: #64748b; font-weight: 400; margin-left: 8px; }
.sh-ex-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; min-height: 26px; }
.sh-ex-chip {
  display: inline-flex; align-items: center; gap: 4px; background: #1e293b; color: #e2e8f0;
  border: 1px solid #334155; border-radius: 6px; padding: 3px 6px 3px 10px; font-size: 0.84rem;
}
.sh-ex-del { background: transparent; border: none; color: #94a3b8; cursor: pointer; font-size: 0.85rem; padding: 0 2px; width: auto; }
.sh-ex-del:hover { color: #f87171; }
.sh-ex-empty { color: #64748b; font-size: 0.84rem; }
.sh-ex-add { display: flex; gap: 8px; }
.sh-ex-add input {
  flex: 1; background: #0b1220; color: #e2e8f0; border: 1px solid #334155;
  border-radius: 6px; padding: 7px 10px; font-size: 0.88rem;
}
.sh-ex-addbtn { width: auto; padding: 7px 16px; font-size: 1rem; }

/* === 批次動作列（勾選料號後固定浮現在頂部）=== */
.sh-bulk-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: #16203a; border: 1px solid #38bdf8; border-radius: 8px;
  padding: 9px 14px; margin: 8px 0; box-shadow: 0 4px 16px rgba(0,0,0,.35);
}
.sh-bulk-bar[hidden] { display: none; }   /* 必須：覆蓋上面的 display:flex */
.sh-bulk-info { color: #e2e8f0; font-size: 0.9rem; }
.sh-bulk-info b { color: #38bdf8; font-size: 1.05rem; }
.sh-bulk-act { color: #94a3b8; font-size: 0.85rem; display: flex; align-items: center; gap: 6px; }
.sh-bulk-act select {
  background: #0b1220; color: #e2e8f0; border: 1px solid #334155;
  border-radius: 6px; padding: 5px 8px; font-size: 0.85rem;
}
.sh-bulk-bar button { width: auto; padding: 6px 18px; }

/* ERP table-form：gap=1px 搭配 background 做格線，overflow:hidden 截圓角 */
.oq-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--c-border-2);
  border: 1px solid var(--c-border-2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 0 0 14px;
}
@media (max-width: 600px) { .oq-form { grid-template-columns: 1fr; } }

/* 每格：label 左欄（固定寬）+ input 右欄（填滿）*/
.oq-field {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 1px;
  background: var(--c-border-2);
  min-height: 46px;
}

/* label 欄（深色背景）*/
.oq-flabel {
  background: var(--c-panel);
  padding: 0 10px;
  display: flex; align-items: center;
  font-size: 0.76rem; font-weight: 600;
  color: var(--c-text-2);
  white-space: nowrap;
  letter-spacing: .02em;
}

/* input 欄（淺色背景）*/
.oq-ctrl {
  background: var(--c-panel-2);
  padding: 6px 10px;
  display: flex; align-items: center;
  gap: 6px;
}
.oq-ctrl:focus-within { background: var(--c-panel-3); }

/* inputs inside form — 覆蓋全域 min-height:52px tap target */
.oq-form input[type="text"],
.oq-form input[type="date"],
.oq-form select {
  background: transparent; border: none; outline: none;
  color: var(--c-text); font-family: var(--font-mono); font-size: 0.88rem;
  min-height: 30px; height: 30px; padding: 0; width: 100%;
}
.oq-form select { cursor: pointer; }
.oq-form select option { background: var(--c-panel-2); color: var(--c-text); }
.oq-form input::placeholder { color: var(--c-text-3); font-family: var(--font); font-size: 0.85rem; }
.oq-form input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.5); cursor: pointer; }

/* 日期範圍 */
.oq-date-range { flex-wrap: nowrap; gap: 4px; }
.oq-date-range input { flex: 1; min-width: 0; }
.oq-tilde { color: var(--c-text-3); font-size: 0.82rem; flex-shrink: 0; }

/* 客戶多選 wrap */
.oq-customer-wrap {
  flex-direction: column; align-items: stretch;
  position: relative; gap: 4px;
  min-height: 46px; justify-content: center;
}
.oq-customer-wrap input { width: 100%; }

/* chips */
.oq-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.oq-tags:empty { display: none; }
.oq-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--c-electric-dim); border: 1px solid rgba(56,189,248,.45);
  border-radius: 12px; padding: 2px 6px 2px 8px; font-size: 0.76rem; line-height: 1.4;
  font-family: var(--font-mono);
}
.oq-tag-id { color: var(--c-electric); font-weight: 700; }
.oq-tag-name { color: var(--c-text-2); }
.oq-tag-rm {
  background: none; border: none; color: var(--c-text-3); cursor: pointer;
  font-size: 1rem; line-height: 1; padding: 0 2px; transition: color .1s;
}
.oq-tag-rm:hover { color: var(--c-danger); }
/* 全選按鈕（dropdown 第一列）*/
.oq-select-all {
  width: 100%; text-align: left; font-weight: 700;
  color: var(--c-electric); background: var(--c-electric-dim);
  border-bottom: 1px solid var(--c-border-2) !important;
}
.oq-item-selected { opacity: .5; }
.oq-range { gap: 4px; }
.oq-range-label { font-size: 0.82rem; font-weight: 600; color: var(--c-text-2); text-transform: uppercase; letter-spacing: .04em; }
.oq-range-inputs { display: flex; align-items: center; gap: 6px; }
.oq-range-inputs input { flex: 1; min-width: 0; }
.oq-tilde { color: var(--c-text-3); }
.oq-exp {
  font-size: 0.68rem; color: var(--c-amber); border: 1px solid var(--c-amber);
  border-radius: var(--radius-sm); padding: 0 4px; margin-left: 2px; vertical-align: middle;
}
.oq-summary { font-size: 0.9rem; color: var(--c-text); margin: 6px 0 10px; }
.oq-notes {
  margin-top: 6px; font-size: 0.8rem; color: var(--c-amber);
  background: var(--c-amber-dim); border-radius: var(--radius-md); padding: 6px 8px;
}
.oq-empty { text-align: center; color: var(--c-muted); font-size: 0.9rem; padding: 18px 8px; }
/* 同步進度條 */
.oq-progress { margin: 4px 0 12px; }
.oq-progress-label {
  display: flex; justify-content: space-between; font-size: 0.82rem;
  color: var(--c-electric); margin-bottom: 5px; font-family: var(--font-mono);
}
.oq-progress-track {
  height: 8px; background: var(--c-panel-3); border-radius: 99px; overflow: hidden;
  border: 1px solid var(--c-border-2);
}
.oq-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--c-electric), var(--c-success));
  border-radius: 99px; transition: width .4s var(--ease-out);
  box-shadow: 0 0 8px rgba(56,189,248,.4);
}
/* 結果列（可點 → 看明細）*/
.oq-row {
  background: var(--c-panel-2); border: 1px solid var(--c-border-2); border-radius: var(--radius-lg);
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer; transition: border-color .12s, background .12s;
}
.oq-row:hover, .oq-row:active { border-color: var(--c-primary); background: var(--c-panel-3); }
/* 明細頁表頭用同卡片風格但不可點 → 取消 hover 高亮 */
.oq-row-static { cursor: default; }
.oq-row-static:hover, .oq-row-static:active { border-color: var(--c-border-2); background: var(--c-panel-2); }
.oq-row-top { display: flex; align-items: baseline; justify-content: flex-start; gap: 8px; }
.oq-row-id { font-family: var(--font-mono); font-size: 1.12rem; font-weight: 700; color: var(--c-electric); letter-spacing: .03em; }
.oq-row-meta { font-size: 0.82rem; color: var(--c-text-3); font-family: var(--font-mono); margin-left: 4px; }
.oq-row-type { font-size: 0.74rem; color: var(--c-text-2); border: 1px solid var(--c-border-2); border-radius: var(--radius-sm); padding: 0 5px; margin-left: auto; }
/* 報價單/請購單狀態徽章（靠右，依狀態變色）— Snow 2026-06-11 */
.oq-status-badge { font-size: 0.74rem; font-weight: 700; border-radius: var(--radius-sm); padding: 1px 7px; margin-left: auto; white-space: nowrap; }
.oq-st-open     { background: rgba(56,189,248,.14); color: #7dd3fc; }
.oq-st-unsigned { background: rgba(245,158,11,.16); color: #fcd34d; }
.oq-st-signing  { background: rgba(168,85,247,.16); color: #d8b4fe; }
.oq-st-close    { background: rgba(107,114,128,.18); color: #cbd5e1; }
.oq-st-other    { background: rgba(107,114,128,.14); color: var(--c-text-2); }
.oq-row-cust { margin-top: 5px; font-size: 0.92rem; color: var(--c-text); }
/* 品項摘要列 */
.oq-row-items { margin-top: 6px; font-size: 0.88rem; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.oq-loading-dot { color: var(--c-text-3); font-size: 0.82rem; }
.oq-item-first { font-family: var(--font-mono); color: var(--c-text-2); flex: 1 1 100%; }
.oq-item-stats { color: var(--c-amber); font-size: 0.86rem; }
.oq-no-items { color: var(--c-text-3); font-size: 0.82rem; }
/* 明細頁表頭小欄位（收件人/電話/地址）*/
.oq-d-kv { margin-top: 3px; font-size: 0.86rem; color: var(--c-text-2); line-height: 1.5; }
.oq-d-kv .oq-dk { color: var(--c-text-3); margin-right: 6px; }
/* 訂單金額/稅金/含稅（右下，三段分隔、含稅強調）*/
.oq-row-amt {
  margin-top: auto; padding-top: 8px;
  display: flex; flex-wrap: wrap; gap: 5px 8px; justify-content: flex-end; align-items: baseline;
}
.oq-amt-i { font-size: 0.92rem; color: var(--c-success); white-space: nowrap; }
.oq-amt-i i { color: var(--c-text-3); font-style: normal; font-size: 0.76rem; margin-right: 1px; }
.oq-amt-i b { color: var(--c-success); font-weight: 700; }
.oq-amt-total {
  background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.3);
  border-radius: var(--radius-sm); padding: 1px 8px;
}
.oq-amt-total b { font-size: 1.02rem; }
.oq-dk { color: var(--c-text-2); white-space: nowrap; min-width: 46px; }
/* 品項列（明細頁）*/
.oq-item {
  background: var(--c-panel-2); border: 1px solid var(--c-border); border-radius: var(--radius-md);
  padding: 8px 10px; margin-bottom: 6px;
}
.oq-item-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.oq-item-no { font-size: 0.72rem; color: var(--c-text-3); min-width: 1.4em; text-align: right; }
.oq-item-part { font-family: var(--font-mono); font-weight: 600; color: var(--c-text); }
.oq-item-spec { margin-top: 4px; font-size: 0.8rem; color: var(--c-text-3); line-height: 1.4; }
/* 品項中文接在料號後面、以 ｜ 隔開（訂單/報價單/請購單明細共用）*/
.oq-item-specinline { color: var(--c-text-3); font-size: 0.82rem; font-weight: 400; }
/* 品項各欄位（單價/金額/出貨日/等級/批號…）— grid 等寬欄，跨品項同欄對齊工整（三頁共用，一次修好）*/
.oq-item-cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 5px 10px; margin-top: 6px; align-items: baseline; }
/* ↑ align-items: baseline — grid 預設 stretch 不會跨欄對齊文字基線，含中文的值欄（如「15 個」）
   會比純數字欄低幾 px；改 baseline 後同列各欄文字基線對齊（垂直工整）。 */
.oq-cell { display: inline-flex; align-items: baseline; gap: 4px; font-size: 0.82rem; min-width: 0; }
.oq-ck { color: var(--c-text-3); font-size: 0.72rem; }
.oq-cv { color: var(--c-text); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
/* 語意色 — 呼應查詢列表頁配色，讓明細品項有層次不單調（克制：只給「錢」與「數量」上色）*/
.oq-cv-money { color: var(--c-success); min-width: 8ch; text-align: right; }   /* 金額 → 綠（同含稅總額） */
.oq-cv-qty   { color: var(--c-amber);   min-width: 6ch; }                       /* 數量 → 琥珀（同列表頁統計） */
.oq-cv-price { min-width: 7ch; text-align: right; }                            /* 單價 → 固定寬靠右 */
/* ↑ 數值欄固定寬：值長短不一（45 / 90.2 / 142.857）會把後面「金額/出貨日/等級」推歪。
   固定寬後每個品項欄寬一致 → 桌機同列對齊、手機換行點也一致，不再參差。 */
/* 出貨備註（品項層 REMARK2）：amber 強調的獨立行，與規格行區隔、清楚易讀 */
.oq-item-shipnote {
  margin-top: 5px; font-size: 0.82rem; color: var(--c-text); line-height: 1.45;
  background: var(--c-amber-dim); border-left: 2px solid var(--c-amber);
  border-radius: var(--radius-sm); padding: 4px 9px; white-space: pre-line;
}
.oq-snk { color: var(--c-amber); font-size: 0.7rem; font-weight: 600; letter-spacing: .06em; margin-right: 7px; }

/* ERP 式存量列：請購/採購/生產 在途 + 批號庫存（接在每個品項下方）*/
.oq-item-stock {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 7px; padding-top: 7px; border-top: 1px dashed var(--c-border);
}
.oq-bs-cell {
  display: inline-flex; align-items: baseline; gap: 5px;
  background: var(--c-panel); border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); padding: 2px 9px;
}
.oq-bs-k { color: var(--c-text-3); font-size: 0.7rem; }
.oq-bs-v { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.9rem; }
/* 語意色 — 對齊 pipeline：請購(中性) → 採購(電光藍) / 生產(琥珀) → 庫存(綠) */
.oq-bs-cell.bs-req   .oq-bs-v { color: var(--c-text-2); }
.oq-bs-cell.bs-po    .oq-bs-v { color: var(--c-electric); }
.oq-bs-cell.bs-mo    .oq-bs-v { color: var(--c-amber); }
.oq-bs-cell.bs-stock { border-color: var(--c-border-2, var(--c-border)); }
.oq-bs-cell.bs-stock .oq-bs-v { color: var(--c-success); }
.oq-bs-load, .oq-bs-na { font-size: 0.74rem; color: var(--c-text-3); }
.oq-bs-err { font-size: 0.74rem; color: var(--c-danger); }
/* 狀態徽章：結清(綠) / 備料中(電光藍) / 缺口可能漏單(紅) */
.oq-bs-badge {
  display: inline-flex; align-items: center; margin-left: 2px;
  padding: 2px 9px; border-radius: var(--radius-sm);
  font-size: 0.74rem; font-weight: 600;
}
.oq-bs-badge.bs-ok   { color: var(--c-success);  background: rgba(34,197,94,.12); }
.oq-bs-badge.bs-prog { color: var(--c-electric); background: var(--c-electric-dim, rgba(56,189,248,.12)); }
.oq-bs-badge.bs-warn { color: var(--c-danger);   background: rgba(239,68,68,.14); }

/* 清單頂端：筆數 + 資料更新時間 + 立即重抓 */
.oq-sum-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; align-items: baseline; }
.oq-synced { font-size: 0.78rem; color: var(--c-text-3); }
.oq-resync-btn {
  background: var(--c-electric-dim); color: var(--c-electric); border: 1px solid var(--c-border-2);
  border-radius: var(--radius-sm); padding: 2px 8px; font-size: 0.76rem; cursor: pointer; margin-left: 4px;
}
.oq-resync-btn:hover { border-color: var(--c-primary); }
.oq-resync-btn:disabled { opacity: .5; cursor: default; }

/* 查詢結果分頁列（>1 頁才出現，頭尾各一條）*/
.oq-pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 10px; margin: 8px 0; }
.oq-page-btn {
  width: auto; background: var(--c-panel-2); color: var(--c-text);
  border: 1px solid var(--c-border-2); border-radius: var(--radius-sm);
  padding: 7px 18px; font-size: 0.9rem; cursor: pointer; white-space: nowrap;
}
.oq-page-btn:hover:not(:disabled) { border-color: var(--c-primary); background: var(--c-panel-3); }
.oq-page-btn:disabled { opacity: .4; cursor: default; }
.oq-page-ind { color: var(--c-text-2); font-size: 0.88rem; white-space: nowrap; }
.oq-page-ind strong { color: var(--c-text); }
.oq-page-hint { color: var(--c-text-2); font-size: 0.82rem; }

/* 搜尋結果卡：左右兩欄。右欄＝備註(上) + 金額(底)，整欄左側 amber 分隔線(全高、固定常在)。
   右欄約 42%；放不下自動換到下面 */
.oq-row-body { display: flex; gap: 14px; align-items: stretch; flex-wrap: wrap; }
.oq-row-left { flex: 1.4 1 0; min-width: 260px; display: flex; flex-direction: column; }
.oq-row-right {
  flex: 1 1 0; min-width: 230px; display: flex; flex-direction: column;
  border-left: 2px solid var(--c-amber); padding-left: 12px;
}
@media (max-width: 760px) {
  .oq-row-right { border-left: none; border-top: 1px solid var(--c-border); padding-left: 0; padding-top: 8px; margin-top: 6px; }
}
.oq-row-remark-side {
  font-size: 0.86rem; color: var(--c-text); line-height: 1.5;
  background: var(--c-panel-3); border-radius: var(--radius-sm); padding: 5px 10px;
  white-space: pre-line;
}
.oq-row-remark-side::before {
  content: '備註'; display: block; font-size: 0.7rem; color: var(--c-amber);
  letter-spacing: .08em; margin-bottom: 2px;
}

/* 詳細頁表頭卡片 */
.oq-detail-head-card {
  background: var(--c-panel-2); border: 1px solid var(--c-border-2);
  border-radius: var(--radius-lg); padding: 12px 14px; margin-bottom: 10px;
}
/* 金額摘要 chips */
.oq-detail-chips { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 8px 0 4px; }
.oq-chip {
  background: var(--c-panel-3); border: 1px solid var(--c-border-2);
  border-radius: var(--radius-md); padding: 3px 10px; font-size: 0.82rem; color: var(--c-text-2);
}
.oq-chip strong { color: var(--c-success); }
/* 備註（表頭）*/
.oq-detail-remark {
  margin-top: 8px; padding: 6px 10px; font-size: 0.82rem; line-height: 1.5;
  background: var(--c-panel-3); border-radius: var(--radius-sm);
  border-left: 2px solid var(--c-amber); color: var(--c-text-2);
  white-space: pre-line;
}
.oq-detail-remark .oq-dk { margin-right: 6px; }
/* 品項區段標籤 */
.oq-items-section-label {
  font-size: 0.78rem; font-weight: 600; color: var(--c-text-3); text-transform: uppercase;
  letter-spacing: .08em; margin: 4px 0 8px; padding-bottom: 4px;
  border-bottom: 1px solid var(--c-border);
}
/* 已出貨 badge */
.oq-shipped-badge {
  font-size: 0.72rem; padding: 1px 7px; border-radius: 10px; margin-left: 4px;
  background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.3); color: var(--c-success);
  font-family: var(--font-mono);
}
