/* ============================================================================
 * go.bosbm.ai —— 博士寶兩岸團購電商・前台共用設計系統（淘寶式 全品項會員制購物）
 * ----------------------------------------------------------------------------
 * 主色：淘寶橙紅 #FF5000 / #FF4400。全品項分類導航、大搜尋列、商品瀑布流、
 *       會員後台側欄 layout、RWD。多租戶品牌可由 app.js 覆寫 --brand-* 變數。
 *
 * 藏價鐵則：前台只顯示台幣售價（--price 紅），永不顯示成本；此檔僅樣式，無資料。
 * 各頁只需： <link rel="stylesheet" href="/theme.css">
 * ========================================================================== */

/* ── Design Tokens ────────────────────────────────────────────────────── */
:root {
  /* 品牌主色（淘寶橙紅系）— 可由 /api/brand 或 window.GO_BRAND 覆寫 */
  --tb-primary:        #FF5000;   /* 主橙紅：CTA / 高亮 / logo */
  --tb-primary-600:    #FF4400;   /* hover / 加深 */
  --tb-primary-700:    #E13F00;   /* active */
  --tb-primary-050:    #FFF3EC;   /* 極淺橙底（選中/hover 背景） */
  --tb-primary-100:    #FFE3D3;
  --tb-secondary:      #FF9000;   /* 漸層副色（橙黃） */
  --tb-gradient:       linear-gradient(90deg, #FF5000 0%, #FF9000 100%);

  /* 語義色 */
  --price:             #FF4400;   /* 售價紅（淘寶價格色） */
  --success:           #00A854;
  --warning:           #FA8C16;
  --danger:            #F5222D;
  --gb:                #FF3366;   /* 團購 / 揪團標籤色 */

  /* 中性 */
  --text-1:            #333333;   /* 主文字 */
  --text-2:            #666666;   /* 次文字 */
  --text-3:            #999999;   /* 弱文字 / 說明 */
  --text-inv:          #ffffff;
  --line:              #ececec;   /* 分隔線 */
  --line-2:            #e0e0e0;
  --bg:                #f5f5f5;   /* 頁面底 */
  --bg-2:              #fafafa;   /* 區塊底 */
  --card:              #ffffff;

  /* 圓角 */
  --r-xs: 3px;  --r-sm: 4px;  --r-md: 8px;  --r-lg: 12px;  --r-pill: 999px;

  /* 陰影 */
  --shadow-1: 0 1px 3px rgba(0,0,0,.06);
  --shadow-2: 0 2px 12px rgba(0,0,0,.10);
  --shadow-3: 0 6px 24px rgba(0,0,0,.14);
  --shadow-hover: 0 8px 20px rgba(255,80,0,.18);

  /* 版面 */
  --container: 1200px;
  --header-h: 120px;
  --z-header: 100;
  --z-menu: 200;
  --z-toast: 900;

  /* 間距刻度 */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;

  /* 品牌別名（多租戶注入點；預設 = 淘寶橙紅） */
  --brand-primary: var(--tb-primary);
  --brand-accent:  var(--tb-secondary);
}

/* ── Reset / Base ─────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei",
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--tb-primary); }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
ul, li { list-style: none; margin: 0; padding: 0; }
input, select, textarea { font-family: inherit; font-size: 14px; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 12px; }
.muted   { color: var(--text-3); }
.small   { font-size: 12px; }
.center  { text-align: center; }
.hide    { display: none !important; }
.row     { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.spacer  { flex: 1; }

/* ============================================================================
 * HEADER —— 頂部三層：①工具列 ②Logo+大搜尋+購物車 ③全品項分類導航
 * ========================================================================== */

/* ① 頂部工具列（歡迎 / 登入 / 我的訂單 / 會員中心 / 客服） */
.tb-utilbar {
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-2);
}
.tb-utilbar .container { display: flex; align-items: center; height: 32px; }
.tb-utilbar a { color: var(--text-2); padding: 0 10px; border-right: 1px solid var(--line-2); line-height: 1; }
.tb-utilbar a:first-child { padding-left: 0; }
.tb-utilbar a:last-child { border-right: none; }
.tb-utilbar a:hover { color: var(--tb-primary); }
.tb-util-left  { display: flex; align-items: center; }
.tb-util-right { display: flex; align-items: center; margin-left: auto; }
.tb-util-user  { color: var(--tb-primary); font-weight: 600; }

