/* =========================================================
   後台四端共用(v12):側欄殼 + 元件庫
   代幣一律取自 theme-midnight-soft.css;身分色 --role 由 body 注入。
   佈局:≥900px 左側欄 236px;<900px 側欄隱藏、底部 tab bar 接手。
   ========================================================= */

/* ---------- 殼 ---------- */
.bo-body { padding-bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom, 0px)); }
.bo-side {
  display: none;
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 60;
  width: 236px; padding: 18px 14px;
  background: var(--bg-elev); border-right: 1px solid var(--line-soft);
  flex-direction: column; gap: 14px;
}
.bo-brand { padding: 4px 6px; }
.bo-role-badge {
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
  margin-left: 6px; padding: 5px 12px; border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--role) 16%, transparent); color: var(--role);
  font-size: 12px; font-weight: 800; letter-spacing: .06em;
}
.bo-role-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--role); }
/* 0039:側欄分四組後項目變多 —— 品牌 / 身分固定,選單區自己捲(側欄是 fixed 定高,原本內容撐破就看不到底下) */
.bo-nav { display: grid; gap: 3px; margin-top: 6px; align-content: start; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-right: 2px; }
/* 0039:側選單群組標題(客人 / 夥伴 / 經紀 / 平台) */
.bo-nav-group { margin: 10px 13px 2px; font-size: 11px; font-weight: 800; letter-spacing: .12em; color: var(--text-muted, var(--text-soft)); opacity: .8; }
.bo-nav-group:first-child { margin-top: 4px; }
.bo-nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: var(--radius-sm);
  font-size: 14.5px; font-weight: 700; color: var(--text-soft);
  transition: background .2s, color .2s;
}
.bo-nav-link svg { width: 19px; height: 19px; flex: 0 0 auto; }
.bo-nav-link:hover { background: var(--surface); color: var(--text); }
.bo-nav-link.is-current { background: var(--surface); color: var(--text); box-shadow: var(--shadow-soft); }
.bo-nav-link.is-current svg { color: var(--role); }
.bo-nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--st-busy); color: #fff; font-size: 11px; font-weight: 800;
}
.bo-who {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 12px; border-radius: var(--radius-sm); background: var(--surface);
}
.bo-who img, .bo-who-avatar { width: 38px; height: 38px; border-radius: 13px; object-fit: cover; flex: 0 0 auto; }
.bo-who-avatar { display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-soft); }
.bo-who-avatar svg { width: 18px; height: 18px; }
.bo-who-meta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; flex: 1; }
/* 0047 補:夥伴 / 經紀端登出鈕(側欄身分區靠右一顆;頂欄同款) */
.bo-logout { flex: 0 0 auto; color: var(--text-faint); }
.bo-logout:hover { color: var(--st-busy); }
.bo-who-meta strong { font-size: 14px; font-weight: 900; }
.bo-who-meta small { font-size: 11.5px; color: var(--text-faint); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bo-main { min-height: 100vh; }
.bo-top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  min-height: var(--header-h); padding: 10px 18px;
  background: color-mix(in srgb, var(--bg-elev) 86%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.bo-top-brand .brand-mark { width: 34px; height: 34px; border-radius: 11px; }
.bo-top-title { flex: 1; min-width: 0; }
.bo-top-title h1 { font-size: 19px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bo-top-title p { font-size: 12px; color: var(--text-faint); font-weight: 700; margin-top: 2px; }
.bo-top-actions { display: flex; align-items: center; gap: 8px; }
.bo-iconbtn {
  position: relative; width: 38px; height: 38px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--text-soft); transition: color .2s, background .2s;
}
.bo-iconbtn:hover { color: var(--text); background: var(--surface-2); }
.bo-iconbtn svg { width: 18px; height: 18px; }
.bo-iconbtn b { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--st-busy); }
/* 0051:鈴鐺未讀數字(取代紅點) */
.bo-iconbtn b.bo-bell-n {
  top: 4px; right: 2px; width: auto; height: 18px; min-width: 18px; padding: 0 5px; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-num); font-size: 11px; font-weight: 800; color: #fff; font-style: normal;
}
a.bo-iconbtn { text-decoration: none; }
.bo-top-who { display: none; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 800; }
.bo-top-who img, .bo-top-who .bo-who-avatar { width: 32px; height: 32px; border-radius: 11px; object-fit: cover; }

