/* ═══════════════════════════════════════════════════════════
   80s RETRO ARCADE THEME — 霓虹 / 8-bit / CRT
   設計語言：所有新增 UI 必須遵循此風格
   - 像素字體 Fusion Pixel（全站）
   - 霓虹色：洋紅 --accent / 青 --accent2 / 綠 --neon-green
   - 直角（全域 border-radius:0）、2px 粗框、硬陰影 4px 4px 0
   - CRT 掃描線覆蓋（body::after）+ 網格背景
   ═══════════════════════════════════════════════════════════ */
@font-face {
  font-family: 'Fusion Pixel';
  src: url('/static/fonts/fusion-pixel-12px-proportional-zh_hant.otf.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0d0221;
  --surface: #1a0b38;
  --surface2: #2a1458;
  --border: #4a2d7a;
  --text: #e8f4ff;
  --text-muted: #9d8fc7;
  --accent: #ff2bd6;        /* 霓虹洋紅 */
  --accent2: #00f0ff;       /* 霓虹青 */
  --neon-green: #2bff88;
  --neon-yellow: #ffe53d;
  --neon-red: #ff2244;
  --pixel-shadow: 4px 4px 0 rgba(0,0,0,.55);
}

* { box-sizing: border-box; }
*, *::before, *::after { border-radius: 0 !important; }

body {
  background:
    linear-gradient(rgba(255,43,214,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,240,255,.035) 1px, transparent 1px),
    var(--bg);
  background-size: 42px 42px, 42px 42px, auto;
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Fusion Pixel', 'DotGothic16', 'Hiragino Sans', 'Noto Sans JP', 'Yu Gothic', sans-serif;
  font-synthesis: none;
  min-height: 100vh;
}

/* CRT 掃描線 */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,.06) 0px, rgba(0,0,0,.06) 1px,
    transparent 1px, transparent 3px
  );
  pointer-events: none;
  z-index: 99999;
  opacity: 0.5;
}

