@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700&display=swap');

:root {
  --ink: #1a2e35;
  --muted: #5d7882;
  --line: #d7e2e7;
  --surface: #ffffff;
  --bg: #f2f5f7;
  --primary: #0f6f7d;
  --accent: #c96a24;
  --ok: #1f8a5b;
  --danger: #c44536;
  --warn: #c98512;
  --font: 'Noto Sans TC', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.shop-top {
  background: #0b3a4a;
  color: #eef8fa;
  border-bottom: 1px solid #092f3c;
}
.shop-top-inner {
  width: min(1200px, calc(100% - 28px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}
.shop-brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.shop-brand {
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
}
.shop-brand:hover { text-decoration: none; opacity: 0.9; }
.company-tag {
  background: rgba(255,255,255,.12);
  color: #e8f4f6;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.82rem;
}
.shop-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.shop-nav > a {
  color: #e8f4f6;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.9rem;
  text-decoration: none;
}
.shop-nav > a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.shop-nav > a.active { background: rgba(255,255,255,.18); font-weight: 700; }
.shop-nav > a.cart-link { background: var(--accent); }
.shop-nav > a.cart-link:hover { background: #db7a33; }

.shop-wrap {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto;
  padding: 16px 0 48px;
}
.shop-nav > a.cart-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #fff;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
}

/* ===== 商城首頁 ===== */
.shop-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 22px 24px;
  border-radius: 14px;
  background:
    radial-gradient(500px 180px at 10% 0%, rgba(15, 111, 125, 0.18), transparent 60%),
    linear-gradient(135deg, #0b3a4a 0%, #145a6b 55%, #1a7a7a 100%);
  color: #eef8fa;
}
.shop-hero-kicker {
  margin: 0 0 6px;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  font-weight: 700;
  opacity: 0.8;
}
.shop-hero h1 {
  margin: 0 0 6px;
  font-size: 1.55rem;
  font-weight: 800;
}
.shop-hero-copy p:last-child {
  margin: 0;
  opacity: 0.88;
  font-size: 0.92rem;
  max-width: 420px;
}
.shop-search {
  display: flex;
  gap: 8px;
  width: min(420px, 100%);
}
.shop-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
}
.shop-catalog {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.shop-sidebar {
  position: sticky;
  top: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}
.shop-sidebar h2 {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.shop-sidebar h2 + .cat-nav { margin-bottom: 16px; }
.cat-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cat-nav a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
}
.cat-nav a:hover { background: #f0f6f8; text-decoration: none; }
.cat-nav a.active {
  background: #e7f4f6;
  color: var(--primary);
  font-weight: 700;
}
.cat-nav em {
  font-style: normal;
  font-size: 0.78rem;
  color: var(--muted);
  background: #eef3f5;
  padding: 1px 7px;
  border-radius: 999px;
}
.cat-nav a.active em { background: #fff; color: var(--primary); }
.cat-nav a.is-subcat {
  padding-left: 22px;
  font-size: 0.88rem;
  color: var(--muted);
}
.cat-nav a.is-subcat.active { color: var(--primary); }

.shop-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.shop-result { color: var(--muted); font-size: 0.92rem; }
.shop-result strong { color: var(--ink); }
.shop-sort label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}
.shop-sort select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  background: #fff;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.product-grid.related {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.product-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow .18s ease, transform .18s ease;
}
.product-card:hover {
  box-shadow: 0 10px 28px rgba(11, 58, 74, 0.1);
  transform: translateY(-2px);
}
.product-card.is-soldout { opacity: 0.78; }
.product-card-media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  text-decoration: none;
  overflow: hidden;
}
.product-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-initial {
  font-size: 2.4rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}
.product-initial.lg { font-size: 5rem; }
.temp-frozen {
  background: linear-gradient(145deg, #1d4e89, #3d7ea6 55%, #7eb6d9);
}
.temp-chilled {
  background: linear-gradient(145deg, #0f6f7d, #2a9aaa 55%, #7dcbd4);
}
.temp-ambient {
  background: linear-gradient(145deg, #8a5a2b, #c4874a 55%, #e2b57a);
}
.product-temp {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
}
.product-soldout {
  position: absolute;
  inset: auto 10px 10px auto;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(196, 69, 54, 0.92);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
}
.product-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 12px 14px;
  flex: 1;
}
.product-card-cat {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}
.product-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
}
.product-card-title.product-card-line {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.92rem;
}
.product-card-title.product-card-line > a {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-card-meta-inline {
  flex: 0 0 auto;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}
.product-card-title a {
  color: var(--ink);
  text-decoration: none;
}
.product-card-title a:hover { color: var(--primary); }
.product-card-meta {
  font-size: 0.8rem;
  color: var(--muted);
}
.product-card-price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 2px;
}
.product-card-price strong {
  font-size: 1.25rem;
  color: var(--accent);
  font-weight: 800;
}
.product-card-price span { color: var(--muted); font-size: 0.82rem; }
.product-card-buy {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: auto;
  padding-top: 8px;
}
.product-card-buy .btn { flex: 1; }

.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.qty-btn {
  width: 32px;
  height: 34px;
  border: 0;
  background: #f3f7f9;
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}
.qty-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.qty-stepper .qty-input {
  width: 48px;
  border: 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-radius: 0;
  text-align: center;
  padding: 6px 4px;
}

/* ===== 商品詳情 ===== */
.shop-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.88rem;
}
.shop-breadcrumb a { color: var(--primary); text-decoration: none; }
.product-detail {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 22px;
  margin-bottom: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.product-detail-media {
  position: relative;
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.product-detail-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-detail-info {
  padding: 22px 24px 24px;
}
.product-detail-info h1 {
  margin: 4px 0 8px;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.3;
}
.product-sku { margin: 0 0 14px; color: var(--muted); font-size: 0.9rem; }
.product-detail-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff7f0;
}
.product-detail-price strong {
  font-size: 1.8rem;
  color: var(--accent);
  font-weight: 800;
}
.product-spec {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 8px;
}
.product-spec li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.92rem;
}
.product-spec span { color: var(--muted); }
.product-desc h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}
.product-desc p {
  margin: 0 0 16px;
  color: var(--ink);
  line-height: 1.65;
}
.product-buy-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
}
.product-buy-box > label {
  width: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.btn-lg { padding: 11px 18px; font-size: 1rem; }
.related-block { margin-top: 8px; }
.related-block h2 {
  margin: 0 0 12px;
  font-size: 1.15rem;
}

.page-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.page-bar h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.section-head h2 {
  margin: 0;
  font-size: 1.1rem;
}
.section-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  align-items: center;
}
.filters input,
.filters select,
.shop-form input,
.shop-form select,
.shop-form textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
.filters input { min-width: 200px; }
.filters select { min-width: 120px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}
.panel h2 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 7px 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(1.03); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-ghost { background: #e8eef1; color: var(--ink); border-color: var(--line); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 9px; font-size: 0.82rem; }
.btn-block { width: 100%; }

.table-wrap { overflow-x: auto; }
table.shop-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table.shop-table th,
table.shop-table td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
table.shop-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  background: #f7fafb;
}
table.shop-table tr:hover td { background: #fafcfd; }
table.shop-table tr.is-process-follow td {
  background: #f4f8f6;
  font-size: 0.88rem;
  color: var(--muted);
}
.shop-process-select {
  min-width: 140px;
  max-width: 220px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 0.88rem;
}
.shop-process-tag {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #e6f2ec;
  color: #1f6b4a;
  font-size: 0.75rem;
  font-weight: 700;
}
.shop-process-preview {
  margin-top: 6px;
  font-size: 0.86rem;
  color: #1f6b4a;
}
.product-buy-box .shop-process-select {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 0 12px;
}
table.info-table th {
  width: 110px;
  background: #f7fafb;
}
table.info-table td { background: #fff; }

.inline-order {
  display: flex;
  gap: 6px;
  align-items: center;
}
.qty-input {
  width: 72px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  font: inherit;
}

.badge {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}
.badge-ok { background: #dff5ea; color: var(--ok); }
.badge-warn { background: #fff2d8; color: var(--warn); }
.badge-danger { background: #fde2de; color: var(--danger); }
.badge-info { background: #d9f0f4; color: var(--primary); }
.badge-muted { background: #e9eef1; color: var(--muted); }
.badge-primary { background: #d9f0f4; color: var(--primary); }

.alert {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}
.alert-success { background: #dff5ea; color: #145c3b; }
.alert-error { background: #fde2de; color: #8a2b22; }
.alert-info { background: #dcecff; color: #1e4e8c; }

.shop-form label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.shop-form .field { margin-bottom: 12px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-grid .full { grid-column: 1 / -1; }

.two-col {
  display: grid;
  grid-template-columns: 1.4fr .9fr;
  gap: 14px;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1.4fr .8fr;
  gap: 16px;
}
.summary-line {
  display: flex;
  justify-content: space-between;
  margin: 6px 0;
  color: var(--muted);
}
.summary-total {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 1.1rem;
  font-weight: 700;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 10px;
}
.product-meta { color: var(--muted); font-size: 0.82rem; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg);
}
.login-card {
  width: min(400px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}
.login-card h1 {
  margin: 0 0 4px;
  font-size: 1.3rem;
  color: #0b3a4a;
}
.login-card p { color: var(--muted); margin: 0 0 16px; font-size: 0.9rem; }
.login-meta {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-grid.related { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .two-col, .detail-grid, .product-detail { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .shop-top-inner { flex-direction: column; align-items: flex-start; }
  .shop-catalog { grid-template-columns: 1fr; }
  .shop-sidebar { position: static; }
  .shop-hero { align-items: stretch; }
  .product-detail-media { min-height: 240px; }
}
@media (max-width: 560px) {
  .product-grid,
  .product-grid.related { grid-template-columns: 1fr; }
  .product-card-buy { flex-wrap: wrap; }
  .product-card-buy .btn { width: 100%; }
}

/* —— B2B 登入／認領／註冊 —— */
.shop-auth-body { min-height: 100vh; }
.shop-auth-wrap { max-width: 960px; }
.shop-auth-hero { margin-bottom: 18px; }
.b2b-rules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
.b2b-rule-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 18px 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}
.b2b-rule-card h2 {
  margin: 0 0 10px;
  font-size: 1.15rem;
  color: var(--ink);
}
.b2b-rule-card ol {
  margin: 0 0 14px;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.92rem;
}
.b2b-rule-card .btn { display: inline-flex; }
.b2b-login-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 22px 18px;
  max-width: 480px;
  margin: 0 auto 28px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}
.b2b-login-panel.b2b-login-match {
  max-width: none;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}
.b2b-panel-wide { max-width: 640px; }
.b2b-login-panel h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}
.b2b-hint {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}
.b2b-form label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  margin: 10px 0 6px;
  color: #334155;
}
.b2b-form label em { color: #dc2626; font-style: normal; }
.b2b-form input,
.b2b-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.95rem;
}
.b2b-form input[type="radio"],
.b2b-form input[type="checkbox"] {
  width: auto;
  padding: 0;
  border: none;
  flex-shrink: 0;
}
.b2b-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.b2b-form-links {
  text-align: center;
  margin: 14px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.b2b-form-links a { color: var(--primary); }
.shop-auth-foot {
  text-align: center;
  padding: 18px 12px 28px;
  color: var(--muted);
  font-size: 0.82rem;
}
.b2b-claim-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 14px;
  max-height: 320px;
  overflow: auto;
}
.b2b-claim-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  background: #f8fafc;
  font-weight: 400;
  margin: 0;
}
.b2b-form label.b2b-claim-item {
  display: flex;
  flex-direction: column;
  margin: 0;
  font-weight: 400;
  color: inherit;
}
.b2b-claim-item:has(input:checked) {
  border-color: var(--primary);
  background: #eff8ff;
}
.b2b-claim-title-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.b2b-claim-title-row input[type="radio"] {
  margin: 0;
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  align-self: center;
}
.b2b-claim-title-row strong {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
  min-width: 0;
}
.b2b-claim-item > small,
.b2b-claim-addr {
  display: block;
  padding-left: calc(1.05rem + 8px);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}
.b2b-claim-item small.is-warn { color: #b45309; }