:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f1f5f9;
  --ink: #172033;
  --muted: #64748b;
  --line: #d9e2ec;
  --primary: #1957d2;
  --primary-dark: #123f9b;
  --teal: #0f766e;
  --amber: #b45309;
  --red: #c24141;
  --green: #15803d;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

.access-locked .app-shell {
  display: none;
}

.access-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #eef6ff 0%, #f7fafc 45%, #eef9f3 100%);
}

.access-locked .access-screen {
  display: flex;
}

.access-card {
  display: grid;
  gap: 16px;
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-title-block {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 4px;
  text-align: center;
}

.login-brand-logo {
  display: block;
  width: min(300px, 100%);
  height: auto;
  object-fit: contain;
}

.login-logo {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: #111827;
  color: #38bdf8;
  font-size: 18px;
  font-weight: 900;
}

.access-card h1 {
  margin: 0;
  color: #111827;
  font-size: 28px;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
}

.access-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.about-entry-link {
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.about-entry-link:hover {
  text-decoration: underline;
}

.login-hint {
  font-size: 12px;
  line-height: 1.55;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 16px;
  background: #111827;
  color: #f8fafc;
}

.brand {
  display: grid;
  place-items: center;
  min-height: 62px;
  padding: 8px;
  border-radius: 8px;
  background: #ffffff;
}

.sidebar-brand-logo {
  display: block;
  width: 100%;
  max-width: 204px;
  height: auto;
  object-fit: contain;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #38bdf8;
  color: #082f49;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

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

.brand div span {
  margin-top: 3px;
  color: #b6c4d8;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  border: 0;
  border-radius: 8px;
  padding: 11px 12px;
  background: transparent;
  color: #dbe7f5;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: #243349;
  color: #ffffff;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.main {
  min-width: 0;
  padding: 24px;
}

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

.topbar-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.access-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #b8c7dc;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.version-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  background: #ecfdf5;
  color: #166534;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.version-badge[data-status="checking"] {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.version-badge[data-status="mismatch"],
.version-badge[data-status="error"] {
  border-color: #fecaca;
  background: #fff1f2;
  color: #b91c1c;
}

.format-select {
  min-width: 132px;
}

.language-select {
  display: grid;
  gap: 5px;
  min-width: 126px;
}

.language-select span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.language-control {
  width: 100%;
}

.access-language-select {
  width: 100%;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.18;
}

h2 {
  margin-bottom: 4px;
  font-size: 19px;
}

.section-head p,
.flow-step p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.scanner-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  background: #ecfdf5;
  color: #166534;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.scanner-pill span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 29px;
  line-height: 1;
}

.metric.alert strong {
  color: var(--red);
}

.metric.attention strong,
.return-arrival-count {
  color: #b45309;
}

.prealert-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
}

.return-arrival-count {
  display: block;
  margin-top: 5px;
  font-weight: 800;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-panel[aria-busy="true"] {
  cursor: progress;
  opacity: 0.68;
  pointer-events: none;
}

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

.tight-head {
  margin-top: 18px;
  margin-bottom: 10px;
}

.button-row,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

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

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

.secondary-btn {
  border-color: #bfd0e4;
  background: #fff;
  color: #1d3557;
}

.secondary-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.danger-btn {
  border-color: #fecaca;
  color: #b91c1c;
}

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

.ghost-btn,
.danger-ghost-btn {
  width: 100%;
  border-color: #334155;
  background: #172033;
  color: #e2e8f0;
}

.danger-ghost-btn {
  color: #fecaca;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.file-btn.is-disabled {
  cursor: wait;
  opacity: 0.62;
}

.file-btn input {
  display: none;
}

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

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

.marketplace-connector {
  margin-top: 12px;
}

.return-processing-form {
  border-color: #67e8f9;
  background: #ecfeff;
}

.checkbox-control-line {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-weight: 600;
}

.checkbox-control-line input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
}

.return-batch-form {
  border-color: #c4b5fd;
  background: #f5f3ff;
}

.return-hk-scan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.return-hk-scan-head h3,
.return-hk-scan-head p {
  margin: 0;
}

.return-hk-scan-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.return-hk-scan-label input {
  min-height: 48px;
  border-color: #2563eb;
  background: #fff;
  font-size: 18px;
  font-weight: 800;
}

.return-hk-import-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.return-hk-import-row .file-btn {
  width: auto;
  min-height: 38px;
  margin: 0;
}

.return-hk-import-summary {
  display: grid;
  gap: 4px;
  border-color: #93c5fd;
  background: #eff6ff;
}

.return-hk-import-summary .error {
  color: #b91c1c;
}

.return-hk-scan-wrap {
  max-height: 320px;
}

.return-hk-scan-wrap table {
  min-width: 1580px;
}

.return-hk-scan-wrap th,
.return-hk-scan-wrap td {
  padding: 8px 10px;
  font-size: 12px;
}

.return-hk-scan-wrap .scan-sequence {
  width: 58px;
  text-align: center;
  font-weight: 800;
}

.return-hk-scan-wrap .scan-imei {
  white-space: nowrap;
  font-family: Consolas, "Courier New", monospace;
  font-weight: 700;
}

.return-refurbish-form {
  border-color: #86efac;
  background: #f0fdf4;
}

.return-refused-form {
  border-color: #fdba74;
  background: #fff7ed;
}

.settlement-rates-form {
  border-color: #fde68a;
  background: #fffbeb;
}

.international-rate-section {
  margin: 14px 0 18px;
  border-top: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
  padding: 14px 0;
}

.international-rate-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.international-rate-heading h3,
.international-rate-heading p {
  margin: 0;
}

.international-rate-heading h3 {
  font-size: 17px;
}

.international-rate-heading p {
  margin-top: 4px;
  color: #475569;
  font-size: 13px;
}

.international-rate-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.international-rate-table-wrap {
  max-height: 360px;
}

.international-rate-table-wrap th,
.international-rate-table-wrap td {
  padding: 8px 10px;
  font-size: 13px;
}

.international-rate-input {
  width: 110px;
  min-height: 34px;
  padding: 6px 8px;
  font-weight: 700;
}

.custom-fee-section {
  margin: 16px 0;
}

.custom-fee-section h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.custom-fee-form {
  border-color: #bae6fd;
  background: #f0f9ff;
}

.custom-fee-table-wrap {
  max-height: 320px;
  margin-bottom: 14px;
}

.attention-text {
  color: #b91c1c;
  font-weight: 700;
}

.duplicate-order-warning {
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid #ef4444;
  border-radius: 6px;
  background: #fff1f2;
  color: #991b1b;
}

.duplicate-order-warning[hidden] {
  display: none;
}

.duplicate-order-warning strong {
  display: block;
  margin-bottom: 7px;
}

.duplicate-order-warning div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  font-weight: 700;
}

.duplicate-order-number {
  color: #b91c1c;
  font-weight: 800;
}

.duplicate-order-tag {
  margin-left: 7px;
  vertical-align: middle;
}

.success-text {
  color: #047857;
  font-weight: 700;
}

.backup-settings-form {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.restore-backup-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 10px 12px;
  align-items: end;
  margin: 12px 0 16px;
  padding: 14px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff7ed;
}

.restore-backup-panel label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.restore-backup-panel p {
  grid-column: 1 / -1;
  margin: 0;
  color: #9a3412;
  font-size: 12px;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 12px;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

#customerAccountForm .permission-grid {
  display: none;
}

.permission-grid legend {
  padding: 0 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.permission-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  font-size: 12px;
}

.permission-grid input {
  width: auto;
  min-height: auto;
}

.account-permission-row td {
  padding-top: 0;
  background: #f8fafc;
}

.account-permission-panel {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.permission-row-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #334155;
  font-size: 12px;
}

.permission-row-title span {
  color: var(--muted);
  font-weight: 600;
}

.permission-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 7px 12px;
}

.permission-checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  font-size: 12px;
  font-weight: 700;
}

.permission-checks input {
  width: auto;
  min-height: auto;
}

.statement-sheet {
  margin-bottom: 16px;
}

.statement-sheet h3 {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #fff7ed;
  font-size: 18px;
  text-align: center;
}

.statement-sheet .table-wrap {
  border-radius: 0 0 8px 8px;
}

.receivable-table {
  min-width: 620px;
}

.receivable-detail-wrap .receivable-table {
  min-width: 420px;
}

.receivable-table th {
  background: #facc15;
  color: #111827;
  text-align: center;
}

.receivable-table td {
  text-align: center;
}

.receivable-table td:nth-child(2) {
  text-align: left;
}

.receivable-total-row td {
  background: #0ea5e9;
  color: #061826;
  font-weight: 800;
}

