/* ==========================================================================
   Edge Store Template - 旗艦高質感主題樣式表 (PREMIUM MULTI-THEME EDITION)
   支援 4 款精選商業主題：
     1. oat (溫潤燕麥奶茶 - 預設)
     2. forest (沉靜森綠大地)
     3. minimal (現代純黑極簡)
     4. ocean (商務深邃湛藍)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;600;700;800;900&family=Outfit:wght@400;500;600;700;800;900&display=swap');


:root,
html[data-theme="oat"] {
  /* 預設主題：溫潤燕麥奶茶 (Warm Oatmeal & Taupe) */
  --bg-body: #F9F8F6;
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #F5EFEB;
  --bg-glass: rgba(249, 248, 246, 0.92);
  --border-subtle: #EFE9E3;
  --border-medium: #D9CFC7;
  --border-active: #C5B099;
  --primary: #C5B099;
  --primary-hover: #B09B85;
  --primary-dark: #8C755B;
  --text-main: #3D352F;
  --text-muted: #8C8279;
  --text-light: #B5ABA2;
  --text-white: #FFFFFF;
  --success: #10B981;
  --danger: #EF4444;
  --danger-bg: #FEF2F2;
  --shadow-sm: 0 2px 8px rgba(61, 53, 47, 0.04);
  --shadow-md: 0 8px 20px rgba(61, 53, 47, 0.06);
  --shadow-lg: 0 16px 36px rgba(61, 53, 47, 0.08);
  --shadow-glow: 0 0 0 3px rgba(197, 176, 153, 0.25);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;
  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

html[data-theme="forest"] {
  /* 沉靜森綠大地 (Forest Green & Earth Olive) */
  --bg-body: #F4F6F4;
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #E8ECE8;
  --bg-glass: rgba(244, 246, 244, 0.92);
  --border-subtle: #DDE2DD;
  --border-medium: #C0C9C0;
  --border-active: #335238;
  --primary: #335238;
  --primary-hover: #263E2A;
  --primary-dark: #1A2A1D;
  --text-main: #202A22;
  --text-muted: #647566;
  --text-light: #98A79A;
  --shadow-sm: 0 2px 8px rgba(32, 42, 34, 0.04);
  --shadow-md: 0 8px 20px rgba(32, 42, 34, 0.06);
  --shadow-lg: 0 16px 36px rgba(32, 42, 34, 0.08);
  --shadow-glow: 0 0 0 3px rgba(51, 82, 56, 0.25);
}

html[data-theme="minimal"] {
  /* 現代純黑極簡 (Monochrome Minimalist) */
  --bg-body: #FAFAFA;
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #F4F4F5;
  --bg-glass: rgba(250, 250, 250, 0.92);
  --border-subtle: #E4E4E7;
  --border-medium: #D4D4D8;
  --border-active: #18181B;
  --primary: #18181B;
  --primary-hover: #27272A;
  --primary-dark: #09090B;
  --text-main: #18181B;
  --text-muted: #71717A;
  --text-light: #A1A1AA;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 0 3px rgba(24, 24, 27, 0.15);
}

html[data-theme="ocean"] {
  /* 商務深邃湛藍 (Corporate Deep Ocean) */
  --bg-body: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #F1F5F9;
  --bg-glass: rgba(248, 250, 252, 0.92);
  --border-subtle: #E2E8F0;
  --border-medium: #CBD5E1;
  --border-active: #1D4ED8;
  --primary: #1D4ED8;
  --primary-hover: #1E40AF;
  --primary-dark: #1E3A8A;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 20px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 16px 36px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 0 0 3px rgba(29, 78, 216, 0.25);
}

html[data-theme="sunset"] {
  /* 暖陽赤茶 (Canyon Clay / Terracotta) */
  --bg-body: #FCF9F8;
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #F7EEEB;
  --bg-glass: rgba(252, 249, 248, 0.92);
  --border-subtle: #EADCD7;
  --border-medium: #D9BEB5;
  --border-active: #C97B63;
  --primary: #C97B63;
  --primary-hover: #B06751;
  --primary-dark: #8E4E3C;
  --text-main: #3B2E2A;
  --text-muted: #85726B;
  --text-light: #B3A19A;
  --shadow-sm: 0 2px 8px rgba(59, 46, 42, 0.04);
  --shadow-md: 0 8px 20px rgba(59, 46, 42, 0.06);
  --shadow-lg: 0 16px 36px rgba(59, 46, 42, 0.08);
  --shadow-glow: 0 0 0 3px rgba(201, 123, 99, 0.25);
}

html[data-theme="lavender"] {
  /* 優雅紫羅蘭 (Orchid / Elegant Purple) */
  --bg-body: #FAFAFC;
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #F2F1F7;
  --bg-glass: rgba(250, 250, 252, 0.92);
  --border-subtle: #E3E1EC;
  --border-medium: #C9C6D9;
  --border-active: #857DB1;
  --primary: #857DB1;
  --primary-hover: #6C6496;
  --primary-dark: #534D7A;
  --text-main: #2D2A3B;
  --text-muted: #726D85;
  --text-light: #A5A0B8;
  --shadow-sm: 0 2px 8px rgba(45, 42, 59, 0.04);
  --shadow-md: 0 8px 20px rgba(45, 42, 59, 0.06);
  --shadow-lg: 0 16px 36px rgba(45, 42, 59, 0.08);
  --shadow-glow: 0 0 0 3px rgba(133, 125, 177, 0.25);
}

html[data-theme="matcha"] {
  /* 初春抹茶 (Muted Green / Sage) */
  --bg-body: #FAFBF9;
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #F1F4EE;
  --bg-glass: rgba(250, 251, 249, 0.92);
  --border-subtle: #DEE4D9;
  --border-medium: #C1CCB9;
  --border-active: #7A966E;
  --primary: #7A966E;
  --primary-hover: #647D59;
  --primary-dark: #4B6141;
  --text-main: #2C3627;
  --text-muted: #6C7A65;
  --text-light: #9DA897;
  --shadow-sm: 0 2px 8px rgba(44, 54, 39, 0.04);
  --shadow-md: 0 8px 20px rgba(44, 54, 39, 0.06);
  --shadow-lg: 0 16px 36px rgba(44, 54, 39, 0.08);
  --shadow-glow: 0 0 0 3px rgba(122, 150, 110, 0.25);
}

html[data-theme="midnight"] {
  /* 午夜曜黑 (Gilded Noir / High-Tech Neon on Dark) */
  --bg-body: #0B0B0F;
  --bg-surface: #15151B;
  --bg-surface-alt: #1F1F27;
  --bg-glass: rgba(11, 11, 15, 0.92);
  --border-subtle: #2A2A35;
  --border-medium: #3F3F4D;
  --border-active: #D4AF37;
  --primary: #D4AF37;
  --primary-hover: #E3C35B;
  --primary-dark: #AA8B29;
  --text-main: #F5F0E6;
  --text-muted: #A3A3B0;
  --text-light: #737385;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.9);
  --shadow-glow: 0 0 0 3px rgba(212, 175, 55, 0.25);
}

html[data-theme="sand"] {
  /* 荒漠裸色 (Boho / Safari / Earthy Neutral) */
  --bg-body: #FDFBF7;
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #F7F3EB;
  --bg-glass: rgba(253, 251, 247, 0.92);
  --border-subtle: #EAE3D4;
  --border-medium: #D4C7AE;
  --border-active: #B19F81;
  --primary: #B19F81;
  --primary-hover: #968569;
  --primary-dark: #70624A;
  --text-main: #4A4336;
  --text-muted: #8F8472;
  --text-light: #C2B7A5;
  --shadow-sm: 0 2px 8px rgba(74, 67, 54, 0.03);
  --shadow-md: 0 8px 20px rgba(74, 67, 54, 0.05);
  --shadow-lg: 0 16px 36px rgba(74, 67, 54, 0.07);
  --shadow-glow: 0 0 0 3px rgba(177, 159, 129, 0.25);
}

html[data-theme="berry"] {
  /* 勃根地酒紅 (Deep Plum & Champagne / Burgundy Luxury) */
  --bg-body: #FCF8F9;
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #F7EFF2;
  --bg-glass: rgba(252, 248, 249, 0.92);
  --border-subtle: #EADBDF;
  --border-medium: #D1B8C0;
  --border-active: #8A2E4B;
  --primary: #8A2E4B;
  --primary-hover: #70223A;
  --primary-dark: #521528;
  --text-main: #3D1B25;
  --text-muted: #8A5F6B;
  --text-light: #B8929D;
  --shadow-sm: 0 2px 8px rgba(61, 27, 37, 0.04);
  --shadow-md: 0 8px 20px rgba(61, 27, 37, 0.06);
  --shadow-lg: 0 16px 36px rgba(61, 27, 37, 0.08);
  --shadow-glow: 0 0 0 3px rgba(138, 46, 75, 0.25);
}


/* 基礎重設 */
html {
  scrollbar-gutter: stable;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   0. 全局向量 SVG 圖示規範 (Designer Icon System)
   ========================================================================== */
.icon-svg {
  width: 1.25em;
  height: 1.25em;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
  flex-shrink: 0;
  display: inline-block;
  transition: transform var(--transition-fast);
}

.icon-sm {
  width: 1.05em;
  height: 1.05em;
}

.icon-xs {
  width: 0.9em;
  height: 0.9em;
}

.icon-xl {
  width: 2.85rem;
  height: 2.85rem;
  stroke-width: 1.8;
  color: var(--primary-dark);
}

.icon-header {
  width: 1.55rem;
  height: 1.55rem;
  stroke-width: 2.2;
  color: var(--primary-dark);
}

.modal-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-with-icon {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ==========================================================================
   1. 頂部精緻導覽列 (Site Header)
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.65rem 1.5rem;
  transition: all var(--transition-normal);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* Logo 區域 */
.logo-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.logo-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

body.admin-mode .logo-link {
  cursor: default;
}

.logo-text {
  font-size: 1.65rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--text-main);
  user-select: text;
  -webkit-user-select: text;
}

.logo-accent {
  color: var(--primary-dark);
  font-weight: 700;
  margin-left: 2px;
}

/* 模式切換器 (精緻純圖示膠囊：👤 顧客 / 🔒 店長) */
.mode-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 3px;
  box-shadow: var(--shadow-sm);
  gap: 2px;
}

.mode-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mode-btn .mode-icon {
  width: 1.2rem;
  height: 1.2rem;
  stroke-width: 2.2;
}

.mode-btn:hover {
  color: var(--primary-dark);
  background: rgba(201, 181, 156, 0.15);
}

.mode-btn.active {
  background: var(--primary);
  color: var(--text-white);
  box-shadow: 0 2px 8px rgba(201, 181, 156, 0.45);
}

/* ==========================================================================
   2. 店長管理模式操作列 (Admin Action Bar)
   ========================================================================== */
.admin-action-bar {
  background: var(--primary-dark);
  color: var(--text-white);
  padding: 0.85rem 1.5rem;
  box-shadow: var(--shadow-md);
  animation: slideDown 0.3s ease-out;
}

.admin-bar-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  background: #34D399;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.3);
  animation: pulse 2s infinite;
}

.admin-status-text {
  font-size: 1.05rem;
  font-weight: 700;
}

.admin-actions-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-senior-admin-sub {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  backdrop-filter: blur(8px);
}

.btn-senior-admin-sub:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.45);
  transform: translateY(-1px);
}

.btn-senior-admin-sub .icon-svg {
  width: 1.1rem;
  height: 1.1rem;
  stroke-width: 2.2;
}

.btn-senior-add-main {
  background: var(--bg-surface);
  color: var(--primary-dark);
  border: none;
  font-size: 1.05rem;
  font-weight: 800;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-senior-add-main:hover {
  transform: translateY(-2px);
  background: var(--bg-surface-alt);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
}

.btn-senior-add-main .icon-svg {
  width: 1.25rem;
  height: 1.25rem;
  stroke-width: 2.6;
}

/* ==========================================================================
   3. 全局 CMS 編輯觸發按鈕 (Edit Trigger Buttons)
   ========================================================================== */
.module-container {
  position: relative;
  transition: all var(--transition-normal);
}

.edit-trigger-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 20;
  background: var(--primary-dark);
  color: var(--text-white);
  border: 2px solid var(--bg-surface);
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.96rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(74, 67, 62, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.edit-trigger-btn .icon-svg {
  width: 1.1em;
  height: 1.1em;
  stroke-width: 2.2;
}

.edit-trigger-btn:hover {
  background: var(--text-main);
  transform: scale(1.05);
}

/* 店長模式下常駐顯示 */
.admin-mode .module-container {
  border-radius: var(--radius-lg);
}

.admin-mode .module-container .edit-trigger-btn {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* Logo 專用位置 */
#logoModule .edit-trigger-btn {
  top: -6px;
  left: calc(100% + 14px);
  right: auto;
}

/* 分類專用位置 */
.edit-cat-btn {
  top: -46px;
  right: 0;
}

/* ==========================================================================
   4. 主頁 Bento Box 排版 (Hero & Store Info)
   ========================================================================== */
.hero-bento-section {
  width: 100%;
  max-width: 1280px;
  margin: 1.5rem auto 2.5rem auto;
  padding: 0 1.5rem;
}

.hero-bento-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  grid-template-rows: auto auto;
  gap: 1.5rem;
  align-items: stretch;
}

.bento-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.bento-box:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-medium);
}

/* 1. 主視覺圖片區塊 (寬版在左側跨兩列) */
.hero-image-box {
  grid-column: 1 / 2;
  grid-row: 1 / 3;
  padding: 0;
  background: var(--bg-surface-alt);
  min-height: 380px;
  display: flex;
  flex-direction: column;
}

.hero-image-box .image-wrapper {
  flex: 1;
  width: 100%;
  height: 100%;
  display: flex;
}

/* 2. 標語文案區塊 (寬版在右上) */
.hero-text-box {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
  padding: 2.75rem 2.75rem 2rem 2.75rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-tag-badge {
  display: inline-block;
  background: var(--bg-surface-alt);
  color: var(--primary-dark);
  font-size: 0.88rem;
  font-weight: 800;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  width: fit-content;
  margin-bottom: 1.25rem;
  letter-spacing: 0.5px;
}

.hero-title {
  font-size: 2.85rem;
  font-weight: 900;
  line-height: 1.2;
  color: var(--text-main);
  margin-bottom: 1.2rem;
  letter-spacing: -0.5px;
}

.hero-title .highlight {
  color: var(--primary);
  display: inline-block;
}

.hero-subtitle {
  font-size: 1.12rem;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 95%;
}

/* 3. 門市營業資訊區塊 (寬版在右下) */
.hero-info-box {
  grid-column: 2 / 3;
  grid-row: 2 / 3;
  padding: 1.75rem 2.75rem;
  background: var(--bg-surface);
}

.info-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.info-box-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.info-box-status {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--bg-surface-alt);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.info-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  font-size: 1.05rem;
  color: var(--text-main);
  line-height: 1.5;
}

.info-item .icon-svg {
  margin-top: 0.15rem;
  color: var(--primary-dark);
}

.info-label {
  font-weight: 800;
  color: var(--primary-dark);
  white-space: nowrap;
  min-width: 76px;
}

.info-value {
  font-weight: 600;
  color: var(--text-main);
  word-break: break-word;
}

.info-link {
  color: var(--text-main);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color var(--transition-fast);
}

.info-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.info-link .icon-xs {
  color: var(--primary-dark);
}

.image-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 380px;
  background: linear-gradient(135deg, var(--bg-surface-alt) 0%, #EFE8E1 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
  box-sizing: border-box;
  transition: all 0.25s ease;
}

/* 一般顧客模式下：空白圖片框維持高質感的大地色極簡底框，100% 隱藏任何提示 */
.hero-placeholder-inner {
  display: none !important;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* 店長模式下：顯示上傳相機圖示與提示按鈕 */
body.admin-mode .hero-image-placeholder {
  cursor: pointer;
  border: 2px dashed var(--border-medium);
}

body.admin-mode .hero-image-placeholder:hover {
  background: #EDE6E0;
  border-color: var(--primary);
  color: var(--primary-dark);
}

body.admin-mode .hero-placeholder-inner {
  display: flex !important;
}

.hero-placeholder-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-dark);
  margin-bottom: 4px;
}

.hero-placeholder-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.hero-placeholder-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==========================================================================
   5. 控制列 (分類標籤與搜尋)
   ========================================================================== */
.controls-section {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto 2rem auto;
  padding: 0 1.5rem;
}

.controls-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  background: var(--bg-surface);
  padding: 1.25rem 1.75rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  flex: 1;
}

.pill-btn {
  background: var(--bg-surface-alt);
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 9px 20px;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.pill-btn:hover {
  background: #EDE6E0;
  color: var(--text-main);
}

.pill-btn.active {
  background: var(--primary);
  color: var(--text-white);
  box-shadow: 0 2px 8px rgba(201, 181, 156, 0.4);
}

/* 店長模式下的複合分類藥丸（具備超寬敞的左側篩選點擊區域與 active 狀態） */
.category-pill-admin-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-alt);
  border: 1.5px solid var(--border-medium);
  padding: 6px 10px 6px 30px; /* 大幅加大左側點擊跳轉區域（黃框區） */
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  min-height: 42px;
  position: relative;
}

/* 左側精緻的標籤指示圓點，明確引導店長此處為切換分類點擊區 */
.category-pill-admin-item::before {
  content: '';
  position: absolute;
  left: 13px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-light);
  opacity: 0.5;
  transition: all 0.2s ease;
  pointer-events: none;
}

.category-pill-admin-item:hover::before {
  background: var(--primary);
  opacity: 1;
  transform: scale(1.3);
}

.category-pill-admin-item:hover {
  background: #EDE6E0;
  border-color: var(--primary);
  transform: translateY(-1px);
}

.category-pill-admin-item.active {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #FFFFFF;
  box-shadow: 0 3px 12px rgba(74, 67, 62, 0.35);
}