.bo-content { padding: 18px 16px 30px; max-width: 1180px; margin: 0 auto; display: grid; gap: 16px; align-content: start; }

/* 手機 tab bar */
.bo-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line-soft); padding-bottom: env(safe-area-inset-bottom);
}
.bo-tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 700; color: var(--text-faint); transition: color .2s;
}
.bo-tab svg { width: 21px; height: 21px; }
.bo-tab.is-current { color: var(--role); }
.bo-tab .bo-nav-badge { position: absolute; top: 6px; left: calc(50% + 6px); margin: 0; min-width: 17px; height: 17px; font-size: 10px; }

@media (min-width: 900px) {
  .bo-body { padding-bottom: 0; }
  .bo-side { display: flex; }
  .bo-main { margin-left: 236px; }
  .bo-top { padding: 12px 28px; }
  .bo-top-brand { display: none; }
  .bo-top-title h1 { font-size: 22px; }
  .bo-top-who { display: inline-flex; }
  .bo-tabbar { display: none; }
  .bo-content { padding: 22px 28px 40px; gap: 18px; }
  .bo-body .role-switch { left: 250px; }
}

/* ---------- 版面工具 ---------- */
.bo-two { display: grid; gap: 16px; }
.bo-two-1 { display: grid; gap: 16px; }
@media (min-width: 900px) {
  .bo-two { grid-template-columns: 1fr 1fr; align-items: start; }
  .bo-two-1 { grid-template-columns: 1.6fr 1fr; align-items: start; }
}
.bo-stack { display: grid; gap: 12px; }

/* ---------- 0044 經紀邀請碼卡(總覽;手機一行放得下:碼 + 複製 / 重生) ---------- */
.ag-code { margin-bottom: 12px; }
.ag-code-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ag-code-val { font-family: var(--font-num); font-size: 26px; font-weight: 700; letter-spacing: .12em; word-break: break-all; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }
.kpi {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border-radius: var(--radius); padding: 15px 16px;
  box-shadow: var(--shadow-soft);
}
.kpi-cap { font-size: 12px; font-weight: 800; color: var(--text-faint); display: flex; align-items: center; gap: 6px; }
.kpi-cap svg { width: 14px; height: 14px; color: var(--role); }
.kpi-num { font-family: var(--font-num); font-size: clamp(22px, 5vw, 28px); font-weight: 700; line-height: 1.1; }
.kpi-num small { font-family: var(--font-body); font-size: 12px; color: var(--text-faint); margin-left: 4px; font-weight: 700; }
.kpi-delta { font-size: 12px; font-weight: 800; }
.kpi-delta.up { color: var(--st-idle); }
.kpi-delta.down { color: var(--st-busy); }
.kpi-delta.flat { color: var(--text-faint); }
.kpi.is-accent { background: var(--grad-brand); color: var(--on-accent); box-shadow: var(--shadow-pop); }
.kpi.is-accent .kpi-cap, .kpi.is-accent .kpi-cap svg, .kpi.is-accent .kpi-num small, .kpi.is-accent .kpi-delta { color: var(--on-accent); opacity: .85; }

/* ---------- 卡 ---------- */
.bo-card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-soft); display: grid; gap: 14px; align-content: start; }
.bo-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bo-card-head h2 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.bo-card-head h2 svg { width: 17px; height: 17px; color: var(--role); }
.bo-card-head p { font-size: 12.5px; color: var(--text-faint); font-weight: 700; width: 100%; }
.bo-card-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bo-link { font-size: 13px; font-weight: 800; color: var(--violet); display: inline-flex; align-items: center; gap: 4px; }
.bo-link svg { width: 14px; height: 14px; }
.bo-link:hover { color: var(--coral); }

/* ---------- 按鈕尺寸 ---------- */
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-danger { background: var(--st-busy-soft); color: var(--st-busy); }
.btn-danger:hover { background: color-mix(in srgb, var(--st-busy) 28%, transparent); }
.btn-ok { background: var(--st-idle-soft); color: var(--st-idle); }
.btn-ok:hover { background: color-mix(in srgb, var(--st-idle) 28%, transparent); }