.toolbar {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.segmented-field {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.segmented-field legend {
  margin-bottom: 6px;
  padding: 0;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 38px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}

.segmented-control label {
  display: grid;
  place-items: center;
  min-width: 0;
  border-right: 1px solid #cbd5e1;
  cursor: pointer;
}

.segmented-control label:last-child {
  border-right: 0;
}

.segmented-control input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  opacity: 0;
}

.segmented-control span {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  padding: 7px 6px;
  color: #334155;
  text-align: center;
}

.segmented-control input:checked + span {
  background: var(--primary);
  color: #fff;
}

.segmented-control input:focus-visible + span {
  outline: 2px solid #38bdf8;
  outline-offset: -2px;
}

.toggle-field {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

.toggle-field input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

.scan-strip {
  grid-template-columns: minmax(220px, 340px) minmax(220px, 340px) minmax(0, 1fr);
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

label.checkbox-line {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding-top: 18px;
}

label.checkbox-line input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(25, 87, 210, 0.12);
}

input[readonly] {
  background: #f1f5f9;
  color: #475569;
}

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

.muted-note {
  min-height: 38px;
  padding: 10px 12px;
  border: 1px solid #dbe6f2;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.selected-box,
.active-order,
.pick-result {
  min-height: 52px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: #334155;
  font-size: 13px;
}

.selected-box.attention {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.import-status {
  margin-bottom: 14px;
}

#receivableShippingAudit strong,
#receivableShippingAudit span {
  display: block;
}

#receivableShippingAudit span {
  margin-top: 4px;
}

.compact-box {
  min-width: 220px;
  min-height: 56px;
}

.account-actions {
  align-self: end;
  align-items: end;
}

.active-order {
  margin-bottom: 12px;
  background: #eef6ff;
}

.active-order span {
  display: block;
  margin-top: 6px;
}

.pick-pack-together-warning {
  margin-top: 12px;
  padding: 10px 0 10px 12px;
  border-left: 4px solid #d97706;
  background: #fffbeb;
  color: #92400e;
}

.pick-pack-together-warning strong,
.pick-pack-together-warning span {
  display: block;
}

.pick-pack-flag {
  display: block;
  margin-top: 4px;
  color: #92400e;
  font-size: 12px;
  font-weight: 900;
  white-space: normal;
}

.mystery-order-flag {
  display: block;
  margin-top: 4px;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 900;
  white-space: normal;
}

tr.mystery-order-row td {
  box-shadow: inset 0 1px 0 #fecaca, inset 0 -1px 0 #fecaca;
}

.mystery-order-warning {
  margin-top: 12px;
  padding: 12px 0 12px 14px;
  border-left: 5px solid #dc2626;
  background: #fff1f2;
  color: #991b1b;
}

.mystery-order-warning.is-confirmed {
  border-left-color: #15803d;
  background: #f0fdf4;
  color: #166534;
}

.mystery-order-warning strong,
.mystery-order-warning span {
  display: block;
}

.mystery-order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.mystery-order-actions .mini-btn {
  min-height: 36px;
  font-size: 13px;
  font-weight: 800;
}

.mystery-order-actions .primary-mini-btn {
  border-color: #15803d;
  background: #15803d;
  color: #fff;
}

.scan-field {
  margin-bottom: 12px;
}

.scan-input {
  border-color: #94a3b8;
  background: #fbfdff;
  font-size: 16px;
}

.flow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.flow-step {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.flow-step span {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--primary);
  font-weight: 800;
}

.flow-step strong {
  display: block;
  margin-bottom: 8px;
}

.warehouse-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.summary-tile {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
}

.summary-tile span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.summary-tile strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.return-location-summary {
  grid-template-columns: repeat(5, minmax(145px, 1fr));
}

.return-location-tile {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.return-location-tile:hover,
.return-location-tile.is-active {
  border-color: var(--primary);
  background: var(--soft);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 12%, transparent);
}

.return-location-tile.is-active strong {
  color: var(--primary);
}

.table-wrap {
  max-height: min(640px, calc(100vh - 250px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  scrollbar-gutter: stable both-edges;
}

.summary-table-wrap {
  margin-bottom: 14px;
}

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

.all-info-table {
  min-width: 1400px;
}

.logistics-tracking-summary {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}

.logistics-auto-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  font-weight: 800;
}

.logistics-auto-refresh input {
  width: 18px;
  height: 18px;
  margin: 0;
}

#logisticsServerTrackingInterval {
  width: auto;
  min-width: 128px;
}

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

.logistics-tracking-pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.logistics-tracking-table-wrap {
  max-height: min(680px, calc(100vh - 330px));
}

.logistics-tracking-table {
  min-width: 1500px;
}

.logistics-latest-event {
  min-width: 260px;
  max-width: 420px;
  white-space: normal;
  line-height: 1.45;
}

.logistics-detail-row td {
  padding: 0;
  background: #f8fafc;
}

.logistics-timeline {
  display: grid;
  gap: 0;
  padding: 10px 18px 14px 34px;
}

.logistics-timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 140px 110px minmax(220px, 1fr) 180px;
  gap: 12px;
  padding: 9px 0 9px 16px;
  border-left: 2px solid #bfdbfe;
  color: #334155;
}

.logistics-timeline-item::before {
  content: "";
  position: absolute;
  top: 15px;
  left: -6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2563eb;
}

.logistics-timeline-item strong {
  color: var(--text);
}

.logistics-tracking-error {
  margin-top: 5px;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 700;
  white-space: normal;
}

.return-tracking-refresh {
  display: block;
  margin-top: 6px;
}

.return-tracking-details {
  margin-top: 6px;
  min-width: 220px;
}

.return-tracking-details summary {
  color: #1d4ed8;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.return-tracking-details .logistics-timeline {
  min-width: 280px;
  padding: 8px 0 4px 12px;
}

.return-tracking-event {
  grid-template-columns: 105px minmax(70px, 90px) minmax(180px, 1fr);
}

.return-tracking-event > :last-child {
  grid-column: 3;
  color: #64748b;
  font-size: 12px;
}

.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
}

