:root {
  /* 主色：翡翠綠（園藝感、比冷藍更溫暖耐看） */
  --tb-orange: #059669;
  --tb-orange-dark: #047857;
  --brand-tint: #ecfdf5;
  --brand-tint-strong: #d1fae5;
  --brand-soft-border: #6ee7b7;
  --leaf: #2d6a4f;
  --leaf-light: #40916c;
  --bg: #f8faf9;
  --card: #ffffff;
  --text: #1b4332;
  --muted: #6b7280;
  --spec: #4b5563;
  --border: #e2e8f0;
  --radius: 16px;
  --shadow: 0 10px 25px -5px rgba(5, 150, 105, 0.1), 0 8px 10px -6px rgba(5, 150, 105, 0.1);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --layout-max: 1200px;
  --sidebar-w: 220px;
  --card-thumb: 1;
  --font-title: 14px;
  --font-spec: 12px;
  --line-title: 1.35;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: clip;
  width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: 
    radial-gradient(rgba(5, 150, 105, 0.1) 1px, transparent 1px) 0 0 / 20px 20px repeat,
    linear-gradient(rgba(248, 250, 249, 0.35), rgba(248, 250, 249, 0.35)) center / 100% 100% no-repeat,
    url("头像/bg-main.png") center / cover no-repeat;
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  vertical-align: middle;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  vertical-align: middle;
}

.social-ico {
  flex-shrink: 0;
  display: block;
}

.social-link--fb .social-ico {
  color: #1877f2;
}

.social-link--wa .social-ico {
  color: #25d366;
}

.social-link--topbar {
  font-weight: 600;
}

.nav-social {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-social .social-ico {
  position: relative;
  top: 1px;
}

.intro-card .social-link {
  color: var(--tb-orange);
  font-weight: 600;
}

.intro-card .social-link:hover {
  text-decoration: underline;
}

.main-hint .social-link {
  text-decoration: underline;
}

.main-hint .social-link--fb .social-ico {
  color: #1877f2;
}

.main-hint .social-link--wa .social-ico {
  color: #25d366;
}

.footer .social-link--footer {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}

.footer .social-link--fb .social-ico {
  color: #86efac;
}

.footer .social-link--wa .social-ico {
  color: #6ee7b7;
}

.top-bar {
  background: linear-gradient(105deg, #10b981 0%, var(--tb-orange) 42%, var(--tb-orange-dark) 100%);
  color: #fff;
  font-size: 12px;
  padding: 6px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  overflow-x: clip;
  width: 100%;
}

.top-bar a {
  color: #fff;
  opacity: 0.95;
}

.top-bar a:hover {
  text-decoration: underline;
}

.top-bar-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-bar-sep {
  opacity: 0.75;
  user-select: none;
}

.top-bar .social-link--topbar.social-link--fb .social-ico {
  color: #1877f2;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.2));
}

.top-bar .social-link--topbar.social-link--wa .social-ico {
  color: #25d366;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.2));
}

.top-bar-lead {
  min-width: 0;
}

.header-main {
  background: #ffffff; /* 改為純色背景以徹底解決模糊問題 */
  padding: 20px 24px;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.08);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  will-change: transform; /* 提示瀏覽器優化效能 */
  overflow-x: clip;
  width: 100%;
}

.header-inner {
  max-width: var(--layout-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 2.2fr 1fr;
  gap: 24px;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: #e8e8e8;
  border: 1px solid var(--border);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.brand-mark img:hover {
  transform: scale(1.1);
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--leaf);
}

.brand .sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.search-wrap {
  display: flex;
  border: 2px solid var(--tb-orange);
  border-radius: 8px;
  overflow: hidden;
  height: 40px;
  background: url("头像/bg-search.png") center / cover no-repeat;
}

.search-wrap input {
  flex: 1;
  border: none;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.85); /* 使背景圖透出一些 */
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
}

.search-wrap button {
  background: var(--tb-orange);
  color: #fff;
  border: none;
  padding: 0 28px;
  font-weight: 600;
  cursor: pointer;
  font-size: 15px;
}

.search-wrap button:hover {
  background: var(--tb-orange-dark);
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  font-size: 13px;
}

.header-actions .summary-btn {
  color: var(--tb-orange);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--tb-orange);
  background: var(--brand-tint);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
}

.header-actions .summary-btn:hover {
  background: var(--brand-tint-strong);
}

.nav-cats {
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 12px 24px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 14px;
}