/* ---------- 列表列 ---------- */
.bo-list { display: grid; gap: 8px; }
.bo-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border-radius: var(--radius-sm); padding: 12px 14px;
  transition: transform .3s var(--ease), opacity .3s var(--ease), background .2s;
}
.bo-row:hover { background: var(--bg-elev); }
.bo-row.is-leaving { opacity: 0; transform: translateX(24px); }
.bo-row img, .bo-row .bo-avatar { width: 44px; height: 44px; border-radius: 15px; object-fit: cover; flex: 0 0 auto; }
.bo-avatar { display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-soft); font-weight: 900; font-size: 15px; }
.bo-avatar svg { width: 18px; height: 18px; }
.bo-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
/* ---------- 0051 站內通知列(夥伴 / 經紀) ---------- */
.bo-notice-day { font-size: 12.5px; font-weight: 900; color: var(--text-faint); padding: 10px 2px 2px; }
.bo-notice-day:first-child { padding-top: 0; }
.bo-notice-row .bo-notice-text { font-size: 14px; color: var(--text); font-weight: 600; white-space: normal; line-height: 1.5; }
.bo-notice-ico[data-st="idle"]    { background: var(--st-idle-soft);    color: var(--st-idle); }
.bo-notice-ico[data-st="enroute"] { background: var(--st-enroute-soft); color: var(--st-enroute); }
.bo-notice-ico[data-st="busy"]    { background: var(--st-busy-soft);    color: var(--st-busy); }
.bo-notice-ico[data-st="off"]     { background: var(--st-off-soft);     color: var(--st-off); }
.bo-notice-ico[data-st="hold"]    { background: var(--st-hold-soft);    color: var(--st-hold); }
div.bo-notice-row { cursor: default; }
.bo-row-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bo-row-top strong { font-size: 15px; font-weight: 900; }
.bo-row-sub { font-size: 12.5px; color: var(--text-soft); font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bo-row-sub svg { width: 13px; height: 13px; }
.bo-row-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: 0 0 auto; }
.bo-row-num { font-family: var(--font-num); font-size: 15px; font-weight: 700; color: var(--coral); }
.bo-row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.bo-mono { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.bo-muted { color: var(--text-faint); }
.bo-tag { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: var(--radius-pill); background: var(--violet-soft); color: var(--violet); white-space: nowrap; }
.bo-tag.is-role { background: color-mix(in srgb, var(--role) 16%, transparent); color: var(--role); }
.bo-tag.is-warn { background: var(--st-enroute-soft); color: var(--st-enroute); }
.bo-tag.is-bad { background: var(--st-busy-soft); color: var(--st-busy); }
.bo-tag.is-ok { background: var(--st-idle-soft); color: var(--st-idle); }

/* ---------- 表格 ---------- */
.bo-table-wrap { overflow-x: auto; border-radius: var(--radius-sm); background: var(--bg); }
.bo-table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 13.5px; }
.bo-table th, .bo-table td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: middle; white-space: nowrap; }
.bo-table th { font-size: 12px; letter-spacing: .05em; color: var(--text-faint); font-weight: 800; background: var(--bg-elev); }
.bo-table tr:last-child td { border-bottom: 0; }
.bo-table td.num, .bo-table th.num { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.bo-table .bo-tr { transition: opacity .3s, transform .3s; }
.bo-table .bo-tr.is-leaving { opacity: 0; transform: translateX(20px); }
.bo-table tfoot td { font-weight: 900; background: var(--bg-elev); }
.bo-cell-who { display: inline-flex; align-items: center; gap: 8px; }
.bo-cell-who img { width: 28px; height: 28px; border-radius: 9px; object-fit: cover; }

/* ---------- 分頁(segment) ---------- */
.bo-tabs { display: inline-flex; gap: 4px; background: var(--bg); border-radius: var(--radius-pill); padding: 4px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.bo-tabs::-webkit-scrollbar { display: none; }
.bo-tabs button {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 8px 15px; border-radius: var(--radius-pill);
  font-size: 13.5px; font-weight: 800; color: var(--text-soft); transition: all .2s var(--ease);
}
.bo-tabs button b { font-size: 11px; padding: 1px 7px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text-faint); }
.bo-tabs button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-soft); }
.bo-tabs button.is-active b { background: var(--coral-soft); color: var(--coral); }