.all-info-table-wrap {
  max-height: min(680px, calc(100vh - 220px));
}

.warehouse-detail-table {
  min-width: 1640px;
}

.movement-cell {
  min-width: 220px;
  max-width: 380px;
  white-space: normal;
  line-height: 1.45;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid #e5edf6;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  white-space: nowrap;
}

.table-inline-input {
  width: 170px;
  max-width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.return-process-col {
  background: #ecfeff;
}

.return-package-details summary {
  cursor: pointer;
  color: #0f4f8f;
  font-weight: 800;
}

th.return-process-col {
  background: #cffafe;
}

tr:last-child td {
  border-bottom: 0;
}

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

tr.duplicate-order-row td {
  background: #fff1f2;
  box-shadow: inset 0 1px 0 #fecaca, inset 0 -1px 0 #fecaca;
}

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

tr.row-ok td {
  background: #f0fdf4;
}

.return-overdue-time {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tag.blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.tag.green {
  background: #dcfce7;
  color: #166534;
}

.tag.red {
  background: #fee2e2;
  color: #991b1b;
}

.tag.amber {
  background: #fef3c7;
  color: #92400e;
}

.tag.teal {
  background: #ccfbf1;
  color: #115e59;
}

.pick-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.2fr);
  gap: 14px;
}

.pick-orders {
  max-height: 520px;
}

.subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  margin-bottom: 10px;
}

.subhead select {
  max-width: 170px;
}

.pick-result {
  margin-bottom: 12px;
  font-weight: 800;
}

.pick-result.ok {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.pick-result.error {
  border-color: #fca5a5;
  background: #fff1f2;
  color: #991b1b;
}

.pick-result.warning {
  border-color: #fbbf24;
  background: #fffbeb;
  color: #92400e;
}

.pick-result.neutral {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(720px, calc(100vw - 36px));
  max-height: min(360px, calc(100vh - 36px));
  overflow: auto;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  padding: 12px 14px;
  background: #111827;
  color: #fff;
  white-space: pre-wrap;
  box-shadow: var(--shadow);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

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

.tracking-sync-error {
  display: block;
  margin-top: 4px;
  max-width: 240px;
  color: #b42318;
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
}

.tracking-sync-ok {
  display: block;
  margin-top: 4px;
  color: #067647;
  font-size: 12px;
  line-height: 1.35;
}

.tracking-sync-manual {
  display: block;
  margin-top: 4px;
  color: #9a6700;
  font-size: 12px;
  line-height: 1.35;
}

.duplicate-sku-manual-flag {
  display: block;
  margin-top: 5px;
  color: #9a6700;
  font-size: 12px;
  font-weight: 900;
  white-space: normal;
}

.manual-shipping-btn {
  border-color: #d8a227;
  color: #7a4e00;
  background: #fff9e8;
}

.block {
  display: block;
  margin-top: 4px;
}

.prealert-details summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 800;
}

.prealert-detail-list {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.prealert-line {
  display: grid;
  gap: 2px;
  min-width: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #f8fafc;
}

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

.prealert-line-warning {
  border-color: #fde68a;
  background: #fffbeb;
}

.prealert-line-error {
  border-color: #fecaca;
  background: #fff1f2;
}

.prealert-duplicate-note {
  margin-top: 8px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 7px 9px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
}

.prealert-notice {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  max-width: 520px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fffbeb;
  color: #92400e;
  font-size: 12px;
}

.prealert-notice strong {
  color: #78350f;
}

.prealert-notice.error {
  border-color: #fecaca;
  background: #fff1f2;
  color: #991b1b;
}

.prealert-notice.error strong {
  color: #7f1d1d;
}

.prealert-selected-warning {
  display: block;
  margin-top: 6px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 7px 9px;
  background: #fffbeb;
  color: #92400e;
  font-size: 12px;
  font-weight: 800;
}

.imei-details summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 700;
}

.imei-list {
  max-height: 220px;
  margin-top: 8px;
  overflow: auto;
  white-space: pre;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #f8fafc;
  color: #334155;
}

.return-imei-cell {
  min-width: 170px;
  max-width: 230px;
  white-space: normal;
}

.return-imei-details summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 700;
  white-space: normal;
}