/* ② 主頭部：Logo + 大搜尋列 + 購物車 */
.tb-header { background: var(--card); }
.tb-header .container {
  display: flex; align-items: center; gap: 28px;
  height: 88px;
}
.tb-logo { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.tb-logo .tb-logo-mark {
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--tb-gradient);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 22px; letter-spacing: -1px;
}
.tb-logo .tb-logo-text { line-height: 1.15; }
.tb-logo .tb-brand-name  { font-size: 20px; font-weight: 800; color: var(--tb-primary); }
.tb-logo .tb-brand-slogan{ font-size: 11px; color: var(--text-3); }

/* 大搜尋列 */
.tb-search { flex: 1; max-width: 640px; }
.tb-search-box {
  display: flex; align-items: stretch;
  border: 2px solid var(--tb-primary);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: #fff;
}
.tb-search-box input {
  flex: 1; border: none; outline: none;
  padding: 0 14px; height: 38px; font-size: 14px; color: var(--text-1);
}
.tb-search-box input::placeholder { color: var(--text-3); }
.tb-search-box button {
  border: none; background: var(--tb-primary); color: #fff;
  padding: 0 26px; font-size: 16px; font-weight: 700; letter-spacing: 2px;
  display: flex; align-items: center; gap: 6px;
}
.tb-search-box button:hover { background: var(--tb-primary-600); }
.tb-search-hot { margin-top: 6px; font-size: 12px; color: var(--text-3); display: flex; gap: 12px; flex-wrap: wrap; }
.tb-search-hot a:hover { color: var(--tb-primary); }

/* 購物車入口 */
.tb-cart {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--tb-primary-100);
  background: var(--tb-primary-050);
  color: var(--tb-primary);
  border-radius: var(--r-sm);
  padding: 9px 16px; font-weight: 600; position: relative;
}
.tb-cart:hover { background: var(--tb-primary-100); color: var(--tb-primary-600); }
.tb-cart .tb-cart-icon { font-size: 18px; }
.tb-cart-badge {
  position: absolute; top: -8px; right: -8px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--tb-primary); color: #fff;
  border-radius: var(--r-pill); font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ③ 全品項分類導航列 */
.tb-nav { background: var(--card); border-bottom: 2px solid var(--tb-primary); }
.tb-nav .container { display: flex; align-items: stretch; gap: 0; height: 40px; }

/* 「全部商品分類」按鈕 + 下拉 mega-menu */
.tb-allcats { position: relative; flex: 0 0 auto; }
.tb-allcats-btn {
  height: 40px; min-width: 190px;
  background: var(--tb-primary); color: #fff;
  border: none; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; gap: 10px; padding: 0 18px;
}
.tb-allcats-btn .tb-burger { font-size: 16px; }
.tb-allcats-menu {
  position: absolute; top: 40px; left: 0; width: 240px;
  background: var(--card); box-shadow: var(--shadow-2);
  border: 1px solid var(--line); border-top: none;
  z-index: var(--z-menu);
  max-height: 460px; overflow-y: auto;
  display: none;
}
/* 首頁常駐展開；其他頁 hover 展開 */
.tb-allcats.is-open .tb-allcats-menu,
.tb-allcats:hover  .tb-allcats-menu { display: block; }
.tb-cat-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; font-size: 14px; color: var(--text-1);
  border-bottom: 1px solid var(--bg);
}
.tb-cat-item:hover { background: var(--tb-primary-050); color: var(--tb-primary); }
.tb-cat-item .tb-cat-ico { font-size: 17px; width: 22px; text-align: center; }
.tb-cat-item .tb-cat-subs { margin-left: auto; color: var(--text-3); font-size: 12px; }

/* 主導航橫向快捷（精選大類） */
.tb-nav-links { display: flex; align-items: center; gap: 4px; flex: 1; overflow: hidden; }
.tb-nav-links a {
  padding: 0 14px; height: 40px; display: flex; align-items: center;
  font-size: 14px; color: var(--text-1); font-weight: 500; white-space: nowrap;
}
.tb-nav-links a:hover, .tb-nav-links a.active { color: var(--tb-primary); }
.tb-nav-links a.hot { color: var(--tb-primary); }