/* ---------- 開關 ---------- */
.bo-toggle { position: relative; display: inline-block; width: 46px; height: 26px; flex: 0 0 auto; }
.bo-toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.bo-toggle i {
  position: absolute; inset: 0; border-radius: var(--radius-pill);
  background: var(--surface-2); transition: background .25s;
}
.bo-toggle i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--text-faint); transition: transform .25s var(--ease), background .25s;
}
.bo-toggle input:checked + i { background: color-mix(in srgb, var(--role) 45%, var(--surface-2)); }
.bo-toggle input:checked + i::after { transform: translateX(20px); background: var(--role); }
.bo-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.bo-toggle-row:last-child { border-bottom: 0; }
.bo-toggle-row .lbl { display: flex; flex-direction: column; gap: 2px; }
.bo-toggle-row .lbl strong { font-size: 14.5px; font-weight: 800; }
.bo-toggle-row .lbl small { font-size: 12px; color: var(--text-faint); font-weight: 700; }
[data-toggle-label] { font-size: 12px; font-weight: 800; color: var(--text-faint); }
[data-toggle-label].is-on { color: var(--st-idle); }

/* ---------- 表單 ---------- */
.bo-form { display: grid; gap: 12px; }
@media (min-width: 640px) { .bo-form.is-2 { grid-template-columns: 1fr 1fr; } }
.bo-field { display: flex; flex-direction: column; gap: 6px; }
.bo-field label, .bo-field .lbl { font-size: 12.5px; font-weight: 800; color: var(--text-soft); }
.bo-field small { font-size: 11.5px; color: var(--text-faint); font-weight: 700; }
.bo-input, .bo-select, .bo-textarea {
  width: 100%; border: 2px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); padding: 10px 14px; outline: none; font-size: 15px;
  transition: border-color .2s, box-shadow .2s;
}
.bo-input:focus, .bo-select:focus, .bo-textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft); }
.bo-textarea { min-height: 88px; resize: vertical; }
.bo-input-unit { display: flex; align-items: center; gap: 8px; }
.bo-input-unit .bo-input { flex: 1; }
.bo-input-unit span { font-size: 13px; font-weight: 800; color: var(--text-faint); white-space: nowrap; }

/* ---------- 組織樹 ---------- */
.bo-tree, .bo-tree ul { list-style: none; }
.bo-tree > .tree-node { padding-left: 0; }
.tree-node { position: relative; }
.tree-node > ul { margin-left: 22px; padding-left: 16px; border-left: 2px dashed var(--line); display: grid; gap: 8px; margin-top: 8px; }
.tree-node.is-collapsed > ul { display: none; }
.tree-node.is-collapsed [data-tree-toggle] svg { transform: rotate(-90deg); }
.tree-card {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--bg); border-radius: var(--radius-sm); padding: 12px 14px;
  border-left: 4px solid var(--role);
}
.tree-card.is-root { border-left-color: var(--coral); background: var(--bg-elev); }
.tree-card.is-off { opacity: .6; border-left-color: var(--st-off); }
.tree-card [data-tree-toggle] { width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-soft); flex: 0 0 auto; }
.tree-card [data-tree-toggle] svg { width: 14px; height: 14px; transition: transform .2s var(--ease); }
.tree-card .tree-main { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 2px; }
.tree-card .tree-main strong { font-size: 15px; font-weight: 900; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tree-card .tree-main small { font-size: 12px; color: var(--text-faint); font-weight: 700; }
.tree-stats { display: flex; gap: 14px; flex-wrap: wrap; }
.tree-stats span { display: flex; flex-direction: column; font-size: 11px; color: var(--text-faint); font-weight: 800; }
.tree-stats b { font-family: var(--font-num); font-size: 14px; color: var(--text); font-weight: 700; }
.tree-actions { display: flex; gap: 6px; }

/* ---------- 分潤堆疊條 ---------- */
.split-bar { display: flex; height: 14px; border-radius: var(--radius-pill); overflow: hidden; background: var(--surface-2); }
.split-bar span { height: 100%; }
.split-bar .sp-platform { background: var(--text-faint); }
.split-bar .sp-worker { background: var(--coral); }
.split-bar .sp-root { background: var(--st-hold); }
.split-bar .sp-sub { background: var(--violet); }
.split-legend { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.split-legend li { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 800; color: var(--text-soft); }
.split-legend i { width: 10px; height: 10px; border-radius: 3px; }
.split-legend b { font-family: var(--font-num); color: var(--text); }

/* ---------- 時間軸 / 三方會話 ---------- */
.bo-timeline { display: grid; gap: 10px; }
.tl-item { display: flex; gap: 10px; align-items: flex-start; }
.tl-dot { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-soft); }
.tl-dot svg { width: 14px; height: 14px; }
.tl-dot.is-customer { background: color-mix(in srgb, var(--role-customer) 18%, transparent); color: var(--role-customer); }
.tl-dot.is-worker { background: color-mix(in srgb, var(--role-worker) 18%, transparent); color: var(--role-worker); }
.tl-dot.is-support { background: color-mix(in srgb, var(--role-support) 18%, transparent); color: var(--role-support); }
.tl-dot.is-system { background: var(--surface-2); color: var(--text-faint); }
.tl-body { flex: 1; min-width: 0; }
.tl-head { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--text-faint); font-weight: 800; }
.tl-head strong { font-size: 13px; color: var(--text); }
.tl-text { margin-top: 4px; background: var(--bg); border-radius: 14px; padding: 10px 14px; font-size: 14px; line-height: 1.6; }
.tl-item.is-support .tl-text { background: color-mix(in srgb, var(--role-support) 10%, var(--bg)); }
.tl-item.is-system .tl-text { background: transparent; padding: 2px 0; font-size: 12.5px; color: var(--text-soft); font-weight: 700; }

