﻿:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --text: #17211b;
  --muted: #69746c;
  --line: #dde5dc;
  --brand: #116149;
  --brand-2: #d84f2a;
  --soft: #e9f2ed;
  --shadow: 0 14px 36px rgba(31, 46, 38, .12);
  --scroll-thumb: color-mix(in srgb, var(--brand) 42%, transparent);
  --scroll-thumb-hover: color-mix(in srgb, var(--brand) 62%, transparent);
  --scroll-track: transparent;
}

html.theme-fresh,
body.theme-fresh {
  --bg: #f0f8f7;
  --brand: #087d8f;
  --brand-2: #f2a541;
  --soft: #e1f1f0;
}

html.theme-classic,
body.theme-classic {
  --bg: #f7f4ee;
  --brand: #4e5f35;
  --brand-2: #9e3f2f;
  --soft: #ede6d8;
}

html.theme-taobao,
body.theme-taobao {
  --bg: #fff5ef;
  --brand: #ff5000;
  --brand-2: #ff8a00;
  --soft: #fff0e5;
}

html.theme-xianyu,
body.theme-xianyu {
  --bg: #f9fbef;
  --brand: #f6c600;
  --brand-2: #18a058;
  --soft: #fff8cc;
  --text: #1e261f;
}

html.theme-jd,
body.theme-jd {
  --bg: #fff7f7;
  --brand: #e1251b;
  --brand-2: #b30000;
  --soft: #ffe8e8;
}

html.theme-amazon,
body.theme-amazon {
  --bg: #f3f5f6;
  --brand: #232f3e;
  --brand-2: #ff9900;
  --soft: #e8edf1;
}

* { box-sizing: border-box; }

* {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: var(--scroll-track);
}

*::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--brand);
  color: white;
  cursor: pointer;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--brand);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.download-link.small {
  min-height: 34px;
  padding: 7px 10px;
  margin-top: 6px;
}

.order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

a,
summary,
select,
input[type="checkbox"],
input[type="radio"],
input[type="file"],
[data-view],
[data-product-open],
[data-cart-add],
[data-buy],
[data-edit],
[data-delete],
[data-category-edit],
[data-category-delete],
[data-order-detail],
[data-admin-tab],
[data-page],
[data-carousel-dir],
[data-carousel-dot],
#mobileMenuBtn,
#floatCart,
#backToTop {
  cursor: pointer;
}

td button, .pager button, .list-tools button {
  padding: 8px 11px;
}

button:hover { filter: brightness(.95); }
button.secondary, .nav button, .tabs button, #logoutBtn, #resetProduct {
  background: var(--soft);
  color: var(--text);
}

.mobile-menu-btn {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  background: var(--soft);
  color: var(--text);
  position: relative;
}

.mobile-menu-btn span,
.mobile-menu-btn::before,
.mobile-menu-btn::after {
  content: "";
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  position: absolute;
  left: 12px;
  transition: top .18s ease, transform .18s ease, opacity .18s ease;
}

.mobile-menu-btn span { top: 20px; }
.mobile-menu-btn::before { top: 14px; }
.mobile-menu-btn::after { top: 26px; }

.topbar.menu-open .mobile-menu-btn span {
  opacity: 0;
}

.topbar.menu-open .mobile-menu-btn::before {
  top: 20px;
  transform: rotate(45deg);
}

.topbar.menu-open .mobile-menu-btn::after {
  top: 20px;
  transform: rotate(-45deg);
}

.nav-back {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  background: var(--soft);
  color: var(--text);
  place-items: center;
}

.nav-back svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-home-icon {
  display: none;
}

.topbar.detail-mode .nav-back {
  display: grid;
}