.category-pill-admin-item.active::before {
  background: #FFFFFF;
  opacity: 1;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
}

.category-pill-admin-item.active .cat-name-input {
  color: #FFFFFF !important;
  background: rgba(255, 255, 255, 0.18) !important;
  outline-color: rgba(255, 255, 255, 0.6) !important;
}

.category-pill-admin-item.active .cat-del-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

.category-pill-admin-item.active .cat-del-btn:hover {
  background: #EF4444;
  color: #FFFFFF;
}

.category-pill-admin-item .cat-name-input {
  cursor: text !important;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  outline: 1.5px dashed #EF4444 !important;
  outline-offset: 0 !important;
  padding: 1px 5px !important;
  border-radius: 4px !important;
  background: rgba(239, 68, 68, 0.05) !important;
  min-width: unset !important;
  display: inline-block;
  transition: all 0.2s ease;
  user-select: text;
}

.category-pill-admin-item .cat-name-input:hover {
  background: rgba(239, 68, 68, 0.15) !important;
}

.category-pill-admin-item .cat-name-input:focus {
  outline: 2px solid #DC2626 !important;
  background: #FFFFFF !important;
  color: var(--text-main) !important;
}

.category-pill-admin-item .cat-del-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(239, 68, 68, 0.12);
  color: #DC2626;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
}

.category-pill-admin-item .cat-del-btn:hover {
  background: #DC2626;
  color: #FFFFFF;
  transform: scale(1.15);
}

.category-pill-admin-item .cat-del-btn .icon-svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.6;
}

/* 店長模式：未分類暫存警示標籤與選單 */
.category-pill-admin-item.uncat-pill {
  background: #FEF3C7 !important;
  border-color: #F59E0B !important;
  color: #B45309 !important;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.18) !important;
}

.category-pill-admin-item.uncat-pill::before {
  display: none !important;
}

.category-pill-admin-item.uncat-pill:hover {
  background: #FDE68A !important;
  border-color: #D97706 !important;
}

.category-pill-admin-item.uncat-pill.active {
  background: #D97706 !important;
  border-color: #B45309 !important;
  color: #FFFFFF !important;
}

.inline-cat-select.uncat-select {
  background: #FEF3C7 !important;
  border-color: #F59E0B !important;
  color: #B45309 !important;
  font-weight: 800 !important;
}

/* 行內新增分類藥丸按鈕 */
.btn-inline-add-cat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.06);
  border: 1.5px dashed #EF4444;
  color: #DC2626;
  font-size: 0.92rem;
  font-weight: 800;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-inline-add-cat:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: #DC2626;
  transform: translateY(-1px);
}

.btn-inline-add-cat .icon-svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.8;
}

/* 搜尋框 */
.search-box-wrapper {
  min-width: 280px;
}

.search-input-inner {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon-box {
  position: absolute;
  left: 14px;
  color: var(--text-light);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.search-input-inner input {
  width: 100%;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 38px 10px 42px;
  border-radius: var(--radius-pill);
  outline: none;
  transition: all var(--transition-fast);
}

.search-input-inner input:focus {
  background: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.clear-search-btn {
  position: absolute;
  right: 10px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.clear-search-btn:hover {
  background: var(--primary);
  color: var(--text-white);
  border-color: var(--primary);
  transform: scale(1.08);
}

/* ==========================================================================
   6. 商品展示網格 (Product Grid)
   ========================================================================== */
.products-section {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto 5rem auto;
  padding: 0 1.5rem;
  flex: 1;
}

.products-container {
  width: 100%;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.75rem;
  width: 100%;
}

/* 商品卡片 */
.product-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-lg);
}

/* 1:1 正方形商品縮圖 */
.product-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-surface-alt);
  position: relative;
  overflow: hidden;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.product-card:hover .product-thumb img {
  transform: scale(1.06);
}

.product-no-img {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--bg-surface-alt) 0%, #EAE2D8 100%);
}

/* 商品內容 */
.product-info {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  background: var(--bg-surface);
}

.product-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
  gap: 8px;
}

/* 店長模式：卡片分類右側快速排序獨立金框圓形按鈕群 (◀ 往前 / ▶ 往後 / 👑 擺最前) */
.product-sort-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px; /* 明確安全間距，防止長輩手抖誤按 */
  background: transparent;
  padding: 0;
  border: none;
}

.sort-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid #F59E0B;
  background: #FFFBEB;
  color: #D97706;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.12);
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.sort-btn .icon-svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.4;
}

.sort-btn:hover:not(:disabled) {
  background: #F59E0B;
  color: #FFFFFF;
  border-color: #D97706;
  transform: translateY(-2px) scale(1.1);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.sort-btn:active:not(:disabled) {
  transform: scale(0.92);
}

.sort-btn:disabled {
  opacity: 0.28;
  border-color: rgba(245, 158, 11, 0.35);
  background: #FAF8F5;
  color: #C9B59C;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

.sort-btn-crown .icon-svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

/* 搜尋狀態下的微型防錯提示標籤 */
.search-sort-hint-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-surface-alt);
  border: 1px dashed var(--border-medium);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.2px;
  cursor: help;
  user-select: none;
}

.product-cat-tag {
  background: var(--bg-surface-alt);
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.product-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 0.65rem;
}

.product-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.product-card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.product-view-hint {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary-dark);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.product-view-hint .icon-svg {
  width: 1em;
  height: 1em;
  transition: transform var(--transition-fast);
}

.product-card:hover .product-view-hint .icon-svg {
  transform: translateX(4px);
}

/* 查無商品空狀態 */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 5rem 2rem;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-medium);
}

.empty-icon-box {
  margin-bottom: 1rem;
  color: var(--primary-dark);
}

.empty-icon-box .icon-svg {
  width: 3.5rem;
  height: 3.5rem;
}

.empty-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.empty-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
}

/* ==========================================
   7. 頁尾宣告 (Footer)
   ========================================== */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 2rem 1.5rem;
  margin-top: auto;
  text-align: center;
}