.nav-cats a {
  color: var(--text);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

.nav-cats a:hover,
.nav-cats a.active {
  color: var(--tb-orange);
  border-bottom-color: var(--tb-orange);
}

.nav-cats a.nav-social--fb:hover,
.nav-cats a.nav-social--fb.active {
  color: var(--tb-orange);
  border-bottom-color: var(--tb-orange);
}

.nav-cats a.nav-social--wa {
  color: #128c7e;
}

.nav-cats a.nav-social--wa:hover,
.nav-cats a.nav-social--wa.active {
  color: #075e54;
  border-bottom-color: #128c7e;
}

.layout {
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: var(--space-5) var(--space-5) 48px;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: var(--space-5);
}

.main-hint {
  margin: 0 0 var(--space-3);
  font-size: var(--font-spec);
  color: var(--spec);
  line-height: 1.55;
}

.main-hint a {
  color: var(--tb-orange);
  text-decoration: underline;
}

.toolbar-stat {
  font-size: var(--font-title);
  color: var(--spec);
}

.toolbar-stat strong {
  color: var(--text);
  font-weight: 700;
}

@media (max-width: 900px) {
  .header-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .brand {
    justify-content: center;
  }

  .header-actions {
    justify-content: center;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .sidebar h3 {
    width: 100%;
  }

  .sidebar .intro-card {
    flex: 1 1 100%;
  }
}

.sidebar {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  height: fit-content;
  position: sticky;
  top: 12px;
}

.sidebar h3 {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--leaf);
}

.filter-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}

.filter-btn:hover,
.filter-btn.active {
  border-color: var(--tb-orange);
  background: var(--brand-tint);
  color: var(--tb-orange);
}

.intro-card {
  background: linear-gradient(135deg, var(--brand-tint) 0%, #ffffff 100%);
  border: 1px solid var(--brand-soft-border);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-4);
  font-size: 13px;
  color: var(--text);
  box-shadow: var(--shadow);
}

.intro-card strong {
  display: block;
  color: var(--leaf);
  margin-bottom: var(--space-2);
}

.info-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  font-size: 13px;
  line-height: 1.6;
}

.info-card strong {
  display: block;
  color: var(--leaf);
  margin-bottom: var(--space-2);
  font-size: 14px;
}

.hours-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-3);
}

.hours-table td {
  padding: 4px 0;
  border-bottom: 1px solid #f5f5f5;
}

/* --- Community Section --- */
.community-section {
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.community-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 16px;
}

.community-header .section-title {
  margin: 0;
  color: var(--leaf);
}

.community-header .section-subtitle {
  margin: 0;
  color: var(--muted);
  flex-grow: 1;
}

#show-post-form-btn {
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
}

.post-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-5);
}

.post-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  border: 1px solid var(--border);
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.post-card__image {
  width: 100%;
  height: 250px;
  object-fit: cover;
  display: block;
  background-color: #f0f0f0;
}

.post-card__content {
  padding: var(--space-4);
}

.post-card__description {
  margin: 0 0 var(--space-3);
  font-size: 14px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 63px; /* 14px * 1.5 * 3 lines */
}

.post-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.post-card__author {
  font-weight: 600;
  color: var(--leaf-light);
}

/* Post Form Dialog */
#post-form-dialog .image-preview {
    max-width: 100%;
    height: auto;
    max-height: 200px;
    margin-top: 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

#post-form .char-counter {
    display: block;
    text-align: right;
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

/* --- Top Content Layout --- */
.top-content-wrapper {
  display: flex;
  gap: var(--space-5);
  align-items: flex-start;
  margin-bottom: var(--space-5);
}

.top-content-wrapper > .community-section {
  flex: 2;
  min-width: 0;
}

.top-content-wrapper > .billboard {
  flex: 1;
  min-width: 0;
  position: sticky;
  top: 80px; /* Adjust based on header height */
}


.hours-table tr:last-child td {
  border-bottom: none;
}

.hours-table td:last-child {
  text-align: right;
  font-weight: 600;
  color: var(--text);
}

.card-sep {
  border: none;
  border-top: 1px dashed var(--border);
  margin: var(--space-3) 0;
}

.address-text {
  margin: 0 0 var(--space-3);
  color: var(--spec);
}

.btn-map {
  display: block;
  text-align: center;
  padding: 10px;
  background: #f0fdf4;
  color: var(--leaf);
  border: 1px solid var(--brand-tint-strong);
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-map:hover {
  background: var(--brand-tint-strong);
  color: #fff;
}

.intro-survey {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed #a5d6a7;
}

.main-panel {
  min-width: 0;
}

/* Billboard / 公告板 */
.billboard {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: row;
  min-height: 200px;
  border: 1px solid var(--brand-soft-border);
  transition: box-shadow 0.3s ease;
}

.billboard:hover {
  box-shadow: 0 15px 35px -5px rgba(5, 150, 105, 0.15), 0 10px 15px -6px rgba(5, 150, 105, 0.15);
}

.billboard-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  background: rgba(0, 0, 0, 0.1);
  color: var(--text);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  font-size: 18px;
  line-height: 1;
  transition: all 0.2s;
}

