:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #18212f;
  --muted: #657184;
  --line: #d9e0ea;
  --primary: #2563eb;
  --green: #15803d;
  --red: #b91c1c;
  --amber: #a16207;
}

* {
  box-sizing: border-box;
}

html,
body {
  touch-action: manipulation;
}

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

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

button {
  border: 1px solid var(--primary);
  border-radius: 8px;
  cursor: pointer;
  min-height: 42px;
  padding: 9px 14px;
}

.primary {
  background: var(--primary);
  color: #ffffff;
}

.secondary,
.ghost {
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.danger {
  color: var(--red);
}

.large {
  min-height: 52px;
  font-weight: 700;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 9px 11px;
  width: 100%;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.account-list { display: grid; gap: 10px; margin-top: 18px; }
.account-card { align-items: center; border: 1px solid var(--line); border-radius: 10px; display: flex; gap: 12px; justify-content: space-between; padding: 14px; }
.account-card p { margin: 4px 0 0; }
.account-form { display: grid; gap: 14px; max-width: 620px; width: min(100%, 620px); }
.coverage-list { display: grid; gap: 10px; margin-top: 12px; }
.coverage-card { border: 1px solid var(--line); border-left: 4px solid var(--amber); border-radius: 8px; padding: 12px; }
.coverage-card.complete { border-left-color: var(--green); }
.coverage-card p { margin: 6px 0 0; }
.permission-options { border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 8px; max-height: 240px; overflow: auto; padding: 10px; }
.permission-options label { align-items: center; display: flex; font-weight: 400; }
.permission-options input { min-height: auto; width: auto; }
.permission-options fieldset { border: 0; display: grid; gap: 8px; margin: 0; padding: 0; }
.permission-options fieldset + fieldset { border-top: 1px solid var(--line); padding-top: 12px; }
.permission-options legend { font-weight: 700; margin-bottom: 8px; }
.home-panel-hidden { display: none !important; }

.login-shell {
  align-items: center;
  display: flex;
  min-height: 100vh;
  justify-content: center;
  padding: 20px;
}

.login-card,
.panel,
.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 44px rgba(22, 30, 46, 0.08);
}

.login-card {
  display: grid;
  gap: 16px;
  max-width: 420px;
  padding: 24px;
  width: 100%;
}

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

h1,
h2,
p {
  margin: 0;
}

.password-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

.check-row {
  align-items: center;
  display: flex;
  font-weight: 400;
}

.check-row input {
  min-height: auto;
  width: auto;
}

.error-text,
.notice.error {
  color: var(--red);
}

.portal {
  margin: 0 auto;
  max-width: 1440px;
  padding: 18px 18px 92px;
}

.portal-header {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.store-home-tab-name { display: none; }

.tabs {
  background: #e9edf5;
  border-radius: 10px;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 14px;
  padding: 4px;
}

.tabs.manager-nav {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.tab {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #384559;
  font-size: 15px;
  font-weight: 700;
  min-width: 0;
  padding: 10px 8px;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.tab.active {
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  color: var(--ink);
}

.tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
}

.notice {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  color: #065f46;
  margin-bottom: 14px;
  padding: 10px 12px;
}

.store-network-status {
  border: 1px solid #93c5fd;
  border-radius: 8px;
  margin: 0 0 12px;
  padding: 9px 12px;
}

.store-network-status.slow { background: #fffbeb; border-color: #fbbf24; color: #92400e; }
.store-network-status.loading { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.store-network-status.error { background: #fff7ed; border-color: #fdba74; color: #9a3412; }
.store-network-status.offline { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.store-network-status.online { background: #ecfdf5; border-color: #86efac; color: #166534; }

.store-view {
  display: none;
}

.store-view.active {
  display: block;
}

.metric-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}

.metric span {
  color: var(--muted);
}

.metric strong {
  display: block;
  font-size: 28px;
  margin-top: 8px;
}

.home-actions,
.cart-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.panel {
  padding: 16px;
}

.section-heading,
.order-card-head,
.order-card-facts,
.order-card-flags {
  align-items: center;
  display: flex;
}

.section-heading,
.order-card-head {
  justify-content: space-between;
}

.section-heading {
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading .meta {
  margin-top: 3px;
}

.link-button {
  background: transparent;
  border: 0;
  color: var(--primary);
  min-height: auto;
  padding: 5px;
  white-space: nowrap;
}

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

.order-card-head {
  gap: 10px;
}

.order-card-facts,
.order-card-flags {
  color: var(--muted);
  flex-wrap: wrap;
  font-size: 13px;
  gap: 6px 14px;
}

.order-card-facts span + span::before {
  color: #b1bac8;
  content: "·";
  margin-right: 14px;
}

.order-card-flags:empty {
  display: none;
}

.toolbar {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(300px, 1fr) 160px 180px 220px auto;
  margin-bottom: 14px;
}

.product-search-row { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr) auto; min-width: 0; }
#order-view > .product-search-row { margin-bottom: 10px; }
.search-input-picker { position: relative; align-self: start; }
#search-input-picker-toggle { min-height: 44px; width: 84px; padding: 8px 6px; font-size: 14px; white-space: nowrap; }
.search-input-options { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 150px; padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: white; box-shadow: 0 6px 20px #0f172a22; }
.search-input-options button { width: 100%; min-height: 44px; padding: 8px; font-size: 14px; margin: 2px 0; white-space: nowrap; }
.product-search-row input { min-width: 0; width: 100%; }
.barcode-scan-button { min-width: 82px; padding-left: 10px; padding-right: 10px; white-space: nowrap; }
.screen-keyboard-toggle { min-width: 112px; padding-left: 10px; padding-right: 10px; white-space: nowrap; }
.product-screen-keyboard {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .12);
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
  padding: 12px;
}
.product-screen-keyboard p { color: var(--muted); font-size: 13px; margin: 0; }
.product-screen-keyboard-keys { display: grid; gap: 6px; grid-template-columns: repeat(10, minmax(36px, 1fr)); }
.product-screen-keyboard-keys button { min-height: 44px; padding: 6px 2px; }
.product-screen-keyboard-actions { display: grid; gap: 8px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.product-screen-keyboard-actions button { min-height: 44px; padding-left: 6px; padding-right: 6px; }

.barcode-scanner-card { display: grid; gap: 14px; max-width: 620px; width: 100%; }
.barcode-scanner-heading { align-items: flex-start; display: flex; gap: 12px; justify-content: space-between; }
.barcode-scanner-heading h2, .barcode-scanner-heading p { margin: 0; }
.barcode-scanner-heading p { margin-top: 5px; }
.barcode-video-frame { background: #080b10; border-radius: 14px; min-height: 260px; overflow: hidden; position: relative; }
.barcode-video-frame video { display: block; height: min(58vh, 460px); object-fit: cover; width: 100%; }
.barcode-target { border: 3px solid #34d399; border-radius: 12px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .28); height: 34%; left: 8%; position: absolute; top: 33%; width: 84%; }

.toolbar select {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
}

.product-loading-heading {
  color: var(--muted);
  font-weight: 700;
  grid-column: 1 / -1;
}

.product-skeleton {
  pointer-events: none;
}

.skeleton-image,
.skeleton-line,
.skeleton-actions {
  animation: store-skeleton-pulse 1.2s ease-in-out infinite;
  background: linear-gradient(90deg, #e8edf4 25%, #f8fafc 50%, #e8edf4 75%);
  background-size: 200% 100%;
  border-radius: 8px;
  display: block;
}

.skeleton-image { height: 82px; width: 82px; }
.skeleton-line { height: 13px; margin: 9px 0; width: 72%; }
.skeleton-line.wide { height: 18px; width: 94%; }
.skeleton-line.short { width: 48%; }
.skeleton-actions { grid-column: 1 / -1; height: 54px; }

@keyframes store-skeleton-pulse {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

.product-more-info {
  margin-top: 6px;
}

.product-more-info summary {
  color: var(--primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.product-more-info[open] summary {
  margin-bottom: 5px;
}

.product-visible-stock {
  align-items: center;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  color: #047857;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin: 7px 0 0;
  padding: 6px 9px;
}

.product-visible-stock span {
  font-size: 12px;
  font-weight: 700;
}

.product-visible-stock strong {
  color: #047857;
  font-size: 16px;
  line-height: 1.2;
}

.store-product-pagination {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  margin-top: 16px;
  padding: 12px 14px;
}

.store-product-page-size-label {
  align-items: center;
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.store-product-page-size-label select {
  min-width: 88px;
  width: auto;
}

.store-product-page-actions {
  flex-wrap: wrap;
  align-items: center;
  display: flex;
  gap: 10px;
}

.store-product-page-jump { display: flex; align-items: center; gap: 6px; margin: 0; }
.store-product-page-jump label { margin: 0; white-space: nowrap; }
.store-product-page-jump input { width: 72px; min-width: 0; min-height: 44px; padding: 8px; }
.store-product-page-jump button { min-height: 44px; }

.store-product-page-actions strong {
  min-width: 92px;
  text-align: center;
  white-space: nowrap;
}

.store-product-page-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.empty-products {
  align-items: center;
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  display: flex;
  gap: 12px;
  grid-column: 1 / -1;
  justify-content: space-between;
  padding: 18px;
}

.empty-products p {
  margin: 0;
}

.product-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-sizing: border-box;
  display: grid;
  gap: 12px;
  grid-template-columns: 82px 1fr;
  min-width: 0;
  padding: 12px;
  position: relative;
}

.product-card > * {
  min-width: 0;
}

.product-card.in-cart {
  border-color: #93c5fd;
}

.product-variant-picker {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 9px;
  display: grid;
  gap: 5px;
  margin: 9px 0;
  padding: 8px;
}

.product-variant-picker span {
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 800;
}

.product-variant-picker select {
  background: #fff;
  border: 1px solid #93c5fd;
  border-radius: 7px;
  color: #172033;
  font-size: 14px;
  font-weight: 700;
  min-height: 42px;
  min-width: 0;
  padding: 7px 9px;
  width: 100%;
}

.product-selected-variant {
  font-weight: 700;
}

.upc-supplement-button {
  align-items: center;
  align-self: end;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 58%, #0369a1 100%);
  border: 1px solid #0369a1;
  border-bottom-width: 4px;
  border-radius: 11px;
  box-shadow: 0 5px 10px rgba(3, 105, 161, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  color: #ffffff;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  gap: 7px;
  justify-content: center;
  min-height: 43px;
  padding: 8px 13px 6px;
  text-shadow: 0 1px 1px rgba(3, 74, 112, 0.45);
  transition: box-shadow 0.12s ease, transform 0.12s ease, filter 0.12s ease;
}

.upc-supplement-button span {
  font-size: 18px;
  line-height: 1;
}

.upc-supplement-button:hover:not(:disabled) {
  filter: brightness(1.06);
}

.upc-supplement-button:active:not(:disabled) {
  border-bottom-width: 1px;
  box-shadow: 0 2px 4px rgba(3, 105, 161, 0.24), inset 0 2px 4px rgba(3, 74, 112, 0.18);
  transform: translateY(3px);
}

.upc-supplement-button:focus-visible {
  outline: 3px solid rgba(56, 189, 248, 0.38);
  outline-offset: 2px;
}

.upc-supplement-button:disabled {
  background: linear-gradient(180deg, #cbd5e1, #94a3b8);
  border-color: #64748b;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.78;
  text-shadow: none;
}

.submit-warning {
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 9px;
  color: #9a3412;
  margin-top: 10px;
  padding: 10px;
}

.submit-warning.error { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.submit-warning ul { margin: 6px 0 0; padding-left: 20px; }
.submit-warning li + li { margin-top: 6px; }
#confirm-submit-button.loading { cursor: wait; opacity: .78; }

.previous-order-count {
  align-items: center;
  background: #fff;
  border: 2px solid #ef4444;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgb(239 68 68 / 18%);
  color: #dc2626;
  display: inline-flex;
  font-size: 14px;
  font-weight: 800;
  height: 30px;
  justify-content: center;
  line-height: 1;
  min-width: 30px;
  padding: 0 6px;
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 1;
}

.product-card > div:first-of-type {
  padding-right: 34px;
}

.product-suggested-prices {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 7px 0;
}

.product-suggested-prices span {
  background: #eef6ff;
  border-radius: 7px;
  color: #334155;
  font-size: 14px;
  padding: 5px 8px;
}

.product-suggested-prices strong {
  color: #1d4ed8;
}

.product-suggested-prices .suggested-sale-price {
  background: #fff1f2;
  color: #9f1239;
}

.product-suggested-prices .suggested-sale-price strong {
  color: #dc2626;
}

.new-products-intro {
  margin-bottom: 14px;
}

.new-products-intro h2 {
  margin-bottom: 6px;
}

.new-product-card {
  border-color: #c4b5fd;
}

.new-product-heading {
  align-items: flex-start;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.new-product-badge {
  background: #f3e8ff;
  color: #7e22ce;
  flex: 0 0 auto;
  margin-top: 0;
}

.new-product-note {
  background: #faf5ff;
  border-radius: 8px;
  color: #6b21a8;
  font-size: 13px;
  line-height: 1.5;
  margin: 8px 0 0;
  padding: 8px 10px;
  white-space: pre-wrap;
}

.launch-vote-summary {
  align-items: center;
  background: #f8fafc;
  border-radius: 8px;
  display: flex;
  gap: 8px;
  grid-column: 1 / -1;
  justify-content: space-between;
  padding: 10px 12px;
}

.launch-vote-summary span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.new-product-vote-actions {
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.product-card img,
.detail-table img {
  background: #eef2f6;
  border-radius: 8px;
  height: 72px;
  object-fit: cover;
  width: 72px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.product-english-name {
  font-size: 12px;
}

.pending-price {
  color: #b45309;
  font-weight: 700;
}

.store-price {
  color: #0f172a;
  font-size: 1.08em;
  font-weight: 800;
}

.badge {
  background: #eff6ff;
  border-radius: 999px;
  color: var(--primary);
  display: inline-block;
  font-size: 12px;
  margin-top: 6px;
  padding: 4px 8px;
}

.badge.warehouse {
  background: #fef3c7;
  color: #92400e;
}

.qty-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  grid-template-columns: 54px minmax(58px, 1fr) 54px auto;
}

.product-order-actions {
  box-sizing: border-box;
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(54px, 1fr));
  min-width: 0;
  width: 100%;
}

.product-order-actions > * {
  box-sizing: border-box;
  min-width: 0;
}

.product-line-total {
  display: none;
}

.quantity-input {
  font-size: 18px;
  font-weight: 700;
  height: 56px;
  min-height: 56px;
  min-width: 0;
  text-align: center;
  width: 100%;
}

.quantity-step-button {
  align-items: center;
  background: linear-gradient(180deg, #ffffff 0%, #eef2f7 100%);
  border: 1px solid #cbd5e1;
  border-bottom: 3px solid #94a3b8;
  border-radius: 11px;
  box-shadow:
    0 3px 6px rgba(15, 23, 42, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  color: #172033;
  cursor: pointer;
  display: inline-flex;
  font-size: 24px;
  font-weight: 800;
  height: 56px;
  justify-content: center;
  line-height: 1;
  min-height: 56px;
  min-width: 0;
  padding: 0;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
  user-select: none;
  width: 100%;
}

.quantity-step-button:hover:not(:disabled) {
  background: linear-gradient(180deg, #ffffff 0%, #e2e8f0 100%);
}

.quantity-step-button:active:not(:disabled) {
  border-bottom-width: 1px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.18),
    inset 0 1px 3px rgba(15, 23, 42, 0.08);
  transform: translateY(2px);
}

.quantity-step-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.card-feedback {
  color: var(--green);
  font-size: 13px;
  grid-column: 1 / -1;
  min-height: 18px;
}

.card-feedback.error {
  color: var(--red);
}

.qty-row button {
  min-height: 56px;
  padding: 0;
}

.cart-items {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.cart-item,
.order-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.cart-item-product {
  align-items: flex-start;
  display: grid;
  gap: 12px;
  grid-template-columns: 84px minmax(0, 1fr) minmax(160px, 220px);
}

.cart-item-product-copy {
  min-width: 0;
}

.cart-item-controls {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.cart-item-controls .qty-row {
  grid-template-columns: 48px minmax(64px, 1fr) 48px;
}

.cart-item-controls [data-cart-remove] {
  grid-column: 1 / -1;
}

.cart-item-product-copy > strong {
  display: block;
  font-size: 16px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.cart-item-product-copy > p {
  margin-bottom: 0;
  margin-top: 5px;
}

.cart-item-image,
.cart-item-image-placeholder {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 9px;
  height: 84px;
  width: 84px;
}

.cart-line-total {
  align-items: baseline;
  background: #eefbf7;
  border: 1px solid #b7ead8;
  border-radius: 8px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 8px;
  padding: 7px 10px;
}

.cart-line-total span {
  color: #52736a;
  font-size: 12px;
  font-weight: 700;
}

.cart-line-total strong {
  color: #0f766e;
  font-size: 17px;
}

.cart-item-image {
  object-fit: contain;
}

.cart-item-image-placeholder {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  justify-content: center;
  text-align: center;
}

.cart-totals,
.detail-summary {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  padding: 12px;
}

.mobile-order-detail-toggle-cell {
  display: none;
}

.order-detail-english-name {
  color: var(--muted);
  display: block;
  margin-top: 3px;
}

.floating-cart-bar {
  align-items: center;
  background: transparent;
  border: 0;
  bottom: 16px;
  box-shadow: none;
  display: flex;
  gap: clamp(32px, 4vw, 42px);
  justify-content: center;
  left: 50%;
  max-width: min(760px, calc(100vw - 24px));
  padding: 8px 14px;
  pointer-events: none;
  position: fixed;
  transform: translateX(-50%);
  width: 100%;
  z-index: 8;
}

.floating-order-amount {
  align-items: center;
  background: #111827;
  border: 0;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.18);
  color: #ffffff;
  display: flex;
  flex: 1 1 auto;
  font-size: clamp(19px, 3vw, 23px);
  font-weight: 800;
  justify-content: center;
  letter-spacing: 0.01em;
  max-width: 430px;
  min-height: 70px;
  padding: 12px 26px;
  pointer-events: auto;
  white-space: nowrap;
}

.floating-order-amount span,
.floating-order-amount strong {
  color: #ffffff;
}

.floating-order-amount small {
  color: #fbbf24;
  font-size: 11px;
  margin-left: 8px;
  white-space: normal;
}

.floating-order-button {
  align-items: center;
  background: #19a94f;
  border: 0;
  border-radius: 50%;
  box-shadow: 0 10px 24px rgba(25, 169, 79, 0.20);
  color: #ffffff;
  display: flex;
  flex: 0 0 92px;
  font-size: 21px;
  font-weight: 800;
  height: 92px;
  justify-content: center;
  min-height: 92px;
  padding: 0;
  pointer-events: auto;
  position: relative;
  width: 92px;
}

.floating-order-button:hover {
  background: #158f45;
}

.floating-order-button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 3px;
}

.floating-order-count {
  align-items: center;
  background: #e52329;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  display: flex;
  font-size: 19px;
  height: 44px;
  justify-content: center;
  min-width: 44px;
  padding: 0 8px;
  position: absolute;
  right: -6px;
  top: -11px;
}

.floating-order-button-label {
  color: #ffffff;
}

.table-wrap {
  overflow: auto;
}

table {
  border-collapse: collapse;
  min-width: 960px;
  width: 100%;
}

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

th {
  background: #f2f5f8;
  color: #4b5563;
  font-size: 13px;
}

.status {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  padding: 4px 8px;
}

.status.draft {
  background: #f3f4f6;
}

.status.returned {
  background: #fef2f2;
  color: var(--red);
}

.status.submitted,
.status.batched,
.status.purchasing {
  background: #eff6ff;
  color: var(--primary);
}

.status.ordered,
.status.delivering,
.status.completed,
.status.issued {
  background: #ecfdf5;
  color: var(--green);
}

.status.void {
  background: #fef2f2;
  color: var(--red);
}

.detail-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.order-detail-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.store-order-print-column-picker {
  position: relative;
}

.store-order-print-column-picker summary {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  font-weight: 700;
  list-style: none;
  padding: 9px 12px;
}

.store-order-print-column-picker summary span {
  color: var(--primary);
  font-size: 11px;
  white-space: nowrap;
}

.store-order-print-column-picker summary::-webkit-details-marker {
  display: none;
}

.store-order-print-column-options {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.16);
  display: grid;
  gap: 8px;
  min-width: 210px;
  padding: 12px;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 12;
}

.store-order-print-column-options label {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.store-order-print-column-options input {
  appearance: auto;
  -webkit-appearance: checkbox;
  border-radius: 3px;
  flex: 0 0 20px;
  height: 20px !important;
  margin: 0 !important;
  min-height: 20px !important;
  padding: 0 !important;
  width: 20px !important;
}

[data-print-column][hidden] {
  display: none !important;
}

.store-order-print-sheet {
  display: none;
}

body.native-order-document .portal-header,
body.native-order-document .tabs,
body.native-order-document .no-print,
body.native-order-document .notice,
body.native-order-document #login-view {
  display: none !important;
}

body.native-order-document .portal {
  max-width: none;
  padding: 0;
}

body.native-order-document .store-view {
  display: none !important;
}

body.native-order-document #detail-view {
  display: block !important;
}

body.native-order-document #detail-view .panel {
  border: 0;
  box-shadow: none;
}

body.native-order-document #detail-view {
  margin: 0 auto;
  width: 190mm;
}

body.native-order-document #detail-view .table-wrap {
  display: none;
}

body.native-order-document .store-order-print-sheet {
  display: block;
}

body.native-order-document .store-order-print-table {
  display: table;
}

body.native-order-document .store-order-print-table thead {
  display: table-header-group;
}

body.native-order-document .store-order-print-table tbody {
  display: table-row-group;
}

body.native-order-document .store-order-print-table tr {
  background: transparent;
  border: 0;
  border-radius: 0;
  display: table-row;
  margin: 0;
  padding: 0;
}

body.native-order-document .store-order-print-table th,
body.native-order-document .store-order-print-table td {
  display: table-cell;
  width: auto;
}

body.native-order-document .store-order-print-table td::before {
  display: none;
}

.store-order-print-table {
  border-collapse: collapse;
  table-layout: fixed;
  width: 100%;
}

.store-order-print-table th,
.store-order-print-table td {
  border: 1px solid #334155;
  font-size: 9px;
  line-height: 1.2;
  padding: 4px 5px;
  text-align: left;
  vertical-align: middle;
}

.store-order-print-table th {
  background: #f1f5f9;
  font-weight: 800;
  text-align: center;
}

.store-order-print-table td small {
  color: #475569;
  display: block;
  font-size: 8px;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.store-order-print-table .print-product-image {
  padding: 2px;
  text-align: center;
}

.store-order-print-table .print-product-image img {
  display: block;
  height: 34px;
  margin: 0 auto;
  object-fit: contain;
  width: 34px;
}

.store-order-print-table tbody tr {
  break-inside: avoid;
  page-break-inside: avoid;
}

.store-order-print-table .print-product-description strong,
.store-order-print-table .print-product-description small {
  display: block;
}

.store-order-print-table .print-number,
.store-order-print-table .print-money {
  text-align: right;
  white-space: nowrap;
}

.store-order-print-table .print-col-image { width: 7%; }
.store-order-print-table .print-col-code { width: 12%; }
.store-order-print-table .print-col-description { width: 30%; }
.store-order-print-table .print-col-unit { width: 13%; }
.store-order-print-table .print-col-quantity { width: 8%; }
.store-order-print-table .print-col-price { width: 10%; }
.store-order-print-table .print-col-amount { width: 11%; }
.store-order-print-table .print-col-note { width: 13%; }

.adjustment-decision-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.adjustment-decision-buttons button {
  min-height: 36px;
  padding: 7px 12px;
}

.modal {
  align-items: center;
  background: rgba(15, 23, 42, 0.42);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 16px;
  position: fixed;
  z-index: 20;
}

.modal-card {
  max-width: 420px;
  padding: 18px;
}

.order-action-card {
  display: grid;
  gap: 14px;
  width: 100%;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.store-header-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.store-language-control {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 4px;
  min-width: 150px;
}

.store-language-control select {
  min-height: 38px;
  padding: 7px 10px;
  width: 100%;
}

.store-menu-button,
.store-mobile-menu,
.store-launcher,
.store-launcher-top-logout,
.active-filter-summary {
  display: none;
}

@media (max-width: 1180px), (min-width: 768px) and (max-width: 1366px) and (orientation: landscape) and (hover: none) and (pointer: coarse) {
  .store-launcher {
    display: none;
  }

  body.store-launcher-open {
    background: #f4f6f9;
  }

  body.store-launcher-open .portal {
    max-width: 1080px;
    padding-top: max(18px, env(safe-area-inset-top));
  }

  body.store-launcher-open .portal-header,
  body.store-launcher-open .tabs,
  body.store-launcher-open #notice,
  body.store-launcher-open #store-network-status,
  body.store-launcher-open .store-view,
  body.store-launcher-open #floating-cart-bar {
    display: none !important;
  }

  body.store-launcher-open .store-launcher {
    display: grid;
    gap: 18px;
  }

  .store-launcher-header {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    padding: 4px 4px 18px;
  }

  .store-launcher-header h2 {
    font-size: clamp(27px, 4vw, 40px);
    margin: 6px 0;
  }

  .launcher-language-control {
    display: grid;
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 700;
    gap: 5px;
    min-width: 148px;
  }

  .launcher-language-control select {
    background: #ffffff;
    min-height: 44px;
    padding: 8px 10px;
  }

  .store-launcher-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .store-launcher-card {
    align-content: start;
    background: #ffffff;
    border: 1px solid #e7ebf0;
    border-radius: 22px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.07);
    color: var(--ink);
    display: grid;
    gap: 7px;
    min-height: 154px;
    padding: 20px;
    position: relative;
    text-align: left;
    transition: border-color .16s ease, box-shadow .16s ease, opacity .16s ease, transform .16s ease;
  }

  .launcher-layout-edit,
  .launcher-layout-reset {
    border: 0;
    border-radius: 9px;
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 800;
    min-height: 34px;
    padding: 5px 9px;
  }

  .launcher-layout-edit {
    background: #e0e7ff;
    color: #1d4ed8;
  }

  .launcher-layout-reset {
    background: #fff7ed;
    color: #c2410c;
  }

  .store-launcher.is-arranging [data-peer-inbox],
  .store-launcher.is-arranging .launcher-language-toggle,
  .store-launcher.is-arranging .store-launcher-top-logout {
    display: none;
  }

  .store-launcher.is-arranging .store-launcher-card:not(.hidden) {
    animation: store-launcher-wiggle .24s ease-in-out infinite alternate;
    border-color: #93c5fd;
    box-shadow: 0 8px 22px rgba(37, 99, 235, .15);
    cursor: grab;
    touch-action: none;
    user-select: none;
  }

  .store-launcher.is-arranging .store-launcher-card:nth-child(even):not(.hidden) {
    animation-direction: alternate-reverse;
  }

  .store-launcher.is-arranging .store-launcher-card:not(.hidden)::after {
    align-items: center;
    background: #2563eb;
    border: 3px solid #fff;
    border-radius: 999px;
    box-shadow: 0 2px 7px rgba(15, 23, 42, .22);
    color: #fff;
    content: "⋮⋮";
    display: flex;
    font-size: 13px;
    font-weight: 900;
    height: 30px;
    justify-content: center;
    letter-spacing: -4px;
    position: absolute;
    right: 8px;
    top: 8px;
    width: 30px;
  }

  .store-launcher.is-arranging .store-launcher-card.is-dragging {
    animation: none;
    box-shadow: 0 24px 48px rgba(15, 23, 42, .3);
    cursor: grabbing;
    margin: 0;
    opacity: .94;
    pointer-events: none;
    position: fixed;
    transform: scale(1.035);
    transition: box-shadow .14s ease, opacity .14s ease, transform .14s ease;
    z-index: 1000;
  }

  .store-launcher-placeholder {
    background: rgba(219, 234, 254, .58);
    border: 2px dashed #60a5fa;
    border-radius: 22px;
    min-height: 0;
    pointer-events: none;
    transition: transform .16s ease;
  }

  .store-launcher.is-arranging .store-launcher-card.is-settling {
    animation: none;
    transition: transform .18s cubic-bezier(.2, .8, .2, 1);
  }

  @keyframes store-launcher-wiggle {
    from { transform: rotate(-.35deg); }
    to { transform: rotate(.35deg); }
  }

  .store-launcher-card:hover {
    background: #ffffff;
    border-color: #bfdbfe;
    color: var(--ink);
    transform: translateY(-1px);
  }

  .store-launcher-icon {
    align-items: center;
    background: #eef2ff;
    border-radius: 13px;
    display: inline-flex;
    font-size: 24px;
    height: 46px;
    justify-content: center;
    margin-bottom: 2px;
    width: 46px;
  }

  .store-launcher-card strong {
    font-size: 20px;
    line-height: 1.25;
  }

  .store-launcher-header {
    gap: 12px;
  }

  .launcher-language-control {
    min-width: 132px;
  }

  .store-launcher-card small {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
  }

  .store-launcher-card.store-launcher-logout {
    background: #fee2e2;
    border-color: #fecaca;
    color: #b91c1c;
  }

  .store-launcher-logout .store-launcher-icon {
    background: rgba(255, 255, 255, 0.62);
  }

}

.active-filter-summary {
  align-items: center;
  background: #eef6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  color: #1e3a8a;
  gap: 10px;
  justify-content: space-between;
  margin: -2px 0 12px;
  padding: 10px 12px;
}

.active-filter-summary:not(.hidden) {
  display: flex;
}

.active-filter-summary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 768px) and (max-width: 1180px) {
  .portal {
    max-width: 100%;
    padding: 18px 18px calc(112px + env(safe-area-inset-bottom));
  }

  .quantity-input,
  .quantity-step-button,
  .qty-row button {
    height: 46px;
    min-height: 46px;
  }

  .quantity-input {
    font-size: 17px;
  }

  .quantity-step-button {
    font-size: 21px;
  }

  .product-order-actions {
    align-items: center;
    grid-column: 2;
    grid-template-columns: 48px minmax(64px, 92px) 48px;
    justify-content: start;
  }

  .product-line-total {
    align-items: baseline;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    gap: 8px;
    grid-column: 1 / -1;
    justify-content: space-between;
    padding: 7px 9px;
    width: 100%;
  }

  .product-line-total span {
    color: var(--muted);
    font-size: 12px;
  }

  .product-line-total strong {
    color: #0f766e;
    font-size: 17px;
  }

  .cart-item .qty-row {
    grid-template-columns: 48px minmax(72px, 100px) 48px auto;
    justify-content: start;
  }

  .metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

  .toolbar > input {
    grid-column: 1 / -1;
  }

  .product-search-row { grid-column: 1 / -1; }

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

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

  .product-card img {
    align-self: stretch;
    grid-row: 1 / span 2;
    height: 100%;
    max-height: 220px;
    min-height: 128px;
    object-fit: contain;
    width: 128px;
  }

  .detail-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .store-menu-button {
    align-items: center;
    display: inline-flex;
    font-size: 20px;
    justify-content: center;
    min-width: 44px;
    padding: 0;
  }

  .store-mobile-menu {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 16px 44px rgba(22, 30, 46, 0.14);
    display: grid;
    gap: 8px;
    margin: -6px 0 10px;
    padding: 10px;
  }

  .store-mobile-menu.hidden {
    display: none;
  }

  .tabs,
  .tabs.manager-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .tab[data-store-view="orders"],
  .tab[data-store-view="invoices"],
  .tab[data-store-view="new-products"],
  .tab[data-store-view="accounts"] {
    display: none;
  }

  #detail-view .table-wrap {
    overflow: visible;
  }

  #detail-view .detail-table,
  #detail-view .detail-table tbody,
  #detail-view .detail-table tr,
  #detail-view .detail-table td {
    display: block;
    min-width: 0;
    width: 100%;
  }

  #detail-view .detail-table thead,
  #detail-items-body .order-detail-extra {
    display: none;
  }

  #detail-view .detail-table tr {
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
    padding: 6px 0;
  }

  #detail-view .detail-table td {
    border: 0;
    display: grid;
    gap: 10px;
    grid-template-columns: 130px minmax(0, 1fr);
    padding: 7px 12px;
  }

  #detail-view .detail-table td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 12px;
    font-weight: 700;
  }

  #detail-items-body tr.mobile-order-detail-expanded .order-detail-extra {
    display: grid;
  }

  #detail-items-body .mobile-order-detail-toggle-cell {
    display: block;
  }

  #detail-items-body .mobile-order-detail-toggle-cell::before {
    display: none;
  }

  .mobile-order-detail-toggle {
    width: 100%;
  }
}

@media (min-width: 1024px) and (max-width: 1180px) and (orientation: landscape) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* iPad 横屏：商品保持两列，并充分利用卡片宽度展示大图。 */
@media (min-width: 768px) and (max-width: 1366px) and (orientation: landscape) and (hover: none) and (pointer: coarse) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-card {
    grid-template-columns: 176px minmax(0, 1fr);
    min-height: 184px;
    padding: 16px;
  }

  .product-card img {
    align-self: stretch;
    grid-row: 1 / span 2;
    height: 100%;
    max-height: 240px;
    min-height: 164px;
    object-fit: contain;
    width: 164px;
  }

  .product-order-actions {
    align-items: center;
    grid-column: 2;
    grid-template-columns: 48px minmax(64px, 92px) 48px;
    justify-content: start;
  }

  .quantity-input,
  .quantity-step-button,
  .qty-row button {
    height: 46px;
    min-height: 46px;
  }

  .quantity-input {
    font-size: 17px;
  }

  .quantity-step-button {
    font-size: 21px;
  }

  .product-line-total {
    align-items: baseline;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    gap: 8px;
    grid-column: 1 / -1;
    justify-content: space-between;
    padding: 7px 9px;
    width: 100%;
  }

  .product-line-total span {
    color: var(--muted);
    font-size: 12px;
  }

  .product-line-total strong {
    color: #0f766e;
    font-size: 17px;
  }

  .cart-item-product {
    grid-template-columns: 104px minmax(0, 1fr) 180px;
  }

  .cart-item-image,
  .cart-item-image-placeholder {
    height: 104px;
    width: 104px;
  }

  .cart-item .qty-row {
    grid-template-columns: 48px minmax(72px, 1fr) 48px;
    justify-content: start;
  }

  .cart-item .qty-row [data-cart-remove] {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1181px) {
  .product-more-info summary {
    display: none;
  }

  .product-more-info > :not(summary) {
    display: block;
  }
}

@media (max-width: 767px) {
  /* Native iOS supplies the initial inset, but sticky controls still need
     the safe-area offset after the document scrolls underneath the status bar. */
  body.store-native-top-inset::before { height: 0; }
  body.store-native-top-inset .portal { padding-top: 10px; }
  body.store-native-top-inset.store-page-scrolling::before {
    height: env(safe-area-inset-top, 0px);
    background: #ffffff;
  }

  /* Opaque status-area cover: scrolling products must never show beside the island. */
  body::before {
    content: '';
    position: fixed;
    inset: 0 0 auto;
    height: env(safe-area-inset-top, 0px);
    background: var(--bg);
    pointer-events: none;
    z-index: 9;
  }

  /* Clip horizontal overflow without creating a scroll container that traps sticky tabs. */
  html,
  body {
    overflow-x: clip;
    /* Keep the viewport from rubber-banding below the status area on pull-down.
       Do not disable touch scrolling or change the existing safe-area spacing. */
    overscroll-behavior-y: none;
  }

  body {
    min-width: 0;
  }

  button,
  input,
  select,
  textarea {
    font-size: 16px;
    min-height: 44px;
  }

  .login-shell {
    min-height: 100svh;
    padding: max(16px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  }

  .login-card {
    border-radius: 10px;
    padding: 18px;
  }

  .portal {
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) calc(110px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }

  .store-launcher-grid {
    gap: 12px;
  }

  .store-launcher-card {
    border-radius: 18px;
    min-height: 142px;
    padding: 16px;
  }

  .store-launcher-card strong {
    font-size: 18px;
  }

  .portal-header {
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
    min-height: 44px;
    background: var(--bg);
  }

  .portal-header > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
  }

  .store-header-actions {
    flex: 0 0 auto;
    gap: 6px;
  }

  .store-header-actions > button {
    min-height: 44px;
    padding: 6px 10px;
  }

  .portal-header h1 {
    font-size: 20px;
    line-height: 1.3;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.store-header-scrolled .store-home-tab-name {
    display: block;
    font-size: 10px;
    line-height: 13px;
    font-weight: 500;
    opacity: 0.8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .portal-header .eyebrow {
    display: none;
  }

  #manager-title {
    display: none;
  }

  #logout-button {
    display: none;
  }

  .store-language-control {
    display: none;
  }

  .store-mobile-language-control {
    display: grid;
    font-size: 13px;
    gap: 5px;
  }

  .store-menu-button {
    align-items: center;
    display: inline-flex;
    font-size: 20px;
    justify-content: center;
    min-width: 44px;
    padding: 0;
  }

  .store-mobile-menu {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 16px 44px rgba(22, 30, 46, 0.14);
    display: grid;
    gap: 8px;
    margin: -6px 0 10px;
    padding: 10px;
  }

  .store-mobile-menu.hidden {
    display: none;
  }

  .tabs {
    align-items: center;
    background: var(--bg);
    border-radius: 0;
    gap: 4px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 8px;
    padding: 2px 0 6px;
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 7;
  }

  .tabs.manager-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .portal-header,
  .tabs,
  #order-view > .product-search-row {
    box-shadow: 10px 0 var(--bg), -10px 0 var(--bg);
  }

  #order-view > .product-search-row {
    background: var(--bg);
    margin-bottom: 8px;
    padding-bottom: 6px;
    position: sticky;
    top: calc(var(--store-mobile-tabs-height, 52px) + env(safe-area-inset-top, 0px));
    z-index: 6;
  }

  #product-screen-keyboard {
    max-height: 50dvh;
    overflow-y: auto;
  }

  .tab {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.07);
    font-size: 12px;
    font-weight: 700;
    min-height: 44px;
    line-height: 16px;
    padding: 4px 2px;
    overflow-wrap: anywhere;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
    white-space: normal;
  }

  .tab.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 5px 12px rgba(37, 99, 235, 0.24);
    color: #ffffff;
  }

  .tab:active {
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
    transform: translateY(1px);
  }

  .tab[data-store-view="orders"] {
    display: none;
  }

  .tab[data-store-view="invoices"],
  .tab[data-store-view="new-products"],
  .tab[data-store-view="accounts"] {
    display: none;
  }

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

  .metric-grid {
    gap: 6px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 10px;
  }

  .metric {
    min-width: 0;
    padding: 8px 4px;
    text-align: center;
  }

  .metric span {
    display: block;
    font-size: 10px;
    line-height: 1.2;
    min-height: 24px;
  }

  .metric strong {
    font-size: 22px;
    margin-top: 1px;
  }

  #home-view .home-actions {
    display: none;
  }

  .panel {
    border-radius: 10px;
    padding: 12px;
  }

  .recent-orders-panel h2 {
    font-size: 20px;
  }

  .recent-orders-panel .section-heading > div > .meta {
    display: none;
  }

  .section-heading {
    margin-bottom: 10px;
  }

  .order-list {
    gap: 8px;
  }

  .order-row {
    gap: 7px;
    padding: 10px;
  }

  .order-row > button {
    min-height: 40px;
  }

  .order-card-head strong {
    font-size: 16px;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .order-card-facts,
  .order-card-flags {
    font-size: 12px;
    gap: 5px 9px;
  }

  .order-card-facts span + span::before {
    margin-right: 9px;
  }

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

  .toolbar > input {
    grid-column: 1 / -1;
  }

  .toolbar > button {
    grid-column: 1 / -1;
  }

  .product-search-row { grid-column: 1 / -1; }

  .toolbar select {
    min-width: 0;
    text-overflow: ellipsis;
  }

  .active-filter-summary:not(.hidden) {
    align-items: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .active-filter-summary span {
    white-space: normal;
  }

  .store-product-pagination {
    align-items: stretch;
    grid-template-columns: 1fr;
    text-align: center;
  }

  .store-product-page-size-label {
    justify-content: center;
  }

  .store-product-page-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .store-product-page-jump { grid-column: 1 / -1; justify-content: center; }

  .store-product-page-actions button {
    padding-left: 8px;
    padding-right: 8px;
  }

  .empty-products {
    align-items: stretch;
    display: grid;
  }

  .product-card {
    gap: 9px;
    grid-template-columns: 120px minmax(0, 1fr);
    padding: 10px;
  }

  .product-card img {
    align-self: stretch;
    grid-row: 1 / span 2;
    height: 100%;
    max-height: 210px;
    min-height: 108px;
    object-fit: contain;
    width: 110px;
  }

  .product-card .badge {
    margin-top: 4px;
  }

  .product-card .meta {
    font-size: 12px;
    line-height: 1.35;
    margin-top: 3px;
  }

  .product-card .product-more-info .meta {
    display: block;
  }

  .product-card strong,
  .meta {
    overflow-wrap: anywhere;
  }

  .qty-row {
    gap: 8px;
    grid-template-columns: 44px minmax(64px, 88px) 44px minmax(92px, 1fr);
  }

  .product-order-actions {
    align-items: center;
    grid-column: 2;
    grid-template-columns: 44px minmax(64px, 88px) 44px;
    justify-content: start;
  }

  .product-line-total {
    align-items: baseline;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    gap: 6px;
    grid-column: 1 / -1;
    justify-content: space-between;
    padding: 6px 8px;
    width: 100%;
  }

  .product-line-total span {
    color: var(--muted);
    font-size: 11px;
  }

  .product-line-total strong {
    color: #0f766e;
    font-size: 16px;
  }

  .qty-row .primary {
    grid-column: auto;
  }

  .cart-item .qty-row {
    grid-template-columns: 36px minmax(48px, 1fr) 36px;
  }

  .cart-item .qty-row [data-cart-remove] {
    grid-column: 1 / -1;
  }

  .quantity-step-button {
    font-size: 20px;
    height: 44px;
    min-height: 44px;
    min-width: 0;
  }

  .quantity-input {
    font-size: 16px;
    height: 44px;
    min-height: 44px;
    padding-left: 4px;
    padding-right: 4px;
    text-align: center;
  }

  .qty-row button {
    min-height: 44px;
  }

  .cart-item-product {
    gap: 8px;
    grid-template-columns: 64px minmax(0, 1fr) 128px;
  }

  .cart-item-image,
  .cart-item-image-placeholder {
    height: 64px;
    width: 64px;
  }

  .cart-item-controls .qty-row button,
  .cart-item-controls .qty-row input {
    min-height: 40px;
  }

  .cart-line-total {
    padding: 6px 7px;
  }

  .cart-line-total strong {
    font-size: 15px;
  }

  .floating-cart-bar {
    bottom: calc(2px + env(safe-area-inset-bottom));
    gap: 10px;
    left: 0;
    max-width: none;
    padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
    transform: none;
  }

  .floating-order-amount {
    flex: 1 1 0;
    min-width: 0;
    max-width: 250px;
    min-height: 52px;
    padding: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px 4px;
    justify-content: center;
    border-radius: 999px;
    background: #111827;
    border: 0;
    box-shadow: 0 4px 12px #11182724;
  }

  .floating-order-amount span {
    font-size: 13px;
    color: #ffffff;
  }

  .floating-order-amount strong {
    font-size: 18px;
    line-height: 1.15;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .floating-order-amount small {
    display: none;
  }

  .floating-order-button {
    flex-basis: 64px;
    font-size: 18px;
    height: 64px;
    min-height: 64px;
    transform: none;
    width: 64px;
    border-radius: 50%;
    background: #19a94f;
    border: 0;
    box-shadow: 0 4px 12px #15803d30;
  }

  .floating-order-button:active {
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px #065f4633;
  }

  .floating-order-count {
    font-size: 12px;
    height: 26px;
    min-width: 26px;
    right: -3px;
    top: -7px;
    border: 2px solid var(--bg);
    padding: 0 6px;
  }

  #cart-view {
    padding-bottom: calc(112px + env(safe-area-inset-bottom));
  }

  #cart-view .cart-totals,
  #cart-view .cart-actions {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 12px 34px rgba(22, 30, 46, 0.10);
    position: sticky;
    z-index: 5;
  }

  #cart-view .cart-totals {
    bottom: calc(62px + env(safe-area-inset-bottom));
  }

  #cart-view .cart-actions {
    bottom: env(safe-area-inset-bottom);
    display: grid;
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .table-wrap {
    overflow: visible;
  }

  table,
  .detail-table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tr {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
    padding: 8px 0;
  }

  td {
    border-bottom: 0;
    display: grid;
    gap: 10px;
    grid-template-columns: 112px minmax(0, 1fr);
    padding: 8px 12px;
    word-break: break-word;
  }

  td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 12px;
    font-weight: 700;
  }

  #detail-items-body .order-detail-extra {
    display: none;
  }

  #detail-items-body tr.mobile-order-detail-expanded .order-detail-extra {
    display: grid;
  }

  #detail-items-body .mobile-order-detail-toggle-cell {
    display: block;
    padding: 8px 12px 4px;
  }

  #detail-items-body .mobile-order-detail-toggle-cell::before {
    display: none;
  }

  .mobile-order-detail-toggle {
    min-height: 40px;
    width: 100%;
  }

  .detail-head {
    display: grid;
  }

  .order-detail-top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .store-order-print-column-picker {
    min-width: 0;
  }

  .store-order-print-column-picker summary {
    min-height: 44px;
    width: 100%;
  }

  .store-order-print-column-options {
    left: 0;
    max-width: calc(100vw - 40px);
    min-width: min(280px, calc(100vw - 40px));
    right: auto;
  }

  .order-detail-top-actions #back-orders-button {
    grid-column: 1 / -1;
  }

  #cart-view .cart-actions {
    grid-template-columns: 1fr 1fr;
  }

  #cart-view #clear-cart-button {
    grid-column: 1 / -1;
  }

  .modal {
    align-items: stretch;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .modal-card {
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
    width: 100%;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }

  body {
    background: #ffffff;
  }

  .portal-header,
  .tabs,
  .no-print,
  .notice,
  #login-view {
    display: none !important;
  }

  .portal {
    max-width: none;
    padding: 0;
  }

  .store-view {
    display: none !important;
  }

  #detail-view {
    display: block !important;
  }

  #detail-view .table-wrap {
    display: none !important;
  }

  .store-order-print-sheet {
    display: block !important;
  }

  .store-order-print-table {
    display: table !important;
  }

  .store-order-print-table thead {
    display: table-header-group !important;
  }

  .store-order-print-table tbody {
    display: table-row-group !important;
  }

  .store-order-print-table tr {
    background: transparent;
    border: 0;
    border-radius: 0;
    display: table-row !important;
    margin: 0;
    padding: 0;
  }

  .store-order-print-table th,
  .store-order-print-table td {
    display: table-cell !important;
    width: auto;
  }

  .store-order-print-table td::before {
    display: none !important;
  }

  .panel {
    border: 0;
    box-shadow: none;
  }

  table {
    min-width: 0;
  }

  th,
  td {
    font-size: 11px;
    padding: 6px;
  }

  .store-order-print-table th,
  .store-order-print-table td {
    font-size: 9px;
    padding: 4px 5px;
  }

  .store-order-print-table td small {
    font-size: 8px;
  }
}