.footer-copy {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ==========================================
   8. 彈窗系統 (Modals - 高級燕麥長者友善)
   ========================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(74, 67, 62, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.senior-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  transform: translateY(20px) scale(0.98);
  transition: transform var(--transition-normal);
  overflow: hidden;
}

.modal-backdrop.active .senior-modal {
  transform: translateY(0) scale(1);
}

/* Modal 標題列 */
.senior-modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
}

.senior-modal-title {
  font-size: 1.55rem;
  font-weight: 900;
  color: var(--text-main);
}

.btn-close-modal {
  background: var(--bg-surface-alt);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-close-modal:hover {
  background: #E5DDD5;
  transform: rotate(90deg);
}

/* Modal 內容滾動區 (Flex: 1) */
.senior-modal-body {
  padding: 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1;
  background: var(--bg-body);
}

/* Modal 固定底部操作列 (Sticky Footer) */
.senior-modal-footer {
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.04);
  z-index: 10;
}

/* 表單元件 */
.senior-form-group {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.senior-label {
  display: block;
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 0.65rem;
  color: var(--text-main);
}

.senior-input, .senior-textarea, .senior-select {
  width: 100%;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 1.15rem;
  font-weight: 600;
  outline: none;
  transition: all var(--transition-fast);
}

.senior-input:focus, .senior-textarea:focus, .senior-select:focus {
  background: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.senior-textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.6;
}

.input-hint {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-top: 0.6rem;
}

/* 密碼輸入框組合 */
.pwd-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-toggle-pwd {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  color: var(--text-muted);
}
.btn-toggle-pwd:hover { color: var(--text-main); }

/* Face ID 快速登入區塊 (僅在 iPhone 手機顯示，電腦版預設隱藏) */
.faceid-login-container {
  display: none;
  flex-direction: column;
  margin-bottom: 0.5rem;
}

.btn-bind-faceid {
  display: none;
  position: relative;
}

body.is-iphone .faceid-login-container {
  display: flex;
}

body.is-iphone .btn-bind-faceid {
  display: inline-flex;
}

.btn-faceid-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.btn-faceid-login:hover {
  background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.btn-faceid-login:active {
  transform: scale(0.98);
}

.icon-faceid {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  flex-shrink: 0;
}

.faceid-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.25rem 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.faceid-divider::before,
.faceid-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-subtle);
}

.faceid-divider span {
  padding: 0 0.85rem;
  white-space: nowrap;
}


/* 照片拍照與上傳區 */
.photo-upload-area {
  border: 3px dashed var(--border-medium);
  background: var(--bg-surface-alt);
  border-radius: var(--radius-md);
  padding: 2.25rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.photo-upload-area:hover {
  background: #EFE7E0;
  border-color: var(--primary);
}

.upload-icon-circle {
  margin-bottom: 0.5rem;
}

.upload-text-main {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}

.upload-text-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.photo-preview-img {
  max-width: 100%;
  max-height: 240px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-top: 1rem;
  box-shadow: var(--shadow-md);
}

/* 大按鈕系列 */
.btn-senior-save {
  background: var(--primary-dark);
  color: var(--text-white);
  border: none;
  font-size: 1.35rem;
  font-weight: 800;
  padding: 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  width: 100%;
  box-shadow: 0 4px 14px rgba(140, 117, 91, 0.35);
  transition: all var(--transition-fast);
  text-align: center;
  text-decoration: none;
  display: block;
}

.btn-senior-save:hover {
  background: #75614B;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(140, 117, 91, 0.45);
}

.btn-senior-cancel {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-medium);
  font-size: 1.15rem;
  font-weight: 700;
  padding: 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  width: 100%;
  transition: all var(--transition-fast);
}

.btn-senior-cancel:hover {
  background: var(--bg-surface-alt);
  color: var(--text-main);
}

.btn-senior-delete {
  background: transparent;
  color: var(--danger);
  border: 2px solid var(--danger);
  font-size: 1.15rem;
  font-weight: 800;
  padding: 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  width: 100%;
  transition: all var(--transition-fast);
}

.btn-senior-delete:hover {
  background: var(--danger-bg);
}

/* 顧客商品詳情彈窗 */
.product-detail-modal {
  max-width: 780px;
}

.detail-modal-body {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 2rem;
  padding: 2.25rem;
  background: var(--bg-surface);
  align-items: start;
}

.detail-gallery-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.detail-image-container {
  width: 100%;
  height: 280px;
  min-height: 280px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface-alt);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  flex-shrink: 0;
  position: relative;
}

.detail-thumbnails-wrapper {
  width: 100%;
  padding: 6px 2px 4px 2px;
}

.detail-thumbnails-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.detail-thumb-item {
  position: relative;
  width: 64px;
  height: 64px;
  min-width: 64px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
  border: 2px solid transparent;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: all var(--transition-fast);
}

.detail-thumb-item:hover {
  transform: translateY(-2px);
  border-color: var(--border-color);
}

.detail-thumb-item.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
  transform: translateY(-2px);
}

.detail-thumb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.detail-thumb-del-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  z-index: 2;
}

.detail-thumb-item:hover .detail-thumb-del-btn {
  opacity: 1;
}

.detail-thumb-del-btn:hover {
  transform: scale(1.15);
  background: #dc2626;
}

.detail-thumb-add-btn {
  width: 64px;
  height: 64px;
  min-width: 64px;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--primary);
  background: rgba(245, 158, 11, 0.05);
  color: var(--primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.detail-thumb-add-btn:hover {
  background: rgba(245, 158, 11, 0.15);
  transform: translateY(-2px);
}

.detail-thumb-cover-badge {
  position: absolute;
  bottom: 2px;
  left: 2px;
  background: var(--primary);
  color: white;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 4px;
  line-height: 1;
}

.detail-product-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.12));
  transition: transform var(--transition-normal);
}

.detail-info-container {
  display: flex;
  flex-direction: column;
}

.detail-category-badge {
  background: var(--bg-surface-alt);
  color: var(--primary-dark);
  font-size: 0.85rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  width: fit-content;
  margin-bottom: 0.75rem;
}

.detail-product-name {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.25;
  margin-bottom: 1.25rem;
}