.billboard-close:hover {
  background: rgba(0, 0, 0, 0.2);
  color: #ef4444;
}

.billboard-edit-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  z-index: 10;
  color: var(--spec);
  transition: all 0.2s;
}

.billboard-edit-btn:hover {
  background: var(--tb-orange);
  color: #fff;
  border-color: var(--tb-orange);
}

.billboard-edit-form {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 100%;
  background: #fff;
}

.billboard-edit-form h3 {
  margin: 0;
  font-size: 16px;
  color: var(--leaf);
}

.billboard-edit-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
}

.billboard-edit-form input[type="text"],
.billboard-edit-form input[type="file"],
.billboard-edit-form textarea {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
}

.billboard-edit-form input[type="file"] {
  padding: 6px;
  font-size: 12px;
}

.admin-login-entry,
.admin-logout-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.admin-login-entry:hover {
  background: var(--brand-tint);
  color: var(--tb-orange);
  border-color: var(--tb-orange);
}

.admin-logout-btn:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fecaca;
}

/* Admin Mode Styles */
body.is-admin-mode .wtp-form,
body.is-admin-mode .preorder-form,
body.is-admin-mode .archive-actions {
  display: none !important;
}

body.is-admin-mode .product-card {
  border-color: var(--brand-soft-border);
  background: linear-gradient(to bottom, #fff, #f0fdf4);
  cursor: pointer;
  position: relative;
}

body.is-admin-mode .product-card:hover {
  border-color: var(--tb-orange);
  box-shadow: 0 15px 30px -10px rgba(5, 150, 105, 0.2);
}

/* Ensure admin actions bar is flex when visible */
#admin-actions-bar {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

#admin-actions-bar[hidden] {
  display: none !important;
}

#add-product-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
}

#add-product-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

#add-product-btn:active {
  transform: translateY(0);
}

.product-admin-tools {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px dashed var(--border);
}

