:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe3ea;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --danger: #b91c1c;
  --soft: #e8f5f3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.shell {
  width: min(1760px, calc(100% - 16px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.admin-shell {
  width: calc(100% - 4px);
  max-width: none;
  padding-top: 10px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 420px);
  align-items: center;
  gap: 72px;
}

.brand h1,
.topbar h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: 0;
}

.brand p,
.topbar p,
.muted {
  color: var(--muted);
}

.panel,
.card,
.auth-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.auth-panel {
  padding: 28px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  font-weight: 700;
}

.toolbar .field {
  margin-bottom: 0;
}

.field span {
  color: #334155;
}

.inline-field {
  flex: 1;
}

.field small {
  color: var(--muted);
  font-weight: 400;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 9px 11px;
  background: #fff;
}

textarea {
  min-height: 72px;
  resize: vertical;
}

.password-row,
.inline-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.password-row input {
  flex: 1;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 16px;
  color: #475569;
  font-size: 14px;
  font-weight: 700;
}

.remember-row input {
  width: 16px;
  height: 16px;
  min-height: auto;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #eef2f6;
  padding: 6px;
  border-radius: 7px;
  margin-bottom: 18px;
}

.tab {
  border: 0;
  background: transparent;
  border-radius: 5px;
  min-height: 40px;
  font-weight: 700;
}

.tab.active {
  background: #fff;
  box-shadow: 0 1px 8px rgba(15, 23, 42, 0.08);
}

.primary,
.secondary,
.ghost,
.danger,
.link-button {
  border: 0;
  border-radius: 6px;
  min-height: 40px;
  padding: 0 16px;
  font-weight: 700;
}

.link-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.primary {
  background: var(--brand);
  color: #fff;
}

.primary:hover {
  background: var(--brand-dark);
}

.secondary {
  background: var(--soft);
  color: var(--brand-dark);
}

.ghost {
  background: #eef2f6;
  color: var(--text);
}

.danger {
  background: #fee2e2;
  color: var(--danger);
}

.full-width {
  width: 100%;
  margin-top: 10px;
}

.status {
  min-height: 20px;
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding-bottom: 22px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.admin-layout {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.admin-nav {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.admin-nav-item {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  text-align: left;
  padding: 0 12px;
  font-weight: 700;
}

.admin-nav-item:hover,
.admin-nav-item.active {
  background: var(--soft);
  color: var(--brand-dark);
}

.admin-content {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.admin-page {
  display: grid;
  gap: 18px;
}

.page-heading {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
}

.page-heading h2 {
  margin: 0 0 6px;
}

.page-heading p {
  margin: 0;
  color: var(--muted);
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 14px;
}

.overview-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.overview-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.overview-card strong {
  display: block;
  font-size: 28px;
  color: var(--brand-dark);
}

.compact-card {
  padding-bottom: 6px;
}

.import-grid {
  display: grid;
  gap: 16px;
}

.import-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid #e6edf3;
  border-radius: 8px;
  background: #fbfdff;
}

.import-panel h3 {
  margin: 0 0 8px;
}

.import-panel .status {
  grid-column: 1 / -1;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}

.span-3 {
  grid-column: span 3;
}

.span-4 {
  grid-column: span 4;
}

.span-6 {
  grid-column: span 6;
}

.span-8 {
  grid-column: span 8;
}

.span-12 {
  grid-column: span 12;
}

.card {
  padding: 20px;
}

.orders-card {
  min-width: 1720px;
}

.price-level-editor {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.price-level-head,
.price-level-row {
  display: grid;
  grid-template-columns: 90px repeat(3, minmax(110px, 1fr));
  gap: 8px;
  align-items: center;
}

.price-level-head {
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.price-level-row strong {
  color: var(--brand-dark);
}

.level-select {
  min-width: 78px;
}

.history-list {
  display: grid;
  gap: 10px;
  max-height: 58vh;
  overflow: auto;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfdfe;
  white-space: normal;
}

.history-item strong {
  display: block;
  margin-bottom: 4px;
}

.history-item pre {
  margin: 8px 0 0;
  padding: 8px;
  background: #f1f5f9;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
}

.card h2,
.card h3 {
  margin: 0 0 14px;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

.address-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 720px) {
  .address-grid {
    grid-template-columns: 1fr;
  }
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.table-wrap {
  overflow-x: auto;
}

.inline-link-button {
  margin-top: 6px;
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  font-weight: 700;
  padding: 0;
  min-height: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #e6edf3;
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.order-products-cell {
  min-width: 430px;
  white-space: normal;
}

.order-action-cell {
  min-width: 210px;
}

.actual-quantity-input {
  width: 88px;
}

.order-action-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: 200px;
}

.order-action-controls select,
.order-action-controls input,
.order-action-controls button {
  width: 100%;
}

.order-row-expanded > td {
  border-bottom-color: transparent;
  background: #fcfefe;
}

.order-split-detail-row > td {
  padding: 0 10px 16px;
  background: #fcfefe;
}

.inline-split-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
  padding: 12px;
}

.inline-split-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.inline-split-table th,
.inline-split-table td {
  background: #fff;
}

.inline-split-table input,
.inline-split-table select {
  min-width: 130px;
}

.order-products {
  display: grid;
  gap: 8px;
}

.order-product-line {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e6edf3;
  border-radius: 6px;
}

.order-product-main {
  display: grid;
  gap: 3px;
  white-space: normal;
}

.order-product-main strong {
  font-size: 15px;
}

.order-product-main span {
  color: var(--muted);
  font-size: 13px;
}

.order-product-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #475569;
  font-size: 13px;
  white-space: nowrap;
}

.order-qty {
  color: var(--brand-dark);
  font-size: 20px;
  font-weight: 800;
}

th {
  color: #334155;
  font-weight: 700;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px;
}

.balance-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.balance-box {
  background: var(--soft);
  border-radius: 8px;
  padding: 16px;
}

.balance-box strong {
  display: block;
  margin-top: 8px;
  color: var(--brand-dark);
  font-size: 24px;
}

.product-list,
.cart-list,
.order-list,
.log-list {
  display: grid;
  gap: 12px;
}

.product-item,
.cart-item,
.order-item,
.log-item {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid #e6edf3;
  border-radius: 8px;
}

.cart-item,
.order-item,
.log-item {
  grid-template-columns: 1fr auto;
}

.thumb {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #eef2f6;
}

.image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.image-list img {
  width: 46px;
  height: 38px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.customer-price-tiers {
  display: grid;
  gap: 6px;
  min-width: 160px;
}

.customer-price-tiers div {
  display: grid;
  grid-template-columns: 46px auto;
  column-gap: 8px;
  align-items: baseline;
  padding: 6px 8px;
  border: 1px solid #dcebe8;
  border-radius: 6px;
  background: #f6fbfa;
}

.customer-price-tiers span,
.customer-price-tiers small {
  color: var(--muted);
  font-size: 12px;
}

.customer-price-tiers strong {
  color: var(--teal);
  font-size: 16px;
}

.customer-price-tiers small {
  grid-column: 2;
}

.image-manager {
  grid-column: span 2;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.image-manager-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.image-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.image-toolbar button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.managed-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
  min-height: 72px;
}

.managed-image {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.managed-image.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.16);
}

.managed-image img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #eef2f6;
}

.main-image-badge {
  position: absolute;
  left: 6px;
  top: 6px;
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--brand-dark);
  background: rgba(232, 245, 243, 0.95);
  font-weight: 700;
  font-size: 12px;
}

.image-order-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  border-radius: 999px;
  padding: 2px 7px;
  color: #fff;
  background: rgba(15, 23, 42, 0.72);
  font-size: 12px;
}

.manual-image-entry {
  margin-top: 10px;
}

.manual-image-entry summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-weight: 700;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.actions input {
  width: 110px;
}

.cart-quantity-actions {
  flex-wrap: nowrap;
}

.cart-quantity-actions button {
  flex: 0 0 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
}

.cart-quantity-input {
  flex: 0 0 92px;
  width: 92px;
  height: 42px;
  text-align: center;
  font-weight: 800;
}

.cart-quantity-actions .cart-delete-button {
  flex: 0 0 auto;
  min-width: 64px;
  height: 42px;
  padding: 0 12px;
}

.actions .wide {
  width: 220px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 460px;
  background: #111827;
  color: #fff;
  padding: 14px 18px;
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  z-index: 20;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.55);
  z-index: 15;
  padding: 20px;
}