.topbar.admin-mode {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.topbar.admin-mode .nav-back {
  display: grid;
}

.topbar.admin-mode .nav-back-icon {
  display: none;
}

.topbar.admin-mode .nav-home-icon {
  display: block;
}

.topbar.admin-mode .brand {
  justify-content: center;
}

.topbar.admin-mode .nav,
.topbar.admin-mode .account {
  display: none;
}

.topbar.admin-mode .mobile-menu-btn {
  display: block;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 14px 28px;
  background: rgba(255,255,255,.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar.detail-mode {
  grid-template-columns: auto auto 1fr auto;
}

.brand, .nav, .account, .tabs, .dialog-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.mobile-menu-overlay {
  display: none;
}

.topbar.admin-mode + .mobile-menu-overlay:not([hidden]) {
  position: fixed;
  inset: 71px 0 0;
  z-index: 8;
  display: block;
  padding: 12px;
  background: rgba(23, 33, 27, .38);
  backdrop-filter: blur(6px);
  animation: fade-slide-in .18s ease both;
}

.topbar.admin-mode + .mobile-menu-overlay:not([hidden]) .mobile-menu-card {
  width: min(100%, 360px);
  margin-left: auto;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.topbar.admin-mode + .mobile-menu-overlay:not([hidden]) .mobile-menu-card button {
  width: 100%;
  min-height: 44px;
  text-align: left;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.mobile-menu-card {
  display: grid;
  gap: 10px;
}

.mobile-menu-card button {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-menu-card button[hidden] {
  display: none !important;
}

.menu-list-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--soft);
  color: var(--brand);
}

.menu-list-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mobile-user-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
}

.mobile-user-card strong,
.mobile-user-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-user-card span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.mobile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(23,33,27,.18);
}

.logo-text, .logo-img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: white;
  font-weight: 800;
  object-fit: cover;
}

.logo-img[src=""] { display: none; }
.logo-img:not([src=""]) + .logo-text { display: none; }

main {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 64px;
}

.view, .admin-tab { display: none; }
.view.active, .admin-tab.active {
  display: block;
  animation: fade-slide-in .22s ease both;
}

@keyframes fade-slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modal-pop {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)) scale(.98); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.hero {
  min-height: 360px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
  align-items: center;
  gap: 34px;
  padding: 46px;
  border-radius: 0 0 8px 8px;
  background:
    linear-gradient(90deg, rgba(18, 31, 22, .88) 0%, rgba(24, 54, 34, .68) 48%, rgba(24, 54, 34, .18) 100%),
    url("https://images.unsplash.com/photo-1523920290228-4f321a939b4c?auto=format&fit=crop&w=1800&q=82") center 42%/cover;
  color: white;
  box-shadow: 0 18px 42px rgba(17, 33, 24, .18);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  background: linear-gradient(0deg, rgba(0,0,0,.26), transparent);
  pointer-events: none;
}

.hero h1 {
  margin: 12px 0 12px;
  max-width: 760px;
  font-size: clamp(34px, 5.4vw, 68px);
  line-height: 1.05;
  letter-spacing: 0;
  text-shadow: 0 12px 30px rgba(0,0,0,.22);
}

.eyebrow {
  margin: 0;
  font-weight: 700;
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  padding: 7px 12px;
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  backdrop-filter: blur(8px);
}

.intro {
  max-width: 620px;
  font-size: 18px;
  line-height: 1.7;
  color: rgba(255,255,255,.88);
}

.hero-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  align-self: end;
  padding: 24px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 8px;
  background: rgba(13, 27, 19, .48);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 38px rgba(0,0,0,.18);
}

.hero-panel span {
  color: rgba(255,255,255,.78);
  font-weight: 700;
}

.hero-panel strong {
  font-size: 26px;
  line-height: 1.28;
}

.hero-panel small {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar {
  margin: 24px 0;
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 12px;
}

.search-field {
  position: relative;
  display: block;
}

.search-field input {
  padding-right: 42px;
}

.search-field span {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  border: 2px solid var(--muted);
  border-radius: 50%;
  pointer-events: none;
}

.search-field span::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  right: -6px;
  bottom: -3px;
  border-radius: 999px;
  background: var(--muted);
  transform: rotate(45deg);
}

input, select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
  color: var(--text);
}

select {
  white-space: nowrap;
  text-overflow: ellipsis;
  padding-right: 34px;
}

#categoryFilter {
  padding-right: 42px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.shop-section {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 24px;
}

.featured-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(40, 51, 45, .06);
}

.card-image {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #ffffff;
  cursor: pointer;
}

.card-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: opacity .24s ease, transform .24s ease;
}

.card-image-hover {
  opacity: 0;
}

.card-image:hover .card-image-main {
  opacity: 0;
  transform: scale(1.02);
}

.card-image:hover .card-image-hover {
  opacity: 1;
  transform: scale(1.02);
}

.card-body {
  padding: 16px;
  display: grid;
  gap: 10px;
}

.card-body h3 {
  margin: 0;
  cursor: pointer;
}

.card-body p {
  margin: 0;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.price {
  color: var(--brand-2);
  font-size: 22px;
  font-weight: 800;
}

.product-actions {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
}

.product-detail-page {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, .92fr);
  gap: 26px;
  align-items: start;
  min-width: 0;
}

.product-carousel img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.product-detail-page .product-carousel {
  min-height: 0;
  aspect-ratio: 1 / 1;
  touch-action: pan-y;
}

.product-detail-page [data-carousel-image] {
  width: 100%;
  height: 100%;
  max-height: none;
  background: #ffffff;
}

.product-detail-info {
  display: grid;
  gap: 16px;
  padding: 4px 0;
  min-width: 0;
}

.product-detail-info h2 {
  margin: 0;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.product-detail-info p {
  margin: 0;
  line-height: 1.75;
  color: var(--muted);
}

.detail-actions {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  max-width: 360px;
}

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

.icon-btn {
  min-width: 44px;
  padding: 10px;
  font-size: 18px;
}

.stack {
  display: grid;
  gap: 14px;
}

.order, .admin-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.admin-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tabs {
  flex-wrap: wrap;
  gap: 6px;
}

.tabs button.active, .nav button.active {
  background: var(--brand);
  color: white;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.form-grid.compact {
  grid-template-columns: minmax(220px, 360px) auto auto;
  align-items: end;
}

#categoryForm {
  grid-template-columns: minmax(220px, 360px) auto auto;
  justify-content: start;
}

#categoryForm button {
  width: auto;
  min-width: 72px;
  padding-inline: 12px;
  white-space: nowrap;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

.form-grid .wide { grid-column: span 2; }
.form-grid .check {
  align-content: end;
  grid-template-columns: auto 1fr;
}
.form-grid .check input { width: auto; }

#productForm .check {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  justify-self: start;
  gap: 8px;
  width: auto;
  white-space: nowrap;
  color: var(--muted);
}

#productForm .check input {
  flex: 0 0 auto;
  margin: 0;
  width: auto;
}

#productForm label:has(textarea[name="detailImages"]),
#productForm label:has(textarea[name="description"]) {
  grid-column: 1 / -1;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  font-size: 14px;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--soft);
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.table-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-2) 14%, #ffffff);
  color: var(--brand-2);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.table-tag.muted {
  background: var(--soft);
  color: var(--muted);
}

.table-wrap { overflow-x: auto; }

.admin-table-scroll {
  max-height: calc(100vh - 230px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-table-scroll .admin-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--soft);
  box-shadow: 0 1px 0 var(--line);
}

.export-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.list-tools, .pager {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin: 0 0 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-tools {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto auto;
  justify-content: stretch;
}

.order-date-tools {
  grid-template-columns: minmax(150px, 180px) minmax(150px, 180px) auto auto;
  justify-content: flex-end;
}

.table-top-pager {
  display: flex;
  justify-content: center;
  min-width: 0;
  margin: 0;
}

.table-top-pager .pager {
  margin-top: 0;
}

.status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 6px;
}

.status-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.status-tabs button.active {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 14%, #ffffff);
  color: var(--brand);
}

.status-tabs span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.list-tools input[type="search"] {
  max-width: none;
  min-width: 280px;
}

.order-select-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(0, auto);
  justify-content: stretch;
}

.select-left {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  min-width: 0;
}

.select-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.order-select-row .check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.admin-search-action {
  justify-self: end;
}

[data-order-status] {
  width: auto;
  min-width: 98px;
  max-width: none;
  padding-right: 28px;
  text-overflow: clip;
}

.pager {
  display: flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  margin: 12px auto 0;
  padding: 8px 10px;
  color: var(--muted);
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.pager span {
  order: 2;
  min-width: 0;
}

.pager-jump {
  order: 4;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  white-space: nowrap;
}

.pager-jump label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
}

.pager-jump input {
  width: 64px;
  height: 34px;
  padding: 6px 8px;
}

.pager-jump button {
  min-height: 34px;
  padding: 6px 10px;
}

.page-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  display: grid;
  place-items: center;
}

.page-icon.prev {
  order: 1;
}

.page-icon.next {
  order: 3;
}

.page-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button:disabled {
  cursor: not-allowed;
  opacity: .5;
}

.cart-row {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 14px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.cart-row img {
  width: 96px;
  height: 76px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--soft);
}

.cart-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-actions input {
  width: 76px;
}

#cartCount {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: var(--brand-2);
  color: white;
  padding: 0 7px;
  font-size: 12px;
}

dialog {
  width: min(560px, calc(100% - 24px));
  border: 0;
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
  position: relative;
  overscroll-behavior: contain;
}

dialog[open] {
  animation: pop-in .22s ease both;
}

body:has(dialog[open]) {
  overflow: hidden;
}

body.modal-open {
  overflow: hidden;
}