/* ============================================================================
 * BUTTONS / BADGES / PRICE
 * ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line-2); background: #fff; color: var(--text-1);
  border-radius: var(--r-sm); padding: 8px 16px; font-size: 14px; font-weight: 500;
  transition: all .15s; line-height: 1.2;
}
.btn:hover { border-color: var(--tb-primary); color: var(--tb-primary); }
.btn-primary {
  background: var(--tb-primary); border-color: var(--tb-primary); color: #fff; font-weight: 700;
}
.btn-primary:hover { background: var(--tb-primary-600); border-color: var(--tb-primary-600); color: #fff; }
.btn-gradient {
  background: var(--tb-gradient); border: none; color: #fff; font-weight: 700;
}
.btn-gradient:hover { filter: brightness(1.05); color: #fff; }
.btn-outline { background: #fff; border-color: var(--tb-primary); color: var(--tb-primary); font-weight: 600; }
.btn-outline:hover { background: var(--tb-primary-050); }
.btn-gb { background: var(--gb); border-color: var(--gb); color: #fff; font-weight: 700; }
.btn-gb:hover { filter: brightness(1.05); color: #fff; }
.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px; border-radius: var(--r-xs);
  font-size: 11px; font-weight: 600; line-height: 1.6;
}
.badge-primary { background: var(--tb-primary-050); color: var(--tb-primary); border: 1px solid var(--tb-primary-100); }
.badge-gb      { background: var(--gb); color: #fff; }
.badge-hot     { background: #fff0f0; color: var(--danger); border: 1px solid #ffd6d6; }
.badge-cross   { background: #eef6ff; color: #1B5FA4; border: 1px solid #cfe4fb; }
.badge-success { background: #e8f8f0; color: var(--success); }
.badge-ghost   { background: var(--bg); color: var(--text-2); }

/* 價格 */
.price { color: var(--price); font-weight: 800; }
.price .cur { font-size: .72em; font-weight: 700; margin-right: 1px; }
.price-lg { font-size: 26px; }
.price-md { font-size: 20px; }
.price-orig { color: var(--text-3); text-decoration: line-through; font-size: 12px; font-weight: 400; margin-left: 6px; }

