:root {
  --brand: #7E1822;
  --bg: #f4f3f0;
  --card: #fff;
  --text: #2b2724;
  --muted: #7a736d;
  --line: #e4e1db;
  --ok: #2e7d4f;
  --danger: #b3261e;
  /* 思源黑體：iPhone、電腦、Android 看起來都一樣，筆畫勻稱、久看不累 */
  font-family: "Noto Sans TC Variable", "Noto Sans TC", -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif;
}
* { box-sizing: border-box; }
/* ===== 全站字體規則（之後新加的畫面都照這裡，不要在別的地方另外指定字體） =====
   字體：思源黑體（public/*.html 都要先載入 /fonts/noto-sans-tc.css 再載入 style.css）
   粗細只用這三種：內文 --w-text、按鈕／分頁／標籤 --w-ui、標題與強調 --w-strong */
:root { --w-text: 430; --w-ui: 500; --w-strong: 650; }
body { margin: 0; background: var(--bg); color: var(--text); -webkit-text-size-adjust: 100%; line-height: 1.6; letter-spacing: .02em; font-weight: var(--w-text); text-rendering: optimizeLegibility; }
h1, h2, h3, h4, strong, b, th { font-weight: var(--w-strong); letter-spacing: .03em; }
button, .btn, .tab, .nav a, .pill, .tag, .link-btn, label, summary { font-weight: var(--w-ui); }
/* 按鈕預設不吃網頁字體，要特別指定，不然會變回系統字 */
button, input, select, textarea, option { font-family: inherit; letter-spacing: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.btn { display: inline-block; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; padding: 12px 18px; font-size: 16px; text-decoration: none; cursor: pointer; transition: background .15s, box-shadow .15s; }
.btn:active { transform: scale(.98); }
/* 手機點下去要「馬上」有反應：不等 iPhone 判斷是不是要放大畫面，點的地方立刻變色 */
/* 手機點兩下不會被放大（EC 2026-10-17）：整頁都關掉雙擊放大，捲動、兩指縮放照常 */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
a, button, .btn, .tab, label, summary, input, select, textarea { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.btn:active, .tab:active { background: #f1eeea; }
.btn.primary:active, .btn.primary-inline:active { filter: brightness(.88); }
.tabbar a:active { opacity: .55; }
/* 按下去等主機回應的時候：按鈕鎖住、旁邊轉圈，免得以為沒按到又按一次 */
.btn.busy { opacity: .7; cursor: progress; }
.btn.busy::after { content: ''; display: inline-block; width: .9em; height: .9em; margin-left: .45em; vertical-align: -.1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; width: 100%; text-align: center; }
.btn.small { padding: 6px 12px; font-size: 14px; }
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: var(--card); border-radius: 16px; padding: 32px 24px; width: 100%; max-width: 360px; text-align: center; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.login-card h1 { font-size: 22px; margin: 12px 0 4px; }
.login-card p { color: var(--muted); margin: 0 0 20px; }
.login-alt { display: block; margin-top: 16px; font-size: 14px; color: var(--muted); }
button.login-alt { margin: 16px auto 0; border: 0; background: none; cursor: pointer; padding: 0; }
/* Apple 審核專用登入：帳號密碼兩格 */
.review-login { display: grid; gap: 10px; margin-top: 12px; text-align: left; }
.review-login label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
/* 隱私權說明：字比較多，靠左排、寬一點 */
.privacy-card { max-width: 560px; text-align: left; }
.privacy-card h2 { font-size: 16px; margin: 18px 0 4px; }
.privacy-card p { margin: 0 0 8px; }
.privacy-card .brand-mark { display: block; margin: 0 auto; }
.privacy-card h1 { text-align: center; }
.privacy-card .btn { margin-top: 16px; }
.login-links { margin-top: 12px; font-size: 13px; }
.login-links a { color: var(--muted); }
.brand-mark { width: 112px; height: 112px; }
.error-text { color: var(--danger); min-height: 1.4em; margin-bottom: 12px; font-size: 15px; }
/* 上方列固定在最上面、白色一路鋪到狀態列：iPhone 才會把頂端當成白色，不會把底下的內容糊成一片 */
.topbar { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 12px; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar .spacer { flex: 1; }
/* 名字和登出不要被擠到斷行 */
#me-name, #logout { white-space: nowrap; flex-shrink: 0; }
.page { max-width: 720px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border-radius: 16px; padding: 20px 18px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(60,40,30,.05), 0 4px 16px rgba(60,40,30,.04); }
.card h2 { font-size: 18px; margin: 0 0 6px; }
.status-list { list-style: none; padding: 0; margin: 12px 0 0; }
.status-list li { padding: 8px 0; border-top: 1px solid var(--line); }
.status-list li.ok { color: var(--ok); }
.status-list li.todo { color: var(--muted); }
.nav { display: flex; gap: 4px; overflow-x: auto; }
/* 電腦版：選單底下的下拉要露出來，不能被捲動框切掉 */
@media (min-width: 701px) { .nav { overflow: visible; flex-wrap: nowrap; } }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; white-space: nowrap; font-size: 15px; }
.nav a.active { color: var(--brand); background: #f6eced; font-weight: var(--w-strong); }
.nav-menu { position: relative; }
.nav-menu summary { list-style: none; cursor: pointer; color: var(--muted); padding: 6px 10px; border-radius: 8px; white-space: nowrap; font-size: 15px; }
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu summary::after { content: ' ▾'; font-size: 11px; }
.nav-menu summary.active { color: var(--brand); background: #f6eced; font-weight: var(--w-strong); }
.nav-drop a { padding: 8px 12px; }
.nav-drop { position: absolute; top: calc(100% + 4px); left: 0; z-index: 10; display: flex; flex-direction: column; gap: 2px; min-width: 120px; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, .08); }
.check-group { display: flex; flex-wrap: wrap; gap: 8px 18px; padding-top: 4px; }
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; }
  .nav { order: 3; width: 100%; }
}
.btn.primary-inline { background: var(--brand); border-color: var(--brand); color: #fff; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.list { display: flex; flex-direction: column; margin-top: 8px; }
.list-item { all: unset; display: block; padding: 12px 4px; border-top: 1px solid var(--line); cursor: pointer; }
.list-item:active { background: #faf8f5; }
.list-item.dim { opacity: .55; }
.li-sub { font-size: 14px; margin-top: 2px; }
.tag { display: inline-block; font-size: 12px; background: #eee; border-radius: 6px; padding: 1px 6px; margin-left: 6px; }
.form { display: flex; flex-direction: column; gap: 18px; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 14px; color: #555; font-weight: var(--w-strong); }
.field > small, .form > small { font-size: 13px; line-height: 1.5; }
input, select, textarea { font: inherit; font-weight: var(--w-text); font-size: 16px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text); max-width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(126,24,34,.12); }
select[multiple] { min-height: 90px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.check input { width: 18px; height: 18px; }
.history h3, .special h4 { font-size: 15px; margin: 18px 0 6px; }
.timeline, .plain { list-style: none; padding: 0; margin: 0; }
.timeline li, .plain li { padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.inline-form input:not([type=checkbox]) { flex: 1 1 120px; }
.unit-card { border-top: 1px solid var(--line); padding: 10px 0; }
.unit-card summary { cursor: pointer; font-weight: var(--w-strong); padding: 4px 0; }
.unit { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.hours { border-collapse: collapse; }
.hours th { text-align: left; font-weight: var(--w-text); color: var(--muted); padding-right: 8px; white-space: nowrap; }
.hours td { padding: 3px 2px; }
.hours input[type=time] { padding: 6px; }
.dept { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.dept.archived input[name=name] { color: var(--muted); background: #f3f3f3; }
.link-btn { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 14px; margin-left: 8px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #333; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 1000; max-width: 90vw; }
.toast.bad { background: var(--danger); }
h2 { font-size: 18px; }
.hours { width: 100%; table-layout: auto; }
.hours td:nth-child(2), .hours td:nth-child(4) { width: 40%; }
.hours input[type=time] { width: 100%; min-width: 0; font-size: 15px; }
.hours .check { white-space: nowrap; font-size: 14px; }
.hours th { padding-right: 4px; }

/* 任務 */
textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
.small { font-size: 13px; }
.back { display: inline-block; color: var(--muted); text-decoration: none; margin: 0 0 10px; font-size: 15px; }
.tabs { display: flex; gap: 6px; margin: 12px 0 4px; overflow-x: auto; }
.tabs.sub { margin-top: 4px; }
.tab { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px; font-size: 15px; color: #5c544e; cursor: pointer; white-space: nowrap; }
.tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tabs.sub .tab { padding: 4px 12px; font-size: 14px; }
.tabs.sub .tab.active { background: #f6eced; color: var(--brand); border-color: #f6eced; }
/* 階段按鈕：固定兩列、每列四顆，手機上也不會排成三列 */
.tabs.sub { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; overflow: visible; }
.tab.chip { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 6px 4px; min-width: 0; }
.tabs.sub .tab.chip { padding: 6px 4px; font-size: 14px; }
.tab.chip .count { min-width: 18px; padding: 0 5px; border-radius: 999px; background: #f1eeea; color: #6b635c; font-size: 12px; line-height: 20px; text-align: center; font-weight: var(--w-strong); }
.tab.chip.active .count { background: var(--brand); color: #fff; }
.tab.chip.alert { color: var(--danger); border-color: #f0c9c6; }
.tab.chip.alert .count { background: var(--danger); color: #fff; }
.tab.chip.active.alert { color: #fff; border-color: var(--brand); }
.empty { padding: 16px 0; }
.list:has(.task-row) { gap: 10px; margin-top: 12px; }
/* 任務卡片 A 清爽留白（EC 2026-10-27）：沒有邊線，淡陰影，狀態用小圓點 */
.list-item.task-row { display: block; color: inherit; text-decoration: none; border: 0; border-radius: 16px; padding: 14px 16px; background: #fff; box-shadow: 0 1px 3px rgba(60,40,30,.06), 0 4px 14px rgba(60,40,30,.05); transition: box-shadow .15s, transform .1s; }
.list-item.task-row:hover { box-shadow: 0 2px 6px rgba(60,40,30,.08), 0 8px 20px rgba(60,40,30,.08); }
.list-item.task-row:active { transform: scale(.99); background: #fff; }
.tr-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; min-height: 20px; }
.tr-status { display: inline-flex; align-items: center; gap: 6px; font-weight: var(--w-ui); }
.tr-status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.tr-status.st-pending { color: #8a5a00; } .tr-status.st-pending::before { background: #e9b949; }
.tr-status.st-in_progress { color: #1d4f91; } .tr-status.st-in_progress::before { background: #7ea6e0; }
.tr-status.st-blocked { color: #9a3d00; } .tr-status.st-blocked::before { background: #ec8f55; }
.tr-status.st-review { color: #5b2ca0; } .tr-status.st-review::before { background: #a68ae0; }
.tr-status.st-done { color: var(--ok); } .tr-status.st-done::before { background: #7cc093; }
.tr-status.st-cancelled { color: #777; } .tr-status.st-cancelled::before { background: #bbb; }
.tr-flags { gap: 6px; }
.tr-new { display: inline-flex; align-items: center; gap: 5px; color: var(--brand); font-size: 12px; font-weight: var(--w-ui); }
.tr-new::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.tr-title { display: block; font-size: 17px; line-height: 1.4; margin: 6px 0 8px; font-weight: var(--w-strong); }
.task-row.overdue .tr-title { color: var(--danger); }
.tr-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.tr-meta span:last-child { text-align: right; }
.tr-meta .bad { color: var(--danger); font-weight: var(--w-ui); }
.tr-meta .warn { color: #a35f00; font-weight: var(--w-ui); }
.tab.chip.just-moved { animation: just-moved 2.4s ease-out; }
@keyframes just-moved { 0%, 40% { box-shadow: 0 0 0 3px var(--brand); } 100% { box-shadow: none; } }
.tags { gap: 4px; margin-top: 4px; }
.pill { display: inline-block; font-size: 12px; border-radius: 999px; padding: 2px 8px; background: #eee; color: #444; }
.s-pending { background: #fff3d6; color: #8a5a00; }
.s-in_progress { background: #e3efff; color: #1d4f91; }
.s-blocked { background: #ffe6d5; color: #9a3d00; }
.s-review { background: #efe6ff; color: #5b2ca0; }
.s-done { background: #e2f3e8; color: var(--ok); }
.s-cancelled { background: #eee; color: #777; }
.s-overdue, .i-urgent { background: var(--danger); color: #fff; }
.pill.s-new { background: var(--brand); color: #fff; }
.i-important { background: #fde7e7; color: var(--danger); }
.task-title { font-size: 20px; margin: 4px 0 6px; }
.criteria { background: #faf8f5; border-radius: 10px; padding: 10px 12px; margin: 12px 0; white-space: pre-wrap; line-height: 1.5; }
.progress-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 10px; font-size: 14px; }
progress { flex: 1 1 140px; height: 10px; appearance: none; -webkit-appearance: none; border: none; border-radius: 999px; overflow: hidden; background: #eee; }
progress::-webkit-progress-bar { background: #eee; border-radius: 999px; }
progress::-webkit-progress-value { background: var(--brand); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--brand); }
.infos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.info { display: flex; flex-direction: column; font-size: 15px; }
.info .muted { font-size: 13px; }
.notice { border-radius: 10px; padding: 10px 12px; margin: 10px 0; background: #f2f2f2; line-height: 1.5; }
.notice.warn { background: #fff1e6; color: #8a3a00; }
.notice.ok { background: #e2f3e8; color: var(--ok); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn.big { padding: 12px 26px; font-weight: var(--w-strong); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-outline { color: var(--danger); border-color: #f0c9c6; }
#panel:not(:empty) { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 4px; }
#panel h3 { margin: 10px 0 0; font-size: 16px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two input { width: 100%; }
.segmented { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.segmented label { position: relative; flex: 1; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span { display: block; padding: 11px 8px; font-size: 15px; text-align: center; cursor: pointer; border-right: 1px solid var(--line); transition: background .15s; }
.segmented label:last-child span { border-right: none; }
.segmented input:checked + span { background: var(--brand); color: #fff; }
.segmented input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: -2px; }
.milestones { display: flex; flex-direction: column; gap: 8px; margin: 2px 0 4px; }
.milestone-row { display: grid; grid-template-columns: 1fr minmax(150px, 38%); gap: 8px; }
.tree { list-style: none; padding: 0; margin: 6px 0 0; }
.tree .tree { padding-left: 14px; border-left: 2px solid var(--line); margin-left: 4px; }
.tree-node { padding: 8px 0; border-top: 1px solid var(--line); }
.tree-node a { color: var(--text); font-weight: var(--w-strong); text-decoration: none; }
.file-list { list-style: none; padding: 0; margin: 0 0 12px; }
.file-list li { padding: 8px 0; border-top: 1px solid var(--line); word-break: break-all; }
.file-list li:first-child { border-top: 0; }
.summary { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
/* 首頁任務：我負責的、我交辦的兩塊（EC 2026-10-27） */
.task-part { display: flex; flex-direction: column; gap: 10px; }
.task-part + .task-part { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; }
.task-part h3 { margin: 0; font-size: 15px; color: var(--muted); }
.task-part .stats { margin-top: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; background: #faf8f5; border-radius: 12px; padding: 12px 4px; color: var(--text); text-decoration: none; }
.stat strong { font-size: 22px; }
.stat span { font-size: 13px; color: var(--muted); text-align: center; }
.stat.bad strong { color: var(--danger); }
@media (max-width: 420px) {
  .infos { grid-template-columns: 1fr 1fr; }
  .milestone-row { grid-template-columns: 1fr 140px; }
}
.milestone-row input { min-width: 0; width: 100%; }
@media (max-width: 380px) {
  .tabs.sub .tab.chip { font-size: 13px; gap: 3px; padding: 6px 2px; letter-spacing: 0; }
  .tab.chip .count { min-width: 16px; padding: 0 4px; }
}

/* 手機 App：下方分頁列（電腦版藏起來，用上方選單） */
.tabbar { display: none; }
@media (max-width: 700px) {
  .topbar .nav { display: none; }
  /* 下方按鈕列：iPhone 底部那條橫線的位置不用整段留白，只留一點，按鈕下面不會空一大塊 */
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: #fff; border-top: 1px solid var(--line); padding: 4px 4px max(6px, calc(env(safe-area-inset-bottom) - 18px)); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; color: var(--muted); text-decoration: none; font-size: 12px; -webkit-tap-highlight-color: transparent; }
  .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a.active { color: var(--brand); }
  .tabbar a.active svg { stroke-width: 2.2; }
  .tabbar a.tab-new svg { width: 30px; height: 30px; padding: 5px; border-radius: 999px; background: var(--brand); color: #fff; stroke: #fff; stroke-width: 2.4; margin-top: -4px; }
  .tabbar a.tab-new { color: var(--brand); }
  body.has-tabbar { padding-bottom: calc(66px + max(6px, env(safe-area-inset-bottom) - 18px)); }
  body.has-tabbar .toast { bottom: calc(76px + max(6px, env(safe-area-inset-bottom) - 18px)); }
}

/* 加到主畫面的教學卡 */
.install-card { border: 1px dashed #e3c9cc; background: #fdf8f8; }
.line-card ol { margin: 8px 0 12px; padding-left: 20px; line-height: 2; }
.line-card .btn.small { white-space: nowrap; flex-shrink: 0; }
.btn.line-btn { background: #06C755; border-color: #06C755; color: #fff; padding: 6px 14px; font-size: 15px; }
.bind-code { text-align: center; padding: 14px 8px; border-radius: 12px; background: #f6f4f1; }
.bind-code .code { font-size: 34px; letter-spacing: .3em; font-weight: var(--w-strong); font-variant-numeric: tabular-nums; }
.install-card ol { margin: 8px 0 12px; padding-left: 20px; line-height: 1.9; }
.install-card .row-between { align-items: flex-start; }
/* 設定頁 */
.setting-row { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.symbol-table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.symbol-table th, .symbol-table td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.symbol-table th { font-weight: var(--w-ui); color: var(--muted); }
.symbol-table input[name=symbol] { width: 4.5em; }
.symbol-table select { width: 100%; }
.symbol-table .center { text-align: center; }
.leave-types li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.leave-types .actions { margin-left: auto; }
.leave-types li.dim { opacity: .55; }
.break { word-break: break-all; }
.warn { color: #9a6200; }
.symbol-table td:nth-child(n+3), .symbol-table th:nth-child(n+3) { white-space: nowrap; width: 1%; }
.setting-row h3 { margin: 2px 0 0; }
.setting-row:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
#quiet-card h3 { margin: 20px 0 4px; font-size: 16px; font-weight: var(--w-strong); }
#quiet-card .row select { width: auto; }
/* 權限頁 */
.perm-group h3 { margin: 18px 0 4px; font-size: 15px; font-weight: var(--w-strong); color: #6b635c; }
.perm-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
.perm-row.on .perm-main strong { color: var(--brand); }
.perm-main { flex: 1 1 220px; min-width: 0; }
.perm-ctl { display: flex; gap: 6px; align-items: center; }
.perm-ctl select { width: auto; }
.pill.lv-mid { background: #fdf1dc; color: #8a5a00; }
.pill.lv-high { background: #fbe4e2; color: var(--danger); }
.pill.adv { background: #e7f0fb; color: #2a5a8f; margin-left: 4px; }
/* 手機「更多」：從下面滑上來的選單，管理頁都收在這裡 */
.more-sheet { display: none; }
@media (max-width: 700px) {
  .more-sheet { display: block; position: fixed; inset: 0; z-index: 8; background: rgba(0, 0, 0, 0); pointer-events: none; transition: background .2s; }
  .more-sheet.open { background: rgba(0, 0, 0, .35); pointer-events: auto; }
  /* 選單最高到畫面上方留一點空，超過就在選單裡面捲（原本沒限高度，項目一多就超出畫面、滑不動） */
  .more-panel { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; max-height: calc(100dvh - 48px - env(safe-area-inset-top)); background: #fff; border-radius: 20px 20px 0 0; box-shadow: 0 -6px 24px rgba(0, 0, 0, .08); transform: translateY(100%); transition: transform .22s ease-out; }
  .more-sheet.open .more-panel { transform: translateY(0); }
  .more-head { position: relative; display: flex; align-items: center; justify-content: center; padding: 18px 16px 10px; border-bottom: 1px solid #f0ebe6; flex: none; }
  .more-head strong { font-size: 16px; font-weight: var(--w-strong); }
  .more-handle { position: absolute; top: 7px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: #e3ddd7; }
  .more-x { position: absolute; right: 10px; top: 50%; margin-top: -14px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #f4f0ec; color: var(--muted); font-size: 14px; line-height: 32px; padding: 0; cursor: pointer; }
  .more-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 12px 16px calc(20px + env(safe-area-inset-bottom)); }
  .more-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 12px 16px 4px; flex: none; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .more-tabs::-webkit-scrollbar { display: none; }
  .more-tabs button { flex: none; border: 0; border-radius: 999px; padding: 7px 14px; background: #f4f0ec; color: var(--muted); font-size: 14px; font-weight: var(--w-ui); cursor: pointer; }
  .more-tabs button.on { background: var(--brand); color: #fff; }
  /* 只顯示選到的那一類；高度留一點，切分類時選單不會一下長一下短 */
  .more-body { min-height: 300px; }
  .more-group { display: none; }
  .more-group.on { display: block; }
  .more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .more-grid a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 92px; padding: 10px 4px; border-radius: 14px; background: #f7f4f1; color: var(--text, #333); text-decoration: none; font-size: 14px; line-height: 1.3; text-align: center; }
  .more-grid a:active { background: #efe9e4; }
  .more-grid a.active { background: #f6eced; color: var(--brand); }
  .more-grid svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  html.more-open, html.more-open body { overflow: hidden; }
  .more-close { width: 100%; }
}

/* 留休 */
.carry-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.carry-table th, .carry-table td { text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.carry-table th:first-child, .carry-table td:first-child { text-align: left; }
.carry-table th { font-weight: var(--w-ui); color: var(--muted); }
.carry-table .bad { color: #b42318; }
.stats.three { grid-template-columns: repeat(3, 1fr); }
.tag.bad { background: #fde8e6; color: #b42318; }
.tag.good { background: #e7f4ec; color: #1e7b45; }
.bad-text { color: #b42318; }
button.list-item { width: 100%; box-sizing: border-box; }

/* 選人（店長、部門主管、區經理） */
.picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.picker select { width: auto; min-width: 7em; }
.chip { display: inline-flex; align-items: center; gap: 2px; background: #f3ece8; border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 14px; }
.chip-x { all: unset; cursor: pointer; padding: 0 6px; color: var(--muted); font-size: 16px; line-height: 1; }
.leaders { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; }
.head-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; }
.region .field { margin-top: 8px; }
.leaders > .btn { margin-top: 10px; }

/* 班表：顏色淡、線條少，一眼看出誰休誰請假，久看不累 */
.page.wide { max-width: 1100px; }
:root { --on: #2e7d4f; --on-bg: #e9f4ed; --off: #7a5a00; --off-bg: #fff1a8; --leave: #a15c12; --leave-bg: #fcefdf; }
.sched-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sched-head h2 { margin: 0; }
.stepper { display: inline-flex; align-items: center; gap: 2px; background: #f6f4f1; border-radius: 999px; padding: 3px; }
.stepper button { all: unset; cursor: pointer; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; color: var(--muted); }
.stepper button:active { background: #e9e5e0; }
.stepper .now { padding: 0 8px; font-weight: var(--w-ui); white-space: nowrap; font-size: 15px; }
.today-link { all: unset; cursor: pointer; font-size: 13px; color: var(--brand); font-weight: var(--w-ui); padding: 4px 2px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.multi { position: relative; border: 1px solid var(--line); border-radius: 999px; background: #fff; transition: border-color .15s, background .15s; }
.multi.on { border-color: #d9b9bc; background: #fbf5f5; }
.multi summary { padding: 7px 14px; cursor: pointer; list-style: none; max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.multi summary::-webkit-details-marker { display: none; }
.multi summary::after { content: '⌄'; margin-left: 6px; color: var(--muted); }
.multi .multi-lbl { color: var(--muted); margin-right: 4px; }
.multi.on .val { color: var(--brand); }
.multi-list { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; min-width: 11em; display: flex; flex-direction: column; gap: 2px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 28px rgba(60,40,30,.14); padding: 8px; }
.multi-list .check { padding: 6px 8px; border-radius: 8px; }
.multi-list .check:active { background: #f6f4f1; }
.clear-filters { all: unset; cursor: pointer; font-size: 13px; color: var(--muted); padding: 7px 4px; text-decoration: underline; text-underline-offset: 3px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }

.stats.three { grid-template-columns: repeat(3, 1fr); margin-top: 14px; }
.stat.on { background: var(--on-bg); } .stat.on strong { color: var(--on); }
.stat.off { background: var(--off-bg); } .stat.off strong { color: var(--off); }
.stat.leave { background: var(--leave-bg); } .stat.leave strong { color: var(--leave); }
.stat strong { font-size: 26px; line-height: 1.2; }
.day-group { margin-top: 16px; }
.day-group h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: var(--w-ui); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--on); } .dot.off { background: var(--off); } .dot.leave { background: var(--leave); }
.names { display: flex; flex-wrap: wrap; gap: 8px; }
.person { display: inline-flex; align-items: baseline; gap: 6px; border-radius: 10px; padding: 6px 12px; font-size: 15px; background: #f7f6f3; }
.person.on { background: var(--on-bg); }
.person.off { background: var(--off-bg); }
.person.leave { background: var(--leave-bg); }
.person small { font-size: 12px; color: var(--muted); }
.person.leave small { color: var(--leave); }
/* 今天上班還沒打卡（EC 2026-11-02）：先灰色，打了卡才變回上班的顏色 */
.person.on.not-in { background: #ecebe8; color: #8f8a84; }
.empty { text-align: center; color: var(--muted); padding: 18px 0 6px; }

.grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 12px; padding-bottom: 4px; }
.sched { border-collapse: separate; border-spacing: 3px; font-size: 13px; }
.sched th, .sched td { min-width: 30px; height: 32px; text-align: center; padding: 0; border-radius: 7px; }
.sched thead th { cursor: pointer; font-weight: var(--w-ui); color: var(--text); line-height: 1.15; padding: 4px 0; }
.sched thead th.wk, .sched thead th.wk .wd { color: #b3261e; }
.sched .wd { font-size: 11px; color: var(--muted); font-weight: var(--w-text); }
.sched thead th.today { background: var(--brand); color: #fff; }
.sched thead th.today .wd { color: #fff; opacity: .85; }
.sched th.who { position: sticky; left: 0; z-index: 1; background: #fff; text-align: left; padding: 0 10px 0 2px; white-space: nowrap; font-weight: var(--w-ui); box-shadow: -4px 0 0 #fff, 4px 0 0 #fff, 9px 0 7px -6px rgba(0,0,0,.14); border-radius: 0; }
.sched td { background: #f9f8f6; color: var(--muted); }
.sched td.on { background: #f9f8f6; }
.sched td.off { background: var(--off-bg); color: var(--off); font-weight: var(--w-ui); }
.sched td.leave { background: var(--leave-bg); color: var(--leave); font-weight: var(--w-ui); }
.sched td.none { background: repeating-linear-gradient(135deg, #f6f5f3 0 4px, #fff 4px 8px); color: transparent; }
.sched td.unknown { background: #fde8e6; color: #b42318; }
.sched td.faded { background: #fcfcfb; color: transparent; }
.sched td.sel, .sched th.sel { box-shadow: inset 0 0 0 2px var(--brand); }
.sched tbody tr:active th.who { color: var(--brand); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-style: normal; font-size: 12px; background: #f9f8f6; }
.legend i.off { background: var(--off-bg); color: var(--off); } .legend i.leave { background: var(--leave-bg); color: var(--leave); }
.legend i.none { background: repeating-linear-gradient(135deg, #f0eeeb 0 4px, #fff 4px 8px); }

/* 佈告欄（首頁「即將到來」、班表頁那天的備註） */
:root { --notice: #8a5a14; --notice-bg: #fbf4e6; }
.notice-hint { margin: 0 0 10px; }
.notices { display: flex; flex-direction: column; gap: 8px; }
.notice { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: 12px; background: #f9f8f6; width: 100%; }
.notice.tappable { cursor: pointer; }
.notice.tappable:active { background: #f1eeea; }
.notice.now { background: var(--notice-bg); }
.notice.now.tappable:active { filter: brightness(.97); }
.notice-when { font-size: 13.5px; font-weight: var(--w-ui); color: var(--muted); }
.notice.now .notice-when { color: var(--notice); }
.notice-text { font-size: 15.5px; line-height: 1.5; word-break: break-word; }
.notice-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.notice-meta .tag { font-size: 12px; }
.notice-edit { margin-left: auto; color: var(--brand); font-weight: var(--w-ui); }
.notice-empty { text-align: center; padding: 10px 0 4px; margin: 0; }
.notice-form { display: flex; flex-direction: column; gap: 12px; padding: 14px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.notice-form textarea, .notice-form select, .notice-form input { width: 100%; min-width: 0; }
.notice-form .two > * { min-width: 0; }
.notice-form .form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.notice-form .check { white-space: nowrap; }
.notice-form .check input { width: 18px; min-width: 18px; }
.notice-form .form-actions .danger-outline { margin-left: auto; }
.day-notes { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.day-note { display: flex; gap: 8px; align-items: baseline; background: var(--notice-bg); color: var(--text); border-radius: 10px; padding: 8px 12px; font-size: 14.5px; }
.day-note::before { content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--notice); transform: translateY(-1px); }
.day-note small { color: var(--muted); margin-left: auto; white-space: nowrap; font-size: 12px; }
.sched thead th .pin { display: block; width: 5px; height: 5px; margin: 2px auto 0; border-radius: 50%; background: var(--notice); }
.sched thead th.today .pin { background: #fff; }
.tag.repeat { background: var(--notice-bg); color: var(--notice); }
.legend i.pin-key { background: transparent; } .legend i.pin-key::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--notice); }
.sched-head { flex-wrap: wrap; }
.sched-head h2 { white-space: nowrap; }
.sched-head .row-between { gap: 4px; }
.today-link { white-space: nowrap; }
@media (max-width: 400px) { .stepper .now { padding: 0 2px; font-size: 14.5px; } .stepper button { width: 30px; } }
/* 電腦版：整個月一頁看完，不用左右捲（EC 2026-10-14） */
@media (min-width: 900px) {
  .page.wide { max-width: 1280px; }
  .grid-wrap { overflow-x: visible; }
  .sched { width: 100%; table-layout: fixed; border-spacing: 2px; }
  .sched th, .sched td { min-width: 0; }
  .sched thead th.who, .sched th.who { width: 6.5em; box-shadow: none; position: static; }
}
.sched thead th { position: relative; padding-bottom: 8px; }
.sched thead th .pin { position: absolute; left: 50%; bottom: 2px; margin: 0 0 0 -2.5px; }

/* 調整班表順序：按住 ☰ 拖，或按 ↑ ↓ */
.order-list { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.order-item { display: flex; align-items: center; gap: 10px; background: #f7f6f3; border-radius: 12px; padding: 6px 8px; }
.order-item.dragging { background: var(--on-bg); box-shadow: 0 4px 14px rgba(0, 0, 0, .12); }
.order-item .grip { touch-action: none; cursor: grab; width: 36px; height: 36px; display: grid; place-items: center; color: var(--muted); font-size: 18px; user-select: none; -webkit-user-select: none; }
.order-item .order-no { width: 1.6em; text-align: right; color: var(--muted); font-size: 13px; }
.order-item .order-name { flex: 1; font-size: 15px; }
.order-btn { all: unset; cursor: pointer; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.order-btn:active { background: #e9e5e0; }
.order-btn:disabled { opacity: .3; cursor: default; }
.order-unit { font: inherit; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; }
.row-end .btn.primary { width: auto; }

/* 公告點開的內文、地址 */
.notice-detail { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 2px; }
.notice-body { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; line-height: 1.65; color: var(--text); }
.notice-body a { color: var(--brand); text-decoration: underline; word-break: break-all; }
.notice-address { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.notice-address .btn { flex: none; }
.notice-more { color: var(--brand); font-weight: var(--w-ui); }
button.notice-edit { all: unset; cursor: pointer; margin-left: auto; color: var(--brand); font-weight: var(--w-ui); }
details.day-note { display: block; }
details.day-note::before { display: none; }
details.day-note summary { display: flex; gap: 8px; align-items: baseline; cursor: pointer; list-style: none; }
details.day-note summary::-webkit-details-marker { display: none; }
details.day-note summary::before { content: '›'; color: var(--notice); transition: transform .15s; }
details.day-note[open] summary::before { transform: rotate(90deg); }
details.day-note summary small { color: var(--muted); margin-left: auto; white-space: nowrap; font-size: 12px; }

/* 設定頁：每日備份 */
.backup-checks li { padding: 3px 0; }
.backup-checks li.ok { color: var(--ok); }
.backup-checks small { color: var(--muted); }
.backup-runs { margin-top: 12px; font-size: 13.5px; }
.backup-runs li { padding: 6px 0; border-top: 1px solid var(--line); word-break: break-word; }
.backup-runs li.warn { color: #8a3a00; }
.backup-actions { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
#backup-card .btn:disabled { opacity: .4; cursor: default; }

/* 排休頁（內建班表）：日曆點一下選休、撞到禁止同休的格子是橘色 */
:root { --clash: #b45309; --clash-bg: #fde7c8; }
.roster-phase { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: #f6f4f1; font-size: 14.5px; line-height: 1.55; }
.roster-phase.ok { background: var(--on-bg); color: var(--on); }
.roster-phase.warn { background: var(--leave-bg); color: var(--leave); }
.roster-manage { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.roster-manage input:not([type]) { flex: 1; min-width: 10em; }
.roster-window { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.roster-window input { -webkit-appearance: none; appearance: none; }
.roster-window input { width: 100%; min-width: 0; }
.roster-count { font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin-top: 12px; max-width: 560px; }
@media (min-width: 900px) { .roster-window { max-width: 560px; } }
.cal-wd { text-align: center; font-size: 12px; color: var(--muted); padding-bottom: 2px; }
.cal-wd.wk { color: #b3261e; }
.cal-day { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 52px; border-radius: 10px; background: #f9f8f6; transition: background .15s, transform .1s; }
.cal-day:active:not(:disabled) { transform: scale(.95); }
.cal-day .n { font-size: 15px; font-weight: var(--w-ui); }
.cal-day.wk .n { color: #b3261e; }
.cal-day .m { font-size: 12px; min-height: 1.2em; font-weight: var(--w-ui); }
.cal-day.off { background: var(--off-bg); color: var(--off); }
.cal-day.annual { background: var(--leave-bg); color: var(--leave); }
.cal-day.clash { background: var(--clash-bg); color: var(--clash); box-shadow: inset 0 0 0 2px var(--clash); }
.cal-day.none { background: repeating-linear-gradient(135deg, #f6f5f3 0 4px, #fff 4px 8px); color: transparent; }
.cal-day:disabled { cursor: default; }
.pick-sheet { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .35); display: flex; align-items: flex-end; justify-content: center; }
.pick-panel { width: 100%; max-width: 480px; background: #fff; border-radius: 18px 18px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.pick-panel h3 { margin: 0; font-size: 17px; }
.pick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pick { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 4px; border-radius: 12px; border: 1px solid var(--line); }
.pick strong { font-size: 20px; }
.pick span { font-size: 12.5px; color: var(--muted); }
.pick.on { border-color: var(--brand); background: #f6eced; color: var(--brand); }
.pick.work strong { color: var(--on); }
@media (min-width: 700px) { .pick-sheet { align-items: center; } .pick-panel { border-radius: 18px; } }
.clash-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; margin-top: 12px; border-radius: 12px; background: #fffaf2; border: 1px solid #f3dcb5; }
.clash-card textarea { width: 100%; box-sizing: border-box; }
.clash-talk { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.clash-talk li { display: flex; flex-direction: column; gap: 2px; font-size: 14.5px; padding: 8px 10px; background: #fff; border-radius: 10px; }
.clash-talk li small { color: var(--muted); font-size: 12px; }
.clash-talk li.insist { border-left: 3px solid var(--danger); }
.clash-talk li.yield, .clash-talk li.decide { border-left: 3px solid var(--on); }
.clash-decide { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 10px; border-top: 1px dashed #f3dcb5; }
.clash-decide small { color: var(--muted); }
.sched.roster td.tap { cursor: pointer; }
.sched.roster td.tap:active { filter: brightness(.94); }
.sched td.clash { background: var(--clash-bg); color: var(--clash); font-weight: var(--w-ui); box-shadow: inset 0 0 0 2px var(--clash); }
.sched tr.sum td { background: transparent; font-size: 12px; color: var(--muted); }
.legend i.clash { background: var(--clash-bg); box-shadow: inset 0 0 0 2px var(--clash); }
.group-row { padding: 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.group-row.archived { opacity: .55; }
.group-pick { display: flex; flex-wrap: wrap; gap: 6px 14px; }

/* 請假頁 */
.leave-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; margin-top: 10px; border-radius: 12px; background: #f9f8f6; border: 1px solid transparent; }
.leave-card.focus { border-color: var(--brand); background: #fbf5f5; }
.leave-card.cancelled { opacity: .55; }
.leave-when { font-size: 14.5px; color: var(--muted); }
.leave-reason { font-size: 15px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.leave-proof { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.leave-proof small { color: var(--muted); font-size: 13px; }
.leave-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.leave-tools input:not([type]) { flex: 1; min-width: 10em; }
.leave-card .row input:not([type]) { flex: 1; min-width: 10em; }
.pill.ok { background: var(--on-bg); color: var(--on); }
.proof-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.proof-thumbs img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.table-wrap { overflow-x: auto; margin-top: 10px; }
.leave-stats { border-collapse: collapse; width: 100%; font-size: 14px; }
.leave-stats th, .leave-stats td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.leave-stats thead th { color: var(--muted); font-weight: var(--w-ui); border-top: none; white-space: nowrap; }
.leave-stats tbody th { white-space: nowrap; font-weight: var(--w-ui); }
#ask .form textarea, #ask .form select { width: 100%; box-sizing: border-box; }
.proof-rule { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.proof-rule .tag { margin-left: 6px; }
.leave-review { display: grid; gap: 8px; }
.proof-rule:first-child { border-top: none; }
.proof-rule select { max-width: 100%; }
.proof-rule .days-input { width: 64px; }
.proof-rule.dim { opacity: .55; }
/* 不能改的欄位（例如轉交時的標題、類型、份量）：灰底，一看就知道是固定的 */
.form input:disabled, .form select:disabled, .form textarea:disabled { background: var(--bg); color: var(--muted); }
.segmented input:disabled + span { opacity: .6; }
.segmented:has(input:disabled) { background: var(--bg); }

/* 排休的申請與規則（EC 2026-10-15）：虛線＝送了申請等同意；紅字日期＝國定假日 */
.cal-day.pending { box-shadow: inset 0 0 0 2px var(--leave); border: 0; background: repeating-linear-gradient(135deg, #fbf3f4 0 6px, #fff 6px 12px); color: var(--leave); }
.sched td.pending { background: repeating-linear-gradient(135deg, #fbf3f4 0 6px, #fff 6px 12px); color: var(--leave); font-weight: var(--w-ui); }
.legend i.pending { background: repeating-linear-gradient(135deg, #fbf3f4 0 6px, #fff 6px 12px); color: var(--leave); }
#mine .roster-count { white-space: normal; margin: 4px 0 8px; }
.rules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 16px; }
.rules-grid input { width: 100%; }
.holiday-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.holiday-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.holiday-row > input:first-child { flex: 1 1 140px; min-width: 0; }
.holiday-row input[type=number] { width: 60px; }
#rules .row input { flex: 1 1 200px; min-width: 0; }
.red-staff { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; margin: 8px 0; }

/* 需關注事項：紅色要立刻處理、黃色要留意 */
/* 需關注事項：跟任務卡片同一套 A 清爽留白（EC 2026-10-27），紅黃用小圓點分 */
.attention { list-style: none; padding: 0; margin: 12px 0 8px; display: flex; flex-direction: column; gap: 10px; }
.att { background: #fff; border-radius: 16px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(60,40,30,.06), 0 4px 14px rgba(60,40,30,.05); line-height: 1.5; }
.att-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.att-level { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: var(--w-ui); color: #8a5a00; }
.att-level::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #e9b949; }
.att.red .att-level { color: var(--danger); }
.att.red .att-level::before { background: var(--danger); }
.att-title { display: block; font-size: 17px; line-height: 1.4; margin: 6px 0 6px; font-weight: var(--w-strong); color: var(--text); text-decoration: none; }
.att.red .att-title { color: var(--danger); }
.att-meta { font-size: 13px; color: var(--muted); }
.pill.att-red { background: var(--danger); color: #fff; }
.pill.att-yellow { background: #fff1c2; color: #7a5a00; }

/* 總覽頁：準時綠、晚交橘、逾期紅（顏色只當輔助，旁邊一定有文字件數） */
:root { --ov-on: #2e7d4f; --ov-late: #d98a1f; --ov-over: var(--danger); --ov-soft: #faf8f5; }
.ov-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.ov-head h2 { margin: 0; }
.ov-note { margin: 12px 0 0; }
.ov-empty { text-align: center; padding: 18px 0 8px; }
.ov-ring { --p: 0deg; flex: 0 0 auto; width: 128px; height: 128px; border-radius: 50%; background: conic-gradient(var(--ov-on) var(--p), #ece8e2 0); display: grid; place-items: center; }
.ov-ring-in { width: 100px; height: 100px; border-radius: 50%; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ov-ring-in strong { font-size: 26px; line-height: 1.1; }
.ov-ring-in span { font-size: 11.5px; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.ov-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
.ov-rows { list-style: none; padding: 0; margin: 0; }
.ov-rows li { padding: 10px 0; border-top: 1px solid #f0ede8; }
.ov-rows li:first-child { border-top: 0; padding-top: 2px; }
.ov-row-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ov-label { font-weight: var(--w-strong); }
.ov-big { font-size: 20px; font-weight: var(--w-strong); }
.ov-bar { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; background: #ece8e2; margin: 6px 0 4px; }
.ov-bar span { display: block; height: 100%; flex-basis: 0; }
.ov-bar .on, .ov-legend .on { background: var(--ov-on); }
.ov-bar .late, .ov-legend .late { background: var(--ov-late); }
.ov-bar .over, .ov-legend .over { background: var(--ov-over); }
.ov-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.ov-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ov-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ov-av { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; color: #fff; display: inline-grid; place-items: center; font-size: 14px; font-weight: var(--w-strong); }
.ov-who { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.ov-list { display: flex; flex-direction: column; gap: 8px; }
.ov-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: #fdf1ef; color: var(--text); text-decoration: none; }
.ov-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.45; }
.ov-item-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-days { flex: 0 0 auto; background: var(--danger); color: #fff; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: var(--w-ui); }
.ov-pairs { list-style: none; padding: 0; margin: 0; }
.ov-pairs li { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid #f0ede8; }
.ov-pairs li:first-child { border-top: 0; }
.ov-arrow { font-size: 16px; }
.ov-chips { margin-left: auto; display: inline-flex; gap: 6px; }
.ov-chip { background: var(--ov-soft); border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: var(--w-ui); white-space: nowrap; }
.ov-chip.red { background: #fdecea; color: var(--danger); }
.ov-trees { display: flex; flex-direction: column; gap: 10px; }
.ov-tree { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--card); }
.ov-tree.late { border-color: #f0c9c6; }
.ov-tree summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.ov-tree summary::-webkit-details-marker { display: none; }
.ov-tree summary::after { content: '›'; color: var(--muted); font-size: 20px; transition: transform .15s; }
.ov-tree[open] summary::after { transform: rotate(90deg); }
.ov-pct { font-weight: var(--w-strong); }
.ov-progress { height: 6px; border-radius: 3px; background: #ece8e2; margin: 10px 0 8px; overflow: hidden; }
.ov-progress-fill { display: block; height: 100%; background: var(--ov-on); border-radius: 3px; }
.ov-tree.late .ov-progress-fill { background: var(--ov-over); }
.ov-tree-kids { list-style: none; margin: 8px 0 0; padding: 0 0 0 14px; border-left: 2px solid #ece8e2; }
.ov-tree-kids li { margin: 6px 0; }
.ov-node { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--ov-soft); color: var(--text); text-decoration: none; }
.ov-node-title { font-weight: var(--w-ui); }
.ov-node-top { display: flex; align-items: center; gap: 10px; }
.ov-node .ov-av { width: 26px; height: 26px; font-size: 12.5px; }
.ov-node .tags { margin-top: 4px; }
@media (max-width: 380px) { .ov-ring { width: 110px; height: 110px; } .ov-ring-in { width: 86px; height: 86px; } .ov-ring-in strong { font-size: 22px; } }
@media (min-width: 900px) {
  .page.ov-page { max-width: 1100px; }
  .ov-grid { grid-template-columns: 1fr 1fr; align-items: start; }
}
.ov-date { color: var(--muted); }
/* 總覽：圓環＋小標籤、每月小圓環 */
.ov-ring.brand { background: conic-gradient(var(--brand) var(--p), #ece8e2 0); }
.ov-rings { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ov-ring-box { display: flex; justify-content: center; background: var(--ov-soft); border-radius: 14px; padding: 14px 0; }
.ov-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ov-pill { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--ov-soft); border-radius: 999px; padding: 8px 10px; color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: var(--w-ui); white-space: nowrap; }
.ov-pill strong { font-size: 17px; color: var(--text); }
.ov-pill.red { background: #fdecea; } .ov-pill.red strong { color: var(--danger); }
.ov-pill.yellow { background: #fff6dc; } .ov-pill.yellow strong { color: #8a6200; }
.ov-month-rings { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.ov-month { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.ov-ring.small { width: 88px; height: 88px; margin-bottom: 4px; }
.ov-ring.small .ov-ring-in { width: 68px; height: 68px; }
.ov-ring.small .ov-ring-in strong { font-size: 18px; }
/* 總覽：三個圓環（第三個是上個月，灰色） */
.ov-ring.gray { background: conic-gradient(#8b8178 var(--p), #ece8e2 0); }
.ov-rings.n3 { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ov-rings.n3 .ov-ring { width: 96px; height: 96px; }
.ov-rings.n3 .ov-ring-in { width: 74px; height: 74px; }
.ov-rings.n3 .ov-ring-in strong { font-size: 19px; }
.ov-rings.n3 .ov-ring-in span { font-size: 11px; }
.ov-rings.n3 .ov-ring-box { padding: 12px 0; }

/* 例行任務：首頁「今天要做的事」、例行事項管理頁 */
.routine-card h2 { margin: 0; }
.routine-count { font-size: 20px; font-weight: var(--w-strong); color: var(--brand); }
.routine-progress { display: flex; align-items: center; gap: 10px; margin: 8px 0 4px; }
.routine-list { display: flex; flex-direction: column; }
.routine-item { padding: 12px 2px; border-top: 1px solid var(--line); }
.routine-check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.routine-photo-ask { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 0 36px; padding: 8px 10px; border-radius: 10px; background: var(--notice-bg); color: var(--notice); font-size: 14px; }
.routine-photo-ask button { flex: none; }
.review-photo { display: block; width: 96px; height: 96px; object-fit: cover; border-radius: 8px; margin-top: 4px; }
.routine-check input { width: 24px; height: 24px; margin: 1px 0 0; flex: none; accent-color: var(--brand); }
.routine-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.routine-title { font-size: 16px; }
.routine-item.done .routine-title { color: var(--muted); text-decoration: line-through; }
.routine-time { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 6px; background: #f6eced; color: var(--brand); font-size: 13px; font-weight: var(--w-ui); }
.routine-review { color: var(--muted); }
.routine-review.ok { color: var(--ok); }
.routine-review.bad { color: var(--danger); }
.routine-carry { color: var(--notice); }
.routine-unfinished { margin-bottom: 14px; padding: 10px 12px; border-radius: 12px; background: var(--notice-bg); }
.routine-unfinished h3 { font-size: 15px; margin: 0 0 4px; color: var(--notice); }
.routine-unfinished .routine-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted-link { color: var(--muted); margin: 4px 0 0 36px; padding: 0; font-size: 13px; }
.routine-due { margin-top: 12px; }
.routine-due h3 { font-size: 15px; margin: 0 0 2px; }
.routine-dept { margin-top: 18px; }
/* 打掃和部門例行事項中間空一點（EC 2026-10-20：打掃獨立一區） */
.section-gap { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.dayend-nav { gap: 8px; align-items: center; margin: 8px 0; }
.dayend-close { margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: #faf8f5; }
.dayend-attention { margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: var(--notice-bg); color: var(--notice); }
.dayend-attention h3 { font-size: 15px; margin: 0 0 4px; }
.dayend-dept { margin-top: 10px; }
.dayend-person { padding: 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.dayend-person progress { width: 100%; flex: none; }
.dayend-bad { color: var(--danger); }
.dayend-item { padding: 6px 0 6px 10px; border-left: 3px solid var(--danger); display: flex; flex-direction: column; gap: 2px; }
.dayend-item.done { border-left-color: var(--ok); }
.dayend-item .btn { align-self: flex-start; margin-top: 4px; }
.review-group { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.review-item, .assign-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; }
.review-actions { display: flex; gap: 6px; flex: none; }
.assign-row select { flex: none; max-width: 45%; }
.exempt-picks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 6px 0 10px; }
.check-line { display: flex; align-items: center; gap: 8px; }
.check-line.small { font-size: 14px; color: var(--muted); }
.rule-line { margin: 4px 0 12px; }
.check-line input { width: 20px; height: 20px; flex: none; accent-color: var(--brand); }
.exempt-pick { display: flex; align-items: center; gap: 6px; }
.routine-dept h3 { font-size: 16px; margin: 0 0 4px; }
.routine-tpl { padding: 10px 2px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.routine-tpl.off { opacity: .6; }
.routine-tpl .tags .tag:first-child { margin-left: 0; }
.routine-form { display: flex; flex-direction: column; gap: 12px; padding: 12px; margin: 10px 0; border-radius: 12px; background: #faf8f5; }
.day-picks { display: flex; gap: 6px; flex-wrap: wrap; }
.day-pick { display: inline-flex; }
.day-pick input { position: absolute; opacity: 0; pointer-events: none; }
.day-pick span { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.day-pick input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.day-pick input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

/* 例行事項分組（EC 2026-10-17） */
.tag.group { background: #efe7f6; color: #5b2a86; }
.routine-title .tag.group { margin-left: 6px; vertical-align: 1px; }
.group-box { margin: 6px 0 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #faf9f7; }
.group-box summary { cursor: pointer; }
.group-box p { margin: 8px 0; }
.group-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.rgroup-row { display: flex; align-items: center; gap: 8px; }
.group-name { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.group-no { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.group-actions { display: inline-flex; gap: 4px; margin-left: auto; flex-shrink: 0; }
.group-add { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.group-add input { flex: 1 1 160px; min-width: 0; }
.group-head { display: flex; align-items: center; gap: 8px; padding: 10px 2px 2px; }
.group-head .tag { margin-left: 0; }
.ext-hint { display: block; }

/* ===== 打卡（EC 2026-10-17）：首頁和打卡頁共用 ===== */
.tag.warn { background: var(--leave-bg); color: var(--leave); }
.punch-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.punch-slot { display: flex; flex-direction: column; align-items: center; gap: 2px; background: #faf8f5; border-radius: 12px; padding: 12px 4px; }
.punch-slot span { font-size: 13px; color: var(--muted); }
.punch-slot strong { font-size: 24px; line-height: 1.2; color: var(--muted); }
.punch-slot.done { background: var(--on-bg); }
.punch-slot.done strong { color: var(--on); }
.punch-flags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.punch-flags .tag { margin-left: 0; }
.punch-buttons { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.punch-buttons > .btn { flex: 1 1 0; min-width: 120px; }
.punch-buttons > .btn.small { flex: 0 0 auto; min-width: 0; }
.punch-buttons > input { flex: 1 1 auto; padding: 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; }
.punch-outside { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding: 14px; border-radius: 12px; background: var(--leave-bg); }
.punch-outside p { margin: 0; }
.punch-outside textarea, .punch-fix-row input, .punch-fix-row select, .punch-place-row input { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; background: #fff; }
.punch-photo-row { display: flex; align-items: center; gap: 10px; }
.punch-photo { max-width: 160px; max-height: 160px; border-radius: 10px; object-fit: cover; margin-top: 6px; }
.punch-record { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px dashed var(--line); }
.punch-record.dim { opacity: .55; }
.punch-actions { text-align: right; }
.punch-days, .punch-team { display: flex; flex-direction: column; margin-top: 8px; }
.punch-day, .punch-person { border-top: 1px solid var(--line); padding: 10px 2px; }
.punch-day summary, .punch-person summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; cursor: pointer; list-style: none; }
.punch-day summary::-webkit-details-marker, .punch-person summary::-webkit-details-marker { display: none; }
.punch-date, .punch-name { min-width: 92px; }
.punch-times { font-variant-numeric: tabular-nums; }
.punch-day .punch-flags, .punch-person .punch-flags { margin: 0; flex-basis: 100%; }
.punch-month-nav { display: flex; align-items: center; gap: 8px; }
.punch-month { margin-top: 10px; padding: 10px; border-radius: 12px; background: #faf8f5; }
.punch-month h3 { font-size: 15px; margin: 0 0 4px; }
.punch-total { margin: 4px 0 10px; }
.punch-total strong { font-weight: var(--w-strong); font-size: 18px; }
.punch-fix-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.punch-fix-row .field:nth-child(2) { grid-column: 1 / -1; grid-row: 1; }
.punch-place { padding: 12px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.punch-place .btn { align-self: flex-start; }
.punch-place-row { display: grid; grid-template-columns: 1fr 110px; gap: 8px; }
.punch-howto { padding-left: 20px; margin: 4px 0 8px; }
.punch-howto li { margin-bottom: 2px; }
.punch-actions .muted-link { margin: 0; }
.punch-card a.link-btn, .punch-person .link-btn, .punch-place a.link-btn { color: var(--brand); text-decoration: none; margin-left: 0; }
#fix textarea { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; }

/* ===== 出勤異常（打卡頁）：上面四格數字、下面一人一張卡，點開看哪幾天 =====
   配色是 EC 2026-10-17 選的 A 版「品牌酒紅」：遲到早退金褐、少打卡酒紅、等主管處理灰 */
:root { --anom-time: #8a6a2e; --anom-time-bg: #f6efe0; --anom-miss: var(--brand); --anom-miss-bg: #f6e9ea; --anom-wait: #5b5f66; --anom-wait-bg: #eeeef0; }
.anom-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.anom-head h2 { margin: 0; }
.anom-nav { display: inline-flex; align-items: center; gap: 2px; background: var(--brand); color: #fff; border-radius: 999px; padding: 3px; font-weight: var(--w-ui); font-variant-numeric: tabular-nums; }
.anom-nav span { padding: 0 8px; font-size: 15px; }
.anom-nav-btn { width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.anom-nav-btn:active { background: rgba(255,255,255,.18); }
.anom-stats { margin: 16px 0 14px; }
.anom-stats .stat strong { font-variant-numeric: tabular-nums; }
.anom-stats .stat { background: #faf8f5; border: 1px solid #ece7e1; }
.anom-stats .stat strong { color: var(--muted); }
.anom-stats .stat.bad strong { color: var(--brand); }
.anom-stats .stat.time strong { color: var(--anom-time); }
.anom-list { display: flex; flex-direction: column; gap: 10px; }
.anom-person { background: #faf8f5; border-radius: 14px; border: 1px solid transparent; transition: border-color .15s, background .15s; }
.anom-person[open] { background: var(--card); border-color: var(--line); }
.anom-person summary { display: block; padding: 12px 14px; cursor: pointer; list-style: none; }
.anom-row { display: flex; align-items: center; gap: 12px; }
.anom-person summary::-webkit-details-marker { display: none; }
.anom-avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--brand); color: #fff; font-weight: var(--w-strong); font-size: 17px; }
.anom-avatar.two { font-size: 13px; letter-spacing: 0; }
.anom-who { flex: 1; display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.anom-who small { color: var(--muted); font-size: 13px; }
.anom-total { display: flex; align-items: baseline; gap: 2px; color: var(--brand); }
.anom-total strong { font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.anom-total small { font-size: 13px; }
.anom-chevron { width: 18px; color: var(--muted); font-size: 20px; transition: transform .2s; text-align: center; }
.anom-person[open] .anom-chevron { transform: rotate(90deg); }
.anom-person summary .anom-chips { padding-left: 52px; margin-top: 8px; }
.anom-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.anom-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: var(--w-ui); white-space: nowrap; }
.anom-chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.anom-chip.time { background: var(--anom-time-bg); color: var(--anom-time); }
.anom-chip.miss { background: var(--anom-miss-bg); color: var(--anom-miss); }
.anom-chip.wait { background: var(--anom-wait-bg); color: var(--anom-wait); }
.anom-days { margin: 0 14px 12px 66px; border-left: 2px solid var(--line); }
.anom-day { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 10px 0 10px 16px; }
.anom-day::before { content: ''; position: absolute; left: -6px; top: 17px; width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 2px solid var(--anom-miss); }
.anom-day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.anom-day-time { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.anom-empty { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 22px 12px; border-radius: 14px; background: var(--on-bg); color: var(--on); text-align: center; }
.anom-empty small { color: var(--muted); }
.anom-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.anom-legend span { display: inline-flex; align-items: center; gap: 6px; }
.anom-legend i { width: 10px; height: 10px; border-radius: 50%; }
.anom-legend i.time { background: var(--anom-time); } .anom-legend i.miss { background: var(--anom-miss); } .anom-legend i.wait { background: var(--anom-wait); }
@media (max-width: 480px) { .anom-days { margin-left: 24px; } .anom-person summary .anom-chips { padding-left: 0; } }
.punch-photo-backup { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ===== 人員指標（metrics）：收到速度、準時率、退回次數，只觀察不考核 =====
   圖表顏色：單一數字用品牌酒紅；準時／晚交／逾期沿用總覽頁的綠橘紅（旁邊一定有文字） */
:root { --mx-series: var(--brand); --mx-series-soft: #d9b7bb; --mx-grid: #ece8e2; }
.page.mx-page { max-width: 1100px; }
.mx-page.mx-loading { opacity: .55; transition: opacity .15s; }
.mx-card h2 { margin: 0; }
.mx-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.mx-head select { width: auto; }
.mx-note { margin: 0 0 14px; padding: 10px 12px; border-radius: 12px; background: #f6eced; color: var(--brand); font-size: 14px; line-height: 1.6; }
.mx-label { font-size: 13px; color: var(--muted); font-weight: var(--w-ui); }
.mx-small { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
/* 這個月三個數字 */
.mx-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mx-kpi { background: var(--ov-soft); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mx-kpi-big { font-size: 30px; line-height: 1.15; font-weight: var(--w-strong); color: var(--text); }
.mx-kpi-big.none { color: var(--muted); }
.mx-prev { margin-top: 4px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 6px; }
/* 趨勢圖 */
.mx-trends { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mx-trend { background: var(--ov-soft); border-radius: 14px; padding: 12px 10px 6px; min-width: 0; }
.mx-trend-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 0 4px 4px; }
.mx-chart { display: block; width: 100%; height: auto; overflow: visible; }
.mx-grid { stroke: var(--mx-grid); stroke-width: 1; }
.mx-base { stroke: #cfc9c1; stroke-width: 1; }
.mx-axis { font-size: 10.5px; fill: var(--muted); }
.mx-axis.sel { fill: var(--text); font-weight: var(--w-strong); }
.mx-val { font-size: 12.5px; fill: var(--text); font-weight: var(--w-strong); stroke: var(--ov-soft); stroke-width: 4px; stroke-linejoin: round; paint-order: stroke; }
.mx-line { fill: none; stroke: var(--mx-series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.mx-dot { fill: var(--mx-series); stroke: var(--ov-soft); stroke-width: 2; }
.mx-dot.sel { stroke: #fff; stroke-width: 2.5; }
.mx-col { fill: var(--mx-series-soft); }
.mx-col.sel { fill: var(--mx-series); }
.mx-hit { fill: transparent; cursor: pointer; outline: none; }
.mx-hit:hover, .mx-hit:focus { fill: rgba(126, 24, 34, .06); }
/* 提示框 */
.mx-tip { position: absolute; z-index: 50; pointer-events: none; background: #2b2724; color: #fff; border-radius: 10px; padding: 8px 11px; font-size: 13px; line-height: 1.5; box-shadow: 0 6px 18px rgba(0,0,0,.18); max-width: 240px; }
.mx-tip[hidden] { display: none; }
.mx-tip-head { display: flex; align-items: baseline; gap: 8px; }
.mx-tip-head strong { font-size: 16px; font-weight: var(--w-strong); }
.mx-tip-head span { color: #d8d2cb; }
.mx-tip-row { color: #e9e4de; }
/* 長條（準時／晚交／逾期） */
.mx-bar { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; background: var(--mx-grid); margin: 4px 0 2px; }
.mx-bar span { display: block; height: 100%; flex-basis: 0; }
.mx-bar .on, .mx-legend .on { background: var(--ov-on); }
.mx-bar .late, .mx-legend .late { background: var(--ov-late); }
.mx-bar .over, .mx-legend .over { background: var(--ov-over); }
.mx-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 10px; }
.mx-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mx-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
/* 每個人比較 */
.mx-tabs { grid-template-columns: repeat(3, 1fr); margin: 0 0 6px; }
.mx-rank-sub { margin: 6px 0 8px; }
.mx-rank { display: flex; flex-direction: column; gap: 2px; }
.mx-rank-row { display: grid; grid-template-columns: 64px 1fr 72px; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 10px; cursor: pointer; outline: none; }
.mx-rank-row:hover, .mx-rank-row:focus { background: #f6eced; }
.mx-rank-name { font-weight: var(--w-ui); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-rank-bar .mx-bar { height: 12px; border-radius: 6px; margin: 0; }
.mx-track { height: 12px; border-radius: 6px; background: var(--mx-grid); overflow: hidden; }
.mx-fill { display: block; height: 100%; background: var(--mx-series); border-radius: 0 6px 6px 0; }
.mx-rank-val { text-align: right; font-weight: var(--w-strong); white-space: nowrap; }
/* 每個人的卡片 */
.mx-two { display: grid; grid-template-columns: 1fr; gap: 0 16px; align-items: start; }
.mx-people { display: flex; flex-direction: column; gap: 10px; }
.mx-person { background: #faf8f5; border-radius: 14px; padding: 12px; }
.mx-who { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.mx-av { flex: none; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--brand); color: #fff; font-weight: var(--w-strong); font-size: 16px; }
.mx-av.two { font-size: 12.5px; }
.mx-cells { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mx-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mx-big { font-size: 20px; font-weight: var(--w-strong); line-height: 1.25; color: var(--text); }
.mx-big.none { color: var(--muted); }
.mx-empty { text-align: center; padding: 16px 0 6px; }
.mx-how-box summary { cursor: pointer; font-weight: var(--w-strong); font-size: 16px; }
.mx-how { margin: 10px 0 0; padding-left: 18px; line-height: 1.7; font-size: 14px; }
.mx-how li { margin-bottom: 8px; }
@media (min-width: 900px) {
  .mx-two { grid-template-columns: 1fr 1fr; }
  .mx-two .mx-cells { gap: 8px; }
  .mx-two .mx-big { font-size: 18px; }
}
@media (max-width: 720px) {
  .mx-trends { grid-template-columns: 1fr; gap: 10px; }
}
@media (max-width: 480px) {
  .mx-kpis { grid-template-columns: 1fr; }
  .mx-kpi { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: baseline; }
  .mx-kpi .mx-label, .mx-kpi .mx-bar, .mx-kpi .mx-small, .mx-kpi .mx-prev { grid-column: 1 / -1; }
  .mx-kpi-big { font-size: 26px; }
  .mx-cells { gap: 8px; }
  .mx-big { font-size: 17px; }
  .mx-rank-row { grid-template-columns: 56px 1fr 64px; gap: 8px; }
}

/* ---------- 考核設置（review-settings）：每一類一個可以點開的標題 ---------- */
.rv-section { padding: 0; overflow: hidden; }
.rv-section > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px; }
.rv-section > summary::-webkit-details-marker { display: none; }
.rv-section > summary h2 { margin: 0; font-size: 17px; }
.rv-section > summary p { margin: 2px 0 0; }
.rv-section > summary::after { content: ''; flex: none; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: 0 4px 4px 0; transition: transform .2s; }
.rv-section[open] > summary::after { transform: rotate(225deg); margin: 4px 4px 0 0; }
.rv-section[open] > summary { border-bottom: 1px solid var(--line); }
.rv-count { margin-left: auto; flex: none; font-size: 13px; color: var(--muted); }
.rv-body, .rv-section > .timeline, .rv-section > p { padding: 4px 18px 18px; }
.rv-item { display: flex; flex-direction: column; gap: 8px; padding: 16px 0; border-top: 1px solid var(--line); }
.rv-item:first-child { border-top: 0; }
.rv-item-head { display: flex; align-items: center; gap: 8px; }
.rv-item h3 { margin: 0; font-size: 15.5px; }
.rv-item p { margin: 0; }
.rv-item .inline-form { margin: 4px 0 0; }
.rv-inline { display: flex; align-items: center; gap: 8px; }
.rv-inline > span { white-space: nowrap; }
.rv-inline input { width: 110px; }
.rv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.rv-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rv-field > span { font-size: 13.5px; color: #555; }
.rv-field select, .rv-field input:not([type=checkbox]) { width: 100%; min-width: 0; }
.rv-grid .rv-inline input { width: 100%; min-width: 0; }
.rv-rows { display: flex; flex-direction: column; }
.rv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0; font-size: 14.5px; }
.rv-row input { width: 80px; }
.rv-rules { display: flex; flex-direction: column; gap: 12px; margin-bottom: 10px; }
.rv-rule { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: #fff; }
.rv-rule-head { display: flex; align-items: flex-end; gap: 12px; }
.rv-grow { flex: 1; }

/* 考核待辦（review-team）：責任主管每天確認自己負責的人 */
.rt-section { margin-top: 18px; }
.rt-section > summary { cursor: pointer; list-style: none; }
.rt-section > summary h3 { display: inline; }
.rt-section > summary::before { content: '▸ '; color: var(--muted); }
.rt-section[open] > summary::before { content: '▾ '; }
.rt-section .routine-item small { display: block; margin-top: 4px; line-height: 1.5; }
.rt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.rt-cats { display: flex; flex-direction: column; gap: 6px; }
.rt-cat { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.rt-cat span { display: flex; flex-direction: column; gap: 2px; }
.rt-cat input { margin-top: 4px; }
.rt-scope { display: flex; align-items: center; gap: 6px; margin: 6px 0 2px; color: var(--muted); }
.rt-fallback .small { margin-top: 4px; }
.rt-notice { padding: 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.rt-notice .btn { align-self: flex-start; }
.rt-region-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 8px 0; border-top: 1px solid var(--line); }

/* 考核：計分任務標籤、協調清單 */
.pill.score { background: #e7f0fb; color: #2a5a8f; }
.timeline li .pill { margin-left: 6px; }
.timeline li .form { margin-top: 8px; }
.notice .btn.small { margin-left: 8px; }

/* 任務照片：小圖一排、點開全螢幕 */
.inv-photo-pick .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.photo-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.photo-thumb { position: relative; width: 72px; height: 72px; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #f4f4f4; cursor: pointer; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-x { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; font-size: 12px; line-height: 22px; cursor: pointer; }
.photo-view { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .9); padding: 16px; }
.photo-view img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* 考核：季出勤（人資）、季評價（主管） */
.tag.warn-tag { background: #fff1e6; color: #8a3a00; }
.ra-summary { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 4px; font-size: 14px; font-weight: var(--w-ui); }
.ra-row .row-between { flex-wrap: wrap; }
.ra-row small { display: block; margin-top: 4px; line-height: 1.5; }
.ra-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.ra-num { display: flex; flex-direction: column; align-items: center; padding: 6px 4px; border-radius: 10px; background: #f6f4f1; color: var(--muted); }
.ra-num b { font-size: 18px; font-weight: var(--w-strong); color: var(--text); }
.ra-num.has b { color: #8a3a00; }
.ra-num small { font-size: 12px; margin: 0; }
.ra-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ra-inputs input { width: 100%; }
.ra-awol { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.ra-awol > small { flex-basis: 100%; }
.ra-day { display: flex; align-items: center; gap: 4px; font-size: 15px; }
.ra-confirm { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.rr-person { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; background: none; border: 0; border-top: 1px solid var(--line); text-align: left; color: inherit; font: inherit; cursor: pointer; }
.rr-person:active { background: #f6f4f1; }
.rr-name { margin-top: 12px; }
.rr-item { padding: 12px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.rr-item-head { display: flex; justify-content: space-between; align-items: center; }
.rr-scale > summary { cursor: pointer; }
.rr-scale > div { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; line-height: 1.5; }
.rr-evidence textarea { width: 100%; }
.rr-preview { margin: 12px 0 0; font-weight: var(--w-strong); }
.rr-incident { padding: 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; line-height: 1.5; }
.rr-incident.revoked { color: var(--muted); text-decoration: line-through; }
.rr-revoke { align-self: flex-start; margin-left: 0; }
.rr-add { margin-top: 10px; }
.rr-add > summary { cursor: pointer; color: var(--brand); font-weight: var(--w-ui); }
.rr-add textarea { width: 100%; }
/* 考核申訴（R6） */
.ap-item { display: flex; flex-direction: column; gap: 6px; }
.ap-item.ap-overdue { border: 1.5px solid #e3a49c; border-radius: 12px; padding: 12px; margin: 8px 0; background: #fffafa; }
.ap-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.ap-tags .tag { margin-left: 0; }
.ap-title { font-size: 16px; line-height: 1.45; }
.ap-result-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.ap-result { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 14px; font-weight: var(--w-ui); background: #f1eeea; color: #5c544e; }
.ap-result.bad { background: #fde8e6; color: #b42318; }
.ap-result.warn { background: #fff1e6; color: #8a3a00; }
.ap-result.good { background: #e7f4ec; color: #1e7b45; }
.ap-timeline { list-style: none; margin: 6px 0 0; padding: 0 0 0 4px; }
.ap-step { position: relative; padding: 0 0 12px 20px; border-left: 2px solid var(--line); line-height: 1.55; }
.ap-step:last-child { border-left-color: transparent; padding-bottom: 0; }
.ap-step::before { content: ''; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); }
.ap-step.good::before { background: #1e7b45; }
.ap-step.pending::before { background: var(--card); border: 2px solid #b8aea6; width: 8px; height: 8px; }
.ap-step.pending.bad::before { border-color: #b42318; }
.ap-step.pending.bad small { color: #b42318; }
.ap-step-body { white-space: pre-wrap; }
.ap-item textarea { width: 100%; }
.ap-scores { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ap-help { margin: -4px 0 4px; font-size: 14px; }
.ap-help > summary, .ap-done > summary { cursor: pointer; color: var(--brand); font-weight: var(--w-ui); }
.ap-help ol { margin: 6px 0 0; padding-left: 20px; line-height: 1.6; color: #5c544e; }
.ap-done { margin-top: 18px; }
.ap-done > summary { padding: 8px 0; }

/* ===== 考核分數（我的考核、團隊考核、全公司考核、資格清單；員工考核 R7） ===== */
/* 分數顏色：90 以上綠、70 以上酒紅、60 以上橘、60 以下紅 */
:root { --sc-top: #2e7d4f; --sc-good: #7E1822; --sc-mid: #c26a12; --sc-low: #b3261e; --sc-none: #c9c3bc; --sc-soft: #faf8f5; }
.t-top { color: var(--sc-top); } .t-good { color: var(--sc-good); } .t-mid { color: var(--sc-mid); } .t-low { color: var(--sc-low); } .t-none { color: var(--muted); }
.warn-text { color: #8a3a00; }
.stat.warn { background: #fff1e6; } .stat.warn strong { color: #8a3a00; }
.sc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sc-top h2 { margin: 0; }
.sc-top select, .sc-filter-box select { padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 14px; }
.sc-note { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); line-height: 1.55; }

/* 分數卡 */
.sc-card { margin-top: 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); padding: 18px; box-shadow: 0 2px 10px rgba(60,40,30,.05); }
.sc-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 28px 18px; }
.sc-empty-icon { font-size: 34px; }
.sc-empty p { margin: 6px 0 0; }
.sc-hero { display: flex; align-items: center; gap: 18px; }
.sc-hero-side { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.sc-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.sc-badges .tag { margin-left: 0; font-size: 12.5px; padding: 2px 8px; }
.sc-ring { --p: 0; --c: var(--sc-none); flex-shrink: 0; width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #efebe6 0); }
.sc-ring.b-top { --c: var(--sc-top); } .sc-ring.b-good { --c: var(--sc-good); } .sc-ring.b-mid { --c: var(--sc-mid); } .sc-ring.b-low { --c: var(--sc-low); }
.sc-ring-in { width: 88px; height: 88px; border-radius: 50%; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.sc-ring-in strong { font-size: 30px; line-height: 1.05; color: var(--c); letter-spacing: 0; }
.sc-ring-in span { font-size: 12px; color: var(--muted); }
.sc-formula { margin: 12px 0 0; display: flex; flex-direction: column; gap: 1px; font-size: 14px; background: var(--sc-soft); border-radius: 10px; padding: 8px 12px; }
.sc-formula small { font-size: 12px; }
.sc-rows { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.sc-row { display: flex; flex-direction: column; gap: 5px; }
.sc-row-flat { background: var(--sc-soft); border-radius: 12px; padding: 10px 12px; }
.sc-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sc-row-name .tag { margin-left: 6px; }
.sc-row-top b { font-size: 18px; letter-spacing: 0; white-space: nowrap; }
.sc-row-top b small { font-size: 13px; font-weight: var(--w-text); }
.sc-coef.b-good, .sc-coef.b-top { color: var(--sc-top); } .sc-coef.b-mid { color: var(--sc-mid); } .sc-coef.b-low { color: var(--sc-low); }
.sc-zero { color: var(--muted); }
.sc-bar { height: 8px; border-radius: 999px; background: #efebe6; overflow: hidden; }
.sc-bar i { display: block; height: 100%; border-radius: 999px; background: var(--sc-none); transition: width .4s ease; }
.sc-bar.b-top i { background: var(--sc-top); } .sc-bar.b-good i { background: var(--sc-good); } .sc-bar.b-mid i { background: var(--sc-mid); } .sc-bar.b-low i { background: var(--sc-low); }

/* 明細、資格、歷史 */
.sc-section { margin-top: 22px; }
.sc-section h3, .sc-history h3 { margin: 0 0 6px; font-size: 17px; }
.sc-detail { border: 1px solid var(--line); border-radius: 16px; background: var(--card); padding: 0 14px; }
.sc-items + .sc-items { border-top: 1px solid var(--line); }
.sc-items { padding: 12px 0; }
.sc-items summary { cursor: pointer; display: flex; align-items: center; justify-content: space-between; list-style: none; }
.sc-items summary::-webkit-details-marker { display: none; }
.sc-items summary::after { content: '⌄'; color: var(--muted); margin-left: 8px; }
.sc-items[open] summary::after { content: '⌃'; }
.sc-items summary > span:first-child { flex: 1; }
.sc-count { min-width: 24px; padding: 0 8px; border-radius: 999px; background: #f1eeea; color: #6b635c; font-size: 12.5px; line-height: 22px; text-align: center; }
.sc-list { list-style: none; padding: 0; margin: 6px 0 0; }
.sc-list li { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.sc-list li .tag { margin-left: 0; }
.sc-date { color: var(--muted); font-size: 13px; min-width: 40px; }
.sc-name { flex: 1; min-width: 140px; }
.sc-name .tag { margin-left: 6px; }
.sc-appeal { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.sc-elig-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.sc-elig-card { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.sc-elig-card.ok { border-color: #bfe0cb; background: #f4fbf6; }
.sc-elig-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sc-elig-top > div:first-child { display: flex; flex-direction: column; }
.sc-elig-res { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.sc-elig-res .tag { margin-left: 0; }
.sc-meter { display: flex; flex-direction: column; gap: 3px; }
.sc-history { margin-top: 22px; }
.sc-hist-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.sc-hist { display: flex; flex-direction: column; align-items: stretch; gap: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 10px 12px; cursor: pointer; text-align: left; color: var(--text); font-size: 14px; }
.sc-hist.active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(126,24,34,.12); }
.sc-hist b { font-size: 22px; letter-spacing: 0; line-height: 1.2; }
.sc-hist .sc-bar { height: 5px; }

/* 名單 */
.sc-people { display: flex; flex-direction: column; margin-top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.sc-person { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; color: var(--text); font-size: 15px; cursor: pointer; }
.sc-person:first-child { border-top: 0; }
.sc-person:not(.sc-static):active { background: var(--sc-soft); }
.sc-person.sc-static { cursor: default; }
.sc-person-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sc-person-score { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.sc-person-score b { font-size: 24px; line-height: 1.1; letter-spacing: 0; }
.sc-person-score .tag { margin-left: 0; }
.sc-avatar { flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; font-weight: var(--w-strong); color: #fff; background: var(--sc-none); }
.sc-avatar.b-top, .sc-avatar.s-eligible { background: var(--sc-top); } .sc-avatar.b-good { background: var(--sc-good); } .sc-avatar.b-mid, .sc-avatar.s-insufficient, .sc-avatar.s-extra_missing { background: var(--sc-mid); } .sc-avatar.b-low { background: var(--sc-low); }
.sc-avatar.big { width: 52px; height: 52px; font-size: 22px; }
.sc-avatar.small { width: 26px; height: 26px; font-size: 12px; display: inline-grid; vertical-align: middle; margin-right: 8px; }
.sc-minis { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.sc-mini { display: inline-flex; gap: 3px; align-items: baseline; font-size: 12.5px; background: #f3f0ec; border-radius: 6px; padding: 1px 6px; font-weight: var(--w-ui); }
.sc-mini i { font-style: normal; color: var(--muted); font-weight: var(--w-text); }
.sc-mini.warn-tag { background: #fff1e6; color: #8a3a00; }
.sc-mini.bad { background: #fde8e6; color: #b42318; }
.sc-who { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.sc-who h2 { margin: 0; line-height: 1.2; }

/* 全公司考核：季的狀態、篩選、分布、表格 */
.sc-panel { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.sc-qstate { display: flex; align-items: center; gap: 6px; }
.sc-filter-box { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; padding: 12px 14px; border-radius: 14px; background: var(--sc-soft); }
.sc-filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sc-filter-label { font-size: 13px; color: var(--muted); min-width: 2.5em; }
.sc-chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1; }
.sc-chip-group { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border-radius: 999px; background: #efebe6; }
.sc-chip, .sc-chip-title { border: 1px solid transparent; border-radius: 999px; padding: 5px 12px; font-size: 14px; background: var(--card); color: var(--text); cursor: pointer; }
.sc-chip-title { background: none; color: var(--muted); font-size: 13px; padding: 5px 8px; }
.sc-chip-title.on { color: var(--brand); }
.sc-chip.on { background: var(--brand); color: #fff; }
.sc-chips > .sc-chip { border-color: var(--line); }
.sc-chips > .sc-chip.on { border-color: var(--brand); }
.sc-spread-box { margin-top: 12px; }
.sc-spread { display: flex; gap: 2px; height: 12px; border-radius: 999px; overflow: hidden; background: #efebe6; }
.sc-spread i { display: block; min-width: 6px; }
.sc-spread i.b-top, .sc-legend i.b-top { background: var(--sc-top); } .sc-spread i.b-good, .sc-legend i.b-good { background: var(--sc-good); }
.sc-spread i.b-mid, .sc-legend i.b-mid { background: var(--sc-mid); } .sc-spread i.b-low, .sc-legend i.b-low { background: var(--sc-low); }
.sc-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; font-size: 13px; color: var(--muted); }
.sc-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; }
.sc-legend b { color: var(--text); }
.sc-table { width: 100%; border-collapse: collapse; margin-top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; font-size: 14.5px; }
.sc-table th { text-align: left; font-size: 13px; color: var(--muted); background: var(--sc-soft); padding: 10px 12px; white-space: nowrap; }
.sc-table td { padding: 10px 12px; border-top: 1px solid var(--line); white-space: nowrap; }
.sc-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.sc-table td.num b { font-size: 17px; }
.sc-table td .tag { margin-left: 0; margin-right: 4px; }
.sc-table tbody tr { cursor: pointer; }
.sc-table tbody tr:hover, .sc-table tbody tr:focus { background: #fbf7f4; outline: none; }
.sc-wide { display: none; overflow-x: auto; }
@media (min-width: 760px) { .sc-wide { display: block; } .sc-narrow { display: none; } }

/* 資格清單 */
.sc-rule { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.sc-tally { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.sc-tally-item { display: flex; align-items: baseline; gap: 6px; padding: 6px 12px; border-radius: 12px; background: #f1eeea; font-size: 13.5px; }
.sc-tally-item strong { font-size: 20px; letter-spacing: 0; }
.sc-tally-item.good { background: #e7f4ec; color: #1e7b45; } .sc-tally-item.warn-tag { background: #fff1e6; color: #8a3a00; } .sc-tally-item.bad { background: #fde8e6; color: #b42318; }
.sc-correct { margin-top: 14px; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; background: var(--card); }
.sc-correct summary { cursor: pointer; }
.sc-correct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.sc-date-pick { display: flex; align-items: center; gap: 6px; }
.sc-date-pick input { padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; }
.sc-warn { background: #fff1e6; color: #8a3a00; border-radius: 10px; padding: 8px 12px; }
@media (max-width: 420px) {
  .sc-hero { gap: 14px; }
  .sc-ring { width: 96px; height: 96px; } .sc-ring-in { width: 76px; height: 76px; } .sc-ring-in strong { font-size: 26px; }
}
.att-rule { margin-left: 0; margin-right: 2px; }

/* ===== 考核規則（review-rules，R9）：公布版說明，內容是主機產生的，樣式都在這裡 ===== */
.rr-title { font-size: 20px; margin: 0; }
.rr-pick { margin-top: 10px; }
.rr-preview-flag { background: #fff1e6; color: #8a3a00; border-radius: 10px; padding: 10px 12px; margin: 0 0 16px; font-weight: var(--w-ui); }
.rr-doc { line-height: 1.75; }
.rr-doc h2 { font-size: 18px; color: var(--brand); margin: 28px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.rr-doc h3 { font-size: 16px; margin: 20px 0 6px; }
.rr-doc h4 { font-size: 15px; margin: 16px 0 6px; }
.rr-doc p { margin: 0 0 10px; }
.rr-doc ul { margin: 0 0 10px; padding-left: 1.3em; }
.rr-doc li { margin-bottom: 4px; }
.rr-head { text-align: center; margin-bottom: 18px; }
.rr-head h1 { font-size: 22px; margin: 0 0 4px; }
.rr-sub { color: var(--muted); }
.rr-ver { font-size: 13px; color: var(--muted); }
.rr-box { background: #f7f5f1; border-left: 4px solid var(--brand); border-radius: 8px; padding: 12px 14px; margin: 12px 0; }
.rr-box p:last-child { margin-bottom: 0; }
.rr-box-title { font-weight: var(--w-strong); }
.rr-box.rr-formula { background: #eef3f8; border-left-color: #1f4e79; text-align: center; }
.rr-table-wrap { overflow-x: auto; margin: 8px 0 14px; -webkit-overflow-scrolling: touch; }
.rr-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.rr-table th, .rr-table td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: top; }
.rr-table th { background: #f4f1ec; white-space: nowrap; }
.rr-fig { margin: 14px 0; text-align: center; }
.rr-fig img { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }
.rr-fig figcaption { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.rr-faq dt { font-weight: var(--w-strong); margin-top: 12px; }
.rr-faq dd { margin: 4px 0 0; }
.rr-end { margin-top: 22px; text-align: center; color: var(--muted); }

/* 列印：只印規則內容（上方選單、版本選擇、發布區塊都不印），表格和圖不要被切成兩半 */
@media print {
  body { background: #fff; }
  .topbar, .tabbar, #nav, #bar, #publish, .toast { display: none !important; }
  .page { max-width: none; padding: 0; }
  .card { box-shadow: none; border-radius: 0; padding: 0; margin: 0; }
  .rr-preview-flag { border: 1px solid #8a3a00; }
  .rr-doc h2 { break-after: avoid; }
  .rr-table-wrap { overflow: visible; }
  .rr-table, .rr-fig, .rr-box, .rr-faq dd { break-inside: avoid; }
  .rr-fig img { max-height: 9cm; width: auto; }
}

/* 會議紀錄：內容可以粗體和 5 種顏色（黑色就是沒有顏色） */
.mc-red { color: #c62828; }
.mc-blue { color: #1565c0; }
.mc-green { color: #2e7d32; }
.mc-orange { color: #e65100; }
.mc-black { color: var(--text); }
.mt-search { width: 100%; margin: 8px 0 0; }
/* 清單：左邊日期塊、右邊標題和狀態，還沒收到的右上角紅點 */
.list:has(.mt-row) { gap: 10px; margin-top: 12px; }
.list-item.mt-row { display: flex; gap: 14px; align-items: flex-start; position: relative; color: inherit; text-decoration: none; border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #fff; transition: box-shadow .15s, transform .1s; }
.list-item.mt-row:hover { box-shadow: 0 3px 12px rgba(60,40,30,.08); }
.list-item.mt-row:active { transform: scale(.99); background: #fff; }
.list-item.mt-row.mt-todo { border-color: #ecd3d5; background: #fffafa; }
.mt-date { flex: 0 0 52px; display: flex; flex-direction: column; align-items: center; padding: 6px 0; border-radius: 10px; background: #f6efea; color: #6b4f45; line-height: 1.2; }
.mt-date strong { font-size: 22px; color: var(--text); }
.mt-date-m, .mt-date-w { font-size: 12px; }
.mt-todo .mt-date { background: var(--brand); color: #f6dfe1; }
.mt-todo .mt-date strong { color: #fff; }
.mt-row-main { flex: 1; min-width: 0; }
.mt-row-title { display: block; font-size: 16px; line-height: 1.4; }
.mt-row-sub { font-size: 13px; margin-top: 2px; }
.mt-row .tags { margin-top: 8px; gap: 6px; }
.mt-row .tags .tag { margin-left: 0; }
.mt-dot { position: absolute; top: 12px; right: 12px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); }
/* 看一份：酒紅頁首放標題、時間、誰的會；收到了／收到進度固定在最下面 */
.mt-card { padding: 0; overflow: hidden; }
.mt-head { position: relative; padding: 20px 18px 16px; background: linear-gradient(135deg, var(--brand), #a3343f); color: #fff; }
.mt-head-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.mt-head-tags .tag { margin-left: 0; background: rgba(255,255,255,.18); color: #fff; }
.mt-head-tags .tag.bad, .mt-head-tags .tag.warn { background: #ffe7b8; color: #7a4b00; }
.mt-head-tags .tag.good { background: #dff3e6; color: #1e7b45; }
.mt-card h2 { margin: 0; font-size: 22px; line-height: 1.4; color: #fff; }
.mt-when { margin-top: 6px; color: #f3d9dc; font-size: 14.5px; }
.mt-tools { display: flex; gap: 8px; margin-top: 14px; }
.mt-tools .btn { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.4); }
.mt-infos { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.22); font-size: 14.5px; }
.mt-info { display: grid; grid-template-columns: 4.5em 1fr; gap: 10px; align-items: baseline; }
.mt-label { color: #f0c9cd; font-size: 13.5px; }
.mt-people { display: flex; flex-wrap: wrap; gap: 6px; }
.mt-person { background: rgba(255,255,255,.16); border-radius: 999px; padding: 1px 10px; font-size: 14px; }
.mt-infos .muted { color: #f0c9cd; }
.mt-paper, .mt-photos, .mt-foot { margin-left: 18px; margin-right: 18px; }
.mt-paper { padding: 6px 0 4px; }
.mt-content { margin: 14px 0 6px; font-size: 16px; line-height: 1.8; word-break: break-word; }
.mt-content p { margin: 0; min-height: 1.8em; white-space: pre-wrap; }
.mt-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; margin-bottom: 4px; }
.mt-photo { aspect-ratio: 1; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #f4f4f4; cursor: pointer; }
.mt-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (min-width: 700px) { .mt-photos { grid-template-columns: repeat(4, 1fr); } }
.mt-foot { margin-top: 10px; margin-bottom: 18px; }
.mt-ack, .mt-dock { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: min(100%, 720px); z-index: 6; background: #fff; border-radius: 16px 16px 0 0; box-shadow: 0 -6px 24px rgba(60,40,30,.14); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
.mt-ack { text-align: center; }
.mt-ack p { margin: 0 0 8px; font-size: 13px; }
.mt-ack .btn { width: 100%; }
.mt-ack.done { position: static; transform: none; width: auto; margin: 0 18px 18px; padding: 14px; box-shadow: none; border: 1px solid #cfe8d8; border-radius: 12px; display: flex; justify-content: center; align-items: baseline; gap: 10px; flex-wrap: wrap; background: #eef8f1; color: #1e7b45; }
.mt-dock { display: flex; align-items: center; gap: 12px; }
.mt-dock strong { white-space: nowrap; }
.mt-dock .mt-bar { flex: 1; margin: 0; }
.mt-dock a { white-space: nowrap; color: var(--brand); font-weight: var(--w-ui); text-decoration: none; }
body.mt-docked .page { padding-bottom: 130px; }
@media (max-width: 700px) {
  body.has-tabbar .mt-ack, body.has-tabbar .mt-dock { bottom: calc(66px + max(6px, env(safe-area-inset-bottom) - 18px)); padding-bottom: 12px; border-radius: 16px 16px 0 0; }
  body.has-tabbar.mt-docked .page { padding-bottom: 130px; }
}
.mt-changed { color: #8a3a00; font-weight: var(--w-ui); }
/* 第一版審核（EC 2026-10-20）：審核人、備註 */
.mt-draft-note { margin: 12px 18px 0; padding: 10px 12px; border-radius: 10px; background: var(--notice-bg); color: var(--notice); }
.mt-review h3 { margin: 0; font-size: 17px; }
.mt-review h4 { margin: 16px 0 8px; font-size: 15px; font-weight: var(--w-strong); }
.mt-reviewers li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mt-notes { display: grid; gap: 8px; }
.mt-note { padding: 10px 12px; border-radius: 12px; background: #f6f3ef; }
.mt-note.mine { background: #f8eced; }
.mt-note-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.mt-note-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.mt-note-add { display: grid; gap: 8px; margin-top: 10px; }
.mt-note-add .btn { justify-self: end; }
.mt-asks { scroll-margin-top: 80px; }
.mt-asks > p.small { margin: 6px 0 10px; }
.mt-note.resolved .mt-ask-reply .mt-note-text { color: inherit; }
.mt-ask-reply { display: grid; gap: 6px; margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--on-bg); justify-items: start; }
.mt-ack .btn:disabled { opacity: .4; cursor: default; }
/* 誰看過了：進度條＋三格數字，名單在下面 */
.mt-status h3 { margin: 0; font-size: 17px; }
.mt-bar { height: 8px; margin: 14px 0 12px; border-radius: 999px; background: #efe9e4; overflow: hidden; }
.mt-bar-fill { display: block; height: 100%; border-radius: 999px; background: #2e9a5b; }
.mt-bar-fill.w0 { width: 0%; }
.mt-bar-fill.w5 { width: 5%; }
.mt-bar-fill.w10 { width: 10%; }
.mt-bar-fill.w15 { width: 15%; }
.mt-bar-fill.w20 { width: 20%; }
.mt-bar-fill.w25 { width: 25%; }
.mt-bar-fill.w30 { width: 30%; }
.mt-bar-fill.w35 { width: 35%; }
.mt-bar-fill.w40 { width: 40%; }
.mt-bar-fill.w45 { width: 45%; }
.mt-bar-fill.w50 { width: 50%; }
.mt-bar-fill.w55 { width: 55%; }
.mt-bar-fill.w60 { width: 60%; }
.mt-bar-fill.w65 { width: 65%; }
.mt-bar-fill.w70 { width: 70%; }
.mt-bar-fill.w75 { width: 75%; }
.mt-bar-fill.w80 { width: 80%; }
.mt-bar-fill.w85 { width: 85%; }
.mt-bar-fill.w90 { width: 90%; }
.mt-bar-fill.w95 { width: 95%; }
.mt-bar-fill.w100 { width: 100%; }
.mt-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 6px; }
.mt-stat { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; border-radius: 12px; font-size: 13px; }
.mt-stat strong { font-size: 22px; line-height: 1.2; }
.mt-stat.good { background: #eef8f1; color: #1e7b45; }
.mt-stat.warn { background: #fff6e5; color: #8a5a00; }
.mt-stat.bad { background: #fdeeed; color: var(--danger); }
.mt-group { border-top: 1px solid var(--line); padding: 8px 0; margin-top: 6px; }
.mt-group summary { cursor: pointer; padding: 4px 0; font-weight: var(--w-ui); }
.mt-group.good summary { color: #1e7b45; }
.mt-group.warn summary { color: #8a5a00; }
.mt-group.bad summary { color: var(--danger); }
.mt-group li { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
/* 寫會議紀錄：分成 4 塊 */
.mt-form { gap: 14px; }
.mt-part { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.mt-part legend { display: flex; align-items: center; gap: 8px; padding: 0 6px; font-weight: var(--w-strong); font-size: 15px; }
.mt-step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12.5px; }
.mt-two { display: grid; grid-template-columns: 1fr; gap: 14px; }
.mt-two > * { min-width: 0; }
.mt-two input, .mt-two select { width: 100%; }
@media (min-width: 640px) { .mt-two { grid-template-columns: 1fr 1fr; } }
.mt-actions { display: flex; flex-direction: column; gap: 6px; }
.mt-actions .error-text { margin: 0; min-height: 0; }
.mt-actions p { margin: 0; }
.chip-picker { display: flex; flex-direction: column; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip-add { width: 100%; }
.rich { display: flex; flex-direction: column; gap: 6px; }
.rt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: #faf8f5; }
.rt-btn { font: inherit; display: inline-flex; align-items: center; gap: 4px; min-width: 40px; height: 36px; justify-content: center; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font-size: 14px; }
.rt-btn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.rt-bold { font-weight: var(--w-strong); font-size: 16px; }
.rt-dot { width: 12px; height: 12px; border-radius: 50%; background: currentColor; }
.rt-color.mc-black .rt-dot { background: var(--text); }
.rt-sep { width: 1px; height: 24px; background: var(--line); margin: 0 2px; }
.rich-area { min-height: 220px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 16px; line-height: 1.75; outline: none; word-break: break-word; -webkit-user-select: text; user-select: text; }
.rich-area:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(126,24,34,.12); }
@media (max-width: 480px) {
  .rt-bar { gap: 4px; padding: 5px; }
  .rt-btn { min-width: 0; padding: 0 7px; gap: 3px; height: 34px; }
  .rt-sep { margin: 0; }
}
/* 會議分類：像資料夾一排，可以左右滑 */
.mt-folders { display: flex; gap: 8px; margin: 12px -4px 2px; padding: 2px 4px 6px; overflow-x: auto; scrollbar-width: none; }
.mt-folders::-webkit-scrollbar { display: none; }
.mt-folders:empty { display: none; }
.mt-folder { font: inherit; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--text); cursor: pointer; font-size: 14.5px; font-weight: var(--w-ui); }
.mt-folder.on { border-color: var(--brand); background: #fbf1f2; color: var(--brand); }
.mt-folder-n { min-width: 20px; padding: 0 6px; border-radius: 999px; background: #f1eeea; color: #6b635c; font-size: 12px; line-height: 20px; text-align: center; }
.mt-folder.on .mt-folder-n { background: var(--brand); color: #fff; }
.mt-folder-edit { color: var(--muted); border-style: dashed; }
.mt-group-head { display: flex; justify-content: space-between; align-items: baseline; margin: 10px 2px 0; font-size: 14px; font-weight: var(--w-strong); color: #5c544e; }
.mt-group-head:first-child { margin-top: 0; }
.mt-cat-row { display: flex; gap: 6px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.mt-cat-row input { flex: 1; min-width: 0; padding: 8px 10px; }
.mt-cat-row.off input { color: var(--muted); background: #f3f3f3; }
/* 會議紀錄：選字留備註（EC 2026-10-20 選 A）：標的字黃底、後面一個小編號，點一下看備註 */
.mt-content .mk-mark { background: #ffe58a; border-bottom: 2px solid #e0a800; border-radius: 2px; cursor: pointer; }
.mt-content .mk-mark.done { background: #f3efe2; border-bottom-color: #cbbf98; }
.mt-content .mk-mark[data-n]::after { content: attr(data-n); display: inline-block; min-width: 18px; height: 18px; line-height: 18px; margin-left: 3px; border-radius: 9px; background: #e0a800; color: #fff; font-size: 11px; font-weight: var(--w-ui); text-align: center; vertical-align: super; }
.mt-content .mk-mark.done[data-n]::after { background: #b5a978; }
.mk-pop { position: absolute; z-index: 20; border: 0; border-radius: 10px; padding: 10px 14px; background: #2b2724; color: #fff; font: inherit; font-size: 15px; font-weight: var(--w-ui); box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.mk-card, .mk-form { margin: 8px 0 12px; padding: 10px 12px; border-radius: 12px; background: #fff8dc; border: 1px solid #f0d77a; font-size: 14.5px; }
.mk-form { display: grid; gap: 8px; }
.mk-q { color: #8a6d00; font-size: 13px; margin-bottom: 4px; overflow-wrap: anywhere; }
.mk-one + .mk-one { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #f0d77a; }
.mk-who { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.mk-act { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.mk-act:empty { display: none; }
.mk-hint { margin: 4px 0 0; color: #8a6d00; }
.mk-quote { display: block; margin: 0 0 4px; padding: 0; border: 0; background: none; color: #8a6d00; font: inherit; text-align: left; cursor: pointer; }
.mk-note-foot { margin-top: 6px; }
.mt-note.resolved .mt-note-text { color: #8a837c; }
/* 佈告欄（EC 2026-10-20）：發公告選「選店、部門或人」才出現選擇區；首頁即將到來的公告整則可以點 */
.bl-pick { display: grid; gap: 10px; margin-top: 10px; padding: 12px; border-radius: 12px; background: #f6f3ef; }
a.notice.bl-home { display: block; color: inherit; text-decoration: none; }
/* 兩欄的日期框在 iPhone 上不要撐破畫面 */
.two > * { min-width: 0; }
.two input[type=date] { min-width: 0; }
/* 佈告欄：要簽名同意的公告（EC 2026-10-22）。簽名框在內容下面，手指寫字不要捲動頁面 */
.bl-sign-card { margin: 0 18px 18px; padding: 14px; border: 1px solid #f0d77a; border-radius: 14px; background: #fffbea; display: grid; gap: 10px; }
.bl-sign-card h3 { margin: 0; font-size: 17px; }
.bl-sign-card p { margin: 0; }
.bl-sign { display: grid; gap: 8px; }
.bl-sign .btn { justify-self: end; }
.bl-sign-box { position: relative; }
.bl-sign-pad { display: block; width: 100%; height: auto; aspect-ratio: 5 / 2; background: #fff; border: 1.5px dashed #c9b26a; border-radius: 12px; touch-action: none; cursor: crosshair; }
.bl-sign-hint { position: absolute; left: 14px; bottom: 10px; color: #b9ad8a; font-size: 13px; pointer-events: none; }
.bl-sign-law { color: #6b5a2a; }
.bl-signed { margin: 0 18px 18px; padding: 14px; border: 1px solid #cfe8d8; border-radius: 12px; background: #eef8f1; color: #1e7b45; display: grid; gap: 4px; justify-items: start; }
.bl-sign-view { width: 200px; height: 80px; background: #fff; border-radius: 8px; border: 1px solid #cfe8d8; }
.bl-sign-mini { width: 120px; height: 48px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }

/* ===== SOP 區（EC 2026-10-23）：搜尋放最上面，內容一塊一塊 ===== */
:root { --sop-warn: #9a4a00; --sop-warn-bg: #fff4e5; --sop-warn-line: #f2c48d; --sop-tip: #1f6b45; --sop-tip-bg: #eaf6ef; --sop-tip-line: #a9d8bd; }
.sop-search { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; }
.sop-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(126,24,34,.12); }
.sop-search input { flex: 1; min-width: 0; border: none; padding: 13px 0; font-size: 16px; background: transparent; box-shadow: none; }
.sop-search input:focus { box-shadow: none; }
.sop-search-ic { font-size: 17px; }
.sop-row-ic { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #f6eced; font-size: 20px; }
.sop-snippet { margin-top: 4px; font-size: 14px; line-height: 1.6; color: #5c544e; }
.sop-row mark, .sop-body mark { background: #ffe58a; color: inherit; border-radius: 2px; padding: 0 1px; }
.sop-hits { margin: 2px 2px 0; }
.sop-toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 18px 0; padding: 10px 12px; border-radius: 12px; background: #faf8f5; }
.sop-toc a { padding: 3px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--text); font-size: 14px; text-decoration: none; }
.sop-body { margin: 6px 18px 4px; font-size: 16px; line-height: 1.8; word-break: break-word; }
.sop-body > * { margin: 12px 0; }
.sop-body .mt-content { margin: 8px 0; }
.sop-h { margin: 22px 0 6px; padding-left: 10px; border-left: 4px solid var(--brand); font-size: 18px; line-height: 1.4; scroll-margin-top: 70px; }
.sop-body > .sop-h:first-child { margin-top: 14px; }
.sop-steps { list-style: none; counter-reset: step; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sop-steps li { counter-increment: step; display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.sop-steps li::before { content: counter(step); flex: none; width: 26px; height: 26px; margin-top: 1px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 14px; font-weight: var(--w-strong); line-height: 1; }
.sop-list { padding-left: 1.3em; }
.sop-list li { margin: 4px 0; }
.sop-note { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--sop-warn-line); background: var(--sop-warn-bg); color: var(--sop-warn); }
.sop-note.tip { border-color: var(--sop-tip-line); background: var(--sop-tip-bg); color: var(--sop-tip); }
.sop-note strong { display: block; font-size: 14px; }
.sop-note div { color: var(--text); white-space: pre-wrap; }
.sop-photo { margin: 12px 0; }
.sop-photo button { display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #f4f4f4; cursor: zoom-in; }
.sop-photo img { display: block; width: 100%; max-height: 420px; object-fit: contain; }
.sop-photo figcaption { margin-top: 6px; font-size: 14px; color: var(--muted); text-align: center; }
.mt-foot .link-btn { color: var(--brand); margin-left: 0; padding: 0; font-size: inherit; }
.sop-ver { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; font: inherit; cursor: pointer; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 12px 14px; }
.sop-old { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; padding: 10px 14px; border-radius: 12px; background: #fff4e5; color: #7a4b00; font-weight: var(--w-ui); }
/* 編輯：每一塊一張小卡，上面一條寫是什麼塊、↑ ↓ ✕ */
.sop-blocks { display: flex; flex-direction: column; gap: 10px; }
.sop-block { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px 10px; background: #fff; min-width: 0; }
.sop-block-bar { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.sop-block-kind { font-size: 12.5px; color: var(--muted); font-weight: var(--w-ui); }
.sop-block-bar .spacer { flex: 1; }
.sop-mini { font: inherit; width: 32px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); cursor: pointer; }
.sop-mini:disabled { opacity: .35; cursor: default; }
.sop-mini.danger { color: var(--danger); }
.sop-block textarea, .sop-block input { width: 100%; }
.sop-h-input { font-size: 17px; font-weight: var(--w-strong); border-left: 4px solid var(--brand); }
.sop-block .rich-area.sop-rich { min-height: 90px; }
.sop-note-edit { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 10px; background: var(--sop-warn-bg); }
.sop-note-edit.tip { background: var(--sop-tip-bg); }
.sop-tone span { padding: 8px 6px; font-size: 14px; background: #fff; }
.sop-photo-edit { display: flex; gap: 10px; align-items: center; }
.sop-photo-edit img { flex: none; width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.sop-add { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1.5px dashed #d8d2ca; border-radius: 12px; }
.sop-add-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sop-add-btn { font: inherit; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 4px; border: 1px solid var(--line); border-radius: 10px; background: #faf8f5; color: var(--text); font-size: 14px; font-weight: var(--w-ui); cursor: pointer; }
@media (min-width: 700px) { .sop-add-btns { grid-template-columns: repeat(6, 1fr); } }
.sop-grow { resize: none; overflow: hidden; line-height: 1.6; }
.sop-add-btn { flex-direction: column; gap: 2px; padding: 8px 4px; }
.sop-add-ic { font-size: 17px; line-height: 1.2; }
/* SOP「只有負責人看得到」：一眼看出還沒開放給大家 */
.tag.sop-lock { background: #fff3e0; color: #8a4b00; border-color: #f0c78a; }
.sop-lock-note { margin: 4px 0 12px; }

/* 測試站提醒條（搬家前先在新主機試用） */
.test-strip { background: #fff3cd; color: #8a3a00; text-align: center; padding: 6px 16px; font-size: 14px; border-bottom: 1px solid #f0d58a; }
.offline-bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fdecea; color: #8a1c1c; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); border-bottom: 1px solid #f3c2bd; font-weight: var(--w-ui); }
.offline-bar .btn { flex: none; width: auto; }

/* ===== 左上角切換模組（EC 2026-10-23）：點 REBUY 選日常任務或進銷存 ===== */
.module-switch { position: relative; flex-shrink: 0; }
.module-switch summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; margin: -4px -8px; border-radius: 8px; }
.module-switch summary::-webkit-details-marker { display: none; }
.module-switch summary::after { content: '▾'; font-size: 11px; color: var(--muted); }
.module-switch[open] summary { background: #f6eced; }
.module-now { font-size: 13px; color: #fff; background: var(--brand); border-radius: 6px; padding: 1px 7px; font-weight: var(--w-ui); }
.module-drop { min-width: 160px; }
.module-drop a { color: var(--text); text-decoration: none; border-radius: 8px; font-size: 15px; }
.module-drop a.active { color: var(--brand); background: #f6eced; font-weight: var(--w-strong); }
.module-head { padding: 4px 12px 2px; }

/* ===== 進銷存：庫存頁 ===== */
.inv-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.inv-filters input[type=search] { flex: 1 1 200px; }
.inv-filters select { flex: 0 1 160px; }
.inv-row { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.inv-main { min-width: 0; flex: 1; }
.inv-sku { font-size: 13px; color: var(--muted); letter-spacing: .04em; }
.inv-name { display: block; overflow: hidden; text-overflow: ellipsis; }
.inv-money { text-align: right; white-space: nowrap; font-size: 14px; }
.inv-money .inv-price { font-weight: var(--w-strong); font-size: 15px; }
.inv-money .inv-cost { color: var(--muted); font-size: 13px; }
.inv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .inv-grid { grid-template-columns: 1fr; } }
.inv-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 12px 0 4px; font-size: 15px; }
.inv-facts dt { color: var(--muted); }
.inv-facts dd { margin: 0; }
.inv-facts dd a { color: var(--brand); font-weight: var(--w-ui); }
.inv-lock { font-size: 12px; color: var(--muted); }
.inv-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.inv-ledger li { display: flex; justify-content: space-between; gap: 10px; }
.inv-ledger .when { color: var(--muted); white-space: nowrap; font-size: 13px; }
.inv-status { display: inline-block; font-size: 12px; border-radius: 6px; padding: 1px 7px; font-weight: var(--w-ui); }
.inv-sale { font-size: 12px; color: var(--text); background: #f3eee8; border-radius: 6px; padding: 1px 7px; }
.inv-status.in_stock { background: #e6f2ea; color: var(--ok); }
.inv-status.reserved { background: #fff3cd; color: #8a5a00; }
.inv-status.sold { background: #eee; color: #555; }
.inv-status.removed { background: #f6e3e2; color: var(--danger); }

/* ===== 庫存頁排版（EC 2026-10-23：名稱旁要有圖，五種挑三種） ===== */
.inv-layouts { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; }
.inv-thumb { flex-shrink: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 10px; background: linear-gradient(135deg, #efe9e3, #e2d8cf); color: #8b7d71; font-size: 12px; letter-spacing: .06em; font-weight: var(--w-ui); text-align: center; }
.inv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inv-thumb.xs { width: 40px; height: 40px; border-radius: 8px; font-size: 9px; }
.inv-thumb.tb { width: 64px; height: 64px; border-radius: 10px; font-size: 10px; }
.inv-thumb.s { width: 64px; height: 64px; }
.inv-thumb.m { width: 112px; height: 112px; font-size: 14px; }
.inv-thumb.sq { width: 100%; aspect-ratio: 1 / 1; border-radius: 12px 12px 0 0; font-size: 16px; }
.inv-thumb.wide { width: 100%; aspect-ratio: 4 / 3; border-radius: 14px 14px 0 0; font-size: 20px; }
.inv-name.two { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.inv-row > .inv-thumb + .inv-main { align-self: center; }
.inv-grid-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 12px; }
@media (max-width: 700px) { .inv-grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.inv-card { all: unset; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; overflow: hidden; }
.inv-card.dim, .inv-feed.dim, .inv-table tr.dim { opacity: .55; }
.inv-card-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.inv-card-body .inv-name { font-size: 14px; line-height: 1.4; }
.inv-feed-list { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
.inv-feed { all: unset; display: block; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; cursor: pointer; background: var(--card); }
.inv-feed-body { display: flex; gap: 12px; justify-content: space-between; padding: 12px 14px; }
.inv-table-wrap { overflow-x: auto; margin-top: 10px; }
.inv-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.inv-table th { text-align: left; color: var(--muted); font-weight: var(--w-ui); padding: 6px 8px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.inv-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.inv-table tbody tr { cursor: pointer; }
.inv-table tbody tr:active { background: #faf8f5; }
.inv-table .num { text-align: right; white-space: nowrap; }
.inv-name-link { color: var(--text); text-decoration: none; font-weight: var(--w-strong); }
.inv-table .inv-sku { white-space: nowrap; }
/* 好幾種價格（EC 2026-10-23） */
.inv-price-name { font-size: 11px; color: var(--muted); font-weight: var(--w-text); margin-right: 4px; }
.inv-main-tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 6px; font-size: 12px; background: #f6e7e8; color: var(--brand); font-weight: var(--w-ui); white-space: nowrap; }
.inv-more-prices { margin: 4px 0; }
.inv-more-prices summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 4px 0; }
.inv-type { display: grid; gap: 8px; }
.inv-type-name input { font-weight: var(--w-strong); max-width: 220px; }
.inv-roles { padding-left: 28px; }
.page.inv-wide { max-width: 1400px; }
/* 庫存新欄位、更多排版、照片、直接編輯（EC 2026-10-23 晚上） */
.inv-grade { display: inline-block; font-size: 12px; border-radius: 6px; padding: 1px 6px; border: 1px solid var(--brand); color: var(--brand); font-weight: var(--w-ui); white-space: nowrap; }
.inv-qty { font-size: 12px; color: var(--muted); }
.inv-qty.zero, .inv-st-qty strong.zero { color: var(--danger); }
.inv-thumb { position: relative; }
.inv-thumb-count { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; border-radius: 6px; padding: 1px 6px; letter-spacing: 0; }
.inv-compact-list { display: flex; flex-direction: column; margin-top: 8px; }
.inv-compact { display: flex; align-items: center; gap: 10px; padding: 6px 2px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 14px; }
.inv-compact.dim, .inv-wall-tile.dim, .inv-stocktake.dim { opacity: .55; }
.inv-compact-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--w-strong); }
.inv-compact-price { white-space: nowrap; font-weight: var(--w-strong); }
@media (max-width: 560px) { .inv-compact .inv-sku { display: none; } }
.inv-wall { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 12px; }
@media (max-width: 700px) { .inv-wall { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; } }
.inv-wall-tile { position: relative; display: block; }
.inv-wall-tile .inv-thumb.sq { border-radius: 8px; }
.inv-wall-sku { position: absolute; left: 4px; bottom: 4px; background: rgba(255,255,255,.88); color: var(--text); font-size: 10px; border-radius: 4px; padding: 0 4px; }
.inv-wall-status { position: absolute; left: 4px; top: 4px; }
.inv-price-card { padding: 12px; }
.inv-price-list { display: grid; grid-template-columns: auto auto; justify-content: start; gap: 2px 14px; margin: 6px 0 0; font-size: 14px; }
.inv-price-list dt { color: var(--muted); }
.inv-price-list dd { margin: 0; text-align: right; }
.inv-price-list dd.main { font-weight: var(--w-strong); color: var(--brand); }
.inv-st-sku { font-size: 20px; font-weight: var(--w-strong); letter-spacing: .04em; }
.inv-st-qty { display: flex; flex-direction: column; align-items: center; min-width: 52px; }
.inv-st-qty strong { font-size: 26px; }
.inv-gallery { margin: -4px 0 12px; }
.inv-gallery-open { all: unset; position: relative; display: block; cursor: zoom-in; border-radius: 14px; overflow: hidden; }
.inv-gallery-main { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #f3efe9; }
.inv-gallery-strip { display: flex; gap: 6px; overflow-x: auto; margin-top: 8px; }
.inv-gallery-dot { all: unset; flex: 0 0 56px; height: 56px; border-radius: 8px; overflow: hidden; cursor: pointer; border: 2px solid transparent; }
.inv-gallery-dot.active { border-color: var(--brand); }
.inv-gallery-dot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inv-facts.editing { align-items: center; }
.inv-facts.editing dd input, .inv-facts.editing dd select { width: 100%; }
.inv-title-input { font-size: 18px; font-weight: var(--w-strong); width: 100%; margin: 4px 0; }
.inv-edit-head { font-size: 14px; border-radius: 8px; padding: 6px 10px; background: #f3efe9; }
.inv-edit-head.admin { background: #f6e7e8; color: var(--brand); font-weight: var(--w-ui); }
.inv-col { display: flex; align-items: center; gap: 8px; }
.inv-col .grow { flex: 1; }
.inv-col .btn.small { padding: 4px 10px; }
.inv-table td { white-space: nowrap; }
.inv-table td.inv-td-name { white-space: normal; min-width: 170px; }
.inv-gallery-open { width: 100%; }
.inv-table-box { position: relative; }
/* 表格下面的左右捲軸：一直貼在畫面最下面（手機貼在下方按鈕列上面） */
.inv-hbar { position: sticky; bottom: 0; z-index: 3; padding: 8px 4px; background: var(--card); border-top: 1px solid var(--line); cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.inv-hbar-track { position: relative; height: 10px; border-radius: 999px; background: #ece7e1; }
.inv-hbar-thumb { position: absolute; top: 0; left: 0; height: 100%; border-radius: 999px; background: #b9aea3; }
.inv-hbar:hover .inv-hbar-thumb, .inv-hbar.dragging .inv-hbar-thumb { background: var(--brand); }
/* 下方按鈕列＝上 4 ＋按鈕 56 ＋下面留白，捲軸剛好貼在它上面 */
@media (max-width: 700px) { body.has-tabbar .inv-hbar { bottom: calc(60px + max(6px, env(safe-area-inset-bottom) - 18px)); padding: 10px 4px; } }
.inv-table-box.more::after { content: ''; position: absolute; top: 34px; right: 0; bottom: 27px; width: 40px; pointer-events: none; background: linear-gradient(to right, rgba(255,255,255,0), var(--card)); }
.inv-scroll-hint { text-align: right; font-size: 12px; color: var(--brand); margin: 8px 0 -4px; }
/* 往右滑時圖和第一個欄位（預設是商品編號）固定在左邊，才知道是哪一件 */
.inv-table th:first-child, .inv-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); width: 80px; min-width: 80px; max-width: 80px; }
.inv-table th:nth-child(2), .inv-table td:nth-child(2) { position: sticky; left: 56px; z-index: 1; background: var(--card); box-shadow: 6px 0 6px -6px rgba(0,0,0,.18); }
/* 排版選單（EC 2026-10-23：一個按鈕跳出選單，每種有小示意圖） */
.lo-btn { display: inline-flex; align-items: center; gap: 8px; }
.lo-caret { color: var(--muted); font-size: 11px; }
.lo-backdrop { position: fixed; inset: 0; z-index: 900; background: rgba(30,20,20,.45); display: flex; align-items: center; justify-content: center; padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
/* iPhone App 是整個螢幕都給網頁，上下要讓出時間列和底下的橫條，不然標題會被時間蓋到 */
.lo-modal { background: var(--card); border-radius: 20px; width: min(640px, 100%); max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.lo-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.lo-head h2 { margin: 0; font-size: 18px; }
.lo-x { all: unset; width: 40px; height: 40px; border-radius: 50%; background: #f3efe9; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 16px; }
.lo-x:focus-visible, .lo-card:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.lo-sub { margin: 10px 20px 0; }
.lo-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 14px 20px 20px; }
@media (max-width: 560px) { .lo-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 12px 14px 16px; } }
.lo-card { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 2px solid var(--line); border-radius: 14px; cursor: pointer; background: var(--card); }
.lo-card.on { border-color: var(--brand); background: #fbf5f5; }
.lo-card strong { font-size: 15px; margin-top: 6px; }
.lo-note { font-size: 12px; color: var(--muted); line-height: 1.45; }
/* 小示意圖：一格一格的灰塊，每種排版排法不一樣 */
.lo-pv { display: grid; gap: 4px; height: 64px; }
.lo-pv i { display: block; border-radius: 4px; background: #e9e4de; }
.lo-pv.mini { height: 18px; width: 22px; gap: 1px; }
.lo-pv.mini i { border-radius: 1px; }
.lo-list { grid-template-columns: 1fr 3fr; grid-template-rows: 1fr 1fr; }
.lo-list i:nth-child(odd), .lo-big i:nth-child(odd), .lo-prices i:first-child, .lo-stocktake i:nth-child(3n+1), .lo-compact i:nth-child(odd) { background: #d9d1c8; }
.lo-big { grid-template-columns: 2fr 3fr; grid-template-rows: 1fr 1fr; }
.lo-grid { grid-template-columns: repeat(3, 1fr); grid-template-rows: 2fr 1fr; }
.lo-grid i:nth-child(-n+3) { background: #d9d1c8; }
.lo-feed { grid-template-rows: 3fr 1fr; }
.lo-feed i:first-child { background: #d9d1c8; }
.lo-table { grid-template-columns: 1fr 2fr 3fr 2fr 2fr; grid-template-rows: repeat(3, 1fr); gap: 2px; }
.lo-table i { border-radius: 2px; }
.lo-table i:nth-child(5n+1) { background: #d9d1c8; }
.lo-compact { grid-template-columns: 1fr 7fr; grid-template-rows: repeat(4, 1fr); gap: 3px; }
.lo-wall { grid-template-columns: repeat(6, 1fr); grid-template-rows: 1fr 1fr; gap: 3px; }
.lo-wall i { background: #d9d1c8; }
.lo-prices { grid-template-columns: 2fr 3fr; grid-template-rows: repeat(3, 1fr); }
.lo-prices i:first-child { grid-row: 1 / 4; }
.lo-stocktake { grid-template-columns: 1fr 3fr 1fr; grid-template-rows: 1fr 1fr; }
.lo-stocktake i:nth-child(3n) { background: #cdbfb3; }

/* 庫存頁每件的「✎ 編輯」（EC 2026-10-23）：疊在卡片右下角，點了在這頁跳出編輯視窗 */
.inv-ed { position: relative; }
.inv-acts { position: absolute; right: 8px; bottom: 8px; z-index: 2; display: flex; gap: 6px; align-items: center; }
.inv-ed-btn { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 13px; font-weight: var(--w-ui); cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.inv-ed-btn:hover, .inv-ed-btn:focus-visible { border-color: var(--accent, #b33); }
.inv-grid-cards .inv-acts, .inv-wall .inv-acts { top: 6px; bottom: auto; right: 6px; }
.inv-grid-cards .inv-acts, .inv-wall .inv-acts { flex-direction: column; align-items: flex-end; }
.inv-wall .inv-ed-btn span { display: none; }
.inv-wall .inv-ed-btn { padding: 4px 8px; }
.inv-compact-list .inv-ed { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.inv-compact-list .inv-ed .inv-compact { flex: 1; min-width: 0; border-bottom: 0; }
.inv-compact-list .inv-acts { position: static; }
.inv-compact-list .inv-ed-btn { padding: 2px 8px; box-shadow: none; }
.inv-compact-list .inv-ed-btn span { display: none; }
.inv-td-ed .inv-ed-btn { display: block; text-align: center; text-decoration: none; margin-top: 4px; padding: 1px 0; width: 100%; box-shadow: none; font-size: 12px; }
.inv-td-ed .inv-ed-btn span { display: none; }
.inv-editor { padding-bottom: 8px; }
.inv-editor .form { padding: 0 20px 12px; }
.inv-editor-tabs { padding: 0 20px 8px; }
.inv-editor .inv-title-input { font-size: 16px; }

/* REBUY 選單裡的「權限設定」（EC 2026-10-23）：跟上面的模組隔一條線 */
.module-drop .module-perm { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; margin-top: 4px; padding-top: 10px; }
.module-drop .module-perm svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.perm-apps { margin-bottom: 12px; }

/* 進銷存頁面在電腦上撐滿整個瀏覽器、兩邊不留白（EC 2026-10-24）；手機照舊 */
.page.full, .page.full.inv-wide { max-width: none; }
@media (min-width: 900px) { .page.full { padding: 20px 24px; } }
/* 撐滿之後格狀、照片牆、大圖卡片照螢幕寬度自動多排幾件，不會一張圖放超大 */
@media (min-width: 701px) {
  .page.full .inv-grid-cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .page.full .inv-wall { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .page.full .inv-feed-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
}
/* 商品頁撐滿之後：照片放左邊、資料放右邊，照片不會被放到整個螢幕那麼大 */
@media (min-width: 900px) {
  .page.full #item, .page.full .inv-edit-form { display: grid; grid-template-columns: minmax(300px, 520px) 1fr; column-gap: 32px; align-content: start; align-items: start; }
  .page.full #item > *, .page.full .inv-edit-form > * { grid-column: 2; }
  .page.full #item > .inv-gallery, .page.full .inv-edit-form > .inv-gallery { grid-column: 1; grid-row: 1 / span 30; margin: 0; }
  .page.full #item > .inv-edit-form { grid-column: 1 / -1; }
}

/* 庫存頁的搜尋列（EC 2026-10-24，照相簿）：REBUY logo＋圓角搜尋框＋排版按鈕同一排 */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.inv-searchbar { display: flex; align-items: center; gap: 12px; }
.inv-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; color: var(--text); text-decoration: none; font-weight: var(--w-strong); font-size: 18px; letter-spacing: .02em; }
.inv-brand img { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: #fff; object-fit: cover; }
.inv-search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 0 18px; border: 1.5px solid var(--line); border-radius: 999px; background: #fff; }
.inv-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(126,24,34,.12); }
.inv-search input { flex: 1; min-width: 0; border: none; padding: 12px 0; font-size: 16px; background: transparent; box-shadow: none; }
.inv-search input:focus { box-shadow: none; outline: none; }
.inv-search-ic { display: flex; color: var(--muted); }
.inv-search-ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.inv-scan { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin-right: -8px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text); cursor: pointer; }
.inv-scan svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.inv-searchbar .lo-btn { flex-shrink: 0; height: 46px; border-radius: 999px; padding: 0 16px; }
.inv-statusrow { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.inv-statusrow .tabs { flex: 1; min-width: 0; margin: 0; }
.inv-statusrow select { flex-shrink: 0; width: auto; border-radius: 999px; padding-top: 8px; padding-bottom: 8px; }
@media (max-width: 700px) {
  .inv-searchbar { gap: 8px; }
  .inv-brand span, .inv-searchbar .lo-btn-text, .inv-searchbar .lo-caret { display: none; }
  .inv-brand img { width: 40px; height: 40px; border-radius: 10px; }
  .inv-search { padding: 0 14px; gap: 8px; }
  .inv-search input { padding: 10px 0; }
  .inv-searchbar .lo-btn { height: 42px; width: 46px; padding: 0; justify-content: center; }
}

/* 批次入庫（EC 2026-10-24）：步驟、貼上框、預覽表（錯的那列紅底）；手機上表格左右滑 */
#add-box .tabs { margin: 0 0 12px; }
.inv-batch-steps { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 10px; }
.inv-batch-steps li > span { margin-right: 8px; }
.inv-batch-steps .btn { margin-right: 8px; }
#add-box textarea { width: 100%; box-sizing: border-box; margin-bottom: 12px; }
.inv-batch-help { margin: 4px 0 12px; }
.inv-batch-help ul { margin: 6px 0 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.inv-batch-preview { margin: 8px 0 12px; }
.inv-batch-preview > .btn { margin-top: 12px; }
.inv-batch-preview > .btn:disabled { opacity: .45; cursor: default; }
.inv-batch-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; max-height: 60vh; }
.inv-batch-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.inv-batch-table th, .inv-batch-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.inv-batch-table th { position: sticky; top: 0; background: #faf8f5; }
.inv-batch-table td.num { color: var(--muted); }
.inv-batch-table tr.bad td { background: #fdf1f0; }
.inv-batch-ok { color: var(--ok); }
.inv-batch-err { color: var(--danger); white-space: normal; }
.inv-batch-table td .inv-batch-err { display: inline-block; min-width: 12em; }

/* 庫存設定「相簿照片」（步驟 1b）：左邊項目、右邊數字；重複編號列表 */
#album .list-item { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#album .grow { flex: 1; min-width: 8em; }
#album input[type=number] { width: 5.5em; }

/* 收購表自動入庫（EC 2026-10-24） */
.sheet-status .list-item { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sheet-status .grow { flex: 1; min-width: 8em; }
.sheet-minutes { display: flex; align-items: center; gap: 8px; }
.sheet-minutes input { width: 5.5em; }
.sheet-share { margin-top: 16px; padding: 12px; border-radius: 10px; background: var(--bg); }
.sheet-share code { overflow-wrap: anywhere; }
.sheet-share .btn { white-space: nowrap; flex: none; }
.sheet-card { display: flex; flex-direction: column; gap: 6px; }
.sheet-card .sheet-form { margin-top: 0; }
.sheet-ended { margin-top: 12px; }
.sheet-ended summary { cursor: pointer; color: var(--muted); }
.sheet-missing { display: flex; flex-direction: column; gap: 6px; }
.sheet-maybe { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sheet-history ul { margin: 6px 0 0; }
.sheet-history li { padding: 2px 0; }
.sheet-confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sheet-confirm input { flex: 1; min-width: 14em; }
.inv-type-del { margin-top: 8px; }
/* 價格種類卡在手機上不要撐破畫面：名稱框縮、按鈕換行不直排 */
.inv-type > * { min-width: 0; }
.inv-type .row-between { flex-wrap: wrap; gap: 8px; }
.inv-type .inv-type-name { flex: 1 1 140px; min-width: 0; }
.inv-type .inv-type-name input { width: 100%; }
.inv-type .inv-col .btn { white-space: nowrap; }
@media (max-width: 600px) { .inv-type-del input { flex: 1 1 100%; min-width: 0; } }

/* 手機版跑版（EC 2026-10-24）：格狀卡片裡很長的英文字（例如 OnTheGo East West）會把格子撐寬，整頁往右跑。格子最小寬度設 0，長字在格子裡斷行 */
.inv-grid-cards > *, .inv-wall > *, .inv-feed-list > * { min-width: 0; }
.inv-card-body .inv-name, .inv-feed .inv-name, .list-item .inv-name { overflow-wrap: anywhere; }
.inv-card-body .row-between { flex-wrap: wrap; min-width: 0; }
/* 編輯鈕不蓋到價錢、成本：清單和卡片類在最下面留一排給它 */
.inv-ed.flow > :first-child { padding-bottom: 52px; }
.inv-ed.flow > .inv-acts { bottom: 10px; right: 10px; }
.inv-ed.flow > .inv-acts .inv-ed-btn { padding: 6px 14px; font-size: 14px; }
/* 原畫面直接編輯（EC 2026-10-24） */
.inv-inline-edit { border: 2px solid var(--brand); border-radius: 12px; background: var(--card); padding: 14px; margin: 8px 0; }
.inv-grid-cards > .inv-inline-edit, .inv-wall > .inv-inline-edit, .inv-feed-list > .inv-inline-edit { grid-column: 1 / -1; margin: 0; }
.inv-inline-head { display: flex; flex-direction: column; margin-bottom: 8px; }
.inv-inline-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 14px; }
.inv-inline-grid .field.wide { grid-column: 1 / -1; }
.inv-inline-grid .inv-title-input { font-size: 16px; margin: 0; }
.inv-tr-edit > td { padding: 0 !important; background: var(--bg); }
.inv-tr-edit .inv-inline-edit { margin: 6px; max-width: 900px; }
/* 點照片跳出照片框（EC 2026-10-24，照相簿的樣子） */
.inv-thumb.zoom { cursor: zoom-in; }
body.no-scroll { overflow: hidden; }
.inv-pv-backdrop { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.inv-pv { background: var(--card); border-radius: 14px; width: min(960px, 100%); max-height: 100%; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.inv-pv-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.inv-pv-head h2 { margin: 0; font-size: 18px; }
.inv-pv-head .spacer { flex: 1; }
.inv-pv-body { overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }
.inv-pv-one { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.inv-pv-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; max-width: 720px; }
.inv-pv-nav { display: flex; gap: 6px; }
.inv-pv-num { display: inline-flex; align-items: center; justify-content: center; min-width: 2.4em; height: 2.4em; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; background: var(--card); }
.inv-pv-img { display: block; max-width: 100%; max-height: calc(100vh - 190px); max-height: calc(100dvh - 190px); border-radius: 12px; object-fit: contain; }
.inv-pv-item { margin: 0 auto 16px; max-width: 720px; position: relative; }
.inv-pv-item img { display: block; width: 100%; border-radius: 12px; }
/* 還沒載好的照片：先佔一個方形的灰底位置，載好就照照片本來的比例 */
.inv-pv-item:not(.ready) img { aspect-ratio: 1 / 1; object-fit: cover; background: linear-gradient(135deg, #efe9e3, #e2d8cf); }
.inv-pv-item .inv-pv-num { position: absolute; top: 10px; left: 10px; }
@media (max-width: 700px) {
  .inv-pv-backdrop { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); background: var(--card); }
  .inv-pv { border-radius: 0; height: 100%; }
  .inv-pv-body { padding: 10px; flex: 1; }
  .inv-pv-img { max-height: calc(100dvh - 170px); }
}
.inv-inline-edit { scroll-margin-top: 76px; }
.inv-inline-edit .inv-actions { display: flex; gap: 8px; }
.inv-inline-edit .inv-actions .btn { flex: 1; margin: 0; }

/* ---------- 訂單（進銷存，EC 2026-10-24）：新增訂單、訂單清單、一張訂單、訂單設定 ---------- */
.ord-title { font-size: 22px; margin: 4px 0 12px; }
.card .ord-title { margin: 0; }
.ord-h3 { font-size: 15px; margin: 18px 0 4px; color: #5c544e; }
.ord-layout { display: flex; flex-direction: column; }
/* 手機一欄：照開單順序排（客戶 → 管道 → 商品 → 付款 → 其他 → 建立），電腦兩欄左右放 */
@media (max-width: 899px) {
  .ord-layout > .ord-col { display: contents; }
  .ord-o1 { order: 1; } .ord-o2 { order: 2; } .ord-o3 { order: 3; } .ord-o4 { order: 4; } .ord-o5 { order: 5; } .ord-o6 { order: 6; }
}
@media (min-width: 900px) {
  .ord-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 16px; align-items: start; }
  .ord-layout > .ord-col:last-child { position: sticky; top: 12px; }
}
.ord-search { margin: 10px 0 8px; }
.ord-results { display: flex; flex-direction: column; gap: 6px; }
.ord-result { all: unset; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; }
.ord-result:active { background: #faf8f5; }
.ord-result .grow, .ord-line .grow { flex: 1; min-width: 0; }
.ord-result strong, .ord-line strong { display: block; }
.ord-name { display: block; overflow-wrap: anywhere; }
.ord-add { color: var(--brand); font-size: 14px; font-weight: var(--w-ui); white-space: nowrap; }
.ord-price { white-space: nowrap; font-weight: var(--w-strong); }
.ord-thumb { flex: none; width: 52px; height: 52px; border-radius: 10px; overflow: hidden; background: #f1eeea; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); text-align: center; }
.ord-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ord-lines { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.ord-line { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fffdfb; }
.ord-line.link { color: inherit; text-decoration: none; align-items: center; }
.ord-line-main { display: flex; flex-direction: column; gap: 6px; }
.ord-price-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.ord-price-row input:disabled { background: #f6f4f1; color: inherit; }
/* 金額不要上下鍵（EC 2026-10-28），用打的就好 */
.ord-price-row input[type=number] { appearance: textfield; -moz-appearance: textfield; }
.ord-price-row input[type=number]::-webkit-inner-spin-button, .ord-price-row input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ord-line-price { text-align: right; white-space: nowrap; }
.ord-x { padding: 2px 9px; }
.ord-empty { margin: 4px 0; }
.ord-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 17px; }
.ord-total strong { font-size: 22px; color: var(--brand); }
.ord-submit { margin-bottom: 16px; }
.ord-submit .muted { text-align: center; margin-top: 8px; }
.ord-picked { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fffdfb; }
.ord-picked .grow { flex: 1; min-width: 0; }
.ord-suggest { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ord-suggest:empty { display: none; }
.ord-chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 14px; cursor: pointer; }
.ord-cfields:empty { display: none; }
.ord-kind, .ord-status, .ord-pay { display: inline-block; font-size: 12px; border-radius: 6px; padding: 1px 7px; font-weight: var(--w-ui); vertical-align: 1px; }
.ord-kind.retail { background: #eef3fb; color: #2c5aa0; }
.ord-kind.trade { background: #f3ecfa; color: #6a3d9a; }
.ord-kind.xian { background: #fdf0e3; color: #9a5214; }
.ord-status.reserved { background: #fff3cd; color: #8a5a00; }
.ord-status.sold { background: #e6f2ea; color: var(--ok); }
.ord-status.cancelled { background: #eee; color: #666; }
.ord-pay.unpaid { background: #f6e3e2; color: var(--danger); }
.ord-pay.deposit { background: #fff3cd; color: #8a5a00; }
.ord-pay.paid { background: #e6f2ea; color: var(--ok); }
.ord-infos { display: grid; gap: 2px; margin-top: 12px; }
.ord-info { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.ord-done { background: #e6f2ea; color: var(--ok); border-radius: 12px; padding: 12px 16px; margin-bottom: 12px; font-weight: var(--w-ui); }
.ord-deposit summary { cursor: pointer; color: var(--muted); font-size: 15px; }
.ord-deposit .form { margin-top: 10px; }
/* 付款截圖（EC 2026-10-24）：訂單上已附的，點了放大；下面小字寫付款還是訂金 */
.ord-proofs { display: flex; flex-wrap: wrap; gap: 10px; }
.ord-proofs-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
/* 取消訂單：收在最下面，打開才看得到原因和按鈕 */
.ord-cancel summary { cursor: pointer; color: var(--danger); font-size: 15px; }
.ord-cancel .form { margin-top: 10px; }
/* 付款方式一列：手機上名稱一行、勾選和儲存在下一行，字才不會被擠成直的 */
.ord-method-row { flex-wrap: wrap; }
.ord-method-row > .grow { flex: 1 1 100%; }
.ord-method-row .check-line { white-space: nowrap; }
@media (min-width: 700px) { .ord-method-row { flex-wrap: nowrap; } .ord-method-row > .grow { flex: 1 1 auto; } }
/* 扣抵和真實利潤（EC 2026-10-24）：合計下面一行一行扣 */
.ord-money { margin-top: 6px; padding: 10px 12px; border-radius: 10px; background: var(--bg); }
.ord-money-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 14px; color: var(--muted); }
.ord-money-row.sum { color: inherit; font-weight: var(--w-ui); border-top: 1px solid var(--line); margin-top: 4px; padding-top: 7px; }
.ord-money-row.profit { color: var(--brand); font-weight: var(--w-strong); font-size: 15px; }
/* 訂單設定：手續費與發票 */
.ord-plans { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.ord-plan, .ord-fee-row { display: flex; align-items: center; gap: 8px; }
.ord-plan .ord-days, .ord-rate { width: 76px; min-width: 0; }
.ord-fee-method .row { gap: 8px; }
.ord-add-channel { margin-top: 10px; }
.ord-fee-row > .grow { flex: 1 1 auto; min-width: 0; }
.tabs.wrap { flex-wrap: wrap; overflow-x: visible; }
/* 公司與超商、出貨 */
.ord-list-name { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.ord-list-name:has(.ord-tax) { grid-template-columns: minmax(0, 1fr) 112px; }
.ord-list-name input { width: 100%; min-width: 0; box-sizing: border-box; }
.ord-add-channel input { flex: 1 1 0; width: auto; min-width: 0; box-sizing: border-box; }
.ord-add-channel .ord-tax { flex: 0 0 112px; width: 112px; }
.ord-ship-edit > .btn { margin-top: 10px; }
.ord-add-channel input { flex: 1; min-width: 0; }
.ord-photo-folder { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.ord-days { width: 92px; flex: none; }
.ord-cust-find { margin-top: 14px; }
.ord-field-row { flex-wrap: wrap; }
@media (max-width: 560px) {
  .ord-field-row .inv-grid { flex-basis: 100%; }
  .ord-days { width: 76px; }
}
/* 訂單查詢（EC 2026-10-24）：日期範圍、合計、按天分 */
.ord-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.ord-dates .field { min-width: 0; }
.ord-dates .field > span { font-size: 13px; }
.ord-dates input { width: 100%; min-width: 0; box-sizing: border-box; }
/* iPhone Safari 的日期框有自己的最小寬度，不管 width: 100% 會撐出去（EC 2026-10-24 截圖）：拿掉系統外觀、字縮一點 */
.ord-dates input[type="date"] { -webkit-appearance: none; appearance: none; display: block; max-width: 100%; padding-left: 10px; padding-right: 10px; font-size: 15px; text-align: left; }
.ord-dates input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.ord-status-tabs { margin-top: 12px; max-width: 480px; }
.ord-sum-head { margin-bottom: 8px; }
.ord-stats { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.ord-stats.no-money { grid-template-columns: 1fr 1fr; }
.ord-stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
@media (min-width: 900px) { .ord-dates { max-width: 420px; } }
/* 訂單查詢的「« ‹ 今日 › »」：一整條分成五格，中間的今日比較寬 */
.ord-daynav { display: grid; grid-template-columns: 1fr 1fr 1.6fr 1fr 1fr; margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; max-width: 420px; }
.ord-daynav button { border: none; border-right: 1px solid var(--line); background: transparent; padding: 11px 0; font-size: 18px; color: #5c544e; cursor: pointer; font-weight: var(--w-ui); }
.ord-daynav button:last-child { border-right: none; }
.ord-daynav button:active { background: #f6f4f1; }
.ord-daynav #d-today { font-size: 15px; }
.ord-daynav #d-today.active { background: var(--brand); color: #fff; }
/* 訂單查詢（EC 2026-10-24 選的 C2）：合計是三格小方塊；每天一張小結卡＋已收進度條；單子照時間串成一條線 */
.ord-summary { margin-top: 14px; }
.ord-stat { background: #faf7f3; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.ord-stat strong { font-size: 20px; font-variant-numeric: tabular-nums; color: var(--brand); white-space: nowrap; }
.ord-days-list { display: flex; flex-direction: column; gap: 22px; margin-top: 18px; }
.ord-daycard { background: #f6eced; border-radius: 14px; padding: 12px 14px; margin-bottom: 6px; }
.ord-daycard-head { display: flex; align-items: center; gap: 12px; padding-bottom: 8px; }
.ord-daynum { flex: none; width: 46px; height: 46px; border-radius: 12px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: var(--w-strong); font-variant-numeric: tabular-nums; }
.ord-daytxt { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.ord-daytotal { margin-left: auto; font-size: 19px; color: var(--brand); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ord-bar { height: 8px; border-radius: 99px; background: #e8d3d5; overflow: hidden; }
.ord-bar span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.ord-daycard-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; margin-top: 6px; }
.ord-daycard-meta strong { font-variant-numeric: tabular-nums; }
.ord-tl-list { display: flex; flex-direction: column; }
.ord-tl { position: relative; display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 0 10px; color: inherit; text-decoration: none; }
.ord-tl::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.ord-dot { position: relative; z-index: 1; width: 14px; height: 14px; margin-top: 18px; border-radius: 50%; background: #e0b84c; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.ord-tl.sold .ord-dot { background: var(--ok); }
.ord-tl.cancelled .ord-dot { background: #bbb; }
.ord-tl.cancelled .ord-tl-body { opacity: .5; }
.ord-tl-body { min-width: 0; margin: 6px 0; padding: 10px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.ord-tl:active .ord-tl-body { background: #faf8f5; }
.ord-tl-main { gap: 10px; align-items: baseline; }
.ord-time { font-variant-numeric: tabular-nums; }
.ord-amt { font-size: 18px; color: var(--brand); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ord-state { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: #8a5a00; font-weight: var(--w-ui); white-space: nowrap; }
.ord-state i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.ord-state.sold { color: var(--ok); }
.ord-state.cancelled { color: #888; }
.ord-paytxt.unpaid { color: var(--danger); }
.ord-paytxt.deposit { color: #8a5a00; }
.ord-paytxt.paid { color: var(--ok); }
@media (min-width: 900px) {
  .ord-query { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 0 28px; align-items: start; }
  .ord-side { position: sticky; top: 12px; }
  .ord-side .ord-daynav, .ord-side .ord-dates { max-width: none; }
  .ord-query .ord-days-list { margin-top: 0; }
  .ord-main { min-width: 0; }
}

/* 庫存：欄位、排序、下載 Excel（EC 2026-10-24） */
.inv-tools { display: flex; align-items: center; justify-content: flex-start; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.inv-tools .inv-xlsx { margin-left: auto; }
/* 在庫天數跟欄位、Excel 同一排（EC 2026-10-24）：點開的幾顆往右長，不往下；放不下就在這一段左右滑 */
.inv-tools .inv-ages { display: flex; align-items: center; gap: 8px; flex: 1 1 0; min-width: 0; }
.inv-tools .inv-age-toggle { flex-shrink: 0; }
.inv-age-scroll { display: flex; align-items: center; gap: 8px; min-width: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.inv-age-scroll::-webkit-scrollbar { display: none; }
.inv-age-scroll .chip { flex-shrink: 0; white-space: nowrap; }
.inv-tools .inv-tool, .inv-tools > .inv-sort-chip { flex-shrink: 0; }
/* 表格的編輯鈕（EC 2026-10-24：放在欄位和在庫天數中間）：編輯模式開著是深色「✓ 完成」 */
.inv-edit-slot { display: contents; }
.inv-edit-ic { font-style: normal; }
.inv-edit-toggle.on { background: var(--brand); color: #fff; border-color: var(--brand); }
/* 手機：排序的小標籤放下一排；空間不夠，欄位、編輯、Excel 只留圖示（編輯模式開著的「完成」留字） */
@media (max-width: 560px) {
  .inv-tools .inv-xlsx { margin-left: 0; }
  .inv-tools .inv-tool:not(.on) > span { display: none; }
  .inv-tools .inv-tool { padding: 6px 10px; }
  .inv-sort-chip { order: 3; }
  .inv-tools:has(.inv-sort-chip)::after { content: ''; order: 2; flex-basis: 100%; height: 0; }
}
.inv-tool { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; text-decoration: none; }
.inv-tool svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.inv-sort-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border-radius: 999px; background: var(--bg); font-size: 13px; font-weight: var(--w-ui); }
.inv-sort-x { border: 0; background: none; color: var(--muted); width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font: inherit; }
.inv-sort-x:hover { background: rgba(0,0,0,.06); }
.inv-table th .inv-sort { all: unset; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font: inherit; color: inherit; white-space: nowrap; }
.inv-table th.num .inv-sort { flex-direction: row-reverse; }
.inv-table th .inv-sort:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.inv-sort-ic { font-size: 11px; opacity: .45; }
.inv-table th.sorted { color: var(--text); }
.inv-table th.sorted .inv-sort-ic { opacity: 1; color: var(--brand); }
.inv-col-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; padding: 12px 20px; }
@media (max-width: 560px) { .inv-col-list { padding: 10px 14px; } }
.inv-col-item { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer; min-width: 0; }
.inv-col-item input { width: 20px; height: 20px; flex-shrink: 0; margin: 0; accent-color: var(--brand); }
.inv-col-item span { overflow-wrap: anywhere; }
.inv-col-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 8px 20px 18px; }
.inv-col-foot .btn { flex: 0 0 auto; width: auto; min-width: 96px; white-space: nowrap; }
/* 訂單明細的下載 Excel（EC 2026-10-24）：售價版、售價＋成本版，手機一顆一行、電腦並排 */
.ord-xlsx-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.ord-xlsx { display: inline-flex; align-items: center; gap: 6px; }
.ord-xlsx svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 899px) { .ord-xlsx-row .ord-xlsx { flex: 1 1 100%; justify-content: center; } }

/* 在庫天數（EC 2026-10-24，顏色跟相簿一樣）：30 天內綠、30–59 黃、60–89 橘、90 以上紅 */
.inv-age { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: var(--w-ui); white-space: nowrap; }
.age-g { background: #e9f4ee; color: #2e7d4f; }
.age-y { background: #fdf6d8; color: #8a6d00; }
.age-o { background: #fde9d6; color: #b45309; }
.age-r { background: #fbe9e7; color: #c0392b; }
.inv-ages .chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: 14px; font-weight: var(--w-ui); cursor: pointer; }
.inv-ages .chip small { min-width: 18px; padding: 0 5px; border-radius: 999px; background: rgba(0,0,0,.07); font-size: 12px; line-height: 18px; text-align: center; }
.inv-age-toggle .caret { display: inline-block; transform: rotate(90deg); transition: transform .15s; }
.inv-age-toggle.open .caret { transform: rotate(-90deg); }
.inv-ages .chip.age-g { border-color: #cfe6d8; } .inv-ages .chip.age-y { border-color: #f1e3a6; }
.inv-ages .chip.age-o { border-color: #f6d2b0; } .inv-ages .chip.age-r { border-color: #f2c9c4; }
.inv-ages .chip.active { color: #fff; }
.inv-ages .chip.active small { background: rgba(255,255,255,.25); }
.inv-ages .chip.age-g.active { background: #2e7d4f; border-color: #2e7d4f; }
.inv-ages .chip.age-y.active { background: #b08c00; border-color: #b08c00; }
.inv-ages .chip.age-o.active { background: #d2691e; border-color: #d2691e; }
.inv-ages .chip.age-r.active { background: #c0392b; border-color: #c0392b; }
.inv-ages .chip.inv-pic-chip.active { background: var(--brand); border-color: var(--brand); }
/* 沒點開的那組只佔按鈕的寬度，點開的那組才吃剩下的空間 */
.inv-tools .inv-ages:not(:has(.inv-age-scroll)) { flex: 0 0 auto; }

/* 表格直接在格子裡改（EC 2026-10-24）：編輯鈕在最後一欄、貼在右邊；按了那一列能改的格子有虛線框 */
.inv-table th.inv-th-act, .inv-table td.inv-td-act { position: sticky; right: 0; z-index: 1; background: var(--card); box-shadow: -6px 0 6px -6px rgba(0,0,0,.18); width: 1%; white-space: nowrap; }
.inv-td-act .inv-ed-btn { box-shadow: none; }
.inv-ed-btn.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.inv-table tr.inv-tr-editing > td { background: #fbf7f2; }
.inv-table tr.inv-tr-editing > td.inv-td-act, .inv-table tr.inv-tr-editing > td:first-child, .inv-table tr.inv-tr-editing > td:nth-child(2) { background: #fbf7f2; }
.inv-td-can { cursor: pointer; outline: 1.5px dashed #c9a9a0; outline-offset: -5px; border-radius: 8px; }
.inv-td-can:hover, .inv-td-can:focus-visible { outline-color: var(--brand); background: #fff !important; }
.inv-cell-form { display: flex; align-items: center; gap: 4px; }
.inv-cell-form input, .inv-cell-form select { width: 120px; min-width: 0; padding: 6px 8px; font-size: 15px; border-radius: 8px; }
.inv-cell-form input.inv-title-input { width: 240px; font-size: 15px; font-weight: var(--w-text); }
.inv-cell-form input[name="accessories"], .inv-cell-form input[name="note"] { width: 200px; }
.inv-cell-form input.num { text-align: right; }
.inv-cell-ok, .inv-cell-no { all: unset; cursor: pointer; width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; font-size: 18px; font-weight: var(--w-strong); }
.inv-cell-ok { color: var(--ok); } .inv-cell-ok:hover { background: #e9f4ee; }
.inv-cell-no { color: var(--danger); } .inv-cell-no:hover { background: #fbe9e7; }
@media (max-width: 700px) {
  .inv-td-act .inv-ed-btn { padding: 4px 10px; }
  .inv-cell-form input, .inv-cell-form select { width: 100%; }
  /* 手機：✓ ✕ 放在輸入框下面，不會被右邊貼住的編輯欄蓋到 */
  .inv-cell-form { flex-wrap: wrap; justify-content: flex-end; width: 104px; }
  .inv-cell-form:has(.inv-title-input), .inv-cell-form:has([name="accessories"]), .inv-cell-form:has([name="note"]) { width: 180px; }
  /* 手機上畫面窄：正在改的那一列，商品編號不貼左邊，輸入框和 ✓ ✕ 才有位置 */
  .inv-table tr.inv-tr-editing > td:nth-child(2) { position: static; box-shadow: none; }
}
/* 必開發票（EC 2026-10-25）：管道、付款方式用小標籤勾選，手機自動換行 */
.ord-must-box { display: grid; gap: 8px; margin-top: 8px; }
.ord-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ord-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 14px; cursor: pointer; }
.ord-chip input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
.ord-chip:has(input:checked) { border-color: var(--brand); background: var(--bg); font-weight: var(--w-ui); }
.ord-chip.dim { opacity: .55; }
.ord-must { margin: -4px 0 0 28px; }
.ord-must-box h3, .ord-must-box p { margin: 0; }
.ord-must-box h3 { margin-top: 8px; }

/* 首頁「待你處理」（EC 2026-10-25） */
.inbox-card { background: var(--brand); color: #fff; }
.inbox-banner-head { display: flex; align-items: baseline; gap: 8px; font-size: 18px; font-weight: var(--w-strong); }
.inbox-banner-n { font-size: 34px; line-height: 1; }
.inbox-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.inbox-chip { background: rgba(255,255,255,.16); color: #fff; text-decoration: none; border-radius: 999px; padding: 7px 12px; font-size: 15px; font-weight: var(--w-ui); }
.inbox-chip strong { background: #fff; color: var(--brand); border-radius: 999px; padding: 0 7px; margin-left: 2px; }
/* 不用附截圖的管道（EC 2026-10-25）：跟上面付款方式清單隔開 */
#no-proof { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
/* 收款那塊：沒用到的期數、公司、發票、截圖欄位是空的 div，不要佔位置 */
.ord-collect .form > div:empty { display: none; }

/* ===== 報表（report-*，EC 2026-10-25）：收購月報、銷售日報／月報、管道比較、報表設定
   跟人員指標共用數字卡和直條圖（mx-*），一張圖只看一個數字、用品牌酒紅 ===== */
.rp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.rp-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rp-head.has-sub .rp-sub { order: 3; flex-basis: 100%; margin-top: -8px; }
.rp-short { display: none; }
.rp-title h1, .rp-page-title { font-size: 22px; margin: 0; }
.rp-page-title { margin: 4px 0 14px; }
.rp-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rp-month { display: flex; align-items: center; gap: 6px; }
.rp-month .btn { min-width: 38px; text-align: center; }
.rp-month-label { position: relative; padding: 6px 10px; border-radius: 10px; background: var(--ov-soft); white-space: nowrap; cursor: pointer; }
/* 原生的月份／日期選擇器蓋在字上面、透明：點字就跳出 iPhone 的選擇器 */
.rp-month-input { position: absolute; inset: 0; opacity: 0; width: 100%; padding: 0; border: 0; cursor: pointer; }
.rp-dl { display: inline-flex; align-items: center; gap: 4px; }
.rp-dl svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rp-delta { font-size: 12px; font-weight: var(--w-ui); white-space: nowrap; }
.rp-delta.up { color: var(--ok); }
.rp-delta.down { color: var(--danger); }
.rp-switch { margin-top: 12px; max-width: 260px; }
.rp-grid { display: grid; gap: 0 16px; }
/* 格子裡的東西不要被裡面的寬圖撐開（圖本身在框裡左右滑） */
.rp-grid > *, .rp-page > .card { min-width: 0; }
/* 左右兩張卡一樣高（EC 2026-10-26：框框左右對稱，內容少的那張下面留空） */
@media (min-width: 900px) { .rp-grid { grid-template-columns: 1fr 1fr; align-items: stretch; } }
/* 收購月報電腦版：品牌在左邊整條，右邊上客人來源、下商品來源；手機照原本順序往下排 */
@media (min-width: 900px) {
  .rp-buy-grid { grid-template-areas: "brand source" "brand buyer"; grid-template-rows: auto 1fr; }
  .rp-a-brand { grid-area: brand; }
  .rp-a-source { grid-area: source; }
  .rp-a-buyer { grid-area: buyer; }
}
.rp-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rp-scroll.wide .mx-chart { min-width: 560px; }
.mx-col.strong { fill: var(--mx-series); }
.mx-hit.rp-click { cursor: pointer; }
.rp-bars { display: flex; flex-direction: column; gap: 12px; }
.rp-bar-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 15px; }
.rp-bar-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-bar-right { white-space: nowrap; text-align: right; }
.rp-pct { display: inline-block; min-width: 3.2em; }
.rp-bar-track { height: 8px; border-radius: 4px; background: var(--mx-grid); margin-top: 4px; overflow: hidden; }
.rp-bar-track span { display: block; height: 100%; border-radius: 4px; background: var(--mx-series); }
.rp-bar-row.dim .rp-bar-track span { background: var(--mx-series-soft); }
.rp-bar-row.dim .rp-bar-label { color: var(--muted); }
.rp-total { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 10px; border-top: 2px solid var(--text); font-size: 16px; font-weight: var(--w-strong); }
.rp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
.rp-table { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.rp-table th, .rp-table td { padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rp-table td { text-align: right; }
.rp-table thead th { font-size: 13px; color: var(--muted); font-weight: var(--w-ui); text-align: right; }
.rp-table thead th:first-child, .rp-table tbody th, .rp-table tfoot th { text-align: left; }
.rp-table tbody th { font-weight: var(--w-ui); }
.rp-table .sel { background: #f6eced; }
.rp-table thead th.sel { color: var(--brand); }
.rp-table .rp-sum th, .rp-table .rp-sum td { font-weight: var(--w-strong); border-top: 2px solid var(--text); border-bottom: 0; }
.rp-ch tbody th { min-width: 120px; }
.rp-ch .rp-bar-track { height: 6px; margin-top: 6px; }
.rp-orders { display: flex; flex-direction: column; }
.rp-order { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.rp-order:last-child { border-bottom: 0; }
.rp-order-time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.rp-order-main { display: flex; flex-direction: column; min-width: 0; }
.rp-order-amt { font-variant-numeric: tabular-nums; }
.rp-foot { text-align: center; margin: 4px 0 20px; }
.rp-src-head, .rp-src-row { display: grid; grid-template-columns: 96px 16px 1fr 44px; gap: 8px; align-items: center; }
.rp-src-head { margin: 10px 0 4px; }
.rp-src-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.rp-src-row input { width: 100%; }
.rp-src-prefix { text-transform: uppercase; letter-spacing: .08em; }
.rp-save { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.rp-save .btn.primary { width: auto; min-width: 140px; }
.rp-status { padding-left: 18px; margin: 10px 0 14px; line-height: 1.9; font-size: 14.5px; }
/* 手機：標題和選日期／月份放同一列（EC 2026-10-26） */
@media (max-width: 480px) {
  .rp-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 8px; }
  .rp-head.has-sub .rp-sub { grid-column: 1 / -1; margin-top: -6px; }
  .rp-title h1 { font-size: 20px; white-space: nowrap; }
  .rp-tools { flex-wrap: nowrap; gap: 6px; }
  .rp-month { gap: 4px; }
  .rp-month .btn { min-width: 34px; padding-left: 8px; padding-right: 8px; }
  .rp-dl span { display: none; }
  .card .rp-month-label .rp-long { display: none; }
  .card .rp-month-label .rp-short { display: inline; }
}
.rp-title a, .mx-head a { color: var(--brand); text-decoration: none; font-weight: var(--w-ui); }

/* ===== 日報、月報（EC 2026-10-26 定）：大卡＋四小卡、銷售管道和利潤、商品來源、明細
   配色是 REBUY 酒紅那組：大卡＝品牌酒紅、銷售＝磚紅、收購＝灰藍、利潤＝綠；線條是圓滑曲線＋漸層 ===== */
.rp-page { --rp-sell: #B4483A; --rp-sell-soft: #e9c8c3; --rp-buy: #4B7895; --rp-buy-soft: #c3d4e0; --rp-profit: #2E7D4F; }
.rp-sell { --mx-series: var(--rp-sell); --mx-series-soft: var(--rp-sell-soft); }
.rp-buy { --mx-series: var(--rp-buy); --mx-series-soft: var(--rp-buy-soft); }
.rp-spark { display: block; width: 100%; color: inherit; overflow: visible; }
.rp-spark-top { stop-opacity: .3; }
.rp-spark-line { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linejoin: round; }
.rp-spark-dot { stroke: currentColor; stroke-width: 7; stroke-linecap: round; }
.rp-hero { background: var(--brand); color: #fff; border-radius: 18px; padding: 16px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.rp-hero-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rp-hero-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rp-hero-col + .rp-hero-col { border-left: 1px solid rgba(255, 255, 255, .25); padding-left: 12px; }
.rp-hero-label { font-size: 13px; opacity: .85; font-weight: var(--w-ui); }
.rp-hero-big { font-size: 28px; line-height: 1.15; font-weight: var(--w-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rp-hero-foot { font-size: 12.5px; opacity: .9; display: flex; flex-direction: column; }
.rp-hero .rp-spark { height: 52px; color: #fff; }
.rp-hero .rp-spark-top { stop-opacity: .45; }
.rp-hero .rp-spark-dot { stroke: #fff; }
.rp-hero-axis { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; opacity: .75; margin-top: -4px; }
.rp-minis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.rp-mini { background: var(--card); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 1px; min-width: 0; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.rp-mini.sell { color: var(--rp-sell); } .rp-mini.buy { color: var(--rp-buy); }
.rp-mini-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: var(--w-ui); }
.rp-dot { width: 9px; height: 9px; border-radius: 3px; background: currentColor; display: inline-block; flex: none; }
.rp-mini-label .rp-dot { color: inherit; }
.rp-mini.sell .rp-dot { background: var(--rp-sell); } .rp-mini.buy .rp-dot { background: var(--rp-buy); }
.rp-mini-big { font-size: 24px; line-height: 1.25; font-weight: var(--w-strong); color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-mini-big.none { color: var(--muted); }
.rp-mini-foot { font-size: 13px; color: var(--muted); }
.rp-mini .rp-spark { height: 30px; margin-top: 6px; }
.rp-two { background: var(--mx-grid); }
.rp-bar-track.rp-two span.rp-two-sell { display: block; height: 100%; background: var(--rp-sell-soft); border-radius: 4px; overflow: hidden; }
.rp-bar-track.rp-two span.rp-two-profit { display: block; height: 100%; background: var(--rp-profit); border-radius: 0; }
.rp-no-profit .rp-bar-track.rp-two span.rp-two-sell { background: var(--rp-sell); }
.rp-pf-line { font-size: 13px; color: var(--rp-profit); margin-top: 3px; }
.rp-pf-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.rp-pf-stats > div { background: var(--ov-soft); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; }
.rp-pf-stats strong { font-size: 19px; color: var(--rp-profit); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rp-key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.rp-key.sell { background: var(--rp-sell-soft); } .rp-key.profit { background: var(--rp-profit); }
.rp-order-name { font-size: 16px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-orders.no-time .rp-order { grid-template-columns: 1fr auto; }
.rp-more { display: block; text-align: center; margin-top: 10px; color: var(--brand); text-decoration: none; font-size: 14px; font-weight: var(--w-ui); }
@media (min-width: 900px) {
  .rp-minis { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .rp-hero { padding: 18px 20px; }
  .rp-hero-row { grid-template-columns: 1fr 1fr; }
  .rp-hero-big { font-size: 40px; }
  .rp-hero .rp-spark { height: 70px; }
}
.rp-nowrap { white-space: nowrap; }

/* 商品來源看件數（EC 2026-10-26）：一條件數占比＋每人一列（件數、占比、金額，右邊小曲線） */
.rp-share-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.rp-share { display: flex; gap: 2px; height: 14px; border-radius: 7px; overflow: hidden; background: var(--mx-grid); margin-bottom: 14px; }
.rp-share span { display: block; height: 100%; flex-basis: 0; min-width: 4px; }
.rp-src-list { display: flex; flex-direction: column; }
.rp-src-item { display: grid; grid-template-columns: minmax(0, 1fr) 38%; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rp-src-item:last-child { border-bottom: 0; }
.rp-src-item.dim .rp-src-name { color: var(--muted); }
.rp-src-info { display: flex; flex-direction: column; min-width: 0; }
.rp-src-name { display: flex; align-items: center; gap: 6px; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-src-name .rp-dot { width: 10px; height: 10px; }
.rp-src-nums { font-size: 15px; font-variant-numeric: tabular-nums; }
.rp-src-item .rp-spark { height: 30px; }
.rp-src-note { margin: 8px 0 0; }
.rp-donut { width: 128px; height: 128px; }
.rp-donut-big { font-size: 30px; font-weight: var(--w-strong); fill: var(--text); }
.rp-donut-sub { font-size: 13px; fill: var(--muted); }
.rp-src-stats strong { color: var(--rp-buy); }

/* ===== 庫存報表（EC 2026-10-26：甜甜圈＋對比表，字放大、行距放寬） ===== */
.iv-ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 4px 0 14px; }
.iv-ctrl-label { font-size: 14px; }
.iv-seg { flex: none; }
.iv-seg span { padding: 7px 14px; white-space: nowrap; }
.iv-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 760px) { .iv-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.iv-kpis .mx-kpi { min-width: 0; }
/* 手機上一排兩格，「6,341.9 萬」字太大會把「萬」擠到下一行：不換行、字跟著螢幕寬度縮 */
.iv-kpis .mx-kpi-big { white-space: nowrap; }
@media (max-width: 759px) { .iv-kpis .mx-kpi-big { font-size: clamp(18px, 5.6vw, 26px); } }
.iv-warn .mx-kpi-big { color: var(--brand); }
.iv-line { white-space: nowrap; }
.iv-line.up { color: var(--danger); } .iv-line.down { color: var(--ok); }
.iv-jump { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.iv-jump a { font-size: 14px; color: var(--text); text-decoration: none; background: var(--bg); border-radius: 999px; padding: 4px 12px; font-weight: var(--w-ui); }
.iv-note { margin: 10px 0 0; }
.iv-card { container-type: inline-size; scroll-margin-top: 70px; }
.iv-card .mx-head { margin-bottom: 14px; }
.iv-body { display: grid; gap: 16px; grid-template-columns: 1fr; justify-items: center; }
@container (min-width: 640px) { .iv-body { grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: center; justify-items: stretch; } }
.iv-donut-box { display: flex; flex-direction: column; align-items: center; }
.iv-donut { position: relative; width: 180px; height: 180px; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.iv-donut svg { display: block; width: 100%; height: 100%; overflow: visible; }
.iv-slice { cursor: pointer; transition: opacity .15s, transform .15s; transform-origin: 90px 90px; }
.iv-donut.focus .iv-slice { opacity: .28; }
.iv-donut.focus .iv-slice.on { opacity: 1; transform: scale(1.04); }
.iv-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; }
.iv-center b { font-size: 19px; font-weight: var(--w-strong); font-variant-numeric: tabular-nums; line-height: 1.3; }
.iv-center span { font-size: 12.5px; color: var(--muted); }
.iv-center em { font-style: normal; font-size: 13px; font-weight: var(--w-ui); max-width: 104px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iv-center.picked span { color: var(--text); font-weight: var(--w-ui); }
.iv-hint { text-align: center; margin-top: 6px; }
.iv-table { width: 100%; border-collapse: collapse; font-size: 15.5px; table-layout: fixed; }
.iv-table th { white-space: nowrap; font-size: 13px; color: var(--muted); font-weight: var(--w-ui); text-align: right; padding: 0 0 8px; }
.iv-table th:first-child { text-align: left; }
.iv-table td { padding: 11px 0; border-top: 1px solid var(--line); text-align: right; vertical-align: middle; }
.iv-table td:first-child { text-align: left; }
.iv-table td + td, .iv-table th + th { padding-left: 12px; }
.iv-table td.num { font-weight: var(--w-ui); font-variant-numeric: tabular-nums; white-space: nowrap; }
.iv-table td.prev { color: var(--muted); font-weight: var(--w-text); }
.iv-table .w1 { width: 28%; } .iv-table .w2 { width: 26%; } .iv-table .w3 { width: 22%; } .iv-table .w4 { width: 24%; }
.iv-table tr.total td { border-top: 2px solid var(--text); font-weight: var(--w-strong); padding-top: 12px; }
.iv-table tr.hl td { background: var(--bg); }
.iv-table tr.other .iv-name { color: var(--muted); }
.iv-name { display: inline-flex; align-items: center; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.iv-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 10px; flex: none; }
.iv-pct { display: block; font-size: 12px; font-weight: var(--w-text); color: var(--muted); line-height: 1.3; margin-top: 2px; }
/* 差異：每一列都是同樣大小的圓角小塊、右邊對齊；箭頭縮小、百分比帶正負號 */
.iv-d { display: inline-block; min-width: 86px; padding: 4px 10px; border-radius: 10px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; line-height: 1.3; background: var(--bg); }
.iv-dv { display: block; font-size: 14.5px; font-weight: var(--w-ui); }
.iv-dv i { font-style: normal; font-size: 9px; margin-right: 4px; vertical-align: 2px; color: var(--muted); }
.iv-d small { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.iv-d.up { background: #f8e9e7; } .iv-d.up .iv-dv, .iv-d.up i, .iv-d.up small { color: var(--danger); }
.iv-d.down { background: #e7f2eb; } .iv-d.down .iv-dv, .iv-d.down i, .iv-d.down small { color: var(--ok); }
.iv-d.flat .iv-dv { color: var(--muted); }
/* 卡片窄（手機）：上週／上月底那欄收起來，只留本期和差異 */
@container (max-width: 520px) {
  .iv-table { font-size: 15px; }
  .iv-table .w1 { width: 37%; } .iv-table .w2 { width: 33%; } .iv-table .w4 { width: 30%; }
  .iv-table .c-prev { display: none; }
}
/* 手機：比較和金額件數兩組排同一列（EC 2026-10-26），拿掉「比較」兩個字 */
@media (max-width: 480px) {
  .iv-ctrl { flex-wrap: nowrap; gap: 8px; }
  .iv-ctrl-label { display: none; }
  .iv-seg span { padding: 7px 10px; font-size: 14px; }
  .iv-seg:first-of-type { flex: 1 1 auto; min-width: 0; }
}
/* 出貨按鈕（EC 2026-10-26）和待請款頁 */
.ord-ship-out { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.ord-due-sum { margin-top: 12px; }
#list > .card + .card { margin-top: 12px; }
.ord-due-total { font-size: 18px; color: var(--brand); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ord-due-days { display: block; font-size: 12px; color: var(--muted); }
.ord-due-days.late { color: var(--danger, #b3261e); font-weight: var(--w-ui); }
.ord-ship-out .btn:disabled { background: #d9d4cf; border-color: #d9d4cf; color: #fff; cursor: not-allowed; opacity: 1; }

/* ---------- 每個搜尋框的 X（common.js 自動加）：系統內建的叉叉藏起來，免得出現兩個 ---------- */
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.search-x-box { position: relative; display: flex; align-items: center; flex: 1 1 auto; min-width: 0; }
.search-x-box > input[type=search] { flex: 1; min-width: 0; width: 100%; padding-right: 40px; }
.search-x {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--line); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
}
.search-x.hidden { display: none; }
.search-x-box:has(> .mt-search) { margin-top: 8px; }
.search-x-box > .mt-search { margin: 0; }

/* ---------- 回到最上面（common.js 自動加）：往下滑過一半才出現 ---------- */
.to-top {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 7;
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--text);
  display: grid; place-items: center; box-shadow: 0 4px 14px rgba(0,0,0,.12); cursor: pointer; padding: 0;
  opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s, transform .2s;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
@media print { .to-top, .search-x { display: none !important; } }
/* 客戶（EC 2026-10-26）：客戶清單、客戶頁（統計、每月、管道、品牌、購買紀錄）；圖用報表的「銷售」色 */
.cu-filter { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.cu-filter > .muted { flex: none; }
.cu-range.tabs.sub { grid-template-columns: repeat(3, 1fr); margin-top: 0; flex: 1; max-width: 300px; }
.cu-sort { margin-top: 10px; }
.cu-sort select { width: 100%; }
.ord-stats.cu-sum { margin-top: 14px; grid-template-columns: 1fr 1fr; }
.cu-sum:not(.no-money) > :first-child { grid-column: 1 / -1; }
.cu-note { margin: 10px 0 0; }
.cu-list { display: flex; flex-direction: column; margin-top: 14px; }
.cu-row { display: flex; align-items: center; gap: 10px; padding: 12px 4px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.cu-row:first-child { border-top: none; }
.cu-row:active { background: #faf8f5; }
.cu-row .grow { flex: 1; min-width: 0; }
.cu-name { overflow-wrap: anywhere; }
.cu-name strong { font-size: 16px; }
.cu-reserved { display: inline-block; margin-left: 8px; padding: 0 7px; border-radius: 6px; background: #fff3cd; color: #8a5a00; font-size: 12px; font-weight: var(--w-ui); }
.cu-amt { font-size: 17px; color: var(--brand); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cu-amt.none { color: var(--muted); font-weight: var(--w-text); }
.cu-go { color: #c4bcb4; font-size: 20px; line-height: 1; }
.cu-empty { padding: 12px 4px; }
@media (min-width: 900px) {
  .cu-list { margin-top: 0; }
  .cu-row { padding: 12px 10px; border-radius: 10px; }
  .cu-row:hover { background: #faf8f5; }
}
/* 客戶總利潤（EC 2026-10-26，customer.view_profit）：放在銷售金額下面，EC 選了「帳本」排法
   綠色＝賺、紅色＝賠錢、灰色＝成本沒填；沒有利潤權限的人照原本只有 .cu-amt */
.cu-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.cu-meta > span { white-space: nowrap; }
.cu-meta .cu-reserved { margin-left: 0; }
.cu-amts { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; text-align: right; }
.cu-pf-miss { font-size: 12px; color: #a15c12; white-space: nowrap; }
.cu-sum > .cu-sumledger { grid-column: 1 / -1; }
.ord-stat strong.cu-pf-total { color: var(--ok); }
.ord-stat strong.cu-pf-total.loss { color: var(--danger); }
/* 每位客戶：「銷售」「利潤」兩行對齊，下面小字毛利率；總數下面一條長條（整條＝銷售、綠色＝利潤） */
.cu-ledger { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 10px; width: 136px; }
.cu-ledger .cu-pf-miss { grid-column: 1 / -1; text-align: right; }
@media (min-width: 900px) { .cu-ledger { width: 170px; } }
.cu-lg-lb { font-size: 12px; color: var(--muted); text-align: left; }
.cu-lg-v { font-size: 16px; color: var(--brand); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.cu-lg-v.none { color: var(--muted); font-weight: var(--w-text); }
.cu-lg-pf { font-size: 15px; color: var(--ok); }
.cu-lg-pf.loss { color: var(--danger); }
.cu-lg-pf.unknown { font-size: 13px; color: var(--muted); font-weight: var(--w-text); }
.cu-lg-foot { grid-column: 1 / -1; margin-top: 1px; font-size: 12px; color: var(--muted); white-space: nowrap; text-align: right; }
.ord-stat.cu-sumledger { gap: 4px; }
.cu-sl-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.cu-sum-bar { height: 8px; margin: 6px 0 2px; border-radius: 4px; background: #e9c8c3; overflow: hidden; }
.cu-sum-bar span { display: block; height: 100%; background: var(--ok); }
/* 手機一欄，照這個順序排；電腦兩欄（下面 900px 那段） */
.cu-detail { --mx-series: #B4483A; --mx-series-soft: #e9c8c3; display: flex; flex-direction: column; }
.cu-col { display: contents; }
.cu-info { order: 1; } .cu-stats { order: 2; } .cu-months { order: 3; } .cu-channels { order: 4; } .cu-brands { order: 5; } .cu-hist { order: 6; }
.cu-chart { min-height: 180px; }
.cu-back { display: inline-block; margin-bottom: 6px; text-decoration: none; }
.cu-title { margin: 0 0 4px; overflow-wrap: anywhere; }
.cu-edit { margin: 12px 0 0; }
.cu-sub { margin: 0 0 10px; }
.cu-hero { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 14px; }
.cu-hero strong { font-size: 34px; line-height: 1.15; color: var(--brand); font-variant-numeric: tabular-nums; }
.cu-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cu-tiles:empty { display: none; }
.cu-tile { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px 12px; border-radius: 12px; background: #faf7f3; border: 1px solid var(--line); }
.cu-tile strong { font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cu-tile.hold, .cu-tile.warn, .cu-tile.wide { grid-column: 1 / -1; }
.cu-tile.hold { background: #fffaeb; border-color: #f3e2ad; }
.cu-tile.warn { background: #fbefee; border-color: #f0cfcc; }
.cu-tile.warn strong { color: var(--danger); }
.cu-cancelled { margin: 10px 0 0; }
.cu-bars { display: flex; flex-direction: column; gap: 12px; }
.cu-bar-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 15px; }
.cu-bar-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cu-bar-num { display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cu-bar-track { height: 8px; border-radius: 4px; background: var(--mx-grid); margin-top: 4px; overflow: hidden; }
.cu-bar-track span { display: block; height: 100%; border-radius: 4px; background: var(--mx-series); }
.cu-history { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.cu-h { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fffdfb; color: inherit; text-decoration: none; }
a.cu-h:active, a.cu-h:hover { background: #faf8f5; }
.cu-h.cancelled { opacity: .55; }
.cu-h.returned { opacity: .6; }
.cu-h-top { align-items: baseline; }
.cu-h-amt { font-size: 17px; color: var(--brand); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cu-h-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cu-h-lines { display: flex; flex-direction: column; gap: 4px; padding-top: 6px; border-top: 1px dashed var(--line); }
.cu-h-line { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.cu-h-item { min-width: 0; overflow-wrap: anywhere; }
.cu-h-brand { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 5px; background: #f3ece8; font-size: 12px; font-weight: var(--w-ui); }
.cu-h-price { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ord-cust-link { margin-top: 12px; }
.ord-split-rows { display: grid; gap: 10px; }
.ord-split-row { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.ord-split-left { margin: 0; }
.ord-swap { display: grid; gap: 8px; margin-top: 12px; justify-items: start; }
.ord-swap .field { width: 100%; }
@media (min-width: 900px) {
  .cu-detail { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 0 18px; align-items: start; }
  .cu-col { display: flex; flex-direction: column; min-width: 0; }
}

/* ===== 訊息中心設定（EC 2026-10-26）：視窗與串接帳號 ===== */
.ch-page { max-width: 880px; }
.ch-head { margin-bottom: 12px; align-items: flex-end; }
.ch-head h1 { margin: 0; }
.ch-head p { margin: 2px 0 0; }
.ch-head .btn { white-space: nowrap; }
.ch-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.ch-kind.ch-sales { background: #f6e7e8; color: var(--brand); }
.ch-kind.ch-purchase { background: #e7f0fb; color: #2a5a8f; }
.ch-meta { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 8px 12px; margin: 14px 0 6px; font-size: 15px; }
.ch-meta dt { color: var(--muted); }
.ch-meta dd { margin: 0; }
.ch-accs { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.ch-accs h3 { font-size: 15px; margin: 0; }
.ch-acc { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.ch-acc-top { display: flex; align-items: center; gap: 10px; }
.ch-acc-hint { margin: 0; }
.pill.ch-on { background: #e3f6e8; color: #1d7a3a; }
.pill.ch-off { background: #fff1d6; color: #8a5a00; }
.pill.ch-gray { background: #ece9e4; color: #5d5650; }
.ch-hook { display: flex; gap: 8px; align-items: center; }
.ch-hook code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; background: var(--bg); padding: 5px 8px; border-radius: 6px; }
.ch-usage { display: flex; flex-direction: column; gap: 4px; }
.ch-ubar { height: 8px; border-radius: 4px; background: #ece9e4; overflow: hidden; }
.ch-ubar span { display: block; height: 100%; width: 0; background: var(--brand); }
.ch-who { display: flex; flex-direction: column; gap: 8px; }
.ch-who-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ch-lprev { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; background: #eef1f5; max-width: 360px; }
.ch-lprev-cap { font-size: 12px; color: var(--muted); }
.ch-lprev-row { display: flex; gap: 8px; align-items: flex-start; }
.ch-lprev-ava { flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; background: #5f7f9a; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: var(--w-strong); }
.ch-lprev-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ch-lprev-name { font-size: 12px; color: #555; }
.ch-lprev-bubble { align-self: flex-start; background: #fff; border-radius: 14px; border-top-left-radius: 4px; padding: 6px 11px; font-size: 14px; }
.ch-acc:last-of-type { border-bottom: 0; }
.ch-acc.dim { opacity: .55; }
.ch-acc-name { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.35; }
.ch-plat { min-width: 76px; text-align: center; }
.ch-plat.ch-line { background: #e3f6e8; color: #1d7a3a; }
.ch-plat.ch-fb { background: #e6eefb; color: #2950a3; }
.ch-plat.ch-ig { background: #fbe7f1; color: #a3285f; }
.ch-form { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.ch-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.ch-picker { display: flex; flex-direction: column; gap: 8px; }
.ch-chip { display: inline-flex; align-items: center; gap: 4px; }
.ch-x { all: unset; cursor: pointer; color: var(--muted); padding: 0 2px; }
@media (min-width: 700px) { .ch-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- 列印標籤（EC 2026-10-27）：預設 5×3 公分（實量 5.2×3.1，留一點安全邊），尺寸和排版在庫存設定改；紙張大小由 label-common.js 設 ---------- */
.lbl-sheet { display: none; }
.lbl-page ~ .lbl-sheet { display: flex; flex-wrap: wrap; justify-content: center; gap: 4mm; padding: 0 16px 120px; zoom: 2; }
.lbl-preview [data-part] { cursor: pointer; border-radius: .4mm; }
.lbl-preview [data-part]:hover { outline: .2mm dashed var(--accent, #8b1a2b); }
.lbl-preview .lbl-off { opacity: .22; }
.lbl-preview { display: flex; flex-wrap: wrap; gap: 4mm; zoom: 2; margin: 8px 0; }
.lbl { width: var(--lw, 50mm); height: var(--lh, 30mm); box-sizing: border-box; background: #fff; color: #000; overflow: hidden; box-shadow: 0 1px 6px rgba(0,0,0,.18); }
.lbl-frame { height: calc(100% - var(--lpy, 0mm)); margin: var(--lpy, 0mm) 0 0 var(--lpx, 0mm); box-sizing: border-box; }
.lbl-qr { flex-shrink: 0; display: block; }
.lbl-mark, .lbl-brand, .lbl-name { display: none; }
.lbl-sku, .lbl-title, .lbl-name, .lbl-brand, .lbl-info div { overflow: hidden; overflow-wrap: anywhere; }
.lbl-sku { white-space: nowrap; line-height: 1; font-weight: var(--w-strong); }
.lbl-title { line-height: 1.22; max-height: 2.44em; }
.lbl-info div { line-height: 1.2; max-height: 2.4em; }
.lbl-model { font-weight: var(--w-ui); white-space: nowrap; }
.lbl-extra { white-space: nowrap; }
.lbl-grade + .lbl-price::before { content: ' · '; }
/* A 經典置中：外框圓角，編號大字下面一條細線，跟現在的吊牌最像 */
.lbl-a { padding: 1.3mm; }
.lbl-a .lbl-frame { border: .3mm solid #000; border-radius: 1.2mm; padding: 1mm 1.6mm .9mm; display: flex; flex-direction: column; align-items: center; }
.lbl-a .lbl-sku { font-size: calc(7mm * var(--fs-sku, 1)); letter-spacing: .05em; padding-bottom: .7mm; border-bottom: .2mm solid #000; max-width: 100%; }
.lbl-a .lbl-title { width: 100%; text-align: center; font-size: calc(2.8mm * var(--fs-title, 1)); font-weight: var(--w-ui); margin-top: .9mm; }
.lbl-a .lbl-bottom { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; gap: 1.8mm; margin-top: .4mm; }
.lbl-a .lbl-qr { width: 10.5mm; height: 10.5mm; }
.lbl-a .lbl-info { flex: 1; min-width: 0; max-height: 10.5mm; display: flex; flex-direction: column; justify-content: center; gap: .3mm; }
.lbl-a .lbl-info div { font-size: calc(2.8mm * var(--fs-info, 1)); }
/* G 左黑條直書：左邊黑條直寫品牌，右邊編號、品名、QR */
.lbl-g { padding: 1.2mm; }
.lbl-g .lbl-frame { border: .3mm solid #000; display: grid; grid-template-columns: 6mm minmax(0, 1fr); grid-template-rows: max-content max-content minmax(0, 1fr); grid-template-areas: 'brand sku' 'brand title' 'brand bottom'; column-gap: 1.6mm; padding-right: 1.4mm; }
.lbl-g .lbl-brand { display: block; grid-area: brand; max-height: calc(var(--lh, 30mm) - 3mm); background: #000; color: #fff; writing-mode: vertical-rl; text-orientation: mixed; transform: rotate(180deg); text-align: center; font-size: calc(3.6mm * var(--fs-brand, 1)); line-height: 6mm; letter-spacing: .12em; white-space: nowrap; font-weight: var(--w-strong); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.lbl-g .lbl-sku { grid-area: sku; font-size: calc(6mm * var(--fs-sku, 1)); letter-spacing: .03em; margin-top: 1mm; }
.lbl-g .lbl-title { display: none; }
.lbl-g .lbl-name { display: block; grid-area: title; font-size: calc(2.6mm * var(--fs-title, 1)); line-height: 1.22; max-height: 2.44em; font-weight: var(--w-ui); margin-top: .8mm; }
.lbl-g .lbl-bottom { grid-area: bottom; min-height: 0; display: flex; align-items: center; gap: 1.6mm; }
.lbl-g .lbl-qr { width: 10mm; height: 10mm; }
.lbl-g .lbl-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: .3mm; }
.lbl-g .lbl-info div { font-size: calc(2.5mm * var(--fs-info, 1)); }
/* J 票券：左邊資料、虛線隔開、右邊 QR 存根 */
.lbl-j { padding: 1.2mm; }
.lbl-j .lbl-frame { position: relative; border: .3mm solid #000; border-radius: 1.4mm; display: grid; grid-template-columns: minmax(0, 1fr) 13mm; grid-template-rows: max-content max-content minmax(0, 1fr); grid-template-areas: 'sku stub' 'title stub' 'info stub'; }
.lbl-j .lbl-frame::before, .lbl-j .lbl-frame::after { content: ''; position: absolute; right: 12mm; width: 2mm; height: 2mm; border: .3mm solid #000; border-radius: 50%; background: #fff; box-sizing: border-box; }
.lbl-j .lbl-frame::before { top: -1.15mm; }
.lbl-j .lbl-frame::after { bottom: -1.15mm; }
.lbl-j .lbl-sku { grid-area: sku; font-size: calc(5.8mm * var(--fs-sku, 1)); letter-spacing: .03em; margin: 1.4mm 1.4mm 0 1.6mm; }
.lbl-j .lbl-title { grid-area: title; font-size: calc(2.6mm * var(--fs-title, 1)); font-weight: var(--w-ui); margin: .8mm 1.4mm 0 1.6mm; }
.lbl-j .lbl-bottom { display: contents; }
.lbl-j .lbl-mark { display: flex; grid-area: stub; border-left: .3mm dashed #000; align-items: flex-end; justify-content: center; font-size: 1.8mm; letter-spacing: .25em; font-weight: var(--w-ui); padding-bottom: 1.4mm; }
.lbl-j .lbl-qr { grid-column: 2; grid-row: 1 / 3; width: 10.5mm; height: 10.5mm; margin: 1.4mm 0 0 .3mm; justify-self: center; align-self: start; }
.lbl-j .lbl-info { grid-area: info; align-self: end; min-width: 0; margin: 0 1.4mm 1.2mm 1.6mm; }
.lbl-j .lbl-info div { font-size: calc(2.5mm * var(--fs-info, 1)); }
/* K 雙欄極簡：中間一條直線，左邊文字，右邊 QR＋品牌 */
.lbl-k { padding: 1.8mm 2mm; }
.lbl-k .lbl-frame { display: grid; grid-template-columns: minmax(0, 1fr) 13mm; grid-template-rows: max-content max-content minmax(0, 1fr); grid-template-areas: 'sku side' 'title side' 'info side'; column-gap: 0; }
.lbl-k .lbl-sku { grid-area: sku; font-size: calc(6mm * var(--fs-sku, 1)); letter-spacing: .03em; padding-right: 1.6mm; }
.lbl-k .lbl-title { grid-area: title; font-size: calc(2.6mm * var(--fs-title, 1)); font-weight: var(--w-ui); margin-top: 1mm; padding-right: 1.6mm; }
.lbl-k .lbl-bottom { display: contents; }
.lbl-k .lbl-info { grid-area: info; align-self: end; min-width: 0; padding-right: 1.6mm; }
.lbl-k .lbl-info div { font-size: calc(2.5mm * var(--fs-info, 1)); }
.lbl-k .lbl-model { border-top: .15mm solid #000; padding-top: .5mm; }
.lbl-k .lbl-qr { grid-column: 2; grid-row: 1 / 3; width: 11.4mm; height: 11.4mm; justify-self: end; align-self: start; }
/* 品牌在右欄底下，太長（BOTTEGA VENETA）就照字分兩行 */
.lbl-k .lbl-brand { grid-area: side; border-left: .25mm solid #000; padding-left: 1.6mm; font-size: calc(3mm * var(--fs-brand, 1)); text-align: center; line-height: 1.1; align-self: stretch; display: flex; align-items: flex-end; justify-content: center; overflow-wrap: normal; letter-spacing: .06em; font-weight: var(--w-strong); }
/* L 黑條三欄（預設，EC 2026-10-27 挑的）：左黑條直寫品牌｜中間文字｜直線右邊 QR＋REBUY（G＋K） */
.lbl-l { padding: 1.2mm; }
.lbl-l .lbl-frame { border: .3mm solid #000; display: grid; grid-template-columns: 6mm minmax(0, 1fr) 12.6mm; grid-template-rows: max-content max-content minmax(0, 1fr); grid-template-areas: 'brand sku side' 'brand name side' 'brand info side'; }
/* 直書黑條高度＝標籤高度－上下留白和框線，品牌太長才量得出來要縮字 */
.lbl-l .lbl-brand, .lbl-n .lbl-brand { display: block; grid-area: brand; max-height: calc(var(--lh, 30mm) - 3mm); background: #000; color: #fff; writing-mode: vertical-rl; text-orientation: mixed; text-align: center; font-size: calc(3.4mm * var(--fs-brand, 1)); line-height: 6mm; letter-spacing: .12em; white-space: nowrap; font-weight: var(--w-strong); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.lbl-l .lbl-brand { transform: rotate(180deg); }
.lbl-l .lbl-sku { grid-area: sku; font-size: calc(5.6mm * var(--fs-sku, 1)); letter-spacing: .03em; margin: 1.2mm 1.4mm 0 1.6mm; }
.lbl-l .lbl-title { display: none; }
.lbl-l .lbl-name { display: block; grid-area: name; font-size: calc(2.5mm * var(--fs-title, 1)); line-height: 1.22; max-height: 2.44em; font-weight: var(--w-ui); margin: .8mm 1.4mm 0 1.6mm; }
.lbl-l .lbl-bottom { display: contents; }
.lbl-l .lbl-info { grid-area: info; align-self: end; min-width: 0; margin: 0 1.4mm 1.1mm 1.6mm; }
.lbl-l .lbl-info div { font-size: calc(2.4mm * var(--fs-info, 1)); }
.lbl-l .lbl-model { border-top: .15mm solid #000; padding-top: .5mm; }
.lbl-l .lbl-mark { display: flex; grid-area: side; border-left: .25mm solid #000; align-items: flex-end; justify-content: center; font-size: 1.7mm; letter-spacing: .2em; font-weight: var(--w-ui); padding-bottom: 1.2mm; }
.lbl-l .lbl-qr { grid-column: 3; grid-row: 1 / 3; width: 10.8mm; height: 10.8mm; margin-top: 1.1mm; justify-self: center; align-self: start; }
/* N 右黑條：文字靠左，QR 旁邊一條黑條直寫品牌 */
.lbl-n { padding: 1.2mm; }
.lbl-n .lbl-frame { border: .3mm solid #000; display: grid; grid-template-columns: minmax(0, 1fr) 11.6mm 6mm; grid-template-rows: max-content max-content minmax(0, 1fr); grid-template-areas: 'sku qr brand' 'title qr brand' 'info info brand'; column-gap: 1.2mm; padding-left: 1.6mm; }
.lbl-n .lbl-sku { grid-area: sku; font-size: calc(5.8mm * var(--fs-sku, 1)); letter-spacing: .03em; margin-top: 1.2mm; }
.lbl-n .lbl-title { display: none; }
.lbl-n .lbl-name { display: block; grid-area: title; font-size: calc(2.6mm * var(--fs-title, 1)); line-height: 1.22; max-height: 2.44em; font-weight: var(--w-ui); margin-top: .8mm; }
.lbl-n .lbl-bottom { display: contents; }
.lbl-n .lbl-qr { grid-area: qr; width: 11.6mm; height: 11.6mm; margin-top: .8mm; }
.lbl-n .lbl-info { grid-area: info; align-self: end; min-width: 0; padding-bottom: 1.1mm; }
.lbl-n .lbl-info div { font-size: calc(2.5mm * var(--fs-info, 1)); }
.lbl-n .lbl-model { border-top: .15mm solid #000; padding-top: .5mm; }
/* O 細黑條：左邊細黑條直寫 REBUY，右欄 QR＋品牌（K 的直線） */
.lbl-o { padding: 1.2mm; }
.lbl-o .lbl-frame { border: .3mm solid #000; display: grid; grid-template-columns: 3.6mm minmax(0, 1fr) 12.6mm; grid-template-rows: max-content max-content minmax(0, 1fr); grid-template-areas: 'mark sku side' 'mark title side' 'mark info side'; }
.lbl-o .lbl-mark { display: block; grid-area: mark; max-height: calc(var(--lh, 30mm) - 3mm); background: #000; color: #fff; writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; font-size: 1.9mm; line-height: 3.6mm; letter-spacing: .4em; font-weight: var(--w-ui); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.lbl-o .lbl-sku { grid-area: sku; font-size: calc(5.8mm * var(--fs-sku, 1)); letter-spacing: .03em; margin: 1.2mm 1.4mm 0 1.6mm; }
.lbl-o .lbl-title { grid-area: title; font-size: calc(2.5mm * var(--fs-title, 1)); font-weight: var(--w-ui); margin: .8mm 1.4mm 0 1.6mm; }
.lbl-o .lbl-bottom { display: contents; }
.lbl-o .lbl-info { grid-area: info; align-self: end; min-width: 0; margin: 0 1.4mm 1.1mm 1.6mm; }
.lbl-o .lbl-info div { font-size: calc(2.4mm * var(--fs-info, 1)); }
.lbl-o .lbl-model { border-top: .15mm solid #000; padding-top: .5mm; }
.lbl-o .lbl-brand { display: flex; grid-area: side; border-left: .25mm solid #000; align-items: flex-end; justify-content: center; font-size: calc(2.6mm * var(--fs-brand, 1)); line-height: 1.1; padding-bottom: 1.1mm; text-align: center; overflow-wrap: normal; letter-spacing: .05em; font-weight: var(--w-strong); }
.lbl-o .lbl-qr { grid-column: 3; grid-row: 1 / 3; width: 10.8mm; height: 10.8mm; margin-top: 1.1mm; justify-self: center; align-self: start; }
.lbl-done { margin-top: 12px; }
@media (max-width: 700px) { .lbl-page ~ .lbl-sheet { zoom: 1.5; } }
.inv-print-btn { text-decoration: none; color: var(--brand); border-color: rgba(126,24,34,.35); }
/* ---------- 訊息中心收件匣（第 3 步，EC 2026-10-27 看過示意第六版） ---------- */
.ib-page { padding: 0; }
.ib-body.ib-fixed { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.ib-body.ib-fixed .ib-page { flex: 1; min-height: 0; }
.ib-fixed .ib-inbox { height: 100%; }
.ib-body.ib-full .tabbar { display: none; }
.ib-body.ib-full.has-tabbar { padding-bottom: 0; }
.ib-pane { background: var(--card); min-width: 0; min-height: 0; }
.ib-pad { padding: 12px 16px; margin: 0; }
.ib-empty { display: flex; align-items: center; justify-content: center; background: var(--bg); }
.ib-cols { display: grid; grid-template-columns: 360px minmax(0, 1fr); }
.ib-cols.with-card { grid-template-columns: 340px minmax(0, 1fr) 340px; }
.ib-cols .ib-list { border-right: 1px solid var(--line); overflow-y: auto; }
.ib-cols .ib-card { border-left: 1px solid var(--line); overflow-y: auto; }
.ib-fixed .ib-conv, .ib-fixed .ib-card { height: 100%; }
.ib-fixed:not(.ib-full) .ib-card { overflow-y: auto; }
.ib-body.ib-full .ib-card { overflow-y: auto; }

/* 清單 */
.ib-list-head { padding: 14px 16px 6px; }
.ib-list-head h1 { font-size: 20px; margin: 0; }
.ib-wins { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 10px; scrollbar-width: none; }
.ib-wins::-webkit-scrollbar { display: none; }
.ib-cols .ib-list .ib-wins { flex-wrap: wrap; overflow: visible; }
.ib-win { all: unset; display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 14px; font-weight: var(--w-ui); white-space: nowrap; cursor: pointer; }
.ib-win.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.ib-count { min-width: 18px; padding: 0 5px; border-radius: 999px; background: #f6e7e8; color: var(--brand); font-size: 12px; line-height: 18px; text-align: center; }
.ib-win.on .ib-count, .ib-st.on .ib-count { background: #fff; color: var(--brand); }
.ib-sts { display: flex; flex-shrink: 0; margin: 2px 16px 8px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.ib-st { all: unset; flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 0; font-size: 14px; font-weight: var(--w-ui); cursor: pointer; color: var(--text); background: var(--card); }
.ib-st .ib-count { background: #ece9e4; color: var(--muted); }
.ib-st.on { background: var(--brand); color: #fff; }
.ib-search { margin: 0 16px 8px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 10px; background: var(--bg); color: var(--muted); }
.ib-search svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ib-search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 9px 0; font-size: 16px; color: var(--text); outline: none; }
.ib-search input:focus { box-shadow: none; }
.ib-search:focus-within { box-shadow: 0 0 0 3px rgba(126,24,34,.12); }
.ib-search-x { flex-shrink: 0; width: 26px; height: 26px; border: 0; border-radius: 50%; background: var(--line); color: var(--muted); font: inherit; font-size: 12px; line-height: 1; cursor: pointer; }
.ib-search-x[hidden] { display: none; }
.ib-row { display: flex; gap: 12px; align-items: center; padding: 12px 16px; text-decoration: none; color: var(--text); border-top: 1px solid var(--line); }
.ib-row.on { background: #fbf4f4; }
.ib-row.done { opacity: .75; }
.ib-ava { flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 17px; font-weight: var(--w-strong); }
.ib-ava.sm { width: 36px; height: 36px; font-size: 15px; }
.ib-ava.big { width: 52px; height: 52px; font-size: 21px; }
.ib-c0 { background: #c98b6b; } .ib-c1 { background: #8f7bb0; } .ib-c2 { background: #5f9a8a; } .ib-c3 { background: #b9756f; }
.ib-c4 { background: #7d8fa8; } .ib-c5 { background: #a58a5c; } .ib-c6 { background: #6f9bb5; } .ib-c7 { background: #9a7d8f; }
.ib-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ib-row-top, .ib-row-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ib-row-top strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-time { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.ib-owner { color: var(--muted); font-size: 12px; white-space: nowrap; }
.ib-preview { flex: 1; min-width: 0; color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-row.unread .ib-preview { color: var(--text); }
.ib-badge { flex-shrink: 0; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 12px; line-height: 20px; text-align: center; font-weight: var(--w-ui); }
.ib-doneby { color: var(--ok); }
.pill.ib-plat { flex-shrink: 0; font-size: 11px; padding: 0 6px; }
.pill.ib-line { background: #e3f6e8; color: #1d7a3a; }
.pill.ib-facebook { background: #e6eefb; color: #2950a3; }
.pill.ib-instagram { background: #fbe7f1; color: #a3285f; }
.pill.ib-tag { flex-shrink: 0; font-size: 12px; }
.pill.ib-tag.bad { background: #fde4e1; color: var(--danger); }
.pill.ib-tag.warn { background: #fff1d6; color: #8a5a00; }
.pill.ib-tag.gray { background: #ece9e4; color: #5d5650; }

/* 對話 */
.ib-conv { display: flex; flex-direction: column; background: var(--bg); }
.ib-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.ib-who { flex: 1; min-width: 0; line-height: 1.35; }
.ib-who strong { font-size: 16px; }
.ib-who .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-head .btn { white-space: nowrap; }
.ib-back { all: unset; cursor: pointer; color: var(--brand); font-size: 30px; line-height: 1; padding: 0 6px 4px 0; }
.ib-cols .ib-conv .ib-back { display: none; }
.ib-donebtn.on { background: #e6f2ea; color: var(--ok); border-color: #bfdcc9; }
.ib-banner { display: flex; flex-direction: column; gap: 2px; padding: 9px 16px; border-bottom: 1px solid var(--line); }
.ib-banner.gray { background: #ece9e4; color: #4d4640; }
.ib-banner.warn { background: #fff4e0; color: #6d4700; }
.ib-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.ib-day { align-self: center; font-size: 12px; color: var(--muted); background: #ebe8e3; border-radius: 999px; padding: 2px 10px; }
.ib-older { align-self: center; margin: 0; }
.ib-msg { display: flex; flex-direction: column; max-width: 78%; }
.ib-msg.in { align-self: flex-start; }
.ib-msg.out { align-self: flex-end; align-items: flex-end; }
.ib-bubble { padding: 9px 13px; border-radius: 16px; font-size: 15px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.ib-msg.in .ib-bubble { background: var(--card); border-top-left-radius: 6px; box-shadow: 0 1px 2px rgba(60, 40, 30, .06); }
.ib-msg.out .ib-bubble { background: var(--brand); color: #fff; border-top-right-radius: 6px; }
.ib-msg.out .ib-bubble a { color: #fff; }
.ib-msg.bad.out .ib-bubble { background: #c9a2a6; }
.ib-bubble.ib-other { background: #f1eee9 !important; color: var(--muted) !important; font-size: 13px; }
.ib-sticker { width: 120px; height: 120px; object-fit: contain; display: block; }
.ib-emoji { width: 1.6em; height: 1.6em; object-fit: contain; vertical-align: middle; }
.ib-photo { width: 200px; max-height: 260px; border-radius: 14px; display: block; object-fit: cover; background: #ece7e0; }
.ib-photo-link { display: block; cursor: zoom-in; }
/* 照片大圖：黑底蓋整個畫面 */
body.ib-viewing { overflow: hidden; }
.ib-view { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, .7); display: flex; align-items: center; justify-content: center; }
.ib-view-stage { position: absolute; inset: 56px 64px 24px; display: flex; align-items: center; justify-content: center; }
.ib-view-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; background: #2a2725; }
.ib-view-top { position: absolute; top: 0; left: 0; right: 0; height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 20px; color: #fff; z-index: 1; }
.ib-view-count { font-size: 15px; opacity: .85; }
.ib-view-tools { display: flex; gap: 8px; }
.ib-view-btn { width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; font: inherit; font-size: 18px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer; }
.ib-view-btn:hover { background: rgba(255, 255, 255, .22); }
.ib-view-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; font: inherit; font-size: 30px; line-height: 1; cursor: pointer; z-index: 1; }
.ib-view-nav:hover { background: rgba(255, 255, 255, .22); }
.ib-view-nav.prev { left: 10px; }
.ib-view-nav.next { right: 10px; }
.ib-view-nav[hidden] { display: none; }
@media (max-width: 700px) {
  .ib-view-stage { inset: 56px 0 16px; }
  .ib-view-nav { width: 40px; height: 40px; font-size: 26px; background: rgba(0, 0, 0, .35); }
}
.ib-phstate { width: 200px; min-height: 120px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; background: #ece9e4; color: var(--muted); padding: 12px; }
.ib-phstate svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; opacity: .7; }
.ib-phstate.wait { background: #eef1f5; color: #4c6680; }
.ib-phstate.down { background: #fff4e0; color: #8a5a00; }
.ib-meta { margin-top: 3px; font-size: 12px; color: var(--muted); padding: 0 4px; }
.ib-by { color: var(--text); font-weight: var(--w-ui); }
.ib-sent { color: var(--ok); }
.ib-fail { color: var(--danger); font-weight: var(--w-ui); }
.ib-unk { color: #8a5a00; font-weight: var(--w-ui); }
.ib-retry { margin-top: 6px; max-width: 300px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding: 8px 10px; border-radius: 10px; background: #fde4e1; color: var(--danger); text-align: right; }
.ib-retry.unk { background: #fff4e0; color: #6d4700; text-align: left; align-items: stretch; }
.ib-retry.unk .btn { align-self: flex-end; }
.ib-compose { background: var(--card); border-top: 1px solid var(--line); padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); }
.ib-via { padding: 0 2px 6px; }
.ib-free { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ok); padding: 0 2px 6px; }
.ib-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.ib-ico { all: unset; cursor: pointer; flex: none; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.ib-ico:hover:not(:disabled) { color: var(--brand); background: rgba(0, 0, 0, .04); }
.ib-ico:focus-visible { outline: 2px solid var(--brand); }
.ib-ico:disabled { opacity: .35; cursor: default; }
.ib-compose-row { display: flex; gap: 4px; align-items: flex-end; }
.ib-inputwrap { flex: 1; min-width: 0; position: relative; display: flex; margin-left: 4px; margin-right: 4px; }
.ib-ico-in { position: absolute; right: 2px; bottom: 0; }
.ib-compose textarea { flex: 1; min-width: 0; width: 100%; box-sizing: border-box; resize: none; border: 1px solid var(--line); border-radius: 18px; padding: 9px 44px 9px 14px; font-size: 16px; background: var(--bg); color: var(--text); min-height: 40px; max-height: 150px; }
.ib-compose .btn { flex: none; border-radius: 18px; padding: 8px 16px; }

/* 貼圖抽屜 */
.ib-sheet-bg { position: fixed; inset: 0; background: rgba(30, 20, 15, .4); z-index: 50; }
.ib-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; background: var(--card); border-radius: 18px 18px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0, 0, 0, .15); max-height: 85vh; display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 900px) { .ib-sheet { left: 50%; right: auto; width: 560px; transform: translateX(-50%); bottom: 24px; border-radius: 18px; } }
.ib-grip { width: 40px; height: 5px; border-radius: 3px; background: #ddd6cd; margin: 2px auto 0; }
.ib-sheet-title { font-size: 18px; }
.ib-stktabs { padding: 0; }
.ib-stkgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; overflow-y: auto; min-height: 0; flex: 1; max-height: 46vh; }
.ib-stkcell { all: unset; cursor: pointer; border: 2px solid transparent; border-radius: 12px; background: transparent; padding: 6px; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.ib-stkcell:hover { background: rgba(0, 0, 0, .04); }
.ib-stkcell.on { border-color: var(--brand); background: #fbeff0; }
.ib-stkimg { width: 100%; height: 100%; object-fit: contain; }
.ib-stkcell .ib-bubble { padding: 0; font-size: 12px; }
.ib-sheet p { margin: 0; }
.ib-sheet-act { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
/* 對話裡開單（第 4 步）：開單那張、對話上面的訂單卡 */
.ib-osheet { max-height: 92vh; }
@media (min-width: 900px) { .ib-osheet { width: 620px; max-height: 88vh; } }
.ib-obody { overflow-y: auto; min-height: 0; flex: 1; display: grid; gap: 14px; align-content: start; }
.ib-osec { display: grid; gap: 8px; }
.ib-osec h3 { margin: 0; font-size: 15px; }
.ib-osearch input { width: 100%; }
.ib-ores { display: flex; flex-direction: column; gap: 6px; max-height: 32vh; overflow-y: auto; }
.ib-ores:empty { display: none; }
.ib-olinebox { display: grid; gap: 6px; }
.ib-osum { padding: 2px 2px 0; }
.ib-ostrip { display: flex; gap: 8px; overflow-x: auto; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #fbf9f6; flex: none; }
.ib-ocard { flex: none; width: 230px; display: grid; gap: 3px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: inherit; text-decoration: none; }
a.ib-ocard:hover { border-color: var(--brand); }
.ib-otags { display: inline-flex; gap: 4px; }
.ib-olines { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-omiss { font-size: 12px; color: #8a5a00; background: #fff3cd; border-radius: 6px; padding: 2px 6px; }
.ib-ocard { cursor: pointer; }
.ib-ocard:hover { border-color: var(--brand); }
.ib-oclose { min-width: 36px; }
.ib-orow { display: grid; grid-template-columns: 64px 1fr; gap: 8px; align-items: baseline; }
.ib-ofrom { color: #1d5a3a; background: #e6f4ea; border-radius: 6px; padding: 4px 8px; }
.ib-fill { font-size: 12px; }
.ib-oship summary { cursor: pointer; font-weight: var(--w-ui); color: var(--brand); }
/* 從相簿挑照片傳給客人：預設全選，點掉不要的；數字是送出的順序 */
.ib-agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.ib-acell { all: unset; cursor: pointer; position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 3px solid transparent; opacity: .45; background: #f1ede8; }
.ib-acell.on { border-color: var(--brand); opacity: 1; }
.ib-acell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ib-anoprev { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px; text-align: center; font-size: 12px; color: var(--muted, #6b625b); word-break: break-all; }
.ib-anoprev small { font-size: 11px; }
.ib-anum { position: absolute; top: 4px; left: 4px; min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box; border-radius: 10px; background: var(--brand); color: #fff; font-size: 12px; font-weight: var(--w-strong); display: flex; align-items: center; justify-content: center; }
.ib-asentbox { display: grid; gap: 4px; width: min(280px, 70vw); }
.ib-asent { display: grid; gap: 3px; border-radius: 12px; overflow: hidden; }
.ib-asent.n1 { grid-template-columns: 1fr; }
.ib-asentbox:has(.n1) { width: min(200px, 60vw); }
.ib-asent.n2 { grid-template-columns: 1fr 1fr; }
.ib-asent.n3 { grid-template-columns: 1fr 1fr 1fr; }
.ib-asent img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #f1ede8; }
.ib-astate { gap: 8px; }

/* 客戶卡 */
.ib-card-head { align-items: flex-start; border-bottom: 0; padding-top: 14px; }
.ib-card-head h2 { margin: 0 0 2px; font-size: 20px; }
.ib-card-head .ib-who .muted { white-space: normal; }
.ib-cols .ib-card .ib-back { display: inline-block; }
.ib-cardbody { padding: 0 16px 18px; }
.ib-contact { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 10px; background: #fdf6e8; color: #5c4515; }
.ib-sec { margin-top: 16px; }
.ib-sec h3 { font-size: 14px; color: var(--muted); margin: 0 0 6px; font-weight: var(--w-ui); }
.ib-sec .chips { margin-bottom: 6px; }
.ib-chip { display: inline-flex; align-items: center; gap: 4px; }
.ib-x { all: unset; cursor: pointer; color: var(--muted); padding: 0 2px; }
.ib-add { all: unset; cursor: pointer; color: var(--brand); font-size: 14px; font-weight: var(--w-ui); }
.ib-addrow { display: flex; gap: 8px; }
.ib-addrow input { flex: 1; min-width: 0; }
.ib-note { white-space: pre-wrap; margin: 0; }
.ib-blocknow { margin: 0 0 6px; padding: 6px 10px; border-radius: 8px; background: #ece9e4; color: #4d4640; font-size: 14px; }
.ib-blocks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.ib-blocks li { display: flex; gap: 10px; }
.ib-bdate { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ib-cardform { margin-top: 8px; }
.ib-foot { margin-top: 18px; }

/* 收件匣：打開電腦通知的提示條（EC 2026-10-28） */
.ib-notify { margin: 0 16px 10px; padding: 10px 12px; border-radius: 10px; background: #fff6e0; border: 1px solid #f1d58f; display: flex; gap: 10px; align-items: center; font-size: 14px; color: #5b4413; }
.ib-notify strong { font-weight: var(--w-strong); }
.ib-notify .btn { margin-left: auto; white-space: nowrap; }
.ib-notify-text { line-height: 1.5; }
.ib-salesname { display: flex; gap: 4px; flex-wrap: wrap; align-items: baseline; margin: 0 0 8px; }
.ib-stiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.ib-stile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 10px; background: var(--bg); text-align: center; }
.ib-stile strong { font-weight: var(--w-strong); font-size: 16px; }
.ib-ords { display: grid; gap: 6px; }
.ib-ord { display: grid; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; color: inherit; text-decoration: none; }
a.ib-ord:hover { background: var(--bg); }
.ib-ordamt { font-weight: var(--w-ui); }
.ib-picker { display: grid; gap: 8px; }
.ib-pick { display: grid; gap: 4px; max-height: 220px; overflow-y: auto; }
.ib-pickrow { all: unset; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); }
.ib-pickrow:hover { background: var(--bg); }
.ib-bell { border: 1px solid var(--line); background: var(--card, #fff); color: inherit; font: inherit; font-weight: var(--w-ui); font-size: 13px; border-radius: 999px; padding: 4px 10px; cursor: pointer; }
.ib-bell.on { background: #fff6e0; border-color: #f1d58f; }
.ib-bell.hot { border-color: var(--brand); color: var(--brand); display: inline-flex; align-items: center; gap: 4px; }
/* 需求配對（EC 2026-10-28）：客戶卡「想找的」、新貨配對清單 */
.ib-want { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ib-want .grow { flex: 1; min-width: 0; }
.ib-want.off { opacity: .6; }
.ib-want .row { gap: 10px; flex: none; }
.ib-wantform { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; margin-top: 8px; }
.ib-wf { display: flex; flex-direction: column; gap: 2px; }
.ib-wf input { width: 100%; box-sizing: border-box; }
.ib-match { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.ib-match.stale { background: #f7f5f2; }
.ib-match-top { display: flex; gap: 10px; align-items: center; }
.ib-match-top .grow { flex: 1; min-width: 0; }
.ib-match-why { background: #fdf3f4; border-radius: 8px; padding: 6px 8px; }
.ib-match-act { gap: 8px; justify-content: flex-end; }
.ib-obody .ib-match + .ib-match { margin-top: 8px; }
.ib-npanel { margin: 0 16px 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); display: grid; gap: 8px; font-size: 14px; }
.ib-npanel p { margin: 0; line-height: 1.5; }
.ib-nrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ib-nrow select { width: auto; }
.ib-nstate { font-weight: var(--w-ui); }
.ib-nstate.ok { color: #1f7a3d; }
.ib-nstate.bad { color: #b42318; }
.ib-nstate.warn { color: #8a5a00; }
.ib-nstate.gray { color: var(--muted); }
.ch-remind-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0; }
.ch-remind-row .ch-remind-min { width: 80px; text-align: center; }
.ch-remind-row select { width: auto; max-width: 100%; }
/* 客人的 LINE 大頭貼（EC 2026-10-28） */
.ib-ava-pic { object-fit: cover; background: var(--line); }
/* ===== 盤點（EC 2026-10-28）：開新盤點、對貨畫面、相機掃 QR、盤損區 ===== */
.st-page { max-width: 1120px; }
.st-h1 { font-size: 22px; margin: 4px 0 6px; }
.st-tabs { display: flex; gap: 6px; margin: 8px 0 12px; overflow-x: auto; }
.st-tabs button { white-space: nowrap; padding: 7px 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 14px; cursor: pointer; }
.st-tabs button.on { background: var(--text); color: #fff; border-color: var(--text); }
.st-field { margin: 14px 0 6px; font-size: 14px; color: var(--muted); }
.st-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.st-pick button, .st-chips-pick button { padding: 9px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); font-size: 15px; cursor: pointer; }
.st-pick button.on, .st-chips-pick button.on { border-color: var(--brand); color: var(--brand); background: #f6e9ea; }
.st-chips-pick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; max-height: 220px; overflow-y: auto; }
.st-chips-pick button { padding: 5px 12px; font-size: 14px; border-radius: 20px; }
.st-count { margin: 16px 0 10px; }
.st-take { display: flex; align-items: center; gap: 10px; }
.st-take .grow { flex: 1; min-width: 0; }
.st-go { color: var(--brand); font-size: 14px; }
.st-badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: #f1eeea; color: var(--muted); white-space: nowrap; }
.st-badge.live { background: #f6e9ea; color: var(--brand); }
.st-badge.bad { background: #fde8e6; color: #b42318; }
.st-badge.warn { background: #fbf4e6; color: #8a5a14; }
.st-empty { color: var(--muted); text-align: center; padding: 24px 0; margin: 0; }
/* 對貨畫面：手機上下排，電腦左邊進度和掃描、右邊清單 */
.st-session { display: block; }
.st-prog, .st-listcard { background: var(--card); border-radius: 16px; padding: 16px 18px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(60,40,30,.05), 0 4px 16px rgba(60,40,30,.04); }
.st-listcard { padding: 6px 14px 8px; }
.st-num { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.st-num strong { font-size: 40px; line-height: 1.1; color: var(--brand); }
.st-num span { color: var(--muted); }
.st-bar { height: 10px; background: #efe9e2; border-radius: 6px; overflow: hidden; margin: 10px 0 8px; }
.st-bar i { display: block; height: 100%; background: var(--brand); border-radius: 6px; transition: width .3s; }
.st-chips { display: flex; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.st-chip { padding: 2px 10px; border-radius: 20px; background: #f1eeea; }
.st-chip.ok { background: #e7f4ec; color: #1e7b45; }
.st-chip.miss { background: #fde8e6; color: #b42318; }
.st-chip.extra { background: #fbf4e6; color: #8a5a14; }
/* 搜尋框：左邊放大鏡、中間打編號、右邊掃 QR（EC 2026-10-28 給的樣子） */
.st-search { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1.5px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 16px; margin-bottom: 12px; }
.st-search:focus-within { border-color: var(--brand); }
.st-search svg { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.st-search-ic { width: 22px; height: 22px; flex-shrink: 0; stroke: var(--muted); stroke-width: 2.4; }
.st-search input { flex: 1; min-width: 0; border: 0; outline: 0; font-size: 17px; background: transparent; padding: 10px 0; color: var(--text); }
.st-search input::-webkit-search-cancel-button { display: none; }
.st-search input:focus { box-shadow: none; }
.st-scan-btn { flex-shrink: 0; width: 46px; height: 46px; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--text); }
.st-scan-btn:active { background: #f1eeea; }
.st-scan-btn svg { width: 28px; height: 28px; stroke: currentColor; stroke-width: 2.2; }
.st-flash { display: flex; gap: 12px; align-items: center; border-radius: 14px; padding: 10px 14px; margin-bottom: 12px; border: 1px solid; }
.st-flash strong { display: block; }
.st-flash-ic { width: 34px; height: 34px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-size: 18px; flex-shrink: 0; font-weight: var(--w-strong); }
.st-flash.ok { background: #e7f4ec; border-color: #bfe3cc; }
.st-flash.ok .st-flash-ic { background: var(--ok); }
.st-flash.seen { background: #eef1f4; border-color: #d6dde4; }
.st-flash.seen .st-flash-ic { background: #5d6b78; }
.st-flash.warn { background: #fbf4e6; border-color: #f0dcb4; }
.st-flash.warn .st-flash-ic { background: #c98a1a; }
.st-flash.bad { background: #fde8e6; border-color: #f4c7c2; }
.st-flash.bad .st-flash-ic { background: var(--danger); }
.st-foot { position: sticky; bottom: 8px; z-index: 3; padding: 8px 0 4px; }
body.has-tabbar .st-foot { bottom: calc(72px + max(6px, env(safe-area-inset-bottom) - 18px)); }
.st-list { display: flex; flex-direction: column; }
.st-row { display: flex; gap: 12px; align-items: center; padding: 10px 2px; border-top: 1px solid var(--line); }
.st-row:first-child { border-top: 0; }
.st-row.done .st-sku { color: var(--ok); }
.st-pic { width: 52px; height: 52px; font-size: 10px; }
.st-m { flex: 1; min-width: 0; }
.st-sku { font-size: 19px; font-weight: var(--w-strong); letter-spacing: .04em; color: var(--text); text-decoration: none; }
.st-nm { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-sub { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12px; margin-top: 2px; }
.st-undo { color: var(--muted); }
.st-ok { color: var(--ok); font-size: 18px; padding: 0 8px; }
.st-acts { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.st-loss { align-items: flex-start; }
@media (max-width: 520px) { .st-loss { flex-wrap: wrap; } .st-loss .st-acts { flex-basis: 100%; padding-left: 64px; justify-content: flex-start; } }
@media (min-width: 900px) {
  .st-session { display: grid; grid-template-columns: 360px minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 16px; align-items: start; }
  .st-side { grid-column: 1; grid-row: 1; }
  .st-listcard { grid-column: 2; grid-row: 1 / span 2; }
  .st-foot, body.has-tabbar .st-foot { grid-column: 1; grid-row: 2; position: static; padding-top: 0; }
}
/* 相機掃 QR：整個畫面黑底，中間一個對準框 */
.st-cam { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; align-items: center; justify-content: center; }
.st-cam-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.st-cam-frame { position: relative; width: min(66vw, 280px); aspect-ratio: 1 / 1; border-radius: 22px; box-shadow: 0 0 0 9999px rgba(0,0,0,.45); border: 3px solid rgba(255,255,255,.9); }
.st-cam-x { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 14px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 20px; cursor: pointer; }
.st-cam-result { position: absolute; left: 16px; right: 16px; bottom: calc(28px + env(safe-area-inset-bottom)); text-align: center; color: #fff; background: rgba(0,0,0,.6); border-radius: 14px; padding: 12px; font-size: 17px; font-weight: var(--w-ui); }
.st-cam-result.ok { background: rgba(46,125,79,.92); }
.st-cam-result.seen { background: rgba(93,107,120,.92); }
.st-cam-result.warn { background: rgba(201,138,26,.95); }
.st-cam-result.bad { background: rgba(179,38,30,.92); }
.st-intro { margin-top: 0; }
.st-flash a { color: inherit; }
.st-more { display: block; margin: 10px auto 4px; }

/* 找款成效（EC 2026-10-29） */
.rw-hero { display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; margin-top: 6px; }
.rw-big { font-size: 56px; line-height: 1; font-weight: var(--w-strong); color: var(--text); }
.rw-big.none { color: var(--muted); }
.rw-of { color: var(--muted); }
.rw-cmp { display: inline-flex; gap: 8px; align-items: baseline; }
.rw-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
@media (max-width: 700px) { .rw-chips { grid-template-columns: repeat(2, 1fr); } }
.rw-chip { background: var(--ov-soft); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rw-chip b { font-size: 20px; font-weight: var(--w-strong); }
.rw-chip span { font-size: 12px; color: var(--muted); }
.rw-funnel { display: flex; flex-direction: column; gap: 10px; }
.rw-step { display: grid; grid-template-columns: 112px 1fr 120px; gap: 12px; align-items: center; }
@media (max-width: 700px) { .rw-step { grid-template-columns: 84px 1fr 80px; gap: 8px; } .rw-label { font-size: 13px; } }
.rw-num { display: flex; flex-direction: column; line-height: 1.3; }
.rw-num b { font-weight: var(--w-strong); }
.rw-track { height: 26px; border-radius: 5px; background: #F6F1EE; overflow: hidden; }
.rw-track span { display: block; height: 100%; background: #B4483A; border-radius: 0 5px 5px 0; }
.rw-track span.dark { background: var(--brand); }
.rw-track.gray span { background: #C9C2BB; }
.rw-rate { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.rw-rate .rw-track { flex: 1; height: 8px; border-radius: 4px; background: #F4E3DE; }
.rw-rate .rw-track span { border-radius: 4px; }
.rw-rate b { width: 40px; text-align: right; font-weight: var(--w-strong); }
.rw-name { white-space: nowrap; }
.rw-tag { display: inline-block; font-size: 12px; padding: 1px 6px; border-radius: 8px; background: #f3ece7; color: var(--muted); white-space: nowrap; }
.rw-tag.on { background: #e7f2ea; color: var(--ok); }

/* 訊息中心：公版訊息、「要傳給客人」那條（EC 2026-10-29） */
.ib-sendbar { display: flex; align-items: center; gap: 8px; background: #fbf6ea; border: 1px solid #ecdcb5; border-radius: 12px; padding: 8px 10px; margin-bottom: 8px; font-size: 14px; }
.ib-sendbar .grow { min-width: 0; }
.ib-sendbar .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-tpl { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.ib-tpl-pick { all: unset; flex: 1; min-width: 0; cursor: pointer; display: block; }
.ib-tpl-def { display: inline-block; margin-left: 6px; font-size: 12px; padding: 1px 7px; border-radius: 999px; background: #e7f2ea; color: var(--ok); }
.ib-tpl-body { display: block; white-space: pre-wrap; margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.ib-tpl-edit { flex: none; }
.ib-tpl-form { display: flex; flex-direction: column; gap: 12px; }
.ib-tpl-form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.ib-tpl-form input[type=text], .ib-tpl-form textarea { font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: var(--card); color: var(--text); resize: vertical; }
.ib-tpl-var { all: unset; cursor: pointer; display: inline-block; border: 1px dashed #b9a99a; border-radius: 6px; padding: 1px 6px; margin: 2px 4px 2px 0; color: #6b5a4d; font-size: 13px; }
.ib-tpl-who { display: flex; gap: 8px; margin: 4px 0; }
.ib-tpl-who .btn { flex: 1; }
.ib-tpl-who .btn.on { border-color: var(--brand); color: var(--brand); background: #fbf3f3; }
.ib-tpl-form .ib-tpl-check { flex-direction: row; align-items: flex-start; gap: 8px; }
.ib-tpl-check input { margin-top: 5px; }
/* 手機打字時左邊圖示收成一個「›」 */
.ib-more { display: none; }
@media (max-width: 899px) {
  .ib-compose-row.typing > .ib-ico:not(.ib-more) { display: none; }
  .ib-compose-row.typing > .ib-more { display: inline-flex; }
}
/* 打到公版關鍵字時，輸入框上面那條「要帶入公版嗎？」 */
.ib-tplhint { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 0 2px 8px; }
.ib-tplhint.hidden { display: none; }
.ib-tpl-kw { display: inline-block; margin-left: 6px; font-size: 12px; padding: 1px 7px; border-radius: 999px; background: #f3ece7; color: var(--muted); }
/* 訂單查詢選銷售管道、連到管道頁和客戶頁（EC 2026-10-29） */
.ord-tl { cursor: pointer; }
.ord-tl:focus-visible .ord-tl-body { outline: 2px solid var(--brand); outline-offset: -2px; }
.ord-tl-link { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.ord-tl-link:hover { color: var(--brand); text-decoration-color: currentColor; }
.ord-channel-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 8px; }
.ord-channel-pick select { flex: 1 1 180px; max-width: 420px; }
#channel-page .ord-tl-link, .ord-ch-switch .ord-tl-link { color: var(--brand); font-size: 14px; font-weight: var(--w-ui); }

/* 批次標已付款、已出貨（EC 2026-10-29）：勾選列黏在上面，捲很長也按得到 */
.ord-bulk { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.ord-bulk-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--brand); }
.ord-bulk-all { display: inline-flex; align-items: center; gap: 6px; font-weight: var(--w-ui); }
.ord-bulk-bar input, .ord-pick > input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.ord-bulk-pay { padding: 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.ord-bulk-done { display: flex; flex-direction: column; gap: 4px; }
.ord-bulk-done.warn { border-color: var(--danger); }
.ord-bulk-done p { margin: 0; }
.ord-pick { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.ord-pick > :last-child { flex: 1; min-width: 0; }
.ord-bulk-btns { display: flex; gap: 8px; margin-left: auto; }

/* 改商品、退貨、待退款（EC 2026-10-29） */
.ord-edit-line { display: flex; align-items: center; gap: 10px; }
.ord-edit-pick { display: flex; align-items: center; gap: 10px; cursor: pointer; min-width: 0; }
.ord-edit-pick > input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
/* 改價錢（EC 2026-11-02）：單上的成交價直接改，改過的框變色 */
.ord-line-amt { width: 110px; text-align: right; appearance: textfield; -moz-appearance: textfield; }
/* 不要上下小箭頭（EC 2026-11-02） */
.ord-line-amt::-webkit-inner-spin-button, .ord-line-amt::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ord-line-amt.changed { border-color: var(--brand); background: #fbf3f3; }
.ord-off { opacity: .55; }
.ord-off strong { text-decoration: line-through; }
.ord-refunds { display: flex; flex-direction: column; gap: 10px; }
.ord-refund { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.ord-refund-act { display: flex; gap: 8px; margin-top: 4px; }
.ord-refund-act input { flex: 1; min-width: 0; }
.ord-refund-ok { color: var(--ok); font-size: 12px; }
.ord-refund-wait { color: var(--danger); font-size: 12px; }
/* 已退貨（EC 2026-10-29）：跟取消一樣變淡，顏色偏紅分得出來 */
.ord-status.returned { background: #fbe9e7; color: var(--danger); }
.ord-state.returned { color: var(--danger); }
.ord-tl.returned .ord-dot { background: var(--danger); }
.ord-tl.returned .ord-tl-body { opacity: .6; }
.ord-head-left { gap: 8px; flex-wrap: wrap; align-items: center; }
.ord-head { align-items: center; gap: 8px; flex-wrap: wrap; }
/* 訂單編號旁邊的修改、退貨、取消（EC 2026-10-29 要有顏色）：修改金黃、退貨紅、取消灰 */
.btn.ord-act { font-weight: var(--w-ui); }
.btn.ord-act.edit { background: #fff3cd; color: #8a5a00; border-color: #e0b84c; }
.btn.ord-act.return { background: #fbe9e7; color: var(--danger); border-color: #e8a9a3; }
.btn.ord-act.cancel { background: #f1efec; color: #555; border-color: #cfcac4; }

/* 權限頁（EC 2026-10-29）：每一項有白話說明、先勾最後一次存、一次開給多人、總表 */
.perm-row .perm-box { flex: none; align-self: flex-start; padding-top: 2px; }
.perm-row .perm-box input { width: 20px; height: 20px; }
.perm-row.pending { background: #fff8e6; margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: 8px; }
.perm-help { font-size: 13px; color: #5d5650; margin-top: 3px; line-height: 1.5; }
.perm-who { color: #2a5a8f; margin-top: 2px; }
.perm-shot-btn { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; font-size: 13px; font-weight: var(--w-ui); color: #2a5a8f; background: #e7f0fb; border: 0; border-radius: 999px; padding: 3px 11px; cursor: zoom-in; }
.perm-shot-btn:hover { background: #d6e6f8; }
.perm-shot-inline { display: none; margin: 8px 0 2px; border: 1px solid #e4ded7; border-radius: 10px; overflow: hidden; background: #fff; }
.perm-shot-inline img { display: block; width: 100%; height: auto; }
.perm-shot-inline figcaption { font-size: 12.5px; color: #6b635c; padding: 6px 10px; background: #faf8f5; }
.shot-modal { position: fixed; inset: 0; z-index: 200; background: rgba(20, 16, 14, .55); display: flex; align-items: center; justify-content: center; padding: 24px; }
.shot-box { background: #fff; border-radius: 16px; max-width: 900px; width: 100%; max-height: calc(100vh - 48px); overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.shot-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; font-size: 17px; }
.shot-head .link-btn { font-size: 20px; color: #8a827b; }
.shot-box img { display: block; width: 100%; height: auto; border-top: 1px solid #eee; }
.shot-box p { margin: 0; padding: 10px 18px 16px; color: #5d5650; font-size: 14px; }
/* 手機：不跳大圖，圖直接放在說明下面 */
@media (max-width: 700px) {
  .perm-shot-btn { display: none; }
  .perm-shot-inline { display: block; }
}
.perm-state { margin-top: 3px; }
.perm-state .link-btn { font-size: 13px; }
.pill.pend { background: #ffe8b3; color: #7a5200; margin-left: 4px; }
.pill.gray { background: #ece9e4; color: #5d5650; margin-left: 4px; }
.perm-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.perm-filter input[type=search] { flex: 1 1 220px; }
.perm-filter select { width: auto; }
.perm-filter .tabs { margin: 0; }
.perm-legend { margin: 6px 0; }
.perm-reset { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 10px; }
.perm-detail { margin: 6px 0 10px; }
.pm-rowgap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 6px 0; }
.pm-rowgap .perm-filter { flex: 1 1 260px; margin: 0; }
.perm-save { position: sticky; bottom: 0; z-index: 40; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; background: #fff; border-top: 2px solid var(--brand); padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(0, 0, 0, .08); }
.perm-save input { flex: 1 1 240px; }
.perm-save .btn.primary { width: auto; min-width: 110px; }
.pm-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 20px; }
@media (max-width: 760px) { .pm-grid { grid-template-columns: minmax(0, 1fr); } }
.pm-people { display: flex; flex-direction: column; gap: 2px; max-height: 560px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.pm-people .check.pm-pick { padding: 8px; border-radius: 8px; }
.check.pm-pick.on, .perm-row.pm-pick.on { background: #fff8e6; }
.perm-row.pm-pick { cursor: pointer; justify-content: flex-start; }
.pm-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pm-action { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; cursor: pointer; }
.pm-action.on { border-color: var(--brand); background: #fbf1f2; }
.field.pm-inline { display: flex; gap: 8px; align-items: center; margin: 0; }
.field.pm-inline select { width: auto; }
.pm-tbl-wrap { overflow-x: auto; margin-top: 8px; }
.pm-tbl { border-collapse: collapse; width: 100%; font-size: 14px; }
.pm-tbl th, .pm-tbl td { border-bottom: 1px solid var(--line); padding: 8px 6px; vertical-align: top; text-align: left; }
.pm-tbl thead th { position: sticky; top: 0; background: #faf8f5; font-size: 13px; color: #6b635c; }
.pm-tbl .pm-tbl-name { min-width: 260px; max-width: 420px; }
.pm-tbl .pm-tbl-who { min-width: 140px; max-width: 200px; color: #2a5a8f; }
.pm-tbl .pm-tbl-role { text-align: center; white-space: nowrap; }
.pm-tbl td.pm-tbl-on, .pm-tbl td.pm-tbl-adv, .pm-tbl td.pm-tbl-off { text-align: center; white-space: nowrap; }
.pm-tbl td.pm-tbl-on { color: var(--brand); font-size: 16px; }
.pm-tbl td.pm-tbl-adv { color: #2a5a8f; font-size: 16px; }
.pm-tbl .pm-tbl-scope { display: block; font-size: 11px; color: #8a817a; }
.pm-tbl tr.pm-tbl-mod th { background: #f3efea; font-size: 14px; color: #3b3530; }
.pm-tbl .pm-tbl-count { text-align: center; }
@media print { .topbar, .perm-apps, #perm-tabs, .no-print, .perm-save, .tabbar { display: none !important; } .pm-tbl thead th { position: static; } }
@media (max-width: 700px) { body.has-tabbar .perm-save { bottom: calc(60px + max(6px, env(safe-area-inset-bottom) - 18px)); } }

/* ---------- 員購頁（EC 2026-10-29）：封面照＋員購價，圖卡格狀，電腦版拉滿畫面 ---------- */
.pc-page { padding: 16px; }
@media (min-width: 900px) { .pc-page { padding: 20px 28px; } }
.pc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0 4px; }
.pc-stat { display: flex; flex-direction: column; gap: 2px; background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.pc-stat strong { font-size: 20px; }
.pc-stat.done { background: #fbeceb; } .pc-stat.done .small { color: var(--danger); }
.pc-list { margin-top: 12px; }
.pc-name { font-weight: var(--w-strong); line-height: 1.4; }
.pc-price { color: var(--brand); font-weight: var(--w-strong); font-size: 18px; white-space: nowrap; }
.pc-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.pc-tags .tag { margin-left: 0; }
.pc-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.pc-btns .btn.small { padding: 7px 12px; font-size: 14px; }
.pc-noimg { display: grid; place-items: center; background: #efebe6; color: var(--muted); font-size: 13px; text-align: center; overflow: hidden; }
.pc-a { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 700px) { .pc-a { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; } }
.pc-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
.pc-img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #efebe6; }
.pc-more { grid-column: 1 / -1; justify-self: center; margin-top: 4px; }
.pc-body { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; flex: 1; }
.pc-body .pc-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 15px; }
.pc-body .pc-btns { margin-top: auto; padding-top: 6px; }
.pc-body .pc-btns .btn { flex: 1 1 auto; text-align: center; }
@media (max-width: 699px) { .pc-body .pc-btns .btn.small { padding: 6px 8px; font-size: 13px; } }
.pc-img.pc-noimg { display: grid; place-items: center; font-size: 18px; letter-spacing: .1em; }

/* 發薪加項（EC 2026-10-29）：篩選、每人小計、勾選併入薪資 */
.pay-tabs { flex-wrap: wrap; overflow: visible; }
.pay-filter { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0; }
.pay-filter .field { min-width: 160px; }
.pay-people { margin: 8px 0; }
.pay-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pay-chip { border: 1px solid transparent; padding: 4px 10px; cursor: pointer; font: inherit; font-size: 14px; }
.pay-chip.active { border-color: var(--brand); color: var(--brand); }
.pay-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; margin: 8px 0; border-radius: 12px; background: #faf6f2; }
.pay-bulk-go { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.pay-bulk-go input { width: auto; }
.pay-check { display: inline-flex; align-items: center; gap: 6px; }
.pay-row { cursor: default; }
.pay-line { display: flex; gap: 10px; align-items: flex-start; }
.pay-box { margin-top: 4px; width: 20px; height: 20px; flex: none; }
.pay-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pay-paid { margin-top: 8px; padding: 10px; border-radius: 12px; background: #faf6f2; }

/* 獎金（EC 2026-10-29，薪酬模組）：試算、確認、銷售利潤、獎金設定 */
.bn-confirm { display: inline-flex; align-items: center; gap: 6px; }
.bn-amount { width: 110px; }
.bn-detail { margin-top: 8px; }
.bn-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.bn-table th, .bn-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.bn-table th { font-weight: var(--w-ui); color: var(--muted); }
.bn-missing td { color: var(--muted); }
.bn-minus td { color: #b42318; }
.bn-store h3 { margin: 0; }
.bn-skip { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.bn-manual { display: grid; gap: 10px; margin: 10px 0; }
@media (min-width: 900px) { .bn-manual { grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; } .bn-manual .actions { grid-column: 1 / -1; } }
.bn-stats { display: grid; gap: 12px; }
@media (min-width: 900px) { .bn-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.bn-stat { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.bn-big { font-size: 26px; font-weight: var(--w-strong); }
.bn-sum { border: 1px solid var(--brand); }
.bn-settings { display: grid; gap: 0 16px; }
@media (min-width: 900px) { .bn-settings { grid-template-columns: 1fr 1fr; align-items: start; } }
.bn-settings > * { min-width: 0; }
.bn-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.bn-num { width: 90px; }
.bn-map { display: flex; flex-direction: column; gap: 8px; }
/* 一列：開頭 → 採購（可以好幾位）、趴數、刪掉；手機上採購換到第二行（EC 2026-10-31） */
.bn-map-row { display: grid; grid-template-columns: 80px auto minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.bn-who { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.bn-who select { flex: 1 1 140px; min-width: 0; }
.bn-chip { display: inline-flex; align-items: center; gap: 4px; }
.bn-chip-x { border: 0; background: none; color: var(--muted); padding: 0 2px; cursor: pointer; font: inherit; }
.bn-pct { display: flex; align-items: center; gap: 4px; }
.bn-pct .bn-num { width: 72px; }
@media (max-width: 600px) {
  .bn-map-row { grid-template-columns: 80px 1fr auto auto; }
  .bn-map-row > [aria-hidden="true"] { display: none; }
  .bn-who { grid-column: 1 / -1; grid-row: 2; }
}
.bn-tier { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin: 6px 0 12px; }
.bn-step { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bn-coef { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.bn-own { display: flex; margin-top: 10px; }

/* 寫進報表（EC 2026-10-29）：每個管道一格可展開，檢查欄位時列出每一欄對到什麼 */
.rs-box { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 10px; }
.rs-box > summary { cursor: pointer; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rs-box[open] > summary { margin-bottom: 4px; }
.rs-cols { display: flex; flex-wrap: wrap; gap: 6px; }
.rs-col { font-size: 13px; padding: 3px 8px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.rs-col.on { color: inherit; border-color: var(--brand); }
.rs-col b { font-weight: var(--w-strong); margin-right: 2px; }
.rs-col em { font-style: normal; }
.ord-report-extra:empty { display: none; }
.ord-report-extra { margin-top: 10px; }
.rs-pay { display: flex; align-items: center; gap: 8px; }
.rs-pay-name { flex: 0 0 auto; min-width: 5.5em; }
.rs-pay input { flex: 1; min-width: 0; max-width: 260px; }
/* 報表一年一份：一年一格，電腦版年份、網址、工作表排一列 */
.rs-years { display: grid; gap: 8px; margin: 6px 0 8px; }
.rs-year { display: grid; gap: 8px; padding: 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
@media (min-width: 900px) { .rs-year { grid-template-columns: 7em 1fr 12em auto; align-items: end; } }
.rs-year .field { margin: 0; }
/* 訂單頁電腦版左右兩欄（EC 2026-10-30）：左邊訂單資料＋客戶，右邊商品金額和動作；訂單資料兩兩一列，盡量一頁看完 */
@media (min-width: 900px) {
  .ord-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 20px; align-items: start; }
  .ord-col { min-width: 0; }
  .ord-split .ord-infos { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 24px; }
}
.ord-who { white-space: nowrap; }
/* 當日需出貨（EC 2026-10-30） */
.ship-date { width: auto; }
.ship-search { margin-top: 8px; }
.ship-list { display: grid; gap: 10px; }
.ship-pkg { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fffdfb; }
.ship-pkg.carried { border-color: #f0c78a; background: #fffaf2; }
.ship-to { display: grid; gap: 4px; padding: 6px 10px; border-radius: 10px; background: #f6f2ee; }
/* 收件人一欄一行、各自複製（EC 2026-11-01） */
.ship-field { display: flex; gap: 10px; align-items: center; min-height: 36px; }
.ship-field-label { flex: none; width: 2.6em; }
.ship-field-value { min-width: 0; overflow-wrap: anywhere; }
.ship-field .btn { flex: none; }
/* 走哪家：宅配・順豐、超商寄件・7-ELEVEN */
.ship-via { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 999px; background: #f6eced; color: var(--brand); font-weight: var(--w-strong); }
.ship-missing { color: var(--danger); }
.ship-items { margin: 0; padding-left: 18px; }
.ship-photos { display: grid; gap: 4px; }
.ship-photo-list { display: flex; flex-wrap: wrap; gap: 8px; }
.ship-photo { display: grid; gap: 2px; justify-items: center; }
.ship-photo a { color: var(--brand); }
.ship-act { display: flex; gap: 8px; align-items: center; }
.ship-act input { flex: 1; min-width: 0; }
.ship-more { display: grid; gap: 6px; }
.ship-more > summary { cursor: pointer; color: var(--brand); }
.ship-more[open] { display: grid; gap: 6px; }
@media (min-width: 900px) {
  .ship-list { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); align-items: start; }
}
.ship-to .grow { flex: 1; min-width: 0; }
.ship-home { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.ship-home .grow { flex: 1; }
.ship-home svg { width: 24px; height: 24px; flex: none; fill: none; stroke: var(--brand); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* 發票開給誰（EC 2026-10-30） */
.ord-inv-buyer { display: grid; gap: 8px; }
.ord-inv-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 8px; }
.ord-inv-edit > div { display: grid; gap: 8px; margin: 8px 0; }
@media (max-width: 480px) { .ord-inv-grid { grid-template-columns: 1fr; } }

/* 整批調貨、日本拍賣會（EC 2026-10-30） */
.xa-lead { margin: 0 0 8px; }
.xa-line { display: flex; align-items: center; gap: 12px; padding: 10px 2px; }
.xa-line .grow { flex: 1; min-width: 0; }
.xa-line .grow .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xa-line > input[type=checkbox], .xa-all input { width: 20px; height: 20px; flex-shrink: 0; }
.xa-line.xa-done { opacity: .7; }
.xa-pick { cursor: pointer; }
.xa-all { display: flex; align-items: center; gap: 10px; padding: 10px 2px 4px; font-size: 14px; color: var(--muted); cursor: pointer; }
.xa-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }
.xa-send { min-width: 140px; }
.xa-flash { margin: 4px 0 0; padding: 10px 14px; border-radius: 12px; font-size: 15px; background: #f1eeea; }
.xa-flash.ok { background: #e7f4ec; color: #1e7b45; }
.xa-flash.warn, .xa-flash.seen { background: #fbf4e6; color: #8a5a14; }
.xa-flash.bad { background: #fde8e6; color: #b42318; }
.st-badge.ok { background: #e7f4ec; color: #1e7b45; }
.xa-store { width: auto; border-radius: 999px; padding: 8px 14px; }
.xa-note { background: #fbf4e6; color: #8a5a14; border-radius: 12px; padding: 10px 14px; font-size: 14px; margin: 0 0 12px; }
.xa-note a { color: inherit; font-weight: var(--w-ui); }
.xa-sub { font-size: 13px; font-weight: var(--w-text); margin-left: 8px; }
.xa-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.xa-field > span { font-size: 13px; color: var(--muted); }
.xa-field > small { font-size: 12px; }
.xa-bar { position: sticky; bottom: 8px; z-index: 3; display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; background: var(--card); border-radius: 16px; padding: 12px 14px; box-shadow: 0 2px 14px rgba(60,40,30,.14); }
.xa-bar .xa-field { flex: 1 1 140px; }
.xa-bar .btn { flex: 1 1 140px; }
@media (max-width: 700px) { body.has-tabbar .xa-bar { bottom: calc(72px + max(6px, env(safe-area-inset-bottom) - 18px)); } }
.xa-lot { flex-wrap: wrap; }
.xa-btns { display: flex; gap: 6px; flex-shrink: 0; }
.xa-money { font-size: 14px; margin-top: 2px; color: var(--text); }
@media (max-width: 520px) { .xa-lot .xa-btns { flex-basis: 100%; justify-content: flex-end; } }
.xa-soldform { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; background: #faf7f4; border-radius: 12px; padding: 12px; margin: 0 0 8px; }
.xa-soldform .xa-field { flex: 1 1 150px; }
.xa-row { display: flex; gap: 6px; }
.xa-settle { border-top: 1px solid var(--line); margin-top: 8px; padding: 12px 2px 6px; }
.xa-settle h3 { font-size: 16px; margin: 0 0 10px; }
.xa-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.xa-sum { margin-top: 12px; background: #faf7f4; border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.xa-sumrow { display: flex; gap: 14px; flex-wrap: wrap; align-items: baseline; font-size: 14px; }
.xa-sumrow > span:first-child { color: var(--muted); width: 2.5em; }
.xa-sumrow strong { margin-left: auto; font-size: 16px; }
.xa-sumrow.tw strong { color: var(--brand); font-size: 18px; }
.xa-hist { display: flex; align-items: center; gap: 10px; padding: 10px 2px; }
.xa-hist .grow { flex: 1; min-width: 0; }
.xa-house { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.xa-house input[type=text] { flex: 1 1 180px; }
.inv-status.held { background: #fbf4e6; color: #8a5a14; }
.xa-btns .btn, .xa-row .btn { width: auto; white-space: nowrap; }
@media (max-width: 520px) { .xa-lot .xa-btns .btn { flex: 1; } }
.xa-total { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 2px 2px; font-size: 14px; color: var(--muted); }
.xa-total strong { font-size: 18px; color: var(--brand); }
.xa-costform { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 12px; }
.xa-costform h3 { font-size: 15px; margin: 0 0 10px; }
.xa-quick { margin-top: 4px; }
.xa-quick button { padding: 4px 12px; font-size: 13px; border-radius: 20px; }
.xa-lotno { font-size: 12px; font-weight: var(--w-ui); color: var(--muted); margin-left: 8px; }
.xa-rate { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.xa-rate input { width: 90px; }
.xa-pos { color: var(--ok); }
.xa-neg { color: var(--danger); }
.xa-round { font-size: 12px; color: var(--muted); margin-top: 2px; }
.xa-times { display: inline-block; font-size: 12px; font-weight: var(--w-ui); color: #8a5a14; background: #fbf4e6; border-radius: 999px; padding: 1px 8px; margin-left: 8px; white-space: nowrap; }
.xa-trail { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.xa-trail li { font-size: 12px; color: var(--muted); background: #f4f0ec; border-radius: 8px; padding: 2px 8px; }
.xa-trail li.on { color: var(--text); background: #efe6dc; font-weight: var(--w-ui); }
.xa-full { flex-basis: 100%; margin: 0; }
.xa-feelist { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; }
.xa-feelist h3 { font-size: 15px; margin: 0 0 4px; }
.xa-houseblock { border-top: 1px solid var(--line); padding: 8px 0 10px; }
.xa-houseblock:first-of-type { border-top: 0; }
.xa-fees { display: flex; gap: 8px 14px; flex-wrap: wrap; align-items: center; margin-top: 8px; font-size: 13px; }
.xa-fees select { width: auto; padding: 6px 10px; }
.xa-soldform .xa-row { flex-wrap: wrap; }
/* 預計送日本（EC 2026-10-30） */
.xa-tiers .xa-rate input { width: 100px; }
.xa-tiers .xa-rate select { width: auto; padding: 6px 10px; }
/* 一級一行；手機放不下就換行，不要被切掉 */
.xa-tiers .xa-tier { flex-basis: 100%; flex-wrap: wrap; gap: 6px; white-space: nowrap; padding-bottom: 6px; border-bottom: 1px dashed var(--line); }
@media (max-width: 560px) { .xa-tiers .xa-tier input { width: 88px; } }
.xa-tiers .xa-rate .btn { padding: 2px 8px; }
.jp-unplan { flex-shrink: 0; }
.jp-batch { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.jp-batch:first-child { border-top: 0; margin-top: 0; }
.jp-batch-h { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 4px 0; font-size: 16px; }
.jp-batch-h a { color: var(--text); font-weight: var(--w-strong); }
.jp-box-h { font-size: 13px; color: var(--muted); font-weight: var(--w-ui); margin: 6px 0 0; padding: 4px 10px; background: var(--bg); border-radius: 8px; display: inline-block; }
.jp-sku { font-weight: var(--w-strong); color: var(--text); text-decoration: none; }
.jp-nocb { visibility: hidden; }
.jp-shipbar { position: static; box-shadow: none; background: #faf7f4; margin-top: 10px; }
.jp-itembox { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: #faf7f4; border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.jp-itembox > div:first-child { flex: 1 1 200px; }
.jp-itembox .btn { width: auto; }
.inv-status-wrap { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.inv-status.jp { background: #fbf4e6; color: #8a5a14; }
.inv-ed-btn.inv-jp-btn.on { background: #fbf4e6; color: #8a5a14; border-color: #ead6ad; }
/* 調貨單裝箱確認（EC 2026-10-30） */
.xa-boxes { flex-wrap: wrap; margin: 4px 0 10px; }
.xa-boxes button { display: inline-flex; align-items: center; gap: 6px; }
.xa-boxn { font-size: 12px; min-width: 20px; padding: 0 6px; border-radius: 10px; background: rgba(0,0,0,.08); }
.xa-left { margin: 8px 0 0; }
.xa-loose h2 { color: #b42318; }
.xa-splits { display: flex; gap: 12px; flex-wrap: wrap; margin: -4px 0 10px; }
.xa-splits a { color: var(--brand); }

/* ---------- 收件匣：收購視窗的線上初估（chat-buy.js，EC 2026-10-31） ---------- */
.qb-bar { display: flex; gap: 8px; padding: 0 0 8px; }
.qb-bar .btn { flex: 1; border-color: var(--brand); color: var(--brand); padding: 6px 10px; }
.qb-grades { display: flex; flex-wrap: wrap; gap: 6px; }
.qb-grade { border: 1px solid var(--line); background: #fff; color: inherit; font: inherit; font-size: 13px; border-radius: 8px; min-width: 36px; padding: 4px 8px; cursor: pointer; }
.qb-grade.on { border-color: var(--brand); color: var(--brand); background: #fbf1f2; }
.qb-search { display: flex; gap: 6px; }
.qb-search input { flex: 1; min-width: 0; }
.qb-ai { color: #1d4ed8; }
.qb-idtop { display: flex; gap: 12px; align-items: flex-start; }
.qb-idstrip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.qb-idpick { all: unset; cursor: pointer; position: relative; flex: none; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; border: 2px solid transparent; opacity: .55; }
.qb-idpick.on { border-color: var(--brand); opacity: 1; }
.qb-idpick:disabled { cursor: default; }
.qb-idpick:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.qb-idpick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.qb-idcheck { position: absolute; right: 2px; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; }
.qb-idphoto { width: 110px; height: 110px; object-fit: cover; border-radius: 12px; flex: none; background: #f1eeea; }
.qb-mini { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; flex: none; background: #f1eeea; }
.qb-sbody .btn[hidden] { display: none; }
.qb-sbody { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 10px; margin: 0 -16px; padding: 0 16px; }
.qb-sim { display: grid; gap: 8px; min-width: 0; }
.qb-gtitle { margin-top: 4px; }
.qb-near { margin: 0; color: #8a5a00; background: #fff6e0; border-radius: 8px; padding: 6px 10px; }
.qb-gtable { display: grid; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.qb-grow { all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: 44px minmax(64px, auto) 1fr auto; gap: 8px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); }
.qb-grow:first-child { border-top: 0; background: #faf8f6; }
.qb-grow:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.qb-grow.on { background: #fbf1f2; box-shadow: inset 3px 0 0 var(--brand); }
.qb-grow strong { color: var(--brand); }
.qb-gname { font-weight: var(--w-ui); }
.qb-grange { text-align: right; }
.qb-ref { background: #fbf1f2; border: 1px solid #f0d4d7; border-radius: 12px; padding: 10px 12px; }
.qb-avg { font-size: 22px; font-weight: var(--w-strong); color: var(--brand); }
.qb-items { display: flex; flex-direction: column; }
.qb-item { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.qb-item.hot .qb-price strong { color: var(--danger); }
.qb-thumb { all: unset; cursor: pointer; position: relative; flex: none; width: 52px; height: 52px; border-radius: 10px; overflow: hidden; background: #f1eeea; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); }
.qb-thumb img { width: 100%; height: 100%; object-fit: cover; }
.qb-thumb:disabled { cursor: default; }
.qb-n { position: absolute; right: 2px; bottom: 2px; font-size: 10px; color: #fff; background: rgba(0, 0, 0, .55); border-radius: 6px; padding: 0 4px; }
.qb-g { display: inline-block; font-size: 11px; color: var(--brand); border: 1px solid #f0d4d7; background: #fbf1f2; border-radius: 6px; padding: 0 5px; }
.qb-warn { display: inline-block; font-size: 12px; color: var(--danger); background: #fdecea; border-radius: 6px; padding: 0 6px; }
.qb-price { text-align: right; flex: none; }
.qb-notthis { margin-top: 4px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--muted); font: inherit; font-size: 12px; font-weight: var(--w-ui); cursor: pointer; }
.qb-notthis:hover { color: var(--danger); border-color: var(--danger); }
.qb-cmp { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.qb-aitag { margin-left: 6px; }
.qb-aitag.ok { color: var(--ok); border-color: var(--ok); }
.qb-qitems { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.qb-qitem { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #fff; }
.qb-qitem.ev { background: #f3f7fd; border-color: #cddcf3; }
.qb-row2, .qb-row3 { display: grid; gap: 6px; grid-template-columns: 1fr 1fr; }
.qb-row3 { grid-template-columns: 1fr 1.4fr 1fr; }
.qb-row2 input, .qb-row3 input { min-width: 0; }
.qb-refline { color: var(--muted); }
.qb-refline.ok { color: var(--ok); }
.qb-ev { display: flex; flex-direction: column; gap: 4px; color: #1d4ed8; }
.qb-evtoggle { display: inline-flex; align-items: center; gap: 2px; }
.qb-preview { width: 100%; box-sizing: border-box; }
.qb-card { width: 260px; }
.qb-act { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.qb-act .btn { padding: 4px 10px; }
.pill.qb-warn, .pill.qb-ok, .pill.qb-gray { font-size: 11px; border-radius: 999px; padding: 0 8px; }
.pill.qb-warn { background: #fff4e0; color: #8a5300; }
.pill.qb-ok { background: var(--on-bg); color: var(--on); }
.pill.qb-gray { background: #f1eeea; color: var(--muted); }
.qb-review { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.qb-dir { font-size: 12px; border-radius: 999px; padding: 0 8px; flex: none; }
.qb-dir.high { color: var(--danger); background: #fdecea; }
.qb-dir.low { color: #1d4ed8; background: #e8effc; }
.qb-verdict { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.qb-verdict .btn.on { border-color: var(--brand); color: var(--brand); background: #fbf1f2; }
.qb-ev[hidden] { display: none; }

/* 收購預約（EC 2026-10-31，示意 v7 ⑥～⑩）：排約、預約詳細、預約表頁、客戶卡收購紀錄 */
.bk-body { display: grid; grid-template-columns: minmax(0, 1fr); grid-auto-rows: max-content; align-content: start; gap: 10px; overflow-y: auto; overflow-x: hidden; min-height: 0; }
.bk-body > * { min-width: 0; }
.bk-dates { padding-bottom: 2px; }
.bk-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bk-segbtn { border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 8px 4px; color: inherit; font: inherit; font-weight: var(--w-ui); cursor: pointer; }
.bk-segbtn.on { border-color: var(--brand); color: var(--brand); background: #fbf1f2; }
.bk-dates, .bk-week { display: flex; gap: 6px; overflow-x: auto; }
.bk-date { position: relative; flex: none; min-width: 48px; display: grid; justify-items: center; gap: 1px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: inherit; font: inherit; font-size: 12px; cursor: pointer; }
.bk-date.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.bk-date.closed:not(.on) { color: var(--muted); background: #f6f3ef; }
.bk-date.today:not(.on) { border-color: var(--brand); }
.bk-dot { position: absolute; top: 3px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.bk-date.on .bk-dot { background: #fff; }
.bk-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.bk-slot { border: 1px solid var(--line); border-radius: 8px; background: var(--card); padding: 7px 0; color: inherit; font: inherit; font-size: 13px; cursor: pointer; }
.bk-slot.taken { color: var(--muted); background: #f1eeea; text-decoration: line-through; }
.bk-slot.on { background: var(--brand); border-color: var(--brand); color: #fff; text-decoration: none; }
.bk-countrow input { max-width: 100px; }
.bk-info { display: grid; gap: 8px; padding: 10px; border-radius: 10px; background: #fbf9f6; }
.bk-info a { color: var(--brand); }
.bk-items { display: grid; gap: 6px; }
.bk-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.bk-item > div { min-width: 0; }
.bk-item input.qb-money { max-width: 110px; text-align: right; }
.bk-item input:not(.qb-money) { flex: 1; min-width: 0; }
.qb-grade-tag { display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 4px; background: #f1eeea; color: var(--muted); font-size: 11px; }
.bk-card { cursor: pointer; }
.bk-hist { display: grid; gap: 2px; margin-top: 8px; }
/* 預約表頁 */
.bk-page { max-width: 900px; }
.bk-head { gap: 8px; flex-wrap: wrap; }
.bk-head h1 { margin: 0; font-size: 20px; }
.bk-tabs { display: flex; gap: 8px; margin: 12px 0 8px; }
.bk-tab { border: 1px solid var(--line); border-radius: 999px; background: var(--card); padding: 6px 14px; color: inherit; font: inherit; font-weight: var(--w-ui); cursor: pointer; }
.bk-tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.bk-week { margin-bottom: 10px; align-items: stretch; }
.bk-week .bk-date { flex: 1; }
.bk-arrow { flex: none; border: 0; background: none; font: inherit; font-size: 20px; color: var(--muted); cursor: pointer; padding: 0 4px; }
.bk-table { border-top: 1px solid var(--line); background: var(--card); border-radius: 10px; }
.bk-trow { display: grid; grid-template-columns: 52px 1fr; gap: 6px; min-height: 30px; border-bottom: 1px solid var(--line); padding: 3px 8px; }
.bk-time { color: var(--muted); padding-top: 4px; }
.bk-trow.has .bk-time { color: inherit; font-weight: var(--w-strong); }
.bk-cells { display: grid; gap: 4px; }
.bk-block, .bk-hcard { display: grid; gap: 2px; text-align: left; width: 100%; border: 0; border-left: 3px solid var(--brand); border-radius: 6px; background: #fbf1f2; padding: 6px 8px; color: inherit; font: inherit; cursor: pointer; }
.bk-block.done, .bk-hcard.done { border-left-color: var(--on); background: var(--on-bg); }
.bk-block.no_show, .bk-hcard.no_show { border-left-color: var(--muted); background: #f1eeea; }
.bk-line { display: flex; gap: 10px; flex-wrap: wrap; }
.bk-cards { display: grid; gap: 10px; }
.bk-hcard { border: 1px solid var(--line); border-left: 3px solid var(--brand); background: var(--card); padding: 10px 12px; border-radius: 10px; }
.bk-empty { padding: 24px 0; text-align: center; }
/* 電話預約、確認訊息公版（EC 2026-10-31） */
.bk-tools { gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.bk-pitem { display: grid; grid-template-columns: minmax(0, 1fr) repeat(2, minmax(0, 76px)) auto; gap: 6px; }
.bk-pitem input { width: 100%; min-width: 0; box-sizing: border-box; }
.bk-tpl { display: grid; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.bk-tpl textarea { width: 100%; font: inherit; }
.bk-vars { display: flex; flex-wrap: wrap; gap: 6px; }
.bk-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.bk-steps .row { margin-top: 4px; flex-wrap: wrap; gap: 6px; }
.bk-calmail { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; word-break: break-all; }
.bk-calmake { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.bk-calmake p { margin: 0; }
.bk-calown summary { cursor: pointer; color: var(--muted); }
.bk-calown[open] { display: grid; gap: 10px; }
.bk-calstat { border-top: 1px solid var(--line); padding-top: 8px; }
.bk-calstat p { margin: 0; }
.bk-var { border: 1px dashed var(--brand); border-radius: 999px; background: none; color: var(--brand); font: inherit; font-size: 12px; padding: 2px 8px; cursor: pointer; }
.bk-prev { white-space: pre-wrap; background: #fbf9f6; border-radius: 10px; padding: 8px 10px; }
.bk-body .qb-row2 > * { min-width: 0; }
.bk-body .qb-row2 input { width: 100%; box-sizing: border-box; }
.ord-tl-note { color: var(--danger); overflow-wrap: anywhere; }
/* 訂單頁的備註也紅字（EC 2026-11-02：更好辨識） */
.ord-info .ord-note-val { color: var(--danger); overflow-wrap: anywhere; }
/* 照片篩選（EC 2026-11-01）：手機上點開時放不下，那一組換到下一排、整排可以左右滑 */
@media (max-width: 600px) {
  .inv-tools.pics-open { flex-wrap: wrap; }
  .inv-tools.pics-open #pics { order: 10; flex: 1 1 100%; }
}
.inv-auto-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.inv-auto-line input { width: 7em; }
/* 表格：列印標籤、送日本在編號下面一排小按鈕（EC 2026-11-01） */
.inv-sku-btns { display: flex; gap: 4px; margin-top: 6px; }
.inv-sku-btns .inv-ed-btn { padding: 2px 8px; font-size: 12px; box-shadow: none; white-space: nowrap; }
.inv-sku-btns .inv-ed-btn span { display: none; }
/* 預計送日本的返回（EC 2026-11-02 只要手機版）：電腦上面有選單，不用 */
.jp-back { display: none; }
@media (max-width: 560px) { .jp-back { display: inline-block; } }

/* ===== 組織圖（EC 2026-11-01）：樹狀圖，一層一個框、用線連到上一層 ===== */
.oc-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.oc-filter { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.oc-filter select { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: 15px; color: var(--text); }
.oc-tree { margin-top: 12px; }
/* 店和部門多的時候樹會比畫面寬，左右滑就看得到 */
.oc-scroll { overflow-x: auto; padding-bottom: 8px; }
.oc-tree ul { display: flex; justify-content: center; margin: 0; padding: 20px 0 0; position: relative; }
.oc-tree ul.oc-root { padding-top: 0; width: max-content; min-width: 100%; }
.oc-tree li { list-style: none; position: relative; display: flex; flex-direction: column; align-items: center; padding: 20px 6px 0; }
.oc-tree ul.oc-root > li { padding-top: 0; }
/* 每個框上面的線：往左、往右各半條橫線，加一條往下的直線 */
.oc-tree li::before, .oc-tree li::after { content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 20px; border-top: 2px solid #cfc8c0; }
.oc-tree li::after { right: auto; left: 50%; border-left: 2px solid #cfc8c0; }
.oc-tree li:only-child::before { display: none; }
.oc-tree li:only-child::after { border-top: 0; }
.oc-tree li:first-child::before, .oc-tree li:last-child::after { border-top: 0; }
.oc-tree li:last-child:not(:only-child)::after { border-left: 0; }
.oc-tree li:last-child::before { border-right: 2px solid #cfc8c0; border-radius: 0 8px 0 0; }
.oc-tree li:first-child::after { border-radius: 8px 0 0 0; }
.oc-tree ul.oc-root > li::before, .oc-tree ul.oc-root > li::after { display: none; }
/* 上一層框底下往下的那條線 */
.oc-tree li > ul::before { content: ''; position: absolute; top: 0; left: 50%; height: 20px; border-left: 2px solid #cfc8c0; }
.oc-node { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-width: 120px; max-width: 220px; text-align: left; box-shadow: 0 1px 3px rgba(60,40,30,.05); }
.oc-node-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.oc-node-title strong { font-size: 15px; white-space: nowrap; }
.oc-sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.oc-node.root { background: var(--brand); border-color: var(--brand); color: #fff; text-align: center; }
.oc-node.root .oc-node-title { justify-content: center; }
.oc-node.root .oc-person, .oc-node.root .oc-person.lead { background: rgba(255,255,255,.14); border-color: transparent; color: #fff; }
.oc-node.root .oc-tag { background: #fff; color: var(--brand); }
.oc-node.region { background: #faf3f3; border-color: #e4cfd1; }
.oc-node.unit { border-top: 4px solid var(--brand); }
.oc-node.unit.hq { border-top-color: #4a6b8a; }
.oc-node.dept { background: #f7f5f2; }
.oc-people { display: flex; flex-direction: column; gap: 4px; }
.oc-person { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; font-size: 14px; line-height: 1.4; }
.oc-person.lead { border-color: #d9b8bb; background: #fbf2f2; }
.oc-name { font-weight: var(--w-ui); white-space: nowrap; }
.oc-pos { font-size: 12px; color: var(--muted); }
.oc-tag { font-size: 11px; font-weight: var(--w-ui); background: var(--brand); color: #fff; border-radius: 999px; padding: 0 7px; margin-left: auto; }
.oc-loose { margin-top: 18px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 12px; }
.oc-loose .oc-people { flex-direction: row; flex-wrap: wrap; }
.oc-av { display: none; }
/* 畫板：固定高度的框，裡面拖著看；放大縮小用 zoom，捲動範圍會跟著變 */
.oc-board { position: relative; margin-top: 8px; }
.oc-tools { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.oc-tools .btn { min-width: 40px; }
.oc-zoom-now { min-width: 48px; text-align: center; font-size: 14px; color: var(--muted); }
.oc-canvas { height: calc(100vh - 260px); min-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background-color: #fbfaf8; background-image: radial-gradient(#e2ddd6 1px, transparent 1px); background-size: 18px 18px; cursor: grab; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.oc-canvas.dragging { cursor: grabbing; user-select: none; }
.oc-pad { width: max-content; min-width: 100%; padding: 24px 40px 40px; }
.oc-scroll { overflow: visible; }
@media (max-width: 700px) {
  .oc-canvas { height: calc(100vh - 300px); min-height: 360px; }
  .oc-pad { padding: 16px 24px 24px; }
}

/* ===== 組織圖樣式：EC 2026-11-01 選「色塊分層＋部門分色」，頭像在後台設定開關（s3＋vd，開頭像再加 vb） ===== */
/* 3 色塊分層：每一層一個顏色，標題列整條上色 */
.oc-tree.s3 .oc-node { padding: 0; overflow: hidden; border: 0; box-shadow: 0 2px 8px rgba(60,40,30,.10); }
.oc-tree.s3 .oc-node-title { margin: 0; padding: 7px 10px; }
.oc-tree.s3 .oc-node .oc-people { padding: 8px 10px; }
.oc-tree.s3 .oc-node.root .oc-node-title { background: var(--brand); }
.oc-tree.s3 .oc-node.region { background: #fff; }
.oc-tree.s3 .oc-node.region .oc-node-title { background: #3d3a37; color: #fff; }
.oc-tree.s3 .oc-node.unit { background: #fff; border-top: 0; }
.oc-tree.s3 .oc-node.unit .oc-node-title { background: #b8505a; color: #fff; }
.oc-tree.s3 .oc-node.unit.hq .oc-node-title { background: #4a6b8a; }
.oc-tree.s3 .oc-node.dept { background: #fff; }
.oc-tree.s3 .oc-node.dept .oc-node-title { background: #efe7e0; }
.oc-tree.s3 .oc-node.region .oc-node-title .oc-sub, .oc-tree.s3 .oc-node.unit .oc-node-title .oc-sub { color: rgba(255,255,255,.8); }
/* 還沒有人的店：在白色那塊寫「這裡還沒有人」 */
.oc-tree.s3 .oc-node > .oc-sub { display: block; padding: 6px 10px; }
/* B 頭像：每個人前面一個圓形字頭，主管酒紅 */
.oc-tree.s3.vb .oc-av { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: #e9dfd6; color: var(--text); font-size: 12px; font-weight: var(--w-strong); flex: none; }
.oc-tree.s3.vb .oc-person.lead .oc-av { background: var(--brand); color: #fff; }
.oc-tree.s3.vb .oc-node.root .oc-av { background: #fff; color: var(--brand); }
.oc-tree.s3.vb .oc-person, .oc-tree.s3.vb .oc-person.lead { background: none; border: 0; padding: 2px 0; }
.oc-tree.s3.vb .oc-node.root .oc-person { background: none; }
/* D 部門分色：每個部門自己的顏色，一眼找到自己的部門 */
.oc-tree.s3.vd .oc-node.dept .oc-node-title { color: #fff; }
.oc-tree.s3.vd .oc-node.dept .oc-node-title .oc-sub { color: rgba(255,255,255,.85); }
.oc-tree.s3.vd .oc-node.dept .oc-node-title { background: #8a837c; }
.oc-tree.s3.vd .oc-node.dept.dc1 .oc-node-title { background: #3f7d5a; }
.oc-tree.s3.vd .oc-node.dept.dc2 .oc-node-title { background: #c26a2e; }
.oc-tree.s3.vd .oc-node.dept.dc3 .oc-node-title { background: #7a5a9a; }
.oc-tree.s3.vd .oc-node.dept.dc4 .oc-node-title { background: #6b6560; }
.oc-tree.s3.vd .oc-node.dept.dc5 .oc-node-title { background: #3d6f9e; }
.oc-tree.s3.vd .oc-node.dept.dc0 .oc-node-title { background: #2f8a8a; }