.detail-desc-box {
  background: var(--bg-body);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.detail-desc-label {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 0.4rem;
}

.detail-desc-text {
  font-size: 1rem;
  color: var(--text-main);
  line-height: 1.65;
  white-space: pre-wrap;
}

.detail-store-callout {
  margin-top: auto;
  border-left: 3px solid var(--primary);
  padding-left: 1rem;
  position: relative;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

/* 顧客商品詳情彈窗底部返回按鈕 */
.detail-modal-footer {
  padding: 1.25rem 2.25rem 1.5rem 2.25rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: center;
}

.btn-detail-close-bottom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-surface-alt);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 12px 32px;
  border-radius: var(--radius-pill);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
  max-width: 280px;
  box-shadow: var(--shadow-sm);
}

.btn-detail-close-bottom:hover {
  background: var(--primary);
  color: var(--text-white);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.callout-edit-btn {
  top: -8px !important;
  right: 0 !important;
  font-size: 0.85rem !important;
  padding: 5px 12px !important;
  box-shadow: var(--shadow-sm) !important;
}

.detail-section-edit-btn {
  top: 6px !important;
  right: 6px !important;
  font-size: 0.88rem !important;
  padding: 5px 12px !important;
  box-shadow: var(--shadow-sm) !important;
}

/* ==========================================================================
   行內即時編輯系統 (紅色虛線視覺指引 & INLINE EDITING)
   ========================================================================== */

/* 店長模式下：所有可編輯文字常駐紅色虛線外框 (預留充足最小空間與空值佔位) */
body.admin-mode [data-inline-edit] {
  cursor: text !important;
  user-select: text !important;
  -webkit-user-select: text !important;
  display: inline-block !important;
  min-width: 38px !important;
  min-height: 1.2em !important;
  vertical-align: baseline !important;
  margin: 2px 3px !important;
  padding: 1px 6px !important;
  outline: 1.5px dashed #EF4444 !important;
  outline-offset: 0 !important;
  border-radius: 4px !important;
  background: rgba(239, 68, 68, 0.05) !important;
  transition: all 0.2s ease !important;
  box-sizing: border-box !important;
}

/* 當文字被完全清空時，自動顯示防坍塌佔位字 */
body.admin-mode [data-inline-edit]:empty::before {
  content: '點此輸入';
  color: rgba(220, 38, 38, 0.65);
  font-size: 0.85em;
  font-style: italic;
  font-weight: 500;
  pointer-events: none;
}

body.admin-mode [data-inline-edit]:hover {
  outline: 2px dashed #DC2626 !important;
  background: rgba(239, 68, 68, 0.12) !important;
}

body.admin-mode [data-inline-edit]:focus {
  outline: 2px solid #DC2626 !important;
  background: #FFFFFF !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.25) !important;
  color: var(--text-main) !important;
}

/* 店長模式下：所有可更換圖片常駐紅色虛線外框 (採用頂層 z-index 疊加與 1.5px 安全內縮，完美配合卡片圓角弧度) */
body.admin-mode [data-inline-image] {
  cursor: pointer !important;
  position: relative !important;
}

body.admin-mode .product-thumb[data-inline-image] {
  border-top-left-radius: var(--radius-lg) !important;
  border-top-right-radius: var(--radius-lg) !important;
}

/* 主視覺圖片四個角圓弧同步 (避免 24px 大圓角裁切直角紅色虛線) */
body.admin-mode .hero-image-box .image-wrapper[data-inline-image],
body.admin-mode .hero-image-box .image-wrapper[data-inline-image]::after {
  border-radius: var(--radius-lg) !important;
}

body.admin-mode [data-inline-image]::after {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  border: 2.5px dashed #EF4444 !important;
  border-radius: inherit !important;
  pointer-events: none !important;
  z-index: 10 !important;
  transition: all 0.2s ease !important;
}

body.admin-mode .product-thumb[data-inline-image]::after {
  border-top-left-radius: var(--radius-lg) !important;
  border-top-right-radius: var(--radius-lg) !important;
}

body.admin-mode [data-inline-image]:hover::after {
  border: 3px dashed #DC2626 !important;
}

/* 行內分類快速切換下拉選單 */
.inline-cat-select {
  background: var(--bg-surface-alt);
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-medium);
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

body.admin-mode .inline-cat-select,
body.admin-mode [data-inline-cat] {
  outline: 1.5px dashed #EF4444 !important;
  outline-offset: 0 !important;
  background: rgba(239, 68, 68, 0.05) !important;
}

body.admin-mode .inline-cat-select:focus {
  outline: 2px solid #DC2626 !important;
  background: #FFFFFF !important;
}

/* 超連結網址自訂按鈕 (店長模式) */
.inline-link-edit-btn {
  background: rgba(239, 68, 68, 0.06);
  border: 1.5px solid #EF4444;
  color: #DC2626;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
  transition: all 0.2s ease;
}

.inline-link-edit-btn:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: #DC2626;
  transform: translateY(-1px);
}

.inline-link-edit-btn .icon-svg {
  width: 0.85em;
  height: 0.85em;
  stroke-width: 2.4;
}

/* 商品卡片刪除按鈕：固定在卡片右上角 */
.card-delete-btn {
  top: 10px !important;
  right: 10px !important;
  font-size: 0.85rem !important;
  padding: 5px 12px !important;
  z-index: 10 !important;
  box-shadow: var(--shadow-sm) !important;
}

/* 行內編輯小提示徽章 */
.inline-edit-hint-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--bg-surface-alt);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  margin-left: 6px;
  vertical-align: middle;
}

.detail-header-group .detail-section-edit-btn {
  top: 0 !important;
  right: 0 !important;
}

.callout-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.callout-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ==========================================================================
   9. 全局 Toast 提示元件
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: #10B981;
  color: #FFFFFF;
  padding: 16px 28px;
  border-radius: var(--radius-pill);
  font-size: 1.2rem;
  font-weight: 800;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  animation: toastSlideDown 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  opacity: 1;
  transition: all 0.25s ease;
}

.toast .icon-svg {
  width: 1.4em;
  height: 1.4em;
  stroke-width: 2.5;
}