.modal-panel {
  width: min(920px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  padding: 18px;
}

.order-modal-panel {
  width: min(1180px, 100%);
}

.split-modal-panel {
  width: min(1320px, 100%);
}

.split-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.split-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.split-summary span,
.split-summary strong {
  display: block;
}

.split-summary span {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.split-summary strong {
  color: var(--ink);
  font-size: 20px;
}

.split-block {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}

.split-rows {
  display: grid;
  gap: 10px;
}

.split-row {
  display: grid;
  grid-template-columns: 120px minmax(160px, 1fr) minmax(180px, 1fr) minmax(220px, 1.2fr) 90px;
  gap: 10px;
  align-items: end;
}

.shipment-list,
.request-list {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

.dialog-panel {
  width: min(520px, 100%);
}

.dialog-message {
  color: var(--text);
  line-height: 1.7;
  white-space: pre-wrap;
}

.dialog-copy {
  margin: 12px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  white-space: pre-wrap;
  user-select: all;
}

.order-edit-head,
.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 18px 0 12px;
}

.form-actions {
  justify-content: flex-end;
}

.order-edit-table input {
  min-width: 110px;
}

.order-edit-table td:nth-child(1) input {
  min-width: 150px;
}

.order-edit-table td:nth-child(2) input {
  min-width: 220px;
}

.modal-panel img {
  max-width: 100%;
}

.product-detail-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.product-detail-images a {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

.product-detail-images img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.positive {
  color: #047857;
  font-weight: 700;
}

.negative {
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
    gap: 24px;
    align-content: center;
  }

  .grid,
  .toolbar,
  .balance-row {
    grid-template-columns: 1fr;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-nav {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .span-3,
  .span-4,
  .span-6,
  .span-8,
  .span-12 {
    grid-column: auto;
  }

  .product-item {
    grid-template-columns: 80px 1fr;
  }

  .product-item > :last-child {
    grid-column: 1 / -1;
  }
}

/* Refined interface layer */
:root {
  --bg: #f4f7f8;
  --panel: #ffffff;
  --text: #101828;
  --ink: #101828;
  --muted: #667085;
  --line: #d8e2ea;
  --line-soft: #e8eef3;
  --brand: #147f74;
  --brand-dark: #0b5f58;
  --teal: #147f74;
  --soft: #e7f4f1;
  --soft-strong: #d4ece7;
  --danger: #b42318;
  --warning: #a16207;
  --accent: #305f72;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 10px 28px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 22px 60px rgba(16, 24, 40, 0.16);
}

html {
  background: #eef3f5;
  -webkit-text-size-adjust: 100%;
}

body {
  background:
    linear-gradient(180deg, rgba(244, 247, 248, 0.96) 0%, rgba(238, 244, 244, 0.92) 100%),
    linear-gradient(90deg, rgba(20, 127, 116, 0.05), rgba(48, 95, 114, 0.035));
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

.shell {
  width: min(1680px, calc(100% - 48px));
  padding: 32px 0 64px;
}

.admin-shell {
  width: min(1920px, calc(100% - 36px));
}

.auth-shell {
  min-height: calc(100vh - 64px);
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 460px);
  gap: 96px;
}

.brand h1,
.topbar h1 {
  font-size: clamp(30px, 3vw, 44px);
  font-weight: 850;
  letter-spacing: 0;
}

.brand p,
.topbar p,
.muted,
.status {
  color: var(--muted);
}

.panel,
.card,
.auth-panel,
.page-heading,
.overview-card,
.admin-nav,
.modal-panel {
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.card,
.auth-panel,
.page-heading,
.overview-card,
.admin-nav {
  background: rgba(255, 255, 255, 0.96);
}

.auth-panel {
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.auth-panel::before,
.page-heading::before,
.card::before {
  content: "";
  display: block;
  height: 3px;
  margin: -1px -1px 18px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  opacity: 0;
}

.auth-panel::before,
.page-heading::before {
  opacity: 1;
}

.card::before {
  content: none;
  display: none;
}

.tabs {
  background: #eef3f6;
  border: 1px solid var(--line-soft);
  padding: 5px;
}

.tab {
  color: #475467;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.tab.active {
  color: var(--ink);
  box-shadow: 0 3px 14px rgba(16, 24, 40, 0.1);
}

.field {
  gap: 7px;
}

.field span,
th {
  color: #344054;
}

input,
select,
textarea {
  border-color: #c9d6df;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #aabac6;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 127, 116, 0.14);
}

input[type="file"] {
  padding: 6px;
}

input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  border: 0;
  border-radius: 5px;
  background: #eef3f6;
  color: #1d2939;
  font-weight: 700;
  padding: 0 12px;
}

button,
.link-button {
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

button:hover,
.link-button:hover {
  transform: translateY(-1px);
}

button:active,
.link-button:active {
  transform: translateY(0);
}

button:focus-visible,
.link-button:focus-visible {
  outline: 3px solid rgba(20, 127, 116, 0.24);
  outline-offset: 2px;
}

.primary {
  background: linear-gradient(180deg, #16897d, #0f766e);
  box-shadow: 0 7px 18px rgba(15, 118, 110, 0.18);
}

.primary:hover {
  background: linear-gradient(180deg, #147f74, #0b5f58);
}

.secondary {
  background: var(--soft);
  color: var(--brand-dark);
}

.secondary:hover {
  background: var(--soft-strong);
}

.ghost {
  background: #eef3f6;
  color: #263445;
}

.ghost:hover {
  background: #e2e9ef;
}

.danger {
  background: #fee4e2;
  color: var(--danger);
}

.danger:hover {
  background: #fecdca;
}

.topbar {
  border-bottom-color: var(--line);
}

#dashboardView > .topbar {
  padding: 0 0 22px;
}

.admin-layout {
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 18px;
}

.admin-nav {
  top: 20px;
  padding: 12px;
  gap: 8px;
}

.admin-nav-item {
  min-height: 46px;
  padding: 0 14px;
  color: #344054;
}

.admin-nav-item:hover,
.admin-nav-item.active {
  background: #e5f3f0;
  color: var(--brand-dark);
}

.page-heading {
  padding: 20px 22px;
}

.page-heading h2,
.card h2 {
  color: #101828;
  font-size: 22px;
}

.overview-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.overview-card {
  padding: 20px;
}

.overview-card strong {
  color: var(--brand-dark);
  font-size: 32px;
  line-height: 1.1;
}

.grid {
  gap: 20px;
}

.card {
  padding: 22px;
}

.compact-card {
  padding-bottom: 12px;
}

.toolbar {
  gap: 12px;
}

.import-panel,
.price-level-editor,
.image-manager,
.inline-split-panel,
.history-item,
.split-summary div {
  background: #fbfcfd;
  border-color: var(--line-soft);
}

.table-wrap {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
}

.table-wrap table {
  border-collapse: separate;
  border-spacing: 0;
}

th {
  background: #f7fafb;
  font-size: 13px;
  white-space: nowrap;
}

th,
td {
  border-bottom-color: var(--line-soft);
  padding: 13px 12px;
}

tbody tr:hover td {
  background: #fbfdfd;
}

.orders-card {
  min-width: 0;
}

.orders-card table {
  min-width: 1740px;
}

.order-products-cell {
  min-width: 520px;
}

.order-product-line {
  background: #f8fbfc;
  border-color: #dfe9ee;
  padding: 10px 12px;
}

.order-product-main strong {
  font-size: 16px;
}

.order-product-meta {
  color: #475467;
}

.order-qty {
  color: var(--brand-dark);
  font-size: 24px;
  letter-spacing: 0;
}

.order-action-controls {
  width: 220px;
}

.balance-row {
  grid-template-columns: minmax(240px, 360px);
}

.balance-box {
  background: linear-gradient(135deg, #e6f4f1 0%, #f5fbf9 100%);
  border: 1px solid #d3e9e4;
  box-shadow: var(--shadow-sm);
}

.balance-box span {
  color: #23615c;
  font-weight: 800;
}

.balance-box strong {
  color: var(--brand-dark);
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.05;
}

.product-list {
  gap: 14px;
}

.product-item,
.cart-item,
.order-item,
.log-item {
  border-color: var(--line-soft);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.product-item {
  grid-template-columns: 132px minmax(0, 1fr) minmax(180px, auto);
  align-items: stretch;
}

.product-item > div {
  min-width: 0;
}

.thumb {
  width: 132px;
  height: 100px;
  border-color: #d9e4ea;
  background: #eef3f6;
}

.image-list img {
  border-color: #d9e4ea;
}

.customer-price-tiers {
  min-width: 190px;
}

.customer-price-tiers div {
  border-color: #d2e8e4;
  background: #f5fbfa;
}

.customer-price-tiers strong {
  color: var(--brand-dark);
}

.cart-item,
.order-item,
.log-item {
  padding: 14px;
}

.managed-images {
  grid-template-columns: repeat(auto-fill, minmax(122px, 1fr));
  gap: 10px;
}

.managed-image {
  border-color: #dce6ed;
}

.managed-image.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 127, 116, 0.15);
}

.image-toolbar {
  gap: 8px;
}

.modal {
  background: rgba(16, 24, 40, 0.5);
  backdrop-filter: blur(3px);
}

.modal-panel {
  box-shadow: var(--shadow-lg);
}

.toast {
  background: #101828;
  box-shadow: var(--shadow-lg);
}

.dialog-copy {
  background: #f7fafb;
}

.positive {
  color: #067647;
}

.negative {
  color: #b42318;
}

@media (max-width: 1100px) {
  .shell,
  .admin-shell {
    width: min(100% - 28px, 1100px);
  }

  .auth-shell {
    gap: 36px;
  }

  .overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-item {
    grid-template-columns: 116px minmax(0, 1fr);
  }

  .product-item > :last-child {
    grid-column: 1 / -1;
  }

  .thumb {
    width: 116px;
    height: 88px;
  }
}

@media (max-width: 900px) {
  .shell,
  .admin-shell {
    width: calc(100% - 24px);
    padding: 20px 0 40px;
  }

  .auth-shell {
    min-height: calc(100vh - 40px);
  }

  .brand h1,
  .topbar h1 {
    font-size: 30px;
  }

  .admin-layout {
    gap: 14px;
  }

  .admin-nav {
    display: flex;
    overflow-x: auto;
    position: static;
  }

  .admin-nav-item {
    flex: 0 0 auto;
    min-width: 132px;
    text-align: center;
  }

  .card,
  .auth-panel,
  .page-heading {
    padding: 18px;
  }

  .orders-card table {
    min-width: 1280px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 13px;
  }

  .shell,
  .admin-shell {
    width: calc(100% - 16px);
    padding-top: 14px;
  }

  .auth-shell {
    align-content: start;
    gap: 18px;
  }

  .auth-panel {
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
  }

  #dashboardView > .topbar {
    flex-direction: row;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .topbar .ghost,
  .topbar .secondary {
    min-width: 70px;
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .product-item {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px;
  }

  .thumb {
    width: 88px;
    height: 72px;
  }

  .customer-price-tiers {
    min-width: 0;
  }

  .customer-price-tiers div {
    grid-template-columns: 58px auto;
  }

  .balance-row {
    grid-template-columns: 1fr;
  }

  .balance-box strong {
    font-size: 30px;
  }

  .cart-item,
  .order-item,
  .log-item {
    grid-template-columns: 1fr;
  }

  .actions {
    width: 100%;
  }

  .actions button,
  .actions .link-button,
  .actions select,
  .actions input {
    flex: 1 1 140px;
  }

  .modal {
    padding: 10px;
  }

  .modal-panel {
    max-height: 92vh;
    padding: 16px;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .form-actions button {
    width: 100%;
  }
}

/* Overflow hardening for desktop and mobile web */
*,
*::before,
*::after {
  min-width: 0;
}

.shell,
.admin-shell,
#dashboardView,
.admin-layout,
.admin-content,
.admin-page,
.grid,
.grid > *,
.card,
.panel,
.auth-panel,
.page-heading,
.overview-card,
.toolbar,
.table-wrap,
.modal-panel,
.orders-card,
.import-panel,
.price-level-editor,
.image-manager,
.inline-split-panel,
.product-item,
.cart-item,
.order-item,
.log-item {
  max-width: 100%;
  min-width: 0;
}

.admin-content,
.admin-page,
.card,
.orders-card {
  overflow: hidden;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  position: relative;
}

.table-wrap > table {
  width: max-content;
  min-width: 100%;
  max-width: none;
}

th,
td,
.muted,
.status,
.dialog-message,
.history-item,
.order-product-main,
.product-item,
.cart-item,
.order-item,
.log-item {
  overflow-wrap: anywhere;
  word-break: break-word;
}

td {
  white-space: normal;
}

.orders-card > .table-wrap > table {
  min-width: 1540px;
}

.orders-card th,
.orders-card td {
  white-space: normal;
}

.orders-card th:nth-child(1),
.orders-card td:nth-child(1) {
  min-width: 170px;
}

.orders-card th:nth-child(2),
.orders-card td:nth-child(2) {
  min-width: 120px;
}

.orders-card th:nth-child(3),
.orders-card td:nth-child(3) {
  min-width: 210px;
}

.orders-card th:nth-child(4),
.orders-card td:nth-child(4) {
  min-width: 420px;
}

.orders-card th:nth-child(8),
.orders-card td:nth-child(8) {
  min-width: 130px;
}

.orders-card th:nth-child(10),
.orders-card td:nth-child(10) {
  min-width: 132px;
}

.orders-card th:nth-child(12),
.orders-card td:nth-child(12) {
  min-width: 220px;
}

.order-products-cell {
  min-width: 360px;
  max-width: 520px;
}

.order-product-line {
  grid-template-columns: minmax(150px, 1fr) auto;
  max-width: 100%;
}

.order-product-meta {
  flex-wrap: wrap;
  justify-content: flex-end;
  white-space: normal;
}

.order-action-controls {
  width: min(220px, 100%);
}

.order-split-detail-row > td {
  position: sticky;
  left: 0;
  z-index: 2;
  max-width: calc(100vw - 72px);
  white-space: normal;
  background: #fcfefe;
}

.order-split-detail-row .inline-split-panel {
  width: min(100%, calc(100vw - 96px));
  max-width: 100%;
  overflow: hidden;
}

.inline-split-head {
  flex-wrap: wrap;
}

.inline-split-panel .table-wrap {
  max-width: 100%;
}

.inline-split-table {
  min-width: 1160px;
}

.inline-split-table th,
.inline-split-table td {
  white-space: normal;
}

.inline-split-table input,
.inline-split-table select {
  width: 100%;
  min-width: 0;
}

.inline-split-table th:nth-child(1),
.inline-split-table td:nth-child(1) {
  min-width: 180px;
}

.inline-split-table th:nth-child(2),
.inline-split-table td:nth-child(2) {
  min-width: 110px;
}

.inline-split-table th:nth-child(3),
.inline-split-table td:nth-child(3) {
  min-width: 130px;
}

.inline-split-table th:nth-child(4),
.inline-split-table td:nth-child(4),
.inline-split-table th:nth-child(5),
.inline-split-table td:nth-child(5),
.inline-split-table th:nth-child(7),
.inline-split-table td:nth-child(7) {
  min-width: 180px;
}

.inline-split-table th:nth-child(8),
.inline-split-table td:nth-child(8) {
  min-width: 190px;
}

.inline-split-table .actions {
  align-items: stretch;
}

.inline-split-table .actions button,
.inline-split-table .actions span {
  flex: 1 1 86px;
}

.product-item > div,
.cart-item > div,
.order-item > div,
.log-item > div {
  max-width: 100%;
}

.product-item strong,
.cart-item strong,
.order-item strong,
.log-item strong {
  overflow-wrap: anywhere;
}

.cart-quantity-actions {
  justify-content: flex-end;
}

.cart-quantity-actions .cart-quantity-input {
  flex: 0 0 92px;
  width: 92px;
}

.image-manager {
  grid-column: 1 / -1;
}

.managed-images {
  width: 100%;
}

.modal-panel {
  max-width: min(100%, 92vw);
  overflow-x: hidden;
}

.modal-panel .table-wrap {
  overflow-x: auto;
}

.order-edit-table {
  min-width: 840px;
}

.split-row {
  grid-template-columns: minmax(80px, 120px) minmax(130px, 1fr) minmax(150px, 1fr) minmax(160px, 1.2fr) minmax(76px, 90px);
}

@media (max-width: 900px) {
  .admin-content,
  .admin-page,
  .card,
  .orders-card {
    overflow: visible;
  }

  .orders-card > .table-wrap > table {
    min-width: 1120px;
  }

  .order-split-detail-row > td {
    max-width: calc(100vw - 40px);
  }

  .order-split-detail-row .inline-split-panel {
    width: min(100%, calc(100vw - 48px));
  }

  .inline-split-table {
    min-width: 920px;
  }

  .split-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .admin-content,
  .admin-page,
  .card,
  .orders-card {
    overflow: visible;
  }

  .table-wrap {
    margin-inline: -2px;
  }

  .orders-card > .table-wrap > table {
    min-width: 980px;
  }

  .order-split-detail-row > td {
    max-width: calc(100vw - 20px);
    padding-inline: 6px;
  }

  .order-split-detail-row .inline-split-panel {
    width: min(100%, calc(100vw - 28px));
    padding: 10px;
  }

  .inline-split-table {
    min-width: 820px;
  }

  .order-product-line {
    grid-template-columns: 1fr;
  }

  .order-product-meta {
    justify-content: flex-start;
  }

  .product-item {
    grid-template-columns: 1fr;
  }

  .thumb {
    width: 100%;
    height: auto;
    max-height: 180px;
    aspect-ratio: 4 / 3;
  }

  .modal-panel {
    max-width: calc(100vw - 20px);
  }
}

/* Order screens: show everything inside the container without horizontal dragging */
.orders-card > .table-wrap {
  overflow: visible;
  border: 0;
  background: transparent;
}

.orders-card > .table-wrap > table {
  display: block;
  width: 100%;
  min-width: 0 !important;
}

.orders-card > .table-wrap > table > thead {
  display: none;
}

.orders-card > .table-wrap > table > tbody {
  display: grid;
  gap: 12px;
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) {
  display: grid;
  grid-template-columns:
    minmax(140px, 0.85fr)
    minmax(120px, 0.7fr)
    minmax(190px, 1.15fr)
    minmax(260px, 1.7fr)
    minmax(190px, 0.95fr);
  grid-template-areas:
    "orderNo customer shipping product action"
    "actual amount cost status action"
    "pay time remark remark action";
  gap: 10px 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.orders-card > .table-wrap > table > tbody > tr > td {
  border: 0;
  padding: 0;
  min-width: 0 !important;
  max-width: 100% !important;
  white-space: normal;
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td::before {
  display: block;
  margin-bottom: 4px;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(1) {
  grid-area: orderNo;
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(1)::before {
  content: "订单号";
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(2) {
  grid-area: customer;
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(2)::before {
  content: "客户";
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(3) {
  grid-area: shipping;
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(3)::before {
  content: "收货信息";
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(4) {
  grid-area: product;
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(4)::before {
  content: "商品";
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(5) {
  grid-area: actual;
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(5)::before {
  content: "实开";
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(6) {
  grid-area: amount;
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(6)::before {
  content: "金额";
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(7) {
  grid-area: cost;
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(7)::before {
  content: "成本";
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(8) {
  grid-area: status;
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(8)::before {
  content: "状态";
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(9) {
  grid-area: pay;
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(9)::before {
  content: "扣款";
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(10) {
  grid-area: time;
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(10)::before {
  content: "时间";
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(11) {
  grid-area: remark;
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(11)::before {
  content: "备注";
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(12) {
  grid-area: action;
}

.orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) > td:nth-child(12)::before {
  content: "操作";
}

.orders-card .empty {
  grid-column: 1 / -1;
}

.orders-card .order-products-cell {
  min-width: 0;
  max-width: 100%;
}

.orders-card .order-product-line {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.orders-card .order-product-meta {
  justify-content: flex-start;
}

.orders-card .actual-quantity-input,
.orders-card .order-action-controls,
.orders-card .order-action-controls select,
.orders-card .order-action-controls input,
.orders-card .order-action-controls button {
  width: 100%;
}

.orders-card .compact-button {
  width: auto;
  min-height: 34px;
  margin-top: 6px;
}

.order-split-detail-row {
  display: block;
  margin-top: -6px;
}

.order-split-detail-row > td {
  display: block;
  position: static;
  max-width: none;
  padding: 0;
  background: transparent;
}

.order-split-detail-row .inline-split-panel {
  width: 100%;
  max-width: 100%;
  overflow: visible;
  border-color: #dce8ee;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.inline-split-panel .table-wrap {
  overflow: visible;
  border: 0;
  background: transparent;
}

.inline-split-table,
.inline-split-table thead,
.inline-split-table tbody,
.inline-split-table tr,
.inline-split-table td {
  display: block;
  width: 100%;
  min-width: 0 !important;
  max-width: 100%;
}

.inline-split-table thead {
  display: none;
}

.inline-split-table tbody {
  display: grid;
  gap: 10px;
}

.inline-split-table tbody > tr {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(100px, 0.45fr) minmax(130px, 0.55fr) minmax(190px, 0.9fr);
  grid-template-areas:
    "splitNo splitQty splitStatus splitAction"
    "splitPlatform splitPlatformNo splitLogistics splitAction"
    "splitNote splitNote splitNote splitAction";
  gap: 10px 12px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
}

.inline-split-table tbody > tr > td {
  border: 0;
  padding: 0;
}

.inline-split-table tbody > tr > td::before {
  display: block;
  margin-bottom: 4px;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.inline-split-table tbody > tr > td:nth-child(1) {
  grid-area: splitNo;
}

.inline-split-table tbody > tr > td:nth-child(1)::before {
  content: "小单号";
}

.inline-split-table tbody > tr > td:nth-child(2) {
  grid-area: splitQty;
}

.inline-split-table tbody > tr > td:nth-child(2)::before {
  content: "数量";
}

.inline-split-table tbody > tr > td:nth-child(3) {
  grid-area: splitStatus;
}

.inline-split-table tbody > tr > td:nth-child(3)::before {
  content: "状态";
}

.inline-split-table tbody > tr > td:nth-child(4) {
  grid-area: splitPlatform;
}

.inline-split-table tbody > tr > td:nth-child(4)::before {
  content: "平台名称";
}

.inline-split-table tbody > tr > td:nth-child(5) {
  grid-area: splitPlatformNo;
}

.inline-split-table tbody > tr > td:nth-child(5)::before {
  content: "平台号";
}

.inline-split-table tbody > tr > td:nth-child(6) {
  grid-area: splitLogistics;
}

.inline-split-table tbody > tr > td:nth-child(6)::before {
  content: "物流";
}

.inline-split-table tbody > tr > td:nth-child(7) {
  grid-area: splitNote;
}

.inline-split-table tbody > tr > td:nth-child(7)::before {
  content: "内部备注";
}

.inline-split-table tbody > tr > td:nth-child(8) {
  grid-area: splitAction;
}

.inline-split-table tbody > tr > td:nth-child(8)::before {
  content: "操作";
}

.inline-split-table input,
.inline-split-table select {
  width: 100%;
  min-width: 0;
}

@media (max-width: 1180px) {
  .orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) {
    grid-template-columns: minmax(130px, 0.85fr) minmax(180px, 1fr) minmax(230px, 1.3fr) minmax(190px, 0.9fr);
    grid-template-areas:
      "orderNo shipping product action"
      "customer amount status action"
      "actual cost pay action"
      "time remark remark action";
  }

  .inline-split-table tbody > tr {
    grid-template-columns: minmax(160px, 1fr) minmax(100px, 0.5fr) minmax(130px, 0.6fr);
    grid-template-areas:
      "splitNo splitQty splitStatus"
      "splitPlatform splitPlatformNo splitLogistics"
      "splitNote splitNote splitNote"
      "splitAction splitAction splitAction";
  }
}

@media (max-width: 760px) {
  .orders-card > .table-wrap > table > tbody > tr:not(.order-split-detail-row) {
    grid-template-columns: 1fr;
    grid-template-areas:
      "orderNo"
      "customer"
      "shipping"
      "product"
      "actual"
      "amount"
      "cost"
      "status"
      "pay"
      "time"
      "remark"
      "action";
  }

  .inline-split-head {
    display: grid;
  }

  .inline-split-table tbody > tr {
    grid-template-columns: 1fr;
    grid-template-areas:
      "splitNo"
      "splitQty"
      "splitStatus"
      "splitPlatform"
      "splitPlatformNo"
      "splitLogistics"
      "splitNote"
      "splitAction";
  }
}

/* Spreadsheet order management. Keep this after the responsive card rules so
   the admin order page behaves like a dense editable table. */
.orders-spreadsheet {
  padding: 12px;
  margin-left: -4px;
  margin-right: -4px;
}

.admin-page[data-admin-page-panel="orders"] {
  gap: 12px;
}

.admin-page[data-admin-page-panel="orders"] .page-heading {
  padding: 12px 16px;
}

.admin-page[data-admin-page-panel="orders"] .toolbar {
  gap: 8px;
}

.orders-spreadsheet > .table-wrap {
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  max-height: 78vh;
}

.orders-spreadsheet > .table-wrap > table {
  display: table !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.orders-spreadsheet > .table-wrap > table > thead {
  display: table-header-group !important;
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fff;
}

.orders-spreadsheet > .table-wrap > table > tbody {
  display: table-row-group !important;
}

.orders-spreadsheet > .table-wrap > table > tbody > tr {
  display: table-row !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: #fff;
}

.orders-spreadsheet > .table-wrap > table th,
.orders-spreadsheet > .table-wrap > table td {
  display: table-cell !important;
  vertical-align: top;
  padding: 7px 5px;
  border-bottom: 1px solid var(--line-soft);
  white-space: normal;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.35;
}

.orders-spreadsheet > .table-wrap > table td::before {
  display: none !important;
  content: none !important;
}

.orders-spreadsheet > .table-wrap > table th:nth-child(1),
.orders-spreadsheet > .table-wrap > table td:nth-child(1) { width: 4.09%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(2),
.orders-spreadsheet > .table-wrap > table td:nth-child(2) { width: 5.04%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(3),
.orders-spreadsheet > .table-wrap > table td:nth-child(3) { width: 3.94%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(4),
.orders-spreadsheet > .table-wrap > table td:nth-child(4) { width: 3.62%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(5),
.orders-spreadsheet > .table-wrap > table td:nth-child(5) { width: 4.57%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(6),
.orders-spreadsheet > .table-wrap > table td:nth-child(6) { width: 5.12%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(7),
.orders-spreadsheet > .table-wrap > table td:nth-child(7) { width: 2.52%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(8),
.orders-spreadsheet > .table-wrap > table td:nth-child(8) { width: 3.46%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(9),
.orders-spreadsheet > .table-wrap > table td:nth-child(9) { width: 3.7%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(10),
.orders-spreadsheet > .table-wrap > table td:nth-child(10) { width: 2.99%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(11),
.orders-spreadsheet > .table-wrap > table td:nth-child(11) { width: 2.99%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(12),
.orders-spreadsheet > .table-wrap > table td:nth-child(12) { width: 2.99%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(13),
.orders-spreadsheet > .table-wrap > table td:nth-child(13) { width: 5.51%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(14),
.orders-spreadsheet > .table-wrap > table td:nth-child(14) { width: 2.52%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(15),
.orders-spreadsheet > .table-wrap > table td:nth-child(15) { width: 2.68%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(16),
.orders-spreadsheet > .table-wrap > table td:nth-child(16) { width: 2.83%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(17),
.orders-spreadsheet > .table-wrap > table td:nth-child(17) { width: 3.31%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(18),
.orders-spreadsheet > .table-wrap > table td:nth-child(18) { width: 3.15%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(19),
.orders-spreadsheet > .table-wrap > table td:nth-child(19) { width: 3.15%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(20),
.orders-spreadsheet > .table-wrap > table td:nth-child(20) { width: 4.33%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(21),
.orders-spreadsheet > .table-wrap > table td:nth-child(21) { width: 3.94%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(22),
.orders-spreadsheet > .table-wrap > table td:nth-child(22) { width: 3.78%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(23),
.orders-spreadsheet > .table-wrap > table td:nth-child(23) { width: 3.54%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(24),
.orders-spreadsheet > .table-wrap > table td:nth-child(24) { width: 3.78%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(25),
.orders-spreadsheet > .table-wrap > table td:nth-child(25) { width: 3.94%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(26),
.orders-spreadsheet > .table-wrap > table td:nth-child(26) { width: 3.94%; }
.orders-spreadsheet > .table-wrap > table th:nth-child(27),
.orders-spreadsheet > .table-wrap > table td:nth-child(27) { width: 4.57%; }

.spreadsheet-input,
.spreadsheet-select {
  width: 100%;
  min-width: 0;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 6px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

.spreadsheet-input.numeric {
  text-align: right;
}

.spreadsheet-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.spreadsheet-actions button,
.compact-button {
  min-height: 26px;
  padding: 4px 6px;
  white-space: nowrap;
  font-size: 12px;
}

.order-split-cell {
  display: grid !important;
  gap: 4px;
}

.order-split-cell .pill {
  width: fit-content;
}

.orders-spreadsheet .order-parent-row > td {
  background: #fffdf3 !important;
}

.orders-spreadsheet .order-parent-row.has-split-children > td {
  border-bottom-color: #efdca0;
}

.orders-spreadsheet .order-child-row > td {
  background: #f3f9ff !important;
  border-bottom-color: #d7e9f8;
}

.orders-spreadsheet .order-child-row > td:nth-child(2) {
  padding-left: 24px;
}

.orders-spreadsheet .order-child-row > td:nth-child(2) strong::before {
  content: "↳ ";
  color: #2b6b8a;
}

.spreadsheet-static {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.child-pill {
  background: #dcefff;
  color: #1f5f7d;
}

.orders-spreadsheet .order-split-detail-row > td {
  padding: 12px !important;
  background: #f8fbfb;
}

.spreadsheet-split-panel {
  min-width: 0;
}

.spreadsheet-split-panel .table-wrap {
  overflow: auto;
}

.spreadsheet-split-panel .inline-split-table {
  display: table !important;
  min-width: 1280px !important;
  width: 100%;
}

.spreadsheet-split-panel .inline-split-table thead {
  display: table-header-group !important;
}

.spreadsheet-split-panel .inline-split-table tbody {
  display: table-row-group !important;
}

.spreadsheet-split-panel .inline-split-table tr {
  display: table-row !important;
  box-shadow: none !important;
  border: 0 !important;
}

.spreadsheet-split-panel .inline-split-table td,
.spreadsheet-split-panel .inline-split-table th {
  display: table-cell !important;
}

/* Final desktop override: let the admin workspace actually use the screen. */
@media (min-width: 901px) {
  .admin-shell {
    width: calc(100vw - 8px) !important;
    max-width: none !important;
    margin-left: calc(50% - 50vw + 4px) !important;
    margin-right: calc(50% - 50vw + 4px) !important;
    padding-left: 0;
    padding-right: 0;
  }

  .admin-layout {
    grid-template-columns: 112px minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  .admin-nav {
    padding: 8px !important;
  }

  .admin-nav-item {
    min-height: 38px !important;
    padding: 0 10px !important;
    font-size: 13px;
  }

  .admin-content,
  .admin-page[data-admin-page-panel="orders"],
  .admin-page[data-admin-page-panel="orders"] > .card,
  .orders-spreadsheet {
    width: 100% !important;
    max-width: none !important;
  }

  .admin-page[data-admin-page-panel="orders"] .page-heading,
  .admin-page[data-admin-page-panel="orders"] > .card {
    margin-left: 0;
    margin-right: 0;
  }

  .orders-spreadsheet {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}


/* Current admin workspace: compact top navigation and denser work pages. */
.admin-shell {
  width: min(1540px, calc(100vw - 56px)) !important;
  max-width: 1540px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-top: 10px;
}

#dashboardView > .topbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(0, auto);
  align-items: center;
  gap: 14px;
  padding: 10px 0 12px !important;
  margin-bottom: 12px;
}

#dashboardView > .topbar h1 {
  margin: 0;
  font-size: clamp(30px, 3vw, 44px);
  line-height: 1.05;
}

#dashboardView > .topbar p {
  margin: 6px 0 0;
}

.admin-top-actions {
  display: grid;
  grid-template-columns: minmax(0, auto) auto;
  gap: 10px;
  align-items: center;
  justify-content: end;
}

.admin-top-actions .admin-nav {
  position: static !important;
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 6px;
  padding: 0 !important;
  border: 0;
  background: transparent;
}

.admin-top-actions .admin-nav-item {
  width: auto;
  min-height: 34px !important;
  padding: 0 12px !important;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  text-align: center;
}

.admin-layout {
  display: block !important;
}

.admin-content {
  gap: 12px;
}

.admin-page {
  gap: 12px;
}

.page-heading {
  padding: 12px 16px !important;
}

.page-heading h2 {
  margin-bottom: 3px;
  font-size: 22px;
}

.page-heading p {
  font-size: 13px;
}

.admin-page > .card,
.admin-page .card {
  padding: 16px;
}

.product-compact-form {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 8px 10px !important;
}

.product-compact-form input,
.product-compact-form select,
.product-compact-form button {
  min-height: 36px;
}

.product-compact-form textarea {
  min-height: 36px;
  height: 36px;
}

.customer-log-picker {
  width: min(360px, 36vw);
}

.customer-log-picker input {
  width: 100%;
  min-height: 36px;
}

.customer-log-results {
  max-height: 150px;
  overflow-y: auto;
  margin-top: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.customer-log-results:empty {
  display: none;
}

.customer-log-option {
  display: grid;
  width: 100%;
  gap: 2px;
  min-height: 44px;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.customer-log-option:hover,
.customer-log-option.active {
  background: var(--soft);
  color: var(--brand-dark);
}

.customer-log-option span {
  font-weight: 800;
}

.customer-log-option small,
.customer-log-empty,
.log-customer-summary {
  color: var(--muted);
  font-size: 12px;
}

.customer-log-empty {
  padding: 10px;
}

.log-customer-summary {
  margin: -4px 0 12px;
}

.orders-spreadsheet {
  padding: 10px !important;
}

.sheet-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 0 8px;
}

.sheet-toolbar button {
  min-height: 34px;
}

.orders-spreadsheet > .table-wrap {
  max-height: calc(100vh - 230px);
  overflow: auto !important;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.orders-spreadsheet > .table-wrap > table {
  min-width: 1420px !important;
  table-layout: fixed;
}

.orders-spreadsheet > .table-wrap > table th,
.orders-spreadsheet > .table-wrap > table td {
  display: table-cell !important;
  padding: 7px 8px !important;
  border-bottom: 1px solid var(--line-soft) !important;
  vertical-align: top;
  background: #fffdf5;
  line-height: 1.35;
}

.orders-spreadsheet > .table-wrap > table thead {
  display: table-header-group !important;
  position: sticky;
  top: 0;
  z-index: 4;
}

.orders-spreadsheet > .table-wrap > table thead th {
  background: #f8fafc;
  color: #0f172a;
  font-weight: 800;
  white-space: nowrap;
}

.orders-spreadsheet > .table-wrap > table tbody,
.orders-spreadsheet > .table-wrap > table tr {
  display: table-row-group;
}

.orders-spreadsheet > .table-wrap > table tr {
  display: table-row !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.orders-spreadsheet .order-child-row > td {
  background: #f2f8ff !important;
}

.orders-spreadsheet > .table-wrap > table td::before {
  display: none !important;
}

.orders-spreadsheet > .table-wrap > table th:nth-child(1),
.orders-spreadsheet > .table-wrap > table td:nth-child(1) { width: 150px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(2),
.orders-spreadsheet > .table-wrap > table td:nth-child(2) { width: 72px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(3),
.orders-spreadsheet > .table-wrap > table td:nth-child(3) { width: 150px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(4),
.orders-spreadsheet > .table-wrap > table td:nth-child(4) { width: 120px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(5),
.orders-spreadsheet > .table-wrap > table td:nth-child(5) { width: 190px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(6),
.orders-spreadsheet > .table-wrap > table td:nth-child(6) { width: 64px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(7),
.orders-spreadsheet > .table-wrap > table td:nth-child(7) { width: 82px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(8),
.orders-spreadsheet > .table-wrap > table td:nth-child(8) { width: 82px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(9),
.orders-spreadsheet > .table-wrap > table td:nth-child(9) { width: 142px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(10),
.orders-spreadsheet > .table-wrap > table td:nth-child(10) { width: 210px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(11),
.orders-spreadsheet > .table-wrap > table td:nth-child(11) { width: 190px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(12),
.orders-spreadsheet > .table-wrap > table td:nth-child(12) { width: 130px; }

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

.order-split-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  width: 100%;
}

.order-action-controls input,
.order-action-controls select,
.order-action-controls button,
.order-split-controls input,
.order-split-controls button {
  min-height: 30px;
  font-size: 12px;
}

.order-action-controls input,
.order-action-controls select,
.order-split-controls input {
  width: 100%;
  border-radius: 6px;
  background: #fff;
}

.order-split-controls button {
  min-width: 0;
  padding: 0 6px;
}

.sheet-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 6px;
  background: #eef2f7;
  color: #1e293b;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.sheet-pill.info {
  background: #dbeafe;
  color: #1d4ed8;
}

.sheet-pill.warn {
  margin-top: 4px;
  background: #fde68a;
  color: #92400e;
}

.sheet-pill.success {
  background: #dcfce7;
  color: #047857;
}

.sheet-pill.status {
  background: #e0f2fe;
  color: #075985;
}

.orders-document-page {
  min-height: calc(100vh - 180px);
}

.orders-document-page > .page-heading {
  display: none !important;
}

.orders-document-page .orders-spreadsheet {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 172px);
  padding: 0;
  overflow: hidden;
  border: 1px solid #d5e1ea;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
}

.orders-document-page .sheet-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid #dbe5ee;
  background: #fbfdff;
}

.sheet-document-title {
  min-width: 0;
}

.sheet-document-title h2 {
  margin: 0;
  color: #06152b;
  font-size: 20px;
  line-height: 1.2;
}

.sheet-document-title p {
  margin: 5px 0 0;
  color: #5d7088;
  font-size: 12px;
}

.sheet-document-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.orders-document-page .orders-spreadsheet > .table-wrap {
  flex: 1;
  max-height: calc(100vh - 235px);
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: #fff;
}

.orders-document-page .orders-spreadsheet > .table-wrap > table {
  min-width: 1540px !important;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 12px;
}

.orders-document-page .orders-spreadsheet > .table-wrap > table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 34px;
  padding: 8px 10px;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #cbd5e1;
  background: #f7fafc;
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
}

.orders-document-page .orders-spreadsheet > .table-wrap > table td {
  height: 44px;
  padding: 8px 10px;
  border-right: 1px solid #edf2f7;
  border-bottom: 1px solid #e5edf5;
  background: #fffdf4;
  color: #0f172a;
  vertical-align: top;
}

.orders-document-page .orders-spreadsheet .order-child-row > td {
  background: #eef6ff !important;
}

.orders-document-page .orders-spreadsheet > .table-wrap > table tbody tr:hover td {
  background: #f8fcff;
}

.orders-document-page .order-action-controls {
  grid-template-columns: 1fr;
  gap: 4px;
}

.orders-document-page .order-action-controls.single-action {
  display: block;
}

.orders-document-page .order-split-controls {
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

.editable-order-cell {
  min-height: 26px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: text;
}

.editable-order-cell:hover {
  border-color: #cbd5e1;
  background: #ffffff;
}

.editable-order-cell:focus {
  border-color: #0f8f83;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(15, 143, 131, 0.18);
}

.editable-order-cell[data-placeholder]:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
}

.editable-order-cell.sub-cell {
  margin-top: 3px;
  color: #475569;
  font-size: 11px;
}

.editable-order-cell.typed-cell {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  background: #eef2f7;
  color: #1e293b;
  font-weight: 800;
}

.editable-order-cell.typed-cell.child {
  background: #dbeafe;
  color: #1d4ed8;
}

.readonly-order-cell {
  background: #fffdf4;
  cursor: default;
  user-select: none;
  caret-color: transparent;
}

.readonly-sub-cell {
  margin-top: 4px;
  color: #475569;
  font-size: 11px;
}

.customer-order-cell {
  position: relative;
  padding-right: 24px !important;
}

.customer-info-dot {
  appearance: none;
  position: absolute;
  top: calc(50% - 14px);
  right: 8px;
  width: 7px;
  height: 28px;
  min-height: 28px;
  max-height: 28px;
  min-width: 7px;
  max-width: 7px;
  transform: none !important;
  transition: none !important;
  animation: none !important;
  box-sizing: border-box;
  display: block;
  margin: 0;
  padding: 0;
  border: 1px solid #059669;
  border-radius: 3px;
  background: #10b981;
  box-shadow: none;
  cursor: pointer;
  line-height: 1;
}

.customer-info-dot:hover,
.customer-info-dot:focus-visible,
.customer-info-dot:active {
  top: calc(50% - 14px);
  right: 8px;
  width: 7px;
  height: 28px;
  min-height: 28px;
  max-height: 28px;
  transform: none !important;
  transition: none !important;
  border-color: #059669;
  background: #10b981;
  outline: none;
  box-shadow: none;
}

.customer-info-panel {
  width: min(620px, calc(100vw - 32px));
}

.customer-info-panel table th {
  width: 150px;
}

.monitor-page {
  gap: 14px;
}

.monitor-unlock-form {
  display: grid;
  grid-template-columns: minmax(240px, 420px) auto;
  gap: 10px;
  align-items: center;
  max-width: 620px;
}

.monitor-dashboard {
  display: grid;
  gap: 14px;
}

.monitor-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 10px;
}

.monitor-card {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid #d9e6ea;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.monitor-card span,
.monitor-card small {
  display: block;
  color: #5d7088;
  font-size: 12px;
  font-weight: 700;
}

.monitor-card strong {
  display: block;
  margin: 6px 0 4px;
  color: #06152b;
  font-size: 26px;
  line-height: 1.1;
}

.monitor-chart-card {
  overflow: hidden;
}

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

.monitor-charts > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fbfdff;
}

.monitor-charts h3 {
  margin: 0 0 8px;
  color: #0f172a;
  font-size: 15px;
}

.monitor-charts canvas {
  display: block;
  width: 100%;
  height: 260px;
  border-radius: 6px;
  background: #ffffff;
}

.monitor-page .table-wrap {
  overflow: auto;
}

@media (max-width: 1180px) {
  .monitor-grid,
  .monitor-charts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .monitor-grid,
  .monitor-charts,
  .monitor-unlock-form {
    grid-template-columns: 1fr;
  }
}

/* Wider admin work tables. Keep a small page gutter, then give dense tables
   enough room to avoid horizontal dragging on normal desktop screens. */
.admin-shell {
  width: min(2200px, calc(100vw - 80px)) !important;
  max-width: 2200px !important;
}

.admin-page > .card,
.admin-page .card,
.orders-document-page .orders-spreadsheet {
  max-width: 100%;
}

.orders-spreadsheet > .table-wrap > table,
.orders-document-page .orders-spreadsheet > .table-wrap > table {
  width: max(100%, 1840px) !important;
  min-width: 1840px !important;
}

.orders-spreadsheet > .table-wrap > table th:nth-child(1),
.orders-spreadsheet > .table-wrap > table td:nth-child(1) { width: 145px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(2),
.orders-spreadsheet > .table-wrap > table td:nth-child(2) { width: 66px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(3),
.orders-spreadsheet > .table-wrap > table td:nth-child(3) { width: 170px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(4),
.orders-spreadsheet > .table-wrap > table td:nth-child(4) { width: 115px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(5),
.orders-spreadsheet > .table-wrap > table td:nth-child(5) { width: 185px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(6),
.orders-spreadsheet > .table-wrap > table td:nth-child(6) { width: 56px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(7),
.orders-spreadsheet > .table-wrap > table td:nth-child(7) { width: 74px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(8),
.orders-spreadsheet > .table-wrap > table td:nth-child(8) { width: 78px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(9),
.orders-spreadsheet > .table-wrap > table td:nth-child(9) { width: 136px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(10),
.orders-spreadsheet > .table-wrap > table td:nth-child(10) { width: 220px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(11),
.orders-spreadsheet > .table-wrap > table td:nth-child(11) { width: 170px; }
.orders-spreadsheet > .table-wrap > table th:nth-child(12),
.orders-spreadsheet > .table-wrap > table td:nth-child(12) { width: 96px; }

[data-admin-page-panel="customers"] .table-wrap > table {
  width: max(100%, 1900px);
  min-width: 1900px;
  table-layout: fixed;
  font-size: 12px;
}

[data-admin-page-panel="customers"] .table-wrap th,
[data-admin-page-panel="customers"] .table-wrap td {
  padding: 8px 9px;
  vertical-align: top;
}

[data-admin-page-panel="customers"] .table-wrap th:nth-child(1),
[data-admin-page-panel="customers"] .table-wrap td:nth-child(1) { width: 108px; }
[data-admin-page-panel="customers"] .table-wrap th:nth-child(2),
[data-admin-page-panel="customers"] .table-wrap td:nth-child(2) { width: 118px; }
[data-admin-page-panel="customers"] .table-wrap th:nth-child(3),
[data-admin-page-panel="customers"] .table-wrap td:nth-child(3) { width: 150px; }
[data-admin-page-panel="customers"] .table-wrap th:nth-child(4),
[data-admin-page-panel="customers"] .table-wrap td:nth-child(4) { width: 125px; }
[data-admin-page-panel="customers"] .table-wrap th:nth-child(5),
[data-admin-page-panel="customers"] .table-wrap td:nth-child(5) { width: 66px; }
[data-admin-page-panel="customers"] .table-wrap th:nth-child(6),
[data-admin-page-panel="customers"] .table-wrap td:nth-child(6),
[data-admin-page-panel="customers"] .table-wrap th:nth-child(7),
[data-admin-page-panel="customers"] .table-wrap td:nth-child(7),
[data-admin-page-panel="customers"] .table-wrap th:nth-child(8),
[data-admin-page-panel="customers"] .table-wrap td:nth-child(8) { width: 82px; }
[data-admin-page-panel="customers"] .table-wrap th:nth-child(9),
[data-admin-page-panel="customers"] .table-wrap td:nth-child(9) { width: 118px; }
[data-admin-page-panel="customers"] .table-wrap th:nth-child(10),
[data-admin-page-panel="customers"] .table-wrap td:nth-child(10) { width: 260px; }
[data-admin-page-panel="customers"] .table-wrap th:nth-child(11),
[data-admin-page-panel="customers"] .table-wrap td:nth-child(11) { width: 150px; }
[data-admin-page-panel="customers"] .table-wrap th:nth-child(12),
[data-admin-page-panel="customers"] .table-wrap td:nth-child(12) { width: 76px; }
[data-admin-page-panel="customers"] .table-wrap th:nth-child(13),
[data-admin-page-panel="customers"] .table-wrap td:nth-child(13) { width: 150px; }

@media (min-width: 1800px) {
  .admin-shell {
    width: min(2200px, calc(100vw - 120px)) !important;
    max-width: 2200px !important;
  }
}

.editable-order-select,
.orders-document-page .order-action-controls button,
.orders-document-page .order-split-controls input,
.orders-document-page .order-split-controls button {
  min-height: 30px;
  padding: 5px 7px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.1;
}

.orders-document-page .order-action-controls button,
.orders-document-page .order-split-controls button {
  min-width: 0;
}

.editable-order-select,
.orders-document-page .order-split-controls input {
  width: 100%;
  border-radius: 6px;
  background: #fff;
}

.orders-document-page .sheet-pill {
  min-height: 20px;
  padding: 2px 6px;
  border-radius: 5px;
}

.split-dialog-panel {
  width: min(560px, calc(100vw - 32px));
}

.split-dialog-topbar {
  align-items: flex-start;
  padding-bottom: 12px;
}

.split-dialog-body {
  display: grid;
  gap: 12px;
}

.split-dialog-label {
  margin-bottom: 8px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

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

.split-quantity-input {
  width: 100%;
  min-height: 40px;
  text-align: center;
}

.split-add-input {
  margin-top: 8px;
  min-height: 34px;
}

.split-dialog-current {
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f8fbfc;
  color: #344054;
}

.split-child-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

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

.split-child-row span {
  min-width: 0;
  word-break: break-word;
}

.split-child-row button {
  min-height: 32px;
  padding: 0 10px;
}

.split-dialog-actions {
  justify-content: flex-end;
}

.mother-shipment-note {
  padding: 7px 0;
  line-height: 1.35;
}

.password-dialog-panel {
  width: min(520px, calc(100vw - 32px));
}

.password-result {
  display: grid;
  gap: 6px;
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid #b7d8d2;
  border-radius: 8px;
  background: #eefaf7;
}

.password-result span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.password-result strong {
  color: var(--brand-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 28px;
  letter-spacing: 0;
}

.password-dialog-actions {
  justify-content: flex-end;
}

.notice-dialog-panel {
  width: min(460px, calc(100vw - 32px));
}

.notice-dialog-actions {
  justify-content: flex-end;
}

.notice-dialog-panel .topbar {
  align-items: start;
}

.notice-dialog-panel h2,
.password-dialog-panel h2 {
  font-size: 22px;
}

@media (max-width: 1100px) {
  .admin-shell {
    width: calc(100vw - 24px) !important;
  }

  #dashboardView > .topbar,
  .admin-top-actions {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .admin-top-actions .admin-nav {
    justify-content: start;
  }

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

  .customer-log-picker {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .product-compact-form,
  .order-action-controls {
    grid-template-columns: 1fr;
  }

  .order-action-controls [data-split-quantities] {
    grid-column: auto;
  }
}

/* Customer commerce skin, scoped to the customer entry only. */
.customer-commerce {
  --shop-red: #c91523;
  --shop-orange: #f26a21;
  --brand: var(--shop-red);
  --brand-dark: #a80f1a;
  --soft: #fff4ed;
  background: #f4f5f7;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
}

.customer-commerce .shell {
  width: min(1500px, calc(100vw - clamp(48px, 7vw, 150px)));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 2vw, 28px);
  padding: clamp(10px, 1.4vw, 22px) 0 clamp(24px, 3vw, 56px);
}

.customer-commerce .auth-shell {
  flex: 1;
  min-height: calc(100vh - clamp(92px, 9vw, 132px));
  grid-template-columns: minmax(420px, 1fr) minmax(360px, 460px);
  gap: clamp(28px, 4vw, 72px);
  align-content: center;
  justify-content: stretch;
}

.customer-commerce .brand {
  min-height: clamp(560px, calc(100vh - 180px), 880px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(34px, 4vw, 72px);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(152, 13, 26, 0.96) 0%, rgba(210, 40, 27, 0.86) 42%, rgba(242, 106, 33, 0.28) 100%),
    url("/assets/commerce-hero.png") right center / cover no-repeat;
  color: #ffffff;
  box-shadow: 0 20px 46px rgba(201, 21, 35, 0.18);
}

.customer-commerce .brand-eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.18);
  color: inherit;
  font-size: 13px;
  font-weight: 800;
}

.customer-commerce .brand h1 {
  margin-top: 26px;
  color: #ffffff;
  font-size: clamp(40px, 4.4vw, 76px);
  line-height: 1.08;
  word-break: keep-all;
}

.customer-commerce .auth-panel,
.customer-commerce .card,
.customer-commerce .balance-box {
  border-color: #e8ecf0;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

.customer-commerce .auth-panel {
  align-self: center;
  width: 100%;
}

.customer-commerce .tab.active,
.customer-commerce .primary {
  background: linear-gradient(135deg, var(--shop-red), var(--shop-orange));
  color: #ffffff;
}

.customer-commerce .topbar {
  padding: 18px 22px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--shop-red), var(--shop-orange));
  color: #ffffff;
  gap: 18px;
  justify-content: space-between;
}

.customer-commerce #dashboardView > .topbar {
  border: 1px solid #e8ecf0;
  background: #ffffff;
  color: #172033;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.customer-commerce #dashboardView > .topbar .brand-eyebrow {
  background: #fff4ed;
  color: var(--shop-red);
}

.customer-commerce #dashboardView > .topbar h1 {
  margin-top: 8px;
  color: #12171c;
  font-size: clamp(24px, 2.4vw, 34px);
}

.customer-commerce #dashboardView > .topbar p {
  color: var(--muted);
}

.customer-commerce .customer-page-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(8px, 1.1vw, 16px);
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
}

.customer-commerce .customer-topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(10px, 1.2vw, 18px);
  min-width: 0;
  flex-wrap: wrap;
}

.customer-commerce .balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #f4c7ba;
  border-radius: 6px;
  background: #fff8f3;
  color: #6b7280;
  white-space: nowrap;
}

.customer-commerce .balance-pill span {
  font-size: 12px;
  font-weight: 800;
}

.customer-commerce .balance-pill strong {
  color: var(--shop-red);
  font-size: 16px;
  font-weight: 900;
}

.customer-commerce .customer-page-nav button {
  min-height: 36px;
  border: 1px solid #f4c7ba;
  border-radius: 6px;
  padding: 0 14px;
  background: #fff4ed;
  color: var(--shop-red);
  font-weight: 800;
}

.customer-commerce .customer-page-nav button.active {
  border-color: var(--shop-red);
  background: linear-gradient(135deg, var(--shop-red), var(--shop-orange));
  color: #ffffff;
}

.customer-commerce #dashboardView > .topbar,
.customer-commerce #dashboardView > .balance-row,
.customer-commerce #dashboardView > .grid {
  width: 100%;
}

.customer-commerce .customer-page-panel {
  min-height: calc(100vh - 320px);
}

.customer-commerce .card .topbar {
  padding: 0 0 16px;
  border-radius: 0;
  background: transparent;
  color: var(--text);
}

.customer-commerce .topbar h1,
.customer-commerce .topbar p,
.customer-commerce .topbar .muted {
  color: inherit;
}

.customer-commerce .card .topbar .muted {
  color: var(--muted);
}

.customer-commerce .mall-search {
  flex: 0 1 460px;
  margin-left: auto;
  max-width: min(460px, 38vw);
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-radius: 8px;
  background: #ffffff;
  color: #8b5a16;
}

.customer-commerce .mall-search span {
  padding: 3px 8px;
  border-radius: 6px;
  background: #fff4ed;
  color: var(--shop-red);
  font-size: 12px;
  font-weight: 800;
}

.customer-commerce .mall-search strong {
  color: #344054;
  font-size: 14px;
}

.customer-commerce .ghost,
.customer-commerce .secondary {
  border: 0;
  background: #fff4ed;
  color: var(--shop-red);
}

.customer-commerce input:focus,
.customer-commerce select:focus,
.customer-commerce textarea:focus {
  border-color: var(--shop-red);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(201, 21, 35, 0.12);
}

.customer-commerce .balance-row {
  gap: 14px;
}

.customer-commerce .balance-box:first-child {
  background: linear-gradient(135deg, #fff7ed, #fff1f2);
}

.customer-commerce .storefront-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.customer-commerce .storefront-strip div {
  min-height: 82px;
  padding: 18px;
  border: 1px solid #f0d8cf;
  border-radius: 8px;
  background: linear-gradient(135deg, #fff8f3 0%, #ffffff 100%);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
}

.customer-commerce .storefront-strip strong {
  display: block;
  color: #9f1239;
  font-size: 18px;
}

.customer-commerce .storefront-strip span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.customer-commerce .balance-box strong,
.customer-commerce .product-item > div:last-child strong {
  color: var(--shop-red);
}

.customer-commerce .product-card-buy {
  display: grid !important;
  gap: 12px;
}

.customer-commerce .product-card-hint {
  margin: 10px 0 0;
  color: var(--shop-red);
  font-weight: 800;
}

.customer-commerce .product-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.customer-commerce .filter-result-count {
  margin: 10px 0 0;
  font-weight: 700;
}

.customer-commerce .product-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: stretch;
  padding: 0;
  border: 1px solid #edf0f3;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.customer-commerce .product-item:hover,
.customer-commerce .product-item:focus-visible {
  border-color: #f4a28c;
  box-shadow: 0 16px 32px rgba(201, 21, 35, 0.12);
  transform: translateY(-2px);
  outline: 0;
}

.customer-commerce .thumb {
  width: 100%;
  height: 168px;
  object-fit: cover;
  border-radius: 0;
  background: #f8fafc;
}

.customer-commerce .product-item > div:nth-child(2) {
  min-width: 0;
  padding: 14px 14px 8px;
}

.customer-commerce .product-item p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-commerce .product-item > div:last-child {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 14px;
  border-top: 1px solid #edf0f3;
}

.customer-commerce .product-item > div:last-child .secondary {
  background: linear-gradient(135deg, var(--shop-red), var(--shop-orange));
  color: #ffffff;
}

.customer-commerce .cart-item,
.customer-commerce .log-item,
.customer-commerce .order-item {
  border-radius: 8px;
}

.customer-commerce .product-detail-panel {
  width: min(920px, calc(100vw - 48px));
  max-height: min(86vh, 880px);
  overflow: auto;
}

.customer-commerce .product-detail-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.customer-commerce .product-detail-header h2 {
  margin: 0;
}

.customer-commerce .product-detail-body {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 24px;
  padding-top: 24px;
}

.customer-commerce .product-detail-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
  align-content: start;
}

.customer-commerce .product-detail-gallery img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid #bfe4e3;
  border-radius: 8px;
  object-fit: cover;
  background: #eefafa;
}

.customer-commerce .product-detail-image-button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: zoom-in;
}

.customer-commerce .product-detail-image-button span {
  display: none;
}

.customer-commerce .product-detail-image-button span {
  position: absolute;
  right: 6px;
  bottom: 6px;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.74);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  line-height: 22px;
}

.customer-commerce .product-detail-image-button:hover img,
.customer-commerce .product-detail-image-button:focus-visible img {
  border-color: var(--shop-red);
  box-shadow: 0 0 0 3px rgba(201, 21, 35, 0.14);
}

.customer-commerce .product-image-viewer {
  z-index: 35;
  padding: clamp(12px, 2vw, 28px);
}

.customer-commerce .product-image-viewer-panel {
  width: min(1180px, 100%);
  max-height: 94vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  padding: clamp(14px, 2vw, 22px);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.customer-commerce .product-image-viewer-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.customer-commerce .product-image-viewer-header h2 {
  margin: 0;
}

.customer-commerce .product-image-viewer-stage {
  position: relative;
  min-height: min(68vh, 720px);
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #0f172a;
}

.customer-commerce .product-image-viewer-stage img {
  max-width: 100%;
  max-height: min(72vh, 760px);
  object-fit: contain;
}

.customer-commerce .product-image-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 46px;
  height: 64px;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: #111827;
  cursor: pointer;
  font-size: 42px;
  line-height: 1;
}

.customer-commerce .product-image-nav:disabled {
  opacity: 0.32;
  cursor: default;
}

.customer-commerce .product-image-prev {
  left: 14px;
}

.customer-commerce .product-image-next {
  right: 14px;
}

.customer-commerce .product-detail-info {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.customer-commerce .product-detail-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.customer-commerce .product-detail-table div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  min-height: 44px;
  border-bottom: 1px solid var(--line-soft);
}

.customer-commerce .product-detail-table div:last-child {
  border-bottom: 0;
}

.customer-commerce .product-detail-table strong {
  padding: 12px;
  background: #f8fafc;
  color: #334155;
}

.customer-commerce .product-detail-table span {
  min-width: 0;
  padding: 12px;
  overflow-wrap: anywhere;
}

.customer-commerce .product-detail-purchase {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
  padding: 18px;
  border: 1px solid #f4c7ba;
  border-radius: 8px;
  background: #fff8f3;
}

.customer-commerce .product-detail-purchase span {
  display: block;
  margin-bottom: 8px;
  color: #334155;
  font-weight: 800;
}

.customer-commerce .detail-quantity-control {
  display: grid;
  grid-template-columns: 42px minmax(80px, 120px) 42px;
  gap: 8px;
}

.customer-commerce .detail-quantity-control input {
  text-align: center;
  font-weight: 900;
}

.customer-commerce #productDetailAddButton {
  min-height: 42px;
  min-width: 136px;
}

@media (max-width: 900px) {
  .customer-commerce .auth-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .customer-commerce .brand {
    min-height: auto;
    padding: 28px;
  }

  .customer-commerce .mall-search {
    order: 3;
    width: 100%;
    max-width: none;
  }

  .customer-commerce .customer-page-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }

  .customer-commerce .customer-topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .customer-commerce .balance-pill {
    order: 0;
  }

  .customer-commerce .storefront-strip {
    grid-template-columns: 1fr;
  }

  .customer-commerce .product-item {
    grid-template-columns: 1fr;
  }

  .customer-commerce .thumb {
    width: 100%;
    height: 170px;
  }

  .customer-commerce .product-detail-body,
  .customer-commerce .product-detail-purchase {
    grid-template-columns: 1fr;
  }

  .customer-commerce .product-detail-gallery {
    grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  }
}

@media (max-width: 520px) {
  .customer-commerce .shell {
    width: calc(100vw - 24px);
    padding: 28px 16px 40px;
    overflow-x: hidden;
  }

  .customer-commerce .auth-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
  }

  .customer-commerce .brand,
  .customer-commerce .auth-panel {
    width: 100%;
    min-width: 0;
  }

  .customer-commerce .brand {
    min-height: min(520px, calc(100vh - 220px));
    padding: 28px;
  }

  .customer-commerce .brand h1 {
    font-size: 32px;
    line-height: 1.16;
    word-break: normal;
    overflow-wrap: anywhere;
  }

  .customer-commerce .auth-panel {
    padding: 20px;
  }

  .customer-commerce .password-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .customer-commerce .password-row input {
    min-width: 0;
  }

  .customer-commerce .password-row .ghost {
    width: 100%;
    min-width: 0;
    padding: 0 10px;
    white-space: nowrap;
  }

  .customer-commerce .product-detail-panel {
    width: calc(100vw - 24px);
  }

  .customer-commerce .product-detail-table div {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .customer-commerce #productDetailAddButton {
    width: 100%;
  }
}

/* Final customer dashboard spacing overrides. Keep the customer workspace away
   from browser edges and give the white header its own inner breathing room. */
.customer-commerce .shell {
  width: min(1360px, calc(100vw - clamp(96px, 12vw, 260px)));
  max-width: 100%;
  margin-inline: auto;
  box-sizing: border-box;
}

.customer-commerce #dashboardView {
  width: 100%;
}

.customer-commerce #dashboardView > .topbar {
  width: 100%;
  box-sizing: border-box;
  padding: clamp(24px, 2.4vw, 38px) clamp(36px, 4vw, 64px) !important;
  margin-inline: auto;
}

.customer-commerce #dashboardView > .topbar > div {
  min-width: 0;
}

.customer-commerce #dashboardView > .balance-row,
.customer-commerce #dashboardView > .grid {
  width: 100%;
  margin-inline: auto;
}

@media (min-width: 1600px) {
  .customer-commerce .shell {
    width: min(1420px, calc(100vw - 280px));
  }
}

@media (max-width: 1100px) {
  .customer-commerce .shell {
    width: calc(100vw - 56px);
  }

  .customer-commerce #dashboardView > .topbar {
    padding: 24px 28px !important;
  }
}

@media (max-width: 700px) {
  .customer-commerce .shell {
    width: calc(100vw - 28px);
    padding-inline: 0;
  }

  .customer-commerce #dashboardView > .topbar {
    padding: 22px 20px !important;
  }
}

/* Customer responsive pass: desktop, tablet, phone, and browser zoom. */
.customer-commerce .shell,
.customer-commerce #dashboardView,
.customer-commerce #dashboardView > .topbar,
.customer-commerce .customer-page-panel,
.customer-commerce .product-item,
.customer-commerce .modal-panel {
  max-width: 100%;
}

.customer-commerce #dashboardView > .topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, auto);
  align-items: center;
}

.customer-commerce #dashboardView > .topbar > div:first-child {
  display: grid;
  gap: 8px;
}

.customer-commerce #dashboardView > .topbar h1 {
  margin: 0;
  overflow-wrap: anywhere;
}

.customer-commerce #dashboardView > .topbar p {
  margin: 0;
  overflow-wrap: anywhere;
}

.customer-commerce .customer-topbar-actions {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas:
    "balance logout"
    "nav nav";
  align-items: center;
  justify-content: end;
  gap: 12px;
}

.customer-commerce .balance-pill {
  grid-area: balance;
  justify-content: center;
}

.customer-commerce #logoutButton {
  grid-area: logout;
  min-height: 38px;
}

.customer-commerce .customer-page-nav {
  grid-area: nav;
  display: grid;
  grid-template-columns: repeat(4, minmax(84px, auto));
  gap: 10px;
  overflow: visible;
}

.customer-commerce .customer-page-nav button,
.customer-commerce #logoutButton,
.customer-commerce .balance-pill,
.customer-commerce .toolbar > *,
.customer-commerce .card .topbar button {
  min-width: 0;
}

.customer-commerce .toolbar {
  grid-template-columns: minmax(180px, 1.1fr) minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(140px, 0.55fr);
  gap: 12px;
}

.customer-commerce .product-list {
  grid-template-columns: repeat(auto-fill, minmax(clamp(190px, 18vw, 240px), 1fr));
  gap: clamp(12px, 1.5vw, 18px);
}

.customer-commerce .thumb {
  height: auto;
  aspect-ratio: 4 / 3;
}

.customer-commerce .product-item > div:nth-child(2) {
  display: grid;
  gap: 8px;
}

.customer-commerce .product-item > div:nth-child(2) strong {
  line-height: 1.35;
}

.customer-commerce .customer-price-tiers {
  gap: 8px;
}

.customer-commerce .customer-price-tiers div {
  min-width: 0;
}

.customer-commerce .cart-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.customer-commerce .cart-quantity-actions {
  justify-content: end;
}

@media (min-width: 1500px) {
  .customer-commerce .product-list {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

@media (max-width: 1180px) {
  .customer-commerce .shell {
    width: calc(100vw - 48px);
  }

  .customer-commerce #dashboardView > .topbar {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .customer-commerce .customer-topbar-actions {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
    justify-content: stretch;
  }

  .customer-commerce .customer-page-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .customer-commerce .shell {
    width: calc(100vw - 32px);
    padding-top: 18px;
  }

  .customer-commerce #dashboardView > .topbar {
    gap: 18px;
  }

  .customer-commerce #dashboardView > .topbar h1 {
    font-size: clamp(28px, 7vw, 40px);
    line-height: 1.12;
  }

  .customer-commerce .customer-page-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .customer-commerce .customer-page-nav button,
  .customer-commerce #logoutButton {
    width: 100%;
    padding: 0 10px;
  }

  .customer-commerce .toolbar {
    grid-template-columns: 1fr;
  }

  .customer-commerce .card .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
  }

  .customer-commerce .product-list {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  }

  .customer-commerce .cart-item {
    grid-template-columns: 1fr;
  }

  .customer-commerce .cart-quantity-actions {
    width: 100%;
    justify-content: stretch;
  }
}

@media (max-width: 560px) {
  .customer-commerce {
    background: #f4f5f7;
  }

  .customer-commerce .shell {
    width: calc(100vw - 20px);
    gap: 14px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  }

  .customer-commerce #dashboardView > .topbar {
    padding: 18px 16px !important;
  }

  .customer-commerce #dashboardView > .topbar .brand-eyebrow {
    width: fit-content;
    min-height: 26px;
    font-size: 13px;
  }

  .customer-commerce #dashboardView > .topbar h1 {
    max-width: 8.5em;
    font-size: clamp(34px, 10vw, 44px);
  }

  .customer-commerce .customer-topbar-actions {
    grid-template-columns: minmax(0, 1fr) minmax(88px, 0.42fr);
    grid-template-areas:
      "balance logout"
      "nav nav";
    gap: 10px;
  }

  .customer-commerce .balance-pill {
    min-height: 44px;
    padding: 0 10px;
  }

  .customer-commerce .balance-pill span {
    font-size: 13px;
  }

  .customer-commerce .balance-pill strong {
    font-size: clamp(16px, 5.2vw, 22px);
  }

  .customer-commerce .customer-page-nav {
    gap: 8px;
  }

  .customer-commerce .customer-page-nav button {
    min-height: 44px;
    font-size: clamp(13px, 3.8vw, 15px);
  }

  .customer-commerce #logoutButton {
    min-height: 44px;
    font-size: 14px;
  }

  .customer-commerce .card {
    padding: 18px 16px;
  }

  .customer-commerce .card .topbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .customer-commerce .card .topbar button {
    width: 100%;
    min-height: 42px;
  }

  .customer-commerce .toolbar {
    gap: 10px;
  }

  .customer-commerce .toolbar input,
  .customer-commerce .toolbar select,
  .customer-commerce .toolbar button {
    min-height: 44px;
    font-size: 15px;
  }

  .customer-commerce .filter-result-count {
    margin-top: 14px;
  }

  .customer-commerce .product-list {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 16px;
  }

  .customer-commerce .thumb {
    aspect-ratio: 16 / 9;
  }

  .customer-commerce .product-item > div:nth-child(2) {
    padding: 14px 12px 8px;
  }

  .customer-commerce .product-item > div:last-child {
    padding: 12px;
  }

  .customer-commerce .customer-price-tiers {
    grid-template-columns: 1fr;
  }

  .customer-commerce .product-card-hint {
    font-size: 13px;
  }

  .customer-commerce .product-detail-panel {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    padding: 18px 16px;
  }

  .customer-commerce .product-detail-header {
    grid-template-columns: 1fr;
  }

  .customer-commerce .product-detail-header .ghost {
    width: 100%;
  }

  .customer-commerce .product-detail-purchase {
    padding: 14px;
  }

  .customer-commerce .detail-quantity-control {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }

  .customer-commerce .product-image-viewer-panel {
    max-height: calc(100vh - 20px);
  }
}

@media (max-width: 380px) {
  .customer-commerce .shell {
    width: calc(100vw - 14px);
  }

  .customer-commerce #dashboardView > .topbar {
    padding: 16px 12px !important;
  }

  .customer-commerce #dashboardView > .topbar h1 {
    font-size: 32px;
  }

  .customer-commerce .customer-topbar-actions {
    grid-template-columns: 1fr;
    grid-template-areas:
      "balance"
      "nav"
      "logout";
  }

  .customer-commerce .customer-page-nav {
    grid-template-columns: 1fr;
  }
}

/* Final customer mobile overrides: keep phone browsers compact and prevent date/filter overflow. */
@media (max-width: 640px) {
  .customer-commerce .shell {
    width: calc(100vw - 18px) !important;
    padding-top: 8px;
    padding-bottom: 24px;
  }

  .customer-commerce #dashboardView > .topbar {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 12px;
    margin-bottom: 14px;
    padding: 16px 14px !important;
  }

  .customer-commerce #dashboardView > .topbar h1 {
    font-size: clamp(30px, 9vw, 38px) !important;
    line-height: 1.05;
  }

  .customer-commerce #customerMeta {
    margin-top: 8px;
    font-size: 14px;
  }

  .customer-commerce .customer-topbar-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas:
      "balance logout"
      "nav nav";
    gap: 8px;
    margin-left: 0;
    width: 100%;
  }

  .customer-commerce .balance-pill {
    grid-area: balance;
    justify-content: center;
    min-width: 0;
    min-height: 42px;
    padding: 0 10px;
  }

  .customer-commerce .balance-pill strong {
    font-size: 22px;
  }

  .customer-commerce #logoutButton {
    grid-area: logout;
    min-height: 42px;
    padding: 0 14px;
  }

  .customer-commerce .customer-page-nav {
    grid-area: nav;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
    overflow: visible;
    white-space: normal;
  }

  .customer-commerce .customer-page-nav button {
    min-width: 0;
    min-height: 46px;
    padding: 0 8px;
    font-size: 16px;
  }

  .customer-commerce .customer-page-panel {
    min-height: auto;
    margin-top: 12px;
    padding: 16px 14px !important;
  }

  .customer-commerce .card .topbar {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 12px;
    padding: 0 0 12px;
  }

  .customer-commerce .card h2 {
    font-size: 28px;
  }

  .customer-commerce .toolbar {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px;
    margin: 10px 0 0;
    padding-top: 0;
  }

  .customer-commerce .toolbar > *,
  .customer-commerce .toolbar input,
  .customer-commerce .toolbar select,
  .customer-commerce .toolbar button {
    grid-column: auto !important;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 16px;
  }

  .customer-commerce .toolbar input,
  .customer-commerce .toolbar select,
  .customer-commerce .toolbar button {
    min-height: 44px;
  }

  .customer-commerce .toolbar input[type="date"] {
    appearance: auto;
    -webkit-appearance: auto;
  }

  .customer-commerce .log-filter-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .customer-commerce .filter-result-count {
    margin: 10px 0 12px;
  }

  .customer-commerce .product-list {
    grid-template-columns: 1fr !important;
    gap: 10px;
    margin-top: 12px;
  }

  .customer-commerce .product-item {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .customer-commerce .thumb {
    width: 96px;
    height: 100%;
    min-height: 128px;
    aspect-ratio: auto;
  }

  .customer-commerce .product-item > div:nth-child(2) {
    padding: 12px 12px 8px;
  }

  .customer-commerce .product-card-main strong {
    min-height: auto;
    font-size: 15px;
  }

  .customer-commerce .product-meta-line,
  .customer-commerce .product-sku-line {
    min-height: auto;
    -webkit-line-clamp: 1;
  }

  .customer-commerce .product-item > div:last-child {
    padding: 10px 12px 12px;
  }

  .customer-commerce .customer-price-tiers {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .customer-commerce .customer-price-tiers div {
    min-height: 38px;
    padding: 6px;
  }

  .customer-commerce .customer-price-tiers span {
    font-size: 11px;
  }

  .customer-commerce .customer-price-tiers strong {
    font-size: 14px;
  }

  .customer-commerce .cart-item,
  .customer-commerce .log-item,
  .customer-commerce .order-item {
    padding: 12px;
    font-size: 14px;
  }

  .customer-commerce .order-item p,
  .customer-commerce .log-item p {
    margin: 7px 0;
  }

  .customer-commerce .order-item strong,
  .customer-commerce .log-item strong {
    overflow-wrap: anywhere;
  }

  .customer-commerce .address-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .customer-commerce .shell {
    width: calc(100vw - 12px) !important;
  }

  .customer-commerce #dashboardView > .topbar {
    padding: 14px 12px !important;
  }

  .customer-commerce .customer-page-panel {
    padding: 14px 12px !important;
  }

  .customer-commerce .log-filter-toolbar {
    grid-template-columns: 1fr !important;
  }

  .customer-commerce .product-item {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .customer-commerce .thumb {
    width: 88px;
    min-height: 118px;
  }

  .customer-commerce .customer-price-tiers {
    grid-template-columns: 1fr;
  }
}

/* Extra compact pass for phones after all customer rules. */
@media (max-width: 640px) {
  .customer-commerce #dashboardView > .topbar {
    gap: 10px;
    padding: 12px !important;
  }

  .customer-commerce .brand-eyebrow {
    padding: 3px 7px;
    font-size: 12px;
  }

  .customer-commerce #dashboardView > .topbar h1 {
    margin-top: 6px;
    font-size: clamp(24px, 7.2vw, 30px) !important;
  }

  .customer-commerce #customerMeta {
    margin-top: 6px;
    font-size: 13px;
  }

  .customer-commerce .balance-pill,
  .customer-commerce #logoutButton {
    min-height: 38px;
  }

  .customer-commerce .balance-pill strong {
    font-size: 19px;
  }

  .customer-commerce .customer-page-nav button {
    min-height: 40px;
    font-size: 15px;
  }

  .customer-commerce .customer-page-panel {
    padding: 12px !important;
  }

  .customer-commerce .card h2 {
    font-size: 24px;
  }

  .customer-commerce .card .topbar {
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 10px;
  }

  .customer-commerce .card .topbar button,
  .customer-commerce .toolbar input,
  .customer-commerce .toolbar select,
  .customer-commerce .toolbar button {
    min-height: 40px;
  }

  .customer-commerce .product-item {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .customer-commerce .thumb {
    width: 82px;
    min-height: 108px;
  }
}

/* Phone-first tightening for real mobile browser chrome. */
@media (max-width: 640px) {
  .customer-commerce .shell {
    width: calc(100vw - 10px) !important;
    padding-top: 6px;
  }

  .customer-commerce #dashboardView > .topbar {
    gap: 8px;
    padding: 10px !important;
    margin-bottom: 10px;
  }

  .customer-commerce #dashboardView > .topbar h1 {
    margin-top: 4px;
    font-size: clamp(21px, 6.2vw, 26px) !important;
  }

  .customer-commerce #customerMeta {
    margin-top: 4px;
    font-size: 12px;
  }

  .customer-commerce .brand-eyebrow {
    font-size: 11px;
  }

  .customer-commerce .balance-pill,
  .customer-commerce #logoutButton {
    min-height: 34px;
    font-size: 13px;
  }

  .customer-commerce .balance-pill strong {
    font-size: 17px;
  }

  .customer-commerce .customer-page-nav {
    gap: 6px;
  }

  .customer-commerce .customer-page-nav button {
    min-height: 36px;
    font-size: 14px;
  }

  .customer-commerce .customer-page-panel {
    padding: 10px !important;
    margin-top: 10px;
  }

  .customer-commerce .card h2 {
    font-size: 21px;
  }

  .customer-commerce .card .topbar button,
  .customer-commerce .toolbar input,
  .customer-commerce .toolbar select,
  .customer-commerce .toolbar button {
    min-height: 36px;
    font-size: 14px !important;
  }

  .customer-commerce .toolbar input[type="date"] {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 10px;
    padding-right: 30px;
    overflow: hidden;
    line-height: 36px;
  }

  .customer-commerce .order-item,
  .customer-commerce .log-item {
    padding: 10px;
  }

  .customer-commerce .modal {
    padding: 6px;
    align-items: center;
  }

  .customer-commerce .product-detail-panel {
    width: calc(100vw - 12px) !important;
    max-height: calc(100dvh - 12px) !important;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 10px;
    overflow: hidden;
  }

  .customer-commerce .product-detail-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding-bottom: 8px;
  }

  .customer-commerce .product-detail-header h2 {
    font-size: 18px;
    line-height: 1.15;
  }

  .customer-commerce .product-detail-header .muted {
    margin-top: 4px;
    font-size: 12px;
  }

  .customer-commerce .product-detail-header button {
    min-height: 32px;
    padding: 0 10px;
    font-size: 13px;
  }

  .customer-commerce .product-detail-body {
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding-top: 8px;
    overflow: hidden;
  }

  .customer-commerce .product-detail-gallery {
    display: flex;
    gap: 6px;
    min-height: 54px;
    max-height: 58px;
    overflow-x: auto;
    overflow-y: hidden;
    align-content: center;
  }

  .customer-commerce .product-detail-image-button {
    flex: 0 0 54px;
    width: 54px;
  }

  .customer-commerce .product-detail-gallery img {
    width: 54px;
    height: 54px;
    aspect-ratio: auto;
    border-radius: 6px;
  }

  .customer-commerce .product-detail-info {
    min-height: 0;
    gap: 8px;
    overflow: hidden;
  }

  .customer-commerce .product-detail-table {
    max-height: min(45dvh, 330px);
    overflow: auto;
  }

  .customer-commerce .product-detail-table div {
    grid-template-columns: 70px minmax(0, 1fr);
    min-height: 26px;
  }

  .customer-commerce .product-detail-table strong,
  .customer-commerce .product-detail-table span {
    padding: 5px 7px;
    font-size: 12px;
    line-height: 1.25;
  }

  .customer-commerce .product-detail-purchase {
    position: static !important;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px;
  }

  .customer-commerce .product-detail-purchase span {
    margin-bottom: 5px;
    font-size: 12px;
  }

  .customer-commerce .detail-quantity-control {
    grid-template-columns: 32px minmax(56px, 82px) 32px;
    gap: 5px;
  }

  .customer-commerce .detail-quantity-control button,
  .customer-commerce .detail-quantity-control input,
  .customer-commerce #productDetailAddButton {
    min-height: 34px;
    font-size: 13px;
  }

  .customer-commerce #productDetailAddButton {
    min-width: 96px;
    padding: 0 10px;
  }
}

@media (max-width: 390px) {
  .customer-commerce #dashboardView > .topbar h1 {
    font-size: 22px !important;
  }

  .customer-commerce .product-detail-purchase {
    grid-template-columns: 1fr;
  }

  .customer-commerce #productDetailAddButton {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .customer-commerce {
    background: #eef3f6;
  }

  .customer-commerce .shell {
    width: calc(100vw - 18px);
    padding-top: 8px;
    padding-bottom: 24px;
  }

  .customer-commerce #dashboardView > .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 14px;
    padding: 16px 14px !important;
  }

  .customer-commerce #dashboardView > .topbar h1 {
    margin-top: 8px;
    font-size: clamp(30px, 9vw, 38px);
    line-height: 1.05;
  }

  .customer-commerce #customerMeta {
    margin-top: 8px;
    font-size: 14px;
  }

  .customer-commerce .brand-eyebrow {
    padding: 4px 8px;
    font-size: 13px;
  }

  .customer-commerce .customer-topbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "balance logout"
      "nav nav";
    gap: 8px;
    margin-left: 0;
    width: 100%;
  }

  .customer-commerce .balance-pill {
    grid-area: balance;
    justify-content: center;
    min-width: 0;
    min-height: 42px;
    padding: 0 10px;
  }

  .customer-commerce .balance-pill strong {
    font-size: 22px;
  }

  .customer-commerce #logoutButton {
    grid-area: logout;
    min-height: 42px;
    padding: 0 14px;
  }

  .customer-commerce .customer-page-nav {
    grid-area: nav;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    white-space: normal;
  }

  .customer-commerce .customer-page-nav button {
    min-width: 0;
    min-height: 46px;
    padding: 0 8px;
    font-size: 16px;
  }

  .customer-commerce .customer-page-panel {
    min-height: auto;
    margin-top: 12px;
    padding: 16px 14px;
  }

  .customer-commerce .card .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 12px;
    padding: 0 0 12px;
  }

  .customer-commerce .card h2 {
    font-size: 28px;
  }

  .customer-commerce .card .topbar button,
  .customer-commerce .toolbar button {
    min-height: 42px;
  }

  .customer-commerce .toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 10px 0 0;
    padding-top: 0;
  }

  .customer-commerce .toolbar > *,
  .customer-commerce .toolbar input,
  .customer-commerce .toolbar select,
  .customer-commerce .toolbar button {
    grid-column: auto;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 16px;
  }

  .customer-commerce .toolbar input,
  .customer-commerce .toolbar select {
    min-height: 44px;
    padding: 0 12px;
  }

  .customer-commerce .toolbar input[type="date"] {
    appearance: auto;
    -webkit-appearance: auto;
  }

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

  .customer-commerce .filter-result-count {
    margin: 10px 0 12px;
  }

  .customer-commerce .product-list {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 12px;
  }

  .customer-commerce .product-item {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 0;
  }

  .customer-commerce .thumb {
    width: 96px;
    height: 100%;
    min-height: 128px;
    aspect-ratio: auto;
  }

  .customer-commerce .product-item > div:nth-child(2) {
    padding: 12px 12px 8px;
  }

  .customer-commerce .product-card-main strong {
    min-height: auto;
    font-size: 15px;
  }

  .customer-commerce .product-meta-line,
  .customer-commerce .product-sku-line {
    min-height: auto;
    -webkit-line-clamp: 1;
  }

  .customer-commerce .product-item > div:last-child {
    padding: 10px 12px 12px;
  }

  .customer-commerce .customer-price-tiers {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .customer-commerce .customer-price-tiers div {
    min-height: 38px;
    padding: 6px;
  }

  .customer-commerce .customer-price-tiers span {
    font-size: 11px;
  }

  .customer-commerce .customer-price-tiers strong {
    font-size: 14px;
  }

  .customer-commerce .cart-list,
  .customer-commerce .log-list,
  .customer-commerce .order-list {
    gap: 10px;
  }

  .customer-commerce .cart-item,
  .customer-commerce .log-item,
  .customer-commerce .order-item {
    padding: 12px;
    font-size: 14px;
  }

  .customer-commerce .order-item p,
  .customer-commerce .log-item p {
    margin: 7px 0;
  }

  .customer-commerce .order-item strong,
  .customer-commerce .log-item strong {
    overflow-wrap: anywhere;
  }

  .customer-commerce .button-row {
    gap: 8px;
  }

  .customer-commerce .button-row button {
    min-height: 40px;
    padding: 0 12px;
  }

  .customer-commerce .address-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .customer-commerce .shell {
    width: calc(100vw - 12px);
  }

  .customer-commerce #dashboardView > .topbar,
  .customer-commerce .customer-page-panel {
    border-radius: 7px;
  }

  .customer-commerce #dashboardView > .topbar {
    padding: 14px 12px !important;
  }

  .customer-commerce .customer-page-panel {
    padding: 14px 12px;
  }

  .customer-commerce #dashboardView > .topbar h1 {
    font-size: 30px;
  }

  .customer-commerce .customer-page-nav button {
    min-height: 44px;
    font-size: 15px;
  }

  .customer-commerce .log-filter-toolbar {
    grid-template-columns: 1fr;
  }

  .customer-commerce .product-item {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .customer-commerce .thumb {
    width: 88px;
    min-height: 118px;
  }

  .customer-commerce .customer-price-tiers {
    grid-template-columns: 1fr;
  }
}

/* Premium login entry: generated image background with visible login/register tabs. */
.customer-commerce .auth-shell {
  position: relative;
  min-height: calc(100vh - 56px);
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(8, 13, 24, 0.78) 0%, rgba(32, 17, 17, 0.46) 46%, rgba(255, 255, 255, 0.06) 100%),
    url("/assets/login-hero-bg.png") center / cover no-repeat;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.16);
}

.customer-commerce .auth-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0)),
    linear-gradient(120deg, rgba(215, 25, 32, 0.28), rgba(240, 90, 40, 0.1) 45%, rgba(17, 24, 39, 0.18));
  pointer-events: none;
}

.customer-commerce .auth-shell > * {
  position: relative;
  z-index: 1;
}

.customer-commerce .auth-shell .brand {
  min-height: auto;
  align-self: end;
  display: grid;
  align-content: end;
  gap: 18px;
  padding: 38px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(135deg, rgba(10, 16, 28, 0.58), rgba(185, 28, 28, 0.28));
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
}

.customer-commerce .auth-shell .brand::before {
  width: 6px;
  background: linear-gradient(180deg, #ffffff, rgba(255, 255, 255, 0.35));
}

.customer-commerce .auth-shell .brand-eyebrow {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.customer-commerce .auth-shell .brand h1 {
  width: min(680px, 100%);
  color: #ffffff;
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}

.customer-commerce .auth-panel {
  position: relative;
  align-self: center;
  border-color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(18px);
}

.customer-commerce .auth-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(90deg, var(--commerce-red), var(--commerce-orange), #225a5c);
}

.customer-commerce .auth-panel .tabs {
  position: relative;
  z-index: 2;
  gap: 8px;
  margin: 4px 0 22px;
  padding: 7px;
  border: 1px solid #dfe7ef;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}

.customer-commerce .auth-panel .tab {
  min-height: 44px;
  border: 1px solid transparent;
  color: #162033;
  background: #f3f6fa;
  font-size: 16px;
  font-weight: 900;
}

.customer-commerce .auth-panel .tab.active {
  border-color: var(--commerce-red);
  background: linear-gradient(135deg, var(--commerce-red), var(--commerce-orange));
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(215, 25, 32, 0.18);
}

.customer-commerce .auth-panel .field span,
.customer-commerce .auth-panel .remember-row {
  color: #1f2937;
}

.customer-commerce .auth-panel input,
.customer-commerce .auth-panel select,
.customer-commerce .auth-panel textarea {
  min-height: 46px;
  border-color: #cbd6e2;
  background: rgba(255, 255, 255, 0.96);
}

.customer-commerce .auth-panel #submitButton {
  min-height: 48px;
  min-width: 150px;
  font-size: 16px;
}

.customer-commerce .auth-panel #forgotPasswordButton,
.customer-commerce .auth-panel .password-row .ghost {
  min-height: 46px;
  background: #fff7f3;
}

@media (max-width: 900px) {
  .customer-commerce .auth-shell {
    padding: 20px;
    background:
      linear-gradient(180deg, rgba(8, 13, 24, 0.7), rgba(215, 25, 32, 0.28)),
      url("/assets/login-hero-bg.png") center / cover no-repeat;
  }

  .customer-commerce .auth-shell .brand {
    min-height: 190px;
    padding: 26px;
  }

  .customer-commerce .auth-shell .brand h1 {
    font-size: 36px;
  }
}

@media (max-width: 640px) {
  .customer-commerce .auth-shell {
    width: 100%;
    gap: 14px;
    padding: 12px;
  }

  .customer-commerce .auth-shell .brand {
    min-height: 160px;
    padding: 22px 18px;
  }

  .customer-commerce .auth-shell .brand h1 {
    font-size: 30px;
  }

  .customer-commerce .auth-panel {
    padding: 18px 16px;
  }

  .customer-commerce .auth-panel .tabs {
    margin-bottom: 18px;
  }

  .customer-commerce .auth-panel .tab {
    min-height: 46px;
    font-size: 15px;
  }
}

/* Login background visibility refinement. */
.customer-commerce .auth-shell {
  background:
    linear-gradient(90deg, rgba(8, 13, 24, 0.16) 0%, rgba(32, 17, 17, 0.08) 44%, rgba(255, 255, 255, 0.06) 100%),
    url("/assets/login-hero-bg.png") center center / cover no-repeat;
}

.customer-commerce .auth-shell::before {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    linear-gradient(120deg, rgba(215, 25, 32, 0.06), rgba(240, 90, 40, 0.02) 48%, rgba(17, 24, 39, 0.04));
}

.customer-commerce .auth-shell .brand {
  align-self: stretch;
  align-content: center;
  padding: 48px;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.customer-commerce .auth-shell .brand::before {
  display: none;
}

.customer-commerce .auth-shell .brand-eyebrow {
  background: rgba(12, 18, 31, 0.5);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.customer-commerce .auth-shell .brand h1 {
  font-size: 50px;
  text-shadow: 0 16px 36px rgba(0, 0, 0, 0.34);
}

@media (max-width: 900px) {
  .customer-commerce .auth-shell {
    background:
      linear-gradient(180deg, rgba(8, 13, 24, 0.34), rgba(215, 25, 32, 0.1)),
      url("/assets/login-hero-bg.png") left center / cover no-repeat;
  }

  .customer-commerce .auth-shell .brand {
    min-height: 210px;
    padding: 30px 22px;
  }
}

@media (max-width: 640px) {
  .customer-commerce .auth-shell {
    background:
      linear-gradient(180deg, rgba(8, 13, 24, 0.3), rgba(215, 25, 32, 0.1)),
      url("/assets/login-hero-bg.png") 28% center / cover no-repeat;
  }

  .customer-commerce .auth-shell .brand {
    min-height: 190px;
  }

  .customer-commerce .auth-shell .brand h1 {
    font-size: 34px;
  }
}

/* Customer commerce polish: app-like rhythm across desktop, tablet, and phone. */
.customer-commerce {
  --commerce-red: #d71920;
  --commerce-red-dark: #b91c1c;
  --commerce-orange: #f05a28;
  --commerce-ink: #111827;
  --commerce-muted: #667085;
  --commerce-line: #e6edf3;
  min-width: 0;
  background:
    linear-gradient(180deg, #f5f6f8 0%, #eef1f5 56%, #f7f8fa 100%);
}

.customer-commerce .shell {
  width: min(1400px, calc(100vw - 112px));
  padding: 28px 0 56px;
}

.customer-commerce .auth-shell {
  min-height: calc(100vh - 56px);
  grid-template-columns: minmax(0, 1.06fr) minmax(360px, 430px);
  gap: 34px;
  align-items: stretch;
}

.customer-commerce .brand,
.customer-commerce .auth-panel,
.customer-commerce #dashboardView > .topbar,
.customer-commerce .customer-page-panel {
  border: 1px solid rgba(230, 237, 243, 0.92);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.07);
}

.customer-commerce .brand {
  position: relative;
  min-height: 560px;
  display: grid;
  align-content: end;
  gap: 18px;
  overflow: hidden;
  padding: 42px;
  background:
    linear-gradient(135deg, rgba(215, 25, 32, 0.96), rgba(240, 90, 40, 0.9)),
    url("/api/placeholder.svg?sku=XINMEI&n=B2B") center / cover;
  color: #ffffff;
}

.customer-commerce .brand::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 8px;
  background: #ffffff;
  opacity: 0.9;
}

.customer-commerce .brand-eyebrow {
  width: fit-content;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.15);
  color: inherit;
  font-weight: 900;
}

.customer-commerce .brand h1 {
  position: relative;
  max-width: 720px;
  color: inherit;
  font-size: 46px;
  line-height: 1.08;
}

.customer-commerce .auth-panel {
  align-self: center;
  padding: 30px;
  background: rgba(255, 255, 255, 0.96);
}

.customer-commerce .tabs {
  background: #f2f4f7;
}

.customer-commerce .tab.active {
  color: var(--commerce-red);
}

.customer-commerce .primary {
  background: linear-gradient(135deg, var(--commerce-red), var(--commerce-orange));
  color: #ffffff;
  box-shadow: 0 12px 22px rgba(215, 25, 32, 0.18);
}

.customer-commerce .primary:hover {
  background: linear-gradient(135deg, var(--commerce-red-dark), var(--commerce-red));
}

.customer-commerce button:disabled,
.customer-commerce button[aria-busy="true"] {
  cursor: not-allowed;
  opacity: 0.68;
  box-shadow: none;
}

.customer-commerce .ghost,
.customer-commerce .secondary {
  border: 1px solid #f2cbbf;
  background: #fff5f0;
  color: var(--commerce-red);
}

.customer-commerce #dashboardView > .topbar {
  grid-template-columns: minmax(260px, 1fr) minmax(360px, auto);
  gap: 24px;
  margin-bottom: 26px;
  background: rgba(255, 255, 255, 0.98);
}

.customer-commerce #dashboardView > .topbar h1 {
  font-size: 36px;
  line-height: 1.1;
}

.customer-commerce #customerMeta {
  max-width: 100%;
  color: #5f6b7a;
  font-weight: 700;
}

.customer-commerce .customer-topbar-actions {
  grid-template-columns: auto auto;
  gap: 12px;
}

.customer-commerce .balance-pill {
  border-color: #ffd6c9;
  background: #fff7f2;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.customer-commerce .customer-page-nav {
  grid-template-columns: repeat(4, minmax(96px, auto));
}

.customer-commerce .customer-page-nav button,
.customer-commerce #logoutButton {
  min-height: 40px;
  border-radius: 6px;
}

.customer-commerce .customer-page-nav button.active {
  border-color: var(--commerce-red);
  background: linear-gradient(135deg, var(--commerce-red), var(--commerce-orange));
}

.customer-commerce .customer-page-panel {
  min-height: calc(100vh - 322px);
  padding: 26px;
  background: rgba(255, 255, 255, 0.98);
}

.customer-commerce .card .topbar {
  margin-bottom: 18px;
  padding-bottom: 18px;
}

.customer-commerce .card h2 {
  font-size: 24px;
  line-height: 1.2;
}

.customer-commerce .toolbar {
  grid-template-columns: minmax(220px, 1.1fr) minmax(180px, 0.82fr) minmax(180px, 0.82fr) minmax(140px, 0.55fr);
  padding-top: 6px;
}

.customer-commerce .filter-result-count {
  margin: 14px 0 0;
}

.customer-commerce .product-list {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.customer-commerce .product-item {
  border-color: #e9eef4;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.customer-commerce .thumb {
  aspect-ratio: 4 / 3;
  background: #eef6f6;
}

.customer-commerce .product-card-main strong {
  min-height: 38px;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.customer-commerce .product-meta-line,
.customer-commerce .product-sku-line {
  min-height: 20px;
  margin: 0;
  overflow-wrap: anywhere;
}

.customer-commerce .product-meta-line {
  color: #667085;
}

.customer-commerce .product-sku-line {
  color: #475569;
  font-size: 13px;
}

.customer-commerce .product-item p {
  white-space: normal;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.customer-commerce .customer-price-tiers {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.customer-commerce .customer-price-tiers div {
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #d9ecea;
  border-radius: 6px;
  background: #f6fbfa;
}

.customer-commerce .customer-price-tiers span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.customer-commerce .customer-price-tiers strong {
  color: var(--commerce-red);
}

.customer-commerce .image-list img {
  border-radius: 5px;
}

.customer-commerce .cart-list,
.customer-commerce .log-list,
.customer-commerce .order-list {
  display: grid;
  gap: 12px;
}

.customer-commerce .cart-item {
  padding: 16px;
  border: 1px solid var(--commerce-line);
  background: #ffffff;
}

.customer-commerce .cart-item strong {
  font-size: 16px;
}

.customer-commerce .cart-quantity-actions {
  grid-template-columns: 42px 92px 42px auto;
  display: grid;
}

.customer-commerce .cart-quantity-actions button,
.customer-commerce .cart-quantity-input {
  min-height: 42px;
}

.customer-commerce .cart-quantity-actions .cart-delete-button {
  padding: 0 16px;
  background: #fee7e2;
}

.customer-commerce .address-grid {
  margin-top: 4px;
}

.customer-commerce #submitOrderButton {
  width: min(360px, 100%);
  min-height: 46px;
}

.customer-commerce .product-detail-panel {
  width: min(960px, calc(100vw - 64px));
}

.customer-commerce .product-detail-purchase {
  position: sticky;
  bottom: 0;
}

.customer-commerce .product-image-viewer-stage {
  min-height: 520px;
}

@media (min-width: 1540px) {
  .customer-commerce .shell {
    width: min(1480px, calc(100vw - 180px));
  }

  .customer-commerce .product-list {
    grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  }
}

@media (max-width: 1180px) {
  .customer-commerce .shell {
    width: calc(100vw - 56px);
  }

  .customer-commerce .auth-shell {
    grid-template-columns: minmax(0, 1fr) minmax(330px, 410px);
    gap: 24px;
  }

  .customer-commerce #dashboardView > .topbar {
    grid-template-columns: 1fr;
  }

  .customer-commerce .customer-topbar-actions {
    justify-content: stretch;
  }

  .customer-commerce .customer-page-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .customer-commerce .shell {
    width: calc(100vw - 36px);
    padding-top: 20px;
  }

  .customer-commerce .auth-shell {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .customer-commerce .brand {
    min-height: 240px;
    padding: 30px 28px;
  }

  .customer-commerce .brand h1 {
    font-size: 38px;
  }

  .customer-commerce .auth-panel {
    align-self: stretch;
  }

  .customer-commerce .customer-page-panel {
    min-height: auto;
  }

  .customer-commerce .toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .customer-commerce .toolbar > :first-child,
  .customer-commerce .toolbar > :last-child {
    grid-column: 1 / -1;
  }

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

  .customer-commerce .product-detail-panel {
    width: calc(100vw - 36px);
  }
}

@media (max-width: 640px) {
  .customer-commerce .shell {
    width: calc(100vw - 22px);
    padding-bottom: 36px;
  }

  .customer-commerce .brand {
    min-height: 184px;
    padding: 24px 22px;
  }

  .customer-commerce .brand h1 {
    font-size: 32px;
  }

  .customer-commerce .auth-panel,
  .customer-commerce .customer-page-panel {
    padding: 18px 16px;
  }

  .customer-commerce #dashboardView > .topbar {
    padding: 18px 16px !important;
  }

  .customer-commerce #dashboardView > .topbar h1 {
    max-width: none;
    font-size: 30px;
  }

  .customer-commerce .customer-topbar-actions {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "balance logout"
      "nav nav";
  }

  .customer-commerce .customer-page-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .customer-commerce .customer-page-nav button,
  .customer-commerce #logoutButton {
    min-height: 44px;
  }

  .customer-commerce .toolbar {
    grid-template-columns: 1fr;
  }

  .customer-commerce .toolbar > * {
    grid-column: auto;
  }

  .customer-commerce .product-list {
    grid-template-columns: 1fr;
  }

  .customer-commerce .product-card-main strong {
    min-height: auto;
  }

  .customer-commerce .product-meta-line,
  .customer-commerce .product-sku-line {
    -webkit-line-clamp: 2;
  }

  .customer-commerce .cart-quantity-actions {
    width: 100%;
    grid-template-columns: 44px minmax(86px, 1fr) 44px;
  }

  .customer-commerce .cart-quantity-actions .cart-delete-button {
    grid-column: 1 / -1;
  }

  .customer-commerce .product-detail-body {
    gap: 18px;
  }

  .customer-commerce .product-detail-panel {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 18px);
  }

  .customer-commerce .product-detail-purchase {
    position: static;
  }

  .customer-commerce .product-image-viewer-stage {
    min-height: 360px;
  }
}

@media (max-width: 380px) {
  .customer-commerce .shell {
    width: calc(100vw - 14px);
  }

  .customer-commerce .brand h1,
  .customer-commerce #dashboardView > .topbar h1 {
    font-size: 28px;
  }

  .customer-commerce .customer-topbar-actions {
    grid-template-columns: 1fr;
    grid-template-areas:
      "balance"
      "nav"
      "logout";
  }

  .customer-commerce .customer-page-nav {
    grid-template-columns: 1fr;
  }
}

/* Final customer mobile overrides: keep phone browsers compact and prevent date/filter overflow. */
@media (max-width: 640px) {
  .customer-commerce .shell {
    width: calc(100vw - 18px) !important;
    padding-top: 8px;
    padding-bottom: 24px;
  }

  .customer-commerce #dashboardView > .topbar {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 12px;
    margin-bottom: 14px;
    padding: 16px 14px !important;
  }

  .customer-commerce #dashboardView > .topbar h1 {
    font-size: clamp(30px, 9vw, 38px) !important;
    line-height: 1.05;
  }

  .customer-commerce #customerMeta {
    margin-top: 8px;
    font-size: 14px;
  }

  .customer-commerce .customer-topbar-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas:
      "balance logout"
      "nav nav";
    gap: 8px;
    margin-left: 0;
    width: 100%;
  }

  .customer-commerce .balance-pill {
    grid-area: balance;
    justify-content: center;
    min-width: 0;
    min-height: 42px;
    padding: 0 10px;
  }

  .customer-commerce .balance-pill strong {
    font-size: 22px;
  }

  .customer-commerce #logoutButton {
    grid-area: logout;
    min-height: 42px;
    padding: 0 14px;
  }

  .customer-commerce .customer-page-nav {
    grid-area: nav;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
    overflow: visible;
    white-space: normal;
  }

  .customer-commerce .customer-page-nav button {
    min-width: 0;
    min-height: 46px;
    padding: 0 8px;
    font-size: 16px;
  }

  .customer-commerce .customer-page-panel {
    min-height: auto;
    margin-top: 12px;
    padding: 16px 14px !important;
  }

  .customer-commerce .card .topbar {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 12px;
    padding: 0 0 12px;
  }

  .customer-commerce .card h2 {
    font-size: 28px;
  }

  .customer-commerce .toolbar {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px;
    margin: 10px 0 0;
    padding-top: 0;
  }

  .customer-commerce .toolbar > *,
  .customer-commerce .toolbar input,
  .customer-commerce .toolbar select,
  .customer-commerce .toolbar button {
    grid-column: auto !important;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 16px;
  }

  .customer-commerce .toolbar input,
  .customer-commerce .toolbar select,
  .customer-commerce .toolbar button {
    min-height: 44px;
  }

  .customer-commerce .toolbar input[type="date"] {
    appearance: auto;
    -webkit-appearance: auto;
  }

  .customer-commerce .log-filter-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .customer-commerce .filter-result-count {
    margin: 10px 0 12px;
  }

  .customer-commerce .product-list {
    grid-template-columns: 1fr !important;
    gap: 10px;
    margin-top: 12px;
  }

  .customer-commerce .product-item {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .customer-commerce .thumb {
    width: 96px;
    height: 100%;
    min-height: 128px;
    aspect-ratio: auto;
  }

  .customer-commerce .product-item > div:nth-child(2) {
    padding: 12px 12px 8px;
  }

  .customer-commerce .product-card-main strong {
    min-height: auto;
    font-size: 15px;
  }

  .customer-commerce .product-meta-line,
  .customer-commerce .product-sku-line {
    min-height: auto;
    -webkit-line-clamp: 1;
  }

  .customer-commerce .product-item > div:last-child {
    padding: 10px 12px 12px;
  }

  .customer-commerce .customer-price-tiers {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .customer-commerce .customer-price-tiers div {
    min-height: 38px;
    padding: 6px;
  }

  .customer-commerce .customer-price-tiers span {
    font-size: 11px;
  }

  .customer-commerce .customer-price-tiers strong {
    font-size: 14px;
  }

  .customer-commerce .cart-item,
  .customer-commerce .log-item,
  .customer-commerce .order-item {
    padding: 12px;
    font-size: 14px;
  }

  .customer-commerce .order-item p,
  .customer-commerce .log-item p {
    margin: 7px 0;
  }

  .customer-commerce .order-item strong,
  .customer-commerce .log-item strong {
    overflow-wrap: anywhere;
  }

  .customer-commerce .address-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .customer-commerce .shell {
    width: calc(100vw - 12px) !important;
  }

  .customer-commerce #dashboardView > .topbar {
    padding: 14px 12px !important;
  }

  .customer-commerce .customer-page-panel {
    padding: 14px 12px !important;
  }

  .customer-commerce .log-filter-toolbar {
    grid-template-columns: 1fr !important;
  }

  .customer-commerce .product-item {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .customer-commerce .thumb {
    width: 88px;
    min-height: 118px;
  }

  .customer-commerce .customer-price-tiers {
    grid-template-columns: 1fr;
  }
}
/* Extra compact pass for phones after all customer rules. */
@media (max-width: 640px) {
  .customer-commerce #dashboardView > .topbar {
    gap: 10px;
    padding: 12px !important;
  }

  .customer-commerce .brand-eyebrow {
    padding: 3px 7px;
    font-size: 12px;
  }

  .customer-commerce #dashboardView > .topbar h1 {
    margin-top: 6px;
    font-size: clamp(24px, 7.2vw, 30px) !important;
  }

  .customer-commerce #customerMeta {
    margin-top: 6px;
    font-size: 13px;
  }

  .customer-commerce .balance-pill,
  .customer-commerce #logoutButton {
    min-height: 38px;
  }

  .customer-commerce .balance-pill strong {
    font-size: 19px;
  }

  .customer-commerce .customer-page-nav button {
    min-height: 40px;
    font-size: 15px;
  }

  .customer-commerce .customer-page-panel {
    padding: 12px !important;
  }

  .customer-commerce .card h2 {
    font-size: 24px;
  }

  .customer-commerce .card .topbar {
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 10px;
  }

  .customer-commerce .card .topbar button,
  .customer-commerce .toolbar input,
  .customer-commerce .toolbar select,
  .customer-commerce .toolbar button {
    min-height: 40px;
  }

  .customer-commerce .product-item {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .customer-commerce .thumb {
    width: 82px;
    min-height: 108px;
  }
}

/* Absolute final phone pass: smaller header, contained dates, one-screen detail modal. */
@media (max-width: 640px) {
  .customer-commerce .shell {
    width: calc(100vw - 8px) !important;
    padding-top: 5px !important;
  }

  .customer-commerce #dashboardView > .topbar {
    gap: 7px !important;
    padding: 9px !important;
    margin-bottom: 9px !important;
  }

  .customer-commerce #dashboardView > .topbar h1 {
    margin-top: 3px !important;
    font-size: clamp(20px, 5.8vw, 24px) !important;
    line-height: 1.08 !important;
  }

  .customer-commerce #customerMeta {
    margin-top: 3px !important;
    font-size: 12px !important;
  }

  .customer-commerce .brand-eyebrow {
    padding: 2px 6px !important;
    font-size: 11px !important;
  }

  .customer-commerce .balance-pill,
  .customer-commerce #logoutButton {
    min-height: 32px !important;
    font-size: 12px !important;
  }

  .customer-commerce .balance-pill strong {
    font-size: 16px !important;
  }

  .customer-commerce .customer-page-nav {
    gap: 5px !important;
  }

  .customer-commerce .customer-page-nav button {
    min-height: 34px !important;
    font-size: 13px !important;
  }

  .customer-commerce .customer-page-panel {
    padding: 9px !important;
    margin-top: 9px !important;
  }

  .customer-commerce .card h2 {
    font-size: 20px !important;
  }

  .customer-commerce .toolbar input,
  .customer-commerce .toolbar select,
  .customer-commerce .toolbar button {
    min-height: 34px !important;
    font-size: 13px !important;
  }

  .customer-commerce .toolbar input[type="date"] {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 26px 0 8px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    line-height: 34px !important;
  }

  .customer-commerce .modal {
    padding: 4px !important;
    align-items: center !important;
  }

  .customer-commerce .product-detail-panel {
    width: calc(100vw - 8px) !important;
    max-height: calc(100dvh - 8px) !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    padding: 8px !important;
    overflow: hidden !important;
  }

  .customer-commerce .product-detail-header {
    gap: 6px !important;
    padding-bottom: 6px !important;
  }

  .customer-commerce .product-detail-header h2 {
    font-size: 17px !important;
    line-height: 1.12 !important;
  }

  .customer-commerce .product-detail-header .muted {
    margin-top: 3px !important;
    font-size: 11px !important;
  }

  .customer-commerce .product-detail-header button {
    min-height: 30px !important;
    padding: 0 9px !important;
    font-size: 12px !important;
  }

  .customer-commerce .product-detail-body {
    min-height: 0 !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 6px !important;
    padding-top: 6px !important;
    overflow: hidden !important;
  }

  .customer-commerce .product-detail-gallery {
    display: flex !important;
    gap: 5px !important;
    min-height: 48px !important;
    max-height: 50px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }

  .customer-commerce .product-detail-image-button,
  .customer-commerce .product-detail-gallery img {
    flex: 0 0 48px !important;
    width: 48px !important;
    height: 48px !important;
  }

  .customer-commerce .product-detail-info {
    min-height: 0 !important;
    gap: 6px !important;
    overflow: hidden !important;
  }

  .customer-commerce .product-detail-table {
    max-height: min(42dvh, 300px) !important;
    overflow: auto !important;
  }

  .customer-commerce .product-detail-table div {
    grid-template-columns: 64px minmax(0, 1fr) !important;
    min-height: 23px !important;
  }

  .customer-commerce .product-detail-table strong,
  .customer-commerce .product-detail-table span {
    padding: 4px 6px !important;
    font-size: 11px !important;
    line-height: 1.2 !important;
  }

  .customer-commerce .product-detail-purchase {
    position: static !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 6px !important;
    padding: 6px !important;
  }

  .customer-commerce .product-detail-purchase span {
    margin-bottom: 4px !important;
    font-size: 11px !important;
  }

  .customer-commerce .detail-quantity-control {
    grid-template-columns: 30px minmax(50px, 74px) 30px !important;
    gap: 4px !important;
  }

  .customer-commerce .detail-quantity-control button,
  .customer-commerce .detail-quantity-control input,
  .customer-commerce #productDetailAddButton {
    min-height: 32px !important;
    font-size: 12px !important;
  }

  .customer-commerce #productDetailAddButton {
    min-width: 88px !important;
    padding: 0 8px !important;
  }
}

@media (max-width: 390px) {
  .customer-commerce #dashboardView > .topbar h1 {
    font-size: 20px !important;
  }

  .customer-commerce .product-detail-purchase {
    grid-template-columns: 1fr !important;
  }

  .customer-commerce #productDetailAddButton {
    width: 100% !important;
  }
}

/* Final real-phone compact header and date controls. */
@media (max-width: 640px) {
  .customer-commerce #dashboardView > .topbar {
    padding: 8px !important;
  }

  .customer-commerce #dashboardView > .topbar h1 {
    font-size: clamp(18px, 5.1vw, 22px) !important;
  }

  .customer-commerce .customer-topbar-actions {
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas:
      "balance logout"
      "nav nav" !important;
    gap: 5px !important;
  }

  .customer-commerce .balance-pill,
  .customer-commerce #logoutButton {
    min-height: 30px !important;
    padding: 0 8px !important;
  }

  .customer-commerce .balance-pill {
    justify-content: center !important;
  }

  .customer-commerce .balance-pill span {
    font-size: 11px !important;
  }

  .customer-commerce .balance-pill strong {
    font-size: 15px !important;
  }

  .customer-commerce .customer-page-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 4px !important;
  }

  .customer-commerce .customer-page-nav button {
    min-height: 30px !important;
    padding: 0 3px !important;
    font-size: 12px !important;
  }

  .customer-commerce .customer-page-panel {
    margin-top: 8px !important;
  }

  .customer-commerce .toolbar input[type="date"] {
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 22px 0 6px !important;
    font-size: 12px !important;
    line-height: 32px !important;
  }

  .customer-commerce .toolbar input[type="date"]::-webkit-date-and-time-value {
    min-height: 32px;
    text-align: left;
  }
}