/* ---------- 邀請卡(夥伴端邀請匣) ---------- */
.inv-card {
  background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-soft);
  display: grid; gap: 12px; transition: opacity .3s, transform .3s;
}
.inv-card.is-leaving { opacity: 0; transform: translateX(24px); }
.inv-card.is-accepted { outline: 2px solid var(--st-hold); }
.inv-card-top { display: flex; align-items: center; gap: 12px; }
.inv-card-top .bo-avatar { width: 46px; height: 46px; border-radius: 16px; }
.inv-card-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.inv-card-who strong { font-size: 16px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.inv-card-who small { font-size: 12px; color: var(--text-faint); font-weight: 700; }
.inv-credit { display: flex; flex-direction: column; align-items: flex-end; }
.inv-credit b { font-family: var(--font-num); font-size: 20px; font-weight: 700; line-height: 1; }
.inv-credit small { font-size: 11px; color: var(--text-faint); font-weight: 800; }
.inv-credit.good b { color: var(--st-idle); }
.inv-credit.mid b { color: var(--st-enroute); }
.inv-credit.bad b { color: var(--st-busy); }
.inv-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.inv-meta li { display: flex; flex-direction: column; gap: 2px; background: var(--bg); border-radius: var(--radius-sm); padding: 10px 8px; align-items: center; font-size: 11.5px; color: var(--text-faint); font-weight: 800; }
.inv-meta strong { font-size: 13.5px; color: var(--text); font-weight: 900; }
.inv-risk { display: flex; gap: 6px; flex-wrap: wrap; }
.inv-note { font-size: 13px; color: var(--text-soft); background: var(--bg); border-radius: var(--radius-sm); padding: 10px 12px; }
.inv-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- 夥伴端:上班開關 ---------- */
.wk-shift {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow-card);
  border: 2px solid transparent; transition: border-color .3s;
}
.wk-shift.is-on { border-color: color-mix(in srgb, var(--st-idle) 50%, transparent); }
.wk-shift-icon { width: 54px; height: 54px; border-radius: 18px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-faint); transition: all .3s; flex: 0 0 auto; }
.wk-shift.is-on .wk-shift-icon { background: var(--st-idle-soft); color: var(--st-idle); }
.wk-shift-icon svg { width: 24px; height: 24px; }
.wk-shift-main { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.wk-shift-main strong { font-size: 18px; font-weight: 900; }
.wk-shift-main small { font-size: 12.5px; color: var(--text-faint); font-weight: 700; }
.wk-shift .bo-toggle { width: 58px; height: 32px; }
.wk-shift .bo-toggle i::after { width: 26px; height: 26px; }
.wk-shift .bo-toggle input:checked + i::after { transform: translateX(26px); }

/* ---------- 定位列(經紀 / 管理員可見) ---------- */
.geo-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-soft); font-weight: 700; }
.geo-row svg { width: 14px; height: 14px; color: var(--role); }
.geo-mini { position: relative; height: 150px; border-radius: var(--radius-sm); overflow: hidden; background:
  radial-gradient(circle at 30% 40%, color-mix(in srgb, var(--role) 18%, transparent), transparent 40%),
  repeating-linear-gradient(0deg, transparent 0 28px, var(--line-soft) 28px 29px),
  repeating-linear-gradient(90deg, transparent 0 28px, var(--line-soft) 28px 29px), var(--bg); }