/* ============================================================================
 * PRODUCT CARD GRID —— 瀑布流（響應式列數）
 * ========================================================================== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.product-card {
  background: var(--card); border-radius: var(--r-md);
  overflow: hidden; border: 1px solid transparent;
  transition: box-shadow .18s, transform .18s, border-color .18s;
  display: flex; flex-direction: column;
}
.product-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--tb-primary-100);
  transform: translateY(-2px);
}
.product-card .pc-imgwrap { position: relative; }
.product-card .pc-img {
  width: 100%; aspect-ratio: 1/1; object-fit: cover; background: #f0f0f0;
}
.product-card .pc-tag {
  position: absolute; top: 8px; left: 8px;
}
.product-card .pc-body { padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.product-card .pc-title {
  font-size: 13px; color: var(--text-1); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 36px;
}
.product-card:hover .pc-title { color: var(--tb-primary); }
.product-card .pc-price-row { display: flex; align-items: baseline; gap: 8px; margin-top: auto; }
.product-card .pc-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-3); }
.product-card .pc-meta .pc-sold { margin-left: auto; }

/* 商品卡快捷加購鈕 */
.product-card .pc-add {
  margin-left: auto; width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--tb-primary-100); background: var(--tb-primary-050);
  color: var(--tb-primary); font-size: 18px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.product-card .pc-add:hover { background: var(--tb-primary); color: #fff; border-color: var(--tb-primary); }

/* ============================================================================
 * 麵包屑 / 分類頁側欄 / 排序列
 * ========================================================================== */
.breadcrumb { font-size: 12px; color: var(--text-3); margin: 12px 0; }
.breadcrumb a:hover { color: var(--tb-primary); }
.breadcrumb .sep { margin: 0 6px; color: var(--line-2); }

.cat-shell { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start; margin: 8px 0 24px; }
.cat-side { background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow-1); overflow: hidden; position: sticky; top: 12px; }
.cat-side .cs-title { padding: 12px 16px; font-weight: 800; font-size: 15px; border-bottom: 2px solid var(--tb-primary); }
.cat-side .cs-item { display: flex; align-items: center; gap: 8px; padding: 9px 16px; font-size: 13px; border-bottom: 1px solid var(--bg); }
.cat-side .cs-item:hover { background: var(--tb-primary-050); color: var(--tb-primary); }
.cat-side .cs-item.active { background: var(--tb-primary-050); color: var(--tb-primary); font-weight: 700; border-left: 3px solid var(--tb-primary); }
.cat-side .cs-sub { padding: 6px 16px 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.cat-side .cs-sub a { font-size: 12px; color: var(--text-3); background: var(--bg); padding: 3px 8px; border-radius: var(--r-pill); }
.cat-side .cs-sub a:hover { background: var(--tb-primary-050); color: var(--tb-primary); }

.sortbar { display: flex; align-items: center; gap: 4px; background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow-1); padding: 8px 12px; margin-bottom: 14px; }
.sortbar .sb-label { color: var(--text-3); font-size: 13px; margin-right: 6px; }
.sortbar .sb-opt { padding: 5px 14px; font-size: 13px; border-radius: var(--r-sm); color: var(--text-2); cursor: pointer; border: 1px solid transparent; }
.sortbar .sb-opt:hover { color: var(--tb-primary); }
.sortbar .sb-opt.active { background: var(--tb-primary); color: #fff; font-weight: 600; }
.sortbar .sb-count { margin-left: auto; color: var(--text-3); font-size: 13px; }

/* ============================================================================
 * 商品詳情頁
 * ========================================================================== */
.pd-shell { display: grid; grid-template-columns: 420px 1fr; gap: 28px; background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow-1); padding: 24px; margin: 8px 0 24px; }
.pd-gallery .pd-main-img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: var(--r-md); background: #f0f0f0; }
.pd-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pd-thumbs img { width: 62px; height: 62px; object-fit: cover; border-radius: var(--r-sm); border: 2px solid transparent; cursor: pointer; }
.pd-thumbs img.active, .pd-thumbs img:hover { border-color: var(--tb-primary); }
.pd-info { min-width: 0; }
.pd-title { font-size: 22px; font-weight: 700; line-height: 1.35; margin: 0 0 14px; }
.pd-pricebox { background: var(--tb-primary-050); border-radius: var(--r-md); padding: 16px 18px; margin-bottom: 18px; }
.pd-pricebox .pd-price { font-size: 34px; }
.pd-row { display: flex; align-items: center; gap: 14px; margin: 14px 0; }
.pd-row .pd-k { width: 68px; color: var(--text-3); font-size: 13px; flex: 0 0 auto; }
.spec-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.spec-opt { padding: 7px 14px; border: 1px solid var(--line-2); border-radius: var(--r-sm); font-size: 13px; cursor: pointer; background: #fff; }
.spec-opt:hover { border-color: var(--tb-primary); color: var(--tb-primary); }
.spec-opt.active { border-color: var(--tb-primary); color: var(--tb-primary); background: var(--tb-primary-050); font-weight: 600; }
.spec-opt.disabled { opacity: .4; cursor: not-allowed; text-decoration: line-through; }

/* 數量步進器 */
.qty-step { display: inline-flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; }
.qty-step button { width: 34px; background: var(--bg-2); border: none; font-size: 16px; color: var(--text-2); }
.qty-step button:hover { color: var(--tb-primary); }
.qty-step input { width: 54px; border: none; border-left: 1px solid var(--line-2); border-right: 1px solid var(--line-2); text-align: center; }
.pd-actions { display: flex; gap: 12px; margin-top: 22px; }
.pd-gb-banner { display: flex; align-items: center; gap: 12px; background: #fff0f4; border: 1px solid #ffd6e2; border-radius: var(--r-md); padding: 12px 16px; margin-bottom: 18px; }
.pd-gb-banner .gb-ico { font-size: 22px; }

/* ============================================================================
 * 購物車 / 結帳
 * ========================================================================== */
.cart-shell { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; margin: 8px 0 24px; }
.cart-line { display: grid; grid-template-columns: 84px 1fr auto auto auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cart-line img { width: 84px; height: 84px; object-fit: cover; border-radius: var(--r-sm); }
.cart-line .cl-title { font-size: 14px; line-height: 1.4; }
.cart-line .cl-spec { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.cart-line .cl-del { color: var(--text-3); font-size: 13px; cursor: pointer; }
.cart-line .cl-del:hover { color: var(--danger); }
.cart-summary { background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow-1); padding: 20px; position: sticky; top: 12px; }
.cart-summary .cs-row { display: flex; justify-content: space-between; margin: 10px 0; font-size: 14px; }
.cart-summary .cs-total { font-size: 22px; }
.checkout-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; margin: 8px 0 24px; }

/* 訂單物流時間軸 */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 6px 0 14px; }
.tl-item::before { content: ''; position: absolute; left: -19px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); border: 2px solid #fff; }
.tl-item.done::before { background: var(--tb-primary); }
.tl-item .tl-t { font-size: 14px; font-weight: 600; }
.tl-item .tl-d { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* 登入卡 / 分頁 */
.auth-card { max-width: 420px; margin: 40px auto; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 9px 16px; font-size: 14px; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--tb-primary); }
.tab.active { color: var(--tb-primary); font-weight: 700; border-bottom-color: var(--tb-primary); }

/* 團購跟團頁 */
.gb-hero { display: grid; grid-template-columns: 320px 1fr; gap: 24px; background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow-1); padding: 24px; margin: 8px 0 24px; }
.gb-hero img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: var(--r-md); }
.gb-progress-num { font-size: 15px; margin: 10px 0 6px; }
.gb-progress-num b { color: var(--gb); font-size: 20px; }