.btn-admin-edit, .btn-admin-del, .btn-admin-top {
  flex: 1;
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-admin-edit {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #dbeafe;
}

.btn-admin-del {
  background: #fef2f2;
  color: #ef4444;
  border: 1px solid #fee2e2;
}

.btn-admin-top {
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #ffedd5;
  flex: 0.8;
}

.btn-admin-edit:hover { background: #dbeafe; transform: translateY(-1px); }
.btn-admin-del:hover { background: #fee2e2; transform: translateY(-1px); }
.btn-admin-top:hover { background: #ffedd5; transform: translateY(-1px); }

/* Orders Section Styles */
.orders-section {
  animation: fadeIn 0.4s ease;
}

.orders-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 20px;
  background: #fff;
  padding: 20px;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.section-title {
  margin: 0 0 8px;
  font-size: 20px;
  color: var(--leaf);
}

.toolbar-actions {
  display: flex;
  gap: 12px;
}

.orders-table-wrapper {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.orders-table th {
  background: #f8fafc;
  padding: 16px;
  font-weight: 700;
  color: #475569;
  border-bottom: 2px solid #f1f5f9;
}

.orders-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.orders-table tr:hover {
  background: #f0fdf4;
}

.order-thumb {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s;
}

.order-thumb:hover {
  transform: scale(1.05);
}

.order-batch-header {
  background: #f8fafc;
}

.order-batch-header td {
  padding: 12px 16px !important;
  border-bottom: 2px solid var(--brand-soft-border) !important;
}

.batch-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  color: var(--leaf);
  font-size: 15px;
}

.batch-customer {
  background: var(--brand-tint-strong);
  padding: 4px 12px;
  border-radius: 8px;
  border: 1px solid var(--brand-soft-border);
}

.batch-time {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.order-time-mini {
  font-size: 11px;
  color: var(--muted);
}

.order-time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.order-status-select {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.order-status-select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.status-pending { background: #fff7ed; color: #ea580c; border-color: #ffedd5; }
.status-unprocessed { background: #fef2f2; color: #dc2626; border-color: #fee2e2; }
.status-shipping { background: #eff6ff; color: #2563eb; border-color: #dbeafe; }
.status-delivered { background: #f0fdf4; color: #16a34a; border-color: #dcfce7; }
.status-completed { background: #f5f3ff; color: #7c3aed; border-color: #ede9fe; }

.btn-danger-outline {
  background: transparent;
  color: #ef4444;
  border: 1px solid #fee2e2;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger-outline:hover {
  background: #fef2f2;
  border-color: #fecaca;
}

.btn-excel {
  background: #10b981;
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-excel:hover {
  background: #059669;
  transform: translateY(-1px);
}

.btn-order-del, .btn-order-edit {
  color: #ef4444;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-order-edit {
  color: #3b82f6;
}

.btn-order-del:hover {
  background: #fee2e2;
}

.btn-order-edit:hover {
  background: #dbeafe;
}

.btn-simulate-order {
  flex: 1;
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: #f0f9ff;
  color: #0284c7;
  border: 1px solid #e0f2fe;
}

.btn-simulate-order:hover {
  background: #e0f2fe;
  transform: translateY(-1px);
}

.btn-upload-manual:hover {
  background: var(--brand-tint) !important;
  border-color: var(--tb-orange) !important;
  color: var(--tb-orange);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
  .header-inner {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .header-main {
    padding: 12px 16px;
  }

  .brand {
    justify-content: center;
    text-align: center;
  }

  .search-wrap {
    order: 3;
    width: 100%;
  }

  .header-actions {
    justify-content: center;
    width: 100%;
    margin-bottom: 4px;
  }

  .nav-cats {
    padding: 8px 16px;
    gap: 12px;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-cats a {
    white-space: nowrap;
    font-size: 13px;
  }

  /* 隱藏側邊欄多餘的分類按鈕 (手機版已有導覽列) */
  .sidebar #filter-heading,
  .sidebar #filter-btns {
    display: none !important;
  }

  .layout {
    flex-direction: column;
    padding: 0 12px;
  }

  .sidebar {
    width: 100%;
    position: static;
    margin-bottom: 20px;
  }

  .billboard {
    flex-direction: column;
    min-height: auto;
  }

  .billboard-img {
    flex: none;
    width: 100%;
    height: 160px;
  }

  .billboard-content {
    padding: 20px;
  }

  .billboard-title {
    font-size: 18px;
  }

  .billboard-text {
    font-size: 14px;
    margin-bottom: 16px;
  }

  .chat-fab {
    bottom: 12px;
    right: 12px;
    width: 50px;
    height: 50px;
  }

  /* 訂單列表在手機版的優化 */
  .orders-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .orders-table thead { display: none; }
  .orders-table td {
    display: block;
    padding: 8px 16px;
    border: none;
    text-align: right;
  }
  .orders-table td::before {
    content: attr(data-label);
    float: left;
    font-weight: 700;
    color: #64748b;
  }
  .orders-table tr {
    display: block;
    border-bottom: 2px solid #f1f5f9;
    padding: 12px 0;
  }
  .order-thumb { width: 80px; height: 80px; }
}

@media (max-width: 480px) {
  .brand h1 {
    font-size: 18px;
  }
  
  .brand .sub {
    font-size: 11px;
  }

  .header-actions {
    gap: 8px;
  }

  .summary-btn {
    padding: 8px 12px;
    font-size: 12px;
  }
}
.premium-dialog {
  border: none;
  border-radius: 24px;
  padding: 0;
  box-shadow: 0 25px 50px -12px rgba(5, 150, 105, 0.25);
  width: 90%;
  max-width: 420px;
  overflow: hidden;
  background: #fff;
  opacity: 0;
  transform: scale(0.9) translateY(20px);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 90vh;
  display: none; /* 預設不顯示，避免佔據底部空間 */
  flex-direction: column;
}

.premium-dialog[open] {
  display: flex; /* 只有在打開時才顯示為 flex */
  opacity: 1;
  transform: scale(1) translateY(0);
}

.premium-dialog--wide {
  max-width: 700px;
}

.premium-dialog::backdrop {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  transition: opacity 0.4s ease;
}

.dialog-header {
  padding: 40px 30px 24px;
  text-align: center;
  background: linear-gradient(to bottom, #f0fdf4, #ffffff);
  border-bottom: 1px solid #f1f5f9;
  position: relative;
  flex-shrink: 0;
}

.dialog-icon-wrap {
  width: 64px;
  height: 64px;
  background: #10b981;
  color: #fff;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
}

.dialog-icon-wrap--edit {
  background: #3b82f6;
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3);
}

.dialog-title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: -0.5px;
}

.dialog-subtitle {
  margin: 8px 0 0;
  font-size: 14px;
  color: #64748b;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

.premium-form {
  padding: 30px;
  overflow-y: auto;
  flex: 1;
}

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 10px;
  transition: color 0.2s;
}

.form-group:focus-within label {
  color: #10b981;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon svg {
  position: absolute;
  left: 16px;
  color: #94a3b8;
  transition: color 0.2s;
}

.form-group:focus-within .input-with-icon svg {
  color: #10b981;
}

.input-with-icon input {
  padding-left: 48px !important;
}

.premium-form input,
.premium-form select,
.premium-form textarea {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  font-size: 15px;
  color: #1e293b;
  background: #f8fafc;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.premium-form input:focus,
.premium-form select:focus {
  outline: none;
  border-color: #10b981;
  background: #fff;
  box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.1);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.full-width {
  grid-column: span 2;
}

.image-preview-container {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  margin-top: 12px;
}

.preview-box {
  width: 120px;
  height: 120px;
  background: #f1f5f9;
  border-radius: 12px;
  border: 2px dashed #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.2s;
}

.preview-box img:hover {
  transform: scale(1.1);
}

.preview-box .placeholder-icon {
  color: #94a3b8;
}

.image-upload-wrapper {
  background: #f8fafc;
  border: 2px dashed #e2e8f0;
  border-radius: 16px;
  padding: 20px;
  transition: all 0.3s ease;
}

.image-upload-wrapper:hover {
  border-color: #10b981;
  background: #f0fdf4;
}

.image-path-input {
  margin-bottom: 16px;
}

.file-label {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  padding: 12px !important;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px !important;
  color: #475569 !important;
  font-weight: 600 !important;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.file-label:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.file-label input {
  display: none;
}

.dialog-footer {
  display: flex;
  gap: 16px;
  margin-top: 20px;
}

.remember-me-wrap {
  margin-top: -12px;
  margin-bottom: 24px;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px !important;
  font-weight: 600 !important;
  color: var(--muted) !important;
}

.checkbox-label input[type="checkbox"] {
  width: 18px !important;
  height: 18px !important;
  cursor: pointer;
  margin: 0;
  accent-color: var(--tb-orange);
}

.checkbox-label:hover {
  color: var(--tb-orange) !important;
}

.btn-cancel, .btn-submit {
  flex: 1;
  padding: 14px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-cancel {
  background: #fff;
  border: 2px solid #e2e8f0;
  color: #64748b;
}

.btn-submit {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  color: #fff;
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
}

.btn-cancel:hover { 
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #1e293b;
}

.btn-submit:hover { 
  transform: translateY(-2px);
  box-shadow: 0 20px 25px -5px rgba(16, 185, 129, 0.4);
}

.btn-submit:active {
  transform: translateY(0);
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .full-width {
    grid-column: span 1;
  }
}

.billboard-edit-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  margin-top: var(--space-2);
}

.billboard-img-preview-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: 4px;
}

.billboard-current-img-hint {
  font-size: 12px;
  color: var(--muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-delete-img {
  padding: 4px 8px;
  font-size: 11px;
  background: #fff;
  color: #ef4444;
  border: 1px solid #fee2e2;
  border-radius: 4px;
  cursor: pointer;
}

.btn-delete-img:hover {
  background: #fef2f2;
  border-color: #fecaca;
}

.billboard-img {
  flex: 0 0 40%;
  max-width: 400px;
  background: #f0fdf4;
}

.billboard-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: transform 0.5s ease;
}

.billboard-img img:hover {
  transform: scale(1.03);
}

.billboard-content {
  flex: 1;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

.billboard-badge {
  display: inline-block;
  background: var(--tb-orange);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: var(--space-2);
  width: fit-content;
  letter-spacing: 1px;
}

.billboard-title {
  margin: 0 0 var(--space-2);
  font-size: 24px;
  color: var(--leaf);
  font-weight: 800;
  line-height: 1.2;
}

.billboard-text {
  margin: 0 0 var(--space-4);
  color: var(--spec);
  font-size: 15px;
  line-height: 1.6;
}

.billboard-btn {
  display: inline-block;
  padding: 10px 24px;
  background: var(--leaf);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  width: fit-content;
  transition: transform 0.2s;
}

.billboard-btn:hover {
  transform: translateY(-2px);
  background: var(--tb-orange-dark);
  color: #fff;
}

@media (max-width: 768px) {
  .billboard {
    flex-direction: column;
  }
  .billboard-img {
    flex: none;
    max-width: 100%;
    height: 180px;
  }
  .billboard-title {
    font-size: 20px;
  }
}

.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.mode-tab {
  padding: 10px 18px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
}

.mode-tab:hover {
  border-color: var(--brand-soft-border);
  background: var(--brand-tint);
}

.mode-tab.active {
  border-color: var(--tb-orange);
  background: var(--brand-tint);
  color: var(--tb-orange);
}

.preorder-section {
  margin-top: 0;
}

.preorder-hint {
  margin-top: 0;
}

.filter-preorder-note {
  margin: var(--space-2) 0 0;
  font-size: 12px;
  color: var(--spec);
  line-height: 1.45;
  padding: var(--space-2) var(--space-3);
  background: var(--brand-tint);
  border-radius: 8px;
  border: 1px dashed var(--brand-soft-border);
}

.product-card--preorder .preorder-price-block {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.product-card--preorder .preorder-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--tb-orange);
}

.product-card--preorder .preorder-price-tag {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.product-card--preorder .preorder-note {
  margin: 0 0 var(--space-3);
  font-size: var(--font-spec);
  color: var(--spec);
}

.preorder-form {
  margin-top: auto;
  padding-top: var(--space-2);
}

.preorder-label {
  display: block;
  font-size: var(--font-spec);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.preorder-row {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
  flex-wrap: wrap;
}

.preorder-qty-input {
  flex: 1;
  min-width: 72px;
  max-width: 120px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: var(--font-spec);
  font-family: inherit;
}

.preorder-submit {
  padding: 8px 14px;
  min-height: 40px;
  background: var(--leaf);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: var(--font-spec);
  font-family: inherit;
}

.preorder-submit:hover {
  background: #246b52;
}

/* Archive Actions */
.archive-actions {
  margin-top: var(--space-3);
}

.archive-want-btn {
  width: 100%;
  padding: 10px;
  background: #fff;
  color: var(--leaf);
  border: 1px solid var(--brand-soft-border);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.archive-want-btn:hover {
  background: var(--brand-tint);
  border-color: var(--tb-orange);
}

.archive-want-btn.active {
  background: var(--tb-orange);
  color: #fff;
  border-color: var(--tb-orange);
}

.product-card.is-wanted {
  border-color: var(--tb-orange);
  background: var(--brand-tint);
}

.summary-section-h {
  margin: var(--space-4) 0 var(--space-2);
  font-size: 15px;
  color: var(--leaf);
}

.summary-section-h:first-child {
  margin-top: 0;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
}

.sort-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sort-row button {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}

.sort-row button.active {
  border-color: var(--tb-orange);
  color: var(--tb-orange);
  background: var(--brand-tint);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: var(--space-4);
  align-items: stretch;
}

.product-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  border: 1px solid var(--border);
}

.product-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 25px -5px rgba(5, 150, 105, 0.1), 0 10px 10px -5px rgba(5, 150, 105, 0.04);
  border-color: var(--brand-soft-border);
}

.product-card .thumb {
  aspect-ratio: var(--card-thumb);
  background: var(--brand-tint);
  overflow: hidden;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.product-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.product-card .thumb img:hover {
  transform: scale(1.08);
}

.product-card .info {
  padding: var(--space-3);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 0;
}

.product-card .title {
  font-size: var(--font-title);
  font-weight: 600;
  color: var(--text);
  line-height: var(--line-title);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(2em * var(--line-title));
  margin: 0;
}

.product-spec {
  margin: 0;
  padding: var(--space-2) 0;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  font-size: var(--font-spec);
  color: var(--spec);
}

/* Manual Order Worksheet Styles */
.manual-items-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px;
}

.order-manual-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  position: relative;
  transition: all 0.2s ease;
}

.order-manual-item:hover {
  border-color: var(--brand-soft-border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
}

.item-index {
  margin: 0;
  color: var(--leaf);
  font-size: 14px;
  font-weight: 700;
}

.btn-remove-item {
  background: #fee2e2;
  color: #ef4444;
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-remove-item:hover {
  background: #fecaca;
}

.manual-item-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 80px 60px;
  gap: 12px;
  align-items: end;
}

.manual-item-grid .form-group {
  margin-bottom: 0 !important;
}

.manual-item-grid label {
  font-size: 11px !important;
  margin-bottom: 4px !important;
  color: #64748b !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.manual-item-grid input {
  padding: 8px 10px !important;
  font-size: 13px !important;
  border-radius: 6px !important;
}

.image-preview-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.order-manual-img-preview {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.order-manual-img-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.2s;
}

.order-manual-img-preview img:hover {
  transform: scale(1.1);
}

.manual-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.btn-outline-dashed {
  flex: 1;
  background: #fff;
  border: 2px dashed #cbd5e1;
  color: #475569;
  padding: 10px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.btn-outline-dashed:hover {
  border-color: var(--leaf);
  color: var(--leaf);
  background: #f0fdf4;
}

.btn-text-danger {
  padding: 0 12px;
  background: none;
  border: none;
  color: #ef4444;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.btn-text-danger:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .manual-item-grid {
    grid-template-columns: 1fr 1fr;
  }
  .qty-group, .img-group {
    grid-column: span 1;
  }
}

/* Custom Manual Search Results Dropdown */
.manual-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  max-height: 250px;
  overflow-y: auto;
  margin-top: 4px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid #f1f5f9;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: #f0fdf4;
}

.result-img {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.result-info {
  flex: 1;
  min-width: 0;
}

.result-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-sku {
  display: block;
  font-size: 11px;
  color: #64748b;
}

.no-results {
  padding: 12px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}

.product-spec .row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: var(--space-1) var(--space-2);
  align-items: start;
  margin-bottom: var(--space-1);
}

.product-spec .row:last-child {
  margin-bottom: 0;
}

.product-spec dt {
  margin: 0;
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
}

.product-spec dd {
  margin: 0;
  word-break: break-word;
}

.wtp-form {
  margin-top: auto;
  padding-top: var(--space-2);
}

.wtp-label {
  display: block;
  font-size: var(--font-spec);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-1);
}

.wtp-row {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
}

.wtp-input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: var(--font-spec);
  font-family: inherit;
}

.wtp-input:focus {
  outline: none;
  border-color: var(--tb-orange);
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.22);
}

.wtp-submit {
  flex-shrink: 0;
  padding: 8px 12px;
  min-width: 88px;
  background: var(--tb-orange);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: var(--font-spec);
  font-family: inherit;
}

.wtp-submit:hover {
  background: var(--tb-orange-dark);
}

.wtp-hint {
  margin: var(--space-2) 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.summary-dialog {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: min(92vw, 560px);
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
  display: none;
}

.summary-dialog[open] {
  display: block;
}

.summary-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.summary-dialog-inner {
  padding: var(--space-4) var(--space-5);
}

.summary-title {
  margin: 0 0 var(--space-3);
  font-size: 18px;
  color: var(--leaf);
}

.btn-submit-order {
  background: #10b981;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-submit-order:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
}

.summary-user-info {
  margin-bottom: 20px;
  padding: 15px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.summary-user-info label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #475569;
}

.summary-user-info input {
  width: 100%;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
}

.summary-user-info input:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.required-star {
  color: #ef4444;
}

.order-contact-info {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
}

.batch-customer-contact {
  margin-left: 15px;
  font-size: 13px;
  color: #64748b;
  font-weight: normal;
}

.summary-body {
  max-height: min(50vh, 360px);
  overflow: auto;
  margin-bottom: var(--space-3);
}

.summary-empty {
  margin: 0;
  color: var(--muted);
  text-align: center;
  padding: var(--space-4);
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-spec);
}

.summary-table th,
.summary-table td {
  border: 1px solid var(--border);
  padding: var(--space-2) var(--space-2);
  text-align: left;
  vertical-align: top;
}

.summary-table th {
  background: #fafafa;
  font-weight: 600;
}

.summary-table .num {
  white-space: nowrap;
}

.summary-hint {
  margin: 0 0 var(--space-3);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
}

.dialog-actions button {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: var(--font-spec);
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
}

.btn-primary {
  background: var(--tb-orange);
  color: #fff;
  border-color: var(--tb-orange) !important;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--tb-orange-dark);
}

.btn-excel {
  background: #1d6f42;
  color: #fff;
  border-color: #1d6f42 !important;
  font-weight: 600;
}

.btn-excel:hover {
  background: #155130;
}

.btn-secondary {
  background: #fff;
  color: var(--text);
}

.btn-secondary:hover {
  background: #f5f5f5;
}

.btn-danger {
  background: #fff;
  color: #c62828;
  border-color: #ffcdd2 !important;
}

.btn-danger:hover {
  background: #ffebee;
}

.footer {
  background: #2c2c2c;
  color: #bbb;
  padding: var(--space-5) var(--space-5);
  font-size: var(--font-spec);
  text-align: center;
}

.footer-brand {
  color: #eee;
}

.footer a {
  color: #6ee7b7;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 100;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Lightbox */
.lightbox {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  max-width: none;
  max-height: none;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: none;
  align-items: center;
  justify-content: center;
}

.lightbox[open] {
  display: flex;
}

.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
}

.lightbox.show {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 99999;
}

.lightbox-content {
  position: relative;
  max-width: min(90vw, 800px);
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: -10px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  padding: 10px;
  line-height: 1;
  font-family: Arial, sans-serif;
}

.lightbox-close:hover {
  color: var(--tb-orange);
}

.brand-mark img {
  cursor: zoom-in;
}

.product-card .thumb img {
  cursor: zoom-in;
}

.empty-hint {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px var(--space-5);
  color: var(--muted);
  background: #fff;
  border-radius: var(--radius);
}

/* 右下角常見問題小助手 */
.chat-widget {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.chat-widget > * {
  pointer-events: auto;
}

.chat-panel {
  width: min(100vw - 32px, 340px);
  max-height: min(72vh, 520px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border);
  overflow: hidden;
}

/* 必須關閉整個浮層；避免被其他 display 規則蓋掉 [hidden] */
.chat-panel[hidden] {
  display: none !important;
}

.chat-faq-wrap[hidden],
.chat-welcome[hidden] {
  display: none !important;
}

.chat-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(105deg, #ecfdf5 0%, var(--brand-tint-strong) 100%);
  border-bottom: 1px solid var(--border);
}

.chat-panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--leaf);
}

.chat-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

.chat-panel-body {
  padding: var(--space-3) var(--space-3) var(--space-4);
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.55;
}

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding: var(--space-2) 0 var(--space-1);
}

.chat-avatar-btn {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 3px solid var(--brand-soft-border);
  background: linear-gradient(145deg, var(--brand-tint-strong) 0%, #fff 100%);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
  padding: 0;
}

.chat-avatar-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.28);
}

.chat-avatar-btn:focus-visible {
  outline: 2px solid var(--tb-orange);
  outline-offset: 3px;
}

.chat-avatar-large {
  font-size: 48px;
  line-height: 1;
}
.chat-welcome-text {
  margin: 0;
  font-size: 13px;
  color: var(--spec);
  line-height: 1.6;
}

.btn-chat-dismiss {
  margin-top: var(--space-1);
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--spec);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 600;
}

.btn-chat-dismiss:hover {
  background: #f5f5f5;
  color: var(--text);
}

.btn-chat-dismiss--bottom {
  width: 100%;
  margin-top: var(--space-4);
}

.chat-panel-hint {
  margin: 0 0 var(--space-3);
  font-size: 12px;
  color: var(--spec);
}

.chat-faq {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: var(--space-2);
  background: #fafafa;
}

.chat-faq:last-child {
  margin-bottom: 0;
}

.chat-faq summary {
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.chat-faq summary::-webkit-details-marker {
  display: none;
}

.chat-faq summary::after {
  content: "";
  flex-shrink: 0;
  width: 0.5em;
  height: 0.5em;
  margin-top: 0.35em;
  border-right: 2px solid var(--tb-orange);
  border-bottom: 2px solid var(--tb-orange);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.chat-faq[open] summary::after {
  transform: rotate(-135deg);
  margin-top: 0.5em;
}

.chat-faq summary:hover {
  color: var(--tb-orange);
}

.chat-answer {
  padding: 0 12px 12px;
  border-top: 1px dashed var(--border);
  color: var(--spec);
}

.chat-answer p {
  margin: 10px 0 0;
}

.chat-answer p:first-child {
  margin-top: 10px;
}

.chat-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, var(--tb-orange) 0%, var(--tb-orange-dark) 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(5, 150, 105, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}

.chat-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.5);
}

.chat-fab:focus-visible {
  outline: 2px solid var(--tb-orange);
  outline-offset: 3px;
}

.chat-fab-emoji {
  display: block;
  font-size: 28px;
  line-height: 1;
}

/* 手機版（≤768px）：與 device.js 斷點一致；無 JS 時仍依螢幕寬度生效 */
@media (max-width: 768px) {
  body {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .layout {
    display: flex;
    flex-direction: column-reverse;
    gap: var(--space-4);
    padding-left: max(var(--space-3), env(safe-area-inset-left, 0px));
    padding-right: max(var(--space-3), env(safe-area-inset-right, 0px));
    padding-top: var(--space-3);
  }

  .main-panel {
    order: 0;
  }

  .sidebar {
    display: block;
    position: static;
    top: auto;
    order: 1;
    width: 100%;
  }

  .top-bar {
    font-size: 11px;
    padding: 8px max(var(--space-3), env(safe-area-inset-left, 0px)) 8px
      max(var(--space-3), env(safe-area-inset-right, 0px));
    align-items: flex-start;
  }

  .top-bar-lead {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    padding-right: var(--space-2);
  }

  .header-main {
    padding: 12px max(var(--space-3), env(safe-area-inset-left, 0px)) 14px
      max(var(--space-3), env(safe-area-inset-right, 0px));
  }

  .brand h1 {
    font-size: 18px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .nav-cats {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    gap: 14px;
    padding: 10px max(var(--space-3), env(safe-area-inset-left, 0px)) 12px
      max(var(--space-3), env(safe-area-inset-right, 0px));
    scrollbar-width: thin;
    border-bottom: 1px solid var(--border);
  }

  .nav-cats a {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 8px 0;
  }

  .product-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
  }

  .product-card {
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  }

  .product-card:hover {
    transform: none;
  }

  .filter-btn {
    min-height: 44px;
    padding: 12px 14px;
  }

  .sort-row button {
    min-height: 40px;
    padding: 8px 12px;
  }

  .wtp-input {
    min-height: 44px;
    font-size: 16px;
  }

  .wtp-submit {
    min-height: 44px;
    padding: 10px 14px;
  }

  .header-actions .summary-btn {
    min-height: 44px;
    padding: 10px 14px;
  }

  .summary-dialog {
    margin: auto;
    max-height: min(90vh, 640px);
    width: calc(100% - 2 * var(--space-3));
  }

  .summary-dialog-inner {
    padding: var(--space-4);
  }

  .toast {
    bottom: max(24px, env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 480px) {
  .top-bar {
    flex-direction: column;
    gap: var(--space-1);
    text-align: center;
    padding: var(--space-2) var(--space-3);
  }

  .search-wrap {
    height: 44px;
  }

  .product-spec .row {
    grid-template-columns: 48px 1fr;
  }

  .wtp-row {
    flex-direction: column;
  }

  .wtp-submit {
    width: 100%;
  }

  .preorder-row {
    flex-direction: column;
  }

  .preorder-submit {
    width: 100%;
  }
}