.geo-pin { position: absolute; transform: translate(-50%, -100%); display: inline-flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 800; }
.geo-pin img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 2px solid var(--surface); box-shadow: var(--shadow-soft); }
.geo-pin span { background: var(--surface); padding: 2px 7px; border-radius: var(--radius-pill); }
.geo-pin[data-st="enroute"] img { border-color: var(--st-enroute); }
.geo-pin[data-st="busy"] img { border-color: var(--st-busy); }
.geo-pin[data-st="idle"] img { border-color: var(--st-idle); }

/* ---------- 公告 / 提示 ---------- */
.bo-notice { display: flex; gap: 10px; align-items: flex-start; background: var(--violet-soft); color: var(--violet); border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13px; font-weight: 700; line-height: 1.55; }
.bo-notice svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 2px; }
.bo-notice.is-warn { background: var(--st-enroute-soft); color: var(--st-enroute); }
.bo-notice.is-bad { background: var(--st-busy-soft); color: var(--st-busy); }
.bo-notice.is-ok { background: var(--st-idle-soft); color: var(--st-idle); }
/* 0045:夥伴今日頁「尚未加入經紀」整塊可點(手機拇指區),字級比一般提示大一級 */
a.wk-join { text-decoration: none; font-size: 14px; align-items: center; }
a.wk-join span { flex: 1; }
a.wk-join svg:last-child { margin-top: 0; }

/* ---------- 恆等式卡(對帳) ---------- */
.eq-card { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; background: var(--bg); border-radius: var(--radius); padding: 18px; }
.eq-card .eq { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.eq-card .eq small { font-size: 11.5px; font-weight: 800; color: var(--text-faint); }
.eq-card .eq b { font-family: var(--font-num); font-size: clamp(20px, 5vw, 26px); font-weight: 700; }
.eq-card .op { font-family: var(--font-num); font-size: 24px; color: var(--text-faint); }
.eq-card .eq.is-ok b { color: var(--st-idle); }

/* ---------- toast ---------- */
.bo-toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom, 0px)); z-index: 95;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg-elev); font-size: 13.5px; font-weight: 800;
  padding: 11px 18px; border-radius: var(--radius-pill); box-shadow: 0 14px 34px rgba(4, 8, 16, .5);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
  max-width: 90vw; text-align: center;
}
.bo-toast.is-show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { .bo-toast { bottom: 28px; } }

/* ---------- 空狀態 ---------- */
.bo-empty { text-align: center; padding: 28px 16px; color: var(--text-soft); display: grid; gap: 8px; justify-items: center; }
.bo-empty svg { width: 36px; height: 36px; color: var(--text-faint); }
.bo-empty h3 { font-size: 16px; }
.bo-empty p { font-size: 13px; }

/* ---------- 星等 ---------- */
.bo-stars { display: inline-flex; gap: 2px; color: var(--amber); }
.bo-stars svg { width: 13px; height: 13px; }
.bo-stars b { font-family: var(--font-num); font-size: 13px; margin-left: 4px; color: var(--text); }

/* ---------- 迷你進度 ---------- */
.mini-bar { height: 8px; border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; }
.mini-bar span { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--grad-chip); }

/* ---------- 列表分頁器(bo_pager();上/下頁 + 頁碼 + 跳頁 + 總筆數 + 每頁筆數) ---------- */
.pager {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding-top: 12px; border-top: 1px solid var(--line-soft);
  font-size: 13px; color: var(--text-soft); font-weight: 700;
}
.pager .total { margin-right: auto; white-space: nowrap; }
.pg-btn {
  min-width: 32px; height: 32px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg); color: var(--text-soft);
  font-size: 13px; font-weight: 700; font-family: var(--font-num);
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s var(--ease);
}
.pg-btn:hover:not(:disabled) { border-color: var(--role); color: var(--text); }
.pg-btn.on { background: var(--role); border-color: var(--role); color: var(--on-accent); font-weight: 800; }
.pg-btn:disabled { opacity: .35; cursor: not-allowed; }
.pg-btn svg { width: 13px; height: 13px; }
.pg-ellipsis { padding: 0 3px; color: var(--text-faint); }
.pager .goto, .pager .per { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; white-space: nowrap; }
.pager .goto input {
  width: 56px; text-align: center; padding: 5px 4px; font-size: 13px;
  border: 1.5px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--text);
  font-family: var(--font-num);
}
.pager .goto input:focus { outline: none; border-color: var(--role); box-shadow: 0 0 0 3px color-mix(in srgb, var(--role) 22%, transparent); }
.pager .goto .chip-btn {
  padding: 5px 11px; border-radius: 9px; font-size: 12.5px; font-weight: 800;
  background: var(--surface-2); color: var(--text-soft); transition: all .15s;
}
.pager .goto .chip-btn:hover { background: color-mix(in srgb, var(--role) 18%, transparent); color: var(--role); }
.pager .per select {
  padding: 5px 28px 5px 10px; font-size: 13px; border-radius: 9px;
  border: 1.5px solid var(--line); background: var(--bg); color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2393a2b9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 14px;
}
@media (max-width: 640px) {
  .pager { gap: 5px; }
  .pager .total { width: 100%; margin-right: 0; }
  .pager .per { display: none; } /* 手機省空間:每頁筆數收起 */
}