@media (max-width: 992px) {
  .cat-shell { grid-template-columns: 160px 1fr; }
  .pd-shell { grid-template-columns: 340px 1fr; }
}
@media (max-width: 768px) {
  .cat-shell, .pd-shell, .cart-shell, .checkout-grid, .gb-hero { grid-template-columns: 1fr; }
  .cat-side { position: static; }
  .cart-summary { position: static; }
  .cart-line { grid-template-columns: 64px 1fr auto; grid-template-areas: 'img title del' 'img price qty'; }
  .cart-line img { grid-area: img; width: 64px; height: 64px; }
}

/* ============================================================================
 * CARD / SECTION / PANEL
 * ========================================================================== */
.card { background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
.panel { background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow-1); padding: 20px; }
.section { margin: 20px 0; }
.section-head { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; }
.section-title {
  font-size: 20px; font-weight: 800; color: var(--text-1);
  border-left: 4px solid var(--tb-primary); padding-left: 10px; line-height: 1.1;
}
.section-sub { color: var(--text-3); font-size: 13px; }
.section-more { margin-left: auto; color: var(--text-3); font-size: 13px; }
.section-more:hover { color: var(--tb-primary); }

/* 首頁 hero（分類欄 + 輪播位） */
.tb-hero { display: grid; grid-template-columns: 240px 1fr; gap: 12px; margin: 14px 0; }
.tb-hero-banner {
  border-radius: var(--r-md); overflow: hidden; min-height: 300px;
  background: var(--tb-gradient); color: #fff;
  display: flex; flex-direction: column; justify-content: center; padding: 40px;
}
.tb-hero-banner h1 { font-size: 30px; margin: 0 0 10px; font-weight: 800; }
.tb-hero-banner p  { font-size: 15px; opacity: .95; margin: 0 0 20px; max-width: 460px; }

/* 首頁常駐分類側欄（hero 左側） */
.tb-hero-cats { background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow-1); overflow: hidden; }
.tb-hero-cats .tb-cat-item { padding: 8px 14px; font-size: 13px; }

/* ============================================================================
 * 會員後台 LAYOUT —— 左側欄 + 右內容（團購等行銷功能在此後台）
 * ========================================================================== */