body.modal-open::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,.72);
  animation: backdrop-in .18s ease both;
}

dialog.app-modal[open] {
  display: block;
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1001;
  margin: 0;
  transform: translate(-50%, -50%);
  animation: modal-pop .18s ease both;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: 0 8px 20px rgba(23, 33, 27, .12);
  display: grid;
  place-items: center;
}

.dialog-close span,
.dialog-close::before {
  content: "";
  width: 15px;
  height: 2px;
  border-radius: 999px;
  background: var(--muted);
  grid-area: 1 / 1;
}

.dialog-close span {
  transform: rotate(45deg);
}

.dialog-close::before {
  transform: rotate(-45deg);
}

.dialog-close:hover {
  background: var(--soft);
}

.address-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

dialog::backdrop {
  background: rgba(0,0,0,.72);
  animation: backdrop-in .22s ease both;
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

dialog form, #detailBox {
  display: grid;
  gap: 13px;
}

#contractDialog {
  width: min(900px, calc(100% - 24px));
}

#contractBox {
  max-height: min(70vh, 760px);
  overflow: auto;
  overscroll-behavior: contain;
}

.contract-paper {
  display: grid;
  gap: 14px;
  padding: 8px 4px;
  color: #1d241f;
}

.contract-paper h2,
.contract-paper h3,
.contract-paper p {
  margin: 0;
}

.contract-paper h2 {
  text-align: center;
  font-size: 26px;
}

.contract-paper section {
  display: grid;
  gap: 8px;
  line-height: 1.65;
}

.contract-muted {
  color: var(--muted);
  text-align: center;
}

.contract-table {
  width: 100%;
  border-collapse: collapse;
}

.contract-table th,
.contract-table td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: left;
}

.contract-signatures {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.contract-signatures div {
  min-height: 124px;
  position: relative;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.contract-signatures span {
  display: block;
  margin-top: 8px;
}

.stamp {
  position: absolute;
  right: 12px;
  bottom: 10px;
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border: 3px solid #c91515;
  border-radius: 50%;
  color: #c91515;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 1.25;
  transform: rotate(-12deg);
  opacity: .9;
  box-shadow:
    inset 0 0 0 3px rgba(201, 21, 21, .18),
    inset 0 0 0 9px #fff,
    inset 0 0 0 11px rgba(201, 21, 21, .72);
  letter-spacing: .04em;
}

.stamp::before {
  content: "★";
  position: absolute;
  top: 17px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  line-height: 1;
}

.stamp::after {
  content: "";
  position: absolute;
  inset: 15px;
  border: 1px solid rgba(201, 21, 21, .55);
  border-radius: 50%;
  pointer-events: none;
}

.stamp.personal {
  font-size: 15px;
  border-radius: 10px;
  width: 78px;
  height: 48px;
  box-shadow: inset 0 0 0 2px rgba(201, 21, 21, .32);
}

.seal-img {
  position: absolute;
  right: 8px;
  bottom: 4px;
  width: 112px;
  height: 112px;
  object-fit: contain;
  transform: rotate(-8deg);
  opacity: .92;
  pointer-events: none;
}

.stamp-fallback[hidden] {
  display: none;
}

.stamp.personal::before,
.stamp.personal::after {
  display: none;
}

.stamp.small {
  font-size: 10px;
}

.contract-actions {
  margin-top: 14px;
}

.copy-line {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

#orderForm.checkout-page {
  min-height: calc(100vh - 150px);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: 18px;
  align-items: start;
}

.checkout-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.checkout-head h2 {
  margin: 0;
}

#detailBox,
.order-form-fields {
  min-height: 0;
}

.order-form-fields {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 38px;
  gap: 8px;
  align-items: center;
}

.captcha-row img {
  width: 96px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.icon-only {
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  display: grid;
  place-items: center;
}

.refresh-icon {
  width: 17px;
  height: 17px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  position: relative;
}

.refresh-icon::after {
  content: "";
  position: absolute;
  right: -2px;
  top: -4px;
  width: 6px;
  height: 6px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(18deg);
}

#authForm .auth-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

#authForm .auth-actions button {
  width: 100%;
  min-height: 44px;
}

#authForm .auth-register-btn {
  min-height: 38px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

#authForm .auth-register-btn:hover {
  background: var(--soft);
  color: var(--brand);
}

#cancelAuthDialog {
  display: none;
}

.dialog-form {
  position: static;
}

.settings-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  margin-top: -4px;
}

#savedAddressWrap {
  white-space: normal;
}

