:root {
  --brand: #0f6b73;
  --brand-dark: #0b5259;
  --brand-soft: #e2f2f3;
  --bg: #f4f7f8;
  --card: #ffffff;
  --text: #17262b;
  --muted: #5b6d73;
  --line: #dbe4e7;
  --rail-bg: #ffffff;
  --ok: #1f7a4f;
  --ok-bg: #e0f3e9;
  --warn: #9a5a0a;
  --warn-bg: #fdefd8;
  --info: #1d5fa8;
  --info-bg: #e3eefb;
  --field-bg: #ffffff;
  --th-bg: #f8fafb;
  --on-brand: #ffffff;
  --danger: #b03a2e;
  --danger-dark: #8f2e24;
  --on-danger: #ffffff;
  --shadow: rgba(15,60,66,.14);
  --rail-w: 64px;
  --rail-open: 200px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --brand: #3fb6bf;
  --brand-dark: #6ccdd4;
  --brand-soft: #123a3e;
  --bg: #0f1719;
  --card: #172225;
  --text: #e4eef0;
  --muted: #93a8ad;
  --line: #2a3a3e;
  --rail-bg: #142023;
  --ok: #5fd39a;
  --ok-bg: #133526;
  --warn: #f0b45a;
  --warn-bg: #3a2a12;
  --info: #8cc0f5;
  --info-bg: #14273d;
  --field-bg: #101a1c;
  --th-bg: #1b282b;
  --on-brand: #06272a;
  --danger: #ff8a7a;
  --danger-dark: #ffa699;
  --on-danger: #2e0a06;
  --shadow: rgba(0,0,0,.5);
  color-scheme: dark;
}
/* 米色（Jesse 2026-11-11 從 6 種候選選燕麥色）：主題色另有米色版，淡底是主色 13%、狀態淡底是狀態色 12% 混進卡片色 */
:root[data-theme="beige"] {
  --brand: #1a6862;
  --brand-dark: #11504b;
  --brand-soft: #dde5e0;
  --bg: #eeeae1;
  --card: #faf8f3;
  --text: #26241f;
  --muted: #5c584e;
  --line: #dcd6c9;
  --rail-bg: #faf8f3;
  --ok: #2f6b3a;
  --ok-bg: #e2e7dd;
  --warn: #8a4f08;
  --warn-bg: #ede4d7;
  --info: #2a5a96;
  --info-bg: #e1e5e8;
  --field-bg: #faf8f3;
  --th-bg: #f4f1ea;
  --on-brand: #ffffff;
  --danger: #a8382c;
  --danger-dark: #86291f;
  --on-danger: #ffffff;
  --shadow: rgba(70,50,20,.16);
  color-scheme: light;
}
/* 主題色：深青是預設（上面兩組），其餘各一組淺色版與深色版 */
:root[data-accent="blue"]   { --brand: #2357c6; --brand-dark: #1a45a0; --brand-soft: #e6eefc; --on-brand: #ffffff; }
:root[data-accent="indigo"] { --brand: #5b3fc4; --brand-dark: #4730a0; --brand-soft: #eeeafc; --on-brand: #ffffff; }
:root[data-accent="green"]  { --brand: #1f7a4a; --brand-dark: #17603a; --brand-soft: #e3f3ea; --on-brand: #ffffff; }
:root[data-accent="orange"] { --brand: #b4530d; --brand-dark: #8f420a; --brand-soft: #fcefe3; --on-brand: #ffffff; }
:root[data-accent="rose"]   { --brand: #c0285a; --brand-dark: #9c1f49; --brand-soft: #fce8ef; --on-brand: #ffffff; }
:root[data-theme="dark"][data-accent="blue"]   { --brand: #6f9bff; --brand-dark: #96b6ff; --brand-soft: #172a52; --on-brand: #0a1838; }
:root[data-theme="dark"][data-accent="indigo"] { --brand: #a08bff; --brand-dark: #bcadff; --brand-soft: #2a2152; --on-brand: #160f38; }
:root[data-theme="dark"][data-accent="green"]  { --brand: #4ccb86; --brand-dark: #77dba3; --brand-soft: #123826; --on-brand: #052615; }
:root[data-theme="dark"][data-accent="orange"] { --brand: #f59e4b; --brand-dark: #f8b878; --brand-soft: #3d2612; --on-brand: #2a1503; }
:root[data-theme="dark"][data-accent="rose"]   { --brand: #f2709b; --brand-dark: #f694b4; --brand-soft: #431a2a; --on-brand: #2e0716; }
:root[data-theme="beige"][data-accent="blue"]   { --brand: #2b55a6; --brand-dark: #1f4186; --brand-soft: #dfe3e9; --on-brand: #ffffff; }
:root[data-theme="beige"][data-accent="indigo"] { --brand: #5a44a6; --brand-dark: #463387; --brand-soft: #e5e1e9; --on-brand: #ffffff; }
:root[data-theme="beige"][data-accent="green"]  { --brand: #3a6a2e; --brand-dark: #2b5222; --brand-soft: #e1e6d9; --on-brand: #ffffff; }
:root[data-theme="beige"][data-accent="orange"] { --brand: #a2440f; --brand-dark: #82360b; --brand-soft: #efe1d5; --on-brand: #ffffff; }
:root[data-theme="beige"][data-accent="rose"]   { --brand: #ab2f52; --brand-dark: #8c2443; --brand-soft: #f0dede; --on-brand: #ffffff; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  font-size: 15px; color: var(--text); background: var(--bg);
  overflow-x: hidden;
}
button { font: inherit; color: inherit; }

/* 原型浮水印（Jesse 2026-11-04 指定）：卡片是不透明底，所以疊在內容上面而不是放背景；滑鼠穿得過去。
   比左側選單（30）、面板（50）、AI 助理（55）、小選單（60）低，它們上面不疊字。列印頁在 .pl-sheet::after 另外打 */
:root { --wm: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 680 340'%3E%3Ctext transform='rotate(-20 340 170)' x='340' y='180' text-anchor='middle' font-family='Noto Sans TC,Microsoft JhengHei,PingFang TC,sans-serif' font-size='28' font-weight='700' fill='%231f3a40' fill-opacity='.11'%3E原型．非正式系統．資料皆為示範%3C/text%3E%3C/svg%3E"); }
:root[data-theme="dark"] { --wm: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 680 340'%3E%3Ctext transform='rotate(-20 340 170)' x='340' y='180' text-anchor='middle' font-family='Noto Sans TC,Microsoft JhengHei,PingFang TC,sans-serif' font-size='28' font-weight='700' fill='%23fff' fill-opacity='.09'%3E原型．非正式系統．資料皆為示範%3C/text%3E%3C/svg%3E"); }
body::after { content: ''; position: fixed; inset: 0; z-index: 25; pointer-events: none; background: var(--wm) 0 0 / 680px 340px; }
body.is-bare::after { content: none; }
@media (max-width: 760px) { body::after { background-size: 400px 200px; } }

/* 圖示欄 */
.rail {
  position: fixed; inset: 0 auto 0 0; z-index: 30;
  width: var(--rail-w); background: var(--rail-bg); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden;
  transition: width .22s ease, box-shadow .22s ease;
}
.rail:hover, .rail:focus-within, .rail.pinned { width: var(--rail-open); }
.rail:hover:not(.pinned), .rail:focus-within:not(.pinned) { box-shadow: 6px 0 24px var(--shadow); }
.rail-logo { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 14px; flex: none; border-bottom: 1px solid var(--line); }
.mark { flex: none; width: 36px; height: 36px; border-radius: 9px; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.rail-logo .name { white-space: nowrap; font-weight: 700; line-height: 1.2; }
.rail-logo .name small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.label, .rail-logo .name, .chev, .sub { opacity: 0; transition: opacity .15s ease; }
.rail:hover .label, .rail:focus-within .label, .rail.pinned .label,
.rail:hover .rail-logo .name, .rail:focus-within .rail-logo .name, .rail.pinned .rail-logo .name,
.rail:hover .chev, .rail:focus-within .chev, .rail.pinned .chev { opacity: 1; transition-delay: .08s; }

.rail-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 10px; }
.grp { margin-bottom: 4px; position: relative; }
.grp-head {
  display: flex; align-items: center; gap: 12px; width: 100%; height: 44px; padding: 0 10px;
  border: 0; border-radius: 9px; background: none; cursor: pointer; text-align: left; text-decoration: none; color: var(--text);
}
.grp-head:hover { background: var(--bg); }
.ico { flex: none; width: 24px; text-align: center; font-size: 19px; color: var(--muted); }
.label { flex: 1; white-space: nowrap; font-weight: 600; }
.chev { color: var(--muted); font-size: 12px; transition: transform .2s, opacity .15s; }
.grp.open .chev { transform: rotate(90deg); }
.grp.current > .grp-head .ico { color: var(--brand); }
.grp.current > .grp-head { background: var(--brand-soft); color: var(--brand-dark); }
.grp.current > .grp-head::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand); }

.sub { display: none; margin: 2px 0 6px 22px; padding-left: 14px; border-left: 2px solid var(--line); }
.rail:hover .grp.open .sub, .rail:focus-within .grp.open .sub, .rail.pinned .grp.open .sub { display: block; opacity: 1; transition-delay: .1s; }
.sub a { display: block; padding: 7px 10px; border-radius: 7px; color: var(--muted); text-decoration: none; white-space: nowrap; font-size: 14px; }
.sub a:hover { background: var(--bg); color: var(--text); }
.sub a.active { background: var(--brand); color: var(--on-brand); font-weight: 700; }

.rail-foot { flex: none; border-top: 1px solid var(--line); padding: 10px; }
.pin-btn { display: flex; align-items: center; gap: 12px; width: 100%; height: 40px; padding: 0 10px; border: 0; border-radius: 9px; background: none; cursor: pointer; color: var(--muted); }
.pin-btn:hover { background: var(--bg); color: var(--text); }
.pin-btn .ico { font-size: 17px; }

/* 主區 */
.main { margin-left: var(--rail-w); min-width: 0; transition: margin-left .22s ease; }
body.is-pinned .main { margin-left: var(--rail-open); }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; height: 60px; padding: 0 28px; background: var(--card); border-bottom: 1px solid var(--line); }
.menu-btn { display: none; border: 0; background: none; font-size: 22px; cursor: pointer; padding: 4px 6px; }
select:focus, input:focus { outline: 2px solid var(--brand); outline-offset: 1px; background: var(--field-bg); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-weight: 700; }
/* 頭像的小選單（access.js）：上面是現在的身分，下面「換人看看」（account.md 第 14 題；我的帳號、登出下一批加） */
.who-wrap { position: relative; flex: none; }
button.avatar { padding: 0; border: 0; font: inherit; font-weight: 700; cursor: pointer; }
button.avatar:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.who-menu { display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: 220px; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px var(--shadow); color: var(--text); }
.who-menu.open { display: block; }
.who-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.who-head span { color: var(--muted); font-size: 13px; }
.who-head small { flex-basis: 100%; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.who-ttl { display: flex; align-items: center; gap: 6px; padding: 6px 10px 4px; font-size: 12px; color: var(--muted); }
.who-ttl .tag { padding: 0 8px; font-weight: 600; background: var(--warn-bg); color: var(--warn); }
.who-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: 8px; background: none; cursor: pointer; color: var(--text); font-size: 14px; text-align: left; }
.who-menu button:hover { background: var(--bg); }
.who-menu button:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.who-menu button small { color: var(--muted); font-size: 12px; }
.who-menu button .chk { margin-left: auto; color: var(--brand); visibility: hidden; }
.who-menu button[aria-checked="true"] { font-weight: 700; }
.who-menu button[aria-checked="true"] .chk { visibility: visible; }
/* 頂端列的店名：能進兩家以上才是可以按的（有 ▾），試用的那家旁邊有試用還剩幾天（account.md 第三批開工第 1、3 題） */
button.shop { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border: 0; border-radius: 8px; background: none; font: inherit; color: inherit; }
button.shop:disabled { cursor: default; color: inherit; opacity: 1; }
button.shop .shop-chev { display: none; font-size: 11px; }
button.shop.can-switch { cursor: pointer; }
button.shop.can-switch:hover { background: var(--bg); color: var(--text); }
button.shop.can-switch .shop-chev { display: inline; }
button.shop:focus-visible, .trial-tag:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.trial-tag { flex: none; padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--muted); font-size: 12px; cursor: pointer; }
.trial-tag.is-soon { border-color: var(--warn); background: var(--warn-bg); color: var(--warn); font-weight: 700; }
.who-co { display: none; }
.who-cur { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 2px 10px 6px; }
.who-menu button.who-trial { width: auto; padding: 1px 8px; border: 1px solid var(--warn); border-radius: 999px; background: var(--warn-bg); color: var(--warn); font-size: 12px; font-weight: 700; }
.who-sep { margin: 4px 0; border-top: 1px solid var(--line); }
@media (max-width: 760px) {
  .who-co { display: block; margin-bottom: 4px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
  .top-right .trial-tag { display: none; }
}
/* 我的帳號（pages/account.js，第三批開工第 2 題）：一整頁五張卡片，每列「名稱｜內容｜鈕」 */
.ac-cards { display: grid; gap: 16px; max-width: 760px; }
.ac-card { padding: 16px 20px; }
.ac-card h2 { margin: 0 0 6px; font-size: 16px; }
.ac-card > .cf-hint { margin: 0 0 6px; }
.ac-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.ac-lbl { flex: 0 0 110px; color: var(--muted); font-size: 14px; }
.ac-val { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.ac-val small { display: block; }
.ac-btns { display: flex; gap: 8px; margin-left: auto; }
.ac-btns .btn, .ac-more .btn { padding: 6px 14px; }
.ac-more { padding-top: 10px; border-top: 1px solid var(--line); }
.ac-dlg { width: min(440px, calc(100vw - 32px)); }
.ac-form .cf-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.ac-in { display: flex; gap: 6px; }
.ac-in input { flex: 1; min-width: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; font: inherit; color: var(--text); background: var(--field-bg); }
.ac-eye { flex: none; width: 40px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); cursor: pointer; }
.ac-eye[aria-pressed="true"] { background: var(--brand-soft); }
@media (max-width: 760px) { .ac-lbl { flex-basis: 100%; } .ac-btns { margin-left: 0; } }
/* 登入前的頁面（pages/auth.js，第四批）：沒有選單與頂端列，置中一張卡片 */
.au-wrap { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 40px; background: var(--bg); }
.au-card { width: min(440px, 100%); padding: 28px 28px 20px; overflow: visible; }
.au-card:has(.au-two) { width: min(760px, 100%); }
.au-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.au-logo .mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--brand); color: var(--on-brand); font-weight: 700; }
.au-logo b { display: block; font-size: 16px; }
.au-logo small { color: var(--muted); font-size: 12px; }
.au-card h1 { margin: 0 0 16px; font-size: 22px; }
.au-f { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.au-acts { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.au-acts .btn { text-decoration: none; }
.au-link, .au-alt a { color: var(--brand); }
.au-alt { margin: 16px 0 0; font-size: 14px; }
.au-note { margin: 22px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6; }
.au-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.au-opt { padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.au-opt h2 { margin: 0 0 6px; font-size: 16px; }
.au-cos { display: grid; gap: 10px; margin-bottom: 12px; }
.au-co { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.au-co:hover, .au-co:focus-visible { border-color: var(--brand); background: var(--brand-soft); outline: none; }
.au-co small { color: var(--muted); font-size: 13px; }
.au-co .au-trial { color: var(--warn); font-weight: 700; }
@media (max-width: 760px) { .au-two { grid-template-columns: 1fr; } .au-card { padding: 22px 18px 16px; } }
/* 員工資料權限欄底下的已加入／邀請中（account.md 第 7 題） */
.em-st { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; }
.em-st .link-btn { font-size: 12px; }
.who-av { display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 700; }
/* 「沒有權限」頁（account.md 開工第 2 題）與畫面上連到打不開的頁、被換成一般文字的連結（開工第 3 題） */
.denied { max-width: 560px; padding: 20px 24px; }
.denied p { margin: 0 0 12px; line-height: 1.7; }
.denied p:last-child { margin: 16px 0 0; }
.denied .btn { display: inline-block; text-decoration: none; }
.no-go { cursor: default; }
/* 沒有修改權時單據整張包在 disabled 的 fieldset（doc-page.js），外觀不能變 */
.as-rofs { border: 0; padding: 0; margin: 0; min-width: 0; }
/* 只能看時「能藏的就藏」：單身最下面新增用的那一列不畫，表單裡的鈕（每列 🗑、挑單、帶出該補的貨…）藏起來但留位置，欄位才不會跑掉 */
.as-rofs tr.qt-blank { display: none; }
.as-rofs button:disabled { visibility: hidden; }
/* 底色三格「淺｜米｜深」（Jesse 2026-11-11，取代原本的深色模式開關） */
.theme-seg { display: inline-flex; flex: none; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.theme-seg button { min-width: 28px; padding: 3px 8px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-size: 13px; cursor: pointer; }
.theme-seg button:hover { color: var(--text); }
.theme-seg button[aria-checked="true"] { background: var(--brand); color: var(--on-brand); font-weight: 700; }
.theme-seg button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.accent-wrap { position: relative; }
.accent-btn { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--card); cursor: pointer; }
.accent-btn .dot, .accent-menu .dot { width: 16px; height: 16px; border-radius: 50%; background: var(--brand); flex: none; }
.accent-btn:focus-visible, .accent-menu button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.accent-menu { display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: 168px; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px var(--shadow); }
.accent-menu.open { display: block; }
.accent-menu .ttl { padding: 6px 10px 4px; font-size: 12px; color: var(--muted); }
.accent-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; cursor: pointer; color: var(--text); font-size: 14px; text-align: left; }
.accent-menu button:hover { background: var(--bg); }
.accent-menu button .chk { margin-left: auto; color: var(--brand); visibility: hidden; }
.accent-menu button[aria-checked="true"] { font-weight: 700; }
.accent-menu button[aria-checked="true"] .chk { visibility: visible; }
.accent-menu .dot[data-c="teal"] { background: #0f6b73; }
.accent-menu .dot[data-c="blue"] { background: #2357c6; }
.accent-menu .dot[data-c="indigo"] { background: #5b3fc4; }
.accent-menu .dot[data-c="green"] { background: #1f7a4a; }
.accent-menu .dot[data-c="orange"] { background: #b4530d; }
.accent-menu .dot[data-c="rose"] { background: #c0285a; }
:root[data-theme="dark"] .accent-menu .dot[data-c="teal"] { background: #3fb6bf; }
:root[data-theme="dark"] .accent-menu .dot[data-c="blue"] { background: #6f9bff; }
:root[data-theme="dark"] .accent-menu .dot[data-c="indigo"] { background: #a08bff; }
:root[data-theme="dark"] .accent-menu .dot[data-c="green"] { background: #4ccb86; }
:root[data-theme="dark"] .accent-menu .dot[data-c="orange"] { background: #f59e4b; }
:root[data-theme="dark"] .accent-menu .dot[data-c="rose"] { background: #f2709b; }
:root[data-theme="beige"] .accent-menu .dot[data-c="teal"] { background: #1a6862; }
:root[data-theme="beige"] .accent-menu .dot[data-c="blue"] { background: #2b55a6; }
:root[data-theme="beige"] .accent-menu .dot[data-c="indigo"] { background: #5a44a6; }
:root[data-theme="beige"] .accent-menu .dot[data-c="green"] { background: #3a6a2e; }
:root[data-theme="beige"] .accent-menu .dot[data-c="orange"] { background: #a2440f; }
:root[data-theme="beige"] .accent-menu .dot[data-c="rose"] { background: #ab2f52; }

.content { padding: 24px 28px 40px; }
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 24px; }
.page-head .spacer { flex: 1; }
.btn { padding: 9px 18px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 700; }
.btn.primary:hover { background: var(--brand-dark); }
/* 刪除這類難回頭的按鈕：不跟主題色，一律紅色 */
.btn.danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); font-weight: 700; }
.btn.danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; border-top: 3px solid var(--brand); }
.stat .label2 { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 6px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.filters { display: flex; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.filters select, .filters input { padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; font: inherit; color: var(--text); background: var(--field-bg); }
.filters input { flex: 1; min-width: 160px; max-width: 320px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 20px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: 13px; color: var(--muted); font-weight: 600; background: var(--th-bg); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num { font-weight: 600; }
tbody tr:hover { background: var(--brand-soft); cursor: pointer; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.info { background: var(--info-bg); color: var(--info); }

@media (prefers-reduced-motion: reduce) {
  .rail, .main, .label, .chev, .sub, .rail-logo .name { transition: none !important; }
}

@media (max-width: 760px) {
  .rail { width: 260px; transform: translateX(-100%); transition: transform .2s ease; }
  .rail:hover, .rail:focus-within { width: 260px; }
  .rail.mopen { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .rail .label, .rail .rail-logo .name, .rail .chev { opacity: 1; }
  .rail .grp.open .sub { display: block; opacity: 1; }
  .pin-btn { display: none; }
  .main, body.is-pinned .main { margin-left: 0; }
  .menu-btn { display: block; }
  .top-right .shop { display: none; }
  .topbar { padding: 0 14px; }
  .content { padding: 16px 14px 32px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stats .stat:last-child { grid-column: span 2; }
  .stat { padding: 14px; }
  .stat .value { font-size: 22px; }
  .filters { padding: 12px 14px; }
  .filters select, .filters input { flex: 1; max-width: none; }
  thead { display: none; }
  table, tbody, tr, td { display: block; }
  tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  tbody tr:last-child { border-bottom: 0; }
  td { border: 0; padding: 2px 0; white-space: normal; }
  td.num { text-align: left; font-size: 18px; }
}

[hidden] { display: none !important; }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.page-head h1:focus { outline: none; }

/* 小提示（LiteErp.toast） */
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 60; padding: 10px 16px; border-radius: 9px; background: var(--text); color: var(--bg); font-size: 14px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: none; }

/* 左邊次選單、右邊內容，內容區不夠寬時次選單改成上方的下拉選擇器。現在只有初始盤點在用（公司資料、設定項目 2026-11-10 改成上方的 Tab） */
.set-layout { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 28px; align-items: start; }
.set-body { min-width: 0; }
.set-nav { position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.set-nav a { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 7px 10px; border-radius: 7px; font-size: 14px; text-decoration: none; color: var(--text); white-space: nowrap; }
.set-nav a:hover { background: var(--bg); }
.set-nav a.active { background: var(--brand); color: var(--on-brand); font-weight: 700; }
.set-nav a:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.set-pick { display: none; margin-bottom: 16px; }
.set-pick label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.set-pick select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font: inherit; font-weight: 600; color: var(--text); background: var(--field-bg); }

/* 公司資料表單 */
.cf { display: grid; gap: 16px; }
.cf-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; }
.cf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 20px; }
.cf-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cf-field > .lbl { font-size: 13px; color: var(--muted); }
.cf-link { align-self: flex-start; font-size: 12px; color: var(--brand); text-decoration: none; }
.cf-link:hover { text-decoration: underline; }
.cf-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.cf-note { margin: -8px 0 12px; }
.cf-grid .cf-span2 { grid-column: span 2; margin: 0; }   /* 預設項目頁：免用統一發票時佔掉發票別、課稅別兩欄的那段小字 */
.cf-field .req { color: #c0392b; margin-left: 2px; }
:root[data-theme="dark"] .cf-field .req { color: #ff8a7a; }
.cf input, .cf select, .cf textarea { width: 100%; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; font: inherit; color: var(--text); background: var(--field-bg); }
.cf textarea { resize: vertical; min-height: 120px; }
.cf textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.cf [aria-invalid="true"] { border-color: #c0392b; }
:root[data-theme="dark"] .cf [aria-invalid="true"] { border-color: #ff8a7a; }
.cf-hint { font-size: 12px; color: var(--muted); }
.cf-err { font-size: 12px; color: #b03a2e; }
:root[data-theme="dark"] .cf-err { color: #ff8a7a; }
.cf-addrs { display: grid; gap: 14px; margin-top: 14px; }
.cf-addr { display: grid; grid-template-columns: 120px 120px minmax(0, 1fr) 90px; gap: 10px; }
.cf-addr-head { display: flex; align-items: center; gap: 10px; }
.cf-addr-head .lbl { font-size: 13px; color: var(--muted); }
.link-btn { border: 0; background: none; padding: 0; color: var(--brand); font-size: 13px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.cf-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* 切換鈕：一排相連的按鈕（底層是單選按鈕），例如收支項目的「收入｜支出」 */
.seg { display: inline-flex; justify-self: start; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg label { position: relative; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg span { display: block; min-width: 44px; padding: 8px 12px; border-left: 1px solid var(--line); background: var(--field-bg); color: var(--text); font-size: 14px; text-align: center; }
.seg label:first-child span { border-left: 0; }
.seg input:checked + span { background: var(--brand); color: var(--on-brand); font-weight: 700; }
.seg input:focus-visible + span { outline: 2px solid var(--text); outline-offset: -4px; }

@media (max-width: 1000px) {
  .set-layout { grid-template-columns: minmax(0, 1fr); }
  .set-nav { display: none; }
  .set-pick { display: block; }
}
@media (max-width: 760px) {
  .toast { left: 14px; right: 14px; bottom: 14px; text-align: center; }
  .cf-card { padding: 16px 14px; }
  .cf-grid { grid-template-columns: 1fr; }
  .cf-grid .cf-span2 { grid-column: auto; }
  .cf-addr { grid-template-columns: 1fr 1fr; }
  .cf-addr .street { grid-column: span 2; }
  .cf-actions .btn { flex: 1; }
}

/* 刪了可以復原的提示（LiteErp.undoToast） */
.undo-toast { position: fixed; left: 50%; bottom: 24px; z-index: 70; display: flex; align-items: center; gap: 16px; padding: 10px 12px 10px 18px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 14px; box-shadow: 0 8px 24px var(--shadow); transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.undo-toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.undo-toast button { padding: 5px 12px; border: 0; border-radius: 7px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; cursor: pointer; }
.undo-toast button:focus-visible { outline: 2px solid var(--bg); outline-offset: 2px; }

/* 點格子就改的清單（cell-list.js：員工資料、倉庫資料、商品類別、配送方式、銀行帳戶等短清單共用） */
.ce-intro { margin: -8px 0 14px; }
.ce-toolbar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.ce-search { flex: 1; min-width: 160px; max-width: 320px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; font: inherit; color: var(--text); background: var(--field-bg); }
.ce-show { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.ce-toolbar .spacer { flex: 1; }
.ce-note { margin: 0; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.ce-wrap { overflow-x: auto; }
/* 清單表頭黏住（sticky-head.js）：複本放在不占高度的外層，黏在 60px 的頂端列底下；比拖拉中的列（2）高、比頂端列（10）低。
   .card 用 clip：圓角照樣裁切，但不算捲動容器，才黏得到視窗 */
.card:has(.ce-wrap) { overflow: clip; }
.sh-box { position: sticky; top: 60px; z-index: 4; height: 0; }
.sh-clip { overflow: hidden; background: var(--card); }
@media print { .sh-box { display: none; } }
/* 鍵盤移動、捲到某一格時，停在黏住的東西底下，不要被蓋住：電腦版是頂端列加表頭，手機沒有表頭、只留頂端列 */
html { scroll-padding-top: 68px; }
@media (min-width: 761px) { html { scroll-padding-top: 112px; } }
.ce-list tbody tr, .ce-list tbody tr:hover { cursor: default; }
.ce-list tbody tr:hover { background: none; }
.ce-list tr.is-off td { color: var(--muted); }
.ce-list td.ce-seq { color: var(--muted); font-variant-numeric: tabular-nums; }
.ce-empty { padding: 28px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.ce-name { font-weight: 600; }
.tag.off { background: var(--line); color: var(--muted); }
.tag.def { background: var(--brand-soft); color: var(--brand-dark); }
.ce { cursor: text; }
.ce:hover, .ce.editing { box-shadow: inset 0 0 0 1px var(--brand); background: var(--field-bg); }
.ce:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.ce.ce-saved { background: var(--ok-bg); }
.ce-body { display: flex; flex-direction: column; justify-content: center; min-width: 0; min-height: 30px; }
.ce-v { overflow: hidden; text-overflow: ellipsis; }
.ce-nv { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.ce-nv > .ce-name { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ce-nv > .tag { flex: none; white-space: nowrap; }
.ce-in, .ce-pick { width: 100%; min-width: 0; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; color: var(--text); background: var(--field-bg); }
.ce-in[aria-invalid="true"] { border-color: #c0392b; }
:root[data-theme="dark"] .ce-in[aria-invalid="true"] { border-color: #ff8a7a; }
.ce-list .cf-err { display: block; margin-top: 4px; white-space: normal; }
.ce-sel { width: 100%; min-width: 0; padding: 5px 6px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; color: var(--text); background: var(--field-bg); cursor: pointer; }
.ce-chk { display: inline-flex; align-self: flex-start; padding: 4px 0; cursor: pointer; }
.ce-chk input { width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--brand); }
.ce-del { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 32px; height: 32px; padding: 0 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); cursor: pointer; font-size: 15px; line-height: 1; }
.ce-del:hover { background: var(--bg); }
.ce-del:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ce-del-t { display: none; font-size: 14px; }
/* 列尾的「移到…」之類小選單按鈕與它打開的選單（cell-list 的 rowMenu；選單掛在 body 上） */
.ce-acts { display: flex; align-items: center; justify-content: center; gap: 6px; }
.ce-mbtn { height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); cursor: pointer; font: inherit; font-size: 14px; white-space: nowrap; }
.ce-mbtn:hover, .ce-mbtn[aria-expanded="true"] { background: var(--bg); }
.ce-mbtn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ce-menu { position: fixed; z-index: 60; display: flex; flex-direction: column; min-width: 120px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); box-shadow: 0 8px 24px var(--shadow); }
.ce-menu button { padding: 8px 12px; border: 0; border-radius: 7px; background: none; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.ce-menu button:hover { background: var(--bg); }
.ce-menu button:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
/* 下拉欄還沒選（例如通訊錄的客戶「未指定」）時字變淡 */
.ce-fsel:has(option[value=""]:checked) { color: var(--muted); }
.ce-hint { margin: 10px 4px 0; }
.ce-actions { margin-top: 16px; }
/* 文字欄格子裡的小按鈕（例如分行的「…」開窗），排在值的右邊 */
.ce-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ce-row .ce-v { flex: 1; min-width: 0; white-space: nowrap; }
.ce-btn { flex: none; min-width: 28px; height: 28px; padding: 0 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--text); cursor: pointer; font: inherit; font-size: 14px; line-height: 1; }
.ce-btn:hover { background: var(--bg); }
.ce-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* 拖拉調順序（drag-sort.js，cell-list 與 drawer-list 共用）：項次格裡的 ⠿ 握把、拖拉中的列、要放的位置那條線、放下後閃一下 */
.dg-seq { display: inline-flex; align-items: center; gap: 4px; }
.dg-h { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 28px; margin-left: -6px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 16px; line-height: 1; cursor: grab; touch-action: none; user-select: none; }
.dg-h:hover:not(:disabled) { background: var(--bg); color: var(--text); }
.dg-h:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.dg-h:disabled { opacity: .35; cursor: not-allowed; }
body.dg-dragging, body.dg-dragging * { cursor: grabbing !important; user-select: none; }
tr.dg-on { position: relative; z-index: 2; opacity: .9; outline: 1px solid var(--brand); outline-offset: -1px; }
tr.dg-on td { background: var(--brand-soft); }
.dg-line { position: fixed; z-index: 20; height: 3px; border-radius: 2px; background: var(--brand); pointer-events: none; }
tr.dg-done td { animation: dg-flash 1.2s ease-out; }
@keyframes dg-flash { from { background: var(--ok-bg); } }
@media (max-width: 760px) {
  .dg-h, .dg-tip { display: none; }
}

/* 開窗挑選（銀行帳戶的分行）：搜尋框＋可捲動的清單，底部標示資料來源 */
.pk { width: min(520px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 48px)); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); box-shadow: 0 16px 48px var(--shadow); }
.pk[open] { display: flex; flex-direction: column; }
.pk::backdrop { background: rgba(0, 0, 0, .45); }
.pk-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 8px 20px; }
.pk-head h2 { margin: 0; font-size: 17px; }
.pk-x { flex: none; width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.pk-x:hover { background: var(--bg); }
.pk-search { margin: 4px 20px 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; font: inherit; color: var(--text); background: var(--field-bg); }
.pk-list { flex: 1; min-height: 120px; margin: 0; padding: 0 10px 8px; overflow-y: auto; list-style: none; }
.pk-item { display: flex; gap: 14px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.pk-item:hover { background: var(--bg); }
.pk-item:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.pk-item.is-cur { background: var(--brand-soft); font-weight: 700; }
.pk-code { flex: none; width: 64px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pk-empty { margin: 0; padding: 16px 20px; color: var(--muted); font-size: 14px; }
.pk-foot { margin: 0; padding: 10px 20px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
/* Excel 匯入前的預覽（xlsx-io.js）：沿用開窗的外框，中間可捲動，底下是取消／匯入 */
.pk.xi { width: min(760px, calc(100vw - 32px)); }
.xi-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 20px 12px; }
.xi-sum { margin: 0 0 8px; font-size: 16px; font-weight: 700; }
.xi-note { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.xi-alert { margin-bottom: 10px; }
.xi-tbl { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 14px; }
.xi-tbl th, .xi-tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.xi-tbl th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.xi-tbl td:nth-child(-n+4) { white-space: nowrap; }
.xi-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.xi-foot .btn:disabled { opacity: .5; cursor: default; }
/* 確認視窗（LiteErp.confirm）：沿用開窗的外框，內文幾句話，底下是取消／紅色的確定鈕 */
.pk.cfm { width: min(440px, calc(100vw - 32px)); }
.cfm-body { padding: 4px 20px 16px; }
.cfm-body p { margin: 0 0 8px; font-size: 14px; line-height: 1.6; }
.cfm-body p:last-child { margin-bottom: 0; }
.cfm-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
@media (min-width: 761px) {
  .ce-list table { table-layout: fixed; min-width: var(--ce-min, 900px); }
  .ce-list th, .ce-list td { padding: 8px 10px; overflow: hidden; text-overflow: ellipsis; }
  .ce-list th:first-child, .ce-list td:first-child { padding-left: 20px; }
  .ce-list th:last-child, .ce-list td:last-child { padding-right: 20px; }
  .ce-list td.ce-act { text-align: center; }
}
@media (max-width: 760px) {
  .undo-toast { left: 14px; right: 14px; bottom: 14px; transform: translateY(16px); justify-content: space-between; }
  .undo-toast.show { transform: none; }
  .ce-toolbar { padding: 12px 14px; }
  .ce-search { max-width: none; }
  .ce-note { padding: 10px 14px; }
  .ce-list colgroup { display: none; }
  .ce-wrap { overflow: visible; }
  /* 手機上一位一塊，每個欄位排成「標籤＋值」一行，連空的欄位也留著，才有地方點 */
  .ce-list tr td.ce, .ce-list tr td.ce-s, .ce-list tr td.ce-ctrl, .ce-list tr td.ce-seq { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
  .ce-btn { min-width: 36px; height: 36px; }
  .pk-search { font-size: 16px; }
  .ce-sel { padding: 8px 10px; font-size: 16px; }
  .ce-chk { padding: 6px 0; }
  .ce-chk input { width: 22px; height: 22px; }
  .ce-list tr td.ce-dis { display: none; }
  .ce-list td[data-label]::before { content: attr(data-label); flex: none; width: 48px; font-size: 12px; color: var(--muted); white-space: nowrap; }
  .ce-body { flex: 1; min-height: 34px; }
  .ce-v:empty::before { content: '點這裡輸入'; color: var(--muted); opacity: .6; }
  .ce { border-radius: 6px; }
  .ce:hover { box-shadow: none; background: none; }
  .ce.editing { box-shadow: inset 0 0 0 1px var(--brand); background: var(--field-bg); }
  .ce-in, .ce-pick { padding: 8px 10px; font-size: 16px; }
  .ce-list td.ce-act { display: block; margin-top: 6px; padding: 0; }
  .ce-acts { justify-content: flex-start; gap: 10px; }
  /* 預覽的問題表在手機上一列一塊 */
  .xi-tbl thead { display: none; }
  .xi-tbl tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .xi-tbl td { display: flex; gap: 10px; padding: 2px 0; border: 0; white-space: normal !important; }
  .xi-tbl td::before { content: attr(data-label); flex: none; width: 48px; color: var(--muted); font-size: 12px; }
  .xi-foot .btn, .cfm-foot .btn { flex: 1; }
  .ce-mbtn { height: 36px; padding: 0 14px; }
  .ce-menu button { padding: 12px 14px; font-size: 16px; }
  .ce-del { padding: 0 14px; }
  .ce-del-t { display: inline; }
  .ce-actions .btn { flex: none; }
}

/* 權限設定：六組各是可展開的區塊（手風琴），展開後是主管、店員各四欄的勾選表 */
.pm-intro { margin: -8px 0 2px; }
.pm-intro2 { margin: 0 0 12px; }
.pm, .pm-actions { max-width: 900px; }
.pm-bar { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 10px; }
.pm-bar .btn { padding: 6px 14px; min-height: 36px; font-size: 13px; }
.pm-item { margin-bottom: 10px; }
/* 標題列＝展開收合的按鈕＋可以點的摘要標籤（按鈕裡不能再放按鈕，所以兩個並排） */
.pm-hrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 0 16px; background: var(--card); cursor: pointer; }
.pm-hrow:hover { background: var(--bg); }
.pm-head { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-height: 48px; padding: 8px 0; border: 0; background: none; color: var(--text); font-size: 15px; font-weight: 700; text-align: left; cursor: pointer; }
.pm-head:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.pm-chev { display: inline-block; width: 14px; color: var(--muted); font-size: 12px; transition: transform .15s; }
.pm-head[aria-expanded="true"] .pm-chev { transform: rotate(90deg); }
.pm-title { flex: 1 1 auto; min-width: 5em; }
.pm-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pm-tags .tag { white-space: nowrap; }
.pm-tag { border: 0; font-family: inherit; line-height: inherit; cursor: pointer; }
.pm-tag:hover { box-shadow: inset 0 0 0 1px currentColor; }
.pm-tag:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.pm-body { border-top: 1px solid var(--line); overflow-x: auto; }
.pm-body th, .pm-body td { white-space: nowrap; }
.pm-body thead th { padding: 8px 4px; text-align: center; font-size: 13px; }
.pm-body thead th.pm-fn { padding-left: 20px; text-align: left; vertical-align: bottom; }
.pm-body thead th.pm-role { padding: 10px 4px 6px; color: var(--text); font-size: 14px; }
.pm-body .pm-start { border-left: 1px solid var(--line); }
.pm-body tbody th { padding: 8px 12px 8px 20px; text-align: left; font-size: 14px; font-weight: 600; color: var(--text); background: none; }
.pm-body tbody th small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); white-space: normal; }
.pm-body tbody tr, .pm-body tbody tr:hover { cursor: default; }
.pm-body td { width: 62px; padding: 0; text-align: center; }
.pm-body td label { display: flex; align-items: center; justify-content: center; min-height: 40px; cursor: pointer; }
.pm-body td label:hover { box-shadow: inset 0 0 0 1px var(--brand); }
.pm-body td input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.pm-body td.pm-na { color: var(--muted); opacity: .55; }
.pm-actions { margin-top: 16px; }
@media (prefers-reduced-motion: reduce) {
  .pm-chev { transition: none; }
}
@media (max-width: 760px) {
  .pm-hrow { row-gap: 0; padding: 0 12px; }
  .pm-head { flex-basis: 100%; }
  .pm-tags { padding: 0 0 10px 24px; }
  /* 手機上仍維持表格（上面的通用規則會把表格拆成一列一塊），九欄剛好放得下 390px */
  .pm-body table { display: table; }
  .pm-body thead { display: table-header-group; }
  .pm-body tbody { display: table-row-group; }
  .pm-body tr { display: table-row; padding: 0; }
  .pm-body th, .pm-body td { display: table-cell; }
  .pm-body thead th { padding: 6px 1px; font-size: 12px; }
  .pm-body thead th.pm-fn { padding-left: 10px; }
  .pm-body tbody th { padding: 8px 4px 8px 10px; white-space: normal; font-size: 13px; }
  .pm-body td { width: auto; min-width: 34px; border-bottom: 1px solid var(--line); }
  .pm-body tbody tr:last-child td { border-bottom: 0; }
}

/* 客戶（pages/customers.js）：清單＋右側滑出面板，面板裡是自動存的完整表單 */
.cu-list tbody tr[data-id] { cursor: pointer; }
.cu-list tbody tr.is-cur td { background: var(--brand-soft); }
.cu-list tbody tr.is-off td { color: var(--muted); }
.cu-list tbody tr:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.cu-list th, .cu-list td { padding: 12px; }
.cu-name { font-weight: 600; }
.cu-addr { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.cu-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(600px, 100vw); display: flex; flex-direction: column;
  background: var(--card); border-left: 1px solid var(--line); box-shadow: -10px 0 30px var(--shadow);
  transform: translateX(105%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s; }
.cu-drawer.open { transform: none; visibility: visible; transition: transform .22s ease; }
.cu-dhead { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px 22px; border-bottom: 1px solid var(--line); }
.cu-dhead h2 { flex: 1; min-width: 0; margin: 0; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cu-dhead h2:focus { outline: none; }
.cu-dbody { flex: 1; overflow-y: auto; padding: 18px 22px 40px; }
.cu-form { display: grid; gap: 18px; }
.cu-group { display: grid; gap: 12px; }
.cu-group + .cu-group { padding-top: 16px; border-top: 1px solid var(--line); }
.cu-gt { margin: 0; font-size: 14px; color: var(--muted); }
.cu-form input, .cu-form select, .cu-form textarea { width: 100%; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; font: inherit; color: var(--text); background: var(--field-bg); }
.cu-form textarea { resize: vertical; min-height: 72px; }
.cu-form [aria-invalid="true"] { border-color: #c0392b; }
:root[data-theme="dark"] .cu-form [aria-invalid="true"] { border-color: #ff8a7a; }
.cu-cols2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cu-money { grid-template-columns: minmax(0, 1fr); }
.cu-form .link-btn { align-self: flex-start; }
.cu-disc { display: flex; align-items: center; gap: 8px; }
.cu-disc input { width: 96px; flex: none; }
.cu-pct { color: var(--muted); }
.cu-terms { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.cu-terms .seg input { width: 100%; padding: 0; border: 0; }
.cu-month { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; white-space: nowrap; }
.cu-month select { width: auto; padding: 7px 8px; }
.cu-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.cu-off { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.cu-off input { width: 18px; height: 18px; margin: 0; padding: 0; accent-color: var(--brand); }
@media (prefers-reduced-motion: reduce) {
  .cu-drawer, .cu-drawer.open { transition: none; }
}
@media (max-width: 760px) {
  .cu-list td { padding: 2px 0; }
  .cu-list td.cu-m { display: none; }
  .cu-addr { max-width: none; }
  .cu-dbody { padding: 16px 14px 40px; }
  .cu-cols2, .cu-money { grid-template-columns: minmax(0, 1fr); }
  .cu-form input, .cu-form select, .cu-form textarea { font-size: 16px; }
}
/* 客戶清單：滑鼠停在聯絡人上浮出的詳細資料 */
.cu-ct { cursor: help; border-bottom: 1px dotted var(--muted); }
.cu-tip { position: fixed; z-index: 60; max-width: 320px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); box-shadow: 0 8px 24px var(--shadow); font-size: 13px; pointer-events: none; }
.cu-tip b { display: block; margin-bottom: 6px; font-size: 14px; }
.cu-tip dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; margin: 0; }
.cu-tip dt { color: var(--muted); white-space: nowrap; }
.cu-tip dd { margin: 0; overflow-wrap: anywhere; }
.cu-tip p { margin: 0; }
/* 商品頁：清單的庫存紅字、面板的圖片、庫存、下拉旁的「＋」、組合內容 */
.pr-list td.pr-code { color: var(--muted); font-variant-numeric: tabular-nums; }
.pr-low { color: var(--danger); font-weight: 700; }
.pr-na { color: var(--muted); }
.pr-top { grid-template-columns: 160px minmax(0, 1fr); align-items: start; gap: 18px; }
.pr-imgbox { display: grid; gap: 6px; justify-items: start; }
.pr-img { width: 160px; height: 160px; border: 1px solid var(--line); border-radius: 10px; object-fit: contain; background: #fff; }
.pr-img-empty { display: grid; place-items: center; border-style: dashed; background: var(--field-bg); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.pr-img-empty:hover { color: var(--brand); border-color: var(--brand); }
.pr-imgacts { display: flex; gap: 14px; }
.pr-stock { width: 100%; border-collapse: collapse; font-size: 14px; }
.pr-stock th, .pr-stock td { padding: 6px 0; background: none; font-size: 14px; }
.pr-stock th { color: var(--muted); font-weight: 400; }
.pr-stock tr.pr-sum th, .pr-stock tr.pr-sum td { color: var(--text); font-weight: 700; border-bottom: 0; }
.pr-pick { display: flex; gap: 6px; }
.pr-pick select { flex: 1; }
.pr-add { flex: none; width: 40px; padding: 0; font-size: 16px; }
.pr-ro { padding: 9px 0; font-variant-numeric: tabular-nums; }
.pr-parts { width: 100%; border-collapse: collapse; }
.pr-parts th, .pr-parts td { padding: 6px 8px 6px 0; border-bottom: 0; white-space: normal; }
.pr-parts th { background: none; }
.pr-parts td:last-child, .pr-parts th:last-child { width: 1%; padding-right: 0; }
.pr-qtybox { display: flex; align-items: center; gap: 6px; }
.cu-group > .pr-padd { justify-self: start; }
.cu-form .pr-qtybox input { width: 80px; flex: none; }
/* 組合商品頁：存量表的欄名、組合內容的子件庫存 */
.kt-stock thead th { padding: 0 0 4px; font-size: 12px; border-bottom: 1px solid var(--line); }
.kt-asm, .kt-dis { margin-top: 10px; }
.kt-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.kt-acts .btn { margin-top: 0; }
.kt-stock th.num, .kt-stock td.num { text-align: right; }
.pr-parts td.kt-pstock { color: var(--muted); font-weight: 400; white-space: nowrap; }
/* 架上還有包好的盒子時，組合內容鎖住 */
.pr-parts select:disabled, .pr-parts input:disabled, .pr-parts .ce-del:disabled { opacity: .55; cursor: not-allowed; }
@media (max-width: 760px) {
  .pr-list td.num { display: flex; align-items: baseline; gap: 10px; font-size: 16px; }
  .pr-list td.num::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 400; }
  .pr-top { grid-template-columns: minmax(0, 1fr); }
  /* 面板裡的兩張小表在手機上照樣是表格，不套清單的直排 */
  .pr-stock, .pr-parts { display: table; }
  .pr-stock tbody, .pr-parts tbody { display: table-row-group; }
  .pr-stock thead, .pr-parts thead { display: table-header-group; }
  /* 組合商品清單的「包好的」同時是 num 與 cu-m：上面那條 display: flex 會蓋掉 cu-m 的藏起來 */
  .pr-list td.num.cu-m { display: none; }
  .pr-stock tr, .pr-parts tr { display: table-row; padding: 0; }
  .pr-stock td, .pr-parts td { display: table-cell; }
  .pr-stock td.num { text-align: right; font-size: 14px; }
  .pr-stock th, .pr-stock td { border-bottom: 1px solid var(--line); }
}
/* 沒有外框的頁（列印預覽）：不顯示圖示欄與頂端列 */
body.is-bare .rail, body.is-bare .topbar { display: none; }
body.is-bare .main { margin-left: 0; }
body.is-bare .content { padding: 0; }

/* 列印預覽（print-list.js）：上方工具列，下方一張張 A4 橫向的紙；紙一律白底黑字，不跟深色模式與主題色 */
.pl-bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; padding: 12px 28px; background: var(--card); border-bottom: 1px solid var(--line); }
.pl-bar .spacer { flex: 1; }
.pl-info { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; }
.pl-info h1 { margin: 0; font-size: 18px; }
.pl-count { color: var(--muted); font-size: 14px; }
.pl-pages { display: flex; flex-direction: column; align-items: center; gap: 24px; padding: 24px 16px 48px; }
.pl-sheet { flex: none; display: flex; flex-direction: column; padding: 12mm 14mm 10mm; background: #fff; color: #000; box-shadow: 0 2px 10px var(--shadow); overflow: hidden;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pl-head { position: relative; flex: none; text-align: center; margin-bottom: 2mm; }
.pl-co { font-size: 16pt; font-weight: 700; }
.pl-title { display: inline-block; margin-top: 1mm; font-size: 14pt; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.pl-meta { margin-top: 1mm; text-align: right; font-size: 9.5pt; }
.pl-meta.pl-split { display: flex; justify-content: space-between; gap: 6mm; }
.pl-meta.pl-split > :first-child { text-align: left; }
.pl-meta.pl-split > .pl-page { flex: none; white-space: nowrap; }
.pl-body { flex: 1; min-height: 0; overflow: hidden; }
.pl-sub { margin: 5mm 0 1.5mm; font-size: 11pt; font-weight: 700; }
.pl-sheet .pl-body > .pl-sub:first-child { margin-top: 0; }
/* 列印的浮水印：每張紙各打一份，紙永遠是白底所以不分深淺色；瀏覽器預設不印背景，要 print-color-adjust 才印得出來 */
.pl-sheet { position: relative; }
.pl-sheet::after { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; -webkit-print-color-adjust: exact; print-color-adjust: exact;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 680 340'%3E%3Ctext transform='rotate(-20 340 170)' x='340' y='180' text-anchor='middle' font-family='Noto Sans TC,Microsoft JhengHei,PingFang TC,sans-serif' font-size='28' font-weight='700' fill='%23000' fill-opacity='.09'%3E原型．非正式系統．資料皆為示範%3C/text%3E%3C/svg%3E") 0 0 / 170mm 85mm; }
.pl-sheet .pl-t { display: table; width: 100%; table-layout: fixed; border-collapse: collapse; border-bottom: 1px solid #000; font-size: 10pt; }
.pl-sheet .pl-t thead { display: table-header-group; }
.pl-sheet .pl-t tbody { display: table-row-group; }
.pl-sheet .pl-t tr { display: table-row; padding: 0; border: 0; background: none; }
.pl-sheet .pl-t tr.pl-alt { background: #f0f0f0; }
.pl-sheet .pl-t tbody tr:hover { background: none; cursor: default; }
.pl-sheet .pl-t tbody tr.pl-alt:hover { background: #f0f0f0; }
.pl-sheet .pl-t th, .pl-sheet .pl-t td { display: table-cell; padding: 1mm 1.5mm; border: 0; text-align: left; vertical-align: top; white-space: normal; overflow-wrap: anywhere; color: #000; background: none; font-size: 10pt; }
.pl-sheet .pl-t th { font-weight: 400; border-top: 1px solid #000; border-bottom: 1px solid #000; }
/* 欄名裡 \n 後面那段（分析表的「（未稅）」）印在第二行；靠右的欄同畫面的 .th-sub 往右推半個字，「）」才跟數字對齊 */
.pl-sheet .pl-t th .pl-thsub { display: block; }
.pl-sheet .pl-t th.num .pl-thsub { margin-right: -.5em; }
.pl-sheet .pl-t th.num, .pl-sheet .pl-t td.num { text-align: right; font-weight: 400; font-size: 10pt; }
.pl-sheet .pl-t td.pl-empty { padding: 4mm 1.5mm; text-align: center; color: #555; }
@media (max-width: 760px) {
  .pl-bar { padding: 10px 14px; }
  .pl-pages { gap: 12px; padding: 12px 16px 32px; }
}
@media print {
  body.is-bare { background: #fff; }
  body.is-bare .pl-bar, body.is-bare .toast, body.is-bare .undo-toast { display: none; }
  .pl-pages { display: block; padding: 0; zoom: 1 !important; }
  .pl-sheet { box-shadow: none; break-after: page; }
  .pl-sheet:last-child { break-after: auto; }
}
.ce-toolbar .btn:disabled { opacity: .5; cursor: default; }
.ce-toolbar .btn:disabled:hover { background: var(--card); }

/* 組裝單、拆裝單（kit-doc.js）：清單＋整頁單據；單頭欄位自動排欄，子件表、庫存不夠的紅字、底部的儲存列 */
.as-intro { margin: -8px 0 14px; }
.as-body { padding: 20px; }
.as-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.as-nav .btn[disabled] { opacity: .45; cursor: not-allowed; }
.as-nav .btn[disabled]:hover { background: var(--card); }
.crumb a { color: inherit; }
/* 還沒做的頁（pages/planned.js）：畫面正中間一行大字；高度扣掉頂端列、內容區上下留白與路徑那一行 */
.pn-body { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 60px - 24px - 40px - 26px); }
.pn-big { margin: 0; color: var(--muted); font-size: 72px; font-weight: 700; letter-spacing: .12em; }
.pn-big:focus { outline: none; }
@media (max-width: 760px) {
  .pn-body { min-height: calc(100vh - 60px - 16px - 32px - 26px); }
  .pn-big { font-size: 48px; }
}
.as-head { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 16px; }
.as-head .as-wide { grid-column: 1 / -1; }
.as-head .as-span2 { grid-column: span 2; }
/* 進項單據的「公司當時」「不計入進項稅額」（cost.md 2026-11-18 第三輪）：只在三聯式＋應稅時出現，自成一行，欄寬跟上面的格子對齊 */
.as-head .it-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 16px; }
.as-head .it-nd { grid-column: span 2; }
.it-chk { display: flex; align-items: center; gap: 8px; min-height: 38px; }
.cu-form .it-chk input { flex: none; width: 18px; height: 18px; margin: 0; padding: 0; }
.as-form textarea { min-height: 56px; }
.as-ro { background: var(--bg) !important; color: var(--muted); }
.as-qty { display: flex; align-items: center; gap: 6px; }
.as-qty input { flex: 1; min-width: 0; }
.as-lines .as-qty input { width: 80px; flex: none; }

/* 子件 */
.as-lwrap { overflow-x: auto; }
/* 子件表不撐滿：寬的版面上「用量」才不會離子件很遠；app.css 的 .pr-parts 末欄 width: 1% 會把表撐滿，要蓋掉 */
table.as-lines { width: auto; }
.as-lines td:last-child, .as-lines th:last-child { width: auto; }
.as-lines td.as-have, .as-lines th.num { padding-left: 16px; }
.as-lines th.as-seq, .as-lines td.as-seq { padding-right: 10px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.as-lines th { white-space: nowrap; }
select.as-period, select.as-dateby { width: auto; padding: 8px 12px; }
.as-lines td.as-have { color: var(--muted); font-weight: 400; white-space: nowrap; }
.as-lines tr.as-short td.as-have { color: var(--danger); font-weight: 700; }
.as-short-t { margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: var(--danger); color: var(--on-danger); font-size: 11px; font-weight: 700; }
.as-chg { margin-left: 6px; vertical-align: middle; }
.as-lines td select { max-width: 100%; }
.cu-form .as-lines input.as-lp { width: 280px; max-width: 100%; }
.as-lines tbody tr:hover { background: none; cursor: default; }
.as-lacts { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.as-warn { margin: 0; padding: 8px 12px; border-radius: 9px; background: var(--warn-bg); color: var(--warn); font-size: 14px; font-weight: 600; }
/* 拆裝單：數量下面「台北倉包好的 N 盒」，拆的比包好的多時紅字 */
.as-packed { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.as-packed.is-short { color: var(--danger); font-weight: 700; }

/* 單據頁底部的動作列：一直黏在視窗最下面（要按儲存才存）；有改沒存時狀態字變色 */
.as-bar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 16px -28px -40px; padding: 12px 28px;
  background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px var(--shadow); }
/* 游標移到下面的格子時留出動作列的高度，不要被蓋住（電腦 66px；手機舊單的按鈕掉第二行，113px） */
html:has(.as-bar) { scroll-padding-bottom: 124px; }
.as-bar .spacer { flex: 1; }
.as-state { color: var(--muted); font-size: 14px; }
.as-bar.is-dirty .as-state { color: var(--warn); font-weight: 700; }
.as-bar .btn:disabled { opacity: .5; cursor: not-allowed; }
.as-bar .btn.primary:disabled:hover { background: var(--brand); }
a.btn.as-add { text-decoration: none; }
.as-lvfoot { flex-wrap: wrap; }

/* 清單 */
.as-list td.as-note { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
/* 被截斷的備註：虛線底線，滑鼠停上去浮出全文（doc-page.js 的 markCut、hoverTip） */
.as-list td.as-note.is-cut { cursor: help; text-decoration: underline dotted var(--muted); text-underline-offset: 4px; }
.as-tip { max-width: 360px; }
.as-tip .as-tipnote { white-space: pre-wrap; overflow-wrap: anywhere; }
/* 報價單、訂單、採購單清單的「商品」格：只寫品名，太長截斷；滑鼠停上去浮出完整清單（.qt-tip） */
.as-list td.qt-items { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qt-it { cursor: help; border-bottom: 1px dotted var(--muted); }
.qt-tip { max-width: 360px; }
.qt-tip dl { grid-template-columns: minmax(0, 1fr) auto; }
.qt-tip dt { color: var(--text); white-space: normal; }
.qt-tip dd { color: var(--muted); text-align: right; white-space: nowrap; }
.as-pfoot { margin-top: 16px; }
@media (max-width: 760px) {
  .as-body { padding: 14px; }
  .page-head .as-nav { width: 100%; }
  .as-head { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .as-head .it-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .as-head .it-nd { grid-column: 1 / -1; }
  .as-head .it-nd > .lbl { display: none; }   /* 手機上勾選框自己一行，不用跟下拉對齊的空白標題 */
  .as-form input, .as-form select, .as-form textarea { font-size: 16px; }
  .as-bar { margin: 16px -14px -32px; padding: 10px 14px; }
  .as-bar .btn { padding: 9px 14px; }
  /* 子件表在手機上照樣是表格，不套清單的一列一塊 */
  .as-lines { display: table; }
  .as-lines thead { display: table-header-group; }
  .as-lines tbody { display: table-row-group; }
  .as-lines tr { display: table-row; padding: 0; }
  .as-lines th, .as-lines td { display: table-cell; padding: 6px 6px 6px 0; }
  .as-lines th.as-seq, .as-lines td.as-seq { display: none; }
  .as-lines .as-qty input { width: 64px; }
  .as-lines td.num { text-align: right; font-size: 14px; }
  table.as-lines { width: 100%; }
  .cu-form .as-lines input.as-lp { width: 100%; min-width: 0; }
  .as-lines td.as-have, .as-lines th.num { padding-left: 4px; }
  .as-list td.as-note { max-width: none; }
  /* 手機沒有滑鼠：品名最多兩行，再多就截斷 */
  .as-list td.qt-items { max-width: none; white-space: normal; }
  .as-list .qt-it { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; border-bottom: 0; cursor: auto; }
  /* 子件在手機上名稱獨占一行，品名才看得完整（Jesse 2026-11-02「類似的都要處理」）：組裝單、拆裝單、組合商品面板 */
  table.as-namerow, table.as-namerow tbody { display: block; }
  table.as-namerow thead { display: none; }
  table.as-namerow tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.as-namerow td { display: block; padding: 0; border-bottom: 0; }
  table.as-namerow td.as-seq { display: none; }
  table.as-namerow td.as-lname { grid-column: 1 / -1; }
  table.as-namerow td.as-lname input { width: 100%; min-width: 0; }
  table.as-namerow td.num { text-align: right; font-size: 14px; }
  table.as-namerow td.num::before { content: attr(data-label) ' '; color: var(--muted); font-size: 12px; font-weight: 400; }
  table.as-namerow td:last-child { width: auto; }
  /* 調撥單的倉庫、庫存調整單的原因：「高雄倉（停用中）」這類長名稱半格放不下，手機上佔一整行 */
  .tf-form .cf-field:has(#tf-from), .tf-form .cf-field:has(#tf-to), .aj-form .cf-field:has(.aj-rsn) { grid-column: 1 / -1; }
}
/* 單據清單底下的分頁列（一頁幾筆可選） */
.as-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 20px; border-top: 1px solid var(--line); font-size: 14px; }
.as-pager .spacer { flex: 1; }
.as-count { display: flex; align-items: center; gap: 14px; }
.as-total { color: var(--muted); }
.as-size { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.as-size .ce-sel { width: auto; padding: 5px 8px; font-size: 14px; }
.as-pgn { min-width: 6.5em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.as-pgn:focus { outline: none; }
.as-pgi { box-sizing: border-box; min-width: 34px; margin-right: 2px; padding: 4px 4px; border: 1px solid var(--line); border-radius: 6px; font: inherit; text-align: center; color: var(--text); background: var(--field-bg); }
.as-pgi[disabled] { padding-left: 0; padding-right: 0; border-color: transparent; background: transparent; }
.as-pg { padding: 6px 12px; font-size: 14px; white-space: nowrap; }
.as-pg[disabled] { opacity: .45; cursor: not-allowed; }
.as-pg[disabled]:hover { background: var(--card); }
@media (max-width: 760px) {
  .as-pager { padding: 12px 14px; justify-content: center; }
  .as-pager .spacer { display: none; }
  .as-count { flex-basis: 100%; justify-content: center; }
  .as-size .ce-sel { padding: 6px 10px; font-size: 16px; }
  .as-pgi { font-size: 16px; min-height: 40px; }
  .as-pgn { min-width: 0; }
  .as-pager { column-gap: 6px; }
  .as-pgt { display: none; }
  .as-pg { min-width: 44px; min-height: 40px; }
}
/* 組裝單清單的查詢條件：第一列期間＋起訖日期，第二列組合商品、倉庫、經辦人、關鍵字、查詢、重設條件；改了還沒查時查詢鈕變主題色框 */
.as-qbar:has(+ .as-qbar) { border-bottom: 0; }
.as-qbar + .as-qbar { padding-top: 0; }
.as-qbar .ce-sel { width: auto; padding: 8px 10px; }
.as-range { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.as-date { min-width: 150px; }
.as-qsel { max-width: 220px; }
.as-qbar input.as-qpick { width: 180px; cursor: text; }
.as-go.is-stale { border-color: var(--brand); color: var(--brand-dark); font-weight: 700; box-shadow: inset 0 0 0 1px var(--brand); }
.as-stale-t { color: var(--warn); }
@media (max-width: 760px) {
  .as-qbar .ce-sel, .as-qsel { flex: 1 1 140px; max-width: none; }
  .as-range { flex: 1 1 100%; }
  .as-range .as-date { flex: 1 1 0; width: 0; min-width: 0; }
  .as-qbar .as-add { flex: 1 1 100%; text-align: center; }
  .as-qbar .ce-search { flex: 1 1 100%; }
  .as-go, .as-clear { flex: 1; white-space: nowrap; }
  .as-stale-t { flex-basis: 100%; }
}
/* 資料清單的條件列（list-filter.js）：工具列下面固定一列，手機收成「篩選 ▾」 */
.ce-toolbar:has(+ .lf-bar) { border-bottom: 0; }
.lf-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; padding: 0 20px 14px; border-bottom: 1px solid var(--line); }
.lf-bar [hidden] { display: none; }
.lf-f { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.lf-bar .ce-sel { width: auto; padding: 6px 8px; }
.lf-f:not(.lf-n) .ce-sel { max-width: 130px; }
.lf-bar .ce-in { padding: 6px 8px; }
.lf-bar input.lf-combo { width: 130px; }
.lf-bar input.lf-num { width: 68px; }
.lf-bar input.lf-num:disabled { opacity: .5; cursor: not-allowed; }
.lf-bar .ce-in[aria-invalid="true"] { color: #c0392b; }
:root[data-theme="dark"] .lf-bar .ce-in[aria-invalid="true"] { color: #ff8a7a; }
.lf-reset { white-space: nowrap; }
.lf-bar .btn:disabled { opacity: .5; cursor: default; }
.lf-bar .btn:disabled:hover { background: var(--card); }
.lf-toggle { display: none; }
@media (max-width: 760px) {
  .lf-toggle { display: inline-flex; white-space: nowrap; }
  .lf-bar { display: none; padding: 0 14px 12px; }
  .lf-bar.is-open { display: flex; }
  .lf-f { flex: 1 1 100%; }
  .lf-l { flex: none; width: 64px; }
  .lf-bar .ce-sel, .lf-f:not(.lf-n) .ce-sel { flex: 1; min-width: 0; max-width: none; }
  .lf-bar input.lf-combo, .lf-bar input.lf-num { flex: 1; width: 0; min-width: 0; }
  .lf-reset { flex: 1 1 100%; }
}
/* 銷貨單產生的組裝單（有銷貨單號）：整張唯讀，上方一行說明，欄位 disabled */
.as-lockmsg { margin: -8px 0 14px; padding: 10px 14px; border-radius: 10px; background: var(--info-bg); color: var(--info); font-size: 14px; font-weight: 600; }
.as-form :disabled { opacity: 1; color: var(--text); background: var(--bg); cursor: default; }
.as-lines select:disabled, .as-lines input:disabled { opacity: 1; cursor: default; }
/* 組裝單單張列印（A4 直向）：單頭資料兩欄、子件表最後一欄是勾選空格、最下面簽名欄；紙一律白底黑字 */
.as-sheet { width: 210mm; min-height: 296mm; overflow: visible; }
.as-pinfo { display: grid; grid-template-columns: 1fr 1fr; gap: 2mm 8mm; margin: 4mm 0 5mm; font-size: 10.5pt; }
.as-pi { display: flex; gap: 3mm; padding-bottom: 1mm; border-bottom: 1px solid #999; }
.as-pi span { flex: none; width: 18mm; color: #444; }
.as-pi b { font-weight: 400; overflow-wrap: anywhere; }
.as-piw { grid-column: 1 / -1; }
.pl-sheet .as-pt td { padding: 2.2mm 1.5mm; border-bottom: 1px solid #bbb; }
.as-box { display: inline-block; width: 4.5mm; height: 4.5mm; border: 1px solid #000; vertical-align: middle; }
.as-sign { display: flex; gap: 20mm; margin-top: 14mm; font-size: 10.5pt; }
.as-sign span { flex: 1; padding-bottom: 8mm; border-bottom: 1px solid #000; }

/* 打字就篩的浮出清單（combo.js）：跟小選單一樣 position: fixed 掛在 body */
.cb-list { position: fixed; z-index: 60; overflow-y: auto; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); box-shadow: 0 8px 24px var(--shadow); }
/* 放得下就一行；放不下小字換到第二行，名稱永遠完整（Jesse 2026-11-02 選） */
.cb-opt { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; padding: 8px 10px; border-radius: 7px; color: var(--text); font-size: 14px; cursor: pointer; }
.cb-opt b { min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.cb-opt:hover { background: var(--bg); }
.cb-opt.is-active { background: var(--brand-soft); color: var(--brand-dark); }
.cb-sub { min-width: 0; color: var(--muted); font-size: 13px; }
.cb-opt.is-active .cb-sub { color: inherit; }
.cb-more { padding: 8px 10px; color: var(--muted); font-size: 13px; }
@media (max-width: 760px) { .cb-opt { padding: 11px 10px; font-size: 16px; } }

/* 報價單：單頭的客戶提示、單身（商品、數量、單價＋灰字、金額、備註）、底部合計 */
.qt-chint { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.qt-head .cf-field > input[data-combo] { min-width: 0; }
table.qt-lines { width: 100%; }
.qt-lines td { vertical-align: top; }
/* 各欄定寬，多的寬度只給備註：第一列（只有空白列）跟之後的欄位才不會跳（Jesse 2026-11-02 選商品欄固定 360px，輸入框寬度，外加 8px 留白） */
.qt-lines th.qt-hp, .qt-lines td.qt-cp { width: 368px; min-width: 368px; }
.qt-lines th.qt-hq, .qt-lines td.qt-cq { width: 106px; min-width: 106px; }
.qt-lines th.qt-hpr, .qt-lines td.qt-cpr { width: 132px; min-width: 132px; }
.qt-lines th.qt-ha, .qt-lines td.qt-amt { width: 72px; min-width: 72px; }
.qt-lines th.qt-hn { width: 100%; }
.qt-lines td.qt-cp input { width: 100%; }
.qt-lines td.qt-cpr input { width: 104px; text-align: right; }
.qt-lines td.qt-cn { width: 100%; }
.qt-lines td.qt-cn input { width: 100%; min-width: 120px; }
.qt-lines .as-qty .cf-hint { white-space: nowrap; }
.qt-lines td.qt-amt { padding-top: 13px; padding-left: 12px; white-space: nowrap; }
.qt-lines th.num { padding-left: 12px; }
.qt-phint { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.qt-lines tr.qt-blank td.as-seq::after { content: '＋'; color: var(--muted); }
.qt-sum { display: grid; justify-content: end; gap: 4px; margin-top: 4px; }
.qt-sum > div { display: flex; justify-content: space-between; gap: 32px; min-width: 240px; font-size: 15px; }
.qt-sum b { font-variant-numeric: tabular-nums; }
.qt-sum .qt-qty { color: var(--muted); }
.qt-sum .qt-total { padding-top: 4px; border-top: 1px solid var(--line); font-size: 18px; font-weight: 700; }
.qt-sum .qt-taxin { justify-content: flex-end; color: var(--muted); font-size: 13px; }
@media (max-width: 760px) {
  /* 手機上單身一列變成一塊：商品一整行，下面數量、單價、金額，再下面備註與 🗑 */
  .qt-lines, .qt-lines tbody { display: block; }
  .qt-lines thead { display: none; }
  .qt-lines tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 88px; gap: 6px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .qt-lines td { display: block; padding: 0; }
  .qt-lines td.as-seq { display: none; }
  .qt-lines td.qt-cp { grid-column: 1 / -1; width: auto; min-width: 0; }
  .qt-lines td.qt-cq, .qt-lines td.qt-cpr, .qt-lines td.qt-amt { width: auto; min-width: 0; }
  .qt-lines td.qt-cpr input { width: 100%; }
  .qt-lines td.qt-amt { align-self: start; padding: 10px 0 0; text-align: right; white-space: normal; }
  .qt-lines td:last-child { justify-self: end; }
  .qt-lines td.qt-cn { grid-column: 1 / 3; width: auto; }
  .qt-lines td.qt-cn input { min-width: 0; }
  .qt-lines tr.qt-blank td:not(.qt-cp) { display: none; }
  .qt-phint { white-space: normal; }
  .qt-sum { justify-content: stretch; }
  .qt-sum > div { min-width: 0; }
  /* 出過貨的訂單：「已交」排在數量、單價、金額那一行下面，再下面才是備註與 🗑 */
  .qt-lines td.qt-shp { order: 4; grid-column: 1 / -1; padding: 0; text-align: left; color: var(--muted); font-weight: 400; }
  .qt-lines td.qt-shp::before { content: '已交 '; }
  .qt-shipped td.qt-cn { order: 5; }
  .qt-shipped td:last-child { order: 6; }
}

/* 訂單：整張唯讀用 fieldset 鎖住（外框拿掉）、出過貨的「已交」欄、尚欠、來源報價單；報價單標題下的「已轉成訂單」 */
.qt-fs { min-width: 0; margin: 0; padding: 0; border: 0; }
.qt-lines td.qt-shp { padding-top: 13px; white-space: nowrap; }
.qt-sum .od-owe { font-weight: 700; }

/* 調撥單（pages/transfer.js）：單身借用 qt-lines，多兩欄「調出倉現有」「調入倉現有」；庫存不夠只有調出那欄變紅 */
.as-list td.tf-wh { white-space: nowrap; }
.tf-lines td.tf-have { padding-top: 13px; }
.as-lines tr.as-short td.tf-to { color: var(--muted); font-weight: 400; }
@media (max-width: 760px) {
  /* 手機上一列一塊：數量、兩個倉庫的現有量排一行，數字前面寫倉庫名稱 */
  .tf-lines td.tf-have { align-self: start; padding: 10px 0 0; text-align: right; white-space: normal; }
  .tf-lines td.tf-have::before { content: attr(data-label) ' '; color: var(--muted); font-size: 12px; font-weight: 400; }
  /* 清單一張一塊：兩個倉庫前面寫「調出」「調入」，才分得出方向 */
  .tf-list td.tf-wh::before { content: attr(data-label) '　'; color: var(--muted); font-size: 13px; }
}

/* 庫存調整單（pages/adjust.js）：單身借用 qt-lines，多兩欄「現有」「調整後」；庫存不夠只有調整後那欄變紅。原因下拉旁的增加／減少標籤 */
.aj-rsn { display: flex; align-items: center; gap: 8px; }
.aj-rsn input { flex: 1; min-width: 0; }
.aj-rsn .aj-dir, .as-list td.aj-rs .aj-dir { flex: none; white-space: nowrap; }
.as-list td.aj-rs, .as-list td.aj-wh { white-space: nowrap; }
.aj-lines td.aj-have { padding-top: 13px; }
.as-lines tr.as-short td.aj-now { color: var(--muted); font-weight: 400; }
@media (max-width: 760px) {
  /* 手機上一列一塊：數量、現有、調整後排一行，數字前面寫是哪一個 */
  .aj-lines td.aj-have { align-self: start; padding: 10px 0 0; text-align: right; white-space: normal; }
  .aj-lines td.aj-have::before { content: attr(data-label) ' '; color: var(--muted); font-size: 12px; font-weight: 400; }
  .aj-lines td.aj-after { white-space: nowrap; }
}

/* 銷貨單（pages/sales.js）：單身多一欄現有量；不夠的先包好再賣底下多一列「補包」；合計區的訂金抵扣；清單的收款欄 */
.sl-due { display: block; margin-top: 4px; }
.sl-form .qt-lines td.sl-have { padding-top: 13px; white-space: nowrap; }
.sl-form .qt-lines tr.sl-packrow td { padding-top: 0; }
.sl-packrow td { font-size: 13px; }
.sl-packing { color: var(--brand); font-weight: 600; }
.sl-packrow .as-short-t { margin-right: 6px; }
.qt-sum .sl-depo { align-items: center; }
.sl-depo input { width: 104px; text-align: right; }
.as-list td.sl-pay, .as-list td.sl-inv { white-space: nowrap; }
/* 銷貨單客戶格：標籤放不下就換行，客戶名不拆字 */
.as-list td.sl-cust { white-space: normal; word-break: keep-all; }
/* 進貨單廠商格的「發票未到」：電腦版在發票號碼欄，手機藏那欄才顯示這顆 */
.tag.rc-inv-m { display: none; }
@media (max-width: 760px) {
  .tag.rc-inv-m { display: inline-block; }
  /* 手機上一列一塊：商品底下先看現有量，再填數量、單價 */
  .sl-form .qt-lines td.qt-cp { order: -2; }
  .sl-form .qt-lines td.sl-have { order: -1; grid-column: 1 / -1; padding: 0; text-align: left; color: var(--muted); font-weight: 400; }
  .sl-form .qt-lines tr.as-short td.sl-have { color: var(--danger); font-weight: 700; }
  .sl-form .qt-lines td.sl-have::before { content: attr(data-label) ' '; font-size: 12px; font-weight: 400; }
  .sl-form .qt-lines tr.sl-packrow { display: block; padding: 0 0 10px; }
  .sl-form .qt-lines tr.sl-packrow td.as-seq { display: none; }
  .sl-form .qt-lines tr.sl-packrow td { justify-self: auto; }
}
.od-src { display: block; padding: 9px 0; }
.od-src a, .qt-conv a { color: var(--brand); }
.qt-conv { margin: -8px 0 14px; }
.od-list td.od-dl, .od-list td.od-st { white-space: nowrap; }

/* 採購單：商品表下面的「帶出該補的貨」、訂單轉採購單時的「要跟哪一家叫？」；手機上已進量前面的字 */
.po-fill-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 10px 0 4px; }
.po-picks { display: grid; gap: 8px; margin-top: 12px; }
.po-pick { display: grid; gap: 3px; justify-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.po-pick:hover, .po-pick:focus-visible { border-color: var(--brand); background: var(--brand-soft); }
.po-pick b { font-weight: 600; }
/* 盤點單：表頭黏在表格自己的捲動區裡（幾百列時看得到欄名），實盤、差異、金額靠右，負數紅字 */
.st-zero { flex: 1; display: flex; align-items: center; gap: 8px; min-height: 38px; white-space: nowrap; }
.cu-form .st-zero input { flex: none; align-self: center; width: 18px; height: 18px; margin: 0; padding: 0; }
.st-tools { padding: 0 0 10px; }
.st-tools .ce-search { flex: 1 1 260px; max-width: 360px; }
.st-tools .st-mode { width: auto; }
.st-tools .st-prune { margin-left: auto; }
.st-wrap { overflow: auto; max-height: min(62vh, 620px); border: 1px solid var(--line); border-radius: 10px; }
table.st-lines { width: 100%; }
.st-lines thead th { position: sticky; top: 0; z-index: 1; background: var(--card); box-shadow: 0 1px 0 var(--line); }
.st-lines th, .st-lines td { padding: 6px 10px; vertical-align: middle; }
.st-lines tr[hidden] { display: none !important; }
.st-lines td.st-p { min-width: 220px; }
.st-code { color: var(--muted); font-variant-numeric: tabular-nums; }
.st-lines td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.st-lines td.st-b { color: var(--muted); }
.st-lines .as-qty input.st-c { width: 84px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.cu-form .st-lines input.st-n { width: 170px; }
.cu-form .st-lines input.st-add { width: 360px; max-width: 100%; }
.st-lines td.is-neg, .st-sum b.is-neg, .st-list td.is-neg { color: var(--danger); font-weight: 700; }
.st-sum { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 20px; margin-top: 10px; font-size: 14px; color: var(--muted); }
.st-sum b { color: var(--text); font-variant-numeric: tabular-nums; }
.pl-sheet .as-pt td.st-blank { border-bottom: 1px solid #000; }
.st-psum { margin: 4mm 0 0; font-size: 10.5pt; }
@media (max-width: 760px) {
  .st-tools .ce-search { flex: 1 1 100%; max-width: none; }
  .st-tools .st-shown { flex: 1 1 60%; }
  .st-tools .st-prune, .st-tools .st-io { flex: 1 1 40%; margin-left: 0; }
  .st-wrap { overflow: visible; max-height: none; border: 0; border-radius: 0; }
  table.st-lines, .st-lines tbody { display: block; }
  .st-lines thead { display: none; }
  .st-lines tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .st-lines td { display: block; padding: 0; border-bottom: 0; }
  .st-lines td.as-seq { display: none; }
  .st-lines td.st-p, .st-lines td.st-nc { grid-column: 1 / -1; }
  .st-lines td.st-nc { grid-column: 1 / 2; }
  .st-lines td.st-dc { text-align: right; }
  .st-lines td.num, .st-lines td.st-cc { text-align: left; font-size: 14px; }
  .st-lines td.num::before, .st-lines td.st-cc::before { content: attr(data-label) ' '; color: var(--muted); font-size: 12px; font-weight: 400; }
  .cu-form .st-lines input.st-n, .cu-form .st-lines input.st-add { width: 100%; min-width: 0; }
  .st-sum { justify-content: flex-start; }
}
/* 補貨頁：清單的勾選、要叫、廠商欄，剛產生的採購單，該組裝的 */
.rp-list th, .rp-list td, .rp-plist th, .rp-plist td { padding: 8px 10px; }
.rp-list th:first-child, .rp-list td:first-child, .rp-plist th:first-child, .rp-plist td:first-child { padding-left: 20px; }
.rp-list th:last-child, .rp-list td:last-child, .rp-plist th:last-child, .rp-plist td:last-child { padding-right: 20px; }
.rp-list tbody tr, .rp-list tbody tr:hover, .rp-plist tbody tr, .rp-plist tbody tr:hover { background: none; cursor: default; }
.rp-list tr.is-on td { background: var(--brand-soft); }
.rp-list td.rp-c, .rp-list th.rp-c { width: 28px; padding-right: 0; }
.rp-list .ce-chk { vertical-align: middle; }
td.rp-code { color: var(--muted); font-variant-numeric: tabular-nums; }
.rp-name { font-weight: 600; }
.rp-q { width: 84px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.rp-qh { text-align: right; }
.rp-v { width: 176px; }
.rp-bar { margin-top: 20px; }
@media (max-width: 760px) {
  .rp-tools .ce-sel { flex: 1 1 100%; }
  .rp-tools .spacer { display: none; }
  .rp-tools .btn { flex: 1; }
  .rp-list tr.is-on { background: var(--brand-soft); }
  .rp-list tr.is-on td { background: none; }
}
.rp-done { margin-bottom: 16px; padding: 14px 20px; border-color: var(--brand); }
.rp-dh { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rp-dh h2 { margin: 0; font-size: 16px; }
.rp-dh h2:focus { outline: none; }
.rp-done ol { margin: 8px 0; padding-left: 22px; }
.rp-done li { padding: 2px 0; }
.rp-done li span { display: inline-block; min-width: 140px; }
.rp-done a { color: var(--brand); }
.rp-done p { margin: 0; }
.rp-packs { margin-top: 16px; }
.rp-ph { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.rp-ph h2 { margin: 0; font-size: 16px; }
.rp-pw { overflow-x: auto; }
.rp-plist td.rp-pa { text-align: right; }
.rp-asm { padding: 5px 12px; white-space: nowrap; }
@media (max-width: 760px) {
  .rp-list tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; padding: 10px 14px; }
  .rp-list td, .rp-list td:first-child, .rp-list td:last-child { padding: 0; }
  .rp-list td.rp-c { width: auto; }
  .rp-list td.rp-code { display: none; }
  .rp-list td.rp-name { flex: 1 1 calc(100% - 44px); font-size: 15px; }
  .rp-list td.rp-n { font-size: 13px; font-weight: 400; color: var(--muted); }
  .rp-list td[data-label]::before { content: attr(data-label) ' '; font-size: 12px; color: var(--muted); }
  .rp-list td.rp-qc { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
  .rp-list td.rp-u { margin-top: 4px; }
  .rp-list td.rp-vc { display: flex; align-items: center; gap: 6px; flex: 1 1 100%; margin-top: 4px; }
  .rp-v { flex: 1; width: auto; }
  .rp-q { width: 96px; }
  .rp-done { padding: 12px 14px; }
  .rp-ph { padding: 12px 14px; }
  .rp-plist tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; padding: 10px 14px; }
  .rp-plist td, .rp-plist td:first-child, .rp-plist td:last-child { padding: 0; }
  .rp-plist td.rp-code { display: none; }
  .rp-plist td.rp-name { flex: 1 1 100%; }
  .rp-plist td.num { font-size: 13px; font-weight: 400; color: var(--muted); }
  .rp-plist td[data-label]::before { content: attr(data-label) ' '; font-size: 12px; }
  .rp-plist td.rp-pa { flex: 1 1 100%; margin-top: 6px; text-align: left; }
}

/* 可以打字找的挑單視窗（銷貨退回單）：框固定在上面，只有選項捲動 */
.po-search { width: 100%; margin-top: 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; font: inherit; color: var(--text); background: var(--field-bg); }
.po-search ~ .po-picks { max-height: min(46vh, 340px); overflow-y: auto; padding-right: 2px; }
@media (max-width: 760px) { .po-form .qt-lines td.qt-shp::before { content: '已進 '; } }

/* 進貨單的已退、進貨退出單的「全部退」 */
@media (max-width: 760px) { .rc-form .qt-lines td.qt-shp::before, .sl-returned .qt-lines td.qt-shp::before { content: '已退 '; } }
.pr-allbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 10px; }

/* 報價單單張列印（A4 直向，給客人看）：上方公司資料與標題、客戶與單據資料兩欄、商品表、右下合計、備註、客戶確認欄 */
.qt-ph { margin-bottom: 4mm; text-align: center; }
.qt-pco { font-size: 16pt; font-weight: 700; }
.qt-pcl { font-size: 9.5pt; color: #333; }
.qt-ptitle { margin-top: 3mm; font-size: 18pt; font-weight: 700; letter-spacing: .6em; text-indent: .6em; text-decoration: underline; text-underline-offset: 2mm; }
.qt-pinfo { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10mm; margin: 2mm 0 5mm; font-size: 10.5pt; }
.qt-pinfo > div { display: grid; gap: 2mm; align-content: start; }
.qt-psum { display: grid; gap: 1.5mm; width: 72mm; margin: 4mm 0 0 auto; font-size: 10.5pt; }
.qt-psum > div { display: flex; justify-content: space-between; gap: 6mm; }
.qt-psum .qt-ptot { padding-top: 1.5mm; border-top: 1px solid #000; font-size: 12pt; }
.qt-psum .qt-ptot b { font-weight: 700; }
.qt-psum .qt-pin { justify-content: flex-end; color: #333; font-size: 9.5pt; }
.qt-psum b { font-weight: 400; font-variant-numeric: tabular-nums; }
.qt-pnote { margin-top: 6mm; font-size: 10pt; }
.qt-pnote span { color: #444; }
.qt-pnote p { margin: 1mm 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* AI 助理（Jesse 2026-10-30）：頂端列左上角的按鈕、右側 380px 的對話欄（開著時整頁往左推）、語音模式、手機上收成一條 */
.ai-spark { color: var(--brand); }
.ai-btn { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border: 1px solid var(--brand); border-radius: 999px;
  background: var(--card); color: var(--brand); font: inherit; font-weight: 700; cursor: pointer; }
.ai-btn:hover { background: var(--brand-soft); }
.ai-btn[aria-expanded="true"] { background: var(--brand); color: var(--on-brand); }
.ai-btn[aria-expanded="true"] .ai-spark { color: var(--on-brand); }
.ai-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ai-btn-m { display: none; }
/* 頂端列的「還原示範資料」：高度跟 AI 助理一樣，手機上字縮短才放得下 */
.top-reset { flex: none; height: 38px; padding: 0 14px; white-space: nowrap; }
.tr-short { display: none; }
.topbar.rc-tight .tr-long { display: none; }
.topbar.rc-tight .tr-short { display: inline; }
/* 頂端列的「最近」（Jesse 2026-11-05）：最近看過的三格（2026-11-11 從五格改），放不下時收成小選單；反白不加粗，字變寬格子會動 */
.rc { flex: 1 1 0; min-width: 0; display: flex; align-items: center; overflow: hidden; }
.rc-row { flex: none; display: flex; align-items: center; gap: 6px; }
.rc-chip { display: flex; flex-direction: column; justify-content: center; min-width: 56px; height: 44px; padding: 0 12px; border-radius: 8px; color: var(--text); font-size: 14px; line-height: 1.25; text-decoration: none; white-space: nowrap; }
.rc-chip small { color: var(--muted); font-size: 11px; }
.rc-chip:hover { background: var(--bg); }
.rc-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.rc-chip[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.rc-chip[aria-current="page"] small { color: var(--brand); }
body.is-opening .rc-chip.rc-lock { opacity: .45; }
.rc-more { display: none; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); font: inherit; font-size: 13px; white-space: nowrap; cursor: pointer; }
.rc-more:hover { background: var(--bg); }
.rc-more:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.rc.rc-fold { flex: none; overflow: visible; }
.rc.rc-fold .rc-row { display: none; }
.rc.rc-fold .rc-more { display: block; }
.ce-menu button.rc-on { background: var(--brand-soft); color: var(--brand); }
.ce-menu button.rc-lock { opacity: .45; }
@media (max-width: 760px) { .rc { display: none; } }
.ai-col { position: fixed; top: 0; right: 0; bottom: 0; z-index: 55; width: 380px; display: flex; flex-direction: column;
  border-left: 1px solid var(--line); background: var(--card); box-shadow: -8px 0 24px var(--shadow);
  transform: translateX(100%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s; }
body.ai-open .ai-col { transform: none; visibility: visible; transition: transform .22s ease; }
.main { transition: margin-left .22s ease, margin-right .22s ease; }
body.ai-open .main { margin-right: 380px; }
body.ai-open .cu-drawer { right: 380px; }
body.ai-open .toast { right: 400px; }
.ai-head { flex: none; display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 12px 0 18px; border-bottom: 1px solid var(--line); }
.ai-title { flex: 1; margin: 0; font-size: 16px; font-weight: 700; }
.ai-x { width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.ai-x:hover { background: var(--brand-soft); }
.ai-x:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.ai-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }
.ai-foot { flex: none; padding: 10px 14px 14px; border-top: 1px solid var(--line); }
.ai-box { position: relative; display: flex; align-items: center; }
.ai-in { flex: 1; min-width: 0; padding: 9px 44px 9px 14px; border: 1px solid var(--line); border-radius: 9px; font: inherit; color: var(--text); background: var(--field-bg); }
.ai-in:disabled { background: var(--bg); color: var(--muted); }
.ai-mic { position: absolute; right: 5px; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; cursor: pointer; font-size: 16px; }
.ai-mic:hover { background: var(--brand-soft); }
.ai-mic:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.ai-mic.on { background: var(--danger); animation: ai-pulse 1.2s ease-in-out infinite; }
@keyframes ai-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(176,58,46,.45); } 50% { box-shadow: 0 0 0 7px rgba(176,58,46,0); } }
.ai-status { margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.ai-status::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--muted); vertical-align: 1px; }
.ai-st-listen { color: var(--danger); }
.ai-st-listen::before { background: var(--danger); animation: ai-blink 1s ease-in-out infinite; }
.ai-st-speak { color: var(--brand); }
.ai-st-speak::before { background: var(--brand); }
@keyframes ai-blink { 50% { opacity: .25; } }
/* 對話泡泡 */
.ai-log { display: flex; flex-direction: column; gap: 10px; }
.ai-msg { max-width: 88%; padding: 9px 13px; border-radius: 12px; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.ai-msg.me { align-self: flex-end; background: var(--brand); color: var(--on-brand); border-bottom-right-radius: 4px; }
.ai-msg.me.ai-live { opacity: .7; }
.ai-msg.bot { align-self: flex-start; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.ai-msg.done, .ai-msg.ai-cfm { border-color: var(--brand); }
.ai-ok { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 6px; border-radius: 50%; background: var(--brand); color: var(--on-brand); font-size: 11px; vertical-align: 1px; flex: none; }
.ai-msg p { margin: 6px 0 0; }
.ai-note { color: var(--muted); font-size: 12px; }
.ai-warn { color: var(--warn); font-weight: 600; }
.ai-tbl { width: auto; min-width: 200px; margin-top: 6px; border-collapse: collapse; }
.ai-tbl td { padding: 3px 10px 3px 0; border: 0; white-space: nowrap; }
.ai-tbl .ai-sum td { border-top: 1px solid var(--line); font-weight: 700; }
.ai-tbl tr:hover { background: none; cursor: default; }
.ai-docs { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
/* 一張單兩行：單號、金額、狀態／日期、客戶（欄寬 380 一行放不下客戶名稱） */
.ai-doc { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.ai-doc:hover { border-color: var(--brand); background: var(--brand-soft); }
.ai-doc:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.ai-doc b { font-variant-numeric: tabular-nums; }
.ai-doc-d { order: 5; flex-basis: 100%; min-width: 0; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-doc-a { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.ai-doc .tag { padding: 1px 7px; font-size: 11px; }
.ai-diff { margin-top: 4px; }
.ai-cfm-b { display: flex; gap: 8px; margin-top: 10px; }
.ai-cfm-b .btn { padding: 6px 16px; }
.ai-cfm-r { color: var(--muted); font-size: 12px; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ai-chip { padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.ai-chip:hover { border-color: var(--brand); background: var(--brand-soft); }
.ai-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.ai-chip.ai-all { margin-top: 8px; color: var(--brand); font-weight: 600; }
.ai-welcome p { margin: 0 0 4px; font-size: 14px; }
.ai-dots { display: flex; gap: 4px; padding: 13px 14px; }
.ai-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: ai-dot 1s infinite ease-in-out; }
.ai-dots i:nth-child(2) { animation-delay: .15s; }
.ai-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
/* 手機上 AI 動到頁面後收成的一條（只有手機有） */
.ai-strip { display: none; }
@media (prefers-reduced-motion: reduce) {
  .ai-col, .main { transition: none !important; }
  .ai-mic.on, .ai-dots i, .ai-st-listen::before { animation: none; }
}
@media (max-width: 760px) {
  .ai-btn { height: 36px; padding: 0 12px; }
  .ai-btn-t { display: none; }
  .ai-btn-m { display: inline; }
  .top-reset { height: 36px; padding: 0 12px; }
  .tr-long { display: none; }
  .tr-short { display: inline; }
  .ai-col { top: 60px; width: 100%; border-left: 0; }
  body.ai-open .main { margin-right: 0; }
  body.ai-open .cu-drawer { right: 0; }
  body.ai-open .toast { right: 14px; }
  .ai-head { height: 52px; }
  .ai-in { font-size: 16px; }
  .ai-msg { font-size: 15px; }
  /* app.css 在手機上把所有表格拆成直排卡片，對話裡的小表格要換回表格 */
  .ai-tbl { display: table; }
  .ai-tbl tbody { display: table-row-group; }
  .ai-tbl tr { display: table-row; padding: 0; border: 0; }
  .ai-tbl td { display: table-cell; padding: 3px 10px 3px 0; }
  .ai-tbl td.num { text-align: right; font-size: inherit; }
  body.ai-mini .ai-col { visibility: hidden; transform: translateX(100%); }
  body.ai-mini .ai-strip { position: fixed; top: 60px; left: 0; right: 0; z-index: 55; display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px;
    border: 0; border-bottom: 1px solid var(--brand); background: var(--card); box-shadow: 0 4px 12px var(--shadow); color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
  .ai-strip-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ai-strip-o { flex: none; color: var(--brand); font-weight: 600; }
}

/* 收款單（pages/receipts.js）：單頭的這次收到、多收橘字；單身是這家還沒收的單，可以勾、打折讓、打這次沖 */
.rcp-amtbox { font-weight: 700; text-align: right; }
.rcp-over { display: block; margin-top: 4px; color: var(--warn); font-size: 13px; font-weight: 700; }
.rcp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 8px; }
.rcp-bar .rcp-all, .rcp-bar .rcp-due { margin-left: auto; }
.rcp-bar .rcp-due + .rcp-all { margin-left: 0; }
table.rcp-lines { width: 100%; }
.rcp-lines th { white-space: nowrap; }
.rcp-lines td { vertical-align: middle; white-space: nowrap; }
.rcp-lines tr.is-on td { background: var(--brand-soft); }
.rcp-lines tbody tr.is-on:hover td { background: var(--brand-soft); }
.rcp-lines th.rcp-ct, .rcp-lines td.rcp-ct { width: 1%; padding-right: 4px; }
.rcp-lines td.rcp-cdoc a { color: var(--brand); }
.rcp-lines td.rcp-cdc input { width: 76px; text-align: right; }
.rcp-lines td.rcp-cam input { width: 96px; text-align: right; }
.rcp-lines td.rcp-cam, .rcp-lines th.rcp-ham, .rcp-lines td.rcp-cdc, .rcp-lines th.rcp-hdc { text-align: right; }
.rcp-neg { display: inline-block; padding-right: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rcp-lines td.rcp-cleft .link-btn { margin-left: 6px; font-size: 13px; }
.rcp-sum { margin-top: 10px; }
.rcp-sum .rcp-oversum { color: var(--warn); font-weight: 700; }
@media (max-width: 760px) {
  /* 手機上一張單一塊：勾選＋單據一行，日期、該收日、還沒收一行，折讓、這次沖一行 */
  table.rcp-lines, .rcp-lines tbody { display: block; }
  .rcp-lines thead { display: none; }
  .rcp-lines tr { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 6px 8px; padding: 10px 6px; border-bottom: 1px solid var(--line); }
  .rcp-lines tr.is-on { background: var(--brand-soft); }
  .rcp-lines td { display: block; padding: 0; border-bottom: 0; background: none !important; white-space: normal; }
  .rcp-lines td.rcp-ct { width: auto; }
  .rcp-lines td.rcp-cdoc { grid-column: 2 / -1; font-weight: 600; }
  .rcp-lines td.rcp-cd, .rcp-lines td.rcp-cdue, .rcp-lines td.rcp-crem, .rcp-lines td.rcp-cleft { grid-column: span 3; display: flex; justify-content: space-between; gap: 8px; text-align: right; font-size: 14px; }
  .rcp-lines td[data-label]::before { content: attr(data-label); margin-right: auto; color: var(--muted); font-size: 12px; font-weight: 400; }
  .rcp-lines td.rcp-cdc, .rcp-lines td.rcp-cam { grid-column: span 3; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .rcp-lines td.rcp-cdc:empty { display: none; }
  .rcp-lines td.rcp-cdc input, .rcp-lines td.rcp-cam input { width: 130px; }
  .rcp-neg { padding-right: 0; }
  .rcp-bar .rcp-all, .rcp-bar .rcp-due { margin-left: 0; }
}

/* 存提轉帳單（pages/fund-moves.js）：轉出、轉入帳戶下面一行說明這張是存款、提款還是轉帳 */
.as-head .fm-dir { margin: 0; color: var(--brand); font-weight: 600; }
.as-list td.fm-kind, .as-list td.fm-acc { white-space: nowrap; }
/* 一格放不下「郵局舊帳戶（停用中）」（1366 差 7px），帳戶下拉各占兩格 */
.as-head .fm-accf { grid-column: span 2; }
@media (max-width: 760px) {
  .fm-list td.fm-acc::before { content: attr(data-label) '　'; color: var(--muted); font-size: 13px; }
  /* 手機上各占一行 */
  .as-head .fm-accf { grid-column: 1 / -1; }
}

/* 資金異動單（pages/fund-changes.js）：金額旁標增加或減少；清單增加、減少分兩欄，手機卡片只留有金額的那一欄 */
.fc-amt { display: flex; align-items: center; gap: 8px; }
.fc-amt input { flex: 1; min-width: 0; }
.fc-amt .fc-dir { flex: none; white-space: nowrap; }
.as-list td.fc-nw { white-space: nowrap; }
/* 一格放不下「郵局舊帳戶（停用中）」「繳信用卡費（停用中）」，帳戶、項目下拉各占兩格（照存提轉帳單） */
.as-head .fc-pick { grid-column: span 2; }
@media (max-width: 760px) {
  .as-head .fc-pick { grid-column: 1 / -1; }
  .fc-list td.fc-money::before { content: attr(data-label) '　'; color: var(--muted); font-size: 13px; font-weight: 400; }
  .fc-list td.fc-money:empty { display: none; }
}

/* 刷卡入帳單（pages/card-deposits.js）：待入帳清單勾選，底部是刷卡金額、手續費、入帳金額 */
.cdp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 8px; }
.cdp-bar .cdp-all { margin-left: auto; }
.as-list td.cdp-nw { white-space: nowrap; }
table.cdp-lines { width: 100%; }
.cdp-lines th { white-space: nowrap; }
.cdp-lines td { vertical-align: middle; white-space: nowrap; }
.cdp-lines tr.is-on td, .cdp-lines tbody tr.is-on:hover td { background: var(--brand-soft); }
.cdp-lines th.cdp-ct, .cdp-lines td.cdp-ct { width: 1%; padding-right: 4px; }
.cdp-lines td.cdp-cdoc a { color: var(--brand); }
.cdp-lines td.cdp-cparty { width: 100%; white-space: normal; }
.cdp-lines td.cdp-neg { color: var(--danger, #c0392b); }
.cdp-sum { margin-top: 10px; }
.cdp-sum .cdp-feerow { align-items: center; }
.cdp-sum .cdp-feerow input { width: 96px; text-align: right; }
.cdp-feehint { display: block; text-align: right; }
.cdp-warn { margin: 8px 0 0; color: var(--warn); font-size: 13px; font-weight: 700; text-align: right; }
@media (max-width: 760px) {
  /* 清單手機上藏了手續費，兩個金額要標明哪個是哪個 */
  .cdp-list td.cdp-amt::before { content: attr(data-label) '　'; color: var(--muted); font-size: 13px; font-weight: 400; }
  /* 手機上一筆一塊：勾選＋單據一行，其他欄一欄一行 */
  table.cdp-lines, .cdp-lines tbody { display: block; }
  .cdp-lines thead { display: none; }
  .cdp-lines tr { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 8px; padding: 10px 6px; border-bottom: 1px solid var(--line); }
  .cdp-lines tr.is-on { background: var(--brand-soft); }
  .cdp-lines td { display: block; width: auto !important; padding: 0; border-bottom: 0; background: none !important; white-space: normal; }
  .cdp-lines td.cdp-cdoc { font-weight: 600; }
  .cdp-lines td[data-label] { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 8px; text-align: right; font-size: 14px; }
  .cdp-lines td[data-label]:empty { display: none; }
  .cdp-lines td[data-label]::before { content: attr(data-label); margin-right: auto; color: var(--muted); font-size: 12px; font-weight: 400; }
  .cdp-bar .cdp-all { margin-left: 0; }
}

/* 其他收入單（pages/incomes.js）：單身是項目、金額、備註，多的寬度都給備註 */
table.ic-lines { width: 100%; }
.ic-lines td { vertical-align: top; }
.ic-lines th.ic-hi, .ic-lines td.ic-ci { width: 280px; min-width: 280px; }
.ic-lines th.ic-ha, .ic-lines td.ic-ca { width: 130px; min-width: 130px; text-align: right; }
.ic-lines th.ic-hn, .ic-lines td.ic-cn { width: 100%; }
.ic-lines td.ic-ci input, .ic-lines td.ic-ca input, .ic-lines td.ic-cn input { width: 100%; }
.ic-lines td.ic-cn input { min-width: 120px; }
.ic-lines td.ic-ca input { text-align: right; }
.ic-plhint { display: block; margin-top: 2px; }
.as-list td.ic-it, .as-list td.ic-inv { white-space: nowrap; }
.ic-new { display: grid; gap: 12px; }
.ic-pls { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.ic-pls legend { padding: 0; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.ic-new .cf-field input { width: 100%; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; font: inherit; color: var(--text); background: var(--field-bg); }
.ic-pls label { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; cursor: pointer; }
.ic-pls input { margin-top: 4px; flex: none; }
.ic-new p.ic-newerr { margin: 0; color: var(--danger); font-size: 14px; }
@media (max-width: 760px) {
  .ic-new .cf-field input { font-size: 16px; }
  /* 手機上一列一塊：項目一行，金額和 🗑 一行，備註一行 */
  table.ic-lines, .ic-lines tbody { display: block; }
  .ic-lines thead { display: none; }
  .ic-lines tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .ic-lines td { display: block; padding: 0; }
  .ic-lines td.as-seq { display: none; }
  .ic-lines td.ic-ci, .ic-lines td.ic-cn { grid-column: 1 / -1; width: auto; min-width: 0; }
  .ic-lines td.ic-ca { width: auto; min-width: 0; }
  .ic-lines td.ic-cn { grid-row: 3; }
  .ic-lines td.ic-cd { grid-column: 2; grid-row: 2; align-self: center; }
}

/* 初始盤點：鎖定時的外框與各步驟 */
.lock-bar { padding: 8px 28px; background: var(--warn-bg); color: var(--warn); font-size: 14px; font-weight: 600; border-bottom: 1px solid var(--line); }
.lock-bar[hidden], body.is-bare .lock-bar { display: none; }
.lock-bar a { margin-left: 8px; color: inherit; text-decoration: underline; }
body.is-opening .grp[data-lock] { opacity: .45; }
.op-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.op-nav .op-off { display: block; padding: 7px 10px; font-size: 14px; color: var(--muted); opacity: .6; white-space: nowrap; }
.op-ok { font-weight: 700; }
.op-h { margin: 0 0 6px; font-size: 18px; }
.op-intro { margin: 0 0 14px; max-width: 760px; font-size: 13px; line-height: 1.6; }
.op-sum { margin: 12px 4px 0; font-size: 14px; font-weight: 600; }
.op-foot { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.op-foot .spacer { flex: 1; }
.op-foot a.btn { color: var(--text); text-decoration: none; }
.op-review a { color: var(--brand); }
.op-n { text-align: right; }
.op-finish { display: flex; justify-content: flex-end; margin-top: 16px; }
.op-again { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }
.op-again p { margin: 0 0 10px; }
.op-warn { margin-bottom: 14px; }
.op-card { padding: 20px 24px; max-width: 760px; font-size: 14px; line-height: 1.7; }
.op-card > p { margin: 0 0 12px; }
.op-list { margin: 0 0 12px; padding-left: 22px; }
.op-q { display: flex; align-items: center; gap: 6px; min-width: 0; }
.op-q .ce-in { flex: 1; }
.op-q .op-unit { flex: none; }
.op-start { width: min(520px, calc(100vw - 32px)); }
.op-start .btn.danger:disabled { opacity: .45; cursor: not-allowed; }
.op-start .cf-field { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.op-start .cf-field input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--text); background: var(--field-bg); }
.op-grid tr.op-flash td { background: var(--brand-soft, var(--bg)); }
@media (min-width: 761px) {
  .op-grid .ce-in, .op-grid .ce-sel { border-color: transparent; background: transparent; }
  .op-grid tr:hover .ce-in, .op-grid tr:hover .ce-sel, .op-grid .ce-in:focus, .op-grid .ce-sel:focus { border-color: var(--line); background: var(--field-bg); }
  .op-grid .ce-in[aria-invalid="true"] { border-color: #c0392b; }
  .op-grid .ce-in:disabled { color: var(--muted); cursor: not-allowed; }
  /* 輸入框的內距抵掉，平常字才跟欄名對齊 */
  .op-grid td.ce-s .ce-in:not(.op-n) { width: calc(100% + 9px); margin-left: -9px; }
  .op-grid td.ce-s .ce-sel { width: calc(100% + 7px); margin-left: -7px; }
  .op-grid td.ce-s .ce-in.op-n:not(.op-q .op-n) { width: calc(100% + 9px); margin-right: -9px; }
}
@media (max-width: 760px) {
  .lock-bar { padding: 8px 14px; }
  .op-card { padding: 16px; }
  .op-foot .btn, .op-finish .btn { flex: 1; text-align: center; }
  .op-grid td[data-label]::before { width: 72px; }
}
@media print { .lock-bar { display: none; } }

/* 首頁：一句一句的白話，區塊顏色跟著 data-hg（pages/home.js） */
:root { --hp-violet: #6b4bb8; --hp-violet-bg: #efeafa; }
:root[data-theme="dark"] { --hp-violet: #b7a2ff; --hp-violet-bg: #2a2340; }
[data-hg="sell"] { --hg: var(--info); --hgs: var(--info-bg); }
[data-hg="buy"] { --hg: var(--warn); --hgs: var(--warn-bg); }
[data-hg="stock"] { --hg: var(--brand); --hgs: var(--brand-soft); }
[data-hg="cash"] { --hg: var(--ok); --hgs: var(--ok-bg); }
[data-hg="report"] { --hg: var(--hp-violet); --hgs: var(--hp-violet-bg); }
[data-hg="data"] { --hg: var(--muted); --hgs: var(--th-bg); }
.hp { max-width: 1240px; margin: 0 auto; }
.hp-h1 { margin: 0; font-size: 26px; }
.hp-h1:focus { outline: none; }
.hp-lead { margin: 4px 0 18px; font-size: 14px; color: var(--muted); }
.hp-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 44px; align-items: start; }
/* 首頁四個 .hp-col：三欄時第四欄（想查什麼）接在第三欄底下；.hp-wrap 夠寬時四欄並排、內容寬度放到 1640 */
.hp-wrap { container: hp / inline-size; }
.hp-col:nth-child(1) { grid-column: 1; grid-row: 1 / span 2; }
.hp-col:nth-child(2) { grid-column: 2; grid-row: 1 / span 2; }
.hp-col:nth-child(3) { grid-column: 3; grid-row: 1; }
.hp-col:nth-child(4) { grid-column: 3; grid-row: 2; }
@container hp (min-width: 1490px) {
  .hp { max-width: 1640px; }
  .hp-cols { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hp-col:nth-child(n) { grid-column: auto; grid-row: auto; }
}
.hp-b { margin-bottom: 20px; }
.hp-b h2 { margin: 0 0 4px; padding-bottom: 6px; border-bottom: 2px solid var(--hg); font-size: 13px; letter-spacing: .08em; color: var(--hg); }
.hp-r { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 8px; border-bottom: 1px solid var(--line); border-radius: 6px; color: inherit; text-decoration: none; }
.hp-r:hover { background: var(--hgs); }
.hp-r:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.hp-ic { display: block; flex: none; color: var(--hg); opacity: .8; }
.hp-r:hover .hp-ic { opacity: 1; }
.hp-s { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; color: var(--text); line-height: 1.35; }
.hp-k { flex: none; font-size: 12px; color: var(--muted); }
body.is-opening .hp-lock { opacity: .45; }
@media (max-width: 1000px) {
  .hp-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
  .hp-col:nth-child(1), .hp-col:nth-child(2) { grid-row: 1; }
  .hp-col:nth-child(3) { grid-column: 1 / -1; grid-row: 2; }
  .hp-col:nth-child(4) { grid-column: 1 / -1; grid-row: 3; }
}
@media (max-width: 760px) {
  .hp-cols { grid-template-columns: minmax(0, 1fr); }
  .hp-col:nth-child(n) { grid-column: auto; grid-row: auto; }
  .hp-h1 { font-size: 22px; }
  .hp-r { min-height: 48px; }
}

/* 單據清單上方的 Tab（doc-page.js 的 cfg.detail）：報價單｜明細查詢 */
.as-tabs { display: flex; gap: 4px; margin: -8px 0 14px; border-bottom: 1px solid var(--line); }
.as-tab { padding: 8px 16px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.as-tab:hover { color: var(--text); }
.as-tab[aria-current] { border-bottom-color: var(--brand); color: var(--brand-dark); }
.as-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: 6px 6px 0 0; }
.as-tabs + .as-intro { margin-top: 0; }
/* 公司資料、設定項目的 Tab：設定項目有 8 個，選單釘住又開 AI 助理時一排放不下，所以什麼寬度都能折行 */
.set-tabs { flex-wrap: wrap; }
/* 各頁第一行的說明小字原本用負的上邊距貼近標題，放在 Tab 下面要拿掉（同 .as-tabs + .as-intro） */
.set-tabs + .set-content > .cf-hint:first-child, .set-subtabs + .set-content > .cf-hint:first-child { margin-top: 0; }
/* 收支項目、資金異動項目、庫存調整原因的第二排 Tab（收入｜支出、增加｜減少，Jesse 2026-11-12）：樣子跟第一排一樣，貼在第一排下面 */
.set-tabs + .set-subtabs { margin-top: 0; }
.as-tabs + .ct-body > .ce-intro:first-child { margin-top: 0; }   /* 通訊錄：Tab 下面是 cell-list 的說明小字 */
/* 明細查詢：手機才用的兩格（對象與日期、數量 × 單價）電腦版藏起來 */
.dt-list td.dt-m { display: none; }
.dt-ml { display: none; }   /* 訂單明細：手機上第一行的「未交」兩字，電腦版有欄名 */
.dt-list .tag { margin-right: 4px; }
/* 欄多：格子內距比其他單據清單窄，1366 釘住選單時才不用左右捲；備註最多 140px，太長截斷、滑鼠停著看全文 */
.dt-list th, .dt-list td { padding-left: 8px; padding-right: 8px; }
.dt-list th:first-child, .dt-list td:first-child { padding-left: 12px; }
.as-list.dt-list td.as-note { max-width: 140px; }
/* 備註讀單頭的明細（銷貨退回明細的退貨原因）：每列都有字，140px 時 1366 釘住選單會多 28px，所以縮到 110px */
.as-list.dt-list.dt-hnote td.as-note { max-width: 110px; }
/* 調撥、庫存調整明細沒有金額欄、位置夠，單頭備註放到 220px（調撥明細 1366 釘住選單實測 360px 才要左右捲） */
.as-list.dt-list.tf-dlist td.as-note, .as-list.dt-list.aj-dlist td.as-note { max-width: 220px; }
/* 盤點明細有 12 欄（多一欄成本盈虧），備註是單身那句、多半空白，放到 170px：1349 釘住選單時 190px 就要左右捲 1px（實測見 docs/decisions/stocktake.md「成本盈虧」） */
.as-list.dt-list.st-dlist td.as-note { max-width: 170px; }
/* 組裝、拆裝明細也沒有金額欄，備註放到 180px（拆裝明細在 1349 釘住選單時 220px 就要左右捲 14px） */
.as-list.dt-list.kd-dlist td.as-note { max-width: 180px; }
/* 其他收入明細：備註是每列自己的，欄位少，放到 220px（實測見 docs/decisions/incomes.md「明細查詢」） */
.as-list.dt-list.ic-dlist td.as-note { max-width: 220px; }
.dt-sum { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 24px; padding: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.dt-sum b { margin-left: 4px; color: var(--text); }
/* 合計那排左邊的註解（銷貨、進貨明細的「金額沒有扣掉退貨」） */
.dt-sum .dt-sumnote { margin-right: auto; font-size: 13px; }
.dt-list + .dt-sum { border-top: 0; }
/* 合計分組時（其他收入明細：合計｜列入損益｜應稅無稅），組跟組之間一條細線；手機上一組一行 */
.dt-sum .dt-sumg { display: flex; flex-wrap: wrap; gap: 6px 24px; }
.dt-sum .dt-sumg + .dt-sumg { padding-left: 24px; border-left: 1px solid var(--line); }
/* 收款明細查詢、實收明細表：負的金額（退貨抵掉的、扣掉之前多收的、退款）紅字 */
.dt-list td.dt-neg, .dt-sum b.dt-neg { color: var(--danger); }
@media (max-width: 760px) {
  /* 每列三行：品名與金額、對象與日期、數量 × 單價（Jesse 2026-11-05 選） */
  .dt-list tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
  .dt-list td { display: none; }
  .dt-list td.dt-name, .dt-list td.dt-amt, .dt-list td.dt-m { display: block; padding: 0; border-bottom: 0; }
  .dt-list td.dt-name { font-weight: 600; white-space: normal; }
  .dt-list td.dt-amt { font-size: 15px; }
  .dt-ml { display: inline; color: var(--muted); font-size: 13px; font-weight: 400; }
  .dt-list td.dt-m { grid-column: 1 / -1; color: var(--muted); font-size: 13px; white-space: normal; }
  .dt-sum { justify-content: flex-start; padding: 12px 14px; }
  .dt-sum .dt-sumnote { flex-basis: 100%; }
  .dt-sum .dt-sumg { flex-basis: 100%; }
  .dt-sum .dt-sumg + .dt-sumg { padding-left: 0; border-left: 0; }
}

/* 庫存 → 現有庫存（pages/stock-now.js）：只能看的清單，總庫存、分倉明細、各倉並列三個 Tab 共用（成本計算 Tab 的樣式在下面的 .cs-list）；各倉並列 0 的格子空白，手機上倉庫欄改成名稱下面一行小字 */
.sn-list tbody tr { cursor: default; }
.sn-list th, .sn-list td { padding: 12px; }
.sn-list td.sn-code { color: var(--muted); font-variant-numeric: tabular-nums; }
.sn-list td.sn-safe { color: var(--muted); font-weight: 400; }
.sn-list td.sn-mwh { display: none; }
/* 單位成本不加粗（粗字留給庫存量、庫存金額）；底部合計的左右留白跟格子一樣，數字才會對齊庫存金額那一欄 */
.sn-list td.sn-cost { font-weight: 400; }
/* 總庫存、分倉明細多了兩欄：品名很長時在格子裡換行，不把表格撐到要左右捲（實測 35 字的品名，1366 釘住選單時超出 116～141px） */
.sn-list:not(.sn-grid) td.sn-name { min-width: 140px; white-space: normal; }
.sn-total .dt-sum { padding: 12px; }
.sn-whf .ce-sel { width: auto; max-width: 160px; padding: 6px 8px; }
.ce-toolbar .sn-sort { width: auto; flex: 0 0 auto; padding: 6px 8px; }
@media (max-width: 760px) {
  /* 四個 Tab 各四個字，390 寬照預設的左右留白會超出 3px，縮一點才放得下一排 */
  .sn-tabs .as-tab { padding: 8px 12px; }
  .sn-list td { padding: 2px 0; }
  .sn-list td.cu-m { display: none; }
  .sn-list td.num { display: flex; align-items: baseline; gap: 10px; font-size: 16px; }
  .sn-list td.sn-cost, .sn-list td.sn-val { font-size: 14px; }
  .sn-total .dt-sum { padding: 12px 14px; }
  .sn-list td.num::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 400; }
  .sn-list td.num.cu-m { display: none; }
  .sn-list td.sn-whc { display: flex; align-items: baseline; gap: 10px; }
  .sn-list td.sn-whc::before { content: attr(data-label); color: var(--muted); font-size: 12px; }
  /* 倉庫下拉跟「顯示庫存為 0」擠同一行（.lf-f 在手機上預設占滿一行），列印、匯出才不會掉到第四行 */
  .sn-whf { flex: 0 1 auto; }
  .sn-whf .lf-l { width: auto; }
  .sn-grid tbody tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
  .sn-grid td.sn-wh { display: none; }
  .sn-grid td.sn-name { flex: 1 1 0; min-width: 0; }
  .sn-grid td.sn-sum { flex: none; }
  .sn-grid td.sn-mwh { display: block; flex: 1 1 100%; font-size: 13px; color: var(--muted); }
  .sn-grid td.ce-empty { flex: 1 1 100%; }
}

/* 進銷存報表的分析表（analysis-report.js：銷售分析表、進貨分析表）：上方 Tab；只有銷售分析表的「每一張單」點得開，其他列不是單據、滑鼠不變手指 */
.sa-list.sa-static tbody tr { cursor: default; }
/* 客戶名、品名太長時在格子裡換行，不把表格撐到要左右捲（實測 40 字的品名，1366 釘住選單時「每家買了什麼」超出 255px） */
.sa-list td.cu-name { min-width: 120px; max-width: 220px; white-space: normal; }
.sa-list td.dt-name:not(.cu-name) { min-width: 140px; max-width: 260px; white-space: normal; }
@media (max-width: 760px) {
  /* 六個 Tab 一排放不下，折成兩排 */
  .sa-tabs { flex-wrap: wrap; }
  .sa-gift, .sa-sort { flex: 1 1 140px; }
}

/* 報表的「圖表」對話框（chart-dialog.js，Jesse 2026-11-12 選的置中對話框）：左邊圖的種類、右邊大圖；手機滿版、種類改成上面一排 */
:root {
  --cd-0: var(--brand);
  --cd-1: color-mix(in srgb, var(--brand) 84%, var(--card));
  --cd-2: color-mix(in srgb, var(--brand) 70%, var(--card));
  --cd-3: color-mix(in srgb, var(--brand) 58%, var(--card));
  --cd-4: color-mix(in srgb, var(--brand) 47%, var(--card));
  --cd-5: color-mix(in srgb, var(--brand) 37%, var(--card));
  --cd-6: color-mix(in srgb, var(--brand) 28%, var(--card));
  --cd-7: color-mix(in srgb, var(--brand) 20%, var(--card));
  --cd-other: color-mix(in srgb, var(--muted) 22%, var(--card));
  --cd-track: var(--th-bg);
}
.cd-dlg { width: min(1100px, calc(100vw - 48px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 12px; background: var(--card); color: var(--text); box-shadow: 0 12px 40px var(--shadow); }
.cd-dlg::backdrop { background: rgba(0,0,0,.35); }
.cd-in { display: grid; grid-template-columns: 180px 1fr; grid-template-rows: auto 1fr auto; height: min(680px, calc(100vh - 48px)); }
.cd-head { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.cd-head h2 { margin: 0; font-size: 17px; }
.cd-x { margin-left: auto; width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 22px; cursor: pointer; }
.cd-x:hover { background: var(--brand-soft); color: var(--text); }
.cd-types { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-right: 1px solid var(--line); overflow-y: auto; }
.cd-types button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--brand); text-align: left; cursor: pointer; }
.cd-types button span { color: var(--text); font-size: 14px; }
.cd-types button:hover { background: var(--brand-soft); }
.cd-types button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.cd-types button[aria-pressed="true"] span { font-weight: 700; }
.cd-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 14px 20px; }
.cd-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.cd-bar h3 { margin: 0 auto 0 0; font-size: 15px; }
.cd-opt { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.cd-opt select { color: var(--text); }
.cd-sum { margin: 6px 0 10px; color: var(--muted); font-size: 13px; }
.cd-chart { flex: 1; min-height: 0; }
.cd-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
.cd-foot .cf-hint { margin-right: auto; }
.cd-svg { display: block; max-width: 100%; height: auto; overflow: visible; font-family: inherit; font-variant-numeric: tabular-nums; }
/* 滑過一項：它的感應區（第一個 rect）淡淡上色 */
.cd-svg .cd-item:hover > rect:first-of-type { fill: color-mix(in srgb, var(--brand) 6%, transparent) !important; }
.cd-svg .cd-item:hover > path { filter: brightness(1.06); }
.cd-empty { margin: 24px 0; color: var(--muted); text-align: center; }
@media (max-width: 760px) {
  .cd-dlg { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .cd-in { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr auto; height: 100dvh; }
  .cd-head { padding: 10px 14px; }
  .cd-types { flex-direction: row; padding: 8px 14px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .cd-types button { flex: none; flex-direction: column; gap: 2px; padding: 6px 8px; }
  .cd-types button span { font-size: 12px; white-space: nowrap; }
  .cd-main { padding: 12px 14px; overflow-y: auto; }
  .cd-foot { padding: 10px 14px; }
  .cd-foot .cf-hint { display: none; }
  .cd-foot .btn { flex: 1; }
}
/* 圖表的列印頁（一張 A4 橫向）：表頭同清單列印，灰階要印出底色 */
.pl-sheet .cd-pbody { display: flex; flex-direction: column; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pl-sheet .cd-ph { margin: 2mm 0 1mm; color: #000; font-size: 12pt; }
.pl-sheet .cd-ps { margin: 0 0 4mm; color: #333; font-size: 10pt; }
.pl-sheet .cd-pn { margin: auto 0 0; color: #555; font-size: 9pt; }

/* 庫存進出表（pages/stock-moves.js）：樣子照分析表，多存摺的期初、期末列與備註欄 */
.sm-list tr.sm-edge { cursor: default; }
.sm-list tr.sm-edge td { color: var(--muted); font-weight: 600; }
.sm-list tr.sm-edge td.dt-neg { color: var(--danger); }
/* 選了一樣商品時沒有品名欄，單號不用像品名那樣留寬度 */
.sm-list.sm-ledger td.dt-name { min-width: 0; white-space: nowrap; }
.sm-list td.sm-note { max-width: 240px; white-space: normal; }
@media (max-width: 760px) {
  /* 手機上右上角那個數字前面補一個字，才知道是期末還是進、出 */
  .sm-list:not(.sm-moves) td.dt-amt::before { content: '期末 '; color: var(--muted); font-size: 13px; }
  .sm-moves td.dt-amt.sm-in::before { content: '進 '; color: var(--muted); font-size: 13px; }
  .sm-moves td.dt-amt.sm-out::before { content: '出 '; color: var(--muted); font-size: 13px; }
  .sm-list.sm-ledger td.dt-name { white-space: normal; }
}

/* 現有庫存的「成本計算」Tab（pages/cost-sheet.js）：樣子照庫存進出表。「怎麼算的」是算式，留寬一點；太長就在這一格裡折行，不讓整張表左右捲 */
.cs-list td.cs-how { max-width: 400px; white-space: normal; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .cs-list td.dt-amt::before { content: '成本 '; color: var(--muted); font-size: 13px; }
}

/* 單據清單的「總金額（含稅）」：括號折到第二行小字，欄才不會變寬（trade-doc.js 的 totalTh，Jesse 2026-11-09 選） */
.th-sub { display: block; font-size: 12px; font-weight: 400; }
/* 第二行一律是全形括號包起來的字，「）」右半個字是空白，靠右的欄看起來會往左縮；往右推半個字才跟上一行、數字對齊（不用 "halt"：微軟正黑體不支援） */
.num > .th-sub { margin-right: -.5em; }

/* 買賣單據明細查詢：單價、金額後面的「含稅／未稅／無稅」小字（trade-doc.js 的 taxWord，Jesse 2026-11-09 選） */
.dt-taxw { margin-left: 4px; font-size: 12px; font-weight: 400; color: var(--muted); }

/* 應收帳款表、應付帳款表（dues-report.js）：樣子照實收明細表；每家那一列最後一格是 🖨（印這家的對帳單），最早該收（付）日過了紅字 */
.ar-asof { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.ar-list td.ar-late, .ar-dlist td.ar-late { color: var(--danger); }
.ar-list th.ar-pr, .ar-list td.ar-pr { width: 1%; text-align: center; }
.ar-list tr[data-cust] { cursor: pointer; }
@media (max-width: 760px) {
  /* 手機上 🖨 放在第二、三行的右邊，名稱與還欠照舊在第一行 */
  .ar-list td.dt-m { grid-column: 1; }
  .ar-list td.ar-pr { display: block; grid-column: 2; grid-row: 2 / span 2; align-self: center; width: auto; padding: 0; border-bottom: 0; }
}
/* 應收票據表、應付票據表（check-report.js）：已經過了到期日的列整列灰字 */
.ck-list tr.ck-past td { color: var(--muted); }

/* 支票退票（bounce.js，checks.md）：紅底白字「退票 10/20」；退票的列刪除線金額；單頭的退票鈕跟標籤排一行 */
.tag.bad { background: var(--danger); color: var(--on-danger); }
.ck-btag { white-space: nowrap; }
.dt-list .ck-btag, .cu-list .ck-btag { margin: 0 0 0 4px; padding: 1px 7px; font-size: 11px; vertical-align: 1px; }
.ck-list tr.ck-bounced td.dt-amt { color: var(--muted); text-decoration: line-through; }
.ck-bline { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 38px; }
.ck-bline .ck-btag { margin: 0; }
.btn.ck-bon { color: var(--danger); border-color: var(--danger); }
.btn.ck-bon:hover { background: var(--danger); color: var(--on-danger); }
.ck-bdlg .cf-field { margin-top: 10px; }
.ck-bdlg input { width: 100%; }
.op-grid td.ce-act .ck-bbtn { min-height: 32px; padding: 0 8px; font-size: 13px; white-space: nowrap; }
.op-grid .ce-body > .ck-btag { align-self: flex-start; margin: 2px 0 0; }

/* 首頁「要注意的事」（pages/home.js）：7 天內到期的支票，不夠扣的紅字；沒事就不出現 */
.hp-alerts { margin: 0 0 18px; padding: 10px 14px; border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: 10px; background: var(--card); }
.hp-alerts h2 { margin: 0 0 4px; font-size: 13px; letter-spacing: .08em; color: var(--warn); }
.hp-al { display: flex; align-items: baseline; gap: 8px; padding: 5px 4px; border-radius: 6px; color: var(--text); font-size: 15px; font-weight: 600; text-decoration: none; }
.hp-al:hover { background: var(--warn-bg); }
.hp-al:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.hp-al-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); transform: translateY(-1px); }
.hp-al.is-bad { color: var(--danger); }
.hp-al.is-bad .hp-al-dot { background: var(--danger); }

/* 現金與存款表（pages/funds.js）：存摺的期初、期末列沿用庫存進出表的 sm-edge；往後預估前兩列（今天的餘額、今天以前該收付的）是灰底的起點 */
.fd-list tr.fd-static, .fd-ahead tbody tr { cursor: default; }
.fd-ahead tr.fd-head td { background: var(--th-bg); font-weight: 600; }
.fd-list td.fd-what { min-width: 140px; max-width: 280px; white-space: normal; }
.fd-dlabel { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.fd-notes { margin: 0; padding: 0 20px 14px; }
@media (max-width: 760px) {
  .fd-list td.dt-amt.fd-in::before { content: '存入 '; color: var(--muted); font-size: 13px; }
  .fd-list td.dt-amt.fd-out::before { content: '支出 '; color: var(--muted); font-size: 13px; }
  .fd-ahead td.dt-amt::before { content: '預估 '; color: var(--muted); font-size: 13px; }
  .fd-notes { padding: 0 14px 12px; }
}

/* 損益表（pages/profit.js）：小計粗體、結餘上面一條線；一般列縮排 */
.pf-list tbody tr { cursor: default; }
/* 三欄撐滿整張卡片時金額離項目太遠，限制寬度；一般列的金額不加粗，小計才看得出層次 */
.pf-list { width: auto; min-width: min(100%, 680px); }
.pf-list td.dt-name { min-width: 320px; }
.pf-list tr.pf-item td.dt-amt { font-weight: 400; }
.pf-list tr.pf-item td.dt-name { padding-left: 32px; }
.pf-list tr.pf-sub td { font-weight: 600; }
.pf-list tr.pf-total td { font-weight: 700; border-top: 2px solid var(--line); }
.pf-list .pf-note { display: block; font-weight: 400; }
.pf-list td.pf-pct { color: var(--muted); font-weight: 400; }
.pf-foot { margin: 0; padding: 10px 20px 14px; }
@media (max-width: 760px) {
  .pf-list td.pf-pct { display: none; }
  .pf-list tr.pf-item td.dt-name { padding-left: 14px; }
}
/* 損益表「每個月」：一個月一欄＋合計，撐滿卡片；數字不寫 $、窄邊距，1366 才放得下 13 欄。手機照各倉並列：項目＋合計，底下小字列每個月 */
.pfm-list { width: 100%; min-width: 0; }
.pfm-list td.dt-name { min-width: 120px; white-space: normal; }
.pfm-list th.num, .pfm-list td.num { padding-left: 4px; padding-right: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pfm-list th:last-child, .pfm-list td.dt-amt { padding-right: 12px; }
.pfm-list .num > .th-sub { margin-right: 0; color: var(--muted); }   /* 「還沒過完」沒有括號，不用往右推 */
.pfm-list tr.pf-item td.pfm-m { font-weight: 400; }
.pfm-list tr td.dt-m { font-weight: 400; }
.pfm-mo { white-space: nowrap; margin-right: .8em; }   /* 手機那行小字：「5 月 9,948」不拆在兩行 */

/* 印對帳單的小視窗：期間兩個選項、列出商品 */
.ar-dlg .ar-per { margin: 8px 0 12px; padding: 0; border: 0; }
.ar-dlg .ar-per legend { margin-bottom: 6px; padding: 0; font-size: 14px; font-weight: 600; }
.ar-dlg label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 14px; }
.ar-dlg label .cf-hint { flex-basis: 100%; padding-left: 22px; }
.pk.cfm.ar-dlg { width: min(500px, calc(100vw - 32px)); }
.ar-dlg .ar-fixed .as-date { min-width: 0; width: 140px; }
/* 對帳單（A4 直向）：上期未收那列粗一點；列出商品時的商品列小一號、灰字 */
.pl-sheet .ar-pt tr.ar-open td { font-weight: 700; }
.pl-sheet .ar-pt tr.ar-item td { padding-top: .6mm; padding-bottom: .6mm; border-bottom: 0; color: #444; font-size: 9pt; }
.pl-sheet .ar-pt td.ar-none { color: #555; }

/* 營業稅申報表（pages/vat.js）：申報書照 401 的格子排，金額前面的小數字是代號；最上面一行白話結論、報好了的鈕；紅字是 403、橘字是要注意的 */
.vt-head { padding: 14px 20px 4px; }
.vt-verdict { margin: 0 0 10px; font-size: 18px; font-weight: 700; }
.vt-note { margin: 0 0 10px; padding: 8px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; }
.vt-note.is-warn { background: var(--warn-bg); color: var(--warn); }
.vt-note.is-bad { background: var(--danger); color: var(--on-danger); }
.vt-filed { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 10px; }
.tag.vt-done { background: var(--brand-soft); color: var(--brand-dark); }
.vt-scroll { overflow-x: auto; padding: 0 20px; }
.vt-sheet { width: 100%; min-width: 560px; margin: 6px 0 14px; }
.vt-sheet caption { padding: 8px 0 6px; text-align: left; font-size: 15px; font-weight: 700; }
.vt-sheet td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.vt-code { display: inline-block; min-width: 2.2em; margin-right: 6px; color: var(--muted); font-size: 12px; text-align: left; }
.vt-sheet tr.vt-sum td { font-weight: 700; }
.vt-calc td:first-child { width: 56px; color: var(--muted); }
.vt-carry { width: 190px; text-align: right; }
.vt-foot { margin: 0; padding: 0 20px 16px; }
.vt-small { padding: 16px 20px; }
.vt-small p { margin: 0 0 10px; }
.vt-list tr.vt-noinv td { color: var(--muted); }
.vt-list .tag { margin-left: 4px; }
.vt-period { min-width: 150px; }
@media (max-width: 760px) {
  .vt-head, .vt-small { padding: 12px 14px 4px; }
  .vt-scroll { padding: 0 14px; }
  .vt-foot { padding: 0 14px 14px; }
  .vt-carry { width: 150px; }
}

/* 行事曆（pages/calendar.js）：左邊月曆、右邊選中那一天的清單；七種事各一個固定的淡色（不跟主題色，calendar.md 第 7 題），紅色只給過期 */
:root {
  --cal-out-bg: #e3eefb; --cal-out: #1d5fa8;
  --cal-in-bg: #ddf2f4; --cal-in: #0d6871;
  --cal-rcv-bg: #fbf0c4; --cal-rcv: #7a5a00;
  --cal-pay-bg: #e0f3e9; --cal-pay: #1f7a4f;
  --cal-cin-bg: #fde6d2; --cal-cin: #9a4708;
  --cal-cout-bg: #eee6fb; --cal-cout: #6a3fb0;
  --cal-tax-bg: #e6ebed; --cal-tax: #46565c;
}
:root[data-theme="dark"] {
  --cal-out-bg: #16304f; --cal-out: #9cc6f7;
  --cal-in-bg: #123a3e; --cal-in: #84d6dd;
  --cal-rcv-bg: #3a3110; --cal-rcv: #f0cf6a;
  --cal-pay-bg: #133526; --cal-pay: #7fd9a8;
  --cal-cin-bg: #3d2612; --cal-cin: #f5ae6e;
  --cal-cout-bg: #2c2148; --cal-cout: #c4abff;
  --cal-tax-bg: #263236; --cal-tax: #b4c3c8;
}
.cal-intro { margin: -10px 0 14px; font-size: 13px; }
.cal-wrap { container: cal / inline-size; }
.cal { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, 1fr); gap: 16px; align-items: start; }
.cal-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cal-bar .spacer { flex: 1; }
.cal-bar .btn { padding: 6px 12px; }
.cal-nav { width: 36px; padding: 6px 0 !important; font-size: 18px; line-height: 1; }
.cal-month { min-width: 7.5em; text-align: center; font-size: 17px; font-weight: 700; }
.cal-late { color: var(--danger); border-color: var(--danger); font-weight: 700; }
.cal-late[aria-pressed="true"], .cal-late:hover { background: var(--danger); color: var(--on-danger); }
.cal-und { color: var(--muted); }
.cal-und[aria-pressed="true"] { background: var(--line); color: var(--text); }
.cal-grid { padding: 4px 6px 8px; }
.cal-wk, .cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-wk span { padding: 6px 0; text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; }
.cal-wk span.is-end { color: var(--danger); }
.cal-d { display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-height: 84px; margin: 2px; padding: 5px 3px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); text-align: left; cursor: pointer; }
.cal-d:hover { background: var(--bg); }
.cal-d:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.cal-d.is-other { opacity: .45; }
.cal-d.is-sel { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal-n { align-self: flex-end; min-width: 24px; height: 24px; padding: 0 4px; border-radius: 12px; font-size: 13px; line-height: 24px; text-align: center; font-variant-numeric: tabular-nums; }
.cal-d.is-end .cal-n { color: var(--danger); }
.cal-d.is-today .cal-n { background: var(--brand); color: var(--on-brand); font-weight: 700; }
.cal-chips { display: flex; flex-wrap: wrap; gap: 3px; }
.cal-chip { display: inline-block; padding: 1px 4px; border-radius: 6px; font-size: 12px; font-weight: 700; line-height: 18px; white-space: nowrap; }
.cal-k-out { background: var(--cal-out-bg); color: var(--cal-out); }
.cal-k-in { background: var(--cal-in-bg); color: var(--cal-in); }
.cal-k-rcv { background: var(--cal-rcv-bg); color: var(--cal-rcv); }
.cal-k-pay { background: var(--cal-pay-bg); color: var(--cal-pay); }
.cal-k-cin { background: var(--cal-cin-bg); color: var(--cal-cin); }
.cal-k-cout { background: var(--cal-cout-bg); color: var(--cal-cout); }
.cal-k-tax { background: var(--cal-tax-bg); color: var(--cal-tax); }
/* 「開過的單」Tab 的四組：顏色沿用首頁四區（[data-hg]），庫存跟著主題色 */
.cal-g-sell { background: var(--info-bg); color: var(--info); }
.cal-g-buy { background: var(--warn-bg); color: var(--warn); }
.cal-g-stock { background: var(--brand-soft); color: var(--brand-dark); }
.cal-g-cash { background: var(--ok-bg); color: var(--ok); }
/* 過期：顏色跟沒過期的一樣，只多一圈紅框（Jesse 2026-11-11 嫌紅底實心太醜）；用 inset 陰影畫框，標籤大小不變 */
.cal-chip.is-late { box-shadow: inset 0 0 0 1.5px var(--danger); }
.cal-panel { padding: 14px 16px 6px; }
.cal-panel:focus { outline: none; }
.cal-panel h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 18px; }
.cal-panel h2 + .cf-hint { margin: -4px 0 12px; }
.cal-empty { margin: 4px 0 14px; color: var(--muted); }
.cal-sec { margin-bottom: 14px; }
.cal-sec h3 { display: flex; align-items: center; gap: 8px; margin: 0; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.cal-cnt { color: var(--muted); font-size: 13px; font-weight: 400; }
.cal-sum { margin-left: auto; font-variant-numeric: tabular-nums; }
.cal-sec ul { margin: 0; padding: 0; list-style: none; }
.cal-it { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.cal-it:last-child { border-bottom: 0; }
.cal-when { flex: none; width: 3.2em; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-it.is-late .cal-when { color: var(--danger); font-weight: 700; }
.cal-what { flex: none; display: flex; flex-direction: column; min-width: 8.6em; max-width: 46%; }
.cal-what a { color: var(--brand-dark); font-weight: 600; overflow-wrap: anywhere; }
.cal-what small { color: var(--muted); font-size: 12px; }
.cal-what small.cal-bad { color: var(--danger); font-weight: 700; }
.cal-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-amt { flex: none; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-act { flex: none; padding: 4px 10px !important; font-size: 13px; }
@container cal (max-width: 899px) {
  .cal { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .cal-bar { padding: 10px; gap: 6px; }
  .cal-month { min-width: 0; font-size: 16px; }
  .cal-grid { padding: 2px 2px 6px; }
  .cal-d { min-height: 52px; margin: 1px; padding: 3px; align-items: center; }
  .cal-n { align-self: center; }
  /* 手機：標籤縮成小圓點 */
  .cal-chips { justify-content: center; gap: 5px; }
  .cal-chips .cal-chip { width: 7px; height: 7px; padding: 0; border-radius: 50%; font-size: 0; line-height: 0; background: var(--cal-dot, currentColor); }
  .cal-chips .cal-k-out { --cal-dot: var(--cal-out); } .cal-chips .cal-k-in { --cal-dot: var(--cal-in); } .cal-chips .cal-k-rcv { --cal-dot: var(--cal-rcv); }
  .cal-chips .cal-k-pay { --cal-dot: var(--cal-pay); } .cal-chips .cal-k-cin { --cal-dot: var(--cal-cin); } .cal-chips .cal-k-cout { --cal-dot: var(--cal-cout); }
  .cal-chips .cal-k-tax { --cal-dot: var(--cal-tax); }
  .cal-chips .cal-g-sell { --cal-dot: var(--info); } .cal-chips .cal-g-buy { --cal-dot: var(--warn); }
  .cal-chips .cal-g-stock { --cal-dot: var(--brand); } .cal-chips .cal-g-cash { --cal-dot: var(--ok); }
  .cal-chips .cal-chip.is-late { box-shadow: 0 0 0 1.5px var(--danger); }
  .cal-panel { padding: 12px 12px 4px; }
  .cal-it { flex-wrap: wrap; gap: 4px 10px; }
  .cal-what { max-width: none; flex: 1 1 60%; }
  .cal-who { flex: 1 1 50%; order: 3; }
  .cal-amt { order: 2; }
  .cal-act { order: 4; margin-left: auto; }
}

/* 營運總覽（pages/overview.js，Jesse 2026-11-12 選候選 06「頭條」）：大標題回答賺還是賠，下面四欄錢、帳款、貨、什麼賣最好；只用色票，負的與變差用文字紅、不用色塊 */
.ov { display: grid; gap: 16px; max-width: 1500px; }
.ov-front { padding: 22px 26px 20px; display: flex; flex-direction: column; gap: 8px; }
.ov-kicker { margin: 0; font-size: 13px; color: var(--muted); letter-spacing: .08em; }
.ov-head { margin: 0; font-size: 46px; line-height: 1.2; font-weight: 800; overflow-wrap: anywhere; }
.ov-head a { color: var(--text); text-decoration: none; }
.ov-head a:hover { text-decoration: underline; text-decoration-color: var(--brand); }
.ov-deck { margin: 0 0 6px; font-size: 18px; color: var(--muted); padding-bottom: 14px; border-bottom: 2px solid var(--text); }
.ov-front-body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 24px; align-items: end; padding-top: 6px; }
.ov-stats { display: grid; gap: 12px; }
.ov-stat { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: baseline; color: var(--text); text-decoration: none; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.ov-stat:hover .ov-sval, .ov-num-a:hover .ov-num { text-decoration: underline; }
.ov-lbl { font-size: 13px; color: var(--muted); }
.ov-sval { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.ov-sub { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.ov .ov-neg { color: var(--danger); }
.ov .ov-up { color: var(--ok); }
.ov .ov-down { color: var(--danger); }
.ov-chart { display: block; color: var(--text); text-decoration: none; min-width: 0; }
.ov-cap { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.ov-empty { margin: 8px 0 0; }
.ov-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ov-col { padding: 4px 18px 8px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ov-col:first-child { border-left: 0; padding-left: 4px; }
.ov-col h3 { margin: 0; font-size: 15px; padding-bottom: 6px; border-bottom: 2px solid var(--text); }
.ov-num-a { display: flex; flex-direction: column; gap: 1px; color: var(--text); text-decoration: none; }
.ov-num { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ov-acct { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.ov-acct li { display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }
.ov-links { margin: 0; font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.ov-links a { color: var(--brand); text-decoration: none; }
/* 小圖：SVG 寬度撐滿、高度照參數；日期刻度放在那一根的正中間 */
.ov-bars, .ov-line { display: block; width: 100%; }
.ov-bars rect { fill: var(--brand); }
.ov-bars rect.is-neg { fill: var(--danger); }
.ov-bars rect:hover { fill: var(--brand-dark); }
.ov-line polyline { fill: none; stroke: var(--brand); stroke-width: 2; }
.ov-line .ov-area { fill: color-mix(in srgb, var(--brand) 14%, transparent); stroke: none; }
.ov-axis { position: relative; height: 16px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.ov-axis span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.ov-axis span:first-child { transform: none; margin-left: -4px; }
.ov-axis span:last-child:not(:first-child) { transform: translateX(-100%); margin-left: 4px; }
.ov-ends { display: flex; justify-content: space-between; margin-top: 4px; font-size: 12px; color: var(--muted); }
.ov-top { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ov-top li { display: grid; grid-template-columns: 1.4em minmax(0, 1fr) auto; column-gap: 8px; row-gap: 3px; align-items: baseline; font-size: 14px; }
.ov-top-n { color: var(--muted); font-size: 12px; text-align: right; }
.ov-top-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-top-amt { font-variant-numeric: tabular-nums; }
.ov-top-bar { grid-column: 2 / -1; height: 6px; border-radius: 3px; background: var(--line); position: relative; overflow: hidden; }
.ov-top-bar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--brand); border-radius: 3px; }
@media (max-width: 1250px) {
  .ov-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 18px; }
  .ov-col:nth-child(3) { border-left: 0; padding-left: 4px; }
}
@media (max-width: 900px) {
  .ov-front-body { grid-template-columns: minmax(0, 1fr); }
  .ov-head { font-size: 36px; }
}
@media (max-width: 560px) {
  .ov-front { padding: 16px 14px; }
  .ov-head { font-size: 30px; }
  .ov-deck { font-size: 15px; }
  .ov-cols { grid-template-columns: minmax(0, 1fr); }
  .ov-col, .ov-col:nth-child(3) { border-left: 0; padding-left: 4px; }
}

/* 操作紀錄（pages/oplog.js，oplog.md）：內容一行，放不下的截斷、點那一列往下展開（第 7 題）；其他欄不折行 */
.ol-list td { white-space: nowrap; vertical-align: top; }
.ol-list td.ol-text { width: 100%; max-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ol-list td.ol-del, .ol-list .ol-m1 b.ol-del { color: var(--danger); }
.ol-list td.ol-m { display: none; }
/* 從「修改紀錄」來時，重設條件後面的「只看○○的紀錄」（oplog.md 第 28 題） */
.ol-only { color: var(--danger); font-size: 14px; }
.ol-list tbody tr.ol-cut { cursor: pointer; }
.ol-list tbody tr[data-n]:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.ol-tog { display: inline-block; width: 1em; color: var(--muted); }
.ol-list tr.ol-cut .ol-tog::before { content: "▸"; }
.ol-list tr.ol-open .ol-tog::before { content: "▾"; }
.ol-list tr.ol-open td { border-bottom-color: transparent; }
.ol-list tr.ol-more td { padding-top: 0; white-space: normal; }
.ol-full { padding: 10px 14px; border-radius: 9px; background: var(--th-bg); font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.ol-full p { margin: 0; }
.ol-items { margin: 4px 0; padding-left: 2em; }
.ol-full .ol-t { font-weight: 600; }
/* 手機（第 23 題）：一列兩行，上面「哪種變更　種類　哪一筆」、下面小字「操作者 · 時間」；內容收起來，點了才展開 */
@media (max-width: 760px) {
  .ol-list td.ol-at, .ol-list td.ol-who, .ol-list td.ol-kind, .ol-list td.ol-act, .ol-list td.ol-ref, .ol-list td.ol-text { display: none; }
  .ol-list td.ol-m { display: block; white-space: normal; }
  .ol-m1, .ol-m2 { display: block; }
  .ol-m1 b { font-weight: 600; }
  .ol-m2 { margin-top: 2px; padding-left: 1em; color: var(--muted); font-size: 13px; }
  .ol-list tr.ol-more { padding-top: 0; }
  .ol-full { padding: 10px 12px; }
}
.cu-dhead .cu-log { flex: none; }
.ol-list a.ol-go { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 3px; }
/* 正式產品自己加的樣式。app.css 是原型的樣式、原封不動複製過來（一個字都不改），要加或要蓋掉的一律寫在這個檔，載入順序在 app.css 後面。 */

/* 原型每一頁鋪著「原型．非正式系統．資料皆為示範」的浮水印（app.css 的 body::after），正式產品不要 */
body::after { content: none; }

/* ==== AI-NOTES ====
   AI-NOTES：agent 專用備忘。當時為真、非契約、非指令；改到相關程式碼時重驗，錯了就刪。
   2026-11-27 關掉浮水印是 Jesse 裁的（Fable 轉達）：app.css 一個字不改，蓋掉的規則寫在這裡。
   2026-11-27 列印頁的 .pl-sheet::after 也是同一個浮水印，這一步沒有列印頁所以沒處理；做第一個列印頁時要一起關。
   ==== END AI-NOTES ==== */