/* Final product purchase mobile layout requested by the client. */
@media (max-width: 640px) {
  .customer-commerce #dashboardView > .topbar {
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    align-items: start !important;
  }

  .customer-commerce #dashboardView > .topbar > div:first-child {
    grid-column: 1 / 2 !important;
    min-width: 0 !important;
  }

  .customer-commerce .customer-topbar-actions {
    display: contents !important;
  }

  .customer-commerce .balance-pill {
    grid-column: 2 / 3 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    max-width: 118px !important;
    overflow: hidden !important;
  }

  .customer-commerce #logoutButton {
    grid-column: 3 / 4 !important;
    grid-row: 1 !important;
    justify-self: end !important;
  }

  .customer-commerce .customer-page-nav {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .toolbar {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  .customer-commerce #keywordInput {
    grid-column: 1 / 4 !important;
    grid-row: 1 !important;
  }

  .customer-commerce #clearCatalogFiltersButton {
    grid-column: 4 / 5 !important;
    grid-row: 1 !important;
    min-width: 0 !important;
    padding: 0 4px !important;
    font-size: 12px !important;
  }

  .customer-commerce #brandFilterInput {
    grid-column: 1 / 3 !important;
    grid-row: 2 !important;
  }

  .customer-commerce #categoryFilterInput {
    grid-column: 3 / 5 !important;
    grid-row: 2 !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .toolbar input,
  .customer-commerce [data-customer-page-panel="products"] .toolbar select,
  .customer-commerce [data-customer-page-panel="products"] .toolbar button {
    height: 34px !important;
    min-height: 34px !important;
  }

  .customer-commerce .product-item {
    grid-template-columns: 84px minmax(0, 1fr) !important;
    align-items: stretch !important;
  }

  .customer-commerce .thumb {
    width: 84px !important;
    height: 100% !important;
    min-height: 132px !important;
    object-fit: cover !important;
  }

  .customer-commerce .image-list {
    display: none !important;
  }

  .customer-commerce .product-card-buy {
    grid-column: 1 / -1 !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    padding: 8px !important;
    border-top: 0 !important;
  }

  .customer-commerce .customer-price-tiers {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .customer-commerce .customer-price-tiers div {
    min-width: 0 !important;
    min-height: 52px !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    place-items: center !important;
    padding: 6px 4px !important;
    text-align: center !important;
  }

  .customer-commerce .customer-price-tiers span {
    font-size: 12px !important;
  }

  .customer-commerce .customer-price-tiers strong {
    font-size: 15px !important;
  }

  .customer-commerce .customer-price-tiers small {
    margin: 0 !important;
    font-size: 11px !important;
    line-height: 1.1 !important;
  }

  .customer-commerce .product-card-hint {
    margin: 0 !important;
    color: var(--commerce-red) !important;
    font-size: 13px !important;
  }
}

