/* 英德睿 ERP：版面照試衣間第一版「經典側欄」（墨藍線框）
   顏色全部是變數：一般／護眼／夜間三種模式（html[data-mode]），主色（--primary）每個人可以自己換。
   裝置版面看 html[data-dev]：desk、tabL 有側欄；tabP、phone 側欄收進左上角的選單鈕。 */

:root {
  --primary: #0a9fd6;
  --btn: #0880ab;              /* 主要按鈕的底色：主色加深到白字看得清楚（boot.js 依主色重算） */
  --on: #ffffff;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #0b1b2b;
  --muted: #5f6b77;
  --line: #dde3e8;
  --p-soft: color-mix(in srgb, var(--primary) 11%, var(--surface));
  --p-ink: color-mix(in srgb, var(--primary) 70%, #000);
  --nav-bg: var(--surface);
  --nav-ink: var(--ink);
  --nav-muted: var(--muted);
  --nav-act: var(--p-soft);
  --nav-act-ink: var(--p-ink);
  --r: 4px;
  --shadow: none;
  --warn: #96600f; --warn-soft: #fcf1d8;
  --ok: #26704a; --ok-soft: #e2f3e8;
  --danger: #c23b3b; --danger-soft: #fbe5e5;
  --idle: #66717d; --idle-soft: #edf0f3;
  --overlay: rgba(10, 20, 30, .32);
  --font: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
/* 護眼：米色紙感、降低對比與藍光 */
:root[data-mode="eye"] {
  --bg: #ece4d3;
  --surface: #f7f1e3;
  --ink: #3b3326;
  --muted: #655a48;
  --line: #ddd1b9;
  --p-soft: color-mix(in srgb, var(--primary) 13%, var(--surface));
  --p-ink: color-mix(in srgb, var(--primary) 62%, #2a2418);
  --warn: #85540f; --warn-soft: #f1dfbd;
  --ok: #33693f; --ok-soft: #dce6cf;
  --danger: #a33a31; --danger-soft: #f1d6cc;
  --idle: #6b614f; --idle-soft: #e5dccb;
  --overlay: rgba(40, 30, 15, .3);
}
/* 夜間 */
:root[data-mode="night"] {
  --bg: #0f151c;
  --surface: #17202a;
  --ink: #e1e7ee;
  --muted: #8b98a6;
  --line: #28333f;
  --p-soft: color-mix(in srgb, var(--primary) 20%, var(--surface));
  --p-ink: color-mix(in srgb, var(--primary) 62%, #fff);
  --warn: #e3ac52; --warn-soft: #3a2f18;
  --ok: #5fc08b; --ok-soft: #173223;
  --danger: #f17b7b; --danger-soft: #3d1d1f;
  --idle: #8b98a6; --idle-soft: #232d38;
  --overlay: rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; margin: 0; text-align: left; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
a { color: var(--p-ink); }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.ic { width: 18px; height: 18px; flex: none; }
.ic.sm { width: 15px; height: 15px; }
.ic.lg { width: 26px; height: 26px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
[hidden] { display: none !important; }

#app { height: 100vh; height: 100dvh; }
.shell { display: flex; height: 100%; min-height: 0; }
.col { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.ct { flex: 1; overflow: auto; padding: 22px 26px 0; min-width: 0; -webkit-overflow-scrolling: touch; }
.ct-in { min-height: calc(100% - 64px); }

/* ---------- 側欄 ---------- */
.sb { width: 232px; flex: none; border-right: 1px solid var(--line); padding: 14px 12px; overflow: auto; display: flex; flex-direction: column; gap: 2px; background: var(--nav-bg); color: var(--nav-ink); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; white-space: nowrap; font-size: 15px; }
.logo small { font-weight: 500; color: var(--muted); font-size: 11px; margin-left: 6px; letter-spacing: .1em; }
.sb .logo { padding: 4px 8px 16px; }
.lm { width: 32px; height: 32px; border-radius: var(--r); background: var(--btn); color: var(--on); display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; }
.sb-m { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: var(--r); font-weight: 500; }
.sb-m span { flex: 1; }
.sb-m:hover { background: var(--nav-act); }
.sb-m.cur { background: var(--nav-act); color: var(--nav-act-ink); }
.sb-its { display: flex; flex-direction: column; padding: 2px 0 6px 38px; }
.sb-it { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 10px; border-radius: var(--r); color: var(--nav-muted); font-size: 13px; }
.sb-it:hover { color: var(--nav-ink); background: var(--nav-act); }
.sb-it.cur { color: var(--nav-act-ink); background: var(--nav-act); font-weight: 500; }
.sb-it.soon::after { content: "準備中"; font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; flex: none; }
.sb-it[draggable="true"] { cursor: grab; }
.sb-ext { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }

/* ---------- 頂列 ---------- */
.tb { height: 58px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 5; }
.tb-r { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.ibtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 38px; height: 38px; padding: 0 9px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); white-space: nowrap; font-size: 13.5px; }
.srch { position: relative; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); color: var(--muted); font-size: 13px; width: 320px; }
.srch input { border: 0; background: transparent; outline: none; flex: 1; min-width: 0; color: var(--ink); font-size: 13.5px; }
.srch-res { position: absolute; top: 40px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 10px 30px rgba(0,0,0,.12); max-height: 60vh; overflow: auto; z-index: 30; padding: 4px; }
.srch-res button { display: flex; justify-content: space-between; gap: 10px; width: 100%; padding: 9px 10px; border-radius: var(--r); color: var(--ink); }
.srch-res button small { color: var(--muted); }
.srch-res button.cur, .srch-res button:hover { background: var(--p-soft); }
.srch-res .none { padding: 10px; color: var(--muted); }
.bell { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: var(--r); }
.bell:hover { background: var(--p-soft); }
.bell b { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; display: grid; place-items: center; padding: 0 4px; font-weight: 700; }
.me { position: relative; }
.me > button { display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; padding: 3px 6px; border-radius: var(--r); }
.me > button:hover { background: var(--p-soft); }
.me i { width: 32px; height: 32px; border-radius: 50%; background: var(--p-soft); color: var(--p-ink); display: grid; place-items: center; font-style: normal; font-weight: 700; flex: none; }
.me small { display: block; color: var(--muted); font-size: 11px; line-height: 1.2; }
.menu { position: absolute; right: 0; top: 46px; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 10px 30px rgba(0,0,0,.14); padding: 6px; z-index: 40; }
.menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; border-radius: var(--r); }
.menu button:hover { background: var(--p-soft); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---------- 抽屜（平板直式、手機） ---------- */
.ov-back { position: fixed; inset: 0; background: var(--overlay); z-index: 50; }
.ov-drawer { position: fixed; left: 0; top: 0; bottom: 0; width: min(320px, 86vw); z-index: 51; background: var(--nav-bg); box-shadow: 8px 0 30px rgba(0,0,0,.2); display: flex; flex-direction: column; }
.ov-drawer .sb { width: 100%; flex: 1; border-right: 0; padding-top: calc(14px + env(safe-area-inset-top)); padding-bottom: calc(14px + env(safe-area-inset-bottom)); }

/* ---------- 按鈕、欄位 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font-size: 13px; white-space: nowrap; color: var(--ink); }
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--btn); border-color: var(--btn); color: var(--on); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.full { width: 100%; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13px; white-space: nowrap; }
.chip:hover { border-color: var(--primary); }
.chip.cur { border-color: var(--primary); background: var(--p-soft); color: var(--p-ink); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fld { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.fld > span { font-size: 12.5px; color: var(--muted); }
.fld input, .fld select, .fld textarea, .inp { height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); width: 100%; }
.fld textarea { height: auto; padding: 9px 11px; }
.fld input:focus, .fld select:focus, .inp:focus { border-color: var(--primary); outline: none; }
.fld small { color: var(--muted); font-size: 12px; }
.fld input.bad { border-color: var(--danger); box-shadow: 0 0 0 2px var(--danger-soft); }
.fld .req { color: var(--danger); font-weight: 400; margin-left: 2px; }
.uform .err { color: var(--danger); font-size: 13.5px; margin: 4px 0 8px; }
/* 密碼欄位的眼睛 */
.pw { position: relative; display: block; width: 100%; }
.pw input { padding-right: 46px !important; width: 100%; }
.pw .eye { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; display: grid; place-items: center; border-radius: var(--r); color: var(--muted); }
.pw .eye:hover { color: var(--p-ink); background: var(--p-soft); }
.ck { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 30px; }
.ck input { width: 17px; height: 17px; accent-color: var(--primary); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 6px; }
.pill { display: inline-block; font-size: 11.5px; padding: 1px 9px; border-radius: 999px; background: var(--p-soft); color: var(--p-ink); white-space: nowrap; font-weight: 500; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.idle { background: var(--idle-soft); color: var(--idle); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 6px; background: var(--primary); }
.dot.warn { background: var(--warn); } .dot.ok { background: var(--ok); } .dot.idle { background: var(--idle); }

/* ---------- 首頁 ---------- */
.d-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.d-title { font-size: 21px; font-weight: 700; line-height: 1.3; }
.d-sub { color: var(--muted); font-size: 13px; }
.lib { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; border: 1px dashed var(--primary); border-radius: var(--r); margin-bottom: 14px; background: var(--p-soft); font-size: 13px; color: var(--p-ink); }
/* 自由排版（電腦、平板橫放）：Gridstack 12 格，每格之間留 14px */
.grid-stack { margin: 0 -7px; }
.grid-stack > .grid-stack-item > .grid-stack-item-content { overflow: visible; }
.grid-stack-placeholder > .placeholder-content { background: var(--p-soft); border: 2px dashed var(--primary); border-radius: var(--r); }
.grid-stack-item.ui-draggable-dragging .wg, .grid-stack-item.ui-resizable-resizing .wg { box-shadow: 0 14px 34px rgba(0,0,0,.18); }
.grid-stack-item > .ui-resizable-e, .grid-stack-item > .ui-resizable-w { width: 12px; cursor: ew-resize; }
.grid-stack-item:hover > .ui-resizable-e::after, .grid-stack-item:hover > .ui-resizable-w::after { content: ""; position: absolute; top: 50%; width: 4px; height: 28px; margin-top: -14px; border-radius: 2px; background: var(--line); }
.grid-stack-item > .ui-resizable-e::after { right: 4px; }
.grid-stack-item > .ui-resizable-w::after { left: 4px; }
/* 窄螢幕：由上往下排；平板直放兩欄 */
.d-stack { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
:root[data-dev="phone"] .d-stack { grid-template-columns: minmax(0, 1fr); }
.wg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; position: relative; }
.wg-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; min-height: 26px; }
.wg-h.movable { cursor: grab; }
.wg-h.movable:active { cursor: grabbing; }
.wg-t { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.notif .wg-t .ic { color: var(--primary); }
.editing .wg { outline: 1.5px dashed var(--primary); outline-offset: -1px; }
.grip { color: var(--muted); display: inline-flex; cursor: grab; touch-action: none; }
.wg-ctl { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.wg-ctl button { height: 26px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 11.5px; background: var(--bg); display: inline-flex; align-items: center; }
.wg-ctl button:hover { border-color: var(--primary); color: var(--p-ink); }
.lock { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.cnt { font-size: 11px; background: var(--danger); color: #fff; border-radius: 999px; padding: 0 7px; font-weight: 700; }
.wg.drop-ok { box-shadow: 0 0 0 3px var(--primary); background: var(--p-soft); }
.w-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.w-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.45; min-width: 0; }
.w-list li > div { min-width: 0; }
.w-list small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.w-list button { text-align: left; }
.empty { color: var(--muted); font-size: 13px; padding: 6px 0; }
.big { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; display: block; line-height: 1.25; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kv > div { background: var(--bg); border-radius: 6px; padding: 9px 11px; }
.kv small { color: var(--muted); font-size: 12px; display: block; }
.kv b { font-size: 15px; }
.bar { height: 8px; border-radius: 4px; background: var(--idle-soft); overflow: hidden; display: flex; margin: 8px 0; }
.bar i { display: block; height: 100%; background: var(--primary); }

/* 常用功能 */
.fav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.fv { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); font-size: 13.5px; min-width: 0; }
.fv > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fv .ic { color: var(--p-ink); }
.fv:hover { border-color: var(--primary); }
.fv.soon { color: var(--muted); }
.fv.soon::after { content: "準備中"; font-size: 10.5px; border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; white-space: nowrap; flex: none; }
.fv.soon .ic { color: var(--muted); }
.fv-add { border-style: dashed; color: var(--p-ink); justify-content: center; }
.fav-grid.fav-edit { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.fav-edit .fv { cursor: default; background: var(--surface); }
.fv .x, .fv .mv { color: var(--muted); width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; flex: none; }
.fv .x:hover { background: var(--danger-soft); color: var(--danger); }
.fv .mv:hover:not(:disabled) { background: var(--p-soft); color: var(--p-ink); }
.fv .mv:disabled { opacity: .3; cursor: default; }
.fv .grip { padding: 4px 0; }
.fv.ph { border: 2px dashed var(--primary); background: var(--p-soft); }
.fav-hint { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.picker { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.picker-g { margin-bottom: 10px; }
.picker-g b { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.picker .chip:disabled { opacity: .45; cursor: default; }

/* ---------- 一般頁面 ---------- */
.crumb { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.crumb button { color: var(--p-ink); }
.crumb b { color: var(--ink); font-weight: 500; }
.pg-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.pg-head h2 { margin: 0; font-size: 22px; }
.pg-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin-bottom: 14px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.card p { margin: 0 0 10px; }
.soon-box { text-align: center; padding: 60px 20px; color: var(--muted); }
.soon-box .ic { width: 40px; height: 40px; color: var(--p-ink); margin-bottom: 10px; }
.soon-box b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); font-size: 13.5px; }
.tbl th { background: var(--bg); color: var(--muted); font-weight: 500; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; word-break: break-word; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.open td { background: var(--p-soft); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .sub td { background: var(--bg); }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: var(--p-soft); }
.mc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 10px; font-size: 14px; }
.mc-t { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.mc small { color: var(--muted); font-size: 12px; display: block; margin-top: 2px; }
.grp-t { font-size: 13px; color: var(--muted); margin: 18px 0 8px; font-weight: 500; }
.note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r); background: var(--p-soft); color: var(--p-ink); font-size: 13px; margin-bottom: 14px; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.linkbox { display: flex; gap: 8px; margin: 10px 0; }
.linkbox input { flex: 1; min-width: 0; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); font-family: var(--mono); font-size: 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.filters select { height: 34px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 0 8px; }

/* 權限表 */
.perm { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); font-size: 13px; }
.perm th, .perm td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: center; }
.perm th:first-child, .perm td:first-child { text-align: left; }
.perm thead th { position: sticky; top: -22px; background: var(--bg); z-index: 1; font-weight: 500; }
.perm .mod td { background: var(--bg); font-weight: 700; }
.perm input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.perm label.cell { display: grid; place-items: center; min-height: 32px; cursor: pointer; }
.perm .rh { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.perm .rh small { color: var(--muted); font-weight: 400; }
.perm .mod td small { font-weight: 400; margin-left: 6px; }
.grp-ck { display: flex; min-height: 44px; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.grp-ck small { margin-left: 6px; }

/* 每一頁標題列右邊的「加到常用」 */
.crumb .fav-tg { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.crumb .fav-tg:hover { border-color: var(--primary); color: var(--p-ink); }
.crumb .fav-tg.on { color: var(--p-ink); border-color: var(--primary); background: var(--p-soft); }
.crumb .fav-tg.on .ic { fill: currentColor; }
:root[data-touch="1"] .crumb .fav-tg { min-height: 40px; padding: 0 14px; }

/* 一頁 20 筆的換頁 */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 14px 0 4px; flex-wrap: wrap; }
.pager small { margin-left: 4px; }
.soon-tag { font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; margin-left: 6px; }

/* 系統空間：每日新增容量圖（長條一律直角） */
.sd-total { margin: 0 0 8px; font-size: 14px; }
.sd-total small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.sd-chart svg { display: block; width: 100%; height: auto; }
.sd-hit { fill: transparent; pointer-events: all; cursor: pointer; }
.sd-bar { fill: var(--primary); pointer-events: none; }
.sd-bar.on { fill: var(--p-ink); }
.sd-ma { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.sd-grid { stroke: var(--line); stroke-width: 1; }
.sd-axis { stroke: var(--muted); stroke-width: 1; opacity: .5; }
.sd-tick { fill: var(--muted); font-size: 11px; }
.sd-caption { min-height: 1.6em; color: var(--ink); font-size: 13px; margin: 6px 0; }
.sd-lead { font-size: 13px; margin: 0 0 8px; }
.sd-lead b { font-variant-numeric: tabular-nums; }
.sd-legend { color: var(--muted); font-size: 12px; margin: 0; }
.sd-key { display: inline-block; width: 12px; height: 9px; margin: 0 5px 0 14px; vertical-align: middle; }
.sd-key:first-child { margin-left: 0; }
.sd-key.bar { background: var(--primary); }
.sd-key.ma { height: 3px; background: var(--ink); }
.tbl-more { margin-top: 12px; }
.tbl-more summary { cursor: pointer; color: var(--p-ink); font-size: 13px; padding: 6px 0; }
.tbl-more[open] summary { margin-bottom: 8px; }

/* 外觀設定 */
.modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mode { border: 1.5px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.mode.cur { border-color: var(--primary); box-shadow: 0 0 0 2px var(--p-soft); }
.mode .sw { height: 54px; border-radius: 6px; border: 1px solid rgba(0,0,0,.08); display: flex; overflow: hidden; }
.mode .sw i { display: block; }
.mode b { font-size: 13.5px; }
.mode small { color: var(--muted); font-size: 12px; }
.colors { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cl { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); position: relative; }
.cl.cur { box-shadow: 0 0 0 2px var(--ink); }
.cl-custom { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.cl-custom input { width: 40px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; }

/* ---------- 頁尾 ---------- */
.ft { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; align-items: center; padding: 22px 0 calc(22px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 12.5px; }
.ft button { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.ft button:hover { color: var(--p-ink); }

/* ---------- 對話框、提示 ---------- */
.modal-back { position: fixed; inset: 0; background: var(--overlay); z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 10px; width: min(560px, 100%); max-height: 86vh; overflow: auto; padding: 20px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(820px, 100%); }
.modal-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.modal-h h3 { margin: 0; font-size: 17px; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(26px + env(safe-area-inset-bottom)); margin: 0 auto; width: fit-content; max-width: 560px; display: flex; align-items: flex-start; gap: 10px; background: var(--ink); color: var(--surface); padding: 10px 12px 10px 16px; border-radius: 8px; z-index: 90; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.toast-t { flex: 1; min-width: 0; }
.toast-x { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; color: inherit; margin: -4px -2px -4px 0; }
.toast-x:hover { background: rgba(255,255,255,.15); }
:root[data-touch="1"] .toast-x { width: 44px; height: 44px; margin: -10px -6px -10px 0; }
.toast.bad { background: var(--danger); color: #fff; }
.toast small { display: block; opacity: .85; font-size: 12px; margin-top: 2px; }

/* 有新版本時最上面那一條 */
.upd-bar { position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 95; display: inline-flex; align-items: center; gap: 8px; padding: 0 18px; min-height: 44px; border-radius: 999px; background: var(--btn); color: var(--on); font-size: 14px; white-space: nowrap; box-shadow: 0 10px 30px rgba(0,0,0,.2); }

/* ---------- 登入 ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 26px 24px; }
.login-card .logo { justify-content: center; margin-bottom: 6px; font-size: 18px; }
.login-card .lm { width: 40px; height: 40px; font-size: 19px; }
.login-card h1 { font-size: 15px; text-align: center; color: var(--muted); font-weight: 500; margin: 0 0 20px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.gbtn { display: flex; justify-content: center; min-height: 44px; }
.login .err { color: var(--danger); font-size: 13.5px; margin: -4px 0 10px; }
.login .err .err-fix { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.login .forgot { color: var(--muted); font-size: 12.5px; text-align: center; margin: 16px 0 0; }

/* ---------- 裝置：平板直式、手機 ---------- */
:root[data-dev="tabL"] .srch { width: 280px; }
:root[data-dev="tabP"] .srch { width: 260px; }
:root[data-dev="tabP"] .ct, :root[data-dev="phone"] .ct { padding: 16px 16px 0; }
:root[data-dev="phone"] .tb { height: 54px; padding: 0 12px; gap: 8px; padding-top: env(safe-area-inset-top); height: calc(54px + env(safe-area-inset-top)); }
:root[data-dev="phone"] .me span { display: none; }
:root[data-dev="phone"] .d-title { font-size: 19px; }
:root[data-dev="phone"] .row2 { grid-template-columns: 1fr; }
:root[data-dev="phone"] .modal-back { place-items: end center; padding: 0; }
:root[data-dev="phone"] .modal { width: 100%; border-radius: 16px 16px 0 0; max-height: 90vh; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
:root[data-dev="phone"] .modal-back.top { place-items: start center; }
:root[data-dev="phone"] .modal-back.top .modal { border-radius: 0 0 16px 16px; padding-top: calc(16px + env(safe-area-inset-top)); max-height: 70vh; }
:root[data-dev="phone"] .modes { grid-template-columns: 1fr; }
:root[data-dev="phone"] .mode { flex-direction: row; align-items: center; }
:root[data-dev="phone"] .mode .sw { width: 70px; height: 44px; flex: none; }
:root[data-dev="phone"] .fav-grid { grid-template-columns: 1fr 1fr; }
:root[data-dev="phone"] .fav-grid.fav-edit { grid-template-columns: 1fr; }
:root[data-dev="phone"] .pg-head h2 { font-size: 19px; }
/* 用手指按的裝置（手機、平板直放、平板橫放）：按得到的地方至少 44px */
:root[data-touch="1"] .btn { height: 44px; padding: 0 16px; font-size: 14px; }
:root[data-touch="1"] .btn.sm { height: 44px; padding: 0 12px; font-size: 13.5px; }
:root[data-touch="1"] .sb-m { min-height: 46px; }
:root[data-touch="1"] .sb-it { min-height: 44px; font-size: 14px; }
:root[data-touch="1"] .fld input, :root[data-touch="1"] .fld select, :root[data-touch="1"] .inp, :root[data-touch="1"] .filters select { height: 44px; font-size: 16px; }
:root[data-touch="1"] .ibtn, :root[data-touch="1"] .bell { min-width: 44px; height: 44px; }
:root[data-touch="1"] .me > button { min-height: 44px; }
:root[data-touch="1"] .menu button { min-height: 44px; }
:root[data-touch="1"] .wg-ctl button { height: 44px; padding: 0 12px; font-size: 13px; }
:root[data-touch="1"] .fv { min-height: 48px; }
:root[data-touch="1"] .fv .x, :root[data-touch="1"] .fv .mv { width: 44px; height: 44px; }
:root[data-touch="1"] .chip { min-height: 44px; padding: 8px 14px; }
:root[data-touch="1"] .cl { width: 44px; height: 44px; }
:root[data-touch="1"] .pw .eye { width: 44px; height: 44px; }
:root[data-touch="1"] .w-list button { min-height: 44px; }
:root[data-touch="1"] .perm td { padding: 0; }
:root[data-touch="1"] .perm td:first-child { padding: 8px 10px; }
:root[data-touch="1"] .perm label.cell { display: grid; place-items: center; min-height: 44px; min-width: 44px; cursor: pointer; }
:root[data-touch="1"] .srch { height: 44px; }
:root[data-touch="1"] .ft button { min-height: 44px; }
