:root {
  --bg: #f3f5f7; --surface: #fff; --surface2: #f8fafb; --ink: #1b2428; --muted: #5d6b72; --line: #d5dde1; --hair: #e6ebee;
  --brand: #a3307a; --brand-ink: #fff; --accent: #2563a8;
  --ok: #1d7f4e; --warn: #b26a00; --bad: #b83a3a; --info: #2563a8;
  --ok-bg: #e5f4ec; --warn-bg: #fdf1dc; --bad-bg: #fbe7e7; --info-bg: #e6effa; --brand-bg: #f7e6f0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12181b; --surface: #1a2226; --surface2: #20292e; --ink: #e4eaec; --muted: #95a3a9; --line: #3a464c; --hair: #2a353a;
    --brand: #e88cc6; --brand-ink: #1a1a1a; --accent: #5b9be0;
    --ok: #4cc58a; --warn: #e6a23c; --bad: #ec7070; --info: #5b9be0;
    --ok-bg: #16352a; --warn-bg: #3a2d12; --bad-bg: #3d1d1d; --info-bg: #172a42; --brand-bg: #3a1b30;
  }
}
html, body { background: var(--bg); color: var(--ink); font-family: "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif; font-size: 14px; }
a { color: var(--accent); }
.app { display: grid; grid-template-columns: 200px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--hair); padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.side .logo { font-weight: 700; font-size: 15px; padding: 4px 10px 2px; }
.side .logo small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.side a { display: block; padding: 8px 10px; margin: 2px 0; border-radius: 7px; color: var(--ink); text-decoration: none; }
.side a:hover { background: var(--surface2); }
.side a.active { background: var(--brand-bg); color: var(--brand); font-weight: 700; }
.side .sec { font-size: 11px; color: var(--muted); margin: 14px 10px 4px; }
.side .who { padding: 0 10px; font-size: 13px; }
main { padding: 18px 22px 40px; min-width: 0; }
/* 手機：上方 ☰ 列＋左側滑出選單（MainLayout navOpen） */
.mtop, .side-mask { display: none; }
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .mtop { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 900; background: var(--surface); border-bottom: 1px solid var(--hair); padding: 8px 12px; font-weight: 700; }
  .mtop-btn { border: 1px solid var(--line); background: var(--surface2); color: var(--ink); border-radius: 7px; font-size: 18px; line-height: 1; padding: 6px 10px; cursor: pointer; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; width: min(280px, 82vw); height: 100vh; z-index: 960; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 4px 0 18px rgba(0,0,0,.25); }
  .side-mask { display: block; position: fixed; inset: 0; z-index: 950; background: rgba(0,0,0,.35); }
  main { padding: 12px 12px 40px; }
  .top > * { max-width: 100%; }
  .card { overflow-x: auto; }   /* 寬表格在卡片內左右滑，整頁不跟著滑 */
}

.top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.top h1 { font-size: 20px; margin: 0; margin-right: auto; }
.card { background: var(--surface); border: 1px solid var(--hair); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.card h2 { font-size: 15px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h2 .sp { margin-left: auto; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 800px) { .g2, .g3, .g5 { grid-template-columns: 1fr; } }
.kpi { background: var(--surface); border: 1px solid var(--hair); border-radius: 10px; padding: 12px 14px; color: var(--ink); text-decoration: none; display: block; }
.kpi .n { font-size: 26px; font-weight: 700; }
.kpi .l { color: var(--muted); font-size: 12px; }
.kpi.bad .n { color: var(--bad); } .kpi.warn .n { color: var(--warn); }

table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--hair); vertical-align: top; }
table.t th { font-size: 12px; color: var(--muted); font-weight: 500; white-space: nowrap; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--surface2); }
.mono { font-family: Consolas, "IBM Plex Mono", monospace; font-size: 13px; }
.muted { color: var(--muted); }
.rule { font-size: 12px; color: var(--muted); }

.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; white-space: nowrap; }
.t-ok { background: var(--ok-bg); color: var(--ok); } .t-warn { background: var(--warn-bg); color: var(--warn); }
.t-bad { background: var(--bad-bg); color: var(--bad); } .t-info { background: var(--info-bg); color: var(--info); }
.t-mute { background: var(--surface2); color: var(--muted); border: 1px solid var(--hair); } .t-brand { background: var(--brand-bg); color: var(--brand); }