/* Final mobile date, logs, orders, and product-card fixes. */
@media (max-width: 640px) {
  .customer-commerce .mobile-date-field {
    min-width: 0 !important;
    width: 100% !important;
    height: 34px !important;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 0 7px !important;
    border: 1px solid #cbd9e3 !important;
    border-radius: 6px !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .customer-commerce .mobile-date-field span {
    color: #64748b !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  .customer-commerce .mobile-date-field input[type="date"] {
    min-width: 0 !important;
    width: 100% !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #111827 !important;
    font-size: 12px !important;
    line-height: 30px !important;
  }

  .customer-commerce .mobile-date-field input[type="date"]:focus {
    box-shadow: none !important;
  }

  .customer-commerce .log-filter-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  .customer-commerce .log-filter-toolbar .mobile-date-field:first-child {
    grid-column: 1 / 2 !important;
    grid-row: 1 !important;
  }

  .customer-commerce .log-filter-toolbar .mobile-date-field:nth-child(2) {
    grid-column: 2 / 3 !important;
    grid-row: 1 !important;
  }

  .customer-commerce #searchLogsButton {
    grid-column: 1 / 2 !important;
    grid-row: 2 !important;
  }

  .customer-commerce #clearLogFiltersButton {
    grid-column: 2 / 3 !important;
    grid-row: 2 !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] .topbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 10px !important;
    margin-bottom: 12px !important;
    padding-bottom: 12px !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] .topbar h2 {
    margin: 0 !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] .topbar .muted {
    margin-top: 6px !important;
  }

  .customer-commerce #refreshOrdersButton.icon-refresh-button {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    display: inline-grid !important;
    place-items: center !important;
    align-self: start !important;
    justify-self: end !important;
    font-size: 24px !important;
    line-height: 1 !important;
    font-weight: 900 !important;
  }

  .customer-commerce #refreshOrdersButton.icon-refresh-button span {
    transform: translateY(-1px);
  }

  .customer-commerce #orderKeywordInput,
  .customer-commerce #orderStatusFilterInput {
    grid-row: 1 !important;
    min-width: 0 !important;
  }

  .customer-commerce #orderKeywordInput {
    grid-column: 1 / 2 !important;
  }

  .customer-commerce #orderStatusFilterInput {
    grid-column: 2 / 3 !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] .mobile-date-field:first-of-type {
    grid-column: 1 / 2 !important;
    grid-row: 2 !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] .mobile-date-field:nth-of-type(2) {
    grid-column: 2 / 3 !important;
    grid-row: 2 !important;
  }

  .customer-commerce #searchOrdersButton {
    grid-column: 1 / 2 !important;
    grid-row: 3 !important;
  }

  .customer-commerce #clearOrderFiltersButton {
    grid-column: 2 / 3 !important;
    grid-row: 3 !important;
  }

  .customer-commerce .product-item {
    grid-template-columns: 88px minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    align-items: stretch !important;
    overflow: hidden !important;
  }

  .customer-commerce .product-item .thumb {
    grid-column: 1 / 2 !important;
    grid-row: 1 !important;
    width: 88px !important;
    height: 154px !important;
    min-height: 0 !important;
    align-self: stretch !important;
    object-fit: cover !important;
  }

  .customer-commerce .product-item > .product-card-main {
    grid-column: 2 / 3 !important;
    grid-row: 1 !important;
    min-height: 154px !important;
    padding: 12px 12px 8px !important;
    box-sizing: border-box !important;
  }

  .customer-commerce .product-card-buy {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    z-index: 1 !important;
    padding: 8px !important;
    border-top: 1px solid #edf0f3 !important;
    background: #ffffff !important;
  }

  .customer-commerce .customer-price-tiers {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .customer-commerce .customer-price-tiers div {
    min-height: 56px !important;
    padding: 6px 4px !important;
    border-radius: 6px !important;
  }

  .customer-commerce .product-detail-panel {
    padding: 12px !important;
  }

  .customer-commerce .product-detail-header {
    padding-bottom: 8px !important;
  }

  .customer-commerce .product-detail-header h2 {
    font-size: 19px !important;
  }

  .customer-commerce .product-detail-gallery {
    min-height: 58px !important;
    max-height: 60px !important;
    gap: 7px !important;
  }

  .customer-commerce .product-detail-image-button,
  .customer-commerce .product-detail-gallery img {
    flex-basis: 58px !important;
    width: 58px !important;
    height: 58px !important;
  }

  .customer-commerce .product-detail-table {
    max-height: min(46dvh, 340px) !important;
  }

  .customer-commerce .product-detail-table div {
    min-height: 26px !important;
    grid-template-columns: 72px minmax(0, 1fr) !important;
  }

  .customer-commerce .product-detail-table strong,
  .customer-commerce .product-detail-table span {
    padding: 5px 7px !important;
    font-size: 12px !important;
    line-height: 1.25 !important;
  }

  .customer-commerce .product-detail-purchase {
    gap: 8px !important;
    padding: 8px !important;
  }
}

