/* ============================================================================
 * go.bosbm.ai —— 會員後台（帶頭人/賣家）工具樣式（疊在 /theme.css 之上）
 * ----------------------------------------------------------------------------
 * 只補後台專屬元件：頂欄、選品卡、藏價定價滑桿、AI 結果面板、狀態膠囊。
 * 版面骨架（member-shell / member-side / stat-tile / table / btn）沿用 theme.css。
 * 藏價鐵則：此為「操作者後台」，帶頭人可見成本（RMB 進價/試算 breakdown）以利定價；
 *          對外前台（public 根目錄）永遠只出 sale_price_twd，兩者互不相通。
 * ========================================================================== */

/* ── 後台頂欄 ─────────────────────────────────────────────────────────── */
.bk-topbar {
  background: var(--card); border-bottom: 2px solid var(--tb-primary);
  position: sticky; top: 0; z-index: var(--z-header);
}
.bk-topbar .container { display: flex; align-items: center; gap: 16px; height: 56px; }
.bk-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--tb-primary); }
.bk-brand .bk-mark {
  width: 34px; height: 34px; border-radius: 8px; background: var(--tb-gradient);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 16px;
}
.bk-brand .bk-tag { font-size: 11px; color: var(--text-3); font-weight: 600; margin-left: 2px; }
.bk-top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13px; }
.bk-top-right a { color: var(--text-2); }
.bk-top-right a:hover { color: var(--tb-primary); }
.bk-user-chip {
  display: flex; align-items: center; gap: 8px; background: var(--tb-primary-050);
  color: var(--tb-primary); border-radius: var(--r-pill); padding: 5px 12px; font-weight: 600;
}
.bk-user-chip .bk-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--tb-gradient);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; }

