:root {
  color-scheme: light;
  --bg: #f5f6f3;
  --surface: #ffffff;
  --line: #d9ded7;
  --ink: #1d2320;
  --muted: #69736d;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --price: #c2410c;
  --warning: #9a3412;
  --vip: #b7791f;
  --vip-strong: #8a520f;
  --vip-soft: #fff7df;
  --shadow: 0 12px 32px rgba(32, 39, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

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

button,
a,
select {
  cursor: pointer;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(245, 246, 243, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px clamp(16px, 4vw, 48px);
}

.brand-block {
  min-width: 0;
}

.topbar h1,
.section-head h2,
.panel-head h2,
.admin-band h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.vip-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin-top: 8px;
  padding: 0 10px;
  color: #4a2d05;
  background: linear-gradient(135deg, #ffe8a3, #d99922);
  border: 1px solid #c47a12;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.vip-badge[hidden] {
  display: none;
}

.admin-link,
.pay-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  color: #fff;
  text-decoration: none;
  background: var(--ink);
  border-radius: 8px;
  white-space: nowrap;
}

.cart-jump-btn,
.purchase-open-btn {
  min-height: 40px;
  padding: 0 14px;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  white-space: nowrap;
}

.cart-jump-btn:hover,
.purchase-open-btn:hover {
  background: var(--accent-strong);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.language-switch {
  display: inline-grid;
  grid-template-columns: repeat(3, 38px);
  gap: 6px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.lang-btn {
  width: 38px;
  height: 34px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-weight: 800;
}

.lang-btn.active {
  color: #fff;
  background: var(--accent);
}

.shop-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 48px) 48px;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.auth-card {
  display: grid;
  gap: 18px;
  width: min(420px, 100%);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0;
  font-size: 28px;
}

.product-area,
.checkout-panel,
.admin-band {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.product-area,
.admin-band {
  padding: 22px;
  border-radius: 8px;
}

.checkout-panel {
  position: sticky;
  top: 92px;
  align-self: start;
  max-height: calc(100vh - 116px);
  overflow: auto;
  padding: 20px;
  border-radius: 8px;
}

#checkoutPanel {
  scroll-margin-top: 92px;
}

.section-head,
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head p,
.payment-box p,
.empty-state {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.search-box input,
label input,
label textarea,
select {
  width: 100%;
  min-height: 40px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.search-box input,
label input,
select {
  padding: 0 12px;
}

label textarea {
  padding: 10px 12px;
  resize: vertical;
}

.search-box {
  width: min(260px, 100%);
}

.product-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 16px;
}

.tag-filter-row {
  display: flex;
  justify-content: flex-end;
  margin: -6px 0 16px;
}

.tag-filter-row label {
  display: grid;
  gap: 6px;
  width: min(260px, 100%);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.filter-btn {
  min-height: 36px;
  padding: 0 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.filter-btn.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.vip-mode .filter-btn.active {
  color: #fff;
  background: var(--vip);
  border-color: var(--vip);
}

.stage-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  color: var(--accent);
  background: #edf7f4;
  border: 1px solid #cfe2de;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.stage-week {
  color: #8a5a00;
  background: #fff7df;
  border-color: #ead39a;
}

.stage-stock {
  color: var(--muted);
  background: #f5f6f3;
  border-color: var(--line);
}

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

.product-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.product-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #eef1ec;
}

.product-info {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.product-meta-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.customer-product-number {
  color: #3f4d47;
  background: #f4f6f3;
  border-color: var(--line);
}

.category {
  color: var(--muted);
  font-size: 13px;
}

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

.money-pair {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.money-pair small {
  color: var(--muted);
  font-size: 0.62em;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.stock {
  color: var(--muted);
  font-size: 13px;
}

.product-info h3 {
  min-height: 48px;
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.product-info p {
  min-height: 44px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.product-buy-row {
  display: grid;
  gap: 10px;
}

.price-stack {
  display: grid;
  gap: 3px;
}

.vip-price,
.cart-vip-note {
  color: var(--vip-strong);
  font-size: 13px;
  font-weight: 800;
}

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

.vip-discount-btn {
  min-height: 40px;
  padding: 0 10px;
  color: #4a2d05;
  background: var(--vip-soft);
  border: 1px solid #d9a441;
  border-radius: 8px;
  font-weight: 900;
}

.vip-discount-btn:hover {
  background: #ffe8a3;
}

.vip-product {
  border-color: #e3b753;
  box-shadow: 0 0 0 2px rgba(183, 121, 31, 0.08);
}

.primary-btn,
.ghost-btn,
.danger-btn {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
}

.primary-btn {
  color: #fff;
  background: var(--accent);
}

.primary-btn:hover {
  background: var(--accent-strong);
}

.vip-mode .primary-btn:not(:disabled),
.vip-mode .purchase-open-btn,
.vip-mode .cart-jump-btn,
.vip-mode .pay-link,
.vip-mode .lang-btn.active {
  color: #fff;
  background: var(--vip);
}

.vip-mode .primary-btn:not(:disabled):hover,
.vip-mode .purchase-open-btn:hover,
.vip-mode .cart-jump-btn:hover,
.vip-mode .pay-link:hover {
  background: var(--vip-strong);
}

.primary-btn:disabled {
  cursor: not-allowed;
  background: #9aa7a0;
}

.ghost-btn {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.danger-btn {
  color: #fff;
  background: var(--warning);
}

.file-picker {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.file-trigger {
  min-height: 32px;
  padding-inline: 12px;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.native-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.cart-items {
  display: grid;
  gap: 12px;
}

.cart-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.cart-row img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  background: #eef1ec;
}

.cart-row h3 {
  margin: 0 0 6px;
  font-size: 15px;
  line-height: 1.35;
}

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

.qty-control {
  display: inline-grid;
  grid-template-columns: 30px 34px 30px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.qty-control button {
  width: 30px;
  height: 30px;
  border: 0;
  background: #f4f7f4;
}

.qty-control span {
  text-align: center;
  font-weight: 700;
}

.total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0;
  padding-top: 14px;
  border-top: 2px solid var(--line);
}

.total-row strong {
  color: var(--price);
  font-size: 24px;
}

.order-form,
.admin-form {
  display: grid;
  gap: 12px;
}

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

.field-stack {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.field-stack label {
  display: block;
}

.field-stack select {
  -webkit-appearance: menulist;
  appearance: auto;
  touch-action: manipulation;
  min-height: 44px;
  font-size: 16px;
  background-color: #fff;
}

.payment-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  background: #f2f7f6;
  border: 1px solid #cfe2de;
  border-radius: 8px;
}

.payment-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.paypal-checkout {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid #ccd9e8;
  border-radius: 8px;
}

.paypal-checkout[hidden] {
  display: none;
}

.paypal-checkout-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.paypal-checkout-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.paypal-environment {
  flex: 0 0 auto;
  padding: 5px 8px;
  color: #725000;
  background: #fff2bd;
  border: 1px solid #e9ca62;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.paypal-order-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-left: 6px;
  padding: 2px 7px;
  color: #073b8c;
  background: #e8f2ff;
  border: 1px solid #b9d4f7;
  border-radius: 5px;
  font-size: 12px;
  vertical-align: middle;
}

.paypal-buttons {
  width: 100%;
  min-height: 42px;
  overflow: hidden;
}

.keep-btn {
  min-width: 82px;
  color: var(--accent);
  border-color: #b9d8d3;
  background: #fff;
}

.form-message {
  min-height: 22px;
  margin: 0;
  color: var(--accent);
  line-height: 1.5;
}

.admin-shell {
  display: grid;
  gap: 22px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 48px) 48px;
}

.admin-workbench {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  align-items: start;
}

.product-number-lookup {
  grid-column: 1 / -1;
  padding: 14px 18px;
}

.product-number-lookup-form {
  display: grid;
  grid-template-columns: auto minmax(260px, 460px) minmax(0, 1fr);
  gap: 10px 14px;
  align-items: center;
}

.product-number-lookup-form > label {
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  white-space: nowrap;
}

.product-number-lookup-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.product-number-lookup-controls input,
.product-number-lookup-controls button {
  min-height: 44px;
}

.product-number-lookup-controls input {
  width: 100%;
  font-size: 16px;
  touch-action: manipulation;
}

.product-number-lookup-form .form-message {
  min-height: 0;
}

.admin-side {
  display: grid;
  gap: 22px;
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 116px);
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) #eef1ec;
}

.product-preview-panel {
  min-height: calc(100vh - 140px);
}

.admin-filter-bar {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(120px, 0.7fr) minmax(150px, 0.8fr) auto;
  gap: 10px;
  align-items: end;
  margin: 0 0 14px;
  padding: 12px;
  background: #f8faf7;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-filter-bar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-filter-bar input,
.admin-filter-bar select {
  width: 100%;
  min-height: 42px;
}

.admin-filter-reset {
  min-height: 42px;
  white-space: nowrap;
}

.admin-filter-summary {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.admin-form .wide {
  grid-column: span 2;
}

.field-hint {
  display: inline-block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stage-choice-field {
  display: grid;
  grid-column: 1 / -1;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.stage-choice-label {
  display: block;
}

.stage-choice-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.stage-choice-button {
  -webkit-appearance: none;
  appearance: none;
  min-height: 44px;
  padding: 7px 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  touch-action: manipulation;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stage-choice-button:hover {
  border-color: #868d89;
}

.stage-choice-button.active {
  color: #fff;
  background: #737976;
  border-color: #737976;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.stage-choice-button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.25);
  outline-offset: 2px;
}

.recent-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
  margin-top: 6px;
}

.recent-chips button,
.recent-chips span {
  min-height: 26px;
  padding: 0 9px;
  color: var(--muted);
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.recent-chips button:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.compact-form {
  grid-template-columns: 1fr;
}

.compact-form .primary-btn {
  width: 100%;
}

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

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-card {
  display: grid;
  gap: 5px;
  min-height: 88px;
  padding: 13px;
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat-card span,
.stat-card small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.stat-card strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 1.1;
}

.vision-tool {
  display: grid;
  gap: 12px;
}

.vision-video {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  background: #111;
  border-radius: 8px;
}

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

.vision-results {
  display: grid;
  gap: 10px;
}

.vision-result-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.vision-result-card img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  background: #eef1ec;
}

.vision-result-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.vision-result-main strong,
.vision-result-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vision-result-main span {
  color: var(--muted);
  font-size: 13px;
}

.vision-score-detail {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.score-bar {
  height: 7px;
  overflow: hidden;
  background: #e4ebe7;
  border-radius: 999px;
}

.score-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.vision-result-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 8px;
  align-items: center;
}

.score-text {
  color: var(--accent);
  font-weight: 800;
}

.product-list-scroll {
  max-height: calc(100vh - 260px);
  min-height: 520px;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) #eef1ec;
}

.product-list-scroll::-webkit-scrollbar {
  width: 10px;
}

.product-list-scroll::-webkit-scrollbar-track {
  background: #eef1ec;
  border-radius: 999px;
}

.product-list-scroll::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 999px;
}

.date-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 2px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}

.date-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.date-divider span {
  white-space: nowrap;
}

.product-preview-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 118px;
  padding: 14px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.product-preview-card:hover,
.product-preview-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.product-preview-card img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 8px;
  background: #eef1ec;
}

.product-preview-main {
  min-width: 0;
}

.product-preview-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0 0 8px;
}

.product-number-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 24px;
  padding: 2px 7px;
  color: #075e58;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  background: #e8f5f1;
  border: 1px solid #b8d8d0;
  border-radius: 6px;
}

.product-number-badge.recycled {
  color: var(--muted);
  background: #f1f3f0;
  border-color: var(--line);
}

.product-preview-title-row h3 {
  min-width: 0;
  margin: 0;
}

.product-preview-main h3 {
  margin: 0;
  overflow: hidden;
  font-size: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-preview-main p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-preview-stats {
  display: grid;
  gap: 8px;
  justify-items: end;
  white-space: nowrap;
}

.product-preview-stats strong {
  color: var(--price);
  font-size: 20px;
}

.product-preview-stats span {
  color: var(--muted);
}

.selected-product {
  display: grid;
  gap: 14px;
}

.selected-product-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.selected-product-card img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 8px;
}

.selected-product-card h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.selected-product-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.selected-edit-form {
  display: grid;
  gap: 12px;
}

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

.sold-out-btn:disabled {
  color: var(--muted);
  cursor: not-allowed;
  background: #eef1ec;
}

.admin-product,
.order-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-product {
  grid-template-columns: 72px minmax(220px, 1fr) minmax(92px, 130px) minmax(92px, 130px) auto;
  align-items: center;
}

.admin-product img,
.order-item img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  background: #eef1ec;
}

.admin-product h3,
.order-card h3 {
  margin: 0 0 5px;
  font-size: 17px;
}

.admin-product p,
.order-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.order-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.status-keep {
  color: var(--ink);
  background: #f7d889;
}

.keep-order {
  border-color: #e7c769;
}

.order-items {
  display: grid;
  gap: 10px;
}

.order-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.order-item img {
  width: 54px;
  height: 54px;
}

.image-thumb-button {
  display: inline-grid;
  place-items: center;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.image-thumb-button img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  background: #eef1ec;
}

.image-thumb-button:hover img {
  outline: 3px solid rgba(15, 118, 110, 0.18);
}

.order-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.proof-link {
  padding: 0;
  color: var(--accent);
  background: transparent;
  border: 0;
  font-weight: 700;
}

.delete-order-btn {
  min-height: 40px;
}

.sold-products-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.sold-product-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #f8faf7;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sold-product-card h3 {
  margin: 0 0 4px;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sold-product-card p,
.sold-product-card small {
  display: block;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sold-product-card strong {
  color: var(--price);
}

.sold-stat-row {
  grid-template-columns: 44px minmax(0, 1fr);
}

.sold-stat-row .image-thumb-button {
  grid-row: span 3;
}

.sold-stat-row .image-thumb-button img {
  width: 44px;
  height: 44px;
}

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 48px 18px 18px;
  background: rgba(14, 18, 16, 0.76);
}

.image-preview-modal[hidden] {
  display: none;
}

.image-preview-modal img {
  max-width: min(980px, 96vw);
  max-height: 86vh;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

.image-preview-modal .ghost-btn {
  position: fixed;
  top: 14px;
  right: 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
}

.product-edit-modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(14, 18, 16, 0.62);
}

.product-edit-modal[hidden] {
  display: none;
}

.product-edit-dialog {
  display: grid;
  gap: 16px;
  width: min(560px, 100%);
  max-height: min(92vh, 820px);
  overflow-y: auto;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

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

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

.customer-entry {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(180px, 240px) minmax(260px, 1fr);
  gap: 14px;
  align-items: end;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.customer-entry h2 {
  margin: 0 0 5px;
  font-size: 20px;
}

.customer-entry p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.payment-warning {
  margin-top: 8px !important;
  color: var(--warning) !important;
  font-size: 13px;
  font-weight: 700;
}

.payment-actions .pay-link,
.payment-actions .line-pay-link,
.payment-actions .keep-btn {
  min-height: 36px;
  padding: 0 12px;
  font-size: 14px;
}

.line-pay-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  text-decoration: none;
  border-color: #b9d8d3;
}

.line-pay-link.disabled {
  opacity: 0.55;
}

.line-qr-box {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.line-qr-box[hidden] {
  display: none;
}

.line-qr-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.line-qr-box img {
  width: min(180px, 100%);
  aspect-ratio: 1;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-shell {
  width: min(1680px, 100%);
}

.admin-workbench {
  grid-template-columns: minmax(0, 2fr) minmax(420px, 500px);
  gap: 16px;
}

.admin-side {
  gap: 16px;
}

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

.admin-side .admin-form .wide,
.admin-side .admin-form .form-message,
.admin-side .admin-form .primary-btn {
  grid-column: 1 / -1;
}

.product-preview-panel {
  min-height: calc(100vh - 126px);
}

.product-list-scroll {
  max-height: calc(100vh - 220px);
}

.product-preview-card {
  grid-template-columns: 64px minmax(0, 1fr) minmax(78px, auto);
  min-height: 88px;
  gap: 12px;
  padding: 10px 12px;
}

.product-preview-card img {
  width: 64px;
  height: 64px;
}

.product-preview-main h3 {
  margin-bottom: 5px;
  font-size: 18px;
}

.product-preview-main p {
  font-size: 14px;
  line-height: 1.35;
  -webkit-line-clamp: 1;
}

.product-preview-stats {
  gap: 4px;
}

.product-preview-stats strong {
  font-size: 18px;
}

.product-preview-stats span {
  font-size: 13px;
}

.stat-button {
  width: 100%;
  color: inherit;
  text-align: left;
  border: 1px solid var(--line);
}

.stat-button:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.visitor-panel {
  display: grid;
  gap: 8px;
  max-height: 360px;
  margin-top: 12px;
  overflow: auto;
  padding-right: 4px;
}

.visitor-panel[hidden] {
  display: none;
}

.visitor-row {
  display: grid;
  gap: 3px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.visitor-row strong {
  font-size: 14px;
}

.visitor-row span,
.visitor-row small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resolved-order {
  border-color: #b7d8cf;
  background: #f8fbfa;
}

.resolve-order-btn {
  min-width: 92px;
}

.line-qr-preview {
  display: grid;
  gap: 8px;
  align-items: center;
  justify-items: start;
  min-height: 42px;
  padding: 10px;
  color: var(--muted);
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.line-qr-preview img {
  width: 92px;
  height: 92px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.money-pair > span {
  color: inherit;
}

.stat-card .money-pair > span {
  color: var(--ink);
}

.price .money-pair > span,
.product-preview-stats .money-pair > span,
.sold-product-card .money-pair > span {
  color: var(--price);
}

.product-tag-title {
  margin-top: 4px;
  font-size: 24px;
  line-height: 1.15;
}

.product-name-line {
  margin: -2px 0 4px;
  color: var(--muted);
  font-weight: 700;
}

.master-shell {
  grid-template-columns: 1fr;
}

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

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

.store-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.store-card-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.store-name-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 22px;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.store-name-btn:hover {
  color: var(--accent);
}

.store-mini-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.store-mini-stats span,
.store-mini-stats button {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #f7faf8;
  font-size: 13px;
  text-align: left;
}

.store-mini-stats button {
  cursor: pointer;
}

.store-mini-stats button:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.store-mini-stats strong {
  color: var(--ink);
  font-size: 18px;
}

.store-admin-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.stats-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.36);
}

.stats-detail-modal[hidden] {
  display: none;
}

.stats-detail-dialog {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  width: min(1840px, 98vw);
  height: min(920px, 92vh);
  max-height: 92vh;
  overflow: hidden;
  padding: 22px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 80px rgba(22, 37, 34, 0.24);
}

.stats-detail-dialog .visitor-panel {
  display: grid;
  gap: 12px;
  height: 100%;
  max-height: none;
  margin-top: 0;
  min-height: 0;
  overflow: hidden;
}

.stats-detail-dialog .store-columns-body {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
}

.stats-detail-dialog .single-detail-body {
  grid-template-columns: minmax(0, 1fr);
}

.stats-detail-dialog h2 {
  margin: 0;
  padding-right: 70px;
}

.admin-stats-detail-dialog {
  width: min(880px, 96vw);
  height: min(760px, 88vh);
}

.admin-stats-detail-dialog .visitor-panel {
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) #eef1ec;
}

.admin-stats-detail-dialog .visitor-row {
  padding: 13px;
}

.admin-stats-detail-dialog .visitor-row strong {
  font-size: 16px;
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
}

.store-detail-section {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  height: 100%;
  min-height: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.store-detail-section + .store-detail-section {
  margin-top: 0;
}

.store-detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.store-detail-heading strong {
  color: var(--accent);
  font-size: 20px;
}

.store-detail-heading a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.store-detail-heading > div {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.store-detail-body {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.personal-store-panel,
.single-store-detail {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding-right: 4px;
}

.personal-store-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
}

.personal-store-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.personal-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.personal-detail-section {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}

.personal-detail-section h3 {
  margin: 0;
}

.vip-keep-entry {
  grid-column: 2 / -1;
  align-self: end;
}

.vip-keep-open-btn {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--vip-gold, #b88916);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(184, 137, 22, 0.18);
  -webkit-tap-highlight-color: transparent;
}

.vip-keep-modal {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.36);
}

.vip-keep-modal[hidden] {
  display: none;
}

.vip-keep-dialog {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 14px;
  width: min(980px, 96vw);
  max-height: min(860px, 92vh);
  padding: 20px;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 70px rgba(22, 37, 34, 0.24);
}

.vip-keep-head,
.vip-keep-paybox,
.vip-keep-line,
.vip-keep-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.vip-keep-paybox {
  padding: 12px;
  border: 1px solid #cfe4df;
  border-radius: 8px;
  background: #f1f8f6;
}

.vip-keep-paybox p {
  margin: 4px 0 0;
  color: var(--muted);
}

.vip-keep-total {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e0d1a2;
  border-radius: 8px;
  background: #fffaf0;
}

.vip-keep-total span {
  color: var(--muted);
  font-weight: 900;
}

.vip-keep-total strong {
  color: var(--price);
  font-size: 24px;
}

.vip-keep-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) #eef1ec;
}

.vip-keep-group {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.vip-keep-group h3 {
  margin: 0;
  color: var(--accent);
}

.vip-keep-item,
.vip-keep-admin-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.vip-keep-item.delete-pending,
.vip-keep-admin-card.delete-requested {
  border-color: #d6a24b;
  background: #fffaf0;
}

.vip-keep-item img,
.vip-keep-thumb img {
  width: 74px;
  height: 74px;
  border-radius: 8px;
  object-fit: cover;
}

.vip-keep-item h4,
.vip-keep-item p,
.vip-keep-item small,
.vip-keep-admin-card p,
.vip-keep-admin-card small {
  margin: 0;
}

.vip-keep-item h4,
.vip-keep-admin-card strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.vip-keep-pending,
.delete-request-note {
  display: inline-block;
  margin-top: 4px;
  color: #9a5b00;
  font-weight: 800;
}

.vip-keep-delete-btn {
  min-width: 112px;
}

.vip-keep-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.vip-keep-summary {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
}

.vip-keep-summary .danger-btn,
.vip-keep-card-actions .danger-btn {
  min-height: 40px;
}

.vip-keep-admin-card {
  grid-template-columns: 64px minmax(0, 1fr) auto;
}

.vip-keep-thumb {
  padding: 0;
}

.vip-keep-thumb img {
  width: 64px;
  height: 64px;
}

.source-pill {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--accent);
  background: #e8f4f1;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.vip-keep-card-actions {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.purchase-idea-list,
.purchase-content {
  display: grid;
  gap: 12px;
}

.purchase-idea-admin-card,
.purchase-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.purchase-idea-admin-card {
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: start;
}

.purchase-idea-thumb,
.purchase-card-image {
  width: 92px;
  height: 92px;
  border-radius: 8px;
  object-fit: cover;
}

.purchase-idea-thumb {
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f4f6f3;
}

.purchase-idea-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.purchase-image-button {
  width: 120px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: zoom-in;
}

.purchase-image-button:focus-visible {
  outline: 3px solid rgba(18, 134, 120, 0.28);
  outline-offset: 3px;
}

.purchase-image-button .purchase-card-image {
  display: block;
}

.purchase-idea-thumb.empty-thumb {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.purchase-idea-admin-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 10px;
}

.purchase-idea-admin-main textarea,
.purchase-idea-admin-main select,
.purchase-idea-image-field input {
  width: 100%;
}

.purchase-idea-image-field {
  grid-column: 1 / -1;
}

.purchase-idea-vote-summary,
.purchase-idea-voters,
.purchase-idea-admin-actions,
.purchase-vote-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.purchase-idea-vote-summary span,
.purchase-idea-voters span {
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef4f0;
  color: var(--muted);
  font-weight: 800;
}

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

.purchase-card {
  grid-template-columns: 120px minmax(0, 1fr);
}

.purchase-card-image {
  width: 120px;
  height: 120px;
}

.purchase-card .purchase-vote-actions {
  grid-column: 1 / -1;
}

.purchase-card h3 {
  overflow-wrap: anywhere;
}

.purchase-modal {
  position: fixed;
  inset: 0;
  z-index: 108;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.38);
}

.purchase-modal[hidden] {
  display: none;
}

.purchase-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  width: min(920px, 96vw);
  max-height: 88vh;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 70px rgba(22, 37, 34, 0.24);
}

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

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

.purchase-content {
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) #eef1ec;
}

@media (max-width: 980px) {
  .shop-top-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .shop-top-actions .language-switch {
    flex: 1 1 100%;
  }
}

@media (max-width: 980px) {
  .shop-shell {
    grid-template-columns: 1fr;
  }

  .admin-workbench {
    grid-template-columns: 1fr;
  }

  .master-stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .store-admin-form {
    grid-template-columns: 1fr;
  }

  .store-mini-stats {
    grid-template-columns: 1fr 1fr;
  }

  .stats-detail-dialog .store-columns-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .admin-side {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .product-preview-panel {
    min-height: auto;
  }

  .product-list-scroll {
    max-height: 520px;
    min-height: 320px;
  }

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

  .checkout-panel {
    position: static;
    max-height: none;
  }

  .admin-form,
  .admin-product {
    grid-template-columns: 1fr 1fr;
  }

  .admin-form .wide {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  body {
    background: #f3f5f1;
  }

  .topbar-inner,
  .section-head,
  .payment-box,
  .order-top {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    padding: 12px;
  }

  .topbar h1 {
    font-size: 22px;
    line-height: 1.15;
  }

  .brand-block {
    grid-column: 1 / -1;
  }

  .eyebrow {
    font-size: 12px;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .shop-top-actions {
    display: contents;
  }

  .purchase-open-btn {
    grid-column: 1;
    align-self: center;
    width: 100%;
    max-width: none;
    min-height: 38px;
    padding-inline: 12px;
    font-size: 13px;
    line-height: 1.2;
    white-space: normal;
  }

  .cart-jump-btn {
    grid-column: 2;
    align-self: center;
    width: 100%;
    max-width: none;
    min-height: 38px;
    padding-inline: 12px;
    font-size: 13px;
    line-height: 1.2;
    white-space: normal;
  }

  .language-switch {
    grid-column: 1 / -1;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lang-btn {
    width: 100%;
  }

  .shop-shell,
  .admin-shell {
    gap: 12px;
    padding-top: 12px;
    padding-inline: 12px;
    padding-bottom: 24px;
  }

  .section-head,
  .panel-head {
    gap: 10px;
    margin-bottom: 12px;
  }

  .search-box {
    width: 100%;
  }

  .admin-filter-bar {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
  }

  .admin-filter-summary {
    font-size: 12px;
  }

  .product-filter-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .tag-filter-row {
    justify-content: stretch;
    margin-top: -2px;
  }

  .tag-filter-row label {
    width: 100%;
  }

  .filter-btn {
    width: 100%;
    min-height: 40px;
    padding-inline: 8px;
    font-size: 14px;
  }

  .product-area,
  .checkout-panel,
  .admin-band {
    padding: 16px;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .product-card img {
    aspect-ratio: 1 / 1;
  }

  .product-tag-title {
    font-size: 22px;
  }

  .product-info {
    gap: 8px;
    padding: 10px;
  }

  .product-meta {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .category,
  .stock {
    font-size: 12px;
  }

  .product-info h3 {
    display: -webkit-box;
    min-height: 38px;
    overflow: hidden;
    font-size: 15px;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .product-info p {
    display: -webkit-box;
    min-height: 38px;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .price {
    font-size: 18px;
  }

  .product-card .primary-btn {
    width: 100%;
    min-height: 40px;
    padding-inline: 8px;
    font-size: 14px;
  }

  .product-card .vip-discount-btn {
    width: 100%;
    min-height: 40px;
    padding-inline: 8px;
    font-size: 13px;
    line-height: 1.2;
  }

  label input,
  label textarea,
  select,
  .primary-btn,
  .ghost-btn,
  .danger-btn,
  .pay-link {
    min-height: 44px;
    font-size: 16px;
  }

  .checkout-panel {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .cart-row {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .cart-row img {
    width: 56px;
    height: 56px;
  }

  .qty-control {
    min-width: 104px;
  }

  .file-picker {
    grid-template-columns: 1fr;
  }

  .payment-actions,
  .payment-actions .pay-link,
  .payment-actions .keep-btn {
    width: 100%;
  }

  .paypal-checkout {
    padding: 12px;
  }

  .paypal-checkout-head {
    align-items: stretch;
    flex-direction: column;
  }

  .paypal-environment {
    align-self: flex-start;
  }

  .admin-form,
  .admin-product {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .master-stats-grid,
  .vision-actions,
  .vision-result-actions {
    grid-template-columns: 1fr;
  }

  .store-card-head,
  .store-mini-stats {
    grid-template-columns: 1fr;
  }

  .store-card-head {
    display: grid;
  }

  .stats-detail-modal {
    align-items: end;
    padding: 10px;
  }

  .stats-detail-dialog {
    width: 100%;
    max-height: 86vh;
    padding: 18px 14px;
  }

  .stats-detail-dialog .store-columns-body,
  .stats-detail-dialog .single-detail-body,
  .personal-stat-grid {
    grid-template-columns: 1fr;
  }

  .store-detail-heading {
    display: grid;
    align-items: start;
  }

  .product-preview-card {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .product-preview-card img,
  .selected-product-card img {
    width: 72px;
    height: 72px;
  }

  .product-preview-stats {
    grid-column: 2;
    justify-items: start;
  }

  .selected-product-card {
    grid-template-columns: 1fr;
  }

  .selected-actions {
    position: sticky;
    bottom: -16px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 10px 0 16px;
    background: var(--surface);
  }

  .product-edit-modal {
    align-items: end;
    padding: 10px;
  }

  .product-edit-dialog {
    width: 100%;
    max-height: 90vh;
    padding: 16px;
  }

  .admin-form .wide {
    grid-column: span 1;
  }

  .order-item {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .order-item strong {
    grid-column: 2;
  }
}

@media (max-width: 640px) {
  .customer-entry {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .vip-keep-entry {
    grid-column: auto;
  }

  .customer-entry h2 {
    font-size: 18px;
  }

  .payment-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .payment-actions .pay-link,
  .payment-actions .line-pay-link,
  .payment-actions .keep-btn {
    width: 100%;
    min-height: 40px;
  }

  .vip-keep-modal {
    align-items: end;
    padding: 10px;
  }

  .vip-keep-dialog {
    width: 100%;
    max-height: 86vh;
    padding: 16px 14px max(16px, env(safe-area-inset-bottom));
  }

  .vip-keep-head,
  .vip-keep-paybox,
  .vip-keep-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .vip-keep-content {
    grid-template-columns: 1fr;
  }

  .vip-keep-item,
  .vip-keep-admin-card {
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: start;
  }

  .vip-keep-item img,
  .vip-keep-thumb img {
    width: 64px;
    height: 64px;
  }

  .vip-keep-delete-btn,
  .vip-keep-card-actions {
    grid-column: 1 / -1;
    width: 100%;
  }

  .vip-keep-delete-btn,
  .vip-keep-card-actions .danger-btn,
  .vip-keep-open-btn {
    min-height: 48px;
    touch-action: manipulation;
  }

  .purchase-dialog {
    width: 100%;
    max-height: 86vh;
    padding: 16px 14px max(16px, env(safe-area-inset-bottom));
  }

  .purchase-head,
  .purchase-idea-admin-actions,
  .purchase-vote-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .purchase-idea-admin-main {
    grid-template-columns: 1fr;
  }

  .purchase-idea-admin-card,
  .purchase-card {
    grid-template-columns: 1fr;
  }

  .purchase-idea-thumb,
  .purchase-card-image {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
  }

  .purchase-image-button {
    width: 100%;
  }

  .purchase-vote-actions .primary-btn,
  .purchase-vote-actions .ghost-btn,
  .purchase-idea-admin-actions .primary-btn,
  .purchase-idea-admin-actions .danger-btn {
    width: 100%;
    min-height: 48px;
    touch-action: manipulation;
  }

  .admin-workbench {
    gap: 12px;
  }

  .product-number-lookup {
    padding: 12px;
  }

  .product-number-lookup-form {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .product-number-lookup-form > label {
    font-size: 16px;
  }

  .product-number-lookup-controls {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .product-number-lookup-controls button {
    padding-inline: 14px;
    white-space: nowrap;
  }

  .product-preview-card {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    min-height: 76px;
    gap: 10px;
    padding: 9px;
  }

  .product-preview-card img {
    width: 56px;
    height: 56px;
  }

  .product-preview-main h3 {
    font-size: 16px;
  }

  .product-preview-stats {
    grid-column: auto;
    justify-items: end;
  }

  .admin-side .admin-form {
    grid-template-columns: 1fr;
  }

  .stage-choice-button {
    min-height: 48px;
    font-size: 14px;
  }

  .admin-stats-detail-modal {
    align-items: end;
    padding: 10px;
  }

  .admin-stats-detail-dialog {
    width: 100%;
    height: min(86vh, 760px);
    max-height: 86vh;
    padding: 16px;
  }

  .admin-stats-detail-dialog h2 {
    font-size: 22px;
  }
}

@supports (-webkit-touch-callout: none) {
  #productForm input,
  #productForm select,
  #productForm textarea,
  #productForm button,
  .product-number-lookup-controls input,
  .product-edit-dialog input,
  .product-edit-dialog select,
  .product-edit-dialog textarea {
    font-size: 16px;
  }
}
