:root {
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #182f29;
  background: #f5f7f4;
  font-synthesis: none;
  --ink: #182f29;
  --muted: #526860;
  --green: #185a48;
  --line: #dee8e1;
  --white: #fff;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid #368568; outline-offset: 3px; }
.shell { width: min(1140px, 100% - 48px); margin-inline: auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 78px;
}
.brand { display: flex; align-items: center; gap: 11px; font-size: 1rem; font-weight: 750; }
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #e3efe7;
  display: grid;
  place-items: center;
}
.brand-mark span {
  width: 15px;
  height: 15px;
  border-radius: 2px 9px 2px 9px;
  background: var(--green);
  transform: rotate(-18deg);
  position: relative;
}
.brand-mark span::after {
  content: "";
  position: absolute;
  width: 12px;
  border-top: 1px solid #c6e1d3;
  transform: rotate(43deg);
  left: 2px;
  top: 7px;
}
.search {
  display: flex;
  align-items: center;
  width: min(400px, 100%);
  min-width: 0;
  gap: 12px;
  padding-inline: 15px 8px;
  background: #f4f7f4;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.search:focus-within { border-color: #47846e; box-shadow: 0 0 0 2px #d5e9dc; }
.search-icon {
  flex: 0 0 15px;
  height: 15px;
  border: 1.6px solid #547267;
  border-radius: 50%;
  position: relative;
  margin-right: 2px;
}
.search-icon::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 1.6px;
  background: #547267;
  bottom: -2px;
  right: -4px;
  transform: rotate(45deg);
}
.search input {
  flex: 1;
  width: 0;
  min-height: 44px;
  border: 0;
  outline: none;
  padding: 0;
  background: transparent;
  color: var(--ink);
}
.search input::placeholder { color: #526960; }
.search input::-webkit-search-cancel-button { display: none; }
.clear-search, .icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 1.35rem;
  line-height: 1;
}
.clear-search:hover, .icon-button:hover { background: #e5eee7; }

.overview {
  isolation: isolate;
  position: relative;
  overflow: hidden;
  margin-top: 29px;
  padding: 29px 32px 24px;
  border-radius: 24px;
  background: linear-gradient(117deg, #113f34, #185743 74%, #225f4a);
  color: var(--white);
}
.overview::before, .overview::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  top: -214px;
  right: -55px;
  width: 460px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid #c4f4d928;
  box-shadow: 0 0 0 27px #b5e8cf0a, 0 0 0 55px #b5e8cf0e, 0 0 0 88px #b5e8cf0a;
}
.overview::after { top: auto; bottom: -305px; right: 50px; }
.overview-header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.overview h1 { margin: 0; font-size: clamp(1.75rem, 4vw, 2.65rem); letter-spacing: .065em; }
.snapshot { margin: 0; color: #e3f2e9; font-size: .875rem; white-space: pre-wrap; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); margin: 23px 0 0; }
.metrics > div { padding: 10px 20px; border-left: 1px solid #daece35c; }
.metrics > div:first-child { border: 0; padding-left: 0; }
.metrics dt { color: #e3f2e9; font-size: .875rem; }
.metrics dd { margin: 1px 0 0; font-size: clamp(1.55rem, 4vw, 2.4rem); line-height: 1.2; font-weight: 700; font-variant-numeric: tabular-nums; }

.inventory { padding: 31px 0 48px; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.section-heading h2 { margin: 0; font-size: 1.35rem; }
.section-heading p { margin: 0; font-size: .875rem; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 13px 0 14px; }
.filter {
  padding: 8px 14px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--white);
  color: #39564c;
  font-size: .875rem;
  white-space: nowrap;
}
.filter:hover { border-color: #82aa98; }
.filter[aria-pressed="true"] { color: #fff; background: var(--green); border-color: var(--green); }
.subtotal { margin: 0 0 14px; color: var(--muted); font-size: .875rem; }

.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.product-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--white);
}
.product-media { aspect-ratio: 2 / 1; display: grid; position: relative; background: #ecf3ec; border-bottom: 1px solid #e5ece6; }
.photo-placeholder {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 9px;
  color: #577167;
  font-size: .875rem;
}
.photo-icon {
  position: relative;
  width: 35px;
  height: 27px;
  overflow: hidden;
  border: 1.5px solid #6e9888;
  border-radius: 7px;
}
.photo-icon::before {
  content: "";
  position: absolute;
  top: 5px;
  right: 6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7aa08f;
}
.photo-icon::after, .photo-icon span {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 2px;
  top: 14px;
  border-radius: 2px;
  transform: rotate(45deg);
  background: #abc3b6;
}
.photo-icon span { left: 14px; top: 16px; background: #c2d6cb; }
.product-image { position: absolute; width: 100%; height: 100%; object-fit: contain; }
.product-body { display: flex; flex-direction: column; flex: 1; padding: 14px; }
.product-label { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; }
.source-tag { font-size: .875rem; color: var(--green); font-weight: 660; }
.row-tag { font-size: .75rem; color: var(--muted); }
.product-body h3 { margin: 6px 0 9px; font-size: 1rem; line-height: 1.4; overflow-wrap: anywhere; }
.product-details, .product-note { margin: 0 0 8px; color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.stock {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0 7px;
  margin-top: auto;
  padding: 8px 0 9px;
  border-top: 1px solid #edf1ed;
}
.stock-label { color: var(--muted); font-size: .875rem; }
.stock strong { color: var(--green); font-size: 1.02rem; overflow-wrap: anywhere; }
.stock .stock-unknown { color: var(--muted); font-size: .875rem; font-weight: 500; }
.button {
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 650;
}
.upload-button { background: #edf5ef; color: var(--green); font-size: .875rem; }
.upload-button:hover { background: #e3f0e7; }
.button-secondary { background: #fff; color: var(--green); border-color: #c7dbd0; }
.button-primary { background: var(--green); color: #fff; }
.button-secondary:hover { background: #f1f7f2; }
.status-panel { text-align: center; padding: 40px 16px; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); background: #fff; }
.status-panel p { margin: 0; }
.status-panel .button { margin-top: 14px; }

.photo-dialog {
  width: min(420px, 100% - 28px);
  max-height: calc(100dvh - 28px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--ink);
}
.photo-dialog::backdrop { background: #112c2488; }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.dialog-header h2 { margin: 0 0 4px; font-size: 1.25rem; }
.dialog-header p { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.photo-preview { display: block; width: 100%; max-height: 230px; object-fit: contain; margin-bottom: 14px; background: #ecf3ec; border-radius: 10px; }
.photo-choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.photo-help, .upload-error { margin: 10px 0; font-size: .875rem; color: var(--muted); }
.upload-error { color: #9e2f1e; }
.photo-dialog .button-primary { width: 100%; margin-top: 4px; }
.toast {
  position: fixed;
  z-index: 3;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  transform: translateX(-50%);
  margin: 0;
  padding: 10px 16px;
  border-radius: 10px;
  color: #fff;
  background: #123e33;
}

@media (max-width: 970px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .shell { width: calc(100% - 28px); }
  .toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 8px 0 10px; }
  .brand { gap: 8px; }
  .brand-mark { width: 26px; height: 26px; border-radius: 8px; }
  .search { width: 100%; }
  .overview { margin-top: 16px; padding: 17px 15px; border-radius: 17px; }
  .overview-header { flex-wrap: wrap; }
  .metrics { margin-top: 14px; }
  .metrics > div { padding: 5px 10px; }
  .inventory { padding-top: 22px; }
  .filters { gap: 6px; }
  .filter { padding-inline: 10px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .product-media { aspect-ratio: 1.55; }
  .product-card { border-radius: 12px; }
  .product-body { padding: 9px; }
}
