:root {
  color-scheme: light;
  --ink: #191714;
  --muted: #6d675f;
  --line: #dfd8cd;
  --paper: #fbfaf7;
  --soft: #f1ece4;
  --accent: #9f242d;
  --accent-dark: #5f151b;
  --gold: #b9832f;
  --white: #ffffff;
  --shadow: 0 18px 55px rgba(49, 41, 31, 0.13);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  /* 只在 html（根捲動容器）擋橫向溢出。
     注意：若把 overflow-x: hidden 加在 body 上，會讓 body 變成捲動容器，
     導致 .site-header 的 position: sticky 失效，所以這裡只放 html。 */
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  line-height: 1.6;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(251, 250, 247, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  transition: transform 0.3s ease;
}

/* 下捲收起、上捲冒出（transform 只在隱藏時套用，避免成為抽屜 fixed 的定位基準） */
.site-header.header-hidden {
  transform: translateY(-100%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.brand img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.35rem;
  line-height: 1.2;
  letter-spacing: 0.04em;
}

.brand small {
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
}

nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

nav a,
nav button,
.primary-action,
.secondary-action,
.primary-button,
.secondary-button,
.danger-button {
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  white-space: nowrap;
}

.nav-dropdown {
  position: static;
}

.nav-menu-button {
  background: transparent;
  color: var(--muted);
}

.nav-menu-button:hover,
.nav-menu-button[aria-expanded="true"] {
  background: var(--soft);
  color: var(--ink);
}

/* 桌機：點「經銷品牌」展開貼齊站頭下緣的滿版橫條，全部品牌一次橫向攤開（不摺疊） */
.brand-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  background: var(--white);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px clamp(18px, 4vw, 56px);
  /* 收合狀態：淡出 + 上移，展開時滑下淡入，避免生硬彈出 */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  pointer-events: none;
  transform-origin: top;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  z-index: 25;
}

.brand-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.nav-menu-button {
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-menu-button .caret {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform 0.18s;
}

.nav-menu-button[aria-expanded="true"] .caret {
  transform: rotate(-135deg) translate(-1px, -1px);
}

.nav-menu-button[aria-current="page"] {
  color: var(--ink);
  background: var(--soft);
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 6px;
  position: relative;
  z-index: 31;
}

.nav-toggle:hover {
  background: var(--soft);
}

.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  transform-origin: center;
  transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(25, 23, 20, 0.55);
  z-index: 29;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.nav-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

body.nav-open {
  overflow: hidden;
}

/* 下拉窗格最上方置中小字：經銷品牌按首字母排序 */
.brand-menu-note {
  grid-column: 1 / -1;
  margin: 0 0 2px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.brand-menu-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 9px;
  text-align: left;
}

.brand-menu-item:hover {
  border-color: var(--gold);
  background: #fff9ed;
}

.brand-menu-item img,
.brand-menu-logo {
  width: 74px;
  height: 42px;
  object-fit: contain;
  display: grid;
  place-items: center;
  background: transparent;
  border-radius: 5px;
  color: var(--gold);
  font-weight: 800;
}

/* 桌機滿版下拉：每格只放置中 logo，品牌名稱改為 hover/focus 才浮現（避免並排文字被裁切）。
   依視窗寬度自動換行（auto-fill）。手機端維持 logo＋名稱清單，不受此區影響。 */
@media (min-width: 821px) {
  .brand-menu {
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 8px;
  }

  .brand-menu-item {
    position: relative;
    grid-template-columns: 1fr;
    gap: 0;
    justify-items: center;
    align-items: center;
    min-height: 66px;
    padding: 10px 12px;
  }

  .brand-menu-item img,
  .brand-menu-logo {
    width: 100%;
    max-width: 120px;
    height: 46px;
  }

  /* 品牌名稱：預設隱藏，hover/focus 時以小膠囊浮現於 logo 下方 */
  .brand-menu-item > span:not(.brand-menu-logo) {
    position: absolute;
    left: 50%;
    bottom: 4px;
    transform: translateX(-50%) translateY(4px);
    max-width: calc(100% - 8px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.78rem;
    line-height: 1.2;
    color: var(--ink);
    background: var(--white);
    padding: 2px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
  }

  .brand-menu-item:hover > span:not(.brand-menu-logo),
  .brand-menu-item:focus-visible > span:not(.brand-menu-logo) {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.catalog-page {
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
  gap: clamp(22px, 4vw, 42px);
  padding: clamp(28px, 5vw, 58px) clamp(18px, 6vw, 82px);
}

.catalog-sidebar {
  align-self: start;
  display: grid;
  gap: 18px;
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
  overscroll-behavior: contain;
  /* 右側留空給捲軸、底部留白避免最後一張卡被裁切到邊緣 */
  padding: 2px 6px 20px 2px;
}

.sidebar-block {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.sidebar-block h2 {
  font-size: 1.1rem;
  margin: 0 0 14px;
}

/* 側欄標題（兼作手機收折開關）。桌機：純標題、無箭頭、不可收合 */
.sidebar-block-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  margin: 0 0 14px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: default;
}

.sidebar-block-title {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
}

.sidebar-block-toggle .caret {
  display: none;
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform 0.2s ease;
}

.catalog-filter-list {
  display: grid;
  gap: 8px;
}

.catalog-brand-button,
.catalog-chip {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.catalog-brand-button {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 8px;
}

.catalog-brand-button img {
  width: 70px;
  height: 38px;
  object-fit: contain;
  background: transparent;
  border-radius: 5px;
}

.catalog-brand-button.active,
.catalog-brand-button:hover,
.catalog-chip.active,
.catalog-chip:hover {
  border-color: var(--gold);
  background: #fff9ed;
}

.catalog-chip {
  min-height: 38px;
  padding: 8px 10px;
}

.catalog-main {
  min-width: 0;
}

.catalog-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.catalog-heading h1 {
  font-size: clamp(2rem, 4vw, 4.5rem);
  line-height: 1.05;
  margin: 0 0 12px;
}

.catalog-heading p {
  color: var(--muted);
  margin: 0;
}

.product-tools.catalog-tools {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) max-content;
  align-items: end;
  gap: 14px 16px;
  margin-bottom: 14px;
}

/* 搜尋框獨佔一列，類別 / 價格 / 按鈕排第二列，較不擁擠 */
.product-tools.catalog-tools > label:first-child {
  grid-column: 1 / -1;
}

.filter-field {
  color: var(--muted);
  font-size: 0.88rem;
  position: relative;
}

.filter-field summary {
  align-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  min-height: 46px;
  padding: 10px 12px;
}

.filter-field summary::after {
  content: "展開";
  color: var(--muted);
  font-size: 0.78rem;
}

.filter-field[open] summary::after {
  content: "收合";
}

.checkbox-panel {
  position: absolute;
  z-index: 15;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 12px;
}

.filter-checkbox {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  gap: 8px;
  min-height: 34px;
  min-width: 0;
  padding: 7px 10px;
}

.product-tools .filter-checkbox {
  display: flex;
  flex-direction: row;
  grid-template-columns: none;
}

.filter-checkbox span {
  line-height: 1.3;
  min-width: 0;
  overflow-wrap: anywhere;
}

.filter-checkbox:hover,
.filter-checkbox:has(input:checked) {
  border-color: var(--gold);
  background: #fff9ed;
}

.filter-checkbox input {
  flex: 0 0 auto;
  height: 18px;
  margin: 0;
  width: auto;
}

.price-range-field {
  color: var(--muted);
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
}

.price-range-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.filter-submit {
  align-self: end;
  min-height: 46px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-self: end;
}

.filter-actions .filter-submit,
.filter-actions .filter-clear {
  min-height: 46px;
  flex: 1 1 auto;
  white-space: nowrap;
}

.active-filter-row {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 16px;
}

.catalog-resultbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.catalog-resultbar .active-filter-row {
  margin-bottom: 0;
}

.catalog-result-controls {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.catalog-sort,
.catalog-perpage {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.catalog-sort select,
.catalog-perpage select {
  width: auto;
  min-height: 40px;
  padding: 8px 12px;
}

/* 分頁 */
.catalog-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 28px;
}

.catalog-pagination:empty {
  display: none;
}

.page-btn {
  min-width: 40px;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.92rem;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.page-btn:hover:not(:disabled):not(.active) {
  border-color: var(--gold);
  background: #fff9ed;
}

.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
  cursor: default;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-ellipsis {
  padding: 0 4px;
  color: var(--muted);
}

/* 預約試聽表單彈窗（前台共用） */
.booking-dialog {
  width: min(540px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  box-shadow: var(--shadow);
}

.booking-dialog::backdrop {
  background: rgba(25, 23, 20, 0.55);
}

.booking-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
  padding: 22px clamp(18px, 4vw, 26px) 24px;
}

/* 整列欄位（標題、說明、型號、備註、人機驗證、按鈕、狀態） */
.booking-head,
.booking-intro,
.booking-full,
.booking-captcha,
.booking-actions,
.booking-status {
  grid-column: 1 / -1;
}

.booking-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 560px) {
  .booking-form {
    grid-template-columns: 1fr;
  }
}

.booking-head h2 {
  margin: 0;
  font-size: 1.3rem;
}

.booking-intro {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.booking-form .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.booking-form .field span {
  font-size: 0.86rem;
  color: var(--muted);
}

.booking-form .field .field-hint {
  font-size: 0.74rem;
  color: var(--muted);
}

.booking-form .field .req {
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--white);
  font-size: 0.68rem;
  font-style: normal;
  vertical-align: middle;
}

.booking-form .invalid {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(159, 36, 45, 0.18);
}

.booking-form select,
.booking-form input,
.booking-form textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
}

.booking-form textarea {
  min-height: auto;
  resize: vertical;
}

/* 型號勾選清單 */
.booking-model-field {
  position: relative;
}

.booking-model-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.booking-model-trigger.has-value {
  color: var(--ink);
}

.booking-model-trigger.invalid {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(159, 36, 45, 0.18);
}

.booking-model-trigger #bookingModelLabel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.booking-model-caret {
  flex: 0 0 auto;
  font-size: 0.7rem;
  color: var(--muted);
}

.booking-model-panel {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.booking-form .booking-model-search {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.booking-model-list {
  max-height: 230px;
  overflow-y: auto;
  padding: 4px;
}

.booking-model-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.92rem;
}

.booking-model-item:hover {
  background: var(--soft);
}

.booking-model-item input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  flex: 0 0 auto;
  cursor: pointer;
}

.booking-model-item.is-newcomer {
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  margin-bottom: 2px;
}

.booking-model-empty {
  margin: 0;
  padding: 14px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.booking-captcha {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

.gate-captcha {
  display: flex;
  justify-content: center;
  margin: 4px 0;
}

/* 未上架商品的後台預覽橫幅 */
.preview-banner {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #b8860b;
  color: #fff;
  text-align: center;
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.booking-actions {
  margin-top: 4px;
}

.booking-actions .primary-button {
  width: 100%;
}

.booking-status {
  margin: 2px 0 0;
  font-size: 0.9rem;
  text-align: center;
}

.booking-status.ok {
  color: #1c7a45;
}

.booking-status.err {
  color: var(--accent);
}

/* 右下角回到頂端浮動按鈕（前後台共用） */
.back-to-top {
  position: fixed;
  right: clamp(14px, 3vw, 28px);
  bottom: clamp(14px, 3vw, 28px);
  z-index: 35;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  background: var(--accent);
  color: var(--white);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s, background 0.2s ease;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--accent-dark);
}

/* 手機抽屜開啟時不要蓋住內容 */
body.nav-open .back-to-top {
  opacity: 0;
  visibility: hidden;
}

.catalog-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.empty-state {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  grid-column: 1 / -1;
  padding: 28px;
}

.product-detail-page {
  background: var(--paper);
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 0 clamp(18px, 6vw, 82px);
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.92rem;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.detail-back:hover {
  background: var(--soft);
  color: var(--ink);
  border-color: var(--accent);
}

.detail-back-arrow {
  font-size: 1.05rem;
  line-height: 1;
}

.product-detail-hero {
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(0, 1.18fr);
  gap: clamp(26px, 5vw, 70px);
  align-items: center;
  padding: clamp(34px, 7vw, 86px) clamp(18px, 6vw, 82px);
  background: var(--white);
}

.product-detail-gallery {
  min-width: 0;
}

.product-detail-image {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(320px, 42vw, 520px);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(18px, 4vw, 42px);
}

.product-detail-image img {
  max-height: clamp(260px, 34vw, 440px);
  object-fit: contain;
}

.detail-image-button {
  border: 0;
  background: transparent;
  cursor: zoom-in;
  display: grid;
  place-items: center;
  width: 100%;
}

.product-detail-image span {
  position: absolute;
  top: 14px;
  left: 14px;
  background: var(--accent-dark);
  color: var(--white);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 0.82rem;
}

.detail-thumbnails {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  justify-content: center;
}

.detail-thumbnail {
  width: 72px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  cursor: pointer;
  padding: 5px;
}

.detail-thumbnail.active,
.detail-thumbnail:hover {
  border-color: var(--gold);
}

.detail-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-lightbox {
  width: min(980px, calc(100vw - 40px));
  border: 0;
  border-radius: 8px;
  padding: 24px;
  background: var(--white);
}

.image-lightbox::backdrop,
.asset-picker-dialog::backdrop,
.batch-delete-dialog::backdrop {
  background: rgba(25, 23, 20, 0.68);
}

.image-lightbox img {
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

.product-detail-copy h1 {
  font-size: clamp(2rem, 4.5vw, 4.8rem);
  line-height: 1.05;
  margin: 0 0 18px;
}

.product-detail-copy p {
  color: var(--muted);
  margin: 0;
  max-width: 760px;
}

.detail-price-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 24px;
}

.detail-price-row strong {
  font-size: 1.6rem;
}

.detail-price-row span {
  color: var(--gold);
  font-weight: 700;
}

.detail-actions {
  margin-top: 28px;
}

.product-detail-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 22px;
}

.detail-content {
  display: grid;
  gap: 18px;
}

.detail-content article,
.detail-spec-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(20px, 4vw, 34px);
}

.detail-content h2,
.detail-spec-panel h2 {
  margin: 0 0 12px;
}

.detail-content p {
  color: var(--muted);
  margin: 0;
}

.detail-spec-panel {
  align-self: start;
}

.detail-spec-panel dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

.detail-spec-panel div {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 12px;
  padding-top: 12px;
}

.detail-spec-panel dt,
.detail-spec-panel dd {
  margin: 0;
}

.detail-spec-panel dt {
  color: var(--muted);
}

.detail-tag-link {
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
  transition: color 0.15s ease, border-bottom-color 0.15s ease;
}

.detail-tag-link:hover,
.detail-tag-link:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.related-section {
  padding-top: 0;
}

nav a {
  color: var(--muted);
}

nav a:hover {
  color: var(--ink);
  background: var(--soft);
}

.admin-link,
.primary-action,
.primary-button {
  background: var(--accent);
  color: var(--white);
}

.secondary-action,
.secondary-button {
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
}

.danger-button {
  background: #fff0f0;
  border-color: #efb8b8;
  color: #9a1e1e;
}

.eyebrow,
.section-kicker {
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 10px;
  text-transform: uppercase;
}

/* ============================
   首頁大圖跑馬燈 Hero carousel
   ============================ */
.hero-carousel {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--accent-dark);
  color: var(--white);
}

.hero-track {
  display: flex;
  width: 100%;
  will-change: transform;
  transition: transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.hero-slide {
  position: relative;
  flex: 0 0 100%;
  min-width: 100%;
  min-height: clamp(440px, 72vh, 760px);
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-slide-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

/* 有文字的投影片：左側加深色漸層提升可讀性 */
.hero-slide::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    105deg,
    rgba(20, 18, 16, 0.86) 0%,
    rgba(20, 18, 16, 0.55) 42%,
    rgba(20, 18, 16, 0.08) 78%,
    rgba(20, 18, 16, 0) 100%
  );
}

/* 純圖片 banner：不壓暗，完整呈現設計圖 */
.hero-slide.is-plain::after {
  background: linear-gradient(180deg, rgba(20, 18, 16, 0.12), rgba(20, 18, 16, 0.04));
}

.hero-slide-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(34px, 7vw, 86px) clamp(18px, 6vw, 82px);
}

.hero-slide-copy {
  max-width: 720px;
}

.hero-slide-title {
  font-size: clamp(2rem, 4.8vw, 4.6rem);
  line-height: 1.06;
  margin: 0 0 20px;
}

.hero-slide-text {
  color: rgba(255, 255, 255, 0.84);
  font-size: 1.08rem;
  margin: 0;
  max-width: 620px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.secondary-action {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.28);
  color: var(--white);
}

/* 跑馬燈 CTA 按鈕：沿用經銷品牌方塊的 hover（上浮＋陰影＋金色邊框） */
.hero-slide .primary-action,
.hero-slide .secondary-action {
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.hero-slide .primary-action:hover,
.hero-slide .primary-action:focus-visible,
.hero-slide .secondary-action:hover,
.hero-slide .secondary-action:focus-visible {
  border-color: var(--gold);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

/* 左右箭頭 */
.hero-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  background: rgba(20, 18, 16, 0.35);
  color: var(--white);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(2px);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.hero-arrow:hover {
  background: rgba(159, 36, 45, 0.85);
  border-color: rgba(255, 255, 255, 0.7);
}

.hero-arrow-prev {
  left: clamp(10px, 2.5vw, 28px);
}

.hero-arrow-next {
  right: clamp(10px, 2.5vw, 28px);
}

/* 底部圓點 */
.hero-dots {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: clamp(14px, 3vw, 28px);
  display: flex;
  justify-content: center;
  gap: 10px;
}

.hero-dot {
  width: 11px;
  height: 11px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.hero-dot.active {
  background: var(--white);
  transform: scale(1.15);
}

.hero-carousel.is-single .hero-arrow,
.hero-carousel.is-single .hero-dots {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .hero-track {
    transition: none;
  }
}

.section {
  padding: clamp(48px, 8vw, 96px) clamp(18px, 6vw, 82px);
  /* 錨點跳轉（後台預覽、導覽列）時，讓區塊落在固定站頭下方而非被蓋住 */
  scroll-margin-top: 90px;
}

.section-heading {
  max-width: 780px;
  margin-bottom: 28px;
}

.section-heading h2,
.intro-section h2,
.store-panel h2,
.panel-heading h1 {
  font-size: clamp(1.7rem, 3vw, 3rem);
  line-height: 1.16;
  margin: 0 0 12px;
}

.section-heading p,
.intro-section p,
.store-panel p,
.panel-heading p {
  color: var(--muted);
  margin: 0;
}

.intro-section {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1fr);
  gap: clamp(24px, 7vw, 100px);
  align-items: start;
  background: var(--white);
}

/* 首頁區塊背景交替：關於(白) → 品牌(米) → 服務(白) → 消息(米) */
#services {
  background: var(--white);
}

.service-grid,
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.service-card,
.product-card,
.editor-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.service-card {
  padding: 22px;
}

.service-card span {
  color: var(--gold);
  font-weight: 700;
}

.service-card h3,
.product-card h3,
.product-card h3 a,
.news-item h3,
.editor-card h3 {
  line-height: 1.28;
  margin: 8px 0;
}

.product-card h3 a:hover {
  color: var(--accent);
}

.service-card p,
.product-card span,
.news-item p,
.editor-card p {
  color: var(--muted);
  margin: 0;
}

.product-section {
  background: var(--soft);
}

.product-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 14px;
  margin-bottom: 18px;
}

.product-tools label,
.field {
  color: var(--muted);
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

.product-card {
  display: flex;
  flex-direction: column;
}

.product-image {
  position: relative;
  background: var(--white);
  color: inherit;
}

.product-image img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
}

.product-image span {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--accent-dark);
  border-radius: 6px;
  color: var(--white);
  font-size: 0.78rem;
  padding: 4px 8px;
}

.product-content {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.product-content p {
  color: var(--gold);
  font-size: 0.84rem;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-content strong {
  font-size: 1.12rem;
}

/* 商品卡：標題與描述固定行數並保留高度，讓所有卡片高度一致，
   避免有些商品把整段網拍敘述塞進來撐爆版面（超出以 … 省略，完整內容仍在商品頁）。 */
.product-card h3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  min-height: 2.56em; /* 2 行 × line-height 1.28 */
}

.product-content span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  line-height: 1.5;
  min-height: 4.5em; /* 3 行 × line-height 1.5 */
}

.brand-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.brand-item {
  display: grid;
  place-items: center;
  min-height: 116px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 18px;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.brand-item:hover,
.brand-item:focus-visible {
  border-color: var(--gold);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.brand-item img {
  width: 100%;
  height: 78px;
  object-fit: contain;
}

/* 「更多品牌」格：填補品牌牆最後一格，導向商品總覽頁 */
.brand-item-more {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  text-align: center;
  background: var(--soft);
  border-style: dashed;
  color: var(--accent);
}

.brand-more-text {
  font-size: 1.05rem;
  font-weight: 800;
}

.brand-more-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.news-section {
  background: var(--paper);
}

.news-list {
  display: grid;
  gap: 12px;
}

.news-item {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 22px;
  border-top: 1px solid var(--line);
  padding: 20px 0;
}

.news-item time {
  color: var(--gold);
  font-weight: 700;
}

.store-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.75fr);
  gap: 18px;
}

.store-panel,
.map-placeholder {
  background: var(--accent-dark);
  border-radius: 8px;
  color: var(--white);
  padding: clamp(24px, 5vw, 44px);
}

.store-panel p,
.store-info dd {
  color: rgba(255, 255, 255, 0.78);
}

.store-info {
  display: grid;
  gap: 12px;
  margin: 30px 0 0;
}

.store-info div {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  padding-top: 12px;
}

.store-info dt,
.store-info dd {
  margin: 0;
}

.store-line {
  margin-top: 26px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  padding-top: 22px;
}

.store-line-link {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  color: var(--white);
  text-decoration: none;
}

.store-line-link img {
  width: 120px;
  height: 120px;
  flex: 0 0 auto;
  border-radius: 12px;
  object-fit: contain;
}

.store-line-link span {
  font-weight: 700;
  border-bottom: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.store-line-link:hover span,
.store-line-link:focus-visible span {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.map-placeholder {
  align-content: center;
  background:
    linear-gradient(rgba(25, 23, 20, 0.66), rgba(25, 23, 20, 0.66)),
    url("assets/logos/happydragon.jpg") center / cover;
  min-height: 330px;
}

.map-placeholder span {
  color: var(--gold);
  display: block;
  font-size: 3rem;
  font-weight: 800;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px clamp(18px, 6vw, 82px);
  background: var(--ink);
  color: var(--white);
}

footer p {
  margin: 0;
}

.admin-body {
  min-height: 100vh;
}

.admin-gate {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(130deg, rgba(25, 23, 20, 0.92), rgba(95, 21, 27, 0.88)),
    url("assets/logos/happydragon.jpg") center / cover;
}

.gate-panel {
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  padding: 28px;
}

.gate-panel img {
  width: 68px;
  height: 68px;
  border-radius: 8px;
  object-fit: cover;
}

.gate-panel h1,
.gate-panel p {
  margin: 0;
}

.gate-panel h1 {
  line-height: 1.2;
}

.gate-panel p {
  color: var(--muted);
}

.gate-panel .gate-error {
  color: #9a1e1e;
}

.admin-header {
  background: var(--white);
}

.admin-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: calc(100vh - 79px);
}

.admin-sidebar {
  background: var(--ink);
  padding: 18px;
  align-self: start;
  position: sticky;
  top: 79px;
  max-height: calc(100vh - 79px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.tab-button {
  width: 100%;
  min-height: 42px;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  text-align: left;
  padding: 10px 12px;
}

.tab-button.active,
.tab-button:hover {
  background: var(--accent);
  color: var(--white);
}

/* 側欄分頁未讀數徽章（預約詢問） */
.tab-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
}

/* 瀏覽數據 */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.stat-card strong {
  display: block;
  font-size: 1.7rem;
  color: var(--accent);
  line-height: 1.1;
}

.stat-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.stat-rangebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 18px;
}

.stat-ranges {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.stat-range {
  padding: 8px 16px;
  border: none;
  background: var(--white);
  color: var(--muted);
  font-size: 0.88rem;
  cursor: pointer;
}

.stat-range + .stat-range {
  border-left: 1px solid var(--line);
}

.stat-range.active {
  background: var(--accent);
  color: var(--white);
}

.stat-custom {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stat-custom label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  color: var(--muted);
}

.stat-custom input {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
}

.stat-period {
  margin-left: auto;
}

.stat-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 14px;
}

.stat-tabs {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.stat-tab {
  padding: 8px 18px;
  border: none;
  background: var(--white);
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.stat-tab + .stat-tab {
  border-left: 1px solid var(--line);
}

.stat-tab.active {
  background: var(--accent);
  color: var(--white);
}

.stat-pagesize {
  font-size: 0.86rem;
  color: var(--muted);
}

.stat-pagesize select {
  margin: 0 4px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
}

.stat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.stat-table th,
.stat-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.stat-table thead th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--soft);
}

.stat-table tbody tr:hover {
  background: var(--soft);
}

.stat-table .stat-rank {
  width: 48px;
  color: var(--muted);
  text-align: center;
}

.stat-table .stat-num {
  width: 110px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.stat-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

.stat-footer .pager {
  display: flex;
  gap: 6px;
}

@media (max-width: 700px) {
  .stat-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stat-table .stat-num {
    width: auto;
  }
}

/* 預約詢問收件匣 */
.inquiry-list {
  display: grid;
  gap: 12px;
}

.inquiry-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
}

.inquiry-card.unread {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.inquiry-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.inquiry-time {
  color: var(--muted);
  font-size: 0.82rem;
}

.inquiry-new {
  background: var(--accent);
  color: var(--white);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 0.74rem;
  font-weight: 700;
}

.inquiry-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 18px;
  margin: 0 0 12px;
}

.inquiry-fields div {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 6px;
}

.inquiry-fields dt {
  color: var(--muted);
  font-size: 0.84rem;
}

.inquiry-fields dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.inquiry-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.tab-group-label {
  margin: 16px 4px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}

.tab-group-label:first-child {
  margin-top: 0;
}

.admin-workspace {
  padding: clamp(18px, 4vw, 42px);
}

.admin-notice {
  display: flex;
  gap: 10px;
  align-items: center;
  background: #fff7e8;
  border: 1px solid #ecd3a9;
  border-radius: 8px;
  margin-bottom: 18px;
  padding: 14px 16px;
}

.admin-notice span {
  color: var(--muted);
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.product-admin-view {
  display: none;
}

.product-admin-view.active {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.product-edit-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.product-admin-list {
  display: grid;
  gap: 12px;
}

.product-admin-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) max-content;
  gap: 14px;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.product-admin-card img {
  width: 92px;
  height: 72px;
  object-fit: contain;
  background: var(--soft);
  border-radius: 6px;
}

.product-admin-card h3,
.product-admin-card p {
  margin: 0;
}

.product-admin-card p {
  color: var(--gold);
  font-size: 0.84rem;
  font-weight: 700;
}

.product-admin-card span {
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

.product-admin-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

/* 未上架商品卡：左側橘條 + 略淡 */
.product-admin-card.is-unpublished {
  opacity: 0.72;
  border-left: 3px solid #b8860b;
}

/* 上架狀態徽章 */
.pub-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  vertical-align: middle;
}

.pub-badge.on { background: #e3f4e8; color: #1f7a3d; }
.pub-badge.off { background: #f0e6d2; color: #8a6d1b; }

/* 上架/下架 動作按鈕（文字 + 顏色，一眼就懂） */
.pub-action {
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid;
  white-space: nowrap;
}

/* 未上架 → 顯示綠色「改上架」鈕，邀請發布 */
.pub-action.off {
  background: #1f7a3d;
  color: #fff;
  border-color: #1f7a3d;
}

/* 已上架 → 顯示淡色「改下架」鈕 */
.pub-action.on {
  background: var(--white);
  color: #8a6d1b;
  border-color: #e3c98f;
}

.pub-action:hover {
  filter: brightness(0.96);
}

.panel-heading {
  margin-bottom: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.panel-heading > div {
  min-width: 0;
}

.ghost-link {
  color: var(--accent);
  font-size: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.ghost-link:hover {
  background: var(--soft);
  border-color: var(--accent);
}

.ghost-note {
  color: var(--muted);
  font-size: 0.85rem;
}

.field-help {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin: -4px 0 6px;
  line-height: 1.5;
}

.field-counter {
  display: block;
  margin-top: 4px;
  text-align: right;
  color: var(--muted);
  font-size: 0.76rem;
}

.field-toolbar {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

/* 完整介紹內插入的圖片（前台商品詳情頁） */
.detail-body-img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 10px 0;
}

.field-counter.over {
  color: var(--accent);
  font-weight: 700;
}

.field-section-header {
  padding: 18px 16px;
  margin-top: 12px;
  background: var(--soft);
  border-left: 5px solid var(--accent);
  border-radius: 6px;
}

.field-section-header h4 {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.field-section-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

/* 顯示/隱藏開關 */
.toggle-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--ink);
  user-select: none;
}

.toggle-field input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: relative;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
  background: var(--line);
  border-radius: 999px;
  transition: background 0.18s;
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--white);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(25, 23, 20, 0.35);
  transition: transform 0.18s;
}

.toggle-field input:checked + .toggle-track {
  background: var(--accent);
}

.toggle-field input:checked + .toggle-track .toggle-thumb {
  transform: translateX(20px);
}

.toggle-field input:focus-visible + .toggle-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 後台卡片/列「前台已隱藏」狀態：整體變淡 */
.editor-card-hidden {
  opacity: 0.55;
}

/* 經銷品牌：清單卡片（可拖曳排序） */
.brand-admin-card {
  display: grid;
  grid-template-columns: 24px 64px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  cursor: grab;
  transition: border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.brand-admin-card:active {
  cursor: grabbing;
}

.brand-admin-card.dragging {
  opacity: 0.35;
}

/* 未勾選首頁品牌牆的品牌：不可拖曳，把手淡化 */
.brand-admin-card--plain {
  cursor: default;
}

.brand-admin-card--plain:active {
  cursor: default;
}

.chip-drag-handle.is-off {
  color: var(--line);
  cursor: default;
}

.brand-admin-card.drop-target {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.brand-admin-card > img {
  width: 64px;
  height: 48px;
  object-fit: contain;
  background: transparent;
  border-radius: 6px;
}

.brand-admin-info {
  min-width: 0;
}

.brand-admin-info h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.brand-admin-info span {
  color: var(--muted);
  font-size: 0.84rem;
}

.brand-home-check {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  cursor: pointer;
}

.brand-home-check input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.brand-home-check.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.brand-home-check.is-disabled input {
  cursor: not-allowed;
}

.brand-admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* 經銷品牌：編輯 modal */
.brand-edit-dialog {
  width: min(520px, calc(100vw - 36px));
  max-height: 88vh;
  overflow: auto;
  border: 0;
  border-radius: 10px;
  padding: 22px;
}

/* 商品編輯框較寬（欄位較多、含圖片排序） */
.product-edit-dialog {
  width: min(760px, calc(100vw - 36px));
}

.brand-edit-dialog::backdrop {
  background: rgba(25, 23, 20, 0.6);
}

.brand-edit-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.brand-edit-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.brand-edit-body {
  display: grid;
  gap: 14px;
}

.brand-edit-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

/* 商品編輯框：品牌勾選器 */
.brand-select-field {
  display: grid;
  gap: 8px;
}

.brand-select-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.brand-select-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  background: var(--white);
  font-size: 0.9rem;
}

.brand-select-option:has(input:checked) {
  border-color: var(--gold);
  background: #fff9ed;
}

.brand-select-option input {
  width: auto;
  height: 16px;
  margin: 0;
}

.brand-select-other {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.brand-other-input {
  width: 200px;
  max-width: 100%;
}

.brand-other-input:disabled {
  background: var(--soft);
  color: var(--muted);
}

/* 商品編輯框：規格表編輯器 */
.specs-editor-field {
  display: grid;
  gap: 8px;
}

.specs-rows {
  display: grid;
  gap: 8px;
}

.specs-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 0.85fr) minmax(0, 1.3fr) auto;
  gap: 8px;
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  transition: border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.specs-row.dragging {
  opacity: 0.4;
}

.specs-row.drop-target {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.specs-row .chip-drag-handle {
  cursor: grab;
}

.specs-row input {
  padding: 8px 10px;
}

/* 鎖定列（品牌/類別自動同步） */
.specs-row-locked {
  background: var(--soft);
}

.specs-row-locked input:disabled {
  color: var(--muted);
  background: transparent;
  cursor: not-allowed;
}

.specs-locked-note {
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
}

.specs-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* 商品分類編輯列 */
.category-editor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}

.image-field {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.image-field > span:first-child {
  font-weight: 600;
}

.image-field-preview {
  display: grid;
  place-items: center;
  background: var(--soft);
  border-radius: 6px;
  min-height: 120px;
  padding: 12px;
}

.image-field-preview img {
  max-height: 140px;
  max-width: 100%;
  object-fit: contain;
}

.image-field-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.image-field-path {
  flex: 1 1 240px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.map-placeholder.has-embed {
  padding: 0;
  background: var(--soft);
  overflow: hidden;
}

.map-placeholder.has-embed iframe {
  width: 100%;
  height: 100%;
  min-height: 330px;
  border: 0;
  display: block;
}

.form-grid,
.editor-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  max-width: 760px;
}

.field textarea {
  min-height: 96px;
}

.admin-actions,
.editor-list {
  max-width: 760px;
}

.image-picker-field {
  align-self: end;
}

.product-image-editor {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.product-image-preview {
  display: grid;
  place-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 150px;
  padding: 12px;
}

.product-image-preview img {
  max-height: 130px;
  object-fit: contain;
}

.product-image-controls {
  display: grid;
  gap: 12px;
  align-content: center;
}

.field-title {
  color: var(--muted);
  display: block;
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.selected-image-list {
  display: grid;
  gap: 8px;
}

.selected-image-chip {
  display: grid;
  grid-template-columns: 22px 64px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  padding: 8px;
  cursor: grab;
  transition: border-color 0.15s, box-shadow 0.15s, opacity 0.15s, background 0.15s;
}

.selected-image-chip:active {
  cursor: grabbing;
}

.selected-image-chip.dragging {
  opacity: 0.35;
}

.selected-image-chip.drop-target {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.selected-image-chip.is-cover {
  background: #fff9ed;
  border-color: var(--gold);
}

.selected-image-chip > img {
  width: 64px;
  height: 50px;
  object-fit: contain;
  background: var(--white);
  border-radius: 4px;
}

.chip-drag-handle {
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  text-align: center;
  user-select: none;
}

.chip-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.chip-cover-badge {
  display: inline-block;
  background: var(--gold);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 9px;
  border-radius: 999px;
  width: max-content;
}

.chip-filename {
  font-size: 0.86rem;
  overflow-wrap: anywhere;
  line-height: 1.3;
  color: var(--ink);
}

.chip-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.chip-action-button {
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.82rem;
  padding: 6px 10px;
  white-space: nowrap;
  font-weight: 600;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.chip-action-button.set-cover {
  border: 1px solid var(--gold);
  background: var(--white);
  color: var(--accent-dark);
}

.chip-action-button.set-cover:hover {
  background: var(--gold);
  color: var(--white);
}

.chip-action-button.remove {
  border: 1px solid #efb8b8;
  background: #fff0f0;
  color: #9a1e1e;
}

.chip-action-button.remove:hover {
  background: #efb8b8;
  color: var(--white);
}

.muted-note {
  color: var(--muted);
  margin: 0;
}

.upload-button {
  position: relative;
  overflow: hidden;
}

.upload-button input {
  position: absolute;
  inset: 0;
  cursor: pointer;
  opacity: 0;
}

.asset-uploader {
  margin-bottom: 18px;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.asset-card {
  display: grid;
  gap: 10px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.asset-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: var(--soft);
  border-radius: 6px;
}

.asset-card strong,
.asset-card span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.asset-card span {
  color: var(--muted);
  font-size: 0.86rem;
}

.asset-picker-dialog {
  width: min(980px, calc(100vw - 36px));
  max-height: 86vh;
  border: 0;
  border-radius: 8px;
  padding: 20px;
}

/* 商品批量刪除 */
.batch-delete-dialog {
  width: min(640px, calc(100vw - 36px));
  max-height: 88vh;
  border: 0;
  border-radius: 8px;
  padding: 20px;
}

.batch-delete-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.batch-delete-head h2,
.batch-delete-head p {
  margin: 0;
}

.batch-delete-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.batch-delete-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.batch-delete-toolbar input,
.batch-delete-toolbar select {
  flex: 1 1 180px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
}

.batch-delete-selectbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 8px;
}

.batch-delete-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.batch-delete-all input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.batch-delete-count {
  color: var(--muted);
  font-size: 0.86rem;
}

.batch-delete-list {
  display: grid;
  gap: 6px;
  max-height: 56vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
}

.batch-delete-item {
  display: grid;
  grid-template-columns: 22px 48px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.batch-delete-item:hover {
  background: var(--soft);
}

.batch-delete-item input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.batch-delete-item img {
  width: 48px;
  height: 40px;
  object-fit: contain;
  background: var(--white);
  border-radius: 4px;
}

.batch-delete-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-delete-item span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.batch-delete-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.asset-picker-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.asset-picker-head h2,
.asset-picker-head p {
  margin: 0;
}

.asset-picker-head p {
  color: var(--muted);
}

.asset-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
  max-height: 58vh;
  overflow: auto;
}

.asset-picker-item {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
  padding: 8px;
  text-align: left;
}

.asset-picker-item:hover {
  border-color: var(--gold);
  background: #fff9ed;
}

.asset-picker-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: var(--white);
  border-radius: 5px;
}

.asset-picker-item span {
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.admin-actions {
  margin-bottom: 0;
}

.editor-list {
  display: grid;
  gap: 14px;
}

.editor-card {
  padding: 16px;
}

.editor-card-head {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 40px;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.editor-card-head img {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  object-fit: contain;
  background: var(--soft);
}

/* 跑馬燈投影片卡：多一欄拖曳握把 */
.hero-slide-card .editor-card-head {
  grid-template-columns: 22px 72px minmax(0, 1fr) 40px;
}

.hero-slide-card .chip-drag-handle {
  cursor: grab;
}

.hero-slide-card.dragging {
  opacity: 0.55;
}

.hero-slide-card.drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
}

.hero-slide-card .editor-card-head img {
  object-fit: cover;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  color: var(--accent);
  cursor: pointer;
  font-size: 1.3rem;
}

.backup-tools {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 10px;
  align-items: start;
}

.backup-tools textarea {
  grid-column: 1 / -1;
  font-family: Consolas, monospace;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  background: var(--ink);
  border-radius: 8px;
  color: var(--white);
  padding: 12px 16px;
  transition: 0.2s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1080px) {
  .service-grid,
  .product-grid,
  .catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .asset-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .asset-picker-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .site-header {
    align-items: center;
    flex-direction: row;
    gap: 12px;
    /* 關鍵：backdrop-filter 會讓子層 .primary-nav 的 position:fixed
       以站頭為基準，導致抽屜被壓成一小塊。手機版直接移除。 */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--paper);
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-toggle {
    display: flex;
  }

  /* 漢堡抽屜：全螢幕、單欄直滾、品牌清單預設全展開 */
  .primary-nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    /* 不佔滿整個畫面，左側保留一截頁面 + 半透明遮罩，視覺上才知道是疊在前台上方 */
    width: min(330px, 82%);
    max-width: 100vw;
    background: var(--paper);
    border-left: 1px solid var(--line);
    box-shadow: -16px 0 40px rgba(25, 23, 20, 0.18);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 30;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 72px 20px 36px;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
  }

  .primary-nav.is-open {
    transform: translateX(0);
  }

  .primary-nav > *,
  .primary-nav a,
  .primary-nav .nav-menu-button {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    flex: 0 0 auto;
  }

  .primary-nav a,
  .primary-nav .nav-menu-button {
    justify-content: flex-start;
    text-align: left;
    min-height: 48px;
    padding: 12px 14px;
    font-size: 1.05rem;
  }

  .nav-dropdown {
    width: 100%;
    display: block;
  }

  /* 品牌清單：點「經銷品牌」展開／折疊（沿用 .open，箭頭會跟著轉）。
     抽屜內改用 max-height 手風琴式滑開，收合時高度歸零不留空白。 */
  .brand-menu {
    position: static;
    width: 100%;
    max-width: 100%;
    grid-template-columns: minmax(0, 1fr);
    box-shadow: none;
    border: 0;
    border-left: 2px solid var(--line);
    background: transparent;
    gap: 6px;
    /* 覆蓋桌機的淡出/位移，改用高度收合 */
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
    max-height: 0;
    overflow: hidden;
    padding: 0 0 0 12px;
    margin: 0 0 0 6px;
    transition: max-height 0.3s ease, padding 0.3s ease, margin 0.3s ease;
  }

  .brand-menu.open {
    transform: none;
    max-height: 1600px;
    padding: 6px 0 6px 12px;
    margin: 2px 0 8px 6px;
  }

  .brand-menu-item {
    background: transparent;
    width: 100%;
    max-width: 100%;
    min-height: 54px;
  }

  .brand-menu-item span {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* 站頭品牌：在窄螢幕不要卡 220px */
  .brand {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .brand span {
    min-width: 0;
    overflow: hidden;
  }

  .brand strong,
  .brand small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .intro-section,
  .store-section,
  .admin-layout,
  .catalog-page,
  .product-detail-hero,
  .product-detail-section {
    grid-template-columns: 1fr;
  }

  .catalog-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }

  /* 手機：品牌側欄改成點標題收折，預設收合避免版面過長 */
  .sidebar-block-toggle {
    cursor: pointer;
    margin-bottom: 0;
  }

  .sidebar-block-toggle .caret {
    display: inline-block;
  }

  .sidebar-block-toggle[aria-expanded="true"] .caret {
    transform: rotate(-135deg) translate(-1px, -1px);
  }

  #brandSidebarBlock .catalog-filter-list {
    overflow: hidden;
    transition: max-height 0.3s ease;
    max-height: 2000px;
  }

  #brandSidebarBlock.is-collapsed .catalog-filter-list {
    max-height: 0;
  }

  #brandSidebarBlock:not(.is-collapsed) .catalog-filter-list {
    margin-top: 14px;
  }

  .catalog-heading {
    align-items: start;
    flex-direction: column;
  }

  .hero-slide {
    min-height: clamp(360px, 60vh, 520px);
  }

  /* 手機改全幅遮罩，文字置中靠下更好讀 */
  .hero-slide::after {
    background: linear-gradient(
      180deg,
      rgba(20, 18, 16, 0.25) 0%,
      rgba(20, 18, 16, 0.55) 55%,
      rgba(20, 18, 16, 0.82) 100%
    );
  }

  /* 手機：隱藏左右箭頭（會壓到文字），改用滑動手勢 + 底部圓點切換 */
  .hero-arrow {
    display: none;
  }

  /* 圓點放大、加大可點範圍，方便手指切換 */
  .hero-dots {
    gap: 12px;
  }

  .hero-dot {
    width: 13px;
    height: 13px;
  }

  .product-tools,
  .product-tools.catalog-tools,
  .form-grid,
  .editor-card-body,
  .news-item {
    grid-template-columns: 1fr;
  }

  .checkbox-panel {
    position: static;
    box-shadow: none;
    margin-top: 8px;
  }

  .product-image-editor {
    grid-template-columns: 1fr;
  }

  .asset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-edit-heading,
  .product-admin-card {
    grid-template-columns: 1fr;
  }

  .product-admin-card-actions {
    justify-content: flex-start;
  }

  .asset-picker-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .brand-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-sidebar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    position: static;
    max-height: none;
    overflow: visible;
  }

  .tab-button {
    margin: 0;
  }

  /* 群組標題在手機格狀排列時跨整列 */
  .tab-group-label {
    grid-column: 1 / -1;
    margin: 12px 4px 2px;
  }

  .tab-group-label:first-child {
    margin-top: 0;
  }
}

@media (max-width: 560px) {
  .service-grid,
  .product-grid,
  .catalog-grid,
  .backup-tools {
    grid-template-columns: 1fr;
  }

  /* 經銷品牌維持兩項一列（沿用 ≤820 的兩欄），避免單欄過大 */
  .brand-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .asset-grid {
    grid-template-columns: 1fr;
  }

  .asset-picker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .backup-tools textarea {
    grid-column: auto;
  }

  .store-info div {
    grid-template-columns: 1fr;
  }

  .editor-card-head {
    grid-template-columns: 56px minmax(0, 1fr) 38px;
  }

  .editor-card-head img {
    width: 56px;
    height: 56px;
  }

  .hero-slide-card .editor-card-head {
    grid-template-columns: 20px 56px minmax(0, 1fr) 38px;
  }
}

/* ============================
   行動端額外修正 (M4 / M6 / M10 / M11 / M12)
   ============================ */

/* M10: 平板直立 (821–1080) 時新聞日期欄縮窄；≤820 由上方規則改為單欄堆疊，
   故此處下限設 821px，避免覆蓋手機的單欄排版。 */
@media (min-width: 821px) and (max-width: 1080px) {
  .news-item {
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 16px;
  }
}

@media (max-width: 820px) {
  /* M11: footer 排好對齊 */
  footer {
    gap: 6px;
    padding-top: 22px;
    padding-bottom: 22px;
  }
}

/* M6: 商品詳情頁規格欄在很窄螢幕改成單欄 */
@media (max-width: 560px) {
  .detail-spec-panel div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .detail-spec-panel dt {
    font-size: 0.82rem;
  }

  /* hero 主標題在最小螢幕再縮一點 */
  .hero-slide-title,
  .product-detail-copy h1,
  .catalog-heading h1 {
    font-size: clamp(1.8rem, 7vw, 2.4rem);
  }

  .section {
    padding-left: 18px;
    padding-right: 18px;
  }
}

/* M12: 觸控裝置統一拉到 44px 觸控目標 */
@media (hover: none) and (pointer: coarse) {
  nav a,
  nav button,
  .primary-nav a,
  .primary-nav .nav-menu-button,
  .primary-action,
  .secondary-action,
  .primary-button,
  .secondary-button,
  .danger-button {
    min-height: 44px;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }

  .catalog-chip,
  .filter-checkbox {
    min-height: 44px;
  }

  .detail-thumbnail {
    width: 76px;
    height: 64px;
  }
}
