:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #d9e0ea;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #b42318;
  --soft: #e9f5f3;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(145deg, #102a43, #1f6f78);
}

.auth-screen[hidden] { display: none; }
.auth-locked > .sidebar,
.auth-locked > main { visibility: hidden; }

.auth-card {
  width: min(420px, 100%);
  padding: 34px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
  display: grid;
  gap: 16px;
}

.auth-card h1, .auth-card p { margin: 0; }
.auth-card label { display: grid; gap: 7px; font-weight: 700; }
.auth-card label[hidden] { display: none; }
.auth-brand { color: #1f6f78; font-size: 13px; font-weight: 900; letter-spacing: .16em; }
.auth-error { min-height: 20px; color: #b42318; }
.topbar-user { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.auth-admin-grid { display: grid; gap: 26px; }
.system-status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.status-card { display: grid; gap: 7px; padding: 16px; border: 1px solid #d0d5dd; border-left-width: 5px; border-radius: 12px; background: #fff; }
.status-card.ok { border-left-color: #12b76a; }
.status-card.warning, .status-card.stale { border-left-color: #f79009; background: #fffcf5; }
.status-card.critical, .status-card.error { border-left-color: #f04438; background: #fffbfa; }
.status-card span, .status-card small { color: #667085; }
.status-card strong { font-size: 18px; }
.user-account-row { display: grid; grid-template-columns: 1.4fr 130px 90px 180px auto; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #e5e7eb; }
.user-account-row div { display: grid; }
.user-account-row small { color: #667085; }
.auth-audit { overflow-x: auto; }
.audit-row { display: grid; grid-template-columns: 160px 100px minmax(300px, 1fr) 60px; gap: 10px; padding: 8px 0; border-bottom: 1px solid #e5e7eb; font-size: 13px; }

@media (max-width: 900px) {
  .user-account-row { grid-template-columns: 1fr; }
  .audit-row { grid-template-columns: 1fr; }
  .topbar-user { align-items: flex-end; flex-direction: column; }
}

.badge.sale-status { border: 1px solid transparent; font-weight: 700; }
.badge.sale-status.sale-status-open { color: #155eef; background: #eaf2ff; border-color: #b7d0ff; }
.badge.sale-status.sale-status-shipping { color: #b54708; background: #fff3e0; border-color: #ffd49a; }
.badge.sale-status.sale-status-ready { color: #6941c6; background: #f1ebff; border-color: #d6c5ff; }
.badge.sale-status.sale-status-delivering { color: #175cd3; background: #eff8ff; border-color: #b2ddff; }
.badge.sale-status.sale-status-picked-up { color: #087f8c; background: #e5f8fa; border-color: #a8e3e8; }
.badge.sale-status.sale-status-delivered { color: #18794e; background: #e8f7ef; border-color: #a9dfc1; }
.badge.sale-status.sale-status-cancelled { color: #b42318; background: #feeceb; border-color: #f7b4af; }
.badge.sale-status.sale-status-merged { color: #475467; background: #eef1f4; border-color: #cfd5dc; }
.badge.sale-status.sale-status-default { color: #344054; background: #f2f4f7; border-color: #d0d5dd; }
.customer-picker-field input.is-locked { background: #eef6f5; border-color: #79b8b1; color: #174f49; font-weight: 700; cursor: not-allowed; }
.container-layout #containerForm.is-editing { border-color: #0f766e; box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14); }

.location-editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px;
  border: 1px solid #d9e2ec;
  border-radius: 10px;
  background: #f8fafc;
}

.location-editor .panel-title { grid-column: 1 / -1; }
.map-link-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.map-link-row button { white-space: nowrap; }

.delivery-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1.35fr) minmax(320px, .65fr);
  gap: 18px;
  align-items: start;
}

.delivery-plan-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.delivery-plan-list-panel { padding: 16px; border: 1px solid #dfe5ec; border-radius: 12px; background: #fff; }
.delivery-candidates-head { display: flex; justify-content: space-between; align-items: center; }
.delivery-candidates { display: grid; gap: 8px; max-height: 360px; overflow: auto; }
.delivery-candidate { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 11px; border: 1px solid #e4e9ef; border-radius: 9px; background: #fff; }
.delivery-candidate small, .delivery-plan-card small, .delivery-stop small { display: block; color: #667085; margin-top: 3px; }
.delivery-candidate.no-location { border-color: #f0b9a8; background: #fff8f5; }
.delivery-plan-list { display: grid; gap: 10px; }
.delivery-plan-card { padding: 13px; border: 1px solid #e3e8ef; border-radius: 10px; cursor: pointer; }
.delivery-plan-card:hover { border-color: #6c8ebf; background: #f7faff; }
.delivery-plan-card-head { display: flex; justify-content: space-between; gap: 8px; }
.delivery-route-summary { display: flex; flex-wrap: wrap; gap: 9px; margin: 12px 0; }
.delivery-route-summary span { padding: 7px 10px; border-radius: 999px; background: #eef4ff; color: #274c77; }
.delivery-stop-list { display: grid; gap: 9px; margin-top: 12px; }
.delivery-stop { display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid #e3e8ef; border-radius: 10px; }
.delivery-stop-sequence { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #285f9f; font-weight: 700; }
.delivery-map-placeholder { min-height: 160px; display: grid; place-items: center; text-align: center; padding: 20px; border-radius: 10px; background: linear-gradient(135deg, #eaf3ff, #f3f8f2); color: #42627f; }

@media (max-width: 980px) {
  .delivery-layout, .delivery-plan-form, .location-editor, .map-link-row { grid-template-columns: 1fr; }
  .location-editor .panel-title { grid-column: auto; }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

.sidebar {
  background: #102a43;
  color: #fff;
  padding: 20px 14px;
}

.brand {
  display: grid;
  gap: 4px;
  margin-bottom: 24px;
}

.brand strong {
  font-size: 24px;
  letter-spacing: 0;
}

.brand span {
  color: #bcccdc;
  font-size: 13px;
}

nav {
  display: grid;
  gap: 8px;
}

.nav {
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 11px 12px;
  text-align: left;
  color: #d9e2ec;
  background: transparent;
  cursor: pointer;
}

.nav.active,
.nav:hover {
  color: #fff;
  background: #1f4b6e;
}

main {
  min-width: 0;
  padding: 20px;
}

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

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.toolbar,
.section-head,
.upload-bar,
.actions,
.line-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.section-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

.toolbar {
  margin-bottom: 12px;
}

.bulk-panel {
  display: grid;
  grid-template-columns: minmax(260px, auto) 1fr;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.bulk-actions,
.sku-delete-box {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.sku-delete-box textarea {
  min-width: 320px;
  flex: 1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

input[type="checkbox"] {
  width: auto;
  min-width: 18px;
  height: 18px;
  padding: 0;
}

textarea {
  resize: vertical;
}

.toolbar input,
.toolbar select {
  width: 170px;
}

button,
.button {
  border: 0;
  border-radius: 6px;
  padding: 9px 13px;
  color: #fff;
  background: var(--primary);
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
}

button:hover,
.button:hover {
  background: var(--primary-dark);
}

button.secondary,
.button.secondary {
  color: var(--ink);
  background: #e2e8f0;
}

button.danger,
.button.danger {
  background: var(--danger);
}

button.small,
.button.small {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 13px;
}

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

.table-wrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
}

.table-wrap.compact {
  max-height: 420px;
}

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

.product-table {
  min-width: 1720px;
}

.product-table th:last-child,
.product-table td:last-child {
  position: sticky;
  right: 0;
  min-width: 132px;
  white-space: nowrap;
  background: #fff;
  box-shadow: -8px 0 12px -12px rgba(15, 23, 42, .45);
}

.product-table th:last-child {
  z-index: 3;
  background: #edf2f7;
}

.product-table .row-actions {
  min-width: 124px;
  flex-wrap: nowrap;
}

/* Compact desktop layout for 1080p displays using 125%/150% Windows scaling. */
@media (min-width: 981px) and (max-width: 1700px) {
  body {
    grid-template-columns: 180px 1fr;
    font-size: 13px;
  }

  .sidebar {
    padding: 14px 10px;
  }

  .brand {
    margin-bottom: 14px;
  }

  .brand strong {
    font-size: 21px;
  }

  nav {
    gap: 4px;
  }

  .nav {
    padding: 8px 10px;
  }

  main {
    padding: 12px;
  }

  .topbar {
    margin-bottom: 10px;
  }

  h1 {
    font-size: 21px;
  }

  .toolbar,
  .section-head,
  .upload-bar,
  .actions,
  .line-picker {
    gap: 7px;
  }

  .toolbar {
    margin-bottom: 8px;
  }

  .toolbar input,
  .toolbar select {
    width: 145px;
  }

  input,
  select,
  textarea {
    padding: 7px 8px;
  }

  button,
  .button {
    min-height: 32px;
    padding: 6px 10px;
  }

  button.small,
  .button.small {
    min-height: 26px;
    padding: 4px 7px;
    font-size: 12px;
  }

  .bulk-panel {
    gap: 8px;
    margin-bottom: 8px;
    padding: 7px;
  }

  .product-table {
    min-width: 1510px;
  }

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

  .product-table th:last-child,
  .product-table td:last-child {
    min-width: 112px;
  }

  .product-table .row-actions {
    min-width: 106px;
  }
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 9px;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf2f7;
  color: #334e68;
  white-space: nowrap;
}

td {
  background: #fff;
}

tr:hover td {
  background: #f8fafc;
}

.product-note-cell {
  min-width: 180px;
  max-width: 260px;
  color: #475569;
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
}

.product-container-history-row td {
  padding: 0 9px 10px 136px;
  background: #f8fafc;
  border-bottom-color: #dbe4ef;
}

.product-container-history {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-left: 3px solid #0f766e;
  background: #ffffff;
}

.container-history-label {
  flex: 0 0 auto;
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
  line-height: 28px;
  white-space: nowrap;
}

.container-history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.container-history-chip,
.container-history-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid #dbe4ef;
  border-radius: 6px;
  background: #f8fafc;
  color: #334e68;
  font-size: 12px;
  line-height: 1.3;
}

.container-history-chip strong {
  color: #102a43;
}

.container-history-chip em {
  color: #0f766e;
  font-style: normal;
}

.container-history-more {
  color: #64748b;
}

tr.eta-row.soon td {
  background: #fffbeb;
}

tr.eta-row.today td {
  background: #fff7ed;
}

tr.eta-row.overdue td {
  background: #fff1f2;
}

.thumb {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #f1f5f9;
}

.no-img {
  width: 58px;
  height: 58px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #eef2f7;
  font-size: 12px;
}

.image-tools {
  display: inline-grid;
  place-items: center;
  gap: 4px;
  max-width: 100%;
}

.image-preview-button {
  display: block;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: inherit;
  background: transparent;
  cursor: zoom-in;
}

.image-preview-button:hover {
  background: transparent;
}

.image-preview-button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.35);
  outline-offset: 2px;
}

.image-tools .thumb {
  display: block;
}

.image-download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  min-width: 46px;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--primary-dark);
  background: var(--soft);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.image-download-link:hover,
.image-download-link:focus {
  color: #fff;
  background: var(--primary);
}

.preview-open {
  overflow: hidden;
}

.debt-browser-open {
  overflow: hidden;
}

.debt-browse-button {
  background: #0f766e;
}

.customer-debt-browser {
  position: fixed;
  inset: 0;
  z-index: 950;
  visibility: hidden;
  pointer-events: none;
}

.customer-debt-browser.is-open {
  visibility: visible;
  pointer-events: auto;
}

.customer-debt-browser-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: rgba(15, 23, 42, 0.5);
  opacity: 0;
  transition: opacity 180ms ease;
}

.customer-debt-browser-backdrop:hover,
.customer-debt-browser-backdrop:focus,
.customer-debt-browser-backdrop:active {
  background: rgba(15, 23, 42, 0.5);
  box-shadow: none;
}

.customer-debt-browser.is-open .customer-debt-browser-backdrop {
  opacity: 1;
}

.customer-debt-browser-panel {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(1440px, calc(100vw - 48px));
  overflow-y: auto;
  background: #f6f8fb;
  box-shadow: -20px 0 60px rgba(15, 23, 42, 0.24);
  transform: translateX(100%);
  transition: transform 220ms ease;
}

.customer-debt-browser.is-open .customer-debt-browser-panel {
  transform: translateX(0);
}

#customerDebtBrowserContent {
  display: grid;
  gap: 16px;
  min-height: 100%;
  padding: 24px;
}

.customer-debt-browser-loading {
  display: grid;
  min-height: 70vh;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.customer-debt-browser-head,
.customer-debt-browser-actions,
.customer-debt-browser-statusline,
.customer-debt-browser-records,
.debt-browser-record,
.customer-debt-browser-head > div:first-child {
  display: flex;
}

.customer-debt-browser-head,
.customer-debt-browser-actions,
.debt-browser-record {
  align-items: center;
  gap: 16px;
}

.customer-debt-browser-head {
  justify-content: space-between;
}

.customer-debt-browser-actions,
.debt-browser-record {
  justify-content: space-between;
}

.customer-debt-browser-head h3 {
  margin: 3px 0;
  color: #0f172a;
  font-size: 28px;
}

.customer-debt-browser-head > div:first-child {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.customer-debt-browser-head p {
  margin: 0;
  color: var(--muted);
}

.customer-debt-browser-eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.customer-debt-browser-close {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  color: #334155;
  background: #e8edf3;
  font-size: 26px;
  line-height: 1;
}

.customer-debt-browser-pager {
  display: flex;
  gap: 8px;
}

.customer-debt-browser-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.customer-debt-browser-summary div {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-right: 1px solid var(--line);
}

.customer-debt-browser-summary div:last-child {
  border-right: 0;
}

.customer-debt-browser-summary span,
.debt-browser-record small {
  color: var(--muted);
  font-size: 12px;
}

.customer-debt-browser-summary strong {
  color: #1e293b;
  white-space: nowrap;
}

.customer-debt-browser-summary .is-balance {
  color: #fff;
  background: #0f766e;
}

.customer-debt-browser-summary .is-balance span,
.customer-debt-browser-summary .is-balance strong {
  color: #fff;
}

.customer-debt-browser-summary .is-cartons {
  background: #e8f6f4;
}

.customer-debt-browser-summary .is-cartons span,
.customer-debt-browser-summary .is-cartons strong {
  color: #0f5f59;
}

.customer-debt-browser-statusline {
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #e9f2f1;
  color: #334155;
  font-size: 13px;
}

.debt-browser-note {
  flex: 1 1 100%;
}

.customer-debt-browser-section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.customer-debt-browser-section .panel-title {
  margin-bottom: 12px;
}

.customer-debt-browser-records {
  align-items: stretch;
  gap: 16px;
}

.customer-debt-browser-records > section {
  flex: 1 1 0;
}

.debt-browser-record {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.debt-browser-record > span {
  display: grid;
  gap: 4px;
}

.debt-browser-documents {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.debt-browser-documents a {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--primary-dark);
  background: var(--soft);
  text-decoration: none;
}

.debt-browser-document-head > div {
  display: grid;
  gap: 3px;
}

.debt-document-upload-button {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.debt-document-upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.debt-browser-documents a > span {
  display: grid;
  gap: 3px;
}

.debt-browser-documents small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.debt-browser-document-empty {
  padding: 22px;
  border: 1px dashed #b8c7d9;
  border-radius: 8px;
  color: var(--muted);
  background: #f8fafc;
  text-align: center;
}

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  padding: 24px;
}

.image-preview-modal.is-open {
  display: grid;
  place-items: center;
}

.image-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
}

.image-preview-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  width: min(1120px, 96vw);
  max-height: 92vh;
  padding: 14px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.35);
}

.image-preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.image-preview-toolbar span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#imagePreviewImg {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 86px);
  margin: 0 auto;
  object-fit: contain;
  border-radius: 6px;
  background: #f8fafc;
}

.status-select {
  width: 112px;
  min-width: 112px;
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 700;
  border-width: 2px;
  background: #fff;
}

.status-select[data-status="正常"] {
  color: #28a745;
  border-color: #28a745;
  background: #eefaf1;
}

.status-select[data-status="需要补货"] {
  color: #7a5b00;
  border-color: #ffc107;
  background: #fff8df;
}

.status-select[data-status="没货"] {
  color: #dc3545;
  border-color: #dc3545;
  background: #fff0f2;
}

.status-select[data-status="暂停采购"] {
  color: #0d6efd;
  border-color: #0d6efd;
  background: #eef5ff;
}

.status-select[data-status="不再采购"] {
  color: #6c757d;
  border-color: #6c757d;
  background: #f3f4f5;
}

.status-select[data-status="清仓处理"] {
  color: #e8590c;
  border-color: #e8590c;
  background: #fff4e6;
}

.status-select[data-status="查看库存状态"] {
  color: #7b2cbf;
  border-color: #7b2cbf;
  background: #f3e8ff;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tracking-button {
  white-space: nowrap;
}

.tracking-info {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.tracking-info span {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.eta-reminder-panel {
  margin-bottom: 12px;
}

.eta-reminder {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid #facc15;
  border-radius: 8px;
  background: #fffbeb;
}

.eta-reminder.empty {
  color: var(--muted);
  border-color: var(--line);
  background: #f8fafc;
}

.eta-reminder-item {
  min-height: 34px;
  gap: 6px;
  padding: 6px 10px;
  color: #334e68;
  border: 1px solid #facc15;
  background: #fff;
}

.eta-reminder-item:hover {
  color: #1f2937;
  background: #fef3c7;
}

.eta-reminder-item.today {
  border-color: #fb923c;
  background: #fff7ed;
}

.eta-reminder-item.overdue {
  border-color: #f43f5e;
  background: #fff1f2;
}

.eta-reminder-item small {
  color: var(--muted);
}

.eta-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.eta-badge.soon {
  color: #92400e;
  background: #fef3c7;
}

.eta-badge.today {
  color: #c2410c;
  background: #ffedd5;
}

.eta-badge.overdue {
  color: #be123c;
  background: #ffe4e6;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

label {
  display: grid;
  gap: 6px;
  color: #334e68;
  font-size: 13px;
  font-weight: 600;
}

.readonly-field {
  background: #f1f5f9;
  color: var(--primary-dark);
  font-weight: 700;
}

.wide {
  grid-column: 1 / -1;
}

#toast {
  position: fixed;
  z-index: 10000;
  top: 18px;
  right: 22px;
  max-width: min(460px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid #99d5cf;
  border-radius: 8px;
  background: #ecfdf9;
  box-shadow: 0 10px 28px rgba(16, 42, 67, 0.2);
  color: var(--primary-dark);
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

#toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

#toast.is-error {
  border-color: #f0aaa4;
  background: #fff1f0;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}

.detail-subhead {
  margin: 16px 0 10px;
}

.detail-subhead h3 {
  margin: 0;
}

.price-summary {
  color: var(--primary-dark);
  font-weight: 700;
}

.supplier-price-table,
.transit-item-table {
  margin-bottom: 12px;
}

.supplier-price-table table {
  min-width: 760px;
}

.transit-item-table table {
  min-width: 1180px;
}

.supplier-price-form {
  display: grid;
  grid-template-columns: 1.2fr 150px 160px 1.5fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.supplier-price-editor,
.peer-price-editor,
.product-image-editor {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.edit-image-upload {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.edit-image-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.compact-head {
  margin-bottom: 0;
}

.compact-head h3 {
  margin: 0;
}

.supplier-price-inputs,
.peer-price-inputs {
  display: grid;
  grid-template-columns: 1.1fr 140px 150px 1.5fr auto;
  gap: 10px;
  align-items: center;
}

.supplier-price-inputs input,
.supplier-price-inputs select,
.peer-price-inputs input {
  min-width: 0;
}

.field {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdff;
}

.field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.image-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.image-item .image-tools,
.image-item .image-preview-button {
  width: 100%;
}

.image-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.image-item p {
  margin: 8px 0;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--primary-dark);
  background: var(--soft);
  font-size: 12px;
  font-weight: 700;
}

.order-layout {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(460px, 0.82fr);
  gap: 18px;
}

.order-workspace {
  align-items: start;
  margin-bottom: 18px;
}

.order-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.order-stats span,
.order-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef6f5;
  color: var(--primary-dark);
  font-weight: 700;
  white-space: nowrap;
}

.order-flow-cell {
  display: grid;
  gap: 4px;
  min-width: 132px;
}

.order-flow-cell small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}

.fulfillment-badge,
.summary-status {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.fulfillment-badge.done,
.summary-status.done {
  color: #0f5132;
  background: #d1e7dd;
}

.fulfillment-badge.partial,
.summary-status.partial {
  color: #7a4d00;
  background: #fff3cd;
}

.fulfillment-badge.pending,
.summary-status.pending {
  color: #842029;
  background: #f8d7da;
}

.fulfillment-badge.empty,
.summary-status.empty {
  color: #475569;
  background: #e2e8f0;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.panel-title span,
.muted-line {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.order-fields,
.order-edit-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.8fr;
  gap: 12px;
}

.order-edit-grid {
  grid-template-columns: 240px 170px 150px minmax(320px, 520px);
  align-items: end;
  justify-content: start;
}

.order-edit-grid .wide {
  grid-column: auto;
}

.order-edit-grid textarea {
  min-height: 38px;
  height: 38px;
  resize: vertical;
}

.order-list-panel,
.order-detail-panel {
  display: grid;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.order-detail-panel {
  display: none;
  margin-top: 18px;
}

.order-detail-panel.is-open {
  display: grid;
}

.order-detail-panel form {
  display: grid;
  gap: 12px;
}

.order-product-picker {
  grid-template-columns: minmax(260px, 1fr) 120px 120px auto auto;
}

.order-detail-picker {
  grid-template-columns: minmax(280px, 520px) 120px 120px auto auto auto;
  justify-content: start;
  align-items: end;
}

.order-summary-grid div {
  display: grid;
  gap: 4px;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.order-summary-grid span {
  color: var(--muted);
  font-size: 12px;
}

.order-summary-grid strong {
  font-size: 18px;
}

.selected-row td {
  background: #eef6f5;
}

.order-list-table table {
  min-width: 0;
}

.order-supplier-group td {
  padding: 8px 9px;
  background: #eef6f5;
  border-top: 1px solid #c9dfdc;
  border-bottom: 1px solid #c9dfdc;
  cursor: pointer;
}

.order-supplier-group.collapsed td {
  background: #f1f5f9;
}

.supplier-toggle-button {
  margin-left: auto;
}

.order-supplier-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--primary-dark);
}

.order-supplier-group-title span {
  color: #486581;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.draft-order-table table {
  min-width: 940px;
}

.order-detail-table table {
  min-width: 1360px;
  table-layout: fixed;
}

.order-detail-table th:nth-child(1),
.order-detail-table td:nth-child(1) {
  width: 74px;
}

.order-detail-table th:nth-child(2),
.order-detail-table td:nth-child(2) {
  width: 130px;
}

.order-detail-table th:nth-child(3),
.order-detail-table td:nth-child(3) {
  width: 150px;
}

.order-detail-table th:nth-child(4),
.order-detail-table td:nth-child(4) {
  width: 150px;
}

.order-detail-table th:nth-child(5),
.order-detail-table td:nth-child(5) {
  width: 130px;
}

.order-detail-table th:nth-child(6),
.order-detail-table td:nth-child(6) {
  width: 110px;
}

.order-detail-table th:nth-child(7),
.order-detail-table td:nth-child(7),
.order-detail-table th:nth-child(8),
.order-detail-table td:nth-child(8),
.order-detail-table th:nth-child(9),
.order-detail-table td:nth-child(9) {
  width: 130px;
}

.order-detail-table th:nth-child(10),
.order-detail-table td:nth-child(10) {
  width: 150px;
}

.order-detail-table th:nth-child(11),
.order-detail-table td:nth-child(11) {
  width: 140px;
}

.order-line-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.order-line-actions button {
  width: 100%;
}

.order-line-flow {
  display: grid;
  gap: 2px;
  margin-top: 7px;
  color: #475569;
  font-size: 12px;
  line-height: 1.35;
}

.order-thumb {
  width: 46px;
  height: 46px;
}

.order-image-cell,
.product-image-cell,
.container-image-cell {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  justify-items: center;
  gap: 4px;
}

.order-image-cell .image-tools,
.product-image-cell .image-tools,
.container-image-cell .image-tools {
  display: contents;
}

.order-image-cell .image-preview-button,
.product-image-cell .image-preview-button,
.container-image-cell .image-preview-button,
.order-image-cell > .no-img,
.product-image-cell > .no-img,
.container-image-cell > .no-img {
  grid-column: 1 / -1;
}

.order-image-cell:not(:has(.image-download-link)) .upload-chip,
.product-image-cell:not(:has(.image-download-link)) .upload-chip,
.container-image-cell:not(:has(.image-download-link)) .upload-chip {
  grid-column: 1 / -1;
}

.upload-chip {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 46px;
  padding: 3px 6px;
  border-radius: 999px;
  color: var(--primary-dark);
  background: var(--soft);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.upload-chip input {
  display: none;
}

.upload-chip.disabled {
  color: #94a3b8;
  background: #f1f5f9;
  cursor: not-allowed;
}

.order-detail-table input,
.draft-order-table input {
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
}

.order-detail-table td {
  vertical-align: top;
}

.container-layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.75fr) minmax(560px, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.container-detail {
  display: grid;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

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

.order-form,
.excel-tools {
  display: grid;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.line-picker {
  display: grid;
  grid-template-columns: 1fr 120px auto;
}

.line-picker.order-product-picker {
  grid-template-columns: minmax(280px, 760px) 120px 120px auto auto;
  justify-content: start;
}

.line-picker.order-detail-picker {
  grid-template-columns: minmax(280px, 520px) 120px 120px auto auto auto;
  justify-content: start;
  align-items: end;
}

.line-picker.sale-product-picker {
  grid-template-columns: minmax(280px, 760px) 120px 120px auto;
  justify-content: start;
}

.sale-product-search-wrap {
  position: relative;
  min-width: 0;
}

.sale-product-search-wrap > input {
  width: 100%;
}

.sale-product-suggestions {
  position: absolute;
  z-index: 60;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18);
}

.sale-product-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #edf2f7;
  border-radius: 0;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
  text-align: left;
}

.sale-product-suggestion-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-product-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 3px 7px;
  border: 1px solid var(--sale-product-status-color, #64748b);
  border-radius: 999px;
  color: var(--sale-product-status-color, #64748b);
  background: color-mix(in srgb, var(--sale-product-status-color, #64748b) 13%, white);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}

.sale-product-status > span {
  margin-right: 5px;
  font-size: 11px;
  font-weight: 900;
}

.sale-product-status[data-status="没货"],
.sale-product-status[data-status="暂停采购"],
.sale-product-status[data-status="不再采购"] {
  border-width: 2px;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--sale-product-status-color) 22%, transparent);
}

.sale-product-suggestion[data-product-status="没货"] {
  border-left: 5px solid #dc3545;
  background: #fff0f2;
}

.sale-product-suggestion[data-product-status="暂停采购"] {
  border-left: 5px solid #0d6efd;
  background: #eef5ff;
}

.sale-product-suggestion[data-product-status="不再采购"] {
  border-left: 5px solid #6c757d;
  background: #f3f4f5;
}

.sale-product-suggestion[data-product-status="没货"]:hover,
.sale-product-suggestion[data-product-status="没货"]:focus,
.sale-product-suggestion[data-product-status="暂停采购"]:hover,
.sale-product-suggestion[data-product-status="暂停采购"]:focus,
.sale-product-suggestion[data-product-status="不再采购"]:hover,
.sale-product-suggestion[data-product-status="不再采购"]:focus {
  filter: brightness(0.97);
}

.sale-product-suggestion:first-child {
  background: #ecfdf5;
  font-weight: 700;
}

.sale-product-suggestion:hover,
.sale-product-suggestion:focus {
  background: #e6fffa;
}

.sale-product-suggestion:last-child {
  border-bottom: 0;
}

.sale-payment-inline,
.sale-confirm-form,
.sale-merge-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
  align-items: end;
}

.batch-payment-allocations {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.batch-allocation-head,
.batch-allocation-row,
.batch-allocation-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.batch-allocation-row {
  grid-template-columns: minmax(0, 1fr) 140px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.batch-allocation-row span,
.batch-allocation-row small {
  display: block;
}

.batch-allocation-row input {
  width: 150px;
}

.batch-allocation-total {
  justify-content: flex-end;
  font-weight: 700;
  color: #047857;
}

.batch-allocation-total.is-error {
  color: #b91c1c;
}

.customer-credit-note-form {
  margin: 16px 0;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  border: 2px solid #f59e0b;
  background: #fffbeb;
}

.credit-note-items {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  background: #fff;
}

.credit-note-item-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 140px 160px;
  gap: 10px;
  align-items: end;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.credit-note-item-row span small {
  display: block;
  color: var(--muted);
}

.sale-confirm-form {
  grid-template-columns: repeat(5, minmax(140px, 220px)) auto;
  background: #f8fafc;
}

.sale-merge-form {
  grid-template-columns: minmax(260px, 520px) auto;
  background: #f8fafc;
}

.sale-ready-alert {
  display: grid;
  gap: 4px;
  margin: 14px 0;
  padding: 12px 14px;
  border: 2px solid #f59e0b;
  border-radius: 8px;
  color: #78350f;
  background: #fffbeb;
}

.sale-ready-inline-alert {
  color: #b45309;
  font-weight: 700;
}

.customer-picker-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.sale-customer-search-wrap {
  display: grid;
  gap: 4px;
}

.sale-customer-search-wrap > input { width: 100%; }

.sale-customer-suggestions {
  max-height: 230px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.sale-customer-suggestion {
  display: block;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-bottom: 1px solid #edf2f7;
  border-radius: 0;
  color: var(--text);
  background: #fff;
  text-align: left;
}

.sale-customer-search-wrap .sale-customer-suggestions > .sale-customer-suggestion {
  color: #111827 !important;
  background: #fff !important;
}
.sale-customer-search-wrap .sale-customer-suggestion:first-child { color: #111827 !important; background: #fff !important; font-weight: 700; }
.sale-customer-search-wrap .sale-customer-suggestion:hover,
.sale-customer-search-wrap .sale-customer-suggestion:focus,
.sale-customer-search-wrap .sale-customer-suggestion.is-active { color: #111827 !important; background: #e5e7eb !important; }
.sale-customer-suggestion:last-child { border-bottom: 0; }

.draft-sale-table table,
.sale-list-table table,
.sale-detail-table table {
  min-width: 1120px;
}

/*
 * Keep the sales workspace comfortable on desktop displays with OS/browser
 * scaling. At these widths two columns technically fit, but neither pane is
 * wide enough to make its data table useful, so let each pane use the full
 * content width instead.
 */
@media (min-width: 981px) and (max-width: 1700px) {
  #sales {
    font-size: 13px;
  }

  #sales h3 {
    font-size: 15px;
  }

  #sales th,
  #sales td,
  #sales button.small,
  #sales .button.small {
    font-size: 12px;
  }

  .sale-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .sale-workspace .order-create-panel,
  .sale-workspace .order-list-panel {
    min-width: 0;
  }

  .sale-list-table {
    max-height: 520px;
  }
}

/* Match the visual density of a 2560px workstation on common 1920px shop PCs. */
@media (min-width: 1701px) and (max-width: 2100px) {
  body {
    min-height: 125vh;
    zoom: 0.8;
  }
}

.container-picker {
  grid-template-columns: minmax(180px, 0.45fr) minmax(300px, 1fr) 120px auto;
}

.container-picker:has(#containerDirectProduct) {
  grid-template-columns: minmax(300px, 1fr) 110px 130px 140px auto;
}

.container-batch-panel {
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid #d7dee8;
  border-radius: 10px;
  background: #f8fafc;
}

.container-batch-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.container-batch-toolbar select,
.container-batch-toolbar input { min-width: 210px; }
.container-batch-table-wrap { max-height: 420px; }
.container-batch-cartons { width: 100px; }

.container-supplier-input {
  min-width: 120px;
  padding: 7px 8px;
}

.domestic-warehouse-table {
  min-width: 1320px;
}

.development-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.42fr) minmax(620px, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.development-form {
  grid-template-columns: repeat(2, minmax(160px, 1fr));
}

.development-list-panel,
.development-detail-panel {
  display: grid;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.development-detail-panel {
  display: none;
}

.development-detail-panel.is-open {
  display: grid;
}

.supplier-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.42fr) minmax(680px, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.supplier-form {
  grid-template-columns: repeat(2, minmax(160px, 1fr));
}

.supplier-list-panel {
  display: grid;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.supplier-table small {
  color: var(--muted);
}

.customer-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.42fr) minmax(680px, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.customer-form {
  grid-template-columns: repeat(2, minmax(160px, 1fr));
}

.customer-list-panel,
.customer-detail-panel {
  display: grid;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.customer-detail-panel {
  display: none;
}

.customer-detail-panel.is-open {
  display: grid;
}

.customer-detail-grid,
.customer-records-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(360px, 1fr));
  gap: 14px;
  align-items: start;
}

.customer-inline-form {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
}

.customer-summary-grid .field {
  min-height: 58px;
}

td small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.badge.open-debt {
  background: #fff4db;
  color: #8a4b00;
  border-color: #f3c46b;
}

.badge.overdue {
  background: #ffe8e8;
  color: #b42318;
  border-color: #f3a6a0;
}

.badge.settled {
  background: #e8f7ef;
  color: #166534;
  border-color: #9bd6b1;
}

.badge.partial {
  background: #e8f1ff;
  color: #1d4ed8;
  border-color: #9bbcf3;
}

.badge.write-off {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

.development-table {
  min-width: 980px;
}

.development-status-select {
  width: 118px;
  min-width: 118px;
  padding: 6px 8px;
  border-width: 2px;
  font-size: 13px;
  font-weight: 700;
}

.sku-check-hint {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sku-check-hint.ok {
  color: var(--primary-dark);
}

.sku-check-hint.conflict {
  color: var(--danger);
}

.sku-check-hint.checking {
  color: #64748b;
}

.development-tabs {
  display: grid;
  gap: 18px;
}

.development-tabs section {
  display: grid;
  gap: 10px;
}

.development-inline-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.development-inline-form input,
.development-inline-form select,
.development-inline-form textarea {
  min-width: 0;
}

.development-inline-form.timeline-form {
  grid-template-columns: 150px minmax(260px, 1fr) minmax(220px, 0.6fr) auto;
}

.inline-check {
  display: inline-flex;
  grid-auto-flow: column;
  gap: 6px;
  align-items: center;
  min-height: 38px;
}

.development-wide-table {
  min-width: 1380px;
}

.development-summary div {
  display: grid;
  gap: 4px;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.development-summary span {
  color: var(--muted);
  font-size: 12px;
}

.development-summary strong {
  font-size: 17px;
}

.development-summary small {
  color: var(--muted);
  font-size: 12px;
}

.wholesale-price-card {
  align-content: start;
}

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

.wholesale-price-form input {
  min-width: 0;
  padding: 7px 8px;
  font-weight: 700;
}

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

.timeline-entry {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: #fbfdff;
}

.timeline-entry div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.timeline-entry span {
  color: var(--muted);
  font-size: 13px;
}

.timeline-entry p {
  margin: 0;
  white-space: normal;
}

.task-done td {
  color: var(--muted);
  background: #f8fafc;
}

.task-done td:nth-child(2) {
  text-decoration: line-through;
}

pre {
  margin: 0;
  min-height: 80px;
  white-space: pre-wrap;
  color: #334e68;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

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

  .sidebar {
    position: static;
  }

  nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-grid,
  .detail-grid,
  .supplier-price-form,
    .supplier-price-inputs,
    .peer-price-inputs,
  .bulk-panel,
  .order-fields,
  .order-edit-grid,
  .order-layout,
    .container-layout,
    .supplier-layout,
    .customer-layout,
    .supplier-form,
    .customer-form,
    .customer-detail-grid,
    .customer-records-grid,
    .customer-inline-form,
    .customer-credit-note-form,
    .development-layout,
    .development-form,
    .development-inline-form,
    .development-inline-form.timeline-form,
    .customer-picker-field,
    .sale-payment-inline,
    .sale-confirm-form,
    .sale-merge-form,
    .summary-grid {
    grid-template-columns: 1fr;
  }

  .credit-note-item-row {
    grid-template-columns: 1fr;
  }

  .line-picker,
  .container-picker,
  .order-product-picker,
  .order-detail-picker,
  .sale-product-picker {
    grid-template-columns: 1fr;
  }

  .toolbar input,
  .toolbar select {
    width: 100%;
  }

  .customer-debt-browser-panel {
    width: 100vw;
  }

  #customerDebtBrowserContent {
    padding: 16px;
  }

  .customer-debt-browser-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .customer-debt-browser-summary div:nth-child(2n) {
    border-right: 0;
  }

  .customer-debt-browser-actions,
  .customer-debt-browser-records {
    align-items: stretch;
    flex-direction: column;
  }
}