.toast.toast-warning {
  background: var(--text-main);
}

.toast-undo-btn {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background var(--transition-fast);
}

.toast-undo-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

.toast.hiding {
  opacity: 0;
  transform: translateY(-20px) scale(0.9);
}

/* ==========================================================================
   10. 動畫與響應式斷點 (RWD)
   ========================================================================== */
@keyframes toastSlideDown {
  0% { opacity: 0; transform: translateY(-30px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  0% { opacity: 0; transform: translateY(-10px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

@media (max-width: 900px) {
  .hero-bento-grid {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
  }
  
  .hero-image-box {
    order: 1;
    width: 100%;
    min-height: auto;
    aspect-ratio: 16 / 10;
  }

  .hero-image-placeholder {
    min-height: auto;
    aspect-ratio: 16 / 10;
  }

  .hero-text-box {
    order: 2;
    width: 100%;
  }

  .hero-info-box {
    order: 3;
    width: 100%;
  }

  .detail-modal-body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.25rem;
  }

  .detail-image-container {
    max-width: 320px;
    margin: 0 auto;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
  }
}

@media (max-width: 600px) {
  .site-header { padding: 0.5rem 1rem; }
  .hero-bento-section, .controls-section, .products-section { padding: 0 1rem; }
  
  .hero-text-box { padding: 2rem 1.5rem; }
  .hero-title { font-size: 2.2rem; }
  .hero-info-box { padding: 1.5rem; }
  
  .controls-container { padding: 1rem; flex-direction: column; align-items: stretch; }
  .search-box-wrapper { min-width: 100%; }

  /* 窄螢幕下商品單欄大卡片陳列，避免並排擁擠，提升照片與字體清晰度 */
  .product-grid {
    grid-template-columns: 1fr;
    gap: 1.75rem;
    max-width: 440px;
    margin: 0 auto;
  }

  .product-info {
    padding: 1.5rem;
  }

  /* 手機版商品卡片文字重配置（嚴格確保所有字體 ≥ 1.25rem / 20px） */
  .product-title {
    font-size: 1.65rem;
    line-height: 1.35;
    margin-bottom: 0.85rem;
  }

  .product-desc {
    font-size: 1.25rem;
    line-height: 1.65;
    margin-bottom: 1.25rem;
    -webkit-line-clamp: 4;
    line-clamp: 4;
  }

  .product-cat-tag {
    font-size: 1.25rem;
    padding: 5px 16px;
  }

  .inline-cat-select {
    font-size: 1.25rem;
    padding: 6px 14px;
    font-weight: 700;
  }

  .search-sort-hint-tag {
    font-size: 1.25rem;
    padding: 5px 14px;
  }

  .product-view-hint {
    font-size: 1.25rem;
    gap: 8px;
  }

  .product-view-hint .icon-svg {
    width: 1.25em;
    height: 1.25em;
  }

  .card-delete-btn {
    font-size: 1.25rem !important;
    padding: 7px 16px !important;
    border-radius: var(--radius-pill) !important;
  }

  .card-delete-btn .icon-svg {
    width: 1.15em;
    height: 1.15em;
  }

  /* 手機窄螢幕下：卡片頂部排版 */
  .product-card-header {
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
  }

  .product-sort-actions {
    gap: 8px;
  }

  .sort-btn {
    width: 36px;
    height: 36px;
  }

  .sort-btn .icon-svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
  }

  .sort-btn-crown .icon-svg {
    width: 18px;
    height: 18px;
  }
  
  .senior-modal { max-height: 94vh; }
  .senior-modal-header, .senior-modal-body, .senior-modal-footer { padding: 1.25rem; }
}

/* ==========================================================================
   浮動儲存膠囊 (Floating Save Capsule)
   ========================================================================== */
.floating-save-capsule {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

body.admin-mode .floating-save-capsule {
  display: block !important;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.capsule-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(36, 32, 28, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 5px 6px 5px 12px;
  border-radius: var(--radius-pill);
  border: 1.5px solid rgba(201, 181, 156, 0.35);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.capsule-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.capsule-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 2.5px rgba(16, 185, 129, 0.3);
  transition: all 0.3s ease;
}

.floating-save-capsule.has-changes .capsule-inner {
  border-color: #EF4444;
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.3), 0 0 0 1px rgba(239, 68, 68, 0.4);
}

.floating-save-capsule.has-changes .capsule-dot {
  background: #EF4444;
  box-shadow: 0 0 0 2.5px rgba(239, 68, 68, 0.4);
  animation: pulse 1.5s infinite;
}

.capsule-text {
  color: #FFFFFF;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.capsule-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.capsule-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  font-family: inherit;
}

.capsule-btn-discard {
  background: rgba(255, 255, 255, 0.12);
  color: #E5E7EB;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.capsule-btn-discard:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #FCA5A5;
  border-color: rgba(239, 68, 68, 0.5);
  transform: translateY(-1px);
}

.capsule-btn-save {
  background: #10B981;
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.capsule-btn-save:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.6);
}

.floating-save-capsule.has-changes .capsule-btn-save {
  background: #DC2626 !important;
  color: #FFFFFF !important;
  box-shadow: 0 3px 12px rgba(220, 38, 38, 0.5) !important;
}

.floating-save-capsule.has-changes .capsule-btn-save:hover {
  background: #B91C1C !important;
  transform: scale(1.03) translateY(-1px);
}

.capsule-btn .icon-svg {
  width: 1em;
  height: 1em;
  stroke-width: 2.4;
}

/* ==========================================================================
   📸 照片取景框與自動壓縮 (Image Cropper & Framing Modal)
   ========================================================================== */
.image-crop-modal {
  position: relative;
  max-width: 440px;
  width: 92%;
  max-height: 88vh;
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
}

.btn-close-modal-float {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 20;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-close-modal-float:hover {
  background: rgba(239, 68, 68, 0.85);
  border-color: #EF4444;
  transform: scale(1.08);
}

.crop-modal-body {
  padding: 1rem 1rem 0.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

.crop-stage-wrapper {
  position: relative;
  width: 100%;
  height: 270px;
  min-height: 270px;
  max-height: 280px;
  background: #141210;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.6);
  user-select: none;
  touch-action: none;
  flex-shrink: 0;
}

.crop-stage {
  position: relative;
  width: 100%;
  height: 270px;
  min-height: 270px;
  cursor: grab;
  overflow: hidden;
}

.crop-stage:active {
  cursor: grabbing;
}

#cropCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.crop-viewfinder-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.68);
  border: 2px solid #FFFFFF;
  box-sizing: border-box;
  transition: width 0.2s ease, height 0.2s ease;
}

.crop-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: #EF4444;
  border-style: solid;
}

.crop-corner.top-left {
  top: -2px;
  left: -2px;
  border-width: 3px 0 0 3px;
}

.crop-corner.top-right {
  top: -2px;
  right: -2px;
  border-width: 3px 3px 0 0;
}

.crop-corner.bottom-left {
  bottom: -2px;
  left: -2px;
  border-width: 0 0 3px 3px;
}

.crop-corner.bottom-right {
  bottom: -2px;
  right: -2px;
  border-width: 0 3px 3px 0;
}

.crop-grid-lines {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  pointer-events: none;
}

.crop-grid-lines .grid-line-h {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
}

.crop-grid-lines .grid-line-h:nth-child(1) { top: 33.33%; }
.crop-grid-lines .grid-line-h:nth-child(2) { top: 66.66%; }

.crop-grid-lines .grid-line-v {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.2);
}

.crop-grid-lines .grid-line-v:nth-child(3) { left: 33.33%; }
.crop-grid-lines .grid-line-v:nth-child(4) { left: 66.66%; }

.crop-controls-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-surface-alt);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.crop-zoom-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.crop-zoom-group input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
  cursor: pointer;
}