/* Final mobile refresh icon and equal order filter sizing. */
@media (max-width: 640px) {
  .customer-commerce [data-customer-page-panel="products"] .topbar,
  .customer-commerce [data-customer-page-panel="orders"] .topbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 10px !important;
    margin-bottom: 12px !important;
    padding-bottom: 12px !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .topbar h2,
  .customer-commerce [data-customer-page-panel="orders"] .topbar h2 {
    margin: 0 !important;
  }

  .customer-commerce #refreshCatalogButton.icon-refresh-button,
  .customer-commerce #refreshOrdersButton.icon-refresh-button {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    padding: 0 !important;
    display: inline-grid !important;
    place-items: center !important;
    align-self: start !important;
    justify-self: end !important;
    font-size: 24px !important;
    line-height: 1 !important;
    font-weight: 900 !important;
  }

  .customer-commerce #refreshCatalogButton.icon-refresh-button span,
  .customer-commerce #refreshOrdersButton.icon-refresh-button span {
    transform: translateY(-1px);
  }

  .customer-commerce [data-customer-page-panel="orders"] .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: stretch !important;
  }

  .customer-commerce #orderKeywordInput,
  .customer-commerce #orderStatusFilterInput,
  .customer-commerce [data-customer-page-panel="orders"] .mobile-date-field {
    grid-row: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 46px !important;
    min-height: 46px !important;
    max-height: 46px !important;
    box-sizing: border-box !important;
    padding: 0 12px !important;
    font-size: 13px !important;
    line-height: 46px !important;
  }

  .customer-commerce #orderKeywordInput {
    grid-column: 1 / 2 !important;
  }

  .customer-commerce #orderStatusFilterInput {
    grid-column: 2 / 3 !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] .mobile-date-field {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] .mobile-date-field span {
    line-height: 1 !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] .mobile-date-field input[type="date"] {
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    line-height: 44px !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] .mobile-date-field:first-of-type {
    grid-column: 1 / 2 !important;
    grid-row: 2 !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] .mobile-date-field:nth-of-type(2) {
    grid-column: 2 / 3 !important;
    grid-row: 2 !important;
  }
}