.return-imei-list {
  display: grid;
  gap: 4px;
  max-height: 118px;
  overflow: auto;
}

.return-imei-details .return-imei-list {
  margin-top: 6px;
}

.return-imei-chip {
  width: max-content;
  max-width: 100%;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  padding: 2px 6px;
  background: #f8fafc;
  color: #1e293b;
  font-family: Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
}

.return-summary-row td {
  vertical-align: middle;
}

.return-expand-cell {
  width: 72px;
  min-width: 72px;
}

.return-expand-btn {
  min-width: 56px;
}

.return-compact-imei {
  max-width: 190px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.return-summary-actions {
  min-width: 260px;
}

.return-detail-row td {
  padding: 0;
  background: #f8fbff;
}

.return-detail-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #dbeafe;
  border-bottom: 1px solid #dbeafe;
}

.return-detail-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

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

.return-detail-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.return-detail-value {
  margin-top: 4px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.return-order-correction-hint {
  border-left: 3px solid #2563eb;
}

.return-order-correction-history,
.return-order-correction-entry {
  display: grid;
  gap: 5px;
}

.return-order-correction-entry {
  grid-template-columns: minmax(180px, auto) minmax(220px, 1fr) auto;
  align-items: center;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
  .return-order-correction-entry {
    grid-template-columns: 1fr;
  }
}

.return-sku-model {
  display: grid;
  gap: 2px;
  min-width: 130px;
}

.return-sku-model .muted {
  font-size: 12px;
  line-height: 1.25;
}

.return-package-quantity {
  display: grid;
  gap: 1px;
  min-width: 72px;
}

.return-package-quantity strong {
  font-size: 16px;
  line-height: 1.1;
}

.return-package-quantity span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.return-package-phone-summary {
  display: grid;
  gap: 7px;
  margin-top: 8px;
  min-width: 0;
}

.return-package-phone-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.return-package-phone-heading span {
  color: var(--muted);
  font-size: 12px;
}

.return-package-phone-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.return-package-phone-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 12px;
}