/* ── 頁首 ─────────────────────────────────────────────────────────────── */
.bk-pagehead { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.bk-pagehead h1 { font-size: 22px; font-weight: 800; margin: 0; color: var(--text-1); }
.bk-pagehead .bk-sub { color: var(--text-3); font-size: 13px; }
.bk-pagehead .spacer { flex: 1; }

/* ── 步驟提示條（選品/團購流程）──────────────────────────────────────── */
.bk-steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.bk-step {
  flex: 1; min-width: 150px; background: var(--card); border-radius: var(--r-md);
  box-shadow: var(--shadow-1); padding: 12px 14px; border-left: 3px solid var(--line-2);
}
.bk-step.on { border-left-color: var(--tb-primary); }
.bk-step .bk-step-n { font-size: 12px; color: var(--tb-primary); font-weight: 700; }
.bk-step .bk-step-t { font-weight: 700; margin: 2px 0; }
.bk-step .bk-step-d { font-size: 12px; color: var(--text-3); }

/* ── 說明/提示盒 ───────────────────────────────────────────────────────── */
.bk-note {
  background: var(--tb-primary-050); border: 1px solid var(--tb-primary-100);
  border-radius: var(--r-md); padding: 14px 16px; font-size: 13px; color: var(--text-2); line-height: 1.7;
}
.bk-note b { color: var(--tb-primary); }
.bk-note.warn { background: #fff8f0; border-color: #ffe0c0; }
.bk-note.warn b { color: var(--warning); }
.bk-note code { background: #fff; border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 6px; font-size: 12px; }
.bk-kbd-list { margin: 8px 0 0; padding-left: 4px; }
.bk-kbd-list li { display: flex; gap: 8px; padding: 4px 0; align-items: flex-start; }
.bk-kbd-list li .n { flex: 0 0 20px; height: 20px; border-radius: 50%; background: var(--tb-primary);
  color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* ── 選品原始貨源卡（帶頭人視角，可見 RMB 進價）───────────────────────── */
.raw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.raw-card { background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow-1); overflow: hidden;
  display: flex; flex-direction: column; border: 1px solid transparent; }
.raw-card:hover { border-color: var(--tb-primary-100); box-shadow: var(--shadow-2); }
.raw-card .rc-img { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: #f0f0f0; }
.raw-card .rc-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.raw-card .rc-title { font-size: 13px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; min-height: 36px; }
.raw-card .rc-cost { color: var(--text-2); font-size: 13px; font-weight: 700; }
.raw-card .rc-cost b { color: #C0392B; }
.raw-card .rc-src { font-size: 11px; color: var(--text-3); }
.raw-card .rc-foot { margin-top: auto; }

/* ── 藏價定價：滑桿 + 試算 breakdown ─────────────────────────────────── */
.pricing-shell { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.slider-row { margin-bottom: 16px; }
.slider-row .sl-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.slider-row .sl-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.slider-row .sl-val { font-size: 14px; font-weight: 800; color: var(--tb-primary); }
.slider-row input[type=range] { width: 100%; accent-color: var(--tb-primary); height: 4px; }
.slider-row .sl-hint { font-size: 11px; color: var(--text-3); margin-top: 3px; }

.calc-panel { background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow-2);
  padding: 18px; position: sticky; top: 72px; }
.calc-price { text-align: center; padding: 14px 0 10px; border-bottom: 1px dashed var(--line-2); margin-bottom: 12px; }
.calc-price .cp-label { font-size: 12px; color: var(--text-3); }
.calc-price .cp-val { font-size: 34px; font-weight: 800; color: var(--price); line-height: 1.1; }
.calc-price .cp-val .cur { font-size: 18px; margin-right: 2px; }
.calc-bd { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.calc-bd li { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--bg); }
.calc-bd li.profit { color: var(--success); font-weight: 700; border-bottom: none; padding-top: 10px; }
.calc-bd li.profit b { color: var(--success); }
.calc-bd .lbl { color: var(--text-3); }
.calc-secret { font-size: 11px; color: var(--text-3); margin-top: 10px; text-align: center; line-height: 1.5; }

/* ── AI 引流：三桶錢包 + 服務磚 + 結果 ───────────────────────────────── */
.wallet-buckets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.bucket { background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow-1); padding: 14px; text-align: center; }
.bucket .bk-val { font-size: 26px; font-weight: 800; }
.bucket.gifted .bk-val { color: var(--warning); }
.bucket.purchased .bk-val { color: var(--tb-primary); }
.bucket.earned .bk-val { color: var(--success); }
.bucket .bk-name { font-size: 12px; color: var(--text-2); margin-top: 2px; font-weight: 600; }
.bucket .bk-desc { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.svc-tile { border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 12px; background: #fff; cursor: pointer;
  transition: all .15s; }
.svc-tile:hover { border-color: var(--tb-primary); box-shadow: var(--shadow-1); }
.svc-tile.on { border-color: var(--tb-primary); background: var(--tb-primary-050); }
.svc-tile .svc-ico { font-size: 20px; }
.svc-tile .svc-name { font-weight: 700; margin: 4px 0 2px; }
.svc-tile .svc-price { font-size: 12px; color: var(--text-3); }
.svc-tile .svc-price .free { color: var(--success); font-weight: 700; }

.ai-out { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px;
  white-space: pre-wrap; font-size: 13px; line-height: 1.7; max-height: 460px; overflow: auto; }
.copy-block { background: #fff; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 10px; }
.copy-block .cb-plat { font-size: 11px; font-weight: 700; color: var(--tb-primary); text-transform: uppercase; }
.copy-block .cb-text { margin: 4px 0; white-space: pre-wrap; }
.copy-block .cb-tags { font-size: 12px; color: #1B5FA4; }

/* ── 狀態膠囊 ─────────────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 700; }
.pill-open   { background: #e8f4ff; color: #1B5FA4; }
.pill-locked { background: #fff3e0; color: var(--warning); }
.pill-done   { background: #e8f8f0; color: var(--success); }
.pill-failed,.pill-rejected,.pill-cancelled { background: #fbeaea; color: var(--danger); }
.pill-verified { background: #e8f8f0; color: var(--success); }
.pill-pending  { background: #f0f0f0; color: var(--text-2); }
.pill-paid     { background: #e8f8f0; color: var(--success); }

/* ── 邀請連結盒 ───────────────────────────────────────────────────────── */
.invite-box { display: flex; gap: 8px; align-items: center; background: var(--bg-2); border: 1px dashed var(--tb-primary-100);
  border-radius: var(--r-sm); padding: 8px 10px; }
.invite-box input { flex: 1; border: none; background: transparent; outline: none; font-size: 13px; color: var(--text-1); }

/* ── 登入遮罩（未登入時） ─────────────────────────────────────────────── */
.bk-login-mask { position: fixed; inset: 0; background: rgba(20,20,20,.5); z-index: var(--z-toast);
  display: flex; align-items: center; justify-content: center; }
.bk-login-card { background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-3); padding: 28px; width: 340px; max-width: 90vw; }
.bk-login-card h3 { margin: 0 0 6px; color: var(--tb-primary); }

/* ── 空狀態 mini ─────────────────────────────────────────────────────── */
.mini-empty { text-align: center; color: var(--text-3); padding: 28px 12px; font-size: 13px; }

/* ── RWD ──────────────────────────────────────────────────────────────── */
@media (max-width: 992px) {
  .pricing-shell { grid-template-columns: 1fr; }
  .calc-panel { position: static; }
}
@media (max-width: 768px) {
  .wallet-buckets { grid-template-columns: 1fr; }
  .bk-top-right .bk-hide-sm { display: none; }
}