/* Final compact sizing for every paired mobile filter row. */
@media (max-width: 640px) {
  .customer-commerce [data-customer-page-panel="products"] .toolbar,
  .customer-commerce [data-customer-page-panel="orders"] .toolbar,
  .customer-commerce .log-filter-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
    align-items: stretch !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .toolbar input,
  .customer-commerce [data-customer-page-panel="products"] .toolbar select,
  .customer-commerce [data-customer-page-panel="products"] .toolbar button,
  .customer-commerce [data-customer-page-panel="orders"] .toolbar input,
  .customer-commerce [data-customer-page-panel="orders"] .toolbar select,
  .customer-commerce [data-customer-page-panel="orders"] .toolbar button,
  .customer-commerce [data-customer-page-panel="orders"] .mobile-date-field,
  .customer-commerce .log-filter-toolbar button,
  .customer-commerce .log-filter-toolbar .mobile-date-field {
    width: 100% !important;
    min-width: 0 !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    box-sizing: border-box !important;
    padding: 0 10px !important;
    font-size: 13px !important;
    line-height: 40px !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .toolbar input,
  .customer-commerce [data-customer-page-panel="products"] .toolbar select,
  .customer-commerce [data-customer-page-panel="orders"] .toolbar input,
  .customer-commerce [data-customer-page-panel="orders"] .toolbar select {
    display: block !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] .mobile-date-field,
  .customer-commerce .log-filter-toolbar .mobile-date-field {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 6px !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] .mobile-date-field span,
  .customer-commerce .log-filter-toolbar .mobile-date-field span {
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] .mobile-date-field input[type="date"],
  .customer-commerce .log-filter-toolbar .mobile-date-field input[type="date"] {
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    line-height: 38px !important;
  }

  .customer-commerce #keywordInput {
    grid-column: 1 / 2 !important;
    grid-row: 1 !important;
  }

  .customer-commerce #clearCatalogFiltersButton {
    grid-column: 2 / 3 !important;
    grid-row: 1 !important;
  }

  .customer-commerce #brandFilterInput {
    grid-column: 1 / 2 !important;
    grid-row: 2 !important;
  }

  .customer-commerce #categoryFilterInput {
    grid-column: 2 / 3 !important;
    grid-row: 2 !important;
  }
}

/* Exact mobile paired-control dimensions. Keep this last. */
@media (max-width: 640px) {
  .customer-commerce {
    --mobile-paired-control-height: 34px;
    --mobile-paired-control-radius: 6px;
    --mobile-paired-control-border: 1px solid #cbd8e2;
  }

  .customer-commerce [data-customer-page-panel="products"] .toolbar,
  .customer-commerce [data-customer-page-panel="orders"] .toolbar,
  .customer-commerce .log-filter-toolbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    grid-auto-rows: var(--mobile-paired-control-height) !important;
    column-gap: 6px !important;
    row-gap: 8px !important;
    align-items: stretch !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .toolbar > input,
  .customer-commerce [data-customer-page-panel="products"] .toolbar > select,
  .customer-commerce [data-customer-page-panel="products"] .toolbar > button,
  .customer-commerce [data-customer-page-panel="orders"] .toolbar > input,
  .customer-commerce [data-customer-page-panel="orders"] .toolbar > select,
  .customer-commerce [data-customer-page-panel="orders"] .toolbar > button,
  .customer-commerce [data-customer-page-panel="orders"] .toolbar > .mobile-date-field,
  .customer-commerce .log-filter-toolbar > button,
  .customer-commerce .log-filter-toolbar > .mobile-date-field {
    width: 100% !important;
    min-width: 0 !important;
    height: var(--mobile-paired-control-height) !important;
    min-height: var(--mobile-paired-control-height) !important;
    max-height: var(--mobile-paired-control-height) !important;
    margin: 0 !important;
    padding: 0 9px !important;
    border-radius: var(--mobile-paired-control-radius) !important;
    box-sizing: border-box !important;
    font-size: 13px !important;
    line-height: 1 !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .toolbar > input,
  .customer-commerce [data-customer-page-panel="products"] .toolbar > select,
  .customer-commerce [data-customer-page-panel="orders"] .toolbar > input,
  .customer-commerce [data-customer-page-panel="orders"] .toolbar > select {
    display: block !important;
    border: var(--mobile-paired-control-border) !important;
    background-color: #ffffff !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .toolbar > button,
  .customer-commerce [data-customer-page-panel="orders"] .toolbar > button,
  .customer-commerce .log-filter-toolbar > button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] .toolbar > .mobile-date-field,
  .customer-commerce .log-filter-toolbar > .mobile-date-field {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 5px !important;
    border: var(--mobile-paired-control-border) !important;
    background-color: #ffffff !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] .toolbar > .mobile-date-field span,
  .customer-commerce .log-filter-toolbar > .mobile-date-field span {
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] .toolbar > .mobile-date-field input[type="date"],
  .customer-commerce .log-filter-toolbar > .mobile-date-field input[type="date"] {
    width: 100% !important;
    min-width: 0 !important;
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    font-size: 13px !important;
    line-height: 32px !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] .toolbar > .mobile-date-field:first-of-type,
  .customer-commerce [data-customer-page-panel="orders"] .toolbar > .mobile-date-field:nth-of-type(2),
  .customer-commerce .log-filter-toolbar > .mobile-date-field:first-child,
  .customer-commerce .log-filter-toolbar > .mobile-date-field:nth-child(2) {
    width: 100% !important;
    min-width: 0 !important;
    height: var(--mobile-paired-control-height) !important;
    min-height: var(--mobile-paired-control-height) !important;
    max-height: var(--mobile-paired-control-height) !important;
    margin: 0 !important;
    padding: 0 9px !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] .toolbar > .mobile-date-field:first-of-type input[type="date"],
  .customer-commerce [data-customer-page-panel="orders"] .toolbar > .mobile-date-field:nth-of-type(2) input[type="date"],
  .customer-commerce .log-filter-toolbar > .mobile-date-field:first-child input[type="date"],
  .customer-commerce .log-filter-toolbar > .mobile-date-field:nth-child(2) input[type="date"] {
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    line-height: 32px !important;
  }

  .customer-commerce #keywordInput,
  .customer-commerce #clearCatalogFiltersButton,
  .customer-commerce #brandFilterInput,
  .customer-commerce #categoryFilterInput,
  .customer-commerce #orderKeywordInput,
  .customer-commerce #orderStatusFilterInput,
  .customer-commerce #searchOrdersButton,
  .customer-commerce #clearOrderFiltersButton,
  .customer-commerce #searchLogsButton,
  .customer-commerce #clearLogFiltersButton {
    width: 100% !important;
    min-width: 0 !important;
    height: var(--mobile-paired-control-height) !important;
    min-height: var(--mobile-paired-control-height) !important;
    max-height: var(--mobile-paired-control-height) !important;
    margin: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
  }
}

/* Final customer mobile header: remove workbench badge and lift title. */
@media (max-width: 640px) {
  .customer-commerce #dashboardView > .topbar .brand-eyebrow {
    display: none !important;
  }

  .customer-commerce #dashboardView > .topbar {
    padding-top: 6px !important;
    padding-bottom: 8px !important;
  }

  .customer-commerce #dashboardView > .topbar > div:first-child {
    padding-top: 0 !important;
  }

  .customer-commerce #dashboardView > .topbar h1 {
    margin-top: 0 !important;
    line-height: 1.04 !important;
  }

  .customer-commerce #customerMeta {
    margin-top: 8px !important;
  }
}

/* Final customer brand mark. */
.customer-commerce .brand-logo {
  display: inline-grid !important;
  grid-template-columns: auto minmax(0, max-content) !important;
  align-items: center !important;
  gap: 10px !important;
  width: fit-content !important;
  max-width: 100% !important;
  margin: 0 !important;
  letter-spacing: 0 !important;
  line-height: 1 !important;
}

.customer-commerce .brand-logo-mark {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid #dc2626;
  border-radius: 8px;
  color: #dc2626;
  background:
    linear-gradient(135deg, rgba(220, 38, 38, 0.12), rgba(249, 115, 22, 0.08)),
    #fff7f2;
  font-size: 15px;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.78), 0 10px 20px rgba(220, 38, 38, 0.12);
}

.customer-commerce .brand-logo-mark::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: 7px;
  width: 14px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #dc2626, #f97316);
}

.customer-commerce .brand-logo-word {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.customer-commerce .brand-logo-word > span {
  color: #07111f;
  font-size: 28px;
  font-weight: 950;
  line-height: 0.92;
  letter-spacing: 0;
}

.customer-commerce .brand-logo-word > small {
  color: #dc2626;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.18em;
}

.customer-commerce .auth-shell .brand-logo {
  margin-top: 12px !important;
}

@media (max-width: 640px) {
  .customer-commerce .brand-logo {
    gap: 8px !important;
  }

  .customer-commerce .brand-logo-mark {
    width: 34px !important;
    height: 34px !important;
    border-radius: 7px !important;
    font-size: 12px !important;
  }

  .customer-commerce .brand-logo-mark::after {
    right: -4px;
    bottom: 5px;
    width: 11px;
    height: 3px;
  }

  .customer-commerce .brand-logo-word > span {
    font-size: 24px !important;
  }

  .customer-commerce .brand-logo-word > small {
    font-size: 10px !important;
    letter-spacing: 0.14em !important;
  }

  .customer-commerce #dashboardView > .topbar h1.brand-logo {
    line-height: 1 !important;
  }
}

/* Final login brand readability: keep the in-app header compact, but make the
   warehouse hero mark readable against photography. */
.customer-commerce .auth-shell .brand {
  align-content: center !important;
  justify-items: center !important;
  padding: 44px !important;
}

.customer-commerce .auth-shell .brand-logo {
  width: min(520px, 100%) !important;
  max-width: 100% !important;
  margin-top: 14px !important;
  padding: 18px 22px !important;
  gap: 14px !important;
  border: 1px solid rgba(255, 255, 255, 0.78) !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.88) !important;
  box-shadow:
    0 24px 64px rgba(7, 17, 31, 0.26),
    inset 0 0 0 1px rgba(255, 255, 255, 0.72) !important;
  backdrop-filter: blur(8px);
}

.customer-commerce .auth-shell .brand-logo-mark {
  width: 64px !important;
  height: 64px !important;
  border-width: 3px !important;
  border-radius: 12px !important;
  font-size: 22px !important;
}