/* =========================================================
   0040 後台列表頁規格(業主:列表頁看起來怪 → 先定一套,逐頁套)
   結構:.bo-filter(篩選列:chips / 搜尋 / 日期 / 下拉 + 動作)→ .bo-list(標題 + 筆數 + 表格 + 頁尾分頁)
   表格:一列一筆、一格一事實;固定欄序 主鍵 → 對象 → 數字 → 狀態 → 時間 → 操作;複雜操作開 .bo-drawer 抽屜
   手機:.bo-table.is-cards 一列變一張卡(td 用 data-label 當左標;is-primary 當卡標題、is-actions 放按鈕)
   ========================================================= */
.bo-content { max-width: none; }   /* 內容區跟著視窗寬(原本鎖 1180px,大螢幕兩側留白像沒撐開)*/
.bo-bad { color: var(--st-busy); }  /* 負數 / 補貼 / 沖正 */
/* 後台不做進場淡入:卡片會有半秒半透明、分頁切換後偶爾卡在透明(業主看到「有的頁沒底框」就是它) */
.bo-body .reveal { opacity: 1; transform: none; transition: none; }

/* 表格(列表頁規格版):表頭比卡片淺一階、文字正常色;列線清楚、hover 亮;欄寬照內容收攏(is-fit),只讓一欄吃剩餘寬(is-grow) */
.bo-list .bo-table { font-size: 14px; }
.bo-list .bo-table th { background: var(--surface-2); color: var(--text-soft); font-size: 12.5px; letter-spacing: .02em; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.bo-list .bo-table td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.bo-list .bo-table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
/* 欄寬:各頁在 th 上給百分比(對象欄寬、數字欄窄、操作欄剛好放兩顆鈕),不靠瀏覽器平均分 */
.bo-list .bo-table th.is-actions, .bo-list .bo-table td.is-actions { width: 1%; white-space: nowrap; }
.bo-list .bo-tag { font-size: 12px; padding: 4px 10px; }

/* 篩選列 */
.bo-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 16px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-soft); }
.bo-filter .bo-input, .bo-filter .bo-select { height: 38px; padding: 0 12px; font-size: 14px; width: auto; min-width: 160px; border-width: 1px; }
.bo-filter .btn { height: 38px; padding-top: 0; padding-bottom: 0; }
.bo-filter .bo-input.is-date { min-width: 150px; }
.bo-filter-field { display: inline-flex; align-items: center; gap: 7px; }
.bo-filter-field > label { font-size: 12.5px; font-weight: 800; color: var(--text-faint); white-space: nowrap; }
.bo-filter-actions { display: inline-flex; gap: 6px; margin-left: auto; }
.bo-chips { display: inline-flex; gap: 4px; background: var(--bg); border-radius: var(--radius-pill); padding: 4px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.bo-chips::-webkit-scrollbar { display: none; }
.bo-chips a, .bo-chips button { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 7px 14px; border-radius: var(--radius-pill); font-size: 13.5px; font-weight: 800; color: var(--text-soft); transition: all .2s var(--ease); }
.bo-chips a b, .bo-chips button b { font-size: 11px; padding: 1px 7px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text-faint); }
.bo-chips .is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-soft); }
.bo-chips .is-active b { background: var(--coral-soft); color: var(--coral); }