::selection { background: var(--accent); color: #fff; }

/* ── Navbar ── */
.navbar {
  background: linear-gradient(90deg, #0d0f1e 0%, #1a1d2e 100%);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}
/* 頂部兜底：手機瀏覽器網址列動態收合時，navbar 上方可能短暫露縫。
   往上延伸一塊同色背景，讓任何縫都是 navbar 底色而非透出捲動內容。 */
.navbar::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: 100%;
  height: 200px;
  background: #0d0f1e;
  pointer-events: none;
}
body.theme-light .navbar::before { background: #ffffff; }
.navbar-brand {
  color: var(--text) !important;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: .03em;
}
.navbar-brand i { color: var(--accent); }
.sync-status { color: var(--text-muted); font-size: .82rem; }
.btn-outline-light { border-color: var(--border); color: var(--text-muted); }
.btn-outline-light:hover { background: var(--surface2); color: var(--text); border-color: var(--accent); }


/* ── Notification bell ── */
.notif-bell, button.notif-bell {
  position: relative;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background .2s;
  border: none;
  background: transparent;
  padding: 0;
  color: var(--text-muted);
}
.notif-bell:hover, button.notif-bell:hover { background: var(--surface2); }
.notif-bell i, button.notif-bell i { color: var(--text-muted); font-size: 1.1rem; }
.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  background: #E74C3C;
  color: #fff;
  border-radius: 99px;
  font-size: .65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  padding: 0 4px;
}

/* ── Notification drawer ── */
.notif-drawer {
  position: fixed;
  top: 0; right: -380px;
  width: 360px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 2000;
  transition: right .3s ease;
  display: flex;
  flex-direction: column;
}
.notif-drawer.open { right: 0; }
.notif-drawer-header {
  display: flex;
  align-items: center;
  padding: 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.notif-list { overflow-y: auto; flex: 1; }
.notif-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.notif-item:hover { background: var(--surface2); }
.notif-item.unread { border-left: 3px solid var(--accent); }
.notif-content { flex: 1; min-width: 0; }
.notif-item .notif-title { font-size: .9rem; font-weight: 600; }
.notif-item .notif-msg { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }
.notif-item .notif-time { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.notif-thumb {
  width: 58px; height: 58px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface2);
}

/* ── Tabs ── */
.nav-tabs { border-bottom-color: var(--border); }
.nav-tabs .nav-link {
  color: var(--text-muted);
  border: none;
  padding: 10px 20px;
  font-size: .9rem;
  border-radius: 0;
  border-bottom: 2px solid transparent;
}
.nav-tabs .nav-link:hover { color: var(--text); background: transparent; }
.nav-tabs .nav-link.active {
  background: transparent;
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Filter bar ── */
.filter-bar .form-select,
.filter-bar .form-control,
.filter-bar .input-group-text {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.filter-bar .form-control::placeholder { color: var(--text-muted); opacity: 1; }
.filter-bar .form-select:focus,
.filter-bar .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(124,131,245,.2);
  background: var(--surface);
  color: var(--text);
}

/* ── Filter type tag buttons ── */
.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
}
.filter-tag {
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
  line-height: 1.5;
}
.filter-tag:hover {
  border-color: var(--accent);
  color: var(--text);
}
.filter-tag.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Product sub-tabs (新品市場 / 中古市場) ── */
.product-sub-tabs {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}
.product-sub-tab {
  padding: 0.25rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1.5;
}
.product-sub-tab:hover {
  border-color: var(--accent);
  color: var(--text);
}
.product-sub-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── View toggle buttons ── */
.view-btn, .view-btn-used {
  width: 30px; height: 30px;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface2);
  border: 1px solid var(--accent2);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
  font-size: .85rem;
  opacity: .65;
}
.view-btn:hover, .view-btn-used:hover { background: var(--surface2); color: var(--text); opacity: 1; }
.view-btn.active, .view-btn-used.active { background: var(--accent); border-color: var(--accent); color: #fff; opacity: 1; }

/* ── Product grid ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
}
.product-grid.view-compact {
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}
.product-grid.view-standard {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
}
.product-grid.view-list {
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  z-index: 0;
  transition: transform .2s, border-color .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.product-card.is-new { border-color: var(--accent); }

.card-img-wrap {
  position: relative;
  aspect-ratio: 1;
  background: var(--surface2);
  overflow: hidden;
}
.card-img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.product-card:hover .card-img-wrap img { transform: scale(1.05); }
.card-img-placeholder {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 2.5rem;
}

.card-badge {
  position: absolute;
  top: 8px; left: 8px;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid rgba(255,255,255,.15);
}
.card-badge-new {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--accent);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
}
.card-lottery-badge {
  position: absolute;
  bottom: 8px; right: 8px;
  background: #F39C12;
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
}

.card-body {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card-title {
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-price {
  font-size: 1rem;
  font-weight: 700;
  color: #7DCEA0;
  margin-top: auto;
}
.card-date {
  font-size: .75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.date-short { display: none; }

.card-footer-strip {
  padding: 8px 12px;
  background: rgba(0,0,0,.2);
  display: flex;
  gap: 8px;
  align-items: center;
}
.card-footer-strip a {
  font-size: .78rem;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.card-footer-strip a:hover { color: var(--accent2); }

/* ── Compact card ── */
.compact-info { padding: 6px 8px 8px; }
.compact-title {
  font-size: .76rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.3;
}
.compact-price { font-size: .74rem; color: #7DCEA0; font-weight: 700; margin-top: 2px; }
.view-compact .card-badge { font-size: .6rem; padding: 1px 5px; }
.view-compact .card-lottery-badge { font-size: .6rem; padding: 2px 5px; }

/* ── List card ── */
.list-card {
  flex-direction: row !important;
  min-height: 96px;
  border-radius: 10px;
}
.list-thumb {
  position: relative;
  width: 128px;
  flex-shrink: 0;
  background: var(--surface2);
  border-radius: 10px 0 0 10px;
  overflow: hidden;
}
.list-thumb img { width: 100%; height: 100%; object-fit: cover; }
.list-thumb .card-img-placeholder { width: 100%; height: 100%; font-size: 1.8rem; }
.list-thumb .card-lottery-badge { bottom: 6px; right: 6px; }
.list-body {
  flex: 1; min-width: 0;
  padding: 12px 14px;
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
}
.list-title {
  font-size: .95rem; font-weight: 600; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.list-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.list-source { font-size: .8rem; font-weight: 600; }
.list-price { font-size: .92rem; font-weight: 700; color: #7DCEA0; }
.list-method {
  font-size: .75rem; color: var(--text-muted);
  background: var(--surface2); padding: 1px 7px; border-radius: 4px;
}
.list-date { font-size: .78rem; color: var(--text-muted); white-space: nowrap; }
.list-actions {
  flex-shrink: 0;
  padding: 12px 14px;
  display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 8px;
}
.list-buy-btn {
  font-size: .8rem; color: var(--accent); text-decoration: none;
  display: flex; align-items: center; gap: 4px; white-space: nowrap;
}
.list-buy-btn:hover { color: var(--accent2); }
/* NEW badge: 在 list-actions 裡用 static 排版，不絕對定位 */
.list-actions .card-badge-new {
  position: static;
  font-size: .6rem;
  padding: 1px 6px;
}

/* ── Calendar ── */

/* List view dark theme overrides */
.fc .fc-list-day-cushion,
.fc .fc-list-day .fc-cell-shaded {
  background: var(--surface2) !important;
}
.fc .fc-list-day-text,
.fc .fc-list-day-side-text {
  color: var(--accent) !important;
  text-decoration: none !important;
}
.fc .fc-list-event td {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
.fc .fc-list-event:hover td {
  background: rgba(124,131,245,.12) !important;
}
.fc .fc-list-event-title a {
  color: var(--text) !important;
  text-decoration: none;
}
.fc .fc-list-event-time {
  color: var(--text-muted) !important;
}

#calendar {
  background: var(--surface);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--border);
}
.fc .fc-daygrid-day-frame { min-height: 0 !important; }
.fc { color: var(--text) !important; }
.fc-theme-standard td, .fc-theme-standard th, .fc-theme-standard .fc-scrollgrid {
  border-color: var(--border) !important;
}
.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number { color: var(--text-muted) !important; text-decoration: none; }
.fc .fc-daygrid-day.fc-day-today { background: rgba(124,131,245,.08) !important; }
.fc .fc-button-primary {
  background: var(--surface2) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
.fc .fc-button-primary:hover { background: var(--accent) !important; border-color: var(--accent) !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active { background: var(--accent) !important; }
.fc .fc-toolbar-title { color: var(--text) !important; font-size: 1.1rem; }
.fc-event { border-radius: 4px !important; font-size: .75rem !important; cursor: pointer; }
.fc-event.cal-selected { outline: 2px solid #fff !important; outline-offset: 1px; filter: brightness(1.25); }
.fc-daygrid-event-dot { display: none; }

.calendar-legend {
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
  margin-bottom: 0.75rem !important;
  border-bottom: 1px solid var(--border);
}
.calendar-legend span { font-size: .82rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-toggle {
  cursor: pointer;
  border-radius: 6px;
  padding: 3px 8px 3px 4px;
  transition: opacity .2s, background .15s;
  user-select: none;
}
.legend-toggle:hover { background: var(--surface2); }
.legend-toggle.inactive { opacity: 0.3; }
.legend-toggle.inactive .legend-dot { filter: grayscale(1); }
.legend-divider { width: 1px; background: var(--border); align-self: stretch; margin: 0 4px; }
.calendar-fav-toggle {
  cursor: pointer;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: .82rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: opacity .2s, background .15s, border-color .15s, color .15s;
  user-select: none;
}
.calendar-fav-toggle:hover { background: var(--surface2); }
.calendar-fav-toggle.active {
  color: #E53935;
  border-color: #E53935;
  background: rgba(229, 57, 53, 0.12);
  font-weight: 600;
}

/* ── Modal ── */
.modal-content { border: 1px solid var(--border); }
.modal-header { border-bottom-color: var(--border); }
.modal-img-wrap { border-radius: 8px; overflow: hidden; background: var(--surface2); position: relative; }
.modal-img-placeholder { display:flex; align-items:center; justify-content:center; height:200px; }
.modal-product-img { width: 100%; max-height: 500px; object-fit: contain; display: block; }

/* 商品詳細燈箱：比 modal-lg(800px) 大 30% */
#productModal .modal-dialog { max-width: min(1040px, 95vw); }

/* ── Gallery carousel ── */
.modal-carousel-img { width:100%; max-height:500px; object-fit:contain; display:block; background:var(--surface2); }
.carousel-control-prev, .carousel-control-next { width: 36px; background: rgba(0,0,0,.45); border-radius: 4px; }
.modal-gallery-thumbs {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  overflow-x: auto;
  background: rgba(0,0,0,.25);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.modal-gallery-thumbs::-webkit-scrollbar { height: 4px; }
.modal-gallery-thumbs::-webkit-scrollbar-track { background: transparent; }
.modal-gallery-thumbs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.gallery-thumb {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  opacity: 0.55;
  flex-shrink: 0;
  transition: opacity .15s, border-color .15s;
}
.gallery-thumb:hover { opacity: .85; }
.gallery-thumb.active { opacity: 1; border-color: var(--accent); }

.modal-label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.modal-value { font-size: .95rem; }

/* ── Spec section ── */
.spec-section { border-top: 1px solid var(--border); padding-top: .75rem; }
.spec-loading  { min-height: 24px; }
.spec-table    { width: 100%; border-collapse: collapse; font-size: .83rem; }
.spec-table tr { border-bottom: 1px solid var(--border); }
.spec-table tr:last-child { border-bottom: none; }
.spec-table td { padding: 5px 8px; vertical-align: top; line-height: 1.4; }
.spec-table td.spec-label {
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 90px;
  max-width: 130px;
  font-weight: 500;
}
.spec-table td.spec-value { word-break: break-word; }

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 12px 16px;
  min-width: 280px;
  max-width: 360px;
  pointer-events: all;
  animation: slideIn .3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
}
.toast-item.lottery { border-left-color: #F39C12; }
.toast-title { font-size: .88rem; font-weight: 700; margin-bottom: 2px; }
.toast-msg { font-size: .8rem; color: var(--text-muted); }
@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes fadeOut {
  to { opacity: 0; transform: translateX(120%); }
}

/* ── Calendar event popup ── */
.cal-popup {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 12px 36px 12px 14px;
  min-width: 260px;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn .3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
  position: relative;
  pointer-events: all;   /* 父層 .toast-container 是 pointer-events:none */
}
.cal-popup-info { flex: 1; min-width: 0; }
.cal-popup-type { font-size: .7rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.cal-popup-title { font-size: .88rem; font-weight: 700; line-height: 1.35; margin-bottom: 3px; }
.cal-popup-src { font-size: .78rem; color: var(--text-muted); }
.cal-popup-link { display: inline-block; margin-top: 5px; font-size: .75rem; color: var(--accent); text-decoration: none; }
.cal-popup-link:hover { color: var(--accent2); }
.cal-popup-img { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--surface2); }
.cal-popup-close { position: absolute; top: 6px; right: 10px; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0; }
.cal-popup-close:hover { color: var(--text); }
.cal-popup.clickable { cursor: pointer; }
.cal-popup.clickable:hover { border-left-color: var(--accent2); box-shadow: 0 6px 24px rgba(0,0,0,.6); }

/* ── Responsive ── */
@media (max-width: 576px) {
  .product-grid                { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .product-grid.view-compact   { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .product-grid.view-list      { grid-template-columns: repeat(1, 1fr); gap: 8px; }
  .view-compact .product-card  { font-size: .78rem; }
  .view-compact .card-title    { font-size: .72rem; -webkit-line-clamp: 2; }
  .view-compact .card-price    { font-size: .7rem; }
  .view-compact .card-badge    { font-size: .55rem; padding: 1px 4px; }
  .notif-drawer { width: 100%; right: -100%; }
}

/* ── Favourite (heart) button ── */
.fav-btn {
  position: absolute;
  bottom: 8px;
  left: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: rgba(160, 152, 190, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: transform .15s, color .15s;
  z-index: 3;
  padding: 0;
}
.fav-btn:hover { transform: scale(1.15); color: rgba(220, 210, 240, 0.95); }
.fav-btn.active { color: #E74C3C; }
.fav-btn.active:hover { color: #ff6b6b; }

/* List-view heart: inline, not absolute */
.list-actions .fav-btn {
  position: static;
  width: 34px;
  height: 34px;
  font-size: .9rem;
  border-radius: 8px;
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text-muted);
}
.list-actions .fav-btn:hover { color: #fff; background: var(--surface); }
.list-actions .fav-btn.active { color: #E74C3C; }

/* ── Stock-watch (bell) button — mirrors .fav-btn, sits on the right ── */
.watch-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: rgba(160, 152, 190, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: transform .15s, color .15s;
  z-index: 3;
  padding: 0;
}
.watch-btn:hover { transform: scale(1.15); color: rgba(220, 210, 240, 0.95); }
.watch-btn.active { color: #e08a1e; }
.watch-btn.active:hover { color: #f0932b; }

/* List-view bell: inline, not absolute */
.list-actions .watch-btn {
  position: static;
  width: 34px;
  height: 34px;
  font-size: .9rem;
  border-radius: 8px;
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text-muted);
}
.list-actions .watch-btn:hover { color: #fff; background: var(--surface); }
.list-actions .watch-btn.active { color: #e08a1e; }

/* ── Shopee 上架標記按鈕（管理員限定）── mirrors .fav-btn/.watch-btn, sits top-center */
.shopee-listed-btn {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: rgba(160, 152, 190, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  transition: transform .15s, color .15s;
  z-index: 3;
  padding: 0;
}
.shopee-listed-btn:hover { transform: translateX(-50%) scale(1.15); color: rgba(220, 210, 240, 0.95); }
.shopee-listed-btn.active { color: #ee4d2d; }
.shopee-listed-btn.active:hover { color: #ff6b4d; }

/* List-view shopee marker: inline, not absolute */
.list-actions .shopee-listed-btn {
  position: static;
  transform: none;
  width: 34px;
  height: 34px;
  font-size: .85rem;
  border-radius: 8px;
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text-muted);
}
.list-actions .shopee-listed-btn:hover { transform: none; color: #fff; background: var(--surface); }
.list-actions .shopee-listed-btn.active { color: #ee4d2d; }

/* ── Watchlist tab badge ── */
.fav-tab-badge {
  display: inline-block;
  background: #E74C3C;
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1.4;
}

/* ── 關注清單卡片：重量輸入（standard / compact 底部橫條） ── */
.card-weight-strip {
  display: flex;
  align-items: center;
  gap: .32rem;
  padding: .32rem .7rem .45rem;
  border-top: 1px solid var(--border);
  font-size: .73rem;
  color: var(--text-muted);
}
/* list-card 版：放入 list-actions 右欄 */
.list-weight-row {
  display: flex;
  align-items: center;
  gap: .28rem;
  font-size: .73rem;
  color: var(--text-muted);
  margin-top: auto;
}
.weight-input {
  width: 52px !important;
  background: var(--bg) !important;
  border: 1px solid #3d4170 !important;
  border-radius: 5px !important;
  color: var(--text) !important;
  text-align: center;
  font-size: .76rem !important;
  padding: 2px 3px !important;
  -moz-appearance: textfield;
}
.weight-input::-webkit-outer-spin-button,
.weight-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.weight-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px rgba(124,131,245,.2) !important;
  outline: none;
}
.weight-unit { flex-shrink: 0; }
.weight-reset {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .72rem;
  padding: 0 3px;
  line-height: 1.5;
  opacity: .55;
  margin-left: auto;
  transition: color .12s, opacity .12s;
}
.weight-reset:hover  { color: #f06f6f; opacity: 1; }
.weight-reset.hidden { display: none !important; }
/* compact 模式稍縮 */
.view-compact .card-weight-strip { padding: .25rem .5rem .35rem; gap: .24rem; font-size: .68rem; }
.view-compact .weight-input { width: 44px !important; font-size: .7rem !important; }

/* ── 數量選擇器 ── */
.card-qty-strip {
  display: flex;
  align-items: center;
  gap: .32rem;
  padding: .32rem .7rem .4rem;
  border-top: 1px solid var(--border);
  font-size: .73rem;
  color: var(--text-muted);
}
.list-qty-row {
  display: flex;
  align-items: center;
  gap: .28rem;
  font-size: .73rem;
  color: var(--text-muted);
}
.qty-label { flex-shrink: 0; }
.qty-btn {
  width: 22px; height: 22px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: .8rem;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
  flex-shrink: 0;
}
.qty-btn:hover:not(:disabled) { background: var(--accent); color: #fff; border-color: var(--accent); }
.qty-btn:disabled { opacity: .3; cursor: default; }
.qty-value {
  min-width: 22px;
  text-align: center;
  font-weight: 700;
  color: var(--accent2);
  font-size: .82rem;
}
.view-compact .card-qty-strip { padding: .22rem .5rem .3rem; gap: .22rem; font-size: .68rem; }
.view-compact .qty-btn { width: 18px; height: 18px; font-size: .7rem; }

/* 費用面板數量徽章 */
.qty-badge {
  display: inline-block;
  margin-left: .25rem;
  padding: 0 .28rem;
  background: var(--accent);
  color: #fff;
  font-size: .65rem;
  vertical-align: middle;
}
body.theme-light .card-qty-strip { border-color: var(--border); color: var(--text-muted); }
body.theme-light .qty-btn { background: #f0eaff; border-color: #c9b8f0; }
body.theme-light .qty-value { color: var(--accent2); }

/* ── Watchlist empty state icon fix ── */
#watchlistEmpty > i.fa-heart { display: block; margin: 0 auto 12px; }
#watchlistEmpty p i.fa-heart { display: inline; margin: 0; vertical-align: middle; }

/* ── Watchlist 左右排版 ── */
.watchlist-body {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}
.watchlist-grid-col {
  flex: 1;
  min-width: 0;      /* 防止 flex child 撐破容器 */
}
.watchlist-cost-col {
  width: 400px;
  flex-shrink: 0;
  position: sticky;
  top: 76px;         /* navbar 高度下方 */
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
/* 小螢幕（< 1100px）改回上下排列 */
@media (max-width: 1099px) {
  .watchlist-body { flex-direction: column; }
  .watchlist-cost-col { width: 100%; position: static; max-height: none; }
  /* 列表檢視：視窗縮小時 3 欄 → 2 欄 */
  .product-grid.view-list { grid-template-columns: repeat(2, 1fr); }
}

/* ── Watchlist export bar ── */
.export-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px;
}
.export-buyer-input {
  background: var(--surface2) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
  border-radius: 8px !important;
  width: 160px !important;
}
.export-buyer-input::placeholder { color: var(--text-muted) !important; }
.export-buyer-input:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 2px rgba(124,131,245,.25) !important; }
.export-btn {
  background: linear-gradient(135deg, #27AE60, #1e8449);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity .15s, transform .1s;
}
.export-btn:hover { opacity: .9; transform: translateY(-1px); color: #fff; }
.export-btn:active { transform: translateY(0); }

/* ══════════════════════════════════════════
   費用試算面板 (Cost Panel)
   ══════════════════════════════════════════ */
.cost-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.4rem;
}

.cost-panel-header {
  display: flex;
  align-items: center;
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: .85rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: .5rem;
}
/* Bootstrap 的 .text-muted 預設 #6c757d，在深色背景上幾乎不可見，全域覆蓋 */
.text-muted { color: var(--text-muted) !important; }

.rate-input {
  width: 76px !important;
  background: var(--bg) !important;
  border-color: #3d4170 !important;
  color: var(--text) !important;
  text-align: center;
  font-size: .85rem !important;
  padding: 3px 6px !important;
}
.rate-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px rgba(124,131,245,.25) !important;
}
.btn-rate-refresh {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  padding: 3px 8px;
  font-size: .73rem;
  cursor: pointer;
  line-height: 1.6;
  transition: color .15s, border-color .15s;
}
.btn-rate-refresh:hover  { color: var(--accent); border-color: var(--accent); }
.btn-rate-refresh:active { opacity: .7; }
.rate-source-note { font-size: .7rem; white-space: nowrap; }
.rate-source-note .rate-ok  { color: #6fcf97; }
.rate-source-note .rate-err { color: #f06f6f; }

/* sections */
.cost-section {
  margin-bottom: .6rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid #1f2240;
}
.cost-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.cost-section-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: .45rem;
}

/* rows */
.cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .22rem 0;
  font-size: .84rem;
  color: #c0c4e0;
  gap: .5rem;
}
.cost-row-name { flex: 1; min-width: 0; }
.cost-site-link {
  color: var(--accent2);
  text-decoration: none;
  border-bottom: 1px solid rgba(0,240,255,.35);
  transition: color .15s, border-color .15s;
}
.cost-site-link:hover { color: #fff; border-color: var(--accent2); }
.cost-row-jpy {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.cost-row-jpy em {
  font-style: normal;
  color: var(--accent);
  font-size: .78rem;
  margin-left: .45rem;
}
.cost-free { color: #6fcf97 !important; }

.cost-row.cost-subtotal {
  font-weight: 700;
  color: var(--text);
  border-top: 1px dashed #2c3050;
  margin-top: .3rem;
  padding-top: .4rem;
}

/* badges */
.badge-free {
  background: #1b4332;
  color: #6fcf97;
  border: 1px solid #2d6a4f;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: .7rem;
  font-weight: 700;
  margin-left: .4rem;
  white-space: nowrap;
}
.badge-nofree {
  background: #3d2b1f;
  color: #f0a070;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: .7rem;
  margin-left: .4rem;
}
.badge-fixed {
  background: #1e2240;
  color: var(--text-muted);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: .7rem;
  margin-left: .4rem;
}
.cost-min-note {
  color: var(--text-muted);
  font-size: .78rem;
  margin-left: .3rem;
}

/* total row */
.cost-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #23264a, #1a1d2e);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: .7rem 1.1rem;
  margin-top: 1rem;
  font-weight: 700;
}
.cost-total-row span:first-child {
  color: var(--text-muted);
  font-size: .88rem;
}
#costTotal {
  color: var(--accent);
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
#costTotal.cost-total-profit { color: #6fcf97; }
.cost-total-row.cost-total-profit { border-color: #6fcf97; }

/* note */
.cost-note {
  margin-top: .75rem;
  font-size: .73rem;
  color: #505570;
  line-height: 1.6;
}

.badge-min-fee {
  background: #4a2e00;
  color: #f5c842;
  border: 1px solid #7a5000;
  border-radius: 4px;
  padding: 1px 7px;
  font-size: .7rem;
  font-weight: 700;
  margin-left: .35rem;
  white-space: nowrap;
}
.badge-customs-free {
  background: #1b4332;
  color: #6fcf97;
  border: 1px solid #2d6a4f;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: .7rem;
  font-weight: 700;
  margin-left: .4rem;
  white-space: nowrap;
}
.badge-customs-due {
  background: #3d1a1a;
  color: #f06f6f;
  border: 1px solid #6b2e2e;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: .7rem;
  font-weight: 700;
  margin-left: .4rem;
  white-space: nowrap;
}

/* inline markup rate override input */
.cost-markup-wrap {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  margin-right: .3rem;
}
.cost-markup-input {
  width: 3.4rem;
  padding: .15rem .35rem;
  background: #1a1d35;
  border: 1px solid #3a3f6a;
  border-radius: 5px;
  color: var(--accent2);
  font-size: .84rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  -moz-appearance: textfield;
}
.cost-markup-input::-webkit-inner-spin-button,
.cost-markup-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.cost-markup-input:focus {
  outline: none;
  border-color: var(--accent2);
}
.cost-markup-pct {
  font-size: .82rem;
  color: var(--accent2);
  font-weight: 600;
}
.cost-markup-reset {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: .1rem .25rem;
  font-size: .72rem;
  border-radius: 4px;
  transition: color .15s;
}
.cost-markup-reset:hover { color: #f0a070; }

/* 利潤率輸入超出 1–99% 合法範圍時的警示樣式 */
.cost-markup-input-warn { border-color: #e0524a !important; color: #ff8a80 !important; }
.cost-markup-warn-note {
  font-size: .72rem;
  color: #ff8a80;
  margin-top: .2rem;
}

/* inline packing weight/cost inputs */
.cost-packing-wrap {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.cost-packing-input {
  width: 4.2rem;
  padding: .15rem .35rem;
  background: #1a1d35;
  border: 1px solid #3a3f6a;
  border-radius: 5px;
  color: var(--text);
  font-size: .84rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  -moz-appearance: textfield;
}
.cost-packing-input::-webkit-inner-spin-button,
.cost-packing-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.cost-packing-input:focus {
  outline: none;
  border-color: var(--accent);
}
.cost-packing-unit {
  font-size: .78rem;
  color: var(--text-muted);
}
body.theme-light .cost-packing-input {
  background: var(--surface);
  border-color: var(--border);
}
.cost-packing-select {
  margin-left: .5rem;
  padding: .1rem .3rem;
  background: #1a1d35;
  border: 1px solid #3a3f6a;
  border-radius: 5px;
  color: var(--text);
  font-size: .78rem;
  cursor: pointer;
}
.cost-packing-select:focus { outline: none; border-color: var(--accent); }
body.theme-light .cost-packing-select { background: var(--surface); border-color: var(--border); }

/* ── 詢價單進度時間軸（買家視角）── */
.quote-timeline {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 2px 0;
}
.qt-step {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.qt-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .62rem;
  background: var(--surface);
  border: 1px solid var(--border);
}
.qt-step.done { color: var(--text); }
.qt-step.done .qt-dot { background: var(--accent); color: #fff; border-color: var(--accent); }
.qt-step.next .qt-dot { border-color: var(--accent); color: var(--accent); }
.qt-line { flex: 0 0 16px; height: 2px; background: var(--border); }
.qt-line.done { background: var(--accent); }

/* ── 導覽列訪客計數器（所有人可見）── */
.visitor-counter {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-left: .9rem;
  padding: .2rem .6rem;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px;
  font-size: .72rem;
  color: rgba(255,255,255,.85);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.visitor-counter .vc-sep { opacity: .45; margin: 0 .1rem; }
body.theme-light .visitor-counter {
  background: rgba(0,0,0,.06);
  border-color: var(--border);
  color: var(--text-muted);
}
@media (max-width: 768px) {
  .visitor-counter .vc-item-total { display: none; }  /* 窄螢幕隱藏「累計」 */
  .visitor-counter { margin-left: .4rem; font-size: .66rem; padding: .15rem .45rem; }
}

/* ── 網站流量統計（後台管理）── */
.visitor-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .9rem 1rem;
  text-align: center;
}
.visitor-stat-num {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.visitor-stat-label { font-size: .78rem; color: var(--text-muted); margin-top: .15rem; }
.visitor-online-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #6fcf97;
  margin-right: .3rem;
  animation: visitorPulse 2s infinite;
}
@keyframes visitorPulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.visitor-daily {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: .5rem .25rem 0;
  overflow-x: auto;
}
.visitor-day { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 34px; }
.visitor-bar { width: 22px; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 4px; }
.visitor-day-label { font-size: .62rem; color: var(--text-muted); white-space: nowrap; }

/* shipping mode toggle */
.wl-ship-toggle {
  display: flex;
  gap: .4rem;
  margin-bottom: .9rem;
}
.wl-ship-btn {
  flex: 1;
  padding: .32rem .6rem;
  font-size: .78rem;
  font-weight: 600;
  border: 1px solid #2c3050;
  border-radius: 6px;
  background: #141628;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.wl-ship-btn:hover {
  background: #1e2240;
  color: var(--text);
}
.wl-ship-btn.active {
  background: linear-gradient(135deg, #1a2060, #0d1535);
  border-color: var(--accent);
  color: var(--accent);
}

/* cost row sub-line and EZway note */
.cost-row-sub {
  font-size: .78rem;
  color: var(--text-muted);
}
.cost-muted {
  color: var(--text-muted);
  font-style: italic;
}
.cost-ezway-note {
  font-size: .74rem;
  color: #f5c842;
  display: block;
  margin-top: .2rem;
}

/* quote summary section */
.cost-quote-summary {
  margin-top: .8rem;
  padding: .65rem .85rem;
  background: linear-gradient(135deg, #151830, #0e1120);
  border: 1px solid #2a2f5a;
  border-radius: 8px;
}
.cost-quote-summary-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: .45rem;
}
.cost-quote-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .84rem;
  color: #c0c4e0;
  padding: .18rem 0;
}
.cost-quote-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}
.cost-quote-note {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: .35rem;
  line-height: 1.5;
}

/* ── Multi-set combo pricing section ── */
.combo-section .cost-section-label { display: flex; align-items: center; }
.combo-toggle-label {
  display: flex;
  align-items: center;
  gap: .3rem;
  cursor: pointer;
  font-size: .75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  margin-left: auto;
}
.combo-toggle-label input[type=checkbox] {
  accent-color: var(--accent);
  width: 13px;
  height: 13px;
  cursor: pointer;
}
.combo-settings {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .35rem .5rem;
  margin-bottom: .5rem;
}
.combo-label {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  font-size: .68rem;
  color: var(--text-muted);
  cursor: default;
}
.combo-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: .78rem;
  padding: 2px 4px;
  text-align: center;
  -moz-appearance: textfield;
}
.combo-input::-webkit-inner-spin-button,
.combo-input::-webkit-outer-spin-button { opacity: .5; }
.combo-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(124,131,245,.2);
}
.combo-table-wrap {
  overflow-x: auto;
  max-height: 200px;
  overflow-y: auto;
  border-radius: 6px;
  border: 1px solid #1f2240;
  margin-top: .25rem;
  scrollbar-width: thin;
}
.combo-table {
  width: 100%;
  font-size: .78rem;
  border-collapse: collapse;
}
.combo-table thead tr {
  background: #151830;
  position: sticky;
  top: 0;
  z-index: 1;
}
.combo-table th {
  padding: .25rem .4rem;
  text-align: center;
  color: var(--text-muted);
  font-weight: 600;
  font-size: .68rem;
  letter-spacing: .03em;
  border-bottom: 1px solid #2a2f5a;
}
.combo-table td {
  padding: .2rem .4rem;
  text-align: center;
  color: #c0c4e0;
  border-bottom: 1px solid #1a1e35;
  font-variant-numeric: tabular-nums;
}
.combo-table tbody tr:last-child td { border-bottom: none; }
.combo-table tbody tr:hover td { background: #1a1e35; }
.combo-row-base td { color: var(--text); font-weight: 600; }
.combo-td-disc { color: #6fcf97 !important; }
.combo-row-base .combo-td-disc { color: var(--text-muted) !important; font-weight: 400; }
.combo-td-price { color: var(--text) !important; font-weight: 600; }
.combo-td-total { color: var(--text-muted) !important; font-size: .73rem; }
.combo-td-profit-pos { color: #6fcf97 !important; font-weight: 600; }
.combo-td-profit-neg { color: #f06f6f !important; font-weight: 600; }
body.theme-light .combo-table-wrap { border-color: var(--border); }
body.theme-light .combo-table thead tr { background: var(--surface); }
body.theme-light .combo-table th { border-bottom-color: var(--border); }
body.theme-light .combo-table td { border-bottom-color: var(--border); color: var(--text); }
body.theme-light .combo-table tbody tr:hover td { background: rgba(0,0,0,.04); }
body.theme-light .combo-td-disc { color: #27ae60 !important; }
body.theme-light .combo-row-base .combo-td-disc { color: var(--text-muted) !important; }
body.theme-light .combo-td-profit-pos { color: #27ae60 !important; }
body.theme-light .combo-td-profit-neg { color: #e74c3c !important; }

/* ── Sticky top bars (tabs / sub-tabs / filter) ── */
#mainTabs {
  position: sticky;
  z-index: 200;
  background: var(--bg);
  /* 自然位置 = sticky 定位點（navH−1），捲動時完全不位移 */
  margin-top: -1px;
  padding-top: .8rem;
  margin-bottom: 0 !important;
  /* subtle bottom shadow so stacked bars look layered */
  box-shadow: 0 2px 8px rgba(0,0,0,.45);
}
/* 補縫層：Windows 縮放下 sticky 定位有次像素誤差，
   在每層 sticky bar 上緣鋪 3px 同色背景，防止捲動內容從縫隙透出 */
#mainTabs::before,
.product-sub-tabs::before,
.filter-bar::before,
.calendar-legend::before,
#tab-watchlist .export-bar::before {
  content: '';
  position: absolute;
  top: -3px; left: 0; right: 0;
  height: 3px;
  background: var(--bg);
  pointer-events: none;
}

/* 行事曆圖例列＋關注清單工具列：固定在主分頁選單下方（與商品頁子選單同層） */
.calendar-legend,
#tab-watchlist .export-bar {
  position: sticky;
  z-index: 199;
  background: var(--bg);
  margin-top: -1px;   /* 靜止位置＝sticky 定位點，捲動零位移 */
  margin-bottom: 0 !important;
  padding-top: .6rem;
  padding-bottom: .6rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
body.theme-light .calendar-legend,
body.theme-light #tab-watchlist .export-bar {
  box-shadow: none;
  border-bottom: 1px solid var(--border);
}

/* 各分頁內容與固定選單保持安全距離 */
#tab-quotes, #tab-orders, #tab-messages, #tab-account, #tab-admin { padding-top: 1.1rem; }
#calendar { margin-top: 1rem; }
#tab-watchlist .watchlist-body { margin-top: 1rem; }
.product-sub-tabs {
  position: sticky;
  z-index: 199;
  background: var(--bg);
  margin-top: -1px;   /* 抵銷 sticky 上緣 1px 重疊，靜止位置＝定位點 */
  margin-bottom: 0 !important;
  padding-top: 0.6rem !important;
  padding-bottom: 0.6rem !important;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.filter-bar {
  position: sticky;
  z-index: 198;
  background: var(--bg);
  margin-top: -1px;   /* 抵銷 sticky 上緣 1px 重疊，靜止位置＝定位點 */
  margin-bottom: 0 !important;
  padding-top: 0.55rem !important;
  padding-bottom: 0.65rem !important;
  border-bottom: 1px solid var(--border);
}
/* Space between filter bar and product grid */
.filter-bar + * { margin-top: 1rem; }
#productGrid,
#usedGrid { padding-top: 0.25rem; }
/* 手機搜尋鈕（開啟底部篩選抽屜）：桌面隱藏，手機規則見 RWD 區塊 */
#btnMobileSearch { display: none; }
/* 懸浮篩選鈕：桌面預設隱藏，必須排在 @media(max-width:768px) 規則「之前」
   才能讓後面的 mobile display:flex 依 source order 勝出（兩者 specificity 相同）*/
#fabFilter { display: none; }
/* 放大鏡就地搜尋：桌面永不顯示，手機規則見 RWD 區塊 */
#mobileInlineSearch { display: none; }
/* Light theme overrides */
body.theme-light #mainTabs,
body.theme-light .product-sub-tabs,
body.theme-light .filter-bar { background: var(--bg); }
body.theme-light #mainTabs { box-shadow: none; border-bottom: 1px solid var(--border); }
body.theme-light .product-sub-tabs { box-shadow: none; border-bottom: 1px solid var(--border); }
body.theme-light .filter-bar { box-shadow: none; }

/* ── Modal lottery banner ── */
.modal-lottery-banner {
  display: flex; align-items: center; flex-wrap: wrap; gap: .4rem;
  margin-bottom: .9rem; padding: .6rem 1rem;
  background: linear-gradient(135deg, #3d2200, #1e1200);
  border: 1px solid #F39C12;
  border-radius: 8px;
  color: #F39C12;
  font-weight: 700;
}
.modal-lottery-title { font-size: .95rem; }
.modal-lottery-sub { font-size: .75rem; color: #c8860d; font-weight: 400; }

/* card-lottery-badge inside modal img-wrap (reuse existing badge class, just ensure it shows) */
.modal-img-wrap .card-lottery-badge { position: absolute; bottom: 10px; right: 10px; font-size: .78rem; }

/* ── Auth overlay ── */
.auth-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(10,12,22,.92);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 12px 48px rgba(0,0,0,.5);
}
.auth-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1.5rem;
  text-align: center;
  letter-spacing: .02em;
}
.auth-logo i { margin-right: .5rem; }
.auth-title { color: var(--text); font-size: 1.1rem; font-weight: 600; margin-bottom: 1.25rem; text-align: center; }
.auth-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: .55rem .85rem;
  margin-bottom: .75rem;
  font-size: .92rem;
  outline: none;
  transition: border-color .15s;
}
.auth-input:focus { border-color: var(--accent); }
.auth-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .6rem 1rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
  margin-top: .25rem;
  text-decoration: none;
}
.auth-btn:hover { opacity: .88; }
.auth-error {
  color: #f06f6f;
  font-size: .82rem;
  min-height: 1.2em;
  margin-bottom: .4rem;
  text-align: center;
}
.auth-switch { font-size: .82rem; color: var(--text-muted); text-align: center; margin-top: .9rem; margin-bottom: 0; }
.auth-switch a { color: var(--accent); text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* Navbar user badge */
.user-badge {
  display: flex;
  align-items: center;
  font-size: .82rem;
  color: var(--text-muted);
  gap: .15rem;
}
.user-badge #usernameDisplay { color: var(--text); font-weight: 600; }

/* Proxy price colour on cards */
.proxy-price { color: #7DCEA0 !important; }

/* ── Admin panel ── */
.admin-panel {
  max-width: 100%;
  margin: 0;
  padding: 0;
}
.admin-section { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.25rem 1.5rem; }
.admin-section-title { font-size: .9rem; font-weight: 700; color: var(--text); margin-bottom: 1rem; }
.admin-section .form-control,
.admin-section .form-select,
.admin-section .input-group-text {
  background-color: var(--surface2) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
.admin-section .form-select option {
  background-color: var(--surface) !important;
  color: var(--text) !important;
}
.admin-section .form-control::placeholder { color: var(--text-muted); opacity: 1; }
.admin-section .form-label { color: var(--text-muted); }
.publish-url-box { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; }

/* ── Shipping method cards ── */
.ship-method-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.4rem;
  transition: border-color .2s;
  color: var(--text);
}
.ship-method-card.ship-method-enabled { border-color: rgba(43,255,136,.25); }
.ship-method-icon { font-size: 1.4rem; color: var(--text-muted); flex-shrink: 0; }
.ship-method-sub { font-size: .75rem; color: var(--text-muted); }
.ship-method-desc { font-size: .82rem; color: var(--text-muted); margin-bottom: .75rem; }
.ship-method-note { font-size: .78rem; color: var(--text-muted); background: var(--surface); border-radius: 6px; padding: .4rem .7rem; }
.ship-method-card details summary { font-size: .8rem; color: var(--text-muted); cursor: pointer; }
/* Override Bootstrap table CSS variables so cells don't inherit Bootstrap's black */
.ship-method-card .table {
  --bs-table-color: var(--text);
  --bs-table-color-state: var(--text);
  --bs-table-color-type: var(--text);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--border);
  color: var(--text);
  font-size: .82rem;
}
.ship-method-card .table th {
  --bs-table-color: var(--text2);
  color: var(--text2) !important;
  background-color: var(--surface) !important;
  border-color: var(--border) !important;
  font-weight: 600;
}
.ship-method-card .table td {
  color: var(--text);
  border-color: var(--border);
}
.ship-method-card .form-control,
.ship-method-card .input-group-text {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  font-size: .82rem;
}
.ship-method-card .form-control::placeholder { color: var(--text-muted); opacity: 1; }
.ship-method-card .form-control:focus {
  background: var(--surface);
  color: var(--text);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0,240,255,.15);
}
.ship-method-card label,
.ship-method-card .fw-semibold { color: var(--text); }

.admin-user-table { border-collapse: collapse; font-size: .82rem; }
.admin-user-table th {
  background: var(--surface2);
  color: var(--text-muted);
  font-weight: 600;
  padding: .5rem .75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.admin-user-table td { padding: .55rem .75rem; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.pending-row { background: rgba(243,156,18,.04); }
.btn-xs { padding: .2rem .5rem; font-size: .75rem; }
.admin-note-input { background: var(--surface2) !important; border-color: var(--border) !important; color: var(--text) !important; font-size: .75rem; }

/* 買家管理：操作按鈕固定一排、欄寬縮到內容寬度 */
.admin-user-table td.admin-action-cell {
  flex-wrap: nowrap;
  white-space: nowrap;
}

/* ── AI Bot Analytics Dashboard ── */
.bot-stat-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 0 !important;
  padding: .9rem 1rem;
  text-align: center;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.bot-stat-title {
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: .4rem;
  line-height: 1.25;
}
.bot-stat-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.bot-panel-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 0 !important;
  padding: 1.1rem 1.25rem;
  height: 100%;
}

.bot-table {
  --bs-table-bg: transparent !important;
  --bs-table-accent-bg: transparent !important;
  --bs-table-striped-bg: transparent !important;
  --bs-table-hover-bg: transparent !important;
  --bs-table-color: var(--text) !important;
  --bs-table-border-color: var(--border) !important;
  background-color: transparent !important;
  color: var(--text) !important;
  font-size: .82rem;
  margin-bottom: 0;
}
.bot-table th {
  background: var(--surface) !important;
  background-color: var(--surface) !important;
  color: var(--text-muted) !important;
  border-bottom: 1px solid var(--border) !important;
  font-weight: 600;
  border-radius: 0 !important;
}
.bot-table tr,
.bot-table td {
  background: transparent !important;
  background-color: transparent !important;
  border-bottom: 1px solid var(--border) !important;
  color: var(--text) !important;
  vertical-align: middle;
}

.admin-user-table th:last-child { width: 1%; white-space: nowrap; }

/* ── Drag & Drop Admin Widgets ── */
.admin-widget {
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.admin-drag-handle {
  display: flex;
  align-items: center;
  cursor: grab;
  user-select: none;
  padding-bottom: .4rem;
  border-bottom: 1px dashed rgba(255,255,255,0.1);
  margin-bottom: 1rem;
}
.admin-drag-handle:active {
  cursor: grabbing;
}
.admin-drag-handle .admin-section-title {
  margin-bottom: 0 !important;
}
.admin-widget.dragging-widget {
  opacity: 0.4;
  transform: scale(0.98);
}
.admin-widget.drag-over-widget .admin-section {
  border: 2px dashed var(--accent) !important;
  box-shadow: 0 0 15px rgba(0,240,255,0.3);
}

/* ── Tab badges (orders, messages) ── */
.tab-badge {
  display: inline-block;
  background: #E74C3C;
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1.4;
}

/* ── Dark inputs (shared) ── */
.dark-input {
  background: var(--surface2) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
  caret-color: var(--text);
  color-scheme: dark;
}
.dark-input:focus {
  background: var(--surface2) !important;
  border-color: var(--accent) !important;
  color: var(--text) !important;
  box-shadow: 0 0 0 2px rgba(124,131,245,.2) !important;
}
.dark-input::placeholder { color: var(--text-muted) !important; opacity: 1; }
.dark-select {
  background: var(--surface2) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

/* ── Order cards ── */
.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color .15s;
  margin-left: auto;
  margin-right: auto;
}
.order-card:hover { border-color: var(--accent); }
.order-card-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .75rem 1rem;
  flex-wrap: wrap;
}
.order-id { font-weight: 700; font-size: .88rem; color: var(--accent); min-width: 52px; }
.order-buyer { font-size: .82rem; color: var(--text-muted); }
.order-date { font-size: .78rem; color: var(--text-muted); }
.order-total { font-weight: 700; font-size: .9rem; color: #7DCEA0; }
.order-preview {
  padding: 0 1rem .55rem;
  font-size: .8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.order-detail {
  border-top: 1px solid var(--border);
  padding: 1rem;
  background: rgba(0,0,0,.2);
}
.order-items-wrap { overflow-x: auto; }
.order-items-table { border-collapse: collapse; font-size: .82rem; min-width: 300px; }
.order-items-table th {
  background: var(--surface2);
  color: var(--text-muted);
  font-weight: 600;
  padding: .4rem .6rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.order-items-table td { padding: .4rem .6rem; border-bottom: 1px solid var(--border); color: var(--text); }
.order-total-row { font-weight: 700; background: rgba(124,131,245,.06); }
.order-item-thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; flex-shrink: 0; border: 1px solid var(--border); }
.order-item-thumb-ph { display: inline-block; width: 96px; height: 96px; flex-shrink: 0; }
.order-item-link { color: var(--accent); text-decoration: none; }
.order-item-link:hover { text-decoration: underline; }
.order-shipping-info { font-size: .82rem; }
.order-info-row { display: flex; gap: .5rem; padding: .2rem 0; }
.order-info-row > span:first-child { color: var(--text-muted); min-width: 80px; }
.order-tracking { font-size: .82rem; color: var(--accent); }
.order-admin-note { font-size: .82rem; color: #F39C12; }
.order-admin-actions { background: rgba(124,131,245,.04); border-radius: 6px; padding: .75rem; }
.order-profit-box { background: rgba(124,131,245,.07); border: 1px solid rgba(124,131,245,.2); border-radius: 8px; padding: .65rem .9rem; font-size: .82rem; }
.order-profit-title { font-weight: 600; color: var(--accent); margin-bottom: .4rem; font-size: .83rem; }
.order-profit-row { display: flex; justify-content: space-between; align-items: center; padding: .18rem 0; color: var(--text); }
.order-profit-net { border-top: 1px solid var(--border); margin-top: .3rem; padding-top: .3rem; font-weight: 600; }

/* ── Message threads ── */
.msg-thread-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: .85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: .5rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.msg-thread-row:hover { border-color: var(--accent); background: var(--surface2); }
.msg-thread-row.unread { border-left: 3px solid var(--accent); }
.msg-thread-left { display: flex; align-items: flex-start; gap: .6rem; flex: 1; min-width: 0; flex-direction: column; }
.msg-thread-right { display: flex; align-items: center; flex-shrink: 0; gap: .3rem; }
.msg-thread-buyer { color: var(--accent2); font-size: .8rem; font-weight: 600; }
.msg-thread-subject { font-size: .88rem; color: var(--text); }
.msg-thread-preview { font-size: .78rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 500px; }
.unread-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
  display: inline-block;
  margin-right: 2px;
}

/* ── Message thread modal body ── */
.msg-thread-body {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.msg-bubble {
  max-width: 80%;
  border-radius: 12px;
  padding: .65rem .9rem;
}
.msg-bubble-buyer {
  background: var(--surface2);
  border: 1px solid var(--border);
  align-self: flex-start;
}
.msg-bubble-admin {
  background: rgba(124,131,245,.15);
  border: 1px solid rgba(124,131,245,.3);
  align-self: flex-end;
}
.msg-bubble-meta {
  display: flex;
  gap: .75rem;
  align-items: baseline;
  margin-bottom: .3rem;
}
.msg-sender { font-size: .78rem; font-weight: 700; color: var(--accent2); }
.msg-bubble-body { font-size: .85rem; line-height: 1.55; color: var(--text); }

/* ── Buyer preview banner ── */
#previewBanner {
  background: linear-gradient(90deg, #d35400, #e67e22);
  color: #fff;
  position: fixed;
  top: 57px;
  left: 0;
  right: 0;
  z-index: 900;
  height: 44px;
  display: flex;
  align-items: center;
}
/* Push main content below the fixed banner */
body.has-preview-banner #pageContent {
  padding-top: 44px;
}
.preview-banner-inner {
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 0 1.5rem;
  font-size: .88rem;
  gap: .5rem;
}
.preview-banner-inner .btn-light {
  font-size: .78rem;
  padding: .2rem .65rem;
}

/* ── Notification item with linked product ── */
.notif-item.has-product { cursor: pointer; }
.notif-item.has-product:hover {
  background: var(--surface2);
  border-left-color: var(--accent2);
}
.notif-item.has-product:hover .notif-title {
  color: var(--accent2);
}

/* ══════════════════════════════════════════
   LIGHT THEME  (買家 / 預覽模式)
   body.theme-light 範圍內完整覆蓋
   ══════════════════════════════════════════ */
body.theme-light {
  --bg:        #f3eaff;
  --surface:   #fdf8ff;
  --surface2:  #ead9ff;
  --border:    #c9a0f0;
  --text:      #2b1158;
  --text-muted:#7a5fa8;
  --accent:    #d4009f;   /* 洋紅（淺色版加深保持對比） */
  --accent2:   #0090c0;   /* 青（淺色版加深保持對比） */
  --neon-green: #00a05a;
  --pixel-shadow: 4px 4px 0 rgba(120,60,180,.25);
  background:
    linear-gradient(rgba(212,0,159,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,144,192,.04) 1px, transparent 1px),
    var(--bg);
  background-size: 42px 42px, 42px 42px, auto;
  background-attachment: fixed;
  color: var(--text);
}
body.theme-light::after { opacity: .45; }

/* ── Navbar ── */
body.theme-light .navbar {
  background: #ffffff;
  border-bottom: 2px solid #dde3f5;
  box-shadow: 0 2px 10px rgba(79, 91, 213, .10);
}
body.theme-light .navbar-brand       { color: #1e2140 !important; }
body.theme-light .navbar-brand i     { color: var(--accent); }
body.theme-light .sync-status        { color: #5c69a8; }
body.theme-light .btn-outline-light  { border-color: #c5cde8; color: #3d4680; }
body.theme-light .btn-outline-light:hover { background: #eef1fb; color: #1e2140; border-color: var(--accent); }
body.theme-light #btnPreviewBuyer    { border-color: #e07b2a; color: #e07b2a; }
body.theme-light #btnPreviewBuyer:hover { background: #e07b2a; color: #fff; }
body.theme-light .notif-bell         { color: #3d4680; }
body.theme-light #notifCount         { background: #e74c3c; color: #fff; }

/* ── Preview banner ── */
body.theme-light #previewBanner {
  background: linear-gradient(90deg, #d35400, #e67e22); /* keep orange */
}

/* ── Nav tabs ── */
body.theme-light .nav-tabs { border-color: var(--border); }
body.theme-light .nav-tabs .nav-link { color: var(--text-muted); background: transparent; }
body.theme-light .nav-tabs .nav-link:hover { color: var(--accent); }
body.theme-light .nav-tabs .nav-link.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  background: transparent;
}
body.theme-light .fav-tab-badge { background: #e74c3c; }

/* ── Filter bar ── */
body.theme-light .filter-bar { background: var(--bg); }
body.theme-light .filter-tag {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
body.theme-light .filter-tag.active,
body.theme-light .filter-tag:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
body.theme-light .form-select,
body.theme-light .form-control {
  background-color: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
body.theme-light .form-select:focus,
body.theme-light .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(79,91,213,.2);
}
body.theme-light .input-group-text {
  background-color: var(--surface2);
  border-color: var(--border);
  color: var(--text-muted);
}
body.theme-light .text-muted { color: var(--text-muted) !important; }

/* ── Product cards (standard) ── */
body.theme-light .product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 1px 5px rgba(63,81,181,.07);
}
body.theme-light .product-card:hover {
  box-shadow: 0 4px 18px rgba(63,81,181,.16);
  border-color: var(--accent);
}
body.theme-light .card-title { color: var(--text); }
body.theme-light .card-date  { color: var(--text-muted); }
body.theme-light .card-price { color: var(--text); }
body.theme-light .card-img-placeholder {
  background: var(--surface2);
  color: var(--border);
}
body.theme-light .card-action a {
  background: var(--surface2);
  color: var(--accent);
  border-color: var(--border);
}
body.theme-light .card-action a:hover { background: var(--accent); color: #fff; }
body.theme-light .fav-btn { background: var(--surface); border-color: var(--border); }
body.theme-light .fav-btn:hover { background: var(--surface2); }
body.theme-light .watch-btn { background: var(--surface); border-color: var(--border); }
body.theme-light .watch-btn:hover { background: var(--surface2); }
body.theme-light .shopee-listed-btn { background: var(--surface); border-color: var(--border); }
body.theme-light .shopee-listed-btn:hover { background: var(--surface2); }

/* ── List view cards ── */
body.theme-light .list-card {
  background: var(--surface);
  border-color: var(--border);
}
body.theme-light .list-card:hover { border-color: var(--accent); }
body.theme-light .list-title { color: var(--text); }
body.theme-light .list-price { color: var(--text); }
body.theme-light .list-actions .fav-btn {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text-muted);
}
body.theme-light .list-actions .watch-btn {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text-muted);
}
body.theme-light .list-actions .shopee-listed-btn {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text-muted);
}

/* ── View mode buttons ── */
body.theme-light .view-btn,
body.theme-light .view-btn-used {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
body.theme-light .view-btn.active,
body.theme-light .view-btn-used.active,
body.theme-light .view-btn:hover,
body.theme-light .view-btn-used:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Product modal ── */
body.theme-light #productModal .modal-content {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border);
}
body.theme-light #productModal .modal-header { border-color: var(--border) !important; }
body.theme-light .modal-title { color: var(--text) !important; }
body.theme-light .modal-label { color: var(--text-muted); }
body.theme-light .modal-value { color: var(--text); }
/* Dark close button for light modal */
body.theme-light .btn-close-white {
  filter: invert(1) grayscale(1) brightness(0.2);
}

/* ── Watchlist cost panel ── */
body.theme-light .cost-panel {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: none;
}
body.theme-light .cost-panel-header {
  color: var(--text);
  border-color: var(--border) !important;
}
body.theme-light .cost-panel-header .text-muted { color: var(--text-muted) !important; }
body.theme-light .cost-row { color: var(--text); }
body.theme-light .cost-row-jpy { color: var(--text); }
body.theme-light .cost-total-row {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface2);
  box-shadow: none;
}
body.theme-light #costTotal { color: var(--accent); text-shadow: none; }
body.theme-light .cost-note { background: rgba(79,91,213,.06) !important; color: var(--text-muted) !important; }
body.theme-light .buyer-cost-panel { background: var(--surface); }
body.theme-light .buyer-cost-item {
  background: var(--surface2);
  border: 1px solid var(--border);
}
body.theme-light .buyer-total-row { border-color: var(--border); }
body.theme-light .export-bar {
  background: var(--surface);
  border-color: var(--border);
}
body.theme-light .export-buyer-input {
  background: var(--surface2) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
body.theme-light .export-btn {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}

/* ── Messages tab ── */
body.theme-light .msg-thread-row {
  background: var(--surface);
  border-color: var(--border);
}
body.theme-light .msg-thread-row:hover { background: var(--surface2); border-color: var(--accent); }
body.theme-light .msg-thread-row.unread { border-left-color: var(--accent); }
body.theme-light .msg-thread-subject { color: var(--text); }
body.theme-light .msg-bubble-buyer {
  background: var(--surface2);
  border-color: var(--border);
}
body.theme-light .msg-bubble-body { color: var(--text); }

/* Message modals */
body.theme-light #messageComposeModal .modal-content,
body.theme-light #messageThreadModal .modal-content {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border);
}
body.theme-light #messageComposeModal .modal-header,
body.theme-light #messageThreadModal .modal-header,
body.theme-light #messageComposeModal .modal-footer,
body.theme-light #messageThreadModal .modal-footer {
  border-color: var(--border) !important;
}
body.theme-light .dark-input {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
body.theme-light .dark-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px rgba(79,91,213,.2) !important;
}
body.theme-light .msg-thread-body { background: var(--surface2); border-radius: 8px; padding: .75rem; }

/* ── Orders tab ── */
body.theme-light .order-card {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 1px 4px rgba(63,81,181,.07);
}
body.theme-light .order-card:hover { border-color: var(--accent); }
body.theme-light .order-detail { background: var(--surface2); border-color: var(--border); }
body.theme-light .order-items-table th { background: var(--surface2); color: var(--text-muted); }
body.theme-light .order-items-table td { color: var(--text); border-color: var(--border); }
body.theme-light .order-item-link { color: #5c6bc0; }
body.theme-light .order-item-thumb { border-color: var(--border); }
body.theme-light .order-total-row { background: rgba(79,91,213,.06); }
body.theme-light .order-info-row > span:first-child { color: var(--text-muted); }

/* Order create modal */
body.theme-light #orderCreateModal .modal-content {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border);
}
body.theme-light #orderCreateModal .modal-header,
body.theme-light #orderCreateModal .modal-footer { border-color: var(--border) !important; }
body.theme-light #orderCreateModal .table-dark,
body.theme-light #orderCreateModal .table-dark th,
body.theme-light #orderCreateModal .table-dark td {
  background: transparent !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
body.theme-light #orderCreateModal hr { border-color: var(--border); }

/* ── Notification drawer ── */
body.theme-light .notif-drawer {
  background: var(--surface);
  border-left: 1px solid var(--border);
}
body.theme-light .notif-drawer-header {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
body.theme-light .notif-item { border-bottom-color: var(--border); }
body.theme-light .notif-item:hover { background: var(--surface2); }
body.theme-light .notif-title { color: var(--text); }
body.theme-light .notif-msg { color: var(--text-muted); }

/* ── Toast ── */
body.theme-light .toast-container .toast {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

/* ── Buttons generic ── */
body.theme-light .btn-outline-secondary {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}
body.theme-light .btn-outline-secondary:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--accent);
}
body.theme-light .btn-outline-secondary.active,
body.theme-light .btn-outline-secondary:active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff !important;
}
body.theme-light .btn-primary {
  background-color: var(--accent);
  border-color: var(--accent);
}
body.theme-light .btn-primary:hover {
  background-color: #3f4fbf;
  border-color: #3f4fbf;
}

/* ── Scrollbar ── */
body.theme-light ::-webkit-scrollbar-track { background: var(--surface2); }
body.theme-light ::-webkit-scrollbar-thumb { background: var(--border); }
body.theme-light ::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Source badge / card-source ── */
body.theme-light .card-source { opacity: .9; }

/* ── Weight strip ── */
body.theme-light .card-weight-strip { border-color: var(--border); color: var(--text-muted); }
body.theme-light .weight-input {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

/* ═══════════════════════════════════════════════
   手機版 RWD（≤ 768px）
   ═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* ── Navbar：單行化，壓縮高度 ── */
  .navbar { padding: 6px 0; }
  .navbar .container-fluid { padding-left: 12px !important; padding-right: 12px !important; flex-wrap: nowrap; min-width: 0; }
  .navbar-brand { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 1; }
  .navbar-brand .me-2 { margin-right: .3rem !important; }
  .brand-suffix { font-size: 0.75rem; display: inline; }
  .sync-status { display: none; }
  .navbar .gap-3,
  .navbar .ms-auto { gap: 6px !important; flex-wrap: nowrap; flex-shrink: 0; }
  #btnPreviewBuyer { display: none !important; }
  #btnViewportToggle { display: none !important; }
  #userBadge .fa-user-circle { display: none !important; }
  .visitor-counter { display: none !important; }
  .user-badge { font-size: .76rem; flex-shrink: 0; }
  .user-badge #usernameDisplay { max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
  #guestNav { flex-shrink: 0; gap: 6px !important; }

  /* ── Preview banner ── */
  .preview-banner-inner { flex-wrap: wrap; font-size: .8rem; padding: 6px 12px; }
  .preview-banner-inner .text-opacity-75 { display: none; }

  /* ── Tabs：橫向捲動 ── */
  .nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tabs .nav-link { white-space: nowrap; padding: 8px 12px; font-size: .88rem; }

  /* ── Main container ── */
  .container-fluid.px-4 { padding-left: 12px !important; padding-right: 12px !important; }
  #pageContent { margin-top: 0 !important; }

  /* ── Filter bar：直向堆疊 ── */
  .filter-bar { gap: 8px !important; }
  /* 品牌標籤：單行橫向滑動 strip */
  .filter-tags-wrap {
    position: relative;
    width: 100%;
    order: -1;          /* 永遠排在 filter-bar 最上方 */
  }
  .filter-tags-wrap::after {
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 36px;
    background: linear-gradient(to right, transparent, var(--bg));
    pointer-events: none;
    z-index: 1;
  }
  .filter-tags {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
    padding-bottom: 2px;
  }
  .filter-tags::-webkit-scrollbar { display: none; }
  .filter-tags .filter-tag { flex-shrink: 0; }
  /* 搜尋欄彈性寬度，與類型/排序同排 */
  .filter-bar .input-group { width: auto !important; flex: 1; min-width: 80px; }
  /* sub-tabs：切換鈕靠左，控制按鈕靠右，同一列 */
  .product-sub-tabs { flex-wrap: nowrap !important; gap: 6px; justify-content: space-between; align-items: center; overflow: hidden; }
  /* 手機：只顯示 active tab，點擊可切換 */
  .product-sub-tab:not(.active) { display: none !important; }
  .product-sub-tab { white-space: nowrap; height: 31px; box-sizing: border-box; padding: 0 .85rem; display: flex; align-items: center; justify-content: center; font-size: .875rem; }
  .product-sub-tab.active::after { content: ' ⇄'; opacity: .65; font-size: .8em; }
  .product-sub-tabs .market-suffix { display: none; }
  .product-sub-tabs > div:last-child { flex-wrap: nowrap !important; flex-shrink: 0; gap: 8px; align-items: center; }
  .product-sub-tabs .view-btn,
  .product-sub-tabs .view-btn-used,
  .product-sub-tabs #btnHideSoldOut,
  .product-sub-tabs #btnThemeToggle,
  .product-sub-tabs #btnPromoMode { height: 31px !important; box-sizing: border-box !important; padding: 0 .4rem !important; display: flex !important; align-items: center !important; justify-content: center !important; font-size: .875rem; }
  .product-sub-tabs .btn-label { display: none; }

  /* ── 行事曆圖例：壓成單一橫向捲動列 ── */
  .calendar-legend-inner {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overflow-y: hidden;
    gap: .4rem !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .calendar-legend-inner::-webkit-scrollbar { display: none; }
  .calendar-legend-inner > * { flex-shrink: 0; }
  .calendar-legend span { font-size: .72rem; }
  .legend-toggle, .calendar-fav-toggle { padding: 2px 6px; }
  .legend-dot { width: 8px; height: 8px; }
  .calendar-legend { padding-top: .35rem; padding-bottom: .35rem; margin-bottom: .4rem !important; }

  .date-full { display: none; }
  .date-short { display: inline; }

  /* ── 頂部精簡：#mainTabs / .product-sub-tabs 上下 padding 壓縮 ── */
  #mainTabs { padding-top: .35rem !important; }
  .nav-tabs .nav-link { padding: 6px 10px; font-size: .82rem; }
  .product-sub-tabs { padding-top: .35rem !important; padding-bottom: .35rem !important; }
  .product-sub-tab { height: 30px; }
  .product-sub-tabs .view-btn,
  .product-sub-tabs .view-btn-used,
  .product-sub-tabs #btnHideSoldOut,
  .product-sub-tabs #btnThemeToggle,
  .product-sub-tabs #btnPromoMode { height: 30px !important; }
  /* 搬到抽屜前的殘留按鈕群若因故未搬移，至少不撐爆這一列 */

  /* ── 搜尋鈕（開啟底部抽屜並聚焦搜尋框）── */
  #btnMobileSearch {
    display: flex !important;
    height: 30px;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    padding: 0 .5rem;
    font-size: .875rem;
  }

  /* ── 放大鏡就地搜尋：覆蓋整排，不擠壓其他按鈕 ── */
  .product-sub-tabs.searching #mobileInlineSearch {
    display: flex;
    align-items: center;
    gap: 6px;
    position: absolute;
    inset: 0;
    z-index: 5;
    background: var(--bg);
    padding: 0 8px;
  }
  #mobileInlineSearch i { color: var(--text-muted); font-size: .9rem; flex-shrink: 0; }
  #mobileSearchInput {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    height: 30px;
    padding: 0 8px;
    color: var(--text);
    font-size: .875rem;
  }
  #mobileSearchClose {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
  }

  /* ── #btnScrape 搬到「新品⇄中古」排：覆蓋 .notif-bell 圓形大尺寸 ── */
  .product-sub-tabs #btnScrape {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--border);
    flex-shrink: 0;
  }
  .product-sub-tabs #btnScrape i { font-size: .8rem; }

  /* ── Modal：滿版 ── */
  .modal-dialog { margin: 8px; max-width: calc(100% - 16px) !important; }
  .modal-body { padding: 14px; }

  /* ── Calendar：縮小工具列 ── */
  .fc .fc-toolbar { flex-wrap: wrap; gap: 6px; }
  .fc .fc-toolbar-title { font-size: 1.05rem; }
  .fc .fc-button { padding: 4px 8px; font-size: .8rem; }
  .fc .fc-event-title { font-size: .68rem; }
  .fc .fc-daygrid-day-number { font-size: .78rem; }

  /* ── 訂單卡片 ── */
  .order-card { padding: 12px; }
  .order-card-header { flex-wrap: wrap; gap: 6px; }
  .order-items-table { font-size: .8rem; }
  .order-admin-actions { flex-wrap: wrap; }

  /* ── 站內信 ── */
  .msg-thread-row { padding: 10px 12px; }
  .msg-bubble { max-width: 88%; }
  .msg-thread-body { max-height: 50vh; }

  /* ── 費用試算面板 ── */
  .watchlist-cost-col { padding: 14px; }

  /* ── Toast / popup：滿版底部 ── */
  .toast-container { left: 12px; right: 12px; bottom: 12px; }
  .cal-popup { min-width: 0; max-width: 100%; }
  .toast-item { min-width: 0; max-width: 100%; }

  /* ── List view：≤768px 縮到 1 欄 ── */
  .product-grid.view-list { grid-template-columns: 1fr; }
  .list-thumb { width: 96px; }

  /* ── 底部篩選抽屜 FAB：手機顯示（JS 依分頁再切 none）── */
  #fabFilter { display: flex; }
}

/* ═══════════════════════════════════════════════
   底部篩選抽屜（offcanvas）＋ 懸浮篩選鈕（FAB）
   手機版把 .filter-bar（新品／中古）＋ 檢視/工具按鈕搬進來；
   桌面版這些節點仍在原位，抽屜永遠是空的也不會被打開。
   ═══════════════════════════════════════════════ */
.mobile-filter-sheet {
  max-height: 78vh;
  background: var(--surface);
  border-top: 1px solid var(--border);
  color: var(--text);
}
.mobile-filter-sheet .offcanvas-header {
  border-bottom: 1px solid var(--border);
  padding: .9rem 1rem .7rem;
}
.mobile-filter-sheet .offcanvas-title { font-size: 1rem; color: var(--text); }
.mobile-filter-sheet .offcanvas-body { padding: .9rem 1rem 1.4rem; overflow-y: auto; }
body.theme-light .mobile-filter-sheet { background: #fff; }
body.theme-light .mobile-filter-sheet .offcanvas-header { border-bottom-color: var(--border); }

/* 抽屜內的 filter-bar：取消 sticky / 邊框，chips 全展開換行 */
.mobile-filter-sheet .filter-bar {
  position: static !important;
  z-index: auto !important;
  background: transparent !important;
  margin: 0 !important;
  padding: 0 0 1rem !important;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 1rem !important;
  box-shadow: none !important;
}
.mobile-filter-sheet .filter-bar::before { content: none; }
.mobile-filter-sheet .filter-bar .filter-tags-wrap { order: 0; }
.mobile-filter-sheet .filter-bar .filter-tags-wrap::after { content: none; }
.mobile-filter-sheet .filter-bar .filter-tags {
  flex-wrap: wrap !important;
  overflow: visible !important;
  width: auto;
}
.mobile-filter-sheet .filter-bar .input-group { width: 100% !important; }
#sheetSlotUsed .filter-bar { border-bottom: none; margin-bottom: 0 !important; }

.sheet-tools-heading {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: .2rem 0 .6rem;
  padding-top: .8rem;
  border-top: 1px dashed var(--border);
}
.sheet-tools-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.sheet-tools-row .btn-label { display: inline !important; }
.sheet-tools-row .view-btn,
.sheet-tools-row .view-btn-used,
.sheet-tools-row .btn {
  height: 40px !important;
  box-sizing: border-box;
  padding: 0 .8rem !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
}

/* 懸浮篩選鈕 */
#fabFilter {
  position: fixed;
  right: 16px;
  bottom: 20px;
  z-index: 1040;
  width: 56px;
  height: 56px;
  border-radius: 50% !important;
  border: 2px solid var(--accent);
  background: var(--accent);
  color: #fff;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  padding: 0;
  box-shadow: var(--pixel-shadow), 0 6px 20px rgba(0,0,0,.5);
  cursor: pointer;
}
#fabFilter:hover, #fabFilter:focus { background: var(--accent2); border-color: var(--accent2); color: #000; }
.fab-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 20px;
  height: 20px;
  line-height: 18px;
  padding: 0 4px;
  border-radius: 50% !important;
  border: 2px solid var(--bg);
  background: var(--neon-red);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  text-align: center;
}

/* ═══════════════════════════════════════════════
   超小螢幕（≤ 576px）
   ═══════════════════════════════════════════════ */
@media (max-width: 576px) {
  .product-grid.standard,
  .product-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .product-grid.view-compact { grid-template-columns: repeat(3, 1fr) !important; gap: 6px; }
  .product-grid.view-list { grid-template-columns: 1fr !important; }

  .card-title { font-size: .8rem; }
  .card-price { font-size: .85rem; }

  /* 行事曆改用月列表較易讀（樣式微調） */
  .fc .fc-list-event-title { font-size: .82rem; }

  /* 後台管理表格橫向捲動 */
  #tab-admin .table-responsive,
  #tab-admin table { font-size: .8rem; }

  /* 燈箱輪播圖高度限制 */
  .modal-carousel-img { max-height: 320px; }
}

/* ── Desktop notify toggle ── */
.desktop-notify-btn {
  display: block;
  width: calc(100% - 24px);
  margin: 10px 12px 0;
  padding: 8px 12px;
  font-size: .8rem;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}
.desktop-notify-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.desktop-notify-btn.active { border-style: solid; border-color: #7DCEA0; color: #7DCEA0; }
.desktop-notify-btn:disabled { cursor: default; opacity: .8; }
body.theme-light .desktop-notify-btn { border-color: var(--border); color: var(--text-muted); }
body.theme-light .desktop-notify-btn.active { border-color: #27ae60; color: #27ae60; }

/* ══════════════════════════════════════════
   宣傳選品模式 (Promo Mode)
   ══════════════════════════════════════════ */
.promo-check-overlay {
  position: absolute;
  top: 8px; right: 8px;
  width: 20px; height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}
body.promo-mode-active .promo-check-overlay { opacity: 1; pointer-events: all; }
body.promo-mode-active .card-badge-new { top: 34px; }

.product-card.promo-selected {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px rgba(124,131,245,.45), 0 6px 20px rgba(0,0,0,.4);
}
body.promo-mode-active .product-card { cursor: pointer; }

/* list-card: promo checkbox now lives in .list-thumb (same as standard card) — no special override needed */

.promo-floating-bar {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 40px;
  padding: 10px 20px;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 6px 28px rgba(0,0,0,.55);
  z-index: 1500;
  white-space: nowrap;
  animation: promoBarSlideUp .25s ease;
}
@keyframes promoBarSlideUp {
  from { transform: translateX(-50%) translateY(60px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}
.promo-bar-count { font-size: .88rem; color: var(--text-muted); }
.promo-bar-count strong { color: var(--accent); font-size: 1rem; }

.promo-textarea {
  font-family: 'Hiragino Sans', 'Noto Sans JP', monospace;
  font-size: .88rem; line-height: 1.7;
  resize: vertical; min-height: 340px;
}

#btnPromoMode.active { background: var(--accent); color: #fff; border-color: var(--accent); }

body.theme-light .promo-floating-bar { box-shadow: 0 6px 28px rgba(79,91,213,.25); }
body.theme-light .product-card.promo-selected {
  box-shadow: 0 0 0 2px rgba(79,91,213,.35), 0 4px 14px rgba(79,91,213,.15);
}

/* ══════════════════════════════════════════
   售罄 (Sold Out) 標示
   ══════════════════════════════════════════ */
.product-card.sold-out .card-img-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  pointer-events: none;
  z-index: 2;
}
.product-card.sold-out .card-img-wrap img,
.product-card.sold-out .card-img-placeholder { opacity: .5; }
.product-card.sold-out .card-body,
.product-card.sold-out .card-footer-strip { opacity: .5; }
.card-soldout-badge {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: #e53535;
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 6px;
  z-index: 3;
  letter-spacing: .5px;
  white-space: nowrap;
}
/* 在庫切れ/品切れ（再入荷の可能性あり）は橙色で「販売終了」と区別 */
.card-soldout-badge.is-restock { background: #e08a1e; }
/* List view: sold-out overlay on thumb + dim body */
.list-card.sold-out .list-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  pointer-events: none;
  z-index: 1;
}
.list-card.sold-out .list-thumb img { opacity: .5; }
.list-card.sold-out .list-body { opacity: .5; }
/* Keep badge absolute-centered on thumb (inherit base .card-soldout-badge) */
.list-card .card-soldout-badge {
  font-size: .7rem;
  padding: 3px 10px;
  z-index: 2;
}
/* Light theme */
body.theme-light .product-card.sold-out .card-img-wrap::after {
  background: rgba(255,255,255,.45);
}

/* ═══════════════════════════════════════════════════════════
   80s RETRO ARCADE — 元件覆蓋層
   （調色盤變數已在 :root 定義；此區負責形狀與光效）
   ═══════════════════════════════════════════════════════════ */

/* ── Navbar：霓虹招牌 ── */
.navbar {
  background: linear-gradient(90deg, #14052e 0%, #1a0b38 100%);
  border-bottom: 2px solid var(--accent);
  box-shadow: 0 2px 18px rgba(255,43,214,.25);
}
.navbar-brand {
  color: var(--accent2) !important;
  text-shadow: 0 0 6px rgba(0,240,255,.8), 0 0 18px rgba(0,240,255,.45);
  animation: neonFlicker 7s infinite;
}
.navbar-brand i {
  color: var(--accent);
  text-shadow: 0 0 8px rgba(255,43,214,.9);
}
@keyframes neonFlicker {
  0%, 100% { opacity: 1; }
  41%  { opacity: 1; }
  42%  { opacity: .65; }
  43%  { opacity: 1; }
  78%  { opacity: 1; }
  79%  { opacity: .8; }
  80%  { opacity: 1; }
}

/* ── Tabs：街機選單 ── */
.nav-tabs .nav-link { border-bottom-width: 3px; letter-spacing: .04em; }
.nav-tabs .nav-link.active {
  color: var(--accent2);
  border-bottom-color: var(--accent2);
  text-shadow: 0 0 8px rgba(0,240,255,.7);
}
.nav-tabs .nav-link:hover { text-shadow: 0 0 6px rgba(255,43,214,.5); }

/* ── 像素卡片：粗框 + 硬陰影 ── */
.product-card {
  border-width: 2px;
  box-shadow: var(--pixel-shadow);
}
.product-card:hover {
  transform: translate(-2px, -2px);
  border-color: var(--accent);
  box-shadow: 6px 6px 0 rgba(255,43,214,.35), 0 0 20px rgba(255,43,214,.25);
}
.product-card.is-new { border-color: var(--accent); }
body.theme-light .product-card:hover {
  box-shadow: 6px 6px 0 rgba(212,0,159,.25), 0 0 16px rgba(212,0,159,.15);
}

/* ── 徽章：像素風 ── */
.card-badge { border: 1px solid rgba(255,255,255,.3); backdrop-filter: none; }
.card-badge-new {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(255,43,214,.7), 2px 2px 0 rgba(0,0,0,.5);
  animation: arcadeBlink 1.4s steps(2, start) infinite;
  letter-spacing: .08em;
}
@keyframes arcadeBlink {
  0%, 60% { opacity: 1; }
  61%, 100% { opacity: .45; }
}
.card-lottery-badge {
  background: var(--neon-yellow);
  color: #3d2b00;
  box-shadow: 0 0 10px rgba(255,229,61,.6), 2px 2px 0 rgba(0,0,0,.5);
}

/* ── 價格：霓虹綠 ── */
.card-price, .compact-price, .list-price, .order-total, .proxy-price {
  color: var(--neon-green) !important;
  text-shadow: 0 0 6px rgba(43,255,136,.45);
}
body.theme-light .card-price,
body.theme-light .compact-price,
body.theme-light .list-price,
body.theme-light .order-total,
body.theme-light .proxy-price {
  color: var(--neon-green) !important;
  text-shadow: none;
}

/* ── 售罄標籤：霓虹紅警示 ── */
.card-soldout-badge {
  background: var(--neon-red);
  border: 2px solid #fff;
  box-shadow: 0 0 14px rgba(255,34,68,.8), 3px 3px 0 rgba(0,0,0,.6);
  letter-spacing: .1em;
}
.card-soldout-badge.is-restock {
  background: #f0932b;
  box-shadow: 0 0 14px rgba(240,147,43,.8), 3px 3px 0 rgba(0,0,0,.6);
}

/* ── 按鈕：像素硬陰影 ── */
.btn { border-width: 2px; transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translate(2px, 2px); box-shadow: none !important; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 3px 3px 0 rgba(0,0,0,.5);
}
.btn-primary:hover {
  background: var(--accent2);
  border-color: var(--accent2);
  color: #062030;
  box-shadow: 3px 3px 0 rgba(0,0,0,.5), 0 0 16px rgba(0,240,255,.5);
}
.btn-success {
  background: var(--neon-green);
  border-color: var(--neon-green);
  color: #02361a;
  box-shadow: 3px 3px 0 rgba(0,0,0,.5);
}
.btn-success:hover {
  background: #5fffa8;
  border-color: #5fffa8;
  color: #02361a;
  box-shadow: 3px 3px 0 rgba(0,0,0,.5), 0 0 16px rgba(43,255,136,.5);
}

/* ── Filter tags：選關膠囊 → 像素章 ── */
.filter-tag { border-width: 2px; letter-spacing: .03em; }
.filter-tag.active {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(255,43,214,.55), 2px 2px 0 rgba(0,0,0,.5);
}
.filter-tag:hover { box-shadow: 0 0 8px rgba(255,43,214,.35); }
.filter-tag-more { opacity: 0.7; border-style: dashed; }
.filter-tag-more:hover { opacity: 1; }

/* ── View buttons ── */
.view-btn, .view-btn-used { border-width: 2px; }
.view-btn.active, .view-btn-used.active { box-shadow: 0 0 10px rgba(255,43,214,.55); }

/* ── 輸入框 focus：霓虹光圈 ── */
.filter-bar .form-select:focus,
.filter-bar .form-control:focus,
.dark-input:focus,
.weight-input:focus,
.rate-input:focus,
.auth-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px rgba(255,43,214,.3), 0 0 12px rgba(255,43,214,.25) !important;
}

/* ── Modal：像素視窗 ── */
.modal-content {
  border: 2px solid var(--accent2);
  box-shadow: 8px 8px 0 rgba(0,0,0,.5), 0 0 30px rgba(0,240,255,.2);
}

/* ── Toast / 行事曆彈窗 ── */
.toast-item, .cal-popup {
  border-width: 2px;
  border-left-width: 6px;
  box-shadow: 4px 4px 0 rgba(0,0,0,.55), 0 0 16px rgba(255,43,214,.2);
}

/* ── 行事曆 ── */
.fc .fc-daygrid-day.fc-day-today { background: rgba(255,43,214,.1) !important; }
.fc .fc-button-primary:hover,
.fc .fc-button-primary:not(:disabled).fc-button-active {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 10px rgba(255,43,214,.5) !important;
}
#calendar { border-width: 2px; box-shadow: var(--pixel-shadow); }

/* ── 宣傳選品 ── */
.promo-floating-bar {
  border-width: 2px;
  box-shadow: 4px 4px 0 rgba(0,0,0,.55), 0 0 24px rgba(255,43,214,.35);
}
.product-card.promo-selected {
  border-color: var(--accent2) !important;
  box-shadow: 0 0 0 2px rgba(0,240,255,.5), 0 0 18px rgba(0,240,255,.35), var(--pixel-shadow) !important;
}
#btnPromoMode.active { box-shadow: 0 0 12px rgba(255,43,214,.55); }

/* ── 費用面板 / 匯出列 ── */
.cost-panel, .export-bar { border-width: 2px; box-shadow: var(--pixel-shadow); }
.cost-total-row {
  background: linear-gradient(135deg, #2a1458, #1a0b38);
  border: 2px solid var(--accent);
  box-shadow: 0 0 16px rgba(255,43,214,.25);
}
#costTotal { color: var(--accent); text-shadow: 0 0 8px rgba(255,43,214,.5); }
.export-btn {
  background: var(--neon-green);
  color: #02361a;
  box-shadow: 3px 3px 0 rgba(0,0,0,.5);
}
.export-btn:hover { background: #5fffa8; color: #02361a; }

/* ── 訂單 / 站內信卡片 ── */
.order-card, .msg-thread-row { border-width: 2px; }
.order-card:hover, .msg-thread-row:hover {
  box-shadow: 0 0 14px rgba(255,43,214,.25);
}

/* ── 登入卡：像素雙框 ── */
.auth-card {
  border: 2px solid var(--accent);
  outline: 2px solid var(--accent2);
  outline-offset: 5px;
  box-shadow: 8px 8px 0 rgba(0,0,0,.5), 0 0 40px rgba(255,43,214,.25);
}
.auth-logo {
  color: var(--accent2);
  text-shadow: 0 0 8px rgba(0,240,255,.7);
}
.auth-btn {
  background: var(--accent);
  box-shadow: 3px 3px 0 rgba(0,0,0,.5);
  letter-spacing: .1em;
}
.auth-btn:hover { opacity: 1; background: var(--accent2); color: #062030; }
.remember-me-label {
  display: flex; align-items: center; gap: 7px;
  font-size: .8rem; color: var(--text-muted);
  cursor: pointer; user-select: none;
  margin-bottom: 2px;
}
.remember-me-cb { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }

/* ── 通知鈴鐺 ── */
.notif-badge { background: var(--neon-red); box-shadow: 0 0 8px rgba(255,34,68,.7); }
.notif-drawer { border-left: 2px solid var(--accent); }

/* ── 滾動條：方塊霓虹 ── */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--surface2);
  border: 2px solid var(--accent);
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── 預覽橫幅：日落漸層 ── */
#previewBanner, body.theme-light #previewBanner {
  background: linear-gradient(90deg, #ff2bd6, #ff8a00);
  border-bottom: 2px solid rgba(255,255,255,.3);
}

/* ── 桌面通知按鈕 ── */
.desktop-notify-btn { border-width: 2px; }
.desktop-notify-btn.active { border-color: var(--neon-green); color: var(--neon-green); }
body.theme-light .desktop-notify-btn.active { border-color: var(--neon-green); color: var(--neon-green); }

/* ── 重點數字 tabular → 像素字不需要，移除字距調整 ── */
#costTotal, .cost-row-jpy { font-variant-numeric: normal; }

/* ══ 詢問商品選擇器 ══ */
.compose-product-preview {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
.compose-product-thumb {
  width: 52px; height: 52px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.compose-product-info { min-width: 0; }
.compose-product-title {
  font-size: .82rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ══ Thread 附件商品卡 ══ */
.thread-product-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface2);
  border: 1px solid var(--accent2);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 4px;
  box-shadow: 0 0 8px rgba(0,255,255,.08);
}
.thread-product-thumb {
  width: 56px; height: 56px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.thread-product-thumb-placeholder {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border-radius: 6px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.thread-product-info { min-width: 0; flex: 1; }
.thread-product-label {
  font-size: .62rem; color: var(--accent2); font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; margin-bottom: 2px;
}
.thread-product-title {
  font-size: .85rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body.theme-light .thread-product-card { box-shadow: 0 0 8px rgba(0,150,200,.1); }

/* ══ 系列分組 ══ */
/* Count badge: bottom-left of thumbnail */
.series-count-badge {
  position: absolute;
  bottom: 8px; left: 8px;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(4px);
  color: var(--accent2);
  font-size: .63rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  border: 1px solid var(--accent2);
  pointer-events: none;
}

/* Expand arrow: circular button at bottom-right of thumbnail */
.series-expand-arrow {
  position: absolute;
  bottom: 8px; right: 8px;
  width: 26px; height: 26px;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(4px);
  border: 1px solid var(--accent2);
  border-radius: 50%;
  color: var(--accent2);
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem;
  cursor: pointer;
  z-index: 4;
  transition: background .15s, color .15s;
  padding: 0;
}
.series-expand-arrow:hover,
.series-expand-arrow.expanded {
  background: var(--accent2);
  color: #061820;
}

/* list-thumb needs relative positioning for the arrow overlay */
.list-thumb { position: relative; }

/* Light theme */
body.theme-light .series-count-badge { color: var(--accent2); }

/* ── Account page ── */
.acct-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.acct-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
}
.acct-profile-card {
  text-align: center;
  grid-row: span 1;
}
.acct-records-card { grid-column: span 2; }
@media (max-width: 768px) { .acct-records-card { grid-column: span 1; } }
.acct-avatar { font-size: 3.5rem; color: var(--accent); margin-bottom: 8px; }
.acct-username { font-size: 1.25rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.acct-displayname { font-size: .9rem; color: var(--text-muted); margin-bottom: 6px; }
.acct-meta { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.acct-section-title {
  font-size: .85rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--accent); margin-bottom: 12px;
}
.acct-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center;
}
@media (max-width: 576px) { .acct-stats { grid-template-columns: repeat(2, 1fr); } }
.acct-stat { background: var(--surface2); border-radius: 8px; padding: 10px 4px; }
.acct-stat-active .acct-stat-num { color: var(--accent2); }
.acct-stat-num { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.acct-stat-label { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }
.acct-records { display: flex; flex-direction: column; gap: 6px; }
.acct-record-row {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--surface2);
  border-radius: 6px;
  font-size: .82rem;
}
body.theme-light .acct-card { background: var(--surface); border-color: var(--border); }
body.theme-light .acct-stat { background: var(--surface2); }
body.theme-light .acct-record-row { background: var(--surface2); }
body.theme-light .acct-username, body.theme-light .acct-stat-num { color: var(--text); }

/* ── Quotes / Orders / Messages tab layout ── */
#tab-quotes, #tab-orders, #tab-messages {
  display: flex;
  flex-direction: column;
  align-items: center;
}
#tab-quotes > *, #tab-orders > *, #tab-messages > * {
  width: 100%;
  max-width: 760px;
}

/* ── Quote cards ── */
.quote-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  transition: border-color .2s;
}
.quote-card:hover { border-color: var(--accent); }
.quote-card-admin { cursor: pointer; }

/* Buyer quoted-state action row */
.buyer-quote-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
}
.buyer-quote-price-group { display: flex; flex-direction: column; gap: 1px; }
.buyer-quote-price-label { font-size: .75rem; color: var(--text-muted); letter-spacing: .02em; }
.buyer-quote-price-val   { font-weight: 700; font-size: 1.05rem; color: var(--accent); }
.buyer-quote-btn-group   { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Admin quote pricing modal */
#qpTable {
  min-width: 560px;
}
#qpTable td:first-child,
#qpTable th:first-child {
  min-width: 160px;
}
.quote-item-thumb {
  width: 52px; height: 52px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.quote-item-thumb-empty {
  width: 52px; height: 52px;
  background: var(--surface2);
  border-radius: 6px;
  flex-shrink: 0;
}
body.theme-light .quote-card {
  background: var(--surface);
  border-color: var(--border);
}
body.theme-light #quotePriceModal .modal-content { background: var(--surface); color: var(--text); }
body.theme-light #quotePriceModal .table { color: var(--text); }
body.theme-light #quotePriceModal .table-light th { background: var(--surface2); color: var(--text); }

/* Admin (dark) mode: quote price modal */
body:not(.theme-light) #quotePriceModal .modal-content {
  background-color: var(--surface) !important;
  color: var(--text) !important;
}
body:not(.theme-light) #quotePriceModal .modal-header,
body:not(.theme-light) #quotePriceModal .modal-footer { border-color: var(--border); }
body:not(.theme-light) #quotePriceModal a:not(.btn) {
  color: var(--neon-green);
  text-decoration-color: rgba(43,255,136,.4);
}
body:not(.theme-light) #quotePriceModal a:not(.btn):hover { color: #fff; }
body:not(.theme-light) #quotePriceModal .table {
  --bs-table-color: var(--text);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--border);
  color: var(--text);
}
body:not(.theme-light) #quotePriceModal thead.table-light,
body:not(.theme-light) #quotePriceModal thead.table-light tr,
body:not(.theme-light) #quotePriceModal thead.table-light th {
  --bs-table-color: var(--text2);
  --bs-table-color-state: var(--text2);
  --bs-table-color-type: var(--text2);
  --bs-table-bg: var(--surface2);
  background-color: var(--surface2) !important;
  color: var(--text2) !important;
  border-color: var(--border) !important;
  white-space: nowrap;
}
body:not(.theme-light) #quotePriceModal .form-control,
body:not(.theme-light) #quotePriceModal textarea {
  background-color: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}
body:not(.theme-light) #quotePriceModal .form-control:focus,
body:not(.theme-light) #quotePriceModal textarea:focus {
  background-color: var(--surface2);
  color: var(--text);
  border-color: var(--accent);
}
body:not(.theme-light) #quotePriceModal .form-control::placeholder,
body:not(.theme-light) #quotePriceModal textarea::placeholder { color: var(--text-muted); opacity: 1; }
body:not(.theme-light) #quotePriceModal .input-group-text {
  background-color: var(--surface2);
  color: var(--text-muted);
  border-color: var(--border);
}
body:not(.theme-light) #quotePriceModal .alert-secondary {
  background-color: var(--surface2);
  border-color: var(--border);
  color: var(--text2);
}
body:not(.theme-light) #quotePriceModal .text-muted { color: var(--text-muted) !important; }
body:not(.theme-light) #quotePriceModal .btn-close { filter: invert(1) grayscale(1); }
.qp-shipping-val { font-size: .9rem; font-weight: 600; color: var(--text-muted); }
.qp-shipping-site { font-size: .72rem; color: var(--text-muted); opacity: .7; margin-top: 2px; }
.qp-price-info { color: var(--text-muted) !important; font-size: .72rem !important; }
.qp-price-info:hover { color: var(--accent2) !important; }
.qp-price-detail {
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: .72rem;
  line-height: 1.5;
}
body.theme-light .qp-price-info { color: #555 !important; }
body.theme-light .qp-price-detail { background: #f0f0f0; border-color: #ccc; color: #333; }
body.theme-light .series-expand-arrow { color: var(--accent2); }

/* ── Quote modal: international shipping section ── */
.qp-intl-ship {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .75rem 1rem;
  color: var(--text);
}
.qp-intl-ship .form-select,
.qp-intl-ship .form-control,
.qp-intl-ship .input-group-text {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.qp-intl-ship .form-label { color: var(--text2); }
body.theme-light .qp-intl-ship { background: #f7f7f7; border-color: #ddd; color: #222; }
body.theme-light .qp-intl-ship .form-select,
body.theme-light .qp-intl-ship .form-control,
body.theme-light .qp-intl-ship .input-group-text { background: #fff; border-color: #ccc; color: #222; }

/* ── Quote pricing breakdown card ── */
.qp-bd-card {
  background: rgba(124,131,245,.06);
  border: 1px solid rgba(124,131,245,.2);
  border-radius: 8px;
  padding: .7rem 1rem;
  font-size: .83rem;
}
.qp-bd-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
}
.qp-bd-val { font-weight: 600; white-space: nowrap; }
.qp-bd-sub { font-size: .79rem; opacity: .8; }
.qp-bd-sep { border-top: 1px solid var(--border); margin: 6px 0; }
.qp-bd-total { font-weight: 700; font-size: .92rem; }
.qp-bd-total .qp-bd-val small { font-size: .78rem; font-weight: 400; opacity: .85; }
body.theme-light .qp-bd-card { background: #f4f4ff; border-color: #c5c5f0; }
body.theme-light .qp-bd-sep { border-color: #ccc; }

/* ── Compare price panel ── */
.btn.qp-compare-btn {
  font-size: .7rem;
  padding: 1px 7px;
  border: 1px solid var(--accent2);
  color: var(--accent2);
  border-radius: 4px;
  line-height: 1.6;
  background: transparent;
}
.btn.qp-compare-btn:hover,
.btn.qp-compare-btn.active { background: var(--accent2); color: #000; }

.qp-compare-row td { padding: 0 !important; }
.qp-compare-panel { border-top: 1px solid var(--border); }
.qp-compare-loading,
.qp-compare-error,
.qp-compare-empty {
  padding: .5rem 1rem;
  font-size: .82rem;
  color: var(--text-muted);
}
.qp-compare-error { color: #ff6b6b; }

.qp-compare-inner { padding: .6rem .8rem .8rem; }
.qp-cmp-header {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.qp-cmp-src-link { font-size: .72rem; color: var(--accent2); margin-left: auto; }

.qp-cmp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: .5rem .75rem;
  margin-bottom: .4rem;
}
.qp-cmp-card.active { border-color: var(--accent2); }
.qp-cmp-card-header { display: flex; align-items: flex-start; gap: .5rem; margin-bottom: .35rem; }
.qp-cmp-thumb { width: 40px; height: 40px; object-fit: contain; border-radius: 4px; flex-shrink: 0; }
.qp-cmp-card-title { display: flex; flex-direction: column; gap: 2px; }
.qp-cmp-card-title a { color: var(--text); text-decoration: none; }
.qp-cmp-card-title a:hover { color: var(--accent2); }
.qp-cmp-cheapest {
  font-size: .7rem;
  background: rgba(var(--accent2-rgb, 0,255,140), .15);
  color: var(--accent2);
  border-radius: 3px;
  padding: 0 5px;
  width: fit-content;
}
.qp-cmp-stores { display: flex; flex-wrap: wrap; gap: .3rem .8rem; }
.qp-cmp-store {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .78rem;
  color: var(--text2);
  white-space: nowrap;
}
.qp-cmp-store.qp-cmp-none { opacity: .45; }
.qp-cmp-price { color: var(--accent2) !important; text-decoration: none; }
.qp-cmp-price:hover { text-decoration: underline; }

body.theme-light .qp-cmp-card { background: #f9f9f9; border-color: #ddd; }
body.theme-light .qp-cmp-card.active { border-color: var(--accent2); }
body.theme-light .qp-cmp-card-title a { color: #222; }
body.theme-light .qp-cmp-store { color: #444; }

.qp-cmp-select-btn {
  font-size: .68rem;
  padding: 1px 7px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.qp-cmp-select-btn:hover { border-color: var(--accent2); color: var(--accent2); }
.qp-cmp-select-btn.selected {
  background: var(--accent2);
  color: #000;
  border-color: var(--accent2);
  font-weight: 600;
}

/* ── Mobile mode simulation (admin tool) ── */

/* Page-level constraint when mobile mode is ON */
body.viewport-mobile {
  background: radial-gradient(ellipse at 50% 30%, #1a0d35 0%, #080512 100%) !important;
  overflow-x: hidden;
  padding: 16px 16px 80px !important;
  display: flex !important;
  justify-content: center;
  align-items: flex-start;
  min-height: 100dvh;
}
/* Elements outside the phone shell still need centering */
body.viewport-mobile .toast-container,
body.viewport-mobile .promo-floating-bar {
  max-width: var(--mobile-w, 393px);
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box;
}

/* ── Phone mockup shell (default: invisible passthrough) ── */
#phoneMockShell { display: contents; }
#phoneMockTopBar, #phoneMockHomeBar { display: none; }
#phoneMockScreen { display: contents; }

/* ── Phone frame active ── */
body.viewport-mobile #phoneMockShell {
  display: flex;
  flex-direction: column;
  width: var(--mobile-w, 393px);
  flex-shrink: 0;
  border-radius: 46px;
  border: 10px solid #252535;
  outline: 2px solid #111;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.06),
    0 0 0 1px #0a0a0a,
    0 30px 90px rgba(0,0,0,.8),
    0 0 60px rgba(120,0,200,.15);
  /* overflow removed: it broke position:sticky inside #phoneMockScreen */
  background: var(--bg, #0d0820);
}
/* Inner clip wrapper: rounds corners visually WITHOUT creating scroll/overflow context
   that would break position:sticky. clip-path clips but never acts as a scroll container. */
body.viewport-mobile #phoneMockClip {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  position: relative; /* 讓底部抽屜/背景遮罩以此為定位基準，不被 clip-path 裁到框外 */
  clip-path: inset(0 round 36px); /* 46px shell radius − 10px border = 36px inner */
}
body.viewport-mobile #phoneMockTopBar {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  flex-shrink: 0;
  background: #000;
}
body.viewport-mobile #phoneMockTopBar::after {
  content: '';
  display: block;
  width: 118px;
  height: 34px;
  background: #000;
  border: 1.5px solid #222;
  border-radius: 20px;
}
body.viewport-mobile #phoneMockScreen {
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  max-height: min(calc(var(--mobile-h, 852px) - 74px), calc(100dvh - 170px));
}
body.viewport-mobile #phoneMockScreen::-webkit-scrollbar { width: 2px; }
body.viewport-mobile #phoneMockScreen::-webkit-scrollbar-track { background: transparent; }
body.viewport-mobile #phoneMockScreen::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }
body.viewport-mobile #phoneMockHomeBar {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  flex-shrink: 0;
  background: var(--bg, #0d0820);
}
body.viewport-mobile #phoneMockHomeBar::after {
  content: '';
  display: block;
  width: 130px;
  height: 5px;
  background: rgba(255,255,255,.22);
  border-radius: 3px;
}
body.viewport-mobile .modal-dialog {
  margin: 8px auto !important;
  max-width: calc(var(--mobile-w, 393px) - 16px) !important;
}

/* ── Navbar: keep on one tidy row at narrow width ── */
body.viewport-mobile .navbar { padding: 8px 0; }
body.viewport-mobile .navbar .container-fluid { padding-left: 12px !important; padding-right: 12px !important; flex-wrap: nowrap; min-width: 0; }
/* Brand shrinks with ellipsis instead of pushing buttons off-screen */
body.viewport-mobile .navbar-brand {
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex-shrink: 1;
}
body.viewport-mobile .navbar-brand .me-2 { margin-right: .3rem !important; }
/* Button cluster: never wrap, tight gaps, icons stay square */
body.viewport-mobile .navbar .ms-auto { gap: 6px !important; flex-shrink: 0; flex-wrap: nowrap; }
body.viewport-mobile .navbar .btn { white-space: nowrap; flex-shrink: 0; }
body.viewport-mobile .sync-status { display: none; }
body.viewport-mobile .brand-suffix { font-size: 0.75rem; display: inline; }
body.viewport-mobile #btnViewportToggle { display: none !important; }
body.viewport-mobile #btnPreviewBuyer { display: none !important; }
body.viewport-mobile #userBadge .fa-user-circle { display: none !important; }
body.viewport-mobile #btnPreviewBuyer .btn-label { display: none; }
body.viewport-mobile .visitor-counter { display: none !important; }
/* User badge compact */
body.viewport-mobile .user-badge { font-size: .76rem; flex-shrink: 0; }
body.viewport-mobile .user-badge #usernameDisplay { max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
body.viewport-mobile .notif-bell { flex-shrink: 0; }
body.viewport-mobile #guestNav { flex-shrink: 0; gap: 6px !important; }
body.viewport-mobile .preview-banner-inner { flex-wrap: wrap; font-size: .8rem; padding: 6px 12px; }
body.viewport-mobile .nav-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
body.viewport-mobile .nav-tabs::-webkit-scrollbar { display: none; }
body.viewport-mobile .nav-tabs .nav-link { white-space: nowrap; padding: 8px 12px; font-size: .88rem; }
body.viewport-mobile .container-fluid.px-4 { padding-left: 12px !important; padding-right: 12px !important; }
body.viewport-mobile #pageContent { margin-top: 0 !important; }
body.viewport-mobile .filter-bar { gap: 8px !important; }
body.viewport-mobile .filter-tags-wrap { position: relative; width: 100%; order: -1; }
body.viewport-mobile .filter-tags-wrap::after {
  content: ''; position: absolute; right: 0; top: 0; bottom: 0;
  width: 36px; background: linear-gradient(to right, transparent, var(--bg));
  pointer-events: none; z-index: 1;
}
body.viewport-mobile .filter-tags { flex-wrap: nowrap !important; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; width: 100%; padding-bottom: 2px; }
body.viewport-mobile .filter-tags::-webkit-scrollbar { display: none; }
body.viewport-mobile .filter-tags .filter-tag { flex-shrink: 0; }
body.viewport-mobile .filter-bar .input-group { width: auto !important; flex: 1; min-width: 80px; }
body.viewport-mobile .product-sub-tabs { flex-wrap: nowrap !important; gap: 6px; justify-content: space-between; align-items: center; overflow: hidden; padding-top: .35rem !important; padding-bottom: .35rem !important; }
body.viewport-mobile #mainTabs { padding-top: .35rem !important; }
body.viewport-mobile .product-sub-tab:not(.active) { display: none !important; }
body.viewport-mobile .product-sub-tab { white-space: nowrap; height: 30px; box-sizing: border-box; padding: 0 .85rem; display: flex; align-items: center; justify-content: center; font-size: .875rem; }
body.viewport-mobile .product-sub-tab.active::after { content: ' ⇄'; opacity: .65; font-size: .8em; }
body.viewport-mobile .product-sub-tabs .market-suffix { display: none; }
body.viewport-mobile .product-sub-tabs > div:last-child { flex-wrap: nowrap !important; flex-shrink: 0; gap: 8px; align-items: center; }
body.viewport-mobile .product-sub-tabs .view-btn,
body.viewport-mobile .product-sub-tabs .view-btn-used,
body.viewport-mobile .product-sub-tabs #btnHideSoldOut,
body.viewport-mobile .product-sub-tabs #btnThemeToggle,
body.viewport-mobile .product-sub-tabs #btnPromoMode { height: 30px !important; box-sizing: border-box !important; padding: 0 .4rem !important; display: flex !important; align-items: center !important; justify-content: center !important; font-size: .875rem; }
body.viewport-mobile .product-sub-tabs .btn-label { display: none; }
body.viewport-mobile #btnMobileSearch {
  display: flex !important;
  height: 30px;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  padding: 0 .5rem;
  font-size: .875rem;
}
/* 放大鏡就地搜尋：覆蓋整排，不擠壓其他按鈕 */
body.viewport-mobile .product-sub-tabs.searching #mobileInlineSearch {
  display: flex;
  align-items: center;
  gap: 6px;
  position: absolute;
  inset: 0;
  z-index: 5;
  background: var(--bg);
  padding: 0 8px;
}
body.viewport-mobile #mobileInlineSearch i { color: var(--text-muted); font-size: .9rem; flex-shrink: 0; }
body.viewport-mobile #mobileSearchInput {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  height: 30px;
  padding: 0 8px;
  color: var(--text);
  font-size: 16px;
}
body.viewport-mobile #mobileSearchClose {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
}
/* #btnScrape 搬到「新品⇄中古」排：覆蓋 .notif-bell 的圓形大尺寸，改成與同排按鈕一致的緊湊尺寸 */
body.viewport-mobile .product-sub-tabs #btnScrape {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
body.viewport-mobile .product-sub-tabs #btnScrape i { font-size: .8rem; }
body.viewport-mobile #fabFilter { display: flex; position: absolute; right: 16px; bottom: 62px; }
/* 底部篩選抽屜／背景遮罩：以 #phoneMockClip 為定位基準，避免被 clip-path 裁到手機框外 */
body.viewport-mobile #mobileFilterSheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 80%;
  height: auto;
}
body.viewport-mobile #phoneMockClip > .offcanvas-backdrop {
  position: absolute;
  inset: 0;
  /* Bootstrap 預設用 100vw/100vh（相對瀏覽器視窗，不是容器），
     蓋掉才能讓遮罩跟著 inset:0 貼合 #phoneMockClip 而非整個視窗 */
  width: 100%;
  height: 100%;
}
/* ── 行事曆圖例：壓成單一橫向捲動列（手機模擬器） ── */
body.viewport-mobile .calendar-legend-inner {
  flex-wrap: nowrap !important;
  overflow-x: auto;
  overflow-y: hidden;
  gap: .4rem !important;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
body.viewport-mobile .calendar-legend-inner::-webkit-scrollbar { display: none; }
body.viewport-mobile .calendar-legend-inner > * { flex-shrink: 0; }
body.viewport-mobile .calendar-legend span { font-size: .72rem; }
body.viewport-mobile .legend-toggle, body.viewport-mobile .calendar-fav-toggle { padding: 2px 6px; }
body.viewport-mobile .legend-dot { width: 8px; height: 8px; }
body.viewport-mobile .calendar-legend { padding-top: .35rem; padding-bottom: .35rem; margin-bottom: .4rem !important; }

body.viewport-mobile .date-full { display: none; }
body.viewport-mobile .date-short { display: inline; }
body.viewport-mobile .order-card { padding: 12px; }
body.viewport-mobile .order-card-header { flex-wrap: wrap; gap: 6px; }
body.viewport-mobile .order-items-table { font-size: .8rem; }
body.viewport-mobile .order-admin-actions { flex-wrap: wrap; }
body.viewport-mobile .msg-thread-row { padding: 10px 12px; }
body.viewport-mobile .msg-bubble { max-width: 88%; }
body.viewport-mobile .msg-thread-body { max-height: 50vh; }
body.viewport-mobile .product-grid.view-list { grid-template-columns: 1fr; }

/* Duplicate 576px rules (most phones are ≤430px) */
body.viewport-mobile .product-grid.standard,
body.viewport-mobile .product-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
body.viewport-mobile .product-grid.view-compact { grid-template-columns: repeat(3, 1fr) !important; gap: 6px; }
body.viewport-mobile .product-grid.view-list { grid-template-columns: 1fr !important; }
body.viewport-mobile .card-title { font-size: .8rem; }
body.viewport-mobile .card-price { font-size: .85rem; }

/* Watchlist: stack product grid above cost panel (mirror of 1099px breakpoint).
   Without this the 400px fixed cost column squeezes the product grid to 0 width. */
body.viewport-mobile .watchlist-body { flex-direction: column; }
body.viewport-mobile .watchlist-cost-col { width: 100%; position: static; max-height: none; padding: 14px; }
body.viewport-mobile .export-bar { padding: 10px 12px; }
body.viewport-mobile .export-bar .ms-auto { width: 100%; margin-left: 0 !important; flex-wrap: wrap; }
body.viewport-mobile .export-buyer-input { width: 100% !important; }

/* Account page: single column + 2-col stats at narrow width */
body.viewport-mobile .acct-records-card { grid-column: span 1; }
body.viewport-mobile .acct-stats { grid-template-columns: repeat(2, 1fr); }

/* Notification drawer — overlays inside the phone shell */
body.viewport-mobile #phoneMockShell { position: relative; }
body.viewport-mobile .notif-drawer {
  position: absolute !important;
  top: 0; bottom: 0;
  right: -100% !important;
  width: 88% !important;
  max-width: none !important;
  margin: 0 !important;
  height: auto !important;
  border-radius: 0;
  z-index: 200;
}
body.viewport-mobile .notif-drawer.open { right: 0 !important; }

/* ════════════════════════════════════════════════════════
   Touch-friendly upgrades (ui-ux-pro-max guidelines)
   Targets ≥44px, gaps ≥8px, dvh units, reduced-motion safe.
   Scoped to mobile mode only — desktop stays compact.
   ════════════════════════════════════════════════════════ */

/* Touch Target Size: min 44×44px for all icon buttons */
body.viewport-mobile .view-btn,
body.viewport-mobile .view-btn-used {
  width: 44px; height: 44px; font-size: 1rem;
}
body.viewport-mobile .notif-bell { width: 44px; height: 44px; }
body.viewport-mobile .notif-bell i { font-size: 1.25rem; }
body.viewport-mobile .navbar .btn-sm { min-height: 44px; min-width: 44px; }
body.viewport-mobile #btnRefreshRate,
body.viewport-mobile .btn-rate-refresh { min-height: 44px; min-width: 44px; padding: 6px 12px; }

/* Filter chips: tappable height + spacing */
body.viewport-mobile .filter-tag {
  min-height: 40px;
  padding: 0.5rem 0.9rem;
  display: inline-flex;
  align-items: center;
  font-size: .85rem;
}
body.viewport-mobile .filter-tags { gap: 8px; }

/* Quantity steppers on cards: enlarge from 22px */
body.viewport-mobile .qty-btn { width: 44px; height: 44px; font-size: 1rem; }
body.viewport-mobile .qty-value { min-width: 30px; font-size: .95rem; }

/* Favourite heart: bigger tap area */
body.viewport-mobile .fav-btn { width: 40px; height: 40px; font-size: 1.15rem; }
body.viewport-mobile .watch-btn { width: 40px; height: 40px; font-size: 1.15rem; }
body.viewport-mobile .shopee-listed-btn { width: 40px; height: 40px; font-size: 1.05rem; }

/* Touch Spacing: ≥8px between adjacent view buttons */
body.viewport-mobile .product-sub-tabs .d-flex.gap-1,
body.viewport-mobile .export-bar .gap-1 { gap: 8px !important; }

/* Device picker buttons: tappable */
body.viewport-mobile .mdp-btn { min-height: 42px; }
body.viewport-mobile .mdp-exit { min-height: 42px; }

/* Viewport Units: use dvh so mobile browser chrome doesn't clip */
body.viewport-mobile .msg-thread-body { max-height: 50dvh; }
body.viewport-mobile .cost-panel { max-height: none; }

/* Pull-to-refresh / overscroll containment */
body.viewport-mobile { overscroll-behavior-y: contain; }

/* Readable body text on mobile (≥16px to avoid iOS input zoom) */
body.viewport-mobile .form-control,
body.viewport-mobile .form-select,
body.viewport-mobile input,
body.viewport-mobile textarea { font-size: 16px !important; }

/* Respect reduced-motion preference — global */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Device picker bar — fixed at bottom, always on top */
#mobileDevicePicker {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 9000;
  background: rgba(15,5,25,.95);
  border-top: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(12px);
  padding: 8px 16px;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
body.viewport-mobile #mobileDevicePicker { display: flex; }

.mdp-devices {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.mdp-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.65);
  font-size: .73rem;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.3;
  transition: all .15s;
  white-space: nowrap;
}
.mdp-btn span { font-size: .63rem; opacity: .5; }
.mdp-btn:hover { border-color: var(--accent); color: #fff; }
.mdp-btn.active { border-color: var(--accent); background: rgba(200,80,192,.2); color: #fff; }

.mdp-label {
  font-size: .72rem;
  color: rgba(255,255,255,.35);
  margin-left: auto;
  white-space: nowrap;
}
.mdp-exit {
  padding: 5px 12px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: .78rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}

/* ── 貼網址匯入商品 Modal：圖片候選縮圖 ── */
.import-img-candidate {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .15s;
}
.import-img-candidate:hover { border-color: rgba(255,255,255,.35); }
.import-img-candidate.selected { border-color: var(--accent); }

/* ── 管理員「買家關注清單」Modal：卡片橫向排版與文字截斷修正 ── */
#adminUserFavoritesModal .card { overflow: hidden; }
#adminUserFavoritesModal .card-body {
  flex-direction: row;
  align-items: center;
}
#adminUserFavoritesModal .fav-modal-info { min-width: 0; }
#adminUserFavoritesModal .admin-fav-card { cursor: pointer; }
#adminUserFavoritesModal .admin-fav-card:hover { border-color: var(--accent) !important; }
.mdp-exit:hover { background: var(--accent); border-color: var(--accent); }

/* ── 買家購物指南與下單流程 Modal ── */
.guide-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.guide-step-card {
  position: relative;
  background: var(--surface, #1e1e2d);
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  transition: transform 0.2s, border-color 0.2s;
}
.guide-step-card:hover {
  border-color: var(--accent, #c850c0);
  transform: translateY(-2px);
}
.guide-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent, #c850c0), var(--accent2, #4158d0));
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.guide-step-content {
  flex: 1;
  min-width: 0;
}
.guide-step-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text, #fff);
  margin-bottom: 4px;
}
.guide-step-desc {
  font-size: 0.78rem;
  color: var(--text-muted, #999);
  line-height: 1.45;
}
.text-purple {
  color: #a855f7 !important;
}
/* 站內信：管理員訊息的「管理員」標籤，讓買家辨識店家本人 */
.msg-admin-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: .66rem;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  vertical-align: middle;
  white-space: nowrap;
}
.msg-admin-badge i { font-size: .62rem; margin-right: 2px; }

/* ── FAQ & Trust Modal CSS ── */
#faqTrustModal .modal-content {
  background-color: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border);
}
.faq-nav-tabs .nav-link {
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all .2s;
}
.faq-nav-tabs .nav-link:hover {
  color: var(--accent);
  border-bottom-color: rgba(88,166,255,0.4);
}
.faq-nav-tabs .nav-link.active {
  color: var(--accent) !important;
  background: transparent !important;
  border-bottom: 2px solid var(--accent) !important;
}
.anidar-footer {
  background: transparent;
}
.anidar-footer a:hover {
  color: var(--accent) !important;
}

/* ── Message Attachment Images ── */
.msg-image-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.msg-img-thumb {
  width: 90px;
  height: 90px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.msg-img-thumb:hover {
  transform: scale(1.05);
  border-color: var(--accent);
}
.img-preview-chip {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--accent);
  background: var(--surface2);
}
.img-preview-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.img-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  border: none;
  font-size: 10px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.img-preview-remove:hover {
  background: #f85149;
}

/* ── Watchlist Keyword Auto-Tracking CSS ── */
.badge-system-recommended {
  background: linear-gradient(135deg, #8a2be2, #6f42c1) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 10px rgba(138, 43, 226, 0.4);
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 6px;
}
.kw-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.82rem;
}
.kw-chip .btn-kw-del {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.75rem;
  transition: color 0.15s;
}
.kw-chip .btn-kw-del:hover {
  color: #f85149;
}