.customer-commerce .auth-shell .brand-logo-mark::after {
  right: -7px !important;
  bottom: 10px !important;
  width: 18px !important;
  height: 4px !important;
}

.customer-commerce .auth-shell .brand-logo-word > span {
  color: #07111f !important;
  font-size: 46px !important;
  line-height: 0.9 !important;
  text-shadow: none !important;
}

.customer-commerce .auth-shell .brand-logo-word > small {
  color: #dc2626 !important;
  font-size: 16px !important;
  letter-spacing: 0.16em !important;
}

@media (max-width: 640px) {
  .customer-commerce .auth-shell .brand {
    min-height: 188px !important;
    padding: 22px 20px 18px !important;
  }

  .customer-commerce .auth-shell .brand-eyebrow {
    margin-bottom: 10px !important;
  }

  .customer-commerce .auth-shell .brand-logo {
    width: min(330px, 100%) !important;
    margin-top: 8px !important;
    padding: 14px 16px !important;
    gap: 12px !important;
    border-radius: 11px !important;
  }

  .customer-commerce .auth-shell .brand-logo-mark {
    width: 54px !important;
    height: 54px !important;
    border-radius: 10px !important;
    font-size: 18px !important;
  }

  .customer-commerce .auth-shell .brand-logo-mark::after {
    right: -6px !important;
    bottom: 8px !important;
    width: 15px !important;
    height: 4px !important;
  }

  .customer-commerce .auth-shell .brand-logo-word > span {
    font-size: 36px !important;
  }

  .customer-commerce .auth-shell .brand-logo-word > small {
    font-size: 13px !important;
    letter-spacing: 0.13em !important;
  }
}

/* Final login brand scale. */
.customer-commerce .auth-shell .brand-eyebrow {
  display: none !important;
}

.customer-commerce .auth-shell .brand {
  transform: translateY(-34px) !important;
}

.customer-commerce .auth-shell .brand-logo {
  width: min(640px, 100%) !important;
  margin-top: 0 !important;
  padding: 22px 26px !important;
  gap: 18px !important;
}

.customer-commerce .auth-shell .brand-logo-mark {
  width: 78px !important;
  height: 78px !important;
  border-radius: 14px !important;
  font-size: 26px !important;
}

.customer-commerce .auth-shell .brand-logo-mark::after {
  right: -9px !important;
  bottom: 12px !important;
  width: 22px !important;
  height: 5px !important;
}

.customer-commerce .auth-shell .brand-logo-word > span {
  font-size: 58px !important;
}

.customer-commerce .auth-shell .brand-logo-word > small {
  font-size: 18px !important;
}

@media (max-width: 640px) {
  .customer-commerce .auth-shell .brand {
    min-height: 180px !important;
    padding: 20px 14px 16px !important;
    transform: translateY(-8px) !important;
  }

  .customer-commerce .auth-shell .brand-logo {
    width: min(360px, 100%) !important;
    padding: 15px 17px !important;
    gap: 13px !important;
  }

  .customer-commerce .auth-shell .brand-logo-mark {
    width: 62px !important;
    height: 62px !important;
    border-radius: 11px !important;
    font-size: 20px !important;
  }

  .customer-commerce .auth-shell .brand-logo-mark::after {
    right: -7px !important;
    bottom: 9px !important;
    width: 17px !important;
    height: 4px !important;
  }

  .customer-commerce .auth-shell .brand-logo-word > span {
    font-size: 41px !important;
  }

  .customer-commerce .auth-shell .brand-logo-word > small {
    font-size: 14px !important;
    letter-spacing: 0.12em !important;
  }
}

/* Final mobile login logo trial: slightly smaller, white wordmark. */
@media (max-width: 640px) {
  .customer-commerce .auth-shell .brand-logo {
    width: min(342px, 100%) !important;
    padding: 14px 16px !important;
    gap: 12px !important;
    background: rgba(7, 17, 31, 0.48) !important;
    border-color: rgba(255, 255, 255, 0.46) !important;
    box-shadow:
      0 22px 58px rgba(7, 17, 31, 0.34),
      inset 0 0 0 1px rgba(255, 255, 255, 0.26) !important;
  }

  .customer-commerce .auth-shell .brand-logo-mark {
    width: 58px !important;
    height: 58px !important;
    font-size: 19px !important;
    background: rgba(255, 255, 255, 0.92) !important;
  }

  .customer-commerce .auth-shell .brand-logo-word > span {
    color: #ffffff !important;
    font-size: 38px !important;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.28) !important;
  }

  .customer-commerce .auth-shell .brand-logo-word > small {
    color: #ffffff !important;
    font-size: 13px !important;
    letter-spacing: 0.12em !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.28) !important;
  }
}

/* Final mobile login logo: no backing plate. */
@media (max-width: 640px) {
  .customer-commerce .auth-shell .brand-logo {
    width: fit-content !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
  }

  .customer-commerce .auth-shell .brand-logo-word > span,
  .customer-commerce .auth-shell .brand-logo-word > small {
    text-shadow:
      0 2px 8px rgba(0, 0, 0, 0.42),
      0 0 18px rgba(0, 0, 0, 0.28) !important;
  }
}

/* Final mobile cart compression. */
@media (max-width: 640px) {
  .customer-commerce [data-customer-page-panel="cart"]:not(.hidden) {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    column-gap: 8px !important;
    row-gap: 8px !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] h2 {
    grid-column: 1 / 2 !important;
    margin: 0 !important;
    align-self: end !important;
    font-size: 30px !important;
    line-height: 1.05 !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] #cartTotalText {
    grid-column: 2 / 3 !important;
    margin: 0 !important;
    align-self: end !important;
    justify-self: end !important;
    line-height: 1.2 !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] .cart-list {
    grid-column: 1 / -1 !important;
    gap: 8px !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] .cart-item {
    grid-template-columns: 74px minmax(0, 1fr) !important;
    gap: 8px !important;
    padding: 10px !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] .cart-item-thumb-button {
    width: 74px !important;
    height: 74px !important;
    min-height: 74px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 6px !important;
    background: transparent !important;
    cursor: pointer !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] .cart-item-thumb {
    width: 74px !important;
    height: 74px !important;
    display: block !important;
    object-fit: cover !important;
    border: 1px solid #d9ecea !important;
    border-radius: 6px !important;
    background: #eef8f6 !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] .cart-item-main {
    min-width: 0 !important;
    cursor: pointer !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] .cart-item strong {
    display: block !important;
    font-size: 18px !important;
    line-height: 1.15 !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] .cart-item p {
    margin: 4px 0 0 !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    overflow-wrap: anywhere !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] .cart-quantity-actions {
    grid-column: 2 / 3 !important;
    width: max-content !important;
    max-width: 100% !important;
    justify-self: start !important;
    grid-template-columns: 36px 72px 36px 68px !important;
    gap: 6px !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] .cart-quantity-actions button,
  .customer-commerce [data-customer-page-panel="cart"] .cart-quantity-input {
    min-height: 36px !important;
    height: 36px !important;
    padding: 0 8px !important;
    line-height: 1 !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] .cart-quantity-actions .cart-delete-button {
    grid-column: auto !important;
    padding: 0 8px !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] > label.field {
    margin: 0 !important;
    gap: 4px !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] > label.field:nth-of-type(1) {
    grid-column: 1 / 2 !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] > label.field:nth-of-type(2) {
    grid-column: 2 / 3 !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] .field span {
    font-size: 13px !important;
    line-height: 1.1 !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] input,
  .customer-commerce [data-customer-page-panel="cart"] select,
  .customer-commerce [data-customer-page-panel="cart"] textarea {
    min-height: 36px !important;
    height: 36px !important;
    padding: 6px 9px !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] .address-grid {
    grid-column: 1 / -1 !important;
    display: grid !important;
    grid-template-columns: 1.08fr 1fr 1fr !important;
    gap: 6px !important;
    margin: 0 !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] .address-grid .field {
    margin: 0 !important;
    gap: 4px !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] > label.field:nth-of-type(3),
  .customer-commerce [data-customer-page-panel="cart"] > label.field:nth-of-type(4) {
    grid-column: 1 / -1 !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] textarea {
    min-height: 42px !important;
    height: 42px !important;
    resize: none !important;
  }

  .customer-commerce [data-customer-page-panel="cart"] #submitOrderButton {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    min-height: 40px !important;
    height: 40px !important;
    margin-top: 2px !important;
  }
}

/* Final mobile product price alignment. Desktop layout is intentionally untouched. */
@media (max-width: 640px) {
  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    align-items: stretch !important;
    gap: 6px !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers div {
    display: grid !important;
    grid-template-rows: 16px 20px 14px !important;
    align-items: center !important;
    justify-items: center !important;
    min-height: 58px !important;
    height: 58px !important;
    padding: 5px 3px !important;
    gap: 1px !important;
    text-align: center !important;
    overflow: hidden !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers span,
  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers strong,
  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers small {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    text-align: center !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers span {
    grid-row: 1 !important;
    font-size: 11px !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers strong {
    grid-row: 2 !important;
    font-size: 16px !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers small {
    grid-row: 3 !important;
    font-size: 11px !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers div:not(:has(small))::after {
    content: "";
    grid-row: 3;
    display: block;
    height: 14px;
  }
}

/* Keep mobile price tier text centered even when earlier rules set inline offsets. */
@media (max-width: 640px) {
  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers div > span,
  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers div > strong,
  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers div > small {
    grid-column: 1 / -1 !important;
    justify-self: center !important;
    align-self: center !important;
    width: auto !important;
    max-width: 100% !important;
    text-align: center !important;
  }
}

/* Final desktop product price layout: keep each tier on one line. */
@media (min-width: 641px) {
  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers div {
    display: grid !important;
    grid-template-columns: max-content minmax(0, 1fr) max-content !important;
    align-items: center !important;
    column-gap: 10px !important;
    min-height: 38px !important;
    padding: 7px 12px !important;
    white-space: nowrap !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers span,
  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers strong,
  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers small {
    display: inline-block !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers span {
    grid-column: 1 !important;
    justify-self: start !important;
    text-align: left !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers strong {
    grid-column: 2 !important;
    justify-self: start !important;
    text-align: left !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers small {
    grid-column: 3 !important;
    justify-self: end !important;
    font-size: 12px !important;
    text-align: right !important;
  }
}

/* Final mobile product price layout: label above, price and N+ on one line. */
@media (max-width: 640px) {
  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers div {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) max-content !important;
    grid-template-rows: 17px 22px !important;
    align-items: center !important;
    justify-items: stretch !important;
    min-height: 50px !important;
    height: 50px !important;
    padding: 6px 8px !important;
    gap: 2px 6px !important;
    text-align: left !important;
    overflow: hidden !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers div > span {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    justify-self: stretch !important;
    align-self: center !important;
    width: 100% !important;
    max-width: 100% !important;
    font-size: 11px !important;
    line-height: 1 !important;
    text-align: left !important;
    white-space: nowrap !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers div > strong {
    grid-column: 1 !important;
    grid-row: 2 !important;
    justify-self: start !important;
    align-self: center !important;
    width: auto !important;
    max-width: 100% !important;
    font-size: 16px !important;
    line-height: 1 !important;
    text-align: left !important;
    white-space: nowrap !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers div > small {
    grid-column: 2 !important;
    grid-row: 2 !important;
    justify-self: end !important;
    align-self: center !important;
    width: auto !important;
    max-width: 100% !important;
    font-size: 11px !important;
    line-height: 1 !important;
    text-align: right !important;
    white-space: nowrap !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .customer-price-tiers div:not(:has(small))::after {
    content: none !important;
    display: none !important;
  }
}

/* Absolute final product-card detail hint styling. */
.customer-commerce .product-card-hint {
  color: #7a8797 !important;
  font-size: 12px !important;
  line-height: 1.2 !important;
  font-weight: 500 !important;
}

.customer-commerce .mobile-refresh-actions {
  display: none;
}

@media (max-width: 640px) {
  .customer-commerce .product-card-hint {
    font-size: 11px !important;
  }
}

/* Mobile refresh controls live in the header next to the balance. */
@media (max-width: 640px) {
  .customer-commerce #dashboardView > .topbar {
    grid-template-columns: minmax(0, 1fr) auto auto auto !important;
  }

  .customer-commerce .mobile-refresh-actions {
    grid-column: 2 / 3 !important;
    grid-row: 1 !important;
    align-self: start !important;
    justify-self: end !important;
    display: grid !important;
    width: 42px !important;
    height: 30px !important;
    min-width: 42px !important;
  }

  .customer-commerce .mobile-refresh-actions .icon-refresh-button {
    display: none !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
    border-radius: 6px !important;
    place-items: center !important;
    font-size: 16px !important;
    line-height: 1 !important;
  }

  .customer-commerce[data-customer-page="products"] .mobile-refresh-actions [data-mobile-refresh="products"],
  .customer-commerce[data-customer-page="cart"] .mobile-refresh-actions [data-mobile-refresh="cart"],
  .customer-commerce[data-customer-page="orders"] .mobile-refresh-actions [data-mobile-refresh="orders"],
  .customer-commerce[data-customer-page="logs"] .mobile-refresh-actions [data-mobile-refresh="logs"] {
    display: grid !important;
  }

  .customer-commerce .balance-pill {
    grid-column: 3 / 4 !important;
  }

  .customer-commerce #logoutButton {
    grid-column: 4 / 5 !important;
  }

  .customer-commerce [data-customer-page-panel="products"] > .topbar {
    display: none !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] > .topbar .icon-refresh-button {
    display: none !important;
  }
}

/* Mobile customer panels use the header nav as the page label, so do not repeat it. */
@media (max-width: 640px) {
  .customer-commerce .customer-page-panel > h2,
  .customer-commerce .customer-page-panel > .topbar h2 {
    display: none !important;
  }

  .customer-commerce [data-customer-page-panel="products"] > .topbar,
  .customer-commerce [data-customer-page-panel="orders"] > .topbar,
  .customer-commerce [data-customer-page-panel="logs"] > .topbar {
    margin-bottom: 8px !important;
    padding-bottom: 0 !important;
  }

  .customer-commerce [data-customer-page-panel="products"] > .topbar {
    justify-content: flex-end !important;
  }

  .customer-commerce [data-customer-page-panel="orders"] > .topbar .muted,
  .customer-commerce [data-customer-page-panel="logs"] > .topbar .muted,
  .customer-commerce [data-customer-page-panel="cart"] > #cartTotalText {
    margin-top: 0 !important;
  }
}

/* Absolute final mobile refresh placement: only the header refresh can show. */
@media (max-width: 640px) {
  .customer-commerce #refreshCatalogButton,
  .customer-commerce #refreshCartButton,
  .customer-commerce #refreshOrdersButton,
  .customer-commerce #refreshLogsButton {
    display: none !important;
    visibility: hidden !important;
  }
}

@media (max-width: 380px) {
  .customer-commerce #dashboardView > .topbar {
    column-gap: 6px !important;
  }

  .customer-commerce #dashboardView > .topbar h1.brand-logo {
    gap: 6px !important;
  }

  .customer-commerce #dashboardView > .topbar .brand-logo-mark {
    width: 30px !important;
    height: 30px !important;
    font-size: 11px !important;
  }

  .customer-commerce #dashboardView > .topbar .brand-logo-word > span {
    font-size: 20px !important;
  }

  .customer-commerce #dashboardView > .topbar .brand-logo-word > small {
    font-size: 9px !important;
  }

  .customer-commerce .mobile-refresh-actions,
  .customer-commerce .mobile-refresh-actions .icon-refresh-button {
    width: 38px !important;
    min-width: 38px !important;
  }

  .customer-commerce .balance-pill {
    max-width: 112px !important;
  }
}

/* Desktop catalog image stage: equal height, compatible with mixed image ratios. */
@media (min-width: 1181px) {
  .customer-commerce [data-customer-page-panel="products"] .product-list {
    align-items: stretch !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .product-item {
    grid-template-rows: 178px minmax(128px, auto) auto !important;
    height: 100% !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .product-item > .thumb {
    display: block !important;
    grid-row: 1 !important;
    width: 100% !important;
    height: 178px !important;
    min-height: 178px !important;
    max-height: 178px !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
    object-position: center center !important;
    background: #eef6f6 !important;
    border-bottom: 1px solid #dbe5ef !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .product-card-main {
    grid-row: 2 !important;
  }

  .customer-commerce [data-customer-page-panel="products"] .product-card-buy {
    grid-row: 3 !important;
    align-self: end !important;
  }
}

.pending-order-table {
  min-width: 1780px;
}

.pending-request-list {
  display: grid;
  gap: 6px;
  min-width: 210px;
}

.pending-request-card {
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid #fde0d7;
  border-radius: 6px;
  background: #fff8f4;
}

.pending-request-card strong {
  color: #b91c1c;
  font-size: 13px;
}

.pending-request-card span,
.pending-request-card p {
  margin: 0;
  color: #475569;
  font-size: 12px;
  line-height: 1.35;
}

.pending-address-cell {
  min-width: 260px;
}

.pending-address-cell .editable-order-cell {
  margin-bottom: 4px;
}

.pending-address-cell .editable-order-cell:last-child {
  margin-bottom: 0;
}

.orders-document-page .pending-order-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  min-width: 92px;
}

.orders-document-page .orders-spreadsheet > .table-wrap > table {
  width: max(100%, 1980px) !important;
  min-width: 1980px !important;
}

.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(1),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(1) { width: 145px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(2),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(2) { width: 66px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(3),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(3) { width: 170px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(4),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(4) { width: 300px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(5),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(5) { width: 190px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(6),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(6) { width: 56px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(7),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(7) { width: 74px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(8),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(8) { width: 78px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(9),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(9) { width: 136px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(10),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(10) { width: 118px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(11),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(11) { width: 120px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(12),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(12) { width: 170px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(13),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(13) { width: 96px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(14),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(14) { width: 78px; }

.orders-document-page .pending-order-table th:nth-child(1),
.orders-document-page .pending-order-table td:nth-child(1) { width: 145px; }
.orders-document-page .pending-order-table th:nth-child(2),
.orders-document-page .pending-order-table td:nth-child(2) { width: 66px; }
.orders-document-page .pending-order-table th:nth-child(3),
.orders-document-page .pending-order-table td:nth-child(3) { width: 150px; }
.orders-document-page .pending-order-table th:nth-child(4),
.orders-document-page .pending-order-table td:nth-child(4) { width: 220px; }
.orders-document-page .pending-order-table th:nth-child(5),
.orders-document-page .pending-order-table td:nth-child(5) { width: 300px; }
.orders-document-page .pending-order-table th:nth-child(6),
.orders-document-page .pending-order-table td:nth-child(6) { width: 190px; }
.orders-document-page .pending-order-table th:nth-child(7),
.orders-document-page .pending-order-table td:nth-child(7) { width: 56px; }
.orders-document-page .pending-order-table th:nth-child(8),
.orders-document-page .pending-order-table td:nth-child(8) { width: 74px; }
.orders-document-page .pending-order-table th:nth-child(9),
.orders-document-page .pending-order-table td:nth-child(9) { width: 78px; }
.orders-document-page .pending-order-table th:nth-child(10),
.orders-document-page .pending-order-table td:nth-child(10) { width: 136px; }
.orders-document-page .pending-order-table th:nth-child(11),
.orders-document-page .pending-order-table td:nth-child(11) { width: 118px; }
.orders-document-page .pending-order-table th:nth-child(12),
.orders-document-page .pending-order-table td:nth-child(12) { width: 120px; }
.orders-document-page .pending-order-table th:nth-child(13),
.orders-document-page .pending-order-table td:nth-child(13) { width: 120px; }

.order-product-cell {
  cursor: default;
  user-select: text;
  caret-color: transparent;
}

.readonly-product-cell + .readonly-product-cell {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #e5edf5;
}

.readonly-product-cell strong {
  display: block;
  color: #0f172a;
  font-weight: 800;
  line-height: 1.35;
  word-break: break-word;
}

.order-address-cell {
  min-width: 250px;
}

.order-address-line {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1em;
  row-gap: 3px;
  align-items: flex-start;
  line-height: 1.45;
}

.order-address-line .editable-order-cell.inline-address-part {
  display: inline-block;
  min-height: 20px;
  max-width: 100%;
  padding: 1px 3px;
  border-radius: 3px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 12px;
}

.order-address-copy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.order-address-copy-actions button {
  min-height: 24px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  line-height: 1;
}

.token-adjust-compact {
  display: grid;
  grid-template-columns: minmax(84px, 1fr) 56px;
  gap: 6px;
  align-items: center;
  max-width: 190px;
}

.token-adjust-compact input {
  width: 100%;
  min-height: 32px;
  padding: 5px 8px;
}

.token-adjust-compact .wide {
  width: 100%;
}

.token-adjust-compact button {
  min-height: 32px;
  padding: 4px 8px;
  white-space: nowrap;
}

[data-admin-page-panel="customers"] .table-wrap th:nth-child(8),
[data-admin-page-panel="customers"] .table-wrap td:nth-child(8) {
  width: 210px;
}

[data-admin-page-panel="customers"] .table-wrap th:nth-child(9),
[data-admin-page-panel="customers"] .table-wrap td:nth-child(9),
[data-admin-page-panel="customers"] .table-wrap th:nth-child(10),
[data-admin-page-panel="customers"] .table-wrap td:nth-child(10) {
  width: 112px;
}

.admin-page[data-admin-page-panel="logs"] .topbar .actions,
.admin-page[data-admin-page-panel="all-logs"] .topbar .actions {
  display: grid !important;
  grid-template-columns: minmax(360px, 1.5fr) minmax(150px, auto) minmax(150px, auto) max-content max-content;
  gap: 12px;
  align-items: center;
  justify-content: end;
}

.admin-page[data-admin-page-panel="logs"] .customer-log-picker,
.admin-page[data-admin-page-panel="logs"] #logCustomerSearch,
.admin-page[data-admin-page-panel="all-logs"] #allLogKeywordInput {
  width: 100%;
  min-width: 360px;
}

.admin-page[data-admin-page-panel="logs"] #logStartInput,
.admin-page[data-admin-page-panel="logs"] #logEndInput,
.admin-page[data-admin-page-panel="all-logs"] #allLogStartInput,
.admin-page[data-admin-page-panel="all-logs"] #allLogEndInput {
  width: 150px;
}

.admin-page[data-admin-page-panel="logs"] .topbar .actions input,
.admin-page[data-admin-page-panel="logs"] .topbar .actions button,
.admin-page[data-admin-page-panel="all-logs"] .topbar .actions input,
.admin-page[data-admin-page-panel="all-logs"] .topbar .actions button {
  min-height: 46px;
  padding: 0 16px;
  font-size: 15px;
}

.orders-document-page .sheet-toolbar {
  align-items: flex-start;
}

.orders-document-page .sheet-document-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  max-width: min(780px, 58vw);
}

.orders-document-page .order-sheet-search {
  width: min(430px, 36vw);
  min-width: 280px;
  min-height: 40px;
  padding: 0 12px;
}

.orders-document-page .order-sheet-filter,
.orders-document-page .order-sheet-date {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  font-size: 14px;
}

.orders-document-page .order-sheet-filter {
  min-width: 130px;
}

.orders-document-page .order-sheet-date {
  width: 142px;
}

.orders-document-page .sheet-document-actions .ghost,
.orders-document-page .sheet-document-actions .secondary {
  min-height: 40px;
  padding: 0 14px;
}

@media (max-width: 1180px) {
  .admin-page[data-admin-page-panel="logs"] .topbar .actions,
  .admin-page[data-admin-page-panel="all-logs"] .topbar .actions {
    grid-template-columns: minmax(260px, 1fr) minmax(140px, 1fr);
    justify-content: stretch;
  }

  .admin-page[data-admin-page-panel="logs"] .customer-log-picker,
  .admin-page[data-admin-page-panel="logs"] #logCustomerSearch,
  .admin-page[data-admin-page-panel="all-logs"] #allLogKeywordInput {
    min-width: 0;
    grid-column: 1 / -1;
  }

  .orders-document-page .sheet-toolbar {
    flex-wrap: wrap;
  }

  .orders-document-page .sheet-document-actions {
    width: 100%;
    max-width: none;
    justify-content: flex-start;
  }

  .orders-document-page .order-sheet-search {
    width: min(460px, 100%);
  }
}
/* Admin audit log page */
.admin-page[data-admin-page-panel="audit-events"] .audit-filterbar {
  align-items: flex-start;
  gap: 16px;
}

.admin-page[data-admin-page-panel="audit-events"] .audit-filterbar .actions {
  display: grid;
  grid-template-columns: 180px minmax(150px, 1fr) minmax(170px, 1fr) minmax(170px, 1fr) 132px 132px auto auto;
  gap: 8px;
  align-items: center;
  flex: 1;
  min-width: 720px;
}

.audit-events-table {
  min-width: 1500px;
  table-layout: fixed;
}

.audit-events-table th,
.audit-events-table td {
  vertical-align: top;
}

.audit-events-table th:nth-child(1),
.audit-events-table td:nth-child(1) { width: 150px; }
.audit-events-table th:nth-child(2),
.audit-events-table td:nth-child(2) { width: 170px; }
.audit-events-table th:nth-child(3),
.audit-events-table td:nth-child(3) { width: 150px; }
.audit-events-table th:nth-child(4),
.audit-events-table td:nth-child(4) { width: 180px; }
.audit-events-table th:nth-child(5),
.audit-events-table td:nth-child(5) { width: 130px; }
.audit-events-table th:nth-child(6),
.audit-events-table td:nth-child(6) { width: 160px; }
.audit-events-table th:nth-child(7),
.audit-events-table td:nth-child(7) { width: 230px; }
.audit-events-table th:nth-child(8),
.audit-events-table td:nth-child(8) { width: 260px; }
.audit-events-table th:nth-child(9),
.audit-events-table td:nth-child(9) { width: 120px; }
.audit-events-table th:nth-child(10),
.audit-events-table td:nth-child(10) { width: 260px; }

.audit-events-table small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.audit-events-table code {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  color: #475569;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 6px;
  font-size: 11px;
  line-height: 1.45;
}

@media (max-width: 1300px) {
  .admin-page[data-admin-page-panel="audit-events"] .audit-filterbar {
    display: block;
  }

  .admin-page[data-admin-page-panel="audit-events"] .audit-filterbar .actions {
    margin-top: 12px;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.advanced-access-button.advanced-unlocked {
  background: #e0f2f1;
  color: #047857;
  border-color: #a7d7d2;
}

.advanced-access-panel {
  max-width: 520px;
}

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

.customer-commerce #exportOrdersButton,
.customer-commerce #exportLogsButton {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .customer-export-actions {
    gap: 6px;
  }

  .customer-commerce #exportOrdersButton,
  .customer-commerce #exportLogsButton {
    min-height: 44px;
    padding: 0 12px;
  }
}

.customer-address-book {
  display: grid;
  gap: 10px;
  margin: 10px 0 12px;
  padding: 12px;
  border: 1px solid #e2edf1;
  border-radius: 8px;
  background: #fbfefd;
}

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

.mini-section-head h3 {
  margin: 0;
  font-size: 1rem;
}

.compact-button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 0.86rem;
}

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

.address-search-input {
  width: 100%;
  margin: 0 0 10px;
}

.address-book-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid #dce8ee;
  border-radius: 8px;
  background: #fff;
}

.address-book-item.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px rgba(13, 148, 136, 0.18);
}

.address-select-button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  box-shadow: none;
}

.address-select-button strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.address-select-button p {
  margin: 4px 0 0;
  color: #475569;
}

.address-default-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 4px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 0.76rem;
  font-weight: 700;
}

.address-item-actions {
  display: flex;
  gap: 6px;
}

.address-editor {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px dashed #c8dce1;
  border-radius: 8px;
  background: #ffffff;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #334155;
  font-weight: 700;
  white-space: nowrap;
}

.check-row span {
  white-space: nowrap;
}

.customer-address-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.customer-address-actions .compact-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.1;
}

.address-modal-panel {
  width: min(720px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 42px));
  overflow: auto;
}

.address-modal-panel .topbar {
  margin-bottom: 10px;
}

.address-modal-panel .topbar h2 {
  margin-bottom: 4px;
}

.customer-order-product {
  display: grid;
  gap: 2px;
  margin: 6px 0;
}

.customer-order-product strong {
  color: #0f172a;
  font-weight: 800;
}

.customer-order-product span {
  color: #475569;
  font-size: 0.92rem;
}

.customer-order-product p {
  margin: 2px 0 0;
}

@media (max-width: 640px) {
  .customer-address-actions {
    display: grid;
    grid-template-columns: 0.85fr 0.95fr 1.2fr;
    gap: 6px;
    margin: 8px 0 10px;
  }

  .customer-address-actions .compact-button {
    width: 100%;
    min-height: 38px;
    padding: 6px 4px;
    font-size: 0.74rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .address-modal-panel {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 28px);
    padding: 14px;
  }

  .customer-address-book {
    gap: 8px;
    margin: 8px 0 10px;
    padding: 10px;
  }

  .address-book-item {
    grid-template-columns: 1fr;
  }

  .address-item-actions {
    justify-content: flex-end;
  }

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

@media (max-width: 640px) {
  .customer-commerce [data-customer-page-panel="logs"] > .topbar {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 10px !important;
  }

  .customer-commerce [data-customer-page-panel="logs"] > .topbar > div:first-child {
    min-width: 0 !important;
  }

  .customer-commerce [data-customer-page-panel="logs"] > .topbar .customer-export-actions {
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    width: auto !important;
    margin-left: auto !important;
  }

  .customer-commerce [data-customer-page-panel="logs"] #refreshLogsButton {
    display: grid !important;
    visibility: visible !important;
    flex: 0 0 44px !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    place-items: center !important;
  }

  .customer-commerce [data-customer-page-panel="logs"] #exportLogsButton {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 78px !important;
    max-width: none !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
}

@media (max-width: 640px) {
  .customer-commerce [data-customer-page-panel="logs"] > .topbar,
  .customer-commerce [data-customer-page-panel="orders"] > .topbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: start !important;
    column-gap: 10px !important;
  }

  .customer-commerce [data-customer-page-panel="logs"] > .topbar .customer-export-actions,
  .customer-commerce [data-customer-page-panel="orders"] > .topbar .customer-export-actions {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    display: flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 6px !important;
  }

  .customer-commerce [data-customer-page-panel="logs"] #refreshLogsButton,
  .customer-commerce [data-customer-page-panel="orders"] #refreshOrdersButton {
    display: inline-flex !important;
    visibility: visible !important;
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    flex: 0 0 42px !important;
    padding: 0 !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .customer-commerce [data-customer-page-panel="logs"] #exportLogsButton,
  .customer-commerce [data-customer-page-panel="orders"] #exportOrdersButton {
    width: auto !important;
    min-width: 74px !important;
    max-width: 92px !important;
    height: 42px !important;
    min-height: 42px !important;
    flex: 0 0 auto !important;
    padding: 0 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
  }
}

/* Ultimate refresh placement: refresh belongs in the top header, never inside page content. */
.customer-commerce #refreshCatalogButton,
.customer-commerce #refreshCartButton,
.customer-commerce #refreshOrdersButton,
.customer-commerce #refreshLogsButton {
  display: none !important;
  visibility: hidden !important;
}

.customer-commerce .customer-topbar-actions {
  grid-template-columns: auto auto auto !important;
  grid-template-areas:
    "refresh balance logout"
    "nav nav nav" !important;
  align-items: center !important;
}

.customer-commerce .mobile-refresh-actions {
  grid-area: refresh !important;
  display: grid !important;
  width: 42px !important;
  min-width: 42px !important;
  justify-self: end !important;
}

.customer-commerce .mobile-refresh-actions .icon-refresh-button {
  display: none !important;
  visibility: hidden !important;
  width: 42px !important;
  min-width: 42px !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 !important;
  place-items: center !important;
  align-items: center !important;
  justify-content: center !important;
}

.customer-commerce[data-customer-page="products"] .mobile-refresh-actions [data-mobile-refresh="products"],
.customer-commerce[data-customer-page="cart"] .mobile-refresh-actions [data-mobile-refresh="cart"],
.customer-commerce[data-customer-page="orders"] .mobile-refresh-actions [data-mobile-refresh="orders"],
.customer-commerce[data-customer-page="logs"] .mobile-refresh-actions [data-mobile-refresh="logs"] {
  display: inline-flex !important;
  visibility: visible !important;
}

.customer-commerce .balance-pill {
  grid-area: balance !important;
}

.customer-commerce #logoutButton {
  grid-area: logout !important;
}

.customer-commerce .customer-page-nav {
  grid-area: nav !important;
}

@media (max-width: 640px) {
  .customer-commerce .customer-topbar-actions {
    grid-template-columns: auto auto auto !important;
    grid-template-areas:
      "refresh balance logout"
      "nav nav nav" !important;
    gap: 8px !important;
  }

  .customer-commerce .mobile-refresh-actions,
  .customer-commerce .mobile-refresh-actions .icon-refresh-button {
    width: 38px !important;
    min-width: 38px !important;
  }

  .customer-commerce .mobile-refresh-actions .icon-refresh-button {
    height: 30px !important;
    min-height: 30px !important;
    border-radius: 6px !important;
    font-size: 16px !important;
  }
}

/* Phone header layout: brand left, refresh/balance/logout locked to the top right. */
@media (max-width: 640px) {
  .customer-commerce #dashboardView > .topbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 36px minmax(112px, 126px) 48px !important;
    grid-template-areas:
      "brand refresh balance logout"
      "nav nav nav nav" !important;
    align-items: start !important;
    column-gap: 6px !important;
    row-gap: 8px !important;
  }

  .customer-commerce #dashboardView > .topbar > div:first-child {
    grid-area: brand !important;
    min-width: 0 !important;
    padding-right: 4px !important;
  }

  .customer-commerce .customer-topbar-actions {
    display: contents !important;
  }

  .customer-commerce .mobile-refresh-actions {
    grid-area: refresh !important;
    width: 36px !important;
    min-width: 36px !important;
    height: 30px !important;
    align-self: start !important;
    justify-self: end !important;
  }

  .customer-commerce .mobile-refresh-actions .icon-refresh-button {
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
  }

  .customer-commerce .balance-pill {
    grid-area: balance !important;
    width: 100% !important;
    max-width: 126px !important;
    min-height: 30px !important;
    height: 30px !important;
    padding: 0 6px !important;
    gap: 5px !important;
    align-self: start !important;
  }

  .customer-commerce .balance-pill span {
    font-size: 11px !important;
  }

  .customer-commerce .balance-pill strong {
    font-size: 15px !important;
  }

  .customer-commerce #logoutButton {
    grid-area: logout !important;
    width: 48px !important;
    min-width: 48px !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
    align-self: start !important;
  }

  .customer-commerce .customer-page-nav {
    grid-area: nav !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    width: 100% !important;
    gap: 6px !important;
  }
}