/* 列表卡 */
.bo-list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-soft); overflow: hidden; }
.bo-list-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.bo-list-head h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.bo-list-head h2 svg { width: 16px; height: 16px; color: var(--role); }
.bo-list-head h2 b { font-size: 12px; padding: 2px 9px; border-radius: var(--radius-pill); background: var(--bg); color: var(--text-faint); font-weight: 800; }
.bo-list-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.bo-hint { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--bg); color: var(--text-faint); font-size: 12px; font-weight: 900; cursor: help; }
.bo-list .bo-table-wrap { border-radius: 0; background: transparent; }
.bo-list .bo-table { min-width: 760px; }
.bo-list .bo-table th { background: var(--bg); }
.bo-list .bo-table td { line-height: 1.35; }
.bo-list-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--line-soft); font-size: 12.5px; color: var(--text-faint); font-weight: 700; }
.bo-list-foot .pager { margin: 0; }
.bo-list-empty { padding: 36px 18px; text-align: center; color: var(--text-faint); font-weight: 700; }
.bo-td-sub { display: block; font-size: 11.5px; color: var(--text-faint); font-weight: 700; margin-top: 2px; }
.bo-td-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.bo-td-actions form { display: inline; }

/* 抽屜(列的複雜操作:明細 / 修改 / 重算;不離開列表) */
.bo-drawer-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(6, 10, 22, .58); opacity: 0; pointer-events: none; transition: opacity .25s; }
.bo-drawer-overlay.is-open { opacity: 1; pointer-events: auto; }
.bo-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 81; width: min(560px, 100%); background: var(--bg-elev); box-shadow: -12px 0 40px rgba(0, 0, 0, .4); transform: translateX(100%); transition: transform .3s var(--ease); display: flex; flex-direction: column; }
.bo-drawer.is-open { transform: none; }
.bo-drawer-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line-soft); }
.bo-drawer-head h3 { flex: 1; font-size: 16px; min-width: 0; }
.bo-drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px; display: grid; gap: 14px; align-content: start; }
.bo-drawer-foot { padding: 12px 18px; border-top: 1px solid var(--line-soft); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.bo-drawer .bo-table { min-width: 0; font-size: 13px; }
.bo-drawer h4 { font-size: 13px; color: var(--text-faint); letter-spacing: .04em; }
.bo-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.bo-kv div { display: flex; flex-direction: column; gap: 2px; }
.bo-kv small { font-size: 11.5px; color: var(--text-faint); font-weight: 800; }
.bo-kv strong { font-size: 14.5px; }

/* 手機:表格 → 卡片 */
@media (max-width: 640px) {
  .bo-filter .bo-input, .bo-filter .bo-select, .bo-filter .bo-input.is-date { min-width: 0; flex: 1 1 120px; }
  .bo-filter-field { flex: 1 1 auto; }
  .bo-filter-actions { margin-left: 0; width: 100%; }
  .bo-filter-actions .btn { flex: 1; }
  .bo-list .bo-table-wrap { overflow: visible; }
  .bo-list .bo-table.is-cards { min-width: 0; display: block; }
  .bo-table.is-cards thead { display: none; }
  .bo-table.is-cards tbody, .bo-table.is-cards tr { display: block; }
  .bo-table.is-cards tr { padding: 8px 16px 12px; border-bottom: 1px solid var(--line-soft); }
  .bo-table.is-cards tr:last-child { border-bottom: 0; }
  .bo-table.is-cards td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 0; white-space: normal; text-align: right; }
  .bo-table.is-cards td::before { content: attr(data-label); flex: 0 0 auto; font-size: 12px; font-weight: 800; color: var(--text-faint); text-align: left; }
  .bo-table.is-cards td { flex-wrap: wrap; }
  .bo-table.is-cards td .bo-td-sub { flex-basis: 100%; text-align: right; margin-top: 0; }
  .bo-table.is-cards td.is-primary { justify-content: flex-start; text-align: left; font-size: 15px; font-weight: 800; padding-bottom: 4px; }
  .bo-table.is-cards td.is-primary::before, .bo-table.is-cards td.is-actions::before { display: none; }
  .bo-table.is-cards td.is-actions { justify-content: flex-start; padding-top: 10px; }
  .bo-table.is-cards td.is-actions .bo-td-actions { justify-content: flex-start; width: 100%; }
  .bo-table.is-cards td:empty { display: none; }
  .bo-list-head { padding: 12px 16px; }
  .bo-list-foot { padding: 10px 16px; }
  .bo-kv { grid-template-columns: 1fr 1fr; }
}