.btn-c { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 7px; padding: 5px 12px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-c:hover { background: var(--surface2); }
.btn-c.pri { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-c.sm { padding: 1px 8px; font-size: 12px; }
.btn-c[disabled] { opacity: .45; cursor: not-allowed; }
.row-f { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 4px 10px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 400; } .kv dd { margin: 0; }
.f { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.f > input, .f > select, .f > textarea { display: block; width: 100%; margin-top: 2px; }
input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 6px; padding: 5px 8px; font: inherit; }
textarea { width: 100%; min-height: 56px; }
.msg { border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 13px; }
.msg.bad { background: var(--bad-bg); color: var(--bad); } .msg.ok { background: var(--ok-bg); color: var(--ok); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--hair); margin: 4px 0 10px; flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 7px 12px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 700; }
.steps { display: flex; gap: 4px; flex-wrap: wrap; margin: 8px 0 4px; }
.step { flex: 1; min-width: 92px; border: 1px solid var(--hair); border-radius: 8px; padding: 6px 8px; cursor: pointer; background: var(--surface2); }
.step b { display: block; font-size: 13px; } .step small { color: var(--muted); font-size: 11px; }
.step.done { border-color: var(--ok); background: var(--ok-bg); } .step.cur { border-color: var(--brand); background: var(--brand-bg); }
.step.review { border-color: var(--warn); background: var(--warn-bg); } .step.picked { outline: 2px solid var(--accent); }
.bar { height: 6px; background: var(--hair); border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; background: var(--ok); }
.timeline { border-left: 2px solid var(--hair); margin-left: 6px; padding-left: 12px; }
.timeline .it { margin-bottom: 10px; position: relative; }
.timeline .it::before { content: ""; position: absolute; left: -18px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.timeline .it.reply::before { background: var(--brand); }
.timeline small { color: var(--muted); }
.login { max-width: 360px; margin: 12vh auto; }

#blazor-error-ui { background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; color: #333; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
h1:focus { outline: none; }

/* Claude 對話回答（Markdown） */
.chat-md > :first-child { margin-top: 0; }
.chat-md > :last-child { margin-bottom: 0; }
.chat-md p, .chat-md ul, .chat-md ol { margin: 6px 0; }
.chat-md h1, .chat-md h2, .chat-md h3 { font-size: 14px; margin: 12px 0 6px; }
.chat-md table { border-collapse: collapse; margin: 6px 0; font-size: 13px; }
.chat-md th, .chat-md td { border: 1px solid var(--hair); padding: 3px 8px; text-align: left; }
.chat-md th { background: var(--surface); color: var(--muted); font-weight: 500; }
.chat-md code { font-family: Consolas, monospace; font-size: 12px; }


/* Claude 浮動對話視窗（每頁右下角） */
.chat-fab { position: fixed; right: 20px; bottom: 20px; z-index: 1000; border: 0; border-radius: 99px; padding: 10px 18px;
  background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 700; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.chat-fab:hover { filter: brightness(1.08); }
/* Mary 客服頭像（img/mary-64.png） */
.chat-fab { display: inline-flex; align-items: center; gap: 8px; padding: 6px 18px 6px 6px; }
.chat-av { width: 36px; height: 36px; border-radius: 50%; flex: none; background: #fff; }
.chat-head .chat-av { width: 30px; height: 30px; }
.chat-a-row { display: flex; align-items: flex-start; gap: 7px; align-self: flex-start; max-width: 100%; }
.chat-a-row .chat-av { width: 26px; height: 26px; margin-top: 2px; }
.chat-a-row .chat-a { min-width: 0; }
.chat-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--warn); margin-left: 6px; vertical-align: middle; }
.chat-win { position: fixed; right: 20px; bottom: 20px; z-index: 1000; width: min(440px, calc(100vw - 32px)); height: min(620px, calc(100vh - 40px));
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--hair); }
.chat-head .sp { margin-left: auto; }
.chat-log { flex: 1; overflow: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-q { align-self: flex-end; max-width: 85%; background: var(--brand-bg); border-radius: 10px; padding: 7px 11px; white-space: pre-wrap; }
.chat-change { align-self: stretch; border: 1px solid var(--hair); border-left: 4px solid #d08a00; border-radius: 8px; padding: 7px 10px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.chat-change.done { border-left-color: #2e8b57; }
.chat-change.saved { border-left-color: var(--line); color: var(--muted); font-size: .92em; }
.chat-hist { display: flex; flex-direction: column; gap: 4px; }
.chat-hist-row { display: flex; justify-content: space-between; gap: 8px; text-align: left; border: 1px solid var(--hair); border-radius: 6px; background: var(--surface); padding: 6px 8px; cursor: pointer; font: inherit; }
.chat-hist-row:hover, .chat-hist-row.on { border-color: var(--accent); }
.chat-hist-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-hist-row .rule { flex: none; }
.chat-change.failed { border-left-color: #c0392b; }
.chat-change.cancelled { border-left-color: var(--hair); opacity: .75; }
.chat-change table.t td.old { color: var(--muted, #888); text-decoration: line-through; }
.chat-change table.t td.new { font-weight: 600; }
.chat-change table.t td { white-space: pre-wrap; word-break: break-word; }
.chat-a { align-self: flex-start; max-width: 100%; background: var(--surface2); border: 1px solid var(--hair); border-radius: 10px; padding: 7px 11px; overflow-x: auto; }
.chat-input { display: flex; gap: 8px; padding: 8px 12px 4px; border-top: 1px solid var(--hair); }
.chat-input textarea { flex: 1; min-height: 44px; max-height: 120px; resize: vertical; }
.chat-foot { padding: 0 12px 8px; font-size: 11px; }
.chat-foot .chat-warn { color: #b26a00; font-weight: 600; }
.chat-foot .chat-over { color: #c0392b; font-weight: 600; }
.chat-cost { align-self: center; font-size: 12px; color: #8a5a00; background: #fff6e0; border: 1px solid #f0d9a0; border-radius: 12px; padding: 3px 10px; }
.chat-attach { position: relative; overflow: hidden; cursor: pointer; align-self: stretch; display: flex; align-items: center; padding: 0 10px; font-size: 16px; }
.chat-attach input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.chat-attach.dis { opacity: .5; pointer-events: none; }
.chat-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 12px 0; border-top: 1px solid var(--hair); }
.chat-file { display: inline-flex; align-items: center; gap: 4px; background: var(--surface2); border: 1px solid var(--hair); border-radius: 12px; padding: 2px 4px 2px 9px; font-size: 12px; max-width: 100%; }
.chat-file small { color: var(--muted, #888); }
.chat-file .x { border: 0; background: transparent; cursor: pointer; color: var(--muted, #888); padding: 0 4px; }
.chat-file-err { color: #c0392b; font-size: 12px; }
.chat-drop { position: absolute; inset: 0; opacity: 0; z-index: 5; pointer-events: none; width: 100%; height: 100%; }
.chat-drop.on { pointer-events: auto; cursor: copy; }
.chat-drop-hint { position: absolute; inset: 8px; z-index: 4; border: 2px dashed var(--brand, #2a6fdb); border-radius: 10px; background: rgba(255,255,255,.92);
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; font-weight: 600; pointer-events: none; }
@media (prefers-color-scheme: dark) { .chat-drop-hint { background: rgba(20,20,20,.92); } .chat-cost { background: #3a2f12; border-color: #6b5520; color: #f0d08a; } }
@media (max-width: 600px) { .chat-fab { right: 16px; bottom: 16px; } .chat-win { right: 16px; bottom: 16px; } }

/* 交易對象資訊（ASSISTANT 第 3 頁版面） */
.dealer-top { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; gap: 14px; margin-bottom: 14px; }
.dealer-top > .card { margin-bottom: 0; }
.dealer-func { display: flex; gap: 12px; align-items: flex-end; background: var(--surface2); border: 1px solid var(--hair); border-radius: 8px; padding: 8px 10px; }
.dealer-func-l { flex: 1; } .dealer-func-l .f { margin-bottom: 4px; }
.dealer-func-r { display: flex; flex-direction: column; gap: 6px; width: 130px; }
.dealer-detail { margin-top: 10px; }
.dealer-detail .f { margin-bottom: 6px; }
.dealer-detail input[readonly] { background: var(--surface2); }
.dealer-list { display: flex; flex-direction: column; min-width: 0; }
.dealer-scroll { overflow: auto; max-height: 520px; border: 1px solid var(--hair); border-radius: 6px; }
.dealer-scroll table.t th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
table.t tr.sel td { background: var(--brand-bg); }
.dealer-query { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: flex-end; margin-bottom: 8px; }
.dealer-query .f { margin-bottom: 4px; }
.dealer-query .f.chk { display: flex; align-items: center; gap: 4px; color: var(--ink); }
.dealer-docs td { font-size: 13px; }
.dealer-docs tr.open td { color: var(--accent); }
@media (max-width: 1100px) { .dealer-top { grid-template-columns: 1fr; } }

/* 主畫面（ASSISTANT MAIN）上方頁籤 */
.main-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 12px; flex-wrap: wrap; }
.main-tabs button { border: 1px solid var(--line); border-bottom: 0; background: var(--surface2); color: var(--muted); padding: 8px 16px; border-radius: 8px 8px 0 0; cursor: pointer; font: inherit; }
.main-tabs button.on { background: var(--surface); color: var(--brand); font-weight: 700; box-shadow: inset 0 -3px 0 var(--brand); }
.main-top { margin-bottom: 14px; }
.dealer-docs tr.overdue td { color: var(--bad); }

/* 主畫面：3 個頁籤的上半部固定同一高度（交易對象清單在框內捲動） */
.main-pane { height: 430px; margin-bottom: 14px; }
.main-pane > .card, .main-pane > .dealer-top { height: 100%; margin-bottom: 0; box-sizing: border-box; }
.main-pane > .card { overflow: auto; }
.main-pane .dealer-top > .card { height: 100%; box-sizing: border-box; overflow: auto; }
.main-pane .dealer-list .dealer-scroll { flex: 1; min-height: 0; max-height: none; }
.main-pane .main-top .dealer-scroll { max-height: 150px !important; }
.main-pane .dealer-detail { margin-top: 8px; }
.main-pane .dealer-detail .f { margin-bottom: 3px; font-size: 11px; }
.main-pane .dealer-detail input, .main-pane .dealer-detail select { padding: 3px 6px; font-size: 13px; }
.main-pane .dealer-detail .grid { gap: 6px !important; }
.main-pane .dealer-func { padding: 6px 8px; }
.main-pane .dealer-func .f { margin-bottom: 2px; }
/* 交易對象資訊：精簡功能列（兩行） */
.acc-func { display: flex; flex-direction: column; gap: 5px; background: var(--surface); border: 1px solid var(--hair); border-radius: 8px; padding: 6px 8px; }
.acc-func-row { display: flex; gap: 6px; align-items: center; }
.acc-func-row select, .acc-func-row input { flex: 1; min-width: 0; padding: 3px 6px; font-size: 13px; }
.acc-func-row .btn-c { flex: none; }
.main-pane .dealer-detail { margin-top: 6px; }
@media (max-width: 1100px) { .main-pane { height: auto; } .main-pane .dealer-list .dealer-scroll { max-height: 320px; } }

/* 單據彈出視窗（訂單 PO Setting／發票） */
.pop-mask { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 950; }
.pop-win { position: fixed; z-index: 960; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 40px);
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.3); outline: none; }
.pop-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--hair); font-size: 16px; }
.pop-head b { color: var(--accent); }
.pop-head .sp { margin-left: auto; }
.pop-body { padding: 10px 14px; overflow: auto; }
.pop-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.pop-grid .f { margin-bottom: 4px; font-size: 11px; }
.pop-grid input, .pop-total input { width: 100%; padding: 3px 6px; font-size: 13px; background: var(--surface2); border: 1px solid var(--line); border-radius: 5px; color: var(--ink); }
.pop-sep { height: 3px; background: var(--brand); opacity: .5; margin: 10px 0; border-radius: 2px; }
.pop-total { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pop-total .f { margin-bottom: 0; font-size: 11px; width: 150px; }
.pop-total span { padding-bottom: 6px; }
.pop-foot { padding: 6px 14px 10px; }
@media (max-width: 700px) { .pop-grid { grid-template-columns: 1fr 1fr; } }

/* 表格每格只顯示一行，超出寬度用左右捲軸 */
table.t.nowrap { width: max-content; min-width: 100%; }
table.t.nowrap th, table.t.nowrap td { white-space: nowrap; }

/* 勾選框放在文字前面、同一行 */
.f.chk { display: flex; align-items: center; gap: 6px; color: var(--ink); cursor: pointer; }
.f.chk > input[type=checkbox] { display: inline-block; width: auto; margin: 0; }

/* 主畫面 3 個頁籤：柔和色系（款項＝淡玫瑰、產品＝淡天空藍、交易對象＝淡薄荷綠） */
:root {
  --tab-inv: #b5677f; --tab-inv-bg: #fbf1f4; --tab-inv-line: #ecc9d4;
  --tab-product: #5a86b3; --tab-product-bg: #f0f5fb; --tab-product-line: #c8dbee;
  --tab-dealer: #4f9a7c; --tab-dealer-bg: #eff8f4; --tab-dealer-line: #c4e3d6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --tab-inv: #e3a3b6; --tab-inv-bg: #2b2127; --tab-inv-line: #5a3d48;
    --tab-product: #9cc0e6; --tab-product-bg: #1f2731; --tab-product-line: #3b5168;
    --tab-dealer: #92d0b6; --tab-dealer-bg: #1e2a26; --tab-dealer-line: #3a5a4d;
  }
}
.main-tabs button.t-inv { background: var(--tab-inv-bg); border-color: var(--tab-inv-line); }
.main-tabs button.t-product { background: var(--tab-product-bg); border-color: var(--tab-product-line); }
.main-tabs button.t-dealer { background: var(--tab-dealer-bg); border-color: var(--tab-dealer-line); }
.main-tabs button.t-inv.on { color: var(--tab-inv); box-shadow: inset 0 -3px 0 var(--tab-inv); }
.main-tabs button.t-product.on { color: var(--tab-product); box-shadow: inset 0 -3px 0 var(--tab-product); }
.main-tabs button.t-dealer.on { color: var(--tab-dealer); box-shadow: inset 0 -3px 0 var(--tab-dealer); }
.main-tabs button:not(.on) { opacity: .75; }
.main-tabs button:not(.on):hover { opacity: 1; }
.main-pane.t-inv .card { background: var(--tab-inv-bg); border-color: var(--tab-inv-line); }
.main-pane.t-product .card { background: var(--tab-product-bg); border-color: var(--tab-product-line); }
.main-pane.t-dealer .card { background: var(--tab-dealer-bg); border-color: var(--tab-dealer-line); }
.main-pane.t-inv .card h2 { color: var(--tab-inv); }
.main-pane.t-product .dealer-func b, .main-pane.t-product .card h2 { color: var(--tab-product); }
.main-pane.t-dealer .dealer-func b { color: var(--tab-dealer); }
.main-pane .dealer-func { background: var(--surface); }
.main-pane .dealer-scroll { background: var(--surface); }

/* ===== 全系統：按鍵＝紫紅色、可輸入欄位＝淡黃色（2026-10-09）===== */
:root { --input-bg: #fffbe3; --input-line: #e8dca0; --readonly-bg: var(--surface2); }
@media (prefers-color-scheme: dark) { :root { --input-bg: #35311e; --input-line: #5c5530; } }

/* 按鍵：主要動作紫紅底白字；次要動作紫紅框紫紅字 */
.btn-c { border-color: var(--brand); color: var(--brand); background: var(--surface); font-weight: 500; }
.btn-c:hover { background: var(--brand-bg); }
.btn-c.pri { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-c.pri:hover { filter: brightness(1.08); background: var(--brand); }
.btn-c[disabled], .btn-c[disabled]:hover { border-color: var(--line); color: var(--muted); background: var(--surface2); filter: none; opacity: .6; }

/* 可輸入欄位：淡黃色底；唯讀或停用：灰底 */
input:not([type]), input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], input[type=email], select, textarea {
  background: var(--input-bg); border-color: var(--input-line); }
input[readonly], input:disabled, select:disabled, textarea[readonly], textarea:disabled,
.pop-grid input[readonly], .pop-total input[readonly], .dealer-detail input[readonly] {
  background: var(--readonly-bg) !important; border-color: var(--line); color: var(--ink); }
.pop-grid input:not([readonly]), .pop-grid select:not(:disabled) { background: var(--input-bg); border-color: var(--input-line); }

/* 下拉式選單、日期選擇：淺灰色底（文字輸入維持淡黃色）（2026-10-09） */
:root { --pick-bg: #eef1f3; --pick-line: #cfd6da; }
@media (prefers-color-scheme: dark) { :root { --pick-bg: #2a3236; --pick-line: #46525a; } }
select, input[type=date], input[type=datetime-local], input[type=month], input[type=time],
.pop-grid select:not(:disabled), .pop-grid input[type=date]:not([readonly]) {
  background-color: var(--pick-bg); border-color: var(--pick-line); }
select:disabled, input[type=date]:disabled { opacity: .7; }

/* 左側樹狀選單 */
.side .tree-node { display: flex; align-items: center; gap: 2px; }
.side .tree-node > a { flex: 1; margin: 2px 0; }
.side .tree-tog { width: 20px; flex: 0 0 20px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0; text-align: center; }
.side .tree-tog:hover { color: var(--brand); }
.side span.tree-tog { cursor: default; }
.side .tree-children { margin-left: 20px; padding-left: 8px; border-left: 1px solid var(--hair); }
.side .tree-children a { padding: 6px 10px; font-size: 13px; }
.side .tree-node > a.tree-group { color: var(--ink); font-weight: 500; }

/* 倉儲系統 */
.stock-top { margin-bottom: 14px; }
.stock-bottom { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; }
.stock-bottom > .card { margin-bottom: 14px; min-width: 0; }
@media (max-width: 1100px) { .stock-bottom { grid-template-columns: 1fr; } }

/* 訂單視窗挑選客戶／產品時的提示列；不換行的小按鍵 */
.pick-bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
.nowrap-btn { white-space: nowrap; flex: 0 0 auto; }
input[type=date]:not([readonly]):not(:disabled) { cursor: pointer; caret-color: transparent; }

/* 倉儲系統：操作區、移倉／IQC 視窗 */
.op-card { margin-bottom: 14px; border-color: var(--brand); }
.op-card h2 { display: flex; align-items: center; gap: 6px; }
.pop-win.wide { width: min(1180px, calc(100vw - 32px)); }
.pop-body h3.sub { font-size: 14px; margin: 12px 0 4px; color: var(--accent); }
.assign-box { margin-top: 10px; padding: 8px 10px; border: 1px solid var(--brand); border-radius: 8px; background: var(--brand-bg); }
.assign-box select, .op-card select, .op-card input:not([type=checkbox]):not([type=radio]) { background: var(--input-bg); border: 1px solid var(--input-line); border-radius: 5px; padding: 3px 6px; }
.tag-warn { background: var(--warn-bg); color: var(--warn); border-radius: 4px; padding: 0 6px; font-size: 12px; }
/* 產品狀況 */
.status-sum { margin: 10px 0 4px; padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.status-sum.ok { background: var(--ok-bg); color: var(--ok); } .status-sum.bad { background: var(--bad-bg); color: var(--bad); }
.tag-ok { background: var(--ok-bg); color: var(--ok); border-radius: 4px; padding: 0 6px; font-size: 12px; }
.tag-bad { background: var(--bad-bg); color: var(--bad); border-radius: 4px; padding: 0 6px; font-size: 12px; }
table.t tr.sub-row td { color: var(--muted); font-size: 12px; background: var(--surface2); }
/* 出入貨列表的條件列：一行排列，選項文字不換行 */
.ledger-opts { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.ledger-opts .f { margin-bottom: 0; }
.ledger-opts .opt { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; padding-bottom: 6px; }
/* 產品狀況：表頭、樹狀圖、甘特圖 */
.sch-head { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; font-size: 13px; }
.sch-head span { color: var(--muted); }
.sch-head b { color: var(--accent); font-weight: 500; }
.sch-trees { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 10px; }
.sch-pane { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; height: 340px; overflow: auto; background: var(--surface); }
@media (max-width: 900px) { .sch-head { grid-template-columns: 1fr 1fr; } .sch-trees { grid-template-columns: 1fr; } }
ul.tree { list-style: none; margin: 0; padding-left: 18px; }
ul.tree.tree-root { padding-left: 0; }
.tree-row { display: flex; align-items: center; gap: 4px; padding: 1px 2px; border-radius: 4px; white-space: nowrap; font-size: 13px; }
.tree-row.sel { background: var(--brand-bg); }
.tree-tg { width: 14px; height: 14px; line-height: 12px; text-align: center; border: 1px solid var(--line); border-radius: 3px; font-size: 11px; cursor: pointer; flex: none; color: var(--muted); }
.tree-tg.empty { border-color: transparent; cursor: default; }
.tree-tx { cursor: pointer; }
.tree-ic { width: 10px; height: 10px; border-radius: 50%; flex: none; background: transparent; }
.ic-ok { background: #2e9d5b; } .ic-bad { background: #d33; } .ic-warn { background: #e8a317; } .ic-demand { background: #2f80ed; border-radius: 2px; }
.ic-res { background: #8e44ad; border-radius: 2px; } .ic-stock { background: #5d6d7e; border-radius: 2px; } .ic-other { background: #b0b7bf; border-radius: 2px; }
.ic-order { background: #27ae60; transform: rotate(45deg); border-radius: 1px; } .ic-future { background: #f39c12; transform: rotate(45deg); border-radius: 1px; }
.ic-process { background: #16a2b8; } .ic-product { background: #9b59b6; } .ic-sum { background: #34495e; border-radius: 2px; }
.gantt { border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.g-row { display: grid; grid-template-columns: 260px 1fr; gap: 8px; align-items: center; min-height: 22px; }
.g-label { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.g-track { position: relative; height: 16px; border-bottom: 1px dashed var(--hair); }
.g-bar { position: absolute; top: 3px; height: 10px; border-radius: 3px; background: var(--accent); }
.g-bar.late { background: #9aa4ad; }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: #d33; }
.g-axis .g-track { border: 0; font-size: 11px; color: var(--muted); }
.g-axis .g-track span { position: absolute; top: 0; }
/* 第二層彈出視窗（產品狀況 → 委內工單） */
.pop-mask.top { z-index: 970; }
.pop-win.top { z-index: 980; width: min(640px, calc(100vw - 32px)); }
.tree-tx.act { color: var(--brand); text-decoration: underline dotted; }
/* Shipping Action（產品入倉／出貨）視窗：依 ASSISTANT 版面 */
.sa-win { width: min(1080px, calc(100vw - 32px)); }
.sa-top { display: grid; grid-template-columns: 1fr 150px; gap: 10px; background: #e3f3f8; border-radius: 8px; padding: 8px 10px; }
.sa-info { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 10px; }
.sa-info .f, .sa-total .f, .sa-edit .f { font-size: 11px; margin-bottom: 2px; }
.sa-info input, .sa-info textarea, .sa-edit input, .sa-total input { width: 100%; padding: 3px 6px; font-size: 13px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); }
.sa-info textarea { resize: vertical; font-family: inherit; }
.sa-info input[readonly], .sa-info textarea[readonly], .sa-edit input[readonly], .sa-total input[readonly] { background: var(--surface2); }
.sa-span2 { grid-column: span 2; } .sa-span4 { grid-column: span 4; }
.sa-btns { display: flex; flex-direction: column; gap: 6px; }
.sa-btns .btn-c { text-align: center; }
.sa-items { display: grid; grid-template-columns: 1fr 140px; gap: 10px; margin-top: 10px; background: #e6e6e6; border-radius: 8px; padding: 8px 10px; }
.sa-cap { font-size: 12px; color: var(--muted); }
.sa-edit { display: grid; grid-template-columns: 80px 80px 2fr 100px 110px 2fr; gap: 6px; margin: 4px 0 6px; }
.sa-modes { display: flex; flex-direction: column; gap: 6px; padding-top: 18px; }
.sa-modes .opt { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; font-size: 13px; }
.sa-total { display: grid; grid-template-columns: 3fr 110px 150px 150px auto; gap: 10px; align-items: end; margin-top: 8px; }
.sa-sep { height: 6px; background: #1d4ed8; border-radius: 3px; margin: 10px 0; }
.sa-bottom { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; margin-top: 10px; align-items: stretch; }
.sa-box { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px 8px; display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin: 0; }
.sa-box.from { background: #dbe9f9; } .sa-box.to { background: #dcefdc; }
.sa-box legend { font-size: 12px; padding: 0 4px; }
.sa-box select { padding: 3px 6px; border: 1px solid var(--line); border-radius: 5px; max-width: 100%; }
.sa-box .f { margin: 0; font-size: 11px; }
.sa-exec { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; padding: 8px 20px; border: 2px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; color: var(--ink); }
.sa-exec .chk { color: #22a33a; font-size: 30px; }
.sa-exec[disabled] { opacity: .45; cursor: not-allowed; }
@media (prefers-color-scheme: dark) { .sa-top { background: #183038; } .sa-items { background: #2a2a2a; } .sa-box.from { background: #1c2a3c; } .sa-box.to { background: #1c321c; } }
@media (max-width: 900px) { .sa-top, .sa-items, .sa-bottom { grid-template-columns: 1fr; } .sa-info { grid-template-columns: 1fr 1fr; } .sa-span4 { grid-column: span 2; } .sa-edit, .sa-total { grid-template-columns: 1fr 1fr; } }
/* 列印出貨單 */
.print-bar { display: flex; gap: 10px; align-items: center; padding: 10px 16px; }
.print-page { max-width: 900px; margin: 0 auto; padding: 16px; background: #fff; color: #000; font-size: 13px; }
.pp-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 10px; }
.pp-co { font-size: 16px; font-weight: 600; } .pp-title { font-size: 20px; font-weight: 700; text-align: right; } .pp-title small { font-size: 12px; font-weight: 400; }
.print-page table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.print-page th, .print-page td { border: 1px solid #555; padding: 4px 6px; vertical-align: top; text-align: left; }
.print-page th { background: #eee; font-weight: 600; white-space: nowrap; }
.pp-items td.n { text-align: right; } .pp-items tr.tot td { font-weight: 600; }
.print-page td.pre { white-space: pre-line; }
.pp-sign { display: flex; justify-content: space-between; margin-top: 40px; } .pp-sign span { width: 30%; border-top: 1px solid #000; padding-top: 4px; }
@media print { .no-print { display: none !important; } body { background: #fff !important; } .print-page { padding: 0; } }
/* 視窗右上角的關閉 X */
.pop-x { border: 0; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; padding: 2px 6px; border-radius: 6px; cursor: pointer; }
.pop-x:hover { background: var(--bad-bg); color: var(--bad); }
/* 點兩下開啟的清單：點一下反白 */
table.t tr.dbl.picked td { background: var(--brand-bg); }
table.t tr.dbl { user-select: none; }
.sa-exec.done, .sa-exec.done[disabled] { opacity: 1; background: var(--surface2); color: var(--muted); cursor: default; }
.sa-exec.done .chk { color: var(--muted); }
/* IQC 視窗：依 ASSISTANT 版面 */
.iqc-win { width: min(1200px, calc(100vw - 32px)); }
.iqc-top { display: grid; grid-template-columns: 1fr 340px; gap: 12px; }
.iqc-info { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 12px; background: #fdfbe6; border-radius: 8px; padding: 8px 10px; font-size: 13px; align-content: start; }
.iqc-info span { color: var(--muted); }
.iqc-info .iqc-span2 { grid-column: span 2; font-size: 11px; }
.iqc-info select { width: 100%; padding: 3px 6px; }
.iqc-desc { align-self: end; color: var(--accent); }
.iqc-photo { border: 1px solid var(--line); border-radius: 8px; padding: 6px; font-size: 13px; }
.iqc-photo img { width: 100%; max-height: 220px; object-fit: contain; margin-top: 6px; background: #000; border-radius: 4px; }
.iqc-nophoto { height: 160px; display: grid; place-items: center; color: var(--muted); background: var(--surface2); border-radius: 4px; margin-top: 6px; }
table.t tr.iqc-tbd td { color: #1d4ed8; } table.t tr.iqc-ng td { color: #c62828; } table.t tr.iqc-cancel td { color: var(--muted); }
table.iqc-measure { margin-top: 6px; max-width: 520px; } table.iqc-measure input, table.iqc-measure select { width: 100%; padding: 2px 4px; }
.iqc-spec { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 4px; padding: 6px 8px; border: 1px solid #b23; border-radius: 6px; background: #f3f8f1; }
.iqc-spec .opt, .assign-box .opt { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 13px; }
.iqc-bottom { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; padding: 8px 10px; background: #dfeaf7; border-radius: 8px; font-size: 13px; }
.iqc-bottom span { color: var(--muted); } .iqc-bottom select, .iqc-bottom input { padding: 3px 6px; }
@media (prefers-color-scheme: dark) { .iqc-info { background: #2e2c1c; } .iqc-spec { background: #1c2a1c; } .iqc-bottom { background: #1c2a3c; } }
@media (max-width: 900px) { .iqc-top { grid-template-columns: 1fr; } .iqc-info { grid-template-columns: 1fr 1fr; } }
/* 材料移倉：數量不足整列紅字 */
table.t tr.short td { color: #c62828; }
/* 精簡搜尋列中的勾選 */
.acc-func-row .opt { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; font-size: 12px; flex: none; }
/* IQC 全畫面（2026-10-12）：整個視窗固定，只有檢驗紀錄清單捲動 */
.iqc-full { position: fixed; inset: 0; z-index: 960; background: var(--surface); display: flex; flex-direction: column; }
.iqc-full .iqc-msg { margin: 4px 12px; }
.iqc-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(280px, 1fr); gap: 12px; padding: 8px 12px 10px; }
.iqc-left { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.iqc-list { flex: 1; min-height: 120px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.iqc-item { border: 2px solid #7a1f2b; border-radius: 6px; padding: 6px 8px; background: #eef4f8; }
.iqc-item-title { font-weight: 600; color: #7a1f2b; margin-bottom: 4px; } .iqc-item-title span { font-weight: 400; color: var(--muted); font-size: 12px; }
.iqc-judge { display: grid; grid-template-columns: 1fr 220px 120px; gap: 8px; margin-top: 6px; align-items: start; }
.iqc-measure-box { min-height: 70px; } .iqc-measure-box textarea { width: 100%; }
.iqc-defect { background: #fffbe0; border-radius: 6px; padding: 4px 6px; } .iqc-defect .f { color: #c62828; } .iqc-defect input, .iqc-defect select { width: 100%; }
.iqc-btns { display: flex; flex-direction: column; gap: 6px; }
.iqc-bottom { display: grid; grid-template-columns: 120px 150px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; background: #dfeaf7; border-radius: 8px; font-size: 13px; margin-top: 0; }
.iqc-result { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; } .iqc-result .iqc-note { grid-column: span 2; } .iqc-result input, .iqc-result select { width: 100%; }
.iqc-calc { font-size: 15px; padding: 10px 18px; }
.iqc-right { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: auto; border-left: 1px solid var(--hair); padding-left: 12px; }
.iqc-right img { width: 100%; max-height: 42vh; object-fit: contain; background: #000; border-radius: 4px; }
.iqc-photo-count { color: #1d4ed8; }
.iqc-later { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; margin: 0; } .iqc-later legend { font-size: 12px; }
@media (prefers-color-scheme: dark) { .iqc-item { background: #1c2630; } .iqc-defect { background: #2e2c1c; } .iqc-bottom { background: #1c2a3c; } }
@media (max-width: 1250px) { .iqc-body { grid-template-columns: minmax(0, 3fr) minmax(220px, 1fr); } .iqc-judge { grid-template-columns: 1fr 190px 104px; } .iqc-right img { max-height: 30vh; } }
@media (max-width: 700px) { .iqc-body { grid-template-columns: 1fr; overflow: auto; } .iqc-judge, .iqc-bottom { grid-template-columns: 1fr; } }
/* IQC 量測紀錄：緊湊（最多 5 筆） */
table.iqc-measure { margin-top: 0; }
table.iqc-measure th, table.iqc-measure td { padding: 1px 4px; font-size: 12px; }
table.iqc-measure input, table.iqc-measure select { padding: 1px 4px; font-size: 12px; height: 24px; }
.iqc-item { padding: 4px 8px; } .iqc-spec { margin-top: 2px; padding: 4px 6px; } .iqc-judge { margin-top: 4px; }
/* IQC：左下品管圖面〔開啟〕、右下〔自動產生IQC〕、品管圖面檢視視窗（蓋在全畫面 IQC 之上） */
.iqc-draw { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; background: #d9ecd9; padding: 6px 8px; border-radius: 6px; }
.iqc-draw .btn-c { min-width: 96px; }
.iqc-auto { display: flex; justify-content: flex-end; margin-top: auto; }
.pop-mask.iqc-dwg-mask { z-index: 970; }
.pop-win.iqc-dwg { z-index: 980; width: min(1100px, calc(100vw - 32px)); }
.iqc-dwg-body { display: flex; justify-content: center; }
.iqc-dwg-body img { max-width: 100%; max-height: calc(100vh - 160px); object-fit: contain; background: #fff; }
@media (prefers-color-scheme: dark) { .iqc-draw { background: #1c2a1c; } }
/* 工作日誌（委內／委外工單）：固定全畫面，版面依 ASSISTANT WorkRecord */
.wl-full { position: fixed; inset: 0; z-index: 955; background: var(--surface); display: flex; flex-direction: column; overflow: hidden; }
.wl-msg { margin: 4px 12px; }
.wl-head { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px 14px; margin: 6px 12px; padding: 8px 12px; background: #dfeaf7; border-radius: 8px; font-size: 14px; color: #1a3d8f; }
.wl-head span { color: #333; } .wl-head .wl-span2 { grid-column: span 2; }
.wl-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(340px, 2fr) minmax(0, 3fr); gap: 10px; padding: 0 12px; }
.wl-left { display: flex; flex-direction: column; gap: 6px; overflow: auto; background: #fffbe8; border-radius: 8px; padding: 8px 10px; min-height: 0; }
.wl-who { color: #1a3d8f; font-size: 16px; }
.wl-modes { display: flex; gap: 14px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
.wl-desc { color: #1a3d8f; font-weight: 600; min-height: 22px; }
.wl-sop { display: grid; grid-template-columns: 180px 1fr; gap: 8px; align-items: start; }
.wl-sop-sel { display: flex; flex-direction: column; gap: 4px; } .wl-sop-sel select { width: 100%; }
.wl-sop-note { font-size: 12px; white-space: pre-line; border: 1px solid var(--line); border-radius: 4px; padding: 4px; min-height: 48px; max-height: 90px; overflow: auto; background: var(--surface); }
.wl-sop-img img { width: 100%; max-height: 190px; object-fit: contain; background: #fff; border: 1px solid var(--hair); border-radius: 4px; }
.wl-box { border: 1px solid #8fb38f; background: #e3efe3; border-radius: 6px; padding: 6px 8px; margin: 0; } .wl-box legend { font-size: 13px; }
.wl-defect { margin-top: 6px; } .wl-check { margin-top: 6px; } .wl-check tr.short td { color: #c62828; }
.wl-btns { justify-content: flex-end; margin-top: auto; padding-top: 6px; }
.wl-right { display: grid; grid-template-rows: minmax(0, 3fr) minmax(0, 2fr); gap: 8px; min-height: 0; }
.wl-panel { border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px 8px; margin: 0; min-height: 0; display: flex; flex-direction: column; }
.wl-records { background: #fffbe8; } .wl-status { background: #eaf5ea; }
.wl-scroll { flex: 1; min-height: 0; max-height: none !important; overflow: auto; margin-top: 4px; }
tr.wl-mine td { color: #1565c0; } tr.wl-mine-semi td { color: #2e7d32; }
.wl-chart { display: grid; grid-template-columns: 1fr 200px; gap: 10px; margin: 8px 12px 10px; height: 130px; }
.wl-gantt { border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px 6px; position: relative; }
.wl-gantt-row { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 8px; }
.wl-gantt-label { font-size: 13px; } .wl-gantt-track { position: relative; height: 18px; border-bottom: 1px dashed var(--line); }
.wl-bar { position: absolute; top: 2px; height: 14px; border-radius: 2px; }
.wl-gantt-axis { position: relative; margin-left: 118px; height: 40px; margin-top: 24px; font-size: 11px; color: var(--muted); }
.wl-gantt-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.wl-progress { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 13px; }
@media (prefers-color-scheme: dark) { .wl-head { background: #1c2a3c; color: #9cc0ff; } .wl-head span { color: #ccc; } .wl-left, .wl-records { background: #2a2818; } .wl-status, .wl-box { background: #1c2a1c; } }
@media (max-width: 1000px) { .wl-full { overflow: auto; } .wl-body { grid-template-columns: 1fr; } .wl-head { grid-template-columns: 1fr 1fr; } .wl-right { grid-template-rows: auto auto; } .wl-chart { grid-template-columns: 1fr; height: auto; } }
.print-page h3.pp-sec { font-size: 14px; margin: 12px 0 4px; }
/* 工作日誌甘特圖：各站半成品＋成品，多列 */
.wl-chart { height: auto; max-height: 34vh; }
.wl-gantt { overflow: auto; padding: 8px 12px 4px; }
.wl-gantt-row { grid-template-columns: 130px 1fr; margin-bottom: 3px; }
.wl-gantt-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.wl-gantt-axis { margin-left: 138px; margin-top: 6px; height: 18px; }
.wl-progress { overflow: auto; font-size: 12px; }
/* 工作日誌：瀏覽／修改／新增／刪除 平均分布、間距拉開 */
.wl-modes { justify-content: space-around; gap: 24px; padding: 8px 12px; }
.wl-modes .opt { cursor: pointer; }
/* 員工管理（docs/11）：左＝申請與清單，右＝個人資訊 */
.hr-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 12px; align-items: start; }
.hr-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.hr-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.hr-who { color: #1a3d8f; font-size: 16px; }
.hr-func { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; }
.hr-modes { display: flex; justify-content: space-around; gap: 24px; border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; margin-bottom: 8px; }
.hr-grid { display: grid; grid-template-columns: 180px 280px 1fr; gap: 10px; align-items: end; }
.hr-typenote { color: #1565c0; font-size: 13px; }
.hr-dates { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px 10px; margin: 8px 0 4px; }
.hr-dates legend { font-size: 13px; }
.hr-dt { display: flex; gap: 6px; align-items: center; } .hr-dt span { width: 36px; color: var(--muted); }
.hr-btns { justify-content: flex-end; margin-top: 6px; }
.hr-list .dealer-scroll { max-height: 52vh !important; }
tr.hr-st1 td { color: #b26a00; } tr.hr-st2 td { color: #2e7d32; } tr.hr-st3 td, tr.hr-st4 td { color: #999; text-decoration: line-through; }
.hr-side { position: sticky; top: 10px; font-size: 14px; }
.hr-side-title { font-weight: 600; margin-bottom: 2px; }
.hr-quota { width: 100%; border-collapse: collapse; margin-top: 6px; }
.hr-quota td { padding: 3px 4px; } .hr-quota td.u { text-align: right; color: #c62828; width: 64px; } .hr-quota td.l { color: #1565c0; width: 72px; }
.hr-quota tr.sep td { border-top: 1px solid var(--line); padding: 2px; }
@media (max-width: 1000px) { .hr-wrap { grid-template-columns: 1fr; } .hr-grid { grid-template-columns: 1fr; } .hr-side { position: static; } }
/* 員工費用單（補助、差旅費、交際費、代墊零用金） */
.hr-exp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; align-items: end; }
.hr-exp-grid .f > span { font-size: 13px; color: var(--muted); }
.hr-items { margin-top: 10px; } .hr-items input { padding: 3px 6px; }
.hr-exp-sum { justify-content: flex-end; gap: 18px; margin: 6px 0; }
@media (max-width: 900px) { .hr-exp-grid { grid-template-columns: 1fr; } }
/* 員工資料管理 */
.hri-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(520px, 1fr); gap: 12px; align-items: start; }
.hri-list .dealer-scroll { max-height: 70vh !important; }
.hri-form { position: sticky; top: 10px; }
.hri-sec { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px 10px; margin: 8px 0 0; }
.hri-sec legend { font-size: 13px; }
.hri-secret { background: #fff6f6; }
.hri-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; }
.hri-grid .hri-span3 { grid-column: span 3; }
@media (prefers-color-scheme: dark) { .hri-secret { background: #2e1c1c; } }
@media (max-width: 1100px) { .hri-wrap { grid-template-columns: 1fr; } .hri-form { position: static; } .hri-grid { grid-template-columns: 1fr 1fr; } .hri-grid .hri-span3 { grid-column: span 2; } }
/* 薪資計算 */
.hrs-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(560px, 1fr); gap: 12px; align-items: start; margin-top: 10px; }
.hrs-detail { position: sticky; top: 10px; }
.hrs-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.hrs-cols .hri-sec { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; align-content: start; }
.hrs-cols .hri-sec legend { grid-column: span 2; }
.hrs-total { display: flex; gap: 18px; justify-content: flex-end; flex-wrap: wrap; margin: 10px 0 6px; font-size: 15px; }
.hrs-total b { color: #c62828; }
.hrs-remark { white-space: pre-line; font-size: 12px; color: var(--muted); border: 1px solid var(--hair); border-radius: 6px; padding: 6px 8px; margin-top: 6px; max-height: 160px; overflow: auto; }
.hrs-slip { page-break-after: always; } .hrs-slip .hrs-remark { max-height: none; color: #333; }
@media (max-width: 1200px) { .hrs-wrap { grid-template-columns: 1fr; } .hrs-detail { position: static; } }
/* 訂單列印 */
.po-print-sub { display: flex; justify-content: space-between; font-size: 12px; color: #555; margin: -4px 0 6px; }
.po-print .po-desc { font-size: 11px; color: #555; }

/* 財務付款（docs/12） */
.fin-mode label { margin-right: 10px; }
.fin-t td, .fin-t th { white-space: nowrap; font-size: 12.5px; }
.fin-t tr.fin-in td { opacity: .45; }
.fin-t tr.fin-deduct td { color: #c0392b; }
.fin-edit { margin-top: 8px; padding: 8px 10px; border: 1px solid var(--hair); border-left: 4px solid var(--brand, #2a6fdb); border-radius: 8px; background: var(--surface2); display: flex; flex-direction: column; gap: 6px; }
.fin-pay { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--hair); }
.btn-c.danger { background: #c0392b; border-color: #c0392b; color: #fff; }
.pp-items tr.fin-item td { font-size: 11px; color: #555; border-top: 0; }

/* 發票狀態顏色（Components/Shared/InvColor.cs），財務付款與主畫面發票列表共用 */
.inv-legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; font-size: 12px; }
.inv-chip { padding: 1px 8px; border: 1px solid var(--hair); border-radius: 10px; }
tr.inv-open td, .inv-chip.inv-open { color: #1f5fbf; }
tr.inv-overdue td, .inv-chip.inv-overdue { color: #c0392b; font-weight: 600; }
tr.inv-pended td, .inv-chip.inv-pended { color: #c46a00; }
tr.inv-approved td, .inv-chip.inv-approved { color: #1e8449; }
tr.inv-paid td, .inv-chip.inv-paid { color: inherit; }
tr.inv-deduct td, .inv-chip.inv-deduct { color: #7d3c98; }
tr.inv-minus td, .inv-chip.inv-minus { color: #8a8f96; }
tr.inv-nocharge td, .inv-chip.inv-nocharge { background: #e9ecef; }
tr.inv-cancel td, .inv-chip.inv-cancel { color: #a0a4aa; font-style: italic; }   /* 2026-10-27 使用者：Cancel／Reject 不要刪除線，改斜體淡灰（與 Minus 區分） */
@media (prefers-color-scheme: dark) {
  tr.inv-open td, .inv-chip.inv-open { color: #6ea8ff; }
  tr.inv-overdue td, .inv-chip.inv-overdue { color: #ff7b72; }
  tr.inv-pended td, .inv-chip.inv-pended { color: #f0a050; }
  tr.inv-approved td, .inv-chip.inv-approved { color: #5fd38d; }
  tr.inv-deduct td, .inv-chip.inv-deduct { color: #c39bd3; }
  tr.inv-nocharge td, .inv-chip.inv-nocharge { background: #2c3035; }
}
.fin-actions { margin-top: 6px; padding: 6px 8px; background: var(--surface2); border: 1px solid var(--hair); border-radius: 8px; position: sticky; top: 0; z-index: 2; }

.pop-win.fin-confirm { width: min(520px, calc(100vw - 32px)); }
.fin-confirm .pop-body table.t th { text-align: left; width: 40%; }

.fin-t tr.fin-sel td { background: var(--brand-bg, #fde8f3); }

/* 左側選單分組顏色：每個大項一種顏色（大項色字＋左色條，子項目同色淡線，目前頁面用該組淡底） */
.side .nav-grp { --g: var(--muted); margin: 2px 0 6px; }
.side .g-dash { --g: #2563a8; } .side .g-main { --g: #a3307a; } .side .g-prod { --g: #1d7f4e; }
.side .g-hr { --g: #c0620a; } .side .g-fin { --g: #0f7c74; } .side .g-sys { --g: #55626a; }
@media (prefers-color-scheme: dark) {
  .side .g-dash { --g: #6ea8ec; } .side .g-main { --g: #e88cc6; } .side .g-prod { --g: #4cc58a; }
  .side .g-hr { --g: #f0a356; } .side .g-fin { --g: #3fb8ad; } .side .g-sys { --g: #98a6ad; }
}
.side .nav-grp > .tree-node > a, .side .nav-grp .grp-head {
  color: var(--g); font-weight: 700; border-left: 3px solid var(--g); border-radius: 0 7px 7px 0; padding-left: 9px;
}
.side .nav-grp .grp-head { flex: 1; display: block; margin: 2px 0; padding: 8px 10px 8px 9px; background: none; border-top: 0; border-right: 0; border-bottom: 0; font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.side .nav-grp > .tree-node > a:hover, .side .nav-grp .grp-head:hover { background: color-mix(in srgb, var(--g) 8%, transparent); }
.side .nav-grp > .tree-node > a.active { background: color-mix(in srgb, var(--g) 15%, transparent); color: var(--g); }
.side .nav-grp .tree-tog { color: var(--g); }
.side .nav-grp .tree-children { border-left: 2px solid color-mix(in srgb, var(--g) 35%, transparent); }
.side .nav-grp .tree-children a { color: var(--ink); font-weight: 400; }
.side .nav-grp .tree-children a:hover { background: color-mix(in srgb, var(--g) 8%, transparent); }
.side .nav-grp .tree-children a.active { background: color-mix(in srgb, var(--g) 15%, transparent); color: var(--g); font-weight: 700; }
.side .g-sys .tree-children { margin-left: 4px; }
.side .sec { border-top: 1px solid var(--hair); padding-top: 10px; letter-spacing: .12em; font-weight: 700; }
.side .logo + .sec { border-top: 0; padding-top: 0; }

/* 客戶追蹤案件（首頁）「系統資料架構圖」（Data/ArchMap.cs）：類別色同 docs/系統資料架構圖.html */
:root { --c-prd: #a3307a; --c-cust: #0f7c74; --c-csm: #2563a8; --c-pm: #5b4bb0; --c-eng: #b0680c; --c-qa: #b83a3a; --c-ext: #55626a; --tint: .10; }
@media (prefers-color-scheme: dark) {
  :root { --c-prd: #e88cc6; --c-cust: #3fb8ad; --c-csm: #5b9be0; --c-pm: #9a8cf0; --c-eng: #e3a247; --c-qa: #ec7070; --c-ext: #98a6ad; --tint: .16; }
}
.arch h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.arch-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.arch-legend span { display: inline-flex; align-items: center; gap: 5px; }
.arch-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.arch-legend i.dash { width: 22px; height: 0; border-top: 2px dashed var(--c-ext); border-radius: 0; }
.arch-legend i.dash.dot { border-top: 2px dotted var(--c-qa); }
.arch-b { width: 16px; height: 11px; border-radius: 6px; display: inline-block; }
.arch-b.warn { background: var(--warn); } .arch-b.bad { background: var(--bad); }
.arch-scroll { overflow-x: auto; }
.arch-svg { display: block; width: 100%; min-width: 1000px; height: auto; color: var(--ink); font-family: inherit; }
.arch-svg .node { cursor: pointer; }
.arch-svg .node.nolink { cursor: default; }
.arch-svg .node.dbl { cursor: pointer; }
.arch-svg .node .box { fill: var(--surface); stroke-width: 1.5; transition: stroke-width .15s; }
.arch-svg .node.core .box { stroke-width: 2.5; }
.arch-svg a.node:hover .box, .arch-svg a.node:focus-visible .box { stroke-width: 3; }
.arch-svg .node text { font-size: 14px; font-weight: 500; fill: var(--ink); }
.arch-svg .node text.sub { font-size: 11.5px; font-weight: 400; fill: var(--muted); }
.arch-svg .node text.sub.mono { font-family: Consolas, monospace; font-size: 11px; }
.arch-svg .badge text { font-size: 12px; font-weight: 700; }
.arch-svg .badge.zero rect { fill: var(--surface); stroke: var(--line); }
.arch-svg .badge.zero text { fill: var(--muted); font-weight: 500; }
.arch-svg .edge line, .arch-svg .edge polyline { stroke: var(--line); stroke-width: 1.5; }
.arch-svg .edge.core line, .arch-svg .edge.core polyline { stroke: var(--c-prd); stroke-opacity: .55; stroke-width: 2; }
.arch-svg .edge.ext line, .arch-svg .edge.ext polyline { stroke: var(--c-ext); stroke-dasharray: 5 4; }
.arch-svg .edge.trace line, .arch-svg .edge.trace polyline { stroke: var(--c-qa); stroke-dasharray: 2 4; stroke-width: 2; stroke-linecap: round; }
.arch-svg .edge.trace text { fill: var(--c-qa); }
.arch-svg .edge text { font-size: 11.5px; fill: var(--muted); paint-order: stroke; stroke: var(--surface); stroke-width: 5px; stroke-linejoin: round; }
.arch-svg.hl .edge.hot line, .arch-svg.hl .edge.hot polyline { stroke: var(--ink); stroke-opacity: 1; stroke-width: 2.2; }
.arch-svg.hl .edge.hot text { fill: var(--ink); font-weight: 500; }
.arch-svg.hl .edge:not(.hot), .arch-svg.hl .node:not(.rel) { opacity: .28; }
.arch-hint { font-size: 13px; padding: 6px 2px 0; min-height: 1.6em; }
.arch-hint b { color: var(--ink); }
.arch-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 10px; padding-top: 10px; border-top: 1px solid var(--hair); }
.arch-chip { border: 1px solid var(--cc); color: var(--cc); background: none; border-radius: 99px; padding: 2px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.arch-chip.on { background: var(--cc); color: #fff; }
.arch-detail { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 760px) { .arch-detail { grid-template-columns: 1fr; } }
.arch-detail h3 { margin: 0 0 4px; font-size: 16px; }
.arch-cat { font-size: 12px; font-weight: 500; border: 1px solid currentColor; border-radius: 99px; padding: 1px 8px; margin: 0 6px; }
.arch-link { display: block; width: 100%; text-align: left; border: 0; background: none; font: inherit; padding: 5px 6px; border-radius: 6px; cursor: pointer; color: var(--ink); }
.arch-link:hover { background: var(--surface2); }
.arch-link .rule { display: inline-block; min-width: 9em; font-size: 12px; }
.arch-svg a, .arch-svg a:hover { text-decoration: none; }
.arch-svg .badge text { fill: var(--brand-ink); }
/* Bootstrap 標題色固定為深色，深色模式下看不到 → 跟隨主題文字色 */
:root { --bs-heading-color: var(--ink); }

/* 客戶追蹤（首頁）：活躍客戶 → 產品 */
.track .card { min-width: 0; }
.track-scroll { max-height: 420px; overflow: auto; }
.track-scroll table tr:first-child th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.tk { display: inline-block; font-size: 11.5px; padding: 0 7px; border-radius: 99px; margin: 1px 2px 1px 0; white-space: nowrap; }
.tk.k1 { background: var(--info-bg); color: var(--info); }
.tk.k2 { background: var(--surface2); color: var(--muted); border: 1px solid var(--line); }
.tk.k3 { background: var(--warn-bg); color: var(--warn); }
.track tr.fin-sel td { background: var(--brand-bg); }
.track table { font-size: 13px; }
.track td:not(:first-child), .track th { white-space: nowrap; }
@media (min-width: 1100px) { .grid.g2.track { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); } }
.arch-svg .node.off text { fill: var(--muted); opacity: .7; }
.arch-svg .node.off .box { stroke-dasharray: 4 3; }
/* 架構圖容器：SVG 與疊在上面的版次下拉選單（百分比定位） */
/* 讀取中：先清空舊資料（2026-10-24 使用者） */
.card.arch.loading > :not(h2), .card.loading#track-prod > :not(h2) { visibility: hidden; }
.arch-canvas { position: relative; min-width: 1000px; container-type: inline-size; }
.arch-canvas .arch-svg { min-width: 0; }
.arch-ver { position: absolute; height: 1.58cqw; font-size: max(9px, 0.85cqw); padding: 0 1px; border: 1px solid var(--c-prd); border-radius: 5px;
  background: var(--surface); color: var(--ink); font-family: Consolas, monospace; cursor: pointer; }
.track td.track-note { white-space: normal; min-width: 220px; max-width: 320px; }
.track select.track-contact { max-width: 170px; font-size: 12.5px; padding: 1px 2px; }
.pn { font-weight: 600; }
.arch-contact { font-family: inherit; border-color: var(--c-cust); }
/* 架構圖「待補」節點（例：生產專案缺產品照片或 SOP） */
.arch-svg .node.todo .box { fill: var(--warn-bg); stroke-width: 2.5; }
.arch-svg .node.todo text.sub { fill: var(--warn); font-weight: 600; }
.pcn-files { font-size: 12.5px; max-width: 200px; } .pcn-files a { word-break: break-all; }
/* 客戶的產品清單：新案（尚未建立產品的服務案件） */
.track-newrow td { background: color-mix(in srgb, var(--c-csm) 6%, transparent); }
.tk.k4 { background: var(--c-csm); color: #fff; }
/* 產品料號編輯與查詢（Shared/ProductCodeEditor.razor，docs/19） */
.pc-win { width: min(1080px, calc(100vw - 32px)); }
.pc-code { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; margin: 10px 0 12px; font-size: 34px; font-weight: 700; font-family: Consolas, monospace; }
.pc-seg { min-width: 1.2ch; padding: 0 4px; border-bottom: 5px solid var(--c-csm); text-align: center; }
.pc-seg.fix { border-bottom-color: transparent; }
.pc-seg.in input { width: 4.4ch; font: inherit; border: 0; background: var(--surface2); text-align: center; padding: 0; }
.pc-sn { margin-left: 16px; color: var(--bad); font-weight: 400; }
.pc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 12px; }
@media (max-width: 800px) { .pc-grid { grid-template-columns: 1fr 1fr; } }
.pc-out { display: flex; align-items: flex-end; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.pc-out .f { min-width: 260px; }
.pc-desc { font-size: 12px; max-width: 100%; }
.pc-similar { max-height: 240px; overflow: auto; border: 1px solid var(--hair); border-radius: 6px; }

/* 生產資料（docs/17） */
.pd-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pd-chip { padding: 3px 10px; border-radius: 12px; font-size: 13px; border: 1px solid var(--hair); }
.pd-chip.ok { color: var(--ok, #1a7f37); }
.pd-chip.todo { color: #b45309; background: #fff4e5; border-color: #f5c27a; }
.pd-proc { margin: 14px 0 6px; font-size: 15px; }
.pd-empty { background: #fff8ec !important; }
.pd-sug { display: inline-flex; gap: 6px; align-items: center; padding: 3px 8px; border: 1px dashed var(--hair); border-radius: 6px; }

/* 案件重點（docs/21） */
.dg-t th { width: 110px; white-space: nowrap; vertical-align: top; }
.dg-ul { margin: 0; padding-left: 18px; }
.dg-ours td, .dg-ours th { background: color-mix(in srgb, var(--warn, #b45309) 10%, transparent); }
.dg-hist { margin-top: 8px; font-size: 13px; }
.dg-hist details { padding: 4px 0; border-bottom: 1px solid var(--hair); }

/* 料號自動編碼 */
.pc-ai { display: flex; gap: 6px; align-items: flex-start; margin: 6px 0 8px; flex-wrap: wrap; }
.pc-ai textarea { flex: 1; min-width: 260px; }
.pc-ai-msg { white-space: pre-wrap; font-size: 13px; padding: 6px 10px; border-left: 3px solid var(--c-prd, #a03c78); background: var(--surface2); margin-bottom: 8px; }
.pc-ai-msg.err { border-color: #c0392b; color: #c0392b; }

/* 客戶產品清單勾選合併（2026-10-22） */
.track .chk-col { width: 26px; padding-left: 4px; padding-right: 0; text-align: center; }
.track .chk-col input { margin: 0; cursor: pointer; }
.mg-mary { display: flex; gap: 10px; align-items: flex-start; background: var(--surface2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.mg-mary p { margin: 2px 0; }
.mg-list { margin: 8px 0 4px 18px; padding: 0; }
.mg-list li { margin: 2px 0; }
.msg.warn { background: var(--warn-bg, rgba(214, 140, 0, .12)); color: var(--ink); border-left: 3px solid var(--warn); }

/* 客戶產品清單：活躍原因與不活躍產品（2026-10-22） */
.tk.k5 { background: var(--ok-bg); color: var(--ok); }
.tk.k6 { background: var(--brand-bg); color: var(--brand); }
.track td .tk + .tk { margin-left: 3px; }
.track tr.track-inactive td { opacity: .55; }
.track tr.track-inactive td.chk-col { opacity: 1; }

/* 架構圖左上角客戶名稱（2026-10-22：只顯示、不連結） */
.arch-svg .arch-heading { font-size: 20px; font-weight: 700; fill: var(--ink); }

/* 架構圖左上「待回覆事項」面板（2026-10-23） */
.arch-pending { position: absolute; overflow: auto; font-size: max(10px, 0.78cqw); line-height: 1.45; background: var(--surface);
  border: 1px solid var(--warn); border-radius: 8px; padding: 6px 8px; color: var(--ink); }
.arch-pending .ap-h { font-weight: 700; color: var(--warn); margin-bottom: 3px; }
.arch-pending .ap-case { display: block; font-weight: 600; color: var(--accent); text-decoration: none; margin-top: 4px; }
.arch-pending .ap-case:hover { text-decoration: underline; }
.arch-pending .ap-case .mono { font-weight: 400; color: var(--muted); font-size: .9em; }
.arch-pending ul { margin: 1px 0 0 1.1em; padding: 0; }
/* 標題固定在面板上方，捲動時看得到（2026-10-26 使用者） */
.arch-pending .ap-h { position: sticky; top: -1px; z-index: 2; background: var(--surface); padding: 2px 0 4px; margin-top: -2px; }
.arch-pending .ap-po { color: var(--accent); text-decoration: underline dotted; cursor: pointer; }
.arch-pending .ap-po:hover { text-decoration: underline; }
.arch-pending .ap-cat { font-weight: 700; color: var(--accent); margin-top: 4px; }
tr.q-old td { color: var(--muted); }
.arch-pending .ap-done { float: right; font-weight: 400; color: var(--muted); font-size: .9em; }
.arch-pending .ap-st { font-size: .82em; padding: 0 2px; margin-left: 4px; height: auto; border-radius: 4px; color: var(--muted); }
.arch-pending li.ap-closed { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.arch-pending li.ap-closed .ap-st { text-decoration: none; }
.dg-ul li.ap-closed { color: var(--muted); text-decoration: line-through; }
.arch-pending .ap-as { color: var(--accent); }
.arch-pending .ap-as.set { font-weight: 600; border-color: var(--accent); }
li.ap-doing .ap-st { color: var(--warn); border-color: var(--warn); font-weight: 600; }   /* 處理中 */
.dg-ul .ap-st { font-size: .82em; padding: 0 2px; margin-left: 6px; border-radius: 4px; color: var(--muted); }
.arch-pending .ap-no { font-family: var(--mono, monospace); font-size: .85em; color: var(--muted); text-decoration: none; margin-left: 4px; }
.arch-pending .ap-no:hover { text-decoration: underline; color: var(--accent); }
.arch-pending li { margin: 0; }

/* 生產軌跡（docs/22，2026-10-23） */
.tr-node { margin-left: 0; }
.tr-node .tr-node { margin-left: 22px; border-left: 1px dashed var(--line); padding-left: 6px; }
.tr-head { display: flex; align-items: center; gap: 6px; padding: 3px 0; flex-wrap: wrap; }
.tr-head .rule { font-size: 12.5px; }
.tr-body { margin-left: 4px; }
.tr-info { font-size: 12.5px; color: var(--muted); margin: 2px 0 4px 26px; }
.tr-info .bad-t, .bad-t { color: var(--bad); }
.tr-kv { display: grid; grid-template-columns: repeat(4, auto 1fr); gap: 4px 10px; }

.tr-cand { width: auto; margin-top: 2px; font-size: 12px; }
.tr-cand td, .tr-cand th { padding: 2px 8px; }

/* 生產軌跡異動歷史：來源入倉列（2026-10-23）—比對吻合／來源單號＝淡綠底；推定＝斜體淡色 */
tr.tr-src td { background: color-mix(in srgb, var(--ok-bg) 60%, transparent); }
tr.tr-guess td { font-style: italic; opacity: .7; background: color-mix(in srgb, var(--warn-bg) 50%, transparent); }

/* 架構圖上方的階段流程圖（2026-10-23） */
.ph-strip-wrap { margin: 4px 0 10px; }
.ph-strip { display: flex; align-items: stretch; gap: 6px; flex-wrap: nowrap; overflow-x: auto; }
.ph-box { flex: 1 1 0; min-width: 84px; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1.5px solid var(--line);
  border-radius: 8px; background: var(--surface); color: var(--ink); text-decoration: none; }
.ph-box small { color: var(--muted); font-size: 12px; }
.ph-box:hover { border-width: 2.5px; }
.ph-s3 { border-color: var(--ok); background: var(--ok-bg); }
.ph-s1 { border-color: var(--brand); background: var(--brand-bg); }
.ph-s2 { border-color: var(--warn); background: var(--warn-bg); }
.ph-s4 { border-style: dashed; opacity: .6; }
.ph-gate { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 2px; text-decoration: none; color: var(--ink); font-size: 12px; }
.ph-gate .ph-dia { font-size: 20px; line-height: 1; color: var(--muted); }
.ph-gate small { color: var(--muted); font-size: 11px; }
.pg-ok .ph-dia { color: var(--ok); } .pg-run .ph-dia { color: var(--warn); } .pg-bad .ph-dia { color: var(--bad); }

.ph-none .ph-box { border-style: dashed; background: var(--surface); }
.ph-none .ph-box b { color: var(--muted); }
a.ph-box:not([href]), a.ph-gate:not([href]) { cursor: default; }

/* 產品階段流程圖（docs/23）：綠＝完成、紅＝進行中、灰＝尚無；數字球 */
.ph-cell { flex: 1 1 0; min-width: 96px; position: relative; display: flex; }
.ph-cell .ph-box { flex: 1; text-align: left; font: inherit; cursor: pointer; }
.ph-done { border-color: var(--ok); background: var(--ok-bg); }
.ph-run { border-color: var(--brand); background: var(--brand-bg); }
.ph-none { border-style: dashed; background: var(--surface); }
.ph-none b { color: var(--muted); }
.ph-balls { position: absolute; top: -9px; right: -4px; display: flex; gap: 3px; }
.ph-ball { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.ph-ball.case { background: var(--c-csm, #2563a8); }
.ph-strip { padding-top: 11px; padding-right: 6px; }

.arch-contact-ok { position: absolute; display: flex; gap: 3px; z-index: 2; }
.arch-contact-ok .btn-c { padding: 0 6px; font-size: max(10px, 0.75cqw); }

/* 小標題（產品頁「測試・承認」等分頁內；2026-10-23 統一大小） */
h3.sub { font-size: 14px; font-weight: 700; margin: 14px 0 6px; color: var(--accent); }
h3.sub .rule { font-size: 12px; }

.arch-owner { height: 1.26cqw; font-size: max(9px, 0.72cqw); }

/* 依品名新增產品：找範本（2026-10-26） */
.name-find { border: 1px dashed var(--line, #d8dce3); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.name-find .row-f { align-items: flex-end; }
.name-find .row-f .f { flex: 1; max-width: 420px; margin-bottom: 0; }