/* Absolute final: no page-card refresh buttons may render. */
.customer-commerce [data-customer-page-panel="products"] #refreshCatalogButton,
.customer-commerce [data-customer-page-panel="cart"] #refreshCartButton,
.customer-commerce [data-customer-page-panel="orders"] #refreshOrdersButton,
.customer-commerce [data-customer-page-panel="logs"] #refreshLogsButton {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
}

.order-request-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  margin-bottom: 6px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.order-request-status-badge.warn {
  background: #fff4d6;
  color: #9a5b00;
}

.order-request-status-badge.danger {
  background: #ffe3e3;
  color: #b91c1c;
}

/* Order management filters: one left-aligned row on desktop. */
.admin-page[data-admin-page-panel="orders"] .sheet-toolbar {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  align-items: start !important;
  justify-content: start !important;
  gap: 8px !important;
}

.admin-page[data-admin-page-panel="orders"] .sheet-document-title {
  width: 100% !important;
}

.admin-page[data-admin-page-panel="orders"] .sheet-document-actions {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  width: 100% !important;
  max-width: none !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding-bottom: 2px;
}

.admin-page[data-admin-page-panel="orders"] .order-sheet-search {
  flex: 0 1 420px !important;
  width: 420px !important;
  min-width: 260px !important;
}

.admin-page[data-admin-page-panel="orders"] .order-sheet-filter {
  flex: 0 0 190px !important;
  width: 190px !important;
  min-width: 190px !important;
}

.admin-page[data-admin-page-panel="orders"] .order-sheet-date {
  flex: 0 0 142px !important;
  width: 142px !important;
  min-width: 142px !important;
}

.admin-page[data-admin-page-panel="orders"] .sheet-document-actions .ghost,
.admin-page[data-admin-page-panel="orders"] .sheet-document-actions .secondary {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
}

@media (max-width: 1180px) {
  .admin-page[data-admin-page-panel="orders"] .sheet-document-actions {
    flex-wrap: wrap !important;
    overflow-x: visible !important;
  }
}

.order-no-stack {
  display: grid;
  gap: 6px;
  align-items: start;
}

.order-history-button {
  min-height: 24px !important;
  width: fit-content;
  padding: 0 8px !important;
  border-radius: 5px !important;
  font-size: 12px !important;
  line-height: 1 !important;
}

.order-history-panel {
  width: min(860px, calc(100vw - 40px));
  height: min(780px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.order-history-list {
  display: grid;
  gap: 10px;
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding-right: 4px;
}

.order-history-entry {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfefd;
}

.order-history-entry-time {
  color: var(--muted);
  font-size: 12px;
}

.order-history-entry-text {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

/* Order cost column: total cost per normal order / child order, parent rows summarize children. */
.orders-document-page .orders-spreadsheet > .table-wrap > table {
  width: max(100%, 2080px) !important;
  min-width: 2080px !important;
}

.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(1),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(1) { width: 145px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(2),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(2) { width: 66px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(3),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(3) { width: 170px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(4),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(4) { width: 300px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(5),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(5) { width: 190px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(6),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(6) { width: 56px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(7),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(7) { width: 74px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(8),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(8) { width: 78px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(9),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(9) { width: 86px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(10),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(10) { width: 136px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(11),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(11) { width: 118px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(12),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(12) { width: 120px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(13),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(13) { width: 170px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(14),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(14) { width: 96px; }
.orders-document-page .editable-order-table:not(.pending-order-table) th:nth-child(15),
.orders-document-page .editable-order-table:not(.pending-order-table) td:nth-child(15) { width: 78px; }

.orders-document-page .pending-order-table th:nth-child(1),
.orders-document-page .pending-order-table td:nth-child(1) { width: 145px; }
.orders-document-page .pending-order-table th:nth-child(2),
.orders-document-page .pending-order-table td:nth-child(2) { width: 66px; }
.orders-document-page .pending-order-table th:nth-child(3),
.orders-document-page .pending-order-table td:nth-child(3) { width: 150px; }
.orders-document-page .pending-order-table th:nth-child(4),
.orders-document-page .pending-order-table td:nth-child(4) { width: 220px; }
.orders-document-page .pending-order-table th:nth-child(5),
.orders-document-page .pending-order-table td:nth-child(5) { width: 300px; }
.orders-document-page .pending-order-table th:nth-child(6),
.orders-document-page .pending-order-table td:nth-child(6) { width: 190px; }
.orders-document-page .pending-order-table th:nth-child(7),
.orders-document-page .pending-order-table td:nth-child(7) { width: 56px; }
.orders-document-page .pending-order-table th:nth-child(8),
.orders-document-page .pending-order-table td:nth-child(8) { width: 74px; }
.orders-document-page .pending-order-table th:nth-child(9),
.orders-document-page .pending-order-table td:nth-child(9) { width: 78px; }
.orders-document-page .pending-order-table th:nth-child(10),
.orders-document-page .pending-order-table td:nth-child(10) { width: 86px; }
.orders-document-page .pending-order-table th:nth-child(11),
.orders-document-page .pending-order-table td:nth-child(11) { width: 136px; }
.orders-document-page .pending-order-table th:nth-child(12),
.orders-document-page .pending-order-table td:nth-child(12) { width: 118px; }
.orders-document-page .pending-order-table th:nth-child(13),
.orders-document-page .pending-order-table td:nth-child(13) { width: 120px; }
.orders-document-page .pending-order-table th:nth-child(14),
.orders-document-page .pending-order-table td:nth-child(14) { width: 120px; }
.orders-document-page .pending-order-table th:nth-child(15),
.orders-document-page .pending-order-table td:nth-child(15) { width: 120px; }

/* Confirmation dialogs must sit above split dialog overlays. */
#noticeDialog,
#passwordDialog,
#orderHistoryDialog,
#orderCustomerModal {
  z-index: 1200;
}

/* After-sale handling: keep refund fields readable and the action column reachable. */
.orders-document-page .pending-order-table {
  width: max(100%, 2280px) !important;
  min-width: 2280px !important;
}

.orders-document-page .pending-order-table th:nth-child(4),
.orders-document-page .pending-order-table td:nth-child(4) {
  width: 360px;
}

.orders-document-page .pending-order-table th:nth-child(5),
.orders-document-page .pending-order-table td:nth-child(5) {
  width: 260px;
}

.orders-document-page .pending-order-table th:nth-child(13),
.orders-document-page .pending-order-table td:nth-child(13) {
  width: 180px;
}

.orders-document-page .pending-order-table th:nth-child(14),
.orders-document-page .pending-order-table td:nth-child(14) {
  width: 150px;
}

.orders-document-page .pending-order-table th:nth-child(15),
.orders-document-page .pending-order-table td:nth-child(15) {
  position: sticky;
  right: 0;
  z-index: 5;
  width: 220px;
  min-width: 220px;
  box-shadow: -8px 0 14px rgba(15, 23, 42, 0.08);
}

.orders-document-page .pending-order-table thead th:nth-child(15) {
  z-index: 8;
}

.orders-document-page .pending-order-table tbody td:nth-child(15) {
  background: #fffdf4;
}

.pending-refund-editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #fed7aa;
}

.pending-refund-editor label {
  display: grid;
  gap: 3px;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.pending-refund-editor label.wide {
  grid-column: 1 / -1;
}

.pending-refund-editor .editable-order-cell {
  min-height: 30px;
  border-color: #f7b4a8;
  background: #fff;
  color: #0f172a;
  font-size: 13px;
}

.orders-document-page .pending-order-actions {
  min-width: 190px;
  gap: 8px;
}

.orders-document-page .pending-order-actions button {
  min-height: 34px;
}

.pending-action-hint {
  padding: 6px 8px;
  border-radius: 6px;
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  line-height: 1.4;
}

#orderSplitDialog {
  z-index: 1100;
}

/* Final after-sale table sizing override. Keep this at the end so the dense sheet rules cannot shrink it. */
.orders-document-page .orders-spreadsheet > .table-wrap > table.pending-order-table {
  width: 2680px !important;
  min-width: 2680px !important;
  table-layout: fixed;
}

.orders-document-page .pending-order-table th:nth-child(4),
.orders-document-page .pending-order-table td:nth-child(4) {
  width: 360px !important;
  min-width: 360px !important;
}

.orders-document-page .pending-order-table th:nth-child(5),
.orders-document-page .pending-order-table td:nth-child(5) {
  width: 310px !important;
  min-width: 310px !important;
}

.orders-document-page .pending-order-table th:nth-child(13),
.orders-document-page .pending-order-table td:nth-child(13) {
  width: 180px !important;
  min-width: 180px !important;
}

.orders-document-page .pending-order-table th:nth-child(14),
.orders-document-page .pending-order-table td:nth-child(14) {
  width: 170px !important;
  min-width: 170px !important;
}

.orders-document-page .pending-order-table th:nth-child(15),
.orders-document-page .pending-order-table td:nth-child(15) {
  width: 220px !important;
  min-width: 220px !important;
}

/* After-sale requests must fit in one page width. Keep this after all dense order table rules. */
.orders-document-page .orders-spreadsheet > .table-wrap > table.pending-order-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}

.orders-document-page .orders-spreadsheet > .table-wrap:has(table.pending-order-table) {
  overflow-x: hidden;
}

.orders-document-page .pending-order-table th,
.orders-document-page .pending-order-table td {
  padding: 7px 7px !important;
  vertical-align: top;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}

.orders-document-page .pending-order-table th:nth-child(10),
.orders-document-page .pending-order-table td:nth-child(10),
.orders-document-page .pending-order-table th:nth-child(12),
.orders-document-page .pending-order-table td:nth-child(12),
.orders-document-page .pending-order-table th:nth-child(13),
.orders-document-page .pending-order-table td:nth-child(13),
.orders-document-page .pending-order-table th:nth-child(14),
.orders-document-page .pending-order-table td:nth-child(14) {
  display: none !important;
}

.orders-document-page .pending-order-table th:nth-child(1),
.orders-document-page .pending-order-table td:nth-child(1) { width: 7.5% !important; min-width: 0 !important; }
.orders-document-page .pending-order-table th:nth-child(2),
.orders-document-page .pending-order-table td:nth-child(2) { width: 3.5% !important; min-width: 0 !important; }
.orders-document-page .pending-order-table th:nth-child(3),
.orders-document-page .pending-order-table td:nth-child(3) { width: 8% !important; min-width: 0 !important; }
.orders-document-page .pending-order-table th:nth-child(4),
.orders-document-page .pending-order-table td:nth-child(4) { width: 17% !important; min-width: 0 !important; }
.orders-document-page .pending-order-table th:nth-child(5),
.orders-document-page .pending-order-table td:nth-child(5) { width: 15% !important; min-width: 0 !important; }
.orders-document-page .pending-order-table th:nth-child(6),
.orders-document-page .pending-order-table td:nth-child(6) { width: 7% !important; min-width: 0 !important; }
.orders-document-page .pending-order-table th:nth-child(7),
.orders-document-page .pending-order-table td:nth-child(7) { width: 4% !important; min-width: 0 !important; }
.orders-document-page .pending-order-table th:nth-child(8),
.orders-document-page .pending-order-table td:nth-child(8) { width: 4% !important; min-width: 0 !important; }
.orders-document-page .pending-order-table th:nth-child(9),
.orders-document-page .pending-order-table td:nth-child(9) { width: 5% !important; min-width: 0 !important; }
.orders-document-page .pending-order-table th:nth-child(11),
.orders-document-page .pending-order-table td:nth-child(11) { width: 9% !important; min-width: 0 !important; }
.orders-document-page .pending-order-table th:nth-child(15),
.orders-document-page .pending-order-table td:nth-child(15) { width: 12% !important; min-width: 0 !important; }

.pending-request-card {
  padding: 7px 8px;
  line-height: 1.32;
}

.pending-request-card strong,
.pending-request-card span,
.pending-request-card p {
  margin-bottom: 3px;
}

.pending-request-card p {
  max-height: 64px;
  overflow: auto;
}

.pending-refund-editor {
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-top: 5px;
  padding-top: 5px;
}

.pending-refund-editor label.wide {
  grid-column: 1 / -1;
}

.pending-refund-editor .editable-order-cell {
  min-height: 28px;
  padding: 5px 7px;
  font-size: 12px;
}

.pending-address-cell .order-address-lines {
  max-height: 74px;
  overflow: auto;
}

.pending-order-actions {
  gap: 6px;
}

.pending-order-actions button {
  min-height: 30px;
  padding: 6px 8px;
}