.return-package-phone-table th,
.return-package-phone-table td {
  padding: 7px 8px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.return-package-phone-table th {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 700;
}

.return-package-phone-table tr.is-current td {
  background: #eff6ff;
}

.return-package-phone-imei {
  min-width: 150px;
  font-family: Consolas, "Liberation Mono", monospace;
}

.label-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.label-card {
  min-height: 118px;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.barcode {
  display: block;
  width: 100%;
  height: 54px;
  margin-bottom: 6px;
  background: #fff;
  fill: #111827;
}

.barcode-text {
  margin-bottom: 8px;
  color: #111827;
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px;
  line-height: 1.1;
  text-align: center;
  word-break: break-all;
}

.label-card strong,
.label-card span {
  display: block;
}

.label-card strong {
  margin-bottom: 8px;
  font-size: 16px;
}

.label-card span {
  color: #334155;
  font-size: 12px;
  line-height: 1.5;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
}

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

.modal-card {
  width: min(920px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.password-modal-card {
  width: min(460px, 100%);
}

.warehouse-loss-modal-card {
  width: min(760px, 100%);
}

.return-processing-modal-card {
  width: min(1180px, 100%);
}

.backmarket-duplicate-sku-modal-card {
  width: min(980px, 100%);
}

.platform-callback-attempts-modal-card {
  width: min(1280px, 100%);
}

.platform-callback-attempts-table-wrap {
  max-height: 520px;
  margin-top: 14px;
}

.platform-callback-attempts-table-wrap table {
  min-width: 1080px;
}

.backmarket-duplicate-sku-note {
  margin-bottom: 14px;
  line-height: 1.55;
}

.backmarket-duplicate-sku-table-wrap {
  max-height: 420px;
}

.backmarket-duplicate-sku-table-wrap code {
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.prealert-edit-modal-card {
  width: min(1160px, 100%);
}

.prealert-supplement-modal-card {
  width: min(860px, 100%);
}

.receipt-correction-modal-card {
  width: min(920px, 100%);
}

.receipt-correction-list {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #f8fafc;
}

.receipt-correction-item {
  display: grid;
  grid-template-columns: 22px minmax(135px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding: 7px 4px;
}

.receipt-correction-item:last-child {
  border-bottom: 0;
}

.receipt-correction-item input {
  margin: 0;
}

.receipt-correction-item code,
.receipt-correction-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.receipt-correction-selection-actions {
  align-items: center;
}

@media (max-width: 680px) {
  .receipt-correction-item {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .receipt-correction-item span {
    grid-column: 2;
  }
}

.prealert-edit-details-input {
  min-height: 240px;
  font-family: Consolas, "Microsoft YaHei", monospace;
  line-height: 1.45;
  white-space: pre;
}

.hong-kong-package-modal-card {
  width: min(1480px, 100%);
}

.return-processing-modal-card .return-processing-form {
  margin-bottom: 0;
}

.single-column {
  grid-template-columns: 1fr;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

.warning-list {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.warning-list span {
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 7px 9px;
  background: #fffbeb;
  color: #92400e;
  font-size: 12px;
  font-weight: 700;
}

.warning-list span.error {
  border-color: #fecaca;
  background: #fff1f2;
  color: #991b1b;
}

.import-preview-wrap {
  max-height: 360px;
}

.package-detail-wrap {
  max-height: 520px;
}

.block-text {
  display: block;
  margin-top: 4px;
  line-height: 1.45;
}

.nowrap {
  white-space: nowrap;
}

.stack-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  min-width: 112px;
}

.mini-btn {
  min-height: 30px;
  border: 1px solid #bfd0e4;
  border-radius: 8px;
  padding: 0 9px;
  background: #fff;
  color: #1d3557;
  font-size: 12px;
  font-weight: 800;
}

.mini-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.copy-chip {
  min-height: 26px;
  padding: 0 8px;
  background: #eff6ff;
  color: #1d4ed8;
}

.mini-link {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid #bfd0e4;
  border-radius: 8px;
  padding: 0 8px;
  background: #fff;
  color: #1d3557;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.mini-link:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.danger-mini-btn {
  border-color: #fecaca;
  color: #b91c1c;
}

.danger-mini-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

.warehouse-transfer-panel {
  margin: 14px 0;
  border-top: 1px solid #c8d8eb;
  border-bottom: 1px solid #c8d8eb;
  padding: 14px 0;
  background: #f4f9ff;
}

.warehouse-transfer-panel .section-head {
  padding: 0 14px;
}

.warehouse-transfer-panel h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.warehouse-transfer-panel p {
  margin: 0;
}

.imei-lifecycle-panel {
  background: #f7fbff;
}

.imei-lifecycle-panel .button-row input {
  width: min(280px, 100%);
}

.imei-lifecycle-summary {
  margin: 0 14px 12px;
}

.imei-lifecycle-table-wrap {
  max-height: 420px;
  margin: 0 14px;
}

.imei-lifecycle-table-wrap table {
  min-width: 1120px;
}

.warehouse-batch-sku-panel {
  background: #f8fafc;
}

.warehouse-local-move-panel {
  background: #f7fbf8;
}

.warehouse-batch-sku-controls {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
  padding: 10px 14px 0;
}

.warehouse-batch-sku-controls .selected-box,
.warehouse-batch-sku-controls button {
  min-height: 42px;
}

.warehouse-local-move-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr)) auto auto;
  gap: 12px;
  align-items: end;
  padding: 10px 14px 0;
}

.warehouse-local-move-controls .selected-box,
.warehouse-local-move-controls button {
  min-height: 42px;
}

.warehouse-transfer-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 10px 14px 0;
}

.inventory-maintenance-section {
  padding: 4px 0 20px;
}

.inventory-maintenance-section + .inventory-maintenance-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.inventory-restore-controls {
  grid-template-columns: minmax(260px, 2fr) minmax(220px, 1fr) auto;
  padding-left: 0;
  padding-right: 0;
}

.warehouse-transfer-history {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.warehouse-transfer-history-filters {
  grid-template-columns: minmax(180px, 240px) minmax(180px, 240px) auto;
  justify-content: start;
}

.warehouse-transfer-history-wrap {
  margin-top: 14px;
}

.warehouse-transfer-history-table {
  min-width: 1260px;
}

.warehouse-transfer-history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 250px;
}

.warehouse-transfer-address-book {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
  padding: 10px 14px 0;
}

.warehouse-transfer-address-book button {
  min-height: 42px;
}

.warehouse-transfer-plan {
  margin: 12px 14px 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.warehouse-transfer-plan-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.warehouse-transfer-plan-head h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.warehouse-transfer-plan-status {
  margin-top: 10px;
  min-height: 40px;
  padding: 9px 12px;
  border-left: 3px solid #7b8da4;
  background: #f8fafc;
  color: #44546a;
}

.warehouse-transfer-plan-status[data-status="success"] {
  border-color: #16834b;
  background: #eefbf3;
  color: #116038;
}

.warehouse-transfer-plan-status[data-status="warning"] {
  border-color: #c98300;
  background: #fff8e7;
  color: #7a4c00;
}

.warehouse-transfer-plan-progress {
  margin-top: 10px;
}

.warehouse-transfer-plan-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.warehouse-transfer-plan-metrics span {
  min-width: 120px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.warehouse-transfer-plan-metrics strong {
  font-size: 18px;
}

.warehouse-transfer-plan-wrap {
  max-height: 260px;
}

.warehouse-transfer-plan-wrap table {
  min-width: 920px;
}

.warehouse-transfer-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 12px 14px 0;
}

.warehouse-transfer-scan {
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
  align-items: end;
  gap: 12px;
  padding: 12px 14px 0;
}

.warehouse-transfer-manual {
  margin: 12px 14px 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.warehouse-transfer-manual summary {
  cursor: pointer;
  font-weight: 700;
}

.warehouse-transfer-manual .warehouse-transfer-controls {
  padding: 12px 0 0;
}

.warehouse-transfer-manual-wrap {
  max-height: 220px;
}

.warehouse-transfer-manual-wrap table {
  min-width: 650px;
}

.warehouse-transfer-append-status {
  margin: 10px 14px 0;
  border-left: 3px solid #1463d6;
  padding: 10px 12px;
  background: #eaf3ff;
  color: #123f7a;
  font-weight: 700;
}

.warehouse-transfer-selected-wrap {
  max-height: 260px;
  margin: 12px 14px 0;
}

.warehouse-transfer-selected-wrap table {
  min-width: 760px;
}

.warehouse-transfer-scan label {
  min-width: 0;
}

.warehouse-transfer-scan-status {
  min-height: 44px;
  padding: 10px 12px;
  border-left: 3px solid transparent;
  overflow-wrap: anywhere;
}

.warehouse-transfer-scan-status[data-status="success"] {
  border-color: #16834b;
  background: #eefbf3;
  color: #116038;
}

.warehouse-transfer-scan-status[data-status="warning"] {
  border-color: #c98300;
  background: #fff8e7;
  color: #7a4c00;
}

.warehouse-transfer-scan-status[data-status="error"] {
  border-color: #c82c3e;
  background: #fff0f1;
  color: #a61b2b;
}

.warehouse-transfer-submit {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 42px;
}

.warehouse-transfer-list-label {
  display: block;
  min-width: 0;
}

.warehouse-transfer-list-label textarea {
  width: 100%;
  min-height: 76px;
  margin-top: 6px;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.45;
}

.warehouse-transfer-checkbox {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
}

.warehouse-transfer-checkbox:disabled {
  cursor: not-allowed;
}

.background-task-summary {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.background-task-table-wrap table {
  min-width: 1180px;
}

.background-task-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid #b8c7dc;
  border-radius: 6px;
  background: #edf3fa;
  color: #29435f;
  font-size: 12px;
  font-weight: 800;
}

.background-task-status[data-status="running"],
.background-task-status[data-status="retrying"] {
  border-color: #7aa2df;
  background: #eaf2ff;
  color: #164f9c;
}

.background-task-status[data-status="waiting"] {
  border-color: #d6a94d;
  background: #fff8e7;
  color: #7a4c00;
}

.background-task-status[data-status="succeeded"] {
  border-color: #77b993;
  background: #e9f8ef;
  color: #17643b;
}

.background-task-status[data-status="failed"] {
  border-color: #df8290;
  background: #fff0f1;
  color: #a61b2b;
}

.background-task-status[data-status="manual_required"] {
  color: #8a3f00;
  background: #fff0d8;
  border-color: #efbf78;
}

.background-task-status[data-status="manual_completed"] {
  color: #315b45;
  background: #e9f6ee;
  border-color: #a8d5b8;
}

.background-task-result {
  max-width: 420px;
  white-space: normal;
  line-height: 1.45;
}

.system-alert-panel {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

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

.system-alert-summary .summary-tile:nth-child(2) strong {
  color: #b11e31;
}

.system-alert-summary .summary-tile:nth-child(3) strong,
.system-alert-summary .summary-tile:nth-child(4) strong {
  font-size: 15px;
  line-height: 1.35;
}

.system-alert-table-wrap table {
  min-width: 1100px;
}

.system-alert-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid #b8c7dc;
  border-radius: 6px;
  background: #edf3fa;
  color: #29435f;
  font-size: 12px;
  font-weight: 800;
}

.system-alert-badge[data-severity="critical"],
.system-alert-badge[data-status="open"] {
  border-color: #df8290;
  background: #fff0f1;
  color: #a61b2b;
}

.system-alert-badge[data-severity="warning"] {
  border-color: #d6a94d;
  background: #fff8e7;
  color: #7a4c00;
}

.system-alert-badge[data-status="resolved"] {
  border-color: #77b993;
  background: #e9f8ef;
  color: #17643b;
}

.system-alert-message {
  max-width: 420px;
  white-space: normal;
  line-height: 1.45;
}

.tracking-sync-queued {
  display: block;
  margin-top: 4px;
  color: #164f9c;
  font-size: 12px;
  font-weight: 700;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.warranty-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 16px;
}

.warranty-toolbar {
  grid-template-columns: minmax(180px, 0.35fr) minmax(280px, 1fr);
}

.warranty-table-wrap table {
  min-width: 1420px;
}

.warranty-customer-cell,
.warranty-note-cell {
  max-width: 270px;
  white-space: normal;
  line-height: 1.45;
}

.warranty-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 210px;
}

.warranty-match-badge,
.warranty-status-badge {
  display: inline-block;
  padding: 4px 7px;
  border: 1px solid #b9c7d8;
  border-radius: 6px;
  background: #f3f7fb;
  color: #24384f;
  font-size: 12px;
  font-weight: 700;
}

.warranty-match-badge[data-match="matched"],
.warranty-status-badge[data-status="warehouse_received"] {
  border-color: #72b68d;
  background: #e9f8ef;
  color: #17643b;
}

.warranty-match-badge:not([data-match="matched"]),
.warranty-status-badge[data-status="approval_failed"],
.warranty-status-badge[data-status="rejected"] {
  border-color: #db9f9f;
  background: #fff0f0;
  color: #8e2424;
}

.receiving-reconciliation-panel {
  margin: 18px 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

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

.receiving-reconciliation-metrics {
  margin-bottom: 14px;
}

.receiving-reconciliation-table-wrap {
  max-height: 300px;
}

.receiving-reconciliation-panel.is-paused {
  border-color: #d7a93b;
}

.receiving-reconciliation-panel.is-complete {
  border-color: #72b68d;
}

.prealert-history-modal-card,
.prealert-completion-modal-card {
  width: min(1040px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
}

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

.prealert-history-summary-block {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.prealert-history-summary-block h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.prealert-history-summary-block p {
  margin: 3px 0;
}

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

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    overflow-x: hidden;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 3;
    display: block;
    padding: 14px;
  }

  .brand,
  .sidebar-footer {
    display: none;
  }

  .nav {
    display: flex;
    overflow-x: auto;
    gap: 8px;
  }

  .nav-item {
    white-space: nowrap;
  }

  .metrics,
  .prealert-metrics,
  .receiving-reconciliation-metrics,
  .flow-grid,
  .warehouse-summary,
  .warranty-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .logistics-timeline-item {
    grid-template-columns: 130px 100px minmax(180px, 1fr);
  }

  .logistics-timeline-item span:last-child {
    grid-column: 3;
  }

  .form-grid,
  .form-grid.compact,
  .toolbar,
  .scan-strip,
  .pick-layout,
  .warehouse-transfer-address-book,
  .warehouse-transfer-controls,
  .warehouse-batch-sku-controls,
  .warehouse-local-move-controls {
    grid-template-columns: 1fr;
  }

  .warehouse-transfer-footer,
  .warehouse-transfer-scan {
    grid-template-columns: 1fr;
  }

  .warehouse-transfer-plan-head {
    flex-direction: column;
  }

  .warehouse-transfer-submit {
    flex-wrap: wrap;
  }

  .section-head,
  .topbar,
  .topbar-actions {
    flex-direction: column;
  }

  .topbar-actions {
    align-items: stretch;
    width: 100%;
  }
}

@media (max-width: 620px) {
  .main {
    padding: 16px;
  }

  h1 {
    font-size: 23px;
  }

  .metrics,
  .prealert-metrics,
  .receiving-reconciliation-metrics,
  .flow-grid,
  .warehouse-summary {
    grid-template-columns: 1fr;
  }

  .prealert-history-comparison {
    grid-template-columns: 1fr;
  }

  .metric {
    padding: 13px;
  }

  table {
    min-width: 680px;
  }
}