#savedAddressWrap select {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.address-summary {
  margin-top: -6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: -6px auto 10px;
  padding: 8px 0 0;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

#loadingOverlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  place-items: center;
  background: rgba(255,255,255,.58);
  backdrop-filter: blur(3px);
}

#loadingOverlay.show {
  display: grid;
}

#loadingText {
  padding: 14px 18px;
  border-radius: 8px;
  background: #17211b;
  color: white;
  box-shadow: var(--shadow);
}

.profile-page {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.profile-head {
  grid-column: 1 / -1;
  padding: 18px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
}

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

.profile-head p {
  margin-top: 6px;
  color: var(--muted);
}

.profile-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.profile-panel h3 {
  margin: 0;
}

#addressForm.profile-panel {
  grid-column: 1 / -1;
}

.address-list {
  display: grid;
  gap: 10px;
}

.address-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.float-actions {
  position: fixed;
  right: 22px;
  bottom: 88px;
  z-index: 3;
  display: none;
  gap: 10px;
}

.float-actions.shop-visible {
  display: grid;
}

.float-actions button {
  position: relative;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  box-shadow: 0 10px 26px rgba(0,0,0,.18);
  font-size: 20px;
  opacity: .7;
  display: grid;
  place-items: center;
  transition: opacity .18s ease, transform .18s ease, filter .18s ease;
}

.float-actions button:hover {
  opacity: .95;
  transform: translateY(-1px);
}

.float-actions svg,
.icon-btn svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

#floatCart {
  color: #ffffff;
}

#backToTop {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

#backToTop.show {
  opacity: .7;
  pointer-events: auto;
  transform: translateY(0);
}

#floatCartCount {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--brand-2);
  color: white;
  font-size: 12px;
  padding: 0 5px;
}

#detailBox img {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--soft);
}

.product-carousel {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 260px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

#detailBox .product-carousel {
  aspect-ratio: 1 / 1;
  min-height: 0;
}

#detailBox .product-carousel img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  border-radius: 0;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand) 24%, transparent);
  color: var(--brand);
  box-shadow: 0 10px 24px rgba(23, 33, 27, .18);
  display: grid;
  place-items: center;
  backdrop-filter: blur(8px);
  line-height: 1;
}

.carousel-btn svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.carousel-btn:hover {
  background: var(--brand);
  color: #ffffff;
}

.carousel-btn.prev { left: 14px; }
.carousel-btn.next { right: 14px; }

.share-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand) 24%, transparent);
  color: var(--brand);
  box-shadow: 0 10px 24px rgba(23, 33, 27, .18);
  backdrop-filter: blur(8px);
}

.share-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-carousel-image].slide-next {
  animation: slide-image-next .24s ease both;
}

[data-carousel-image].slide-prev {
  animation: slide-image-prev .24s ease both;
}