.btn-crop-tool {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.btn-crop-tool:hover {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}

.crop-action-group {
  display: flex;
  gap: 10px;
}

.btn-crop-tool-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-crop-tool-action:hover {
  background: #EDE6E0;
  border-color: var(--primary);
}

/* ==========================================================================
   11. 更換圖片方式選擇彈窗 (Image Source Modal)
   ========================================================================== */
.image-source-modal-box {
  max-width: 520px;
  width: 92%;
}

.image-source-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0;
}

.image-source-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  background: var(--bg-surface-alt);
  border: 1.5px solid var(--border-subtle);
  padding: 18px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all 0.25s ease;
  font-family: inherit;
}

.image-source-card:hover {
  background: #EDE6E0;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.source-card-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-dark);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.source-card-info {
  flex: 1;
}

.source-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 3px;
}

.source-card-desc {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.image-source-url-card {
  background: var(--bg-surface-alt);
  border: 1.5px solid var(--border-subtle);
  padding: 18px 20px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.image-source-url-card .source-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.source-url-input-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

.source-url-input {
  width: 100% !important;
  box-sizing: border-box !important;
  display: block !important;
  font-size: 0.98rem !important;
  padding: 12px 14px !important;
  background: #FFFFFF !important;
  border: 1.5px solid var(--border-medium) !important;
  border-radius: var(--radius-md) !important;
  color: var(--text-main) !important;
  transition: all var(--transition-fast) !important;
}

.source-url-input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(201, 181, 156, 0.35) !important;
  outline: none !important;
}

.btn-apply-url {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 800;
  background: var(--primary-dark);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(140, 117, 91, 0.3);
  transition: all var(--transition-fast);
  font-family: inherit;
}

.btn-apply-url:hover {
  background: #75614B;
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(140, 117, 91, 0.45);
}

.btn-apply-url .icon-svg {
  width: 1.15em;
  height: 1.15em;
  stroke-width: 2.5;
}

/* ==========================================================================
   11. 📊 買家喜好與門市流量分析看板樣式
   ========================================================================== */
.analytics-modal-box {
  max-width: 820px !important;
  width: 95% !important;
}

.analytics-modal-body {
  padding: 1.5rem !important;
  max-height: 75vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* 3 大指標摘要格線 */
.analytics-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 768px) {
  .analytics-summary-grid {
    grid-template-columns: 1fr;
  }
}

.analytics-metric-card {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.analytics-metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--primary);
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.metric-icon-wrap {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(201, 181, 156, 0.25);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-value {
  font-size: 1.85rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.1;
  font-feature-settings: "tnum";
}

.metric-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* 分區標題 */
.analytics-section-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.85rem;
}

.analytics-section-title .icon-svg {
  color: var(--primary-dark);
}

/* 熱門商品排行清單 */
.analytics-ranking-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
  transition: all 0.2s ease;
}

.ranking-item:hover {
  background: #EDE6E0;
}

.ranking-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 900;
  flex-shrink: 0;
  background: #E5DDD5;
  color: var(--text-muted);
}

.ranking-badge.rank-1 {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.4);
}

.ranking-badge.rank-2 {
  background: linear-gradient(135deg, #9CA3AF, #6B7280);
  color: #FFFFFF;
}

.ranking-badge.rank-3 {
  background: linear-gradient(135deg, #D97706, #B45309);
  color: #FFFFFF;
}

.ranking-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #FFFFFF;
  border: 1px solid var(--border-light);
}

.ranking-info {
  flex-grow: 1;
  min-width: 0;
}

.ranking-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.ranking-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-count-text {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--primary-dark);
  flex-shrink: 0;
}

.ranking-bar-bg {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border-medium);
  overflow: hidden;
}

.ranking-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 雙欄分析區（熱搜關鍵字 + 進貨雷達） */
.analytics-dual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 768px) {
  .analytics-dual-grid {
    grid-template-columns: 1fr;
  }
}

.analytics-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.tags-cloud-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.keyword-tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-medium);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.keyword-tag-badge .tag-count {
  background: var(--primary-dark);
  color: #FFFFFF;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 800;
}

.missed-tag-badge {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: #DC2626;
}

.missed-tag-badge .tag-count {
  background: #DC2626;
}

.empty-analytics-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 1.5rem;
}

/* Cloudflare Turnstile 免打字驗證元件容器樣式 */
.turnstile-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 1rem;
  min-height: 65px;
  width: 100%;
}