.store-weekly-specials-list { display: grid; gap: 22px; margin-top: 16px; }
.weekly-special-filters { display: grid; gap: 10px; grid-template-columns: minmax(260px, 1fr) minmax(300px, 430px); margin-top: 16px; }
.weekly-special-filters input, .weekly-special-filters select { min-width: 0; width: 100%; }
.weekly-special-filter-row { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) auto; }
.weekly-special-filter-row button { white-space: nowrap; }
.weekly-special-result-summary { margin: 10px 0 0; }
.store-special-supplier-group > h3 { border-bottom: 2px solid #0f766e; color: #0f5b4f; margin: 0 0 12px; padding-bottom: 8px; }
.store-special-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.store-special-card { background: linear-gradient(135deg, #fff 70%, #fff7ed); border: 1px solid #fed7aa; border-radius: 14px; display: grid; gap: 14px; grid-template-columns: 110px minmax(0, 1fr); padding: 14px; }
.store-special-card.upcoming { background: #f8fafc; border-color: #cbd5e1; }
.store-special-card > img { border-radius: 10px; height: 105px; object-fit: contain; width: 105px; }
.store-special-card-head { align-items: flex-start; display: flex; gap: 8px; justify-content: space-between; }
.store-special-price-row { align-items: center; display: flex; flex-wrap: wrap; gap: 9px; margin: 8px 0; }
.store-special-price-row > strong { color: #c2410c; font-size: 25px; }
.store-special-price-row del { color: #7b8794; }
.store-special-price-row b { background: #c2410c; border-radius: 999px; color: #fff; padding: 5px 9px; }
.store-special-minimum { font-weight: 800; margin: 5px 0; }
.special-countdown, .product-expiry-alert { border-radius: 6px; display: inline-block; font-size: 12px; padding: 5px 8px; }
.special-countdown { background: #e8f4ff; color: #175cd3; }
.special-countdown.warning, .product-expiry-alert.warning { background: #fff4ce; color: #854d0e; }
.special-countdown.urgent, .product-expiry-alert.urgent, .product-expiry-alert.expired { background: #fee2e2; color: #b42318; }
.product-expiry-alert { background: #edfdf3; color: #067647; margin-top: 5px; }
.product-card-special { background: #fff7ed; border: 2px solid #fb923c; border-radius: 9px; margin: 8px 0; padding: 8px 10px; }
.product-card-special > div { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }
.product-card-special > div > strong { color: #c2410c; font-size: 18px; }
.product-card-special > div > b { background: #c2410c; border-radius: 999px; color: #fff; font-size: 12px; padding: 4px 8px; }
.product-card-special p { margin: 6px 0 0; }
.product-card-special .special-tier-note { color: #9a3412; font-size: 14px; font-weight: 800; }
.product-card-special.expired { background: #fff1f2; border-color: #dc2626; }
.special-free-preview { color: #067647; display: block; font-weight: 800; }
.expired-order-block { background: #b42318; border-radius: 5px; color: #fff; display: inline-block; margin-top: 7px; padding: 5px 8px; }
@media (max-width: 560px) {
  .weekly-special-filters { grid-template-columns: 1fr; }
  .weekly-special-filter-row { grid-template-columns: minmax(0, 1fr) auto; }
  .store-special-grid { grid-template-columns: 1fr; }
  .store-special-card { grid-template-columns: 80px minmax(0, 1fr); }
  .store-special-card > img { height: 76px; width: 76px; }
}

@media (max-width: 1180px), (min-width: 768px) and (max-width: 1366px) and (orientation: landscape) and (hover: none) and (pointer: coarse) {
  html.store-launcher-open,
  body.store-launcher-open { height: 100%; max-height: 100%; overflow: hidden; overscroll-behavior: none; }
  body.store-launcher-open { inset: 0; position: fixed; touch-action: none; width: 100%; }
  body.store-launcher-open .portal { height: 100dvh; max-width: 1080px; overflow: hidden; padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  body.store-launcher-open .store-launcher { display: grid; gap: clamp(8px, 1.5dvh, 18px); grid-template-rows: auto minmax(0, 1fr); height: 100%; min-height: 0; }
  body.store-launcher-open .store-launcher-header { gap: 10px; padding: 2px 4px clamp(7px, 1.4dvh, 16px); }
  body.store-launcher-open .store-launcher-grid { grid-auto-rows: minmax(0, 1fr); grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(5, minmax(0, 1fr)); min-height: 0; }
  body.store-launcher-open .store-launcher:not(.manager-launcher) .store-launcher-grid { grid-template-rows: repeat(4, minmax(0, 1fr)); }
  body.store-launcher-open .store-launcher-card { gap: clamp(2px, 0.7dvh, 7px); min-height: 0; overflow: hidden; padding: clamp(7px, 1.5dvh, 18px); }
  body.store-launcher-open .store-launcher-icon { font-size: clamp(16px, 2.6dvh, 24px); height: clamp(28px, 4.6dvh, 46px); width: clamp(28px, 4.6dvh, 46px); }
  body.store-launcher-open .store-launcher-card strong { font-size: clamp(13px, 2.1dvh, 20px); }
  body.store-launcher-open .store-launcher-card small { font-size: clamp(9px, 1.35dvh, 13px); line-height: 1.2; }
  .store-launcher-top-logout { background: #fee2e2; border: 0; color: var(--red); display: inline-flex; flex: 0 0 auto; font-size: 12px; font-weight: 700; min-height: 34px; padding: 5px 9px; }
}

@media (max-height: 720px) and (max-width: 599px) {
  body.store-launcher-open .store-launcher-header .eyebrow,
  body.store-launcher-open #store-launcher-manager-name,
  body.store-launcher-open .store-launcher-card small,
  body.store-launcher-open .launcher-language-control span { display: none; }
  body.store-launcher-open .store-launcher-header h2 { font-size: 20px; margin: 0; }
  body.store-launcher-open .launcher-language-control { min-width: 104px; }
  body.store-launcher-open .launcher-language-control select { min-height: 34px; padding: 4px 6px; }
}

@media (max-width: 1180px), (min-width: 768px) and (max-width: 1366px) and (orientation: landscape) and (hover: none) and (pointer: coarse) {
  .store-launcher-header { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 16px; box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06); padding: clamp(8px, 1.4dvh, 14px); }
  .store-launcher-header > div:first-child { flex: 1 1 auto; min-width: 0; overflow: hidden; }
  .store-launcher-header .eyebrow,
  .store-launcher-header h2,
  .store-launcher-header #store-launcher-manager-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .store-launcher-header h2 { font-size: 18px; margin: 2px 0; }
  .store-launcher-header .eyebrow { font-size: 10px; margin: 0; }
  .store-launcher-header #store-launcher-manager-name { font-size: 11px; margin: 2px 0 0; }
  .launcher-header-actions { align-items: center; background: #f4f6f9; border: 1px solid #e2e8f0; border-radius: 12px; display: flex; flex: 0 0 auto; gap: 4px; padding: 3px; }
  .store-launcher-header .launcher-language-toggle { background: transparent; border: 0; border-radius: 9px; color: #1d4ed8; font-size: 13px; font-weight: 800; min-height: 34px; padding: 5px 10px; width: 82px; }
  .store-launcher-header .store-launcher-top-logout { background: #ffffff; border: 0; border-radius: 9px; color: #b42318; font-size: 12px; min-height: 34px; padding: 5px 9px; }
}

@media (max-width: 420px) {
  .store-launcher-header { gap: 7px; }
  .store-launcher-header h2 { font-size: 16px; }
  .store-launcher-header .launcher-language-toggle { font-size: 12px; width: 68px; }
  .launcher-layout-edit,
  .launcher-layout-reset { font-size: 11px; padding-inline: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  .store-launcher.is-arranging .store-launcher-card:not(.hidden) { animation: none; }
}

.store-settings-grid { display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.store-settings-card { align-content: start; background: #ffffff; border: 1px solid #e7ebf0; border-radius: 18px; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07); color: var(--ink); display: grid; gap: 8px; min-height: 132px; padding: 18px; text-align: left; }
.store-settings-card strong { font-size: 17px; }
.store-settings-card small { color: var(--muted); line-height: 1.4; }
.store-settings-card.store-settings-logout { background: #fff7f7; border-color: #fecaca; color: #b42318; }
.inactive-product-card { background: #f8fafc; border-color: #cbd5e1; }
.inactive-product-card > img { filter: saturate(.75); }
.inactive-product-heading { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }
.relist-request-button { margin-top: 10px; min-height: 44px; }

@media (max-width: 1180px) {
  .store-settings-view > .panel { background: transparent; border: 0; box-shadow: none; padding: 0; }
  .store-settings-view .section-heading { margin-bottom: 12px; }
  .store-settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .store-settings-card { min-height: 132px; }
}

@media (min-width: 768px) and (max-width: 1180px) {
  .store-settings-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Larger Start Ordering images; retain quantity and total controls on the right. */
@media (min-width: 768px) and (max-width: 1180px), (min-width: 768px) and (max-width: 1366px) and (hover: none) and (pointer: coarse) {
  #product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #product-grid > .product-card {
    grid-template-columns: minmax(0, 1fr) minmax(176px, 1.1fr);
    gap: 10px;
  }
  #product-grid > .product-card > img {
    width: 100%;
    height: 100%;
    min-height: 176px;
    max-height: 280px;
    object-fit: contain;
    background: #fff;
    align-self: center;
  }
}
@media (max-width: 767px) {
  #product-grid > .product-card {
    grid-template-columns: minmax(0, 144px) minmax(160px, 1fr);
    gap: 8px;
    padding: 10px;
  }
  #product-grid > .product-card > img {
    width: 100%;
    height: 100%;
    min-height: 156px;
    max-height: 240px;
    object-fit: contain;
    background: #fff;
    align-self: center;
  }
  #product-grid .product-order-actions {
    grid-template-columns: 44px minmax(48px, 1fr) 44px;
    width: 100%;
  }
}

/* Compact, removable filters and clearer ordering cards (store list only). */
#order-view .product-filter-bar { display: flex; align-items: flex-start; gap: 8px; margin: 4px 0 14px; }
#order-view .active-filter-summary { background: transparent; border: 0; padding: 0; margin: 0; flex: 1; min-width: 0; }
#order-view .active-filter-summary:not(.hidden) { display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: 6px; }
#order-view .product-filter-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 40px; padding: 6px 10px; border: 1px solid #d8e4f5; border-radius: 10px; background: #edf4ff; color: #234b80; font-size: 13px; font-weight: 600; box-shadow: none; }
#order-view .product-filter-chip > span:first-child { white-space: normal; overflow-wrap: anywhere; text-align: left; }
#order-view .product-filter-chip .filter-chip-remove { flex: 0 0 18px; font-size: 20px; color: #5c7594; }
#order-view #clear-product-filter-button { flex: 0 0 auto; width: auto; min-height: 40px; padding: 6px 10px; margin-left: auto; border-color: transparent; background: transparent; box-shadow: none; color: #64748b; font-size: 13px; }
#order-view .product-filter-chip:focus-visible, #order-view #clear-product-filter-button:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
#product-grid > .product-card { border-radius: 16px; border-color: #dde4ed; box-shadow: 0 3px 12px rgb(15 23 42 / 3%); align-content: start; }
#product-grid > .product-card.in-cart { border-color: #8fb6ef; }
#product-grid .product-card-content { padding-right: 0; }
#product-grid .product-card-name { display: block; padding-right: 28px; font-size: 17px; line-height: 1.45; color: #172337; overflow-wrap: anywhere; }
#product-grid .product-english-name { font-size: 12px; line-height: 1.4; color: #7a8698; margin: 4px 0 8px; }
#product-grid .product-selected-variant { color: #526278; font-size: 13px; line-height: 1.5; margin: 6px 0; }
#product-grid .product-primary-price { margin: 6px 0 10px; }
#product-grid .product-primary-price .store-price { font-size: 19px; font-weight: 800; color: #172337; }
#product-grid .product-more-info { border-top: 1px solid #eef1f6; margin-top: 8px; padding-top: 6px; }
#product-grid .product-more-info > summary { min-height: 36px; line-height: 36px; font-size: 13px; color: #47678e; }
#product-grid .product-more-info .meta { line-height: 1.55; overflow-wrap: anywhere; }
#product-grid .product-line-total { background: #f3f7fa; border-color: #e5edf3; border-radius: 9px; }
@media (max-width: 767px) {
  #order-view .product-filter-bar { gap: 4px; }
  #order-view .product-filter-chip { font-size: 12px; }
  #product-grid .product-card-name { font-size: 16px; padding-right: 0; }
  #product-grid .product-primary-price .store-price { font-size: 18px; }
  #product-grid > .product-card:has(.previous-order-count) .product-card-name { padding-right: 28px; }
}

/* Category levels remain visible as a single row on iPad. */
#order-view .toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#order-view .product-search-row, #order-view .store-category-cascade { grid-column: 1 / -1; }
.store-category-cascade { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; min-width: 0; }
.store-category-cascade label { display: grid; gap: 5px; min-width: 0; font-size: 13px; color: #475569; }
.store-category-cascade select { width: 100%; min-width: 0; min-height: 44px; }
@media (max-width: 560px) {
  .product-search-row { grid-template-columns: minmax(0, 1fr) auto; }
  .product-search-row > input { grid-column: auto; }
  .barcode-scan-button, .screen-keyboard-toggle { min-width: 0; width: 100%; }
  .product-screen-keyboard-keys { gap: 4px; grid-template-columns: repeat(8, minmax(28px, 1fr)); }
  .product-screen-keyboard-keys button { font-size: 13px; min-height: 40px; }
  .product-screen-keyboard-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .store-category-cascade { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .store-category-cascade label { gap: 4px; font-size: 12px; }
  #order-view .store-category-cascade select {
    min-width: 0;
    min-height: 44px;
    padding: 8px 20px 8px 6px;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
  }
}

/* Compact, consistent navigation icons without changing button text bindings. */
body:has(#order-view.active) .tabs, body:has(#order-view.active) .tabs.manager-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
body:has(#order-view.active) .tabs .tab::before { content: ""; display: inline-block; width: 20px; height: 20px; margin-right: 7px; vertical-align: middle; background: currentColor; -webkit-mask: var(--order-tab-icon) center / contain no-repeat; mask: var(--order-tab-icon) center / contain no-repeat; }
body:has(#order-view.active) .tab[data-store-view="home"] { --order-tab-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%2010%2012%203l9%207M5%209v12h5v-7h4v7h5V9%22%2F%3E%3C%2Fsvg%3E"); }
body:has(#order-view.active) .tab[data-store-view="order"] { --order-tab-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%203h2l3%2012h11l2-9H6M9%2020h.01M18%2020h.01%22%2F%3E%3C%2Fsvg%3E"); }
body:has(#order-view.active) .tab[data-store-view="new-arrivals"] { --order-tab-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m3%207%209-4%209%204v10l-9%204-9-4V7m0%200%209%204%209-4M12%2011v10%22%2F%3E%3C%2Fsvg%3E"); }
body:has(#order-view.active) .tab[data-store-view="weekly-specials"] { --order-tab-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%203h9l9%209-9%209-9-9V3m5%205h.01%22%2F%3E%3C%2Fsvg%3E"); }
body:has(#order-view.active) .tab[data-store-view="cart"] { --order-tab-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%203h2l3%2012h11l2-9H6M9%2020h.01M18%2020h.01%22%2F%3E%3C%2Fsvg%3E"); }
@media (max-width: 767px) { body:has(#order-view.active) .tabs .tab::before { display: block; margin: 0 auto 4px; width: 18px; height: 18px; } body:has(#order-view.active) .tabs .tab { font-size: 11px; min-height: 56px; } }

/* Ordering preview approved October 2026. Scoped to this view: other portal
   screens, cart behavior, display permissions and native safe areas stay intact. */
body:has(#order-view.active) .portal-header { margin-bottom: 8px; }
body:has(#order-view.active) .tabs { gap: 4px; background: var(--bg); padding: 4px 0 8px; }
body:has(#order-view.active) .tabs .tab {
  border: 1px solid transparent; border-radius: 10px; background: transparent;
  color: #526078; box-shadow: none; min-height: 48px; font-weight: 600;
}
body:has(#order-view.active) .tabs .tab.active { background: #e8f1ff; color: #1764e8; border-color: #dbe9ff; }
#order-view input, #order-view select, #order-view .supplier-picker-toggle {
  border-color: #dce4ee; border-radius: 10px; background-color: #fff; color: #24344c;
}
#order-view .product-search-row { gap: 8px; }
#order-view #product-search { background: #fff; border: 1px solid #dce4ee; min-height: 44px; }
#order-view #search-input-picker-toggle { min-height: 44px; border-color: #dce4ee; background: #fff; box-shadow: none; }
#order-view .toolbar { gap: 10px; margin-bottom: 8px; }
#order-view .product-filter-chip { border: 0; border-radius: 999px; background: #eaf2ff; color: #1764e8; }
#order-view #clear-product-filter-button { color: #1764e8; }
#product-grid { gap: 14px; align-items: start; }
#product-grid > .product-card {
  padding: 14px; gap: 8px 12px; border-radius: 12px; background: #fff;
  box-shadow: 0 2px 8px rgb(15 23 42 / 2%);
}
#product-grid > .product-card.in-cart { border-color: #3983ff; background: #fff; box-shadow: 0 0 0 1px rgb(57 131 255 / 8%); }
#product-grid .product-card-content { min-width: 0; }
#product-grid .product-card-name { line-height: 1.4; }
#product-grid .product-more-info { border: 0; margin: 0; padding: 0; }
#product-grid .product-more-info > summary { color: #1764e8; min-height: 36px; }
#product-grid .product-order-actions { gap: 0; align-items: center; align-self: end; }
#product-grid .quantity-step-button, #product-grid .quantity-input {
  height: 44px; min-height: 44px; border: 1px solid #dce4ee;
  border-radius: 0; box-shadow: none; background: #fff; color: #24344c;
}
#product-grid .quantity-step-button { background: #f4f7fb; color: #1764e8; font-size: 20px; }
#product-grid [data-dec] { border-radius: 9px 0 0 9px; }
#product-grid [data-inc] { border-radius: 0 9px 9px 0; }
#product-grid .quantity-input { border-left: 0; border-right: 0; font-size: 16px; }
#product-grid .quantity-step-button:disabled { color: #a5afbe; opacity: 1; }
#product-grid .quantity-step-button:not(:disabled):active { background: #e2edff; transform: none; }
#product-grid .product-line-total { margin-top: 8px; border: 0; background: #f7f9fc; padding: 7px 9px; }
#product-grid .product-line-total strong { color: #172337; }
#product-grid .upc-supplement-button {
  min-height: 40px; padding: 6px 10px; margin-top: 4px; border: 1px solid #dce4ee;
  border-radius: 8px; background: #f7faff; color: #2461aa; box-shadow: none;
  font-size: 12px; text-shadow: none; transform: none;
}
#product-grid .upc-supplement-button::before, #product-grid .upc-supplement-button::after { display: none; }
#order-view { padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }
body:has(#order-view.active) .floating-cart-bar { bottom: calc(6px + env(safe-area-inset-bottom, 0px)); gap: 10px; max-width: 400px; }
body:has(#order-view.active) .floating-order-amount { min-height: 48px; padding: 10px 16px; font-size: 13px; box-shadow: 0 4px 14px #11182720; }
body:has(#order-view.active) .floating-order-amount strong { font-size: 18px; }
body:has(#order-view.active) .floating-order-button { width: 60px; height: 60px; min-height: 60px; flex: 0 0 60px; font-size: 17px; box-shadow: 0 4px 14px #15803d25; }
body:has(#order-view.active) .floating-order-count { min-width: 24px; height: 24px; font-size: 12px; padding: 0 5px; border-width: 2px; top: -4px; right: -2px; }
.scanned-invoice-upload-panel { max-width: 900px; margin-inline: auto; }
.scanned-invoice-form { display: grid; gap: 14px; }
.invoice-file-drop { display: grid; justify-items: center; gap: 8px; padding: 28px 18px; border: 2px dashed #9fb7d1; border-radius: 16px; background: #f7fbff; text-align: center; cursor: pointer; }
.invoice-file-drop:hover { border-color: var(--primary); background: #f0fdfa; }
.invoice-file-drop input { width: min(100%, 420px); margin-top: 8px; }
.invoice-file-icon { font-size: 36px; }
.scanned-invoice-list { display: grid; gap: 12px; }
.scanned-invoice-card { padding: 16px; border: 1px solid #dbe4ee; border-radius: 14px; background: #fff; }
.scanned-invoice-card.reupload_requested { border-color: #fca5a5; background: #fffafa; }
.scanned-invoice-card-head, .scanned-invoice-file-actions { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.scanned-invoice-file-actions { justify-content: flex-start; margin-top: 10px; }
.scanned-invoice-file-link { display: inline-flex; text-decoration: none; }
.scanned-invoice-reupload { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; cursor: pointer; }
.scanned-invoice-reupload input { max-width: 240px; }
.scanned-invoice-draft-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.scanned-invoice-page-list { display: grid; gap: 8px; }
.scanned-invoice-page-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid #dbe4ee; border-radius: 11px; background: #f8fafc; }
.scanned-invoice-page-item > span { display: grid; min-width: 0; gap: 2px; }
.scanned-invoice-page-item small { overflow: hidden; color: #64748b; text-overflow: ellipsis; white-space: nowrap; }
.scanned-invoice-page-item button { flex: 0 0 auto; min-height: 36px; padding: 6px 11px; }
.windows-scanner-setup { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 22px; padding: 18px; border: 1px solid #cbdce9; border-radius: 14px; background: #f8fbfd; }
.windows-scanner-setup h3 { margin: 0 0 6px; }
.windows-scanner-setup p { margin: 0; }
.windows-scanner-setup button { flex: 0 0 auto; }
@media (min-width: 768px) and (max-width: 1366px) {
  /* iPad portrait and landscape share the phone's measured sticky stack. */
  html:has(#order-view.active), body:has(#order-view.active) { overflow-x: clip; }
  body:has(#order-view.active)::before {
    content: ''; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
    background: var(--bg); pointer-events: none; z-index: 9;
  }
  body:has(#order-view.active) #portal-view > .tabs {
    position: sticky; top: env(safe-area-inset-top, 0px); z-index: 7;
    border-radius: 0; background: var(--bg); box-shadow: 18px 0 var(--bg), -18px 0 var(--bg);
  }
  #order-view > .product-search-row {
    position: sticky; top: calc(var(--store-mobile-tabs-height, 60px) + env(safe-area-inset-top, 0px));
    z-index: 6; background: var(--bg); padding-bottom: 8px;
    box-shadow: 18px 0 var(--bg), -18px 0 var(--bg);
  }
  #product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #product-grid > .product-card { grid-template-columns: minmax(0, .9fr) minmax(160px, 1.1fr); }
  #product-grid > .product-card > img { width: 100%; height: 100%; min-height: 170px; max-height: 250px; grid-row: 1 / span 2; object-fit: contain; align-self: center; }
  #product-grid .product-order-actions { grid-column: 2; grid-template-columns: 44px minmax(48px, 1fr) 44px; width: 100%; }
  body:has(#order-view.active) .floating-cart-bar { left: auto; right: 16px; transform: none; }
}
@media (min-width: 1024px) {
  #order-view .toolbar { grid-template-columns: minmax(150px, 1fr) minmax(180px, 1fr) minmax(0, 2fr); align-items: end; }
  #order-view .store-category-cascade { grid-column: auto; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
}
@media (max-width: 767px) {
  #invoice-upload-view { padding-inline: 0; }
  .invoice-file-drop { padding: 22px 12px; }
  .scanned-invoice-card { padding: 13px; }
  .windows-scanner-setup { align-items: stretch; flex-direction: column; padding: 14px; }
  #product-grid > .product-card { padding: 10px; grid-template-columns: minmax(0, .85fr) minmax(156px, 1fr); gap: 6px 10px; }
  #product-grid > .product-card > img { min-height: 154px; max-height: 240px; }
  #product-grid .product-order-actions { grid-template-columns: 44px minmax(48px, 1fr) 44px; }
  #product-grid .product-primary-price { margin: 4px 0; }
  #product-grid .product-english-name { margin: 3px 0; }
  body:has(#order-view.active) .floating-cart-bar { max-width: none; }
  body:has(#order-view.active) .floating-order-amount span { font-size: 12px; }
}


/* Supplier selection in store cart */
.cart-supplier-selection { display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin-bottom:16px; }
.cart-supplier-selection > .meta { flex-basis:100%; margin:0; }
.cart-supplier-check { display:flex; flex-direction:row; align-items:center; gap:10px; margin:0; cursor:pointer; }
.cart-supplier-check input[type="checkbox"] { width:22px; height:22px; min-width:22px; margin:0; accent-color:#2563eb; }
.cart-supplier-group { display:grid; gap:12px; min-width:0; padding-bottom:12px; }
.cart-supplier-header { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px; padding:14px; border-radius:12px; background:#eef4ff; border:1px solid #cbdcfb; }
.cart-supplier-header strong { overflow-wrap:anywhere; }
@media(max-width:600px) { .cart-supplier-header { align-items:flex-start; flex-direction:column; } }