.member-shell {
  display: grid; grid-template-columns: 200px 1fr; gap: 16px;
  max-width: var(--container); margin: 16px auto; padding: 0 12px;
  align-items: start;
}
.member-side {
  background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow-1);
  overflow: hidden; position: sticky; top: 12px;
}
.member-side .ms-user {
  padding: 18px 16px; background: var(--tb-gradient); color: #fff;
  display: flex; align-items: center; gap: 12px;
}
.member-side .ms-avatar {
  width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700;
}
.member-side .ms-name { font-weight: 700; font-size: 15px; }
.member-side .ms-role { font-size: 11px; opacity: .9; }
.member-side .ms-group { padding: 6px 0; border-bottom: 1px solid var(--bg); }
.member-side .ms-group-title { padding: 8px 16px 4px; font-size: 12px; color: var(--text-3); font-weight: 600; }
.member-side .ms-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: 14px; color: var(--text-1); border-left: 3px solid transparent;
}
.member-side .ms-link .ms-ico { width: 20px; text-align: center; }
.member-side .ms-link:hover { background: var(--tb-primary-050); color: var(--tb-primary); }
.member-side .ms-link.active {
  background: var(--tb-primary-050); color: var(--tb-primary);
  border-left-color: var(--tb-primary); font-weight: 700;
}
.member-main { min-width: 0; }
.member-main .panel + .panel { margin-top: 16px; }

/* 統計磚（會員後台 / 團購行銷數據） */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-tile { background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow-1); padding: 16px; }
.stat-tile .st-val { font-size: 24px; font-weight: 800; color: var(--tb-primary); }
.stat-tile .st-label { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ============================================================================
 * FORMS / TABLES / PROGRESS / EMPTY
 * ========================================================================== */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 5px; font-weight: 600; }
.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-2);
  border-radius: var(--r-sm); background: #fff; color: var(--text-1);
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--tb-primary); }
.textarea { min-height: 90px; resize: vertical; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { color: var(--text-3); font-weight: 600; background: var(--bg-2); }
.table tr:hover td { background: var(--bg-2); }

.progress { background: #eee; border-radius: var(--r-pill); height: 8px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--tb-gradient); }

.empty { text-align: center; color: var(--text-3); padding: 48px 20px; }
.empty .empty-ico { font-size: 40px; margin-bottom: 10px; }

.skeleton { background: linear-gradient(90deg,#eee 25%,#f5f5f5 37%,#eee 63%); background-size: 400% 100%;
  animation: sk 1.2s ease-in-out infinite; border-radius: var(--r-sm); }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ── FOOTER ───────────────────────────────────────────────────────────── */
.tb-footer { background: #fff; border-top: 1px solid var(--line); margin-top: 40px; color: var(--text-3); }
.tb-footer .container { padding: 26px 12px; text-align: center; font-size: 12px; }
.tb-footer a { color: var(--text-2); margin: 0 8px; }
.tb-footer a:hover { color: var(--tb-primary); }
.tb-footer .tb-foot-note { margin-top: 8px; }

/* ── TOAST ────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(10px);
  background: rgba(30,30,30,.92); color: #fff; padding: 12px 22px; border-radius: var(--r-md);
  font-size: 14px; box-shadow: var(--shadow-3); opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; z-index: var(--z-toast);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================================
 * RWD 斷點：1200 / 992 / 768 / 480
 * ========================================================================== */
@media (max-width: 1200px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 992px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .tb-hero { grid-template-columns: 1fr; }
  .tb-hero-cats { display: none; }
  .member-shell { grid-template-columns: 160px 1fr; }
}
@media (max-width: 768px) {
  .tb-header .container { height: auto; padding: 10px 12px; flex-wrap: wrap; gap: 12px; }
  .tb-search { order: 3; flex-basis: 100%; max-width: none; }
  .tb-utilbar .tb-util-left { display: none; }
  .tb-nav-links { display: none; }
  .tb-allcats-btn { min-width: 150px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .member-shell { grid-template-columns: 1fr; }
  .member-side { position: static; }
  .member-side .ms-links-wrap { display: flex; overflow-x: auto; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .tb-hero-banner { min-height: 180px; padding: 24px; }
  .tb-hero-banner h1 { font-size: 22px; }
}
@media (max-width: 480px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .tb-logo .tb-brand-slogan { display: none; }
  .stat-row { grid-template-columns: 1fr 1fr; }
}