@keyframes slide-image-next {
  from { opacity: .45; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slide-image-prev {
  from { opacity: .45; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
}

.carousel-dots button {
  width: 8px;
  height: 8px;
  min-width: 8px;
  padding: 0;
  border-radius: 50%;
  background: var(--line);
}

.carousel-dots button.active {
  background: var(--brand);
}

.detail-images {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.detail-images img {
  max-height: 180px;
}

#toast {
  position: fixed;
  top: 22px;
  left: 50%;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #17211b;
  color: white;
  transform: translate(-50%, -18px);
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  z-index: 30;
  text-align: center;
}

#toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

@media (max-width: 820px) {
  main {
    margin-top: 0;
  }
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 14px 16px;
    column-gap: 18px;
    row-gap: 0;
  }
  .topbar.menu-open {
    row-gap: 0;
  }
  .topbar.detail-mode {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .topbar.admin-mode {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .topbar.detail-mode .brand {
    justify-content: center;
  }
  .brand { min-width: 0; }
  .mobile-menu-btn { display: block; }
  .nav, .account {
    display: none;
  }
  .mobile-menu-overlay:not([hidden]) {
    position: fixed;
    inset: 71px 0 0;
    z-index: 8;
    display: block;
    padding: 12px;
    background: rgba(23, 33, 27, .38);
    backdrop-filter: blur(6px);
    animation: fade-slide-in .18s ease both;
  }
  .mobile-menu-card {
    width: min(100%, 360px);
    margin-left: auto;
    padding: 14px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
  }
  .mobile-menu-card button {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line);
  }
  .mobile-menu-card button:hover {
    background: var(--soft);
  }
  .hero {
    grid-template-columns: 1fr;
    min-height: 420px;
    align-items: end;
    padding: 28px;
    gap: 22px;
    background:
      linear-gradient(180deg, rgba(18, 31, 22, .48) 0%, rgba(18, 31, 22, .88) 76%),
      url("https://images.unsplash.com/photo-1523920290228-4f321a939b4c?auto=format&fit=crop&w=1000&q=80") center top/cover;
  }
  .hero-panel {
    align-self: stretch;
    padding: 18px;
  }
  .toolbar {
    grid-template-columns: 1fr;
    margin: 12px 0 18px;
  }
  .pager {
    gap: 6px;
    padding: 7px 8px;
  }
  .pager span {
    font-size: 13px;
  }
  .page-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
  }
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .featured-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .profile-page {
    grid-template-columns: 1fr;
  }
  #addressForm.profile-panel {
    grid-column: auto;
  }
  .card-body {
    padding: 10px;
    gap: 8px;
  }
  .card-body h3 {
    font-size: 15px;
  }
  .price {
    font-size: 18px;
  }
  .product-actions {
    grid-template-columns: 38px 1fr;
    gap: 8px;
  }
  .icon-btn {
    min-width: 38px;
    min-height: 38px;
    padding: 8px;
  }
  .admin-head { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid.compact { grid-template-columns: 1fr; }
  #categoryForm {
    grid-template-columns: minmax(0, 1fr) auto auto;
    justify-content: stretch;
  }
  #categoryForm button {
    min-width: 58px;
  }
  .admin-tools {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }
  .admin-search-action {
    grid-column: 1 / -1;
    justify-self: stretch;
  }
  .order-date-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-tools input[type="search"] {
    min-width: 0;
  }
  .order-select-row {
    grid-template-columns: 1fr;
  }
  .select-actions,
  .table-top-pager {
    justify-self: stretch;
  }
  .select-actions {
    justify-content: flex-start;
  }
  .table-top-pager .pager {
    width: 100%;
  }
  .pager-jump {
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }
  .form-grid .wide { grid-column: auto; }
  .cart-row { grid-template-columns: 74px 1fr; }
  .cart-row img { width: 74px; height: 62px; }
  .cart-actions { grid-column: 1 / -1; }
  .address-grid { grid-template-columns: 1fr; }
  .product-detail-page {
    grid-template-columns: 1fr;
    gap: 14px;
    width: 100%;
    overflow: hidden;
  }
  .product-detail-page .product-carousel {
    width: 100%;
    min-height: auto;
    height: auto;
    aspect-ratio: 1 / 1;
  }
  .product-detail-page [data-carousel-image] {
    max-height: none;
    height: 100%;
  }
  .product-detail-page .carousel-btn {
    display: none;
  }
  .product-detail-page .carousel-dots {
    margin-top: 12px;
  }
  .product-detail-info {
    gap: 11px;
  }
  .product-detail-info h2 {
    font-size: 21px;
    line-height: 1.25;
  }
  .product-detail-info p {
    line-height: 1.6;
    font-size: 14px;
  }
  .detail-actions {
    max-width: none;
    grid-template-columns: 44px minmax(0, 1fr);
  }
  dialog {
    max-height: 75dvh;
    overflow: auto;
    overscroll-behavior: contain;
  }
  dialog::backdrop {
    background: rgba(0,0,0,.72);
  }
  #contractDialog {
    max-height: 75dvh;
  }
  #contractBox {
    max-height: calc(75dvh - 104px);
  }
  .contract-signatures {
    grid-template-columns: 1fr;
  }
  .copy-line {
    grid-template-columns: 1fr;
  }
  #orderForm.checkout-page {
    grid-template-columns: 1fr;
    min-height: 0;
  }
}

@media (max-width: 420px) {
  main {
    width: min(100% - 20px, 1180px);
    margin-top: 0;
  }
  .hero {
    min-height: 390px;
    padding: 18px;
  }
  .hero h1 {
    font-size: 32px;
  }
  .intro {
    font-size: 15px;
  }
  .eyebrow {
    width: auto;
    font-size: 13px;
  }
  .product-detail-page .product-carousel {
    height: auto;
  }
  .carousel-btn {
    width: 36px;
    height: 36px;
  }
  .carousel-btn svg {
    width: 19px;
    height: 19px;
  }
  .captcha-row {
    grid-template-columns: minmax(0, 1fr) 86px 36px;
  }
  .captcha-row img {
    width: 86px;
    height: 36px;
  }
  .icon-only {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }
}

