:root {
  --enterprise-bg: #f4f6f8;
  --enterprise-panel: #ffffff;
  --enterprise-text: #172033;
  --enterprise-muted: #667085;
  --enterprise-line: #e2e7ef;
  --enterprise-blue: #1769d2;
  --enterprise-blue-dark: #0d3b73;
  --enterprise-blue-soft: #edf5ff;
  --enterprise-danger: #c0362c;
  --enterprise-warning: #a45d00;
  --enterprise-success: #16815d;
}

[hidden] {
  display: none !important;
}

body.app-mode {
  grid-template-columns: 248px minmax(0, 1fr);
  background: var(--enterprise-bg);
  color: var(--enterprise-text);
}

body.app-mode .sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 100vh;
  height: 100vh;
  padding: 20px 14px;
  gap: 20px;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--enterprise-blue-dark);
  box-shadow: none;
}

body.app-mode .brand {
  padding: 0 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

body.app-mode .brand .mark {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: #2e8df0;
  box-shadow: none;
}

body.app-mode .brand strong {
  font-size: 15px;
  letter-spacing: 0;
}

body.app-mode .brand span {
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
}

body.app-mode #nav {
  display: grid;
  gap: 18px;
}

body.app-mode .nav-group {
  display: grid;
  gap: 6px;
}

body.app-mode .nav-group-label {
  padding: 0 10px;
  color: rgba(255, 255, 255, 0.46);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.app-mode .nav-group > div {
  display: grid;
  gap: 3px;
}

body.app-mode #nav button {
  min-height: 38px;
  padding: 9px 10px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 14px;
  font-weight: 600;
}

body.app-mode #nav button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

body.app-mode #nav button.active {
  background: rgba(61, 151, 246, 0.24);
  color: #ffffff;
  box-shadow: inset 3px 0 0 #62b0ff;
}

body.app-mode .auth {
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

body.app-mode .auth .google,
body.app-mode .auth button {
  min-height: 38px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
  font-size: 13px;
}

body.app-mode main {
  padding: 0 24px 32px;
}

body.app-mode main > header {
  min-height: 72px;
  margin: 0 -24px 24px;
  padding: 17px 24px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--enterprise-line);
  border-radius: 0;
  background: var(--enterprise-panel);
  box-shadow: none;
  backdrop-filter: none;
}

body.app-mode main > header h1 {
  color: var(--enterprise-text);
  font-size: 23px;
  font-weight: 750;
}

body.app-mode main > header .actions {
  align-items: center;
}

body.app-mode main > header button,
body.app-mode .inventory-section-head button,
body.app-mode .inventory-query-form > button,
body.app-mode .inventory-batch-actions button {
  min-height: 38px;
  border: 1px solid var(--enterprise-blue);
  border-radius: 6px;
  padding: 8px 14px;
  background: var(--enterprise-blue);
  box-shadow: none;
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

body.app-mode .status {
  min-height: 0;
  margin: 0;
}

body.app-mode .status:not(:empty) {
  min-height: 40px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid #cfe0f5;
  border-radius: 6px;
  background: var(--enterprise-blue-soft);
}

body.app-mode .metrics,
body.app-mode .inventory-metrics,
body.app-mode .dashboard-metrics,
body.app-mode .decision-metrics,
body.app-mode .flow-metrics,
body.app-mode .flow-result-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  background: var(--enterprise-panel);
}

body.app-mode .metric {
  min-height: 102px;
  padding: 18px 20px;
  border: 0;
  border-right: 1px solid var(--enterprise-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

body.app-mode .metric:last-child {
  border-right: 0;
}

body.app-mode .metric::after {
  display: none;
}

body.app-mode .metric span {
  color: var(--enterprise-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

body.app-mode .metric strong {
  margin-top: 7px;
  color: var(--enterprise-text);
  font-size: 25px;
}

body.app-mode .metric small {
  margin-top: 4px;
  color: var(--enterprise-muted);
  font-size: 12px;
}

body.app-mode .content {
  gap: 16px;
}

body.app-mode .panel,
body.app-mode .inventory-query-shell {
  overflow: hidden;
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  background: var(--enterprise-panel);
  box-shadow: none;
  backdrop-filter: none;
}

body.app-mode .panel-head {
  min-height: 52px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--enterprise-line);
}

body.app-mode .panel-head h2,
body.app-mode .panel > h2 {
  color: var(--enterprise-text);
  font-size: 15px;
  font-weight: 750;
}

body.app-mode .table-wrap {
  background: var(--enterprise-panel);
}

body.app-mode table {
  font-size: 13px;
}

body.app-mode th {
  padding: 10px 12px;
  background: #f8fafc;
  color: #5d6b80;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

body.app-mode td {
  padding: 12px;
  border-color: var(--enterprise-line);
  color: #28354a;
}

body.app-mode tbody tr:hover {
  background: #f8fbff;
}

body.app-mode input,
body.app-mode select,
body.app-mode textarea {
  border-color: #ccd5e1;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: none;
}

body.app-mode input:focus,
body.app-mode select:focus,
body.app-mode textarea:focus {
  border-color: var(--enterprise-blue);
  outline: 3px solid rgba(23, 105, 210, 0.12);
}

.inventory-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--enterprise-line);
}

.inventory-section-head span {
  display: block;
  margin-bottom: 3px;
  color: var(--enterprise-blue);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.inventory-section-head h2 {
  margin: 0;
  font-size: 18px;
}

.inventory-query-tabs {
  display: flex;
  gap: 22px;
  padding: 0 20px;
  border-bottom: 1px solid var(--enterprise-line);
}

.inventory-query-tabs button {
  min-height: 44px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--enterprise-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.inventory-query-tabs button.active {
  border-bottom-color: var(--enterprise-blue);
  color: var(--enterprise-blue);
}

.inventory-query-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 190px auto;
  gap: 12px;
  align-items: end;
  padding: 18px 20px;
}

.inventory-query-form label,
.enterprise-batch-form label {
  display: grid;
  gap: 6px;
}

.inventory-query-form label > span,
.enterprise-batch-form label > span {
  color: #4d5d73;
  font-size: 12px;
  font-weight: 700;
}

.inventory-query-form input,
.inventory-query-form select {
  width: 100%;
  min-height: 40px;
}

.inventory-query-note {
  margin: -5px 20px 18px;
  color: var(--enterprise-muted);
  font-size: 12px;
}

/* 面板标题栏同时承载计数与页面级操作，取代原来只有一个标题的独立工具栏。 */
body.app-mode .panel-head-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
}

body.app-mode .panel-head-actions {
  display: flex;
  gap: 8px;
}

body.app-mode .panel-head-actions button {
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
}

body.app-mode .tasks-list-head {
  display: flex;
  justify-content: flex-end;
  padding: 14px 18px 0;
}

/* 列表行整行可点击，因此行内不再放实心主按钮。 */
body.app-mode .history-table tbody tr[data-go] {
  cursor: pointer;
}

/* 今日重点的每一项都是入口，整块可点击进入预设筛选的列表。 */
body.app-mode .dashboard-priority-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

body.app-mode .dashboard-priority-link > span {
  display: grid;
  gap: 2px;
}

body.app-mode .dashboard-priority-link:hover strong {
  color: var(--enterprise-blue);
  text-decoration: underline;
}

body.app-mode .dashboard-priority-link:focus-visible {
  outline: 3px solid rgba(23, 105, 210, 0.35);
  outline-offset: 2px;
}

.dashboard-snapshot-label {
  color: var(--enterprise-muted);
  font-size: 12px;
  white-space: nowrap;
}

/* 决策快照明显陈旧时的提示，避免与「今日重点」的实时数字冲突却无从判断。 */
.dashboard-snapshot-warning {
  margin: 0 20px 12px;
  padding: 8px 10px;
  border-left: 3px solid var(--enterprise-warning);
  border-radius: 4px;
  background: #fdf7ec;
  color: var(--enterprise-text);
  font-size: 12px;
  line-height: 1.5;
}


.enterprise-batch-form {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
  padding: 18px 20px;
}

.enterprise-batch-form .inventory-batch-input {
  min-width: 0;
}

.enterprise-batch-form textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
}

.enterprise-batch-form small {
  color: var(--enterprise-muted);
}

.enterprise-batch-form .inventory-batch-actions {
  display: flex;
  align-items: center;
  padding: 0;
  border: 0;
}

body.app-mode .enterprise-batch-form .inventory-batch-actions button.secondary {
  border-color: #ccd5e1;
  background: #ffffff;
  color: #344054;
}

.enterprise-kind-tabs {
  display: inline-flex;
  grid-template-columns: none;
  width: auto;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--enterprise-line);
  border-radius: 7px;
  background: #ffffff;
}

.enterprise-kind-tabs button {
  min-height: 32px;
  padding: 6px 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--enterprise-muted);
  font-size: 12px;
  font-weight: 700;
}

.enterprise-kind-tabs button.active {
  background: var(--enterprise-blue-soft);
  color: var(--enterprise-blue);
}

.inventory-results {
  min-width: 0;
}

.inventory-query-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--enterprise-muted);
}

body.app-mode .badge {
  border-radius: 999px;
  box-shadow: none;
}

/* M2.15: DDT and Inbound enterprise workspaces */
body.app-mode[data-page="ddt"] .content,
body.app-mode[data-page="inbound"] .content {
  gap: 16px;
}

body.app-mode .page-toolbar,
body.app-mode .workflow-identity {
  min-height: 64px;
  padding: 14px 16px;
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  background: var(--enterprise-panel);
  box-shadow: none;
  backdrop-filter: none;
}

body.app-mode .page-toolbar h2,
body.app-mode .workflow-identity h2 {
  color: var(--enterprise-text);
  font-size: 18px;
  font-weight: 760;
}

body.app-mode .workflow-identity .eyebrow {
  color: var(--enterprise-blue);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

body.app-mode .page-toolbar button,
body.app-mode .workflow-identity button,
body.app-mode .mini-actions button,
body.app-mode .subnav button,
body.app-mode .source-links button,
body.app-mode .flow-actions button,
body.app-mode .ddt-detail-page-action button {
  min-height: 36px;
  border: 1px solid var(--enterprise-blue);
  border-radius: 6px;
  padding: 7px 12px;
  background: var(--enterprise-blue);
  box-shadow: none;
  color: #ffffff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

body.app-mode .page-toolbar button.secondary,
body.app-mode .workflow-identity button.secondary,
body.app-mode .flow-actions button.secondary,
body.app-mode .ops-actions button.secondary {
  border-color: #cfd8e5;
  background: #ffffff;
  color: #344054;
}

body.app-mode .workflow-step-nav {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding: 0 12px;
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  background: var(--enterprise-panel);
}

body.app-mode .workflow-step-nav button,
body.app-mode .workflow-step-nav.ddt-stepper button {
  position: relative;
  min-width: 116px;
  min-height: 52px;
  flex: 1 0 116px;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 8px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--enterprise-muted);
}

body.app-mode .workflow-step-nav button + button {
  border-left: 1px solid var(--enterprise-line);
}

body.app-mode .workflow-step-nav button.active {
  border-bottom-color: var(--enterprise-blue);
  background: var(--enterprise-blue-soft);
  color: var(--enterprise-blue);
}

body.app-mode .workflow-step-nav button > span {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #eef2f7;
  color: #526174;
}

body.app-mode .workflow-step-nav button.active > span {
  background: var(--enterprise-blue);
  color: #ffffff;
}

body.app-mode .workflow-step-nav button > strong {
  overflow: visible;
  font-size: 12px;
  white-space: nowrap;
}

body.app-mode .workflow-layout-single {
  display: block;
}

body.app-mode .workflow-step-surface {
  width: 100%;
  max-width: none;
}

body.app-mode .workflow-step-surface > .panel,
body.app-mode .ddt-workflow-main > .panel {
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  background: var(--enterprise-panel);
  box-shadow: none;
}

body.app-mode .ops-filter-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--enterprise-line);
  background: #fbfcfe;
}

body.app-mode .ops-filter-grid .ops-span-6 {
  grid-column: span 3;
}

body.app-mode .ops-filter-grid .ops-span-4 {
  grid-column: span 3;
}

body.app-mode .ops-field {
  gap: 5px;
}

body.app-mode .ops-field > span:first-child {
  color: #56657a;
  font-size: 11px;
  font-weight: 700;
}

body.app-mode .ops-field input,
body.app-mode .ops-field select {
  min-height: 38px;
  border-color: #ccd5e1;
  border-radius: 6px;
  background: #ffffff;
  font-size: 12px;
}

body.app-mode .ops-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
}

body.app-mode .ops-actions button {
  min-height: 38px;
  border: 1px solid var(--enterprise-blue);
  border-radius: 6px;
  background: var(--enterprise-blue);
  box-shadow: none;
  font-size: 12px;
}

body.app-mode .history-table {
  border-radius: 0;
}

body.app-mode .history-table td,
body.app-mode .history-table th {
  vertical-align: middle;
}

body.app-mode .history-table .record-title {
  color: var(--enterprise-blue);
  font-weight: 750;
}

body.app-mode .table-sort {
  color: inherit;
  font: inherit;
  font-weight: inherit;
}

body.app-mode .ddt-upload-workbench {
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 20px;
  padding: 20px;
}

body.app-mode .ddt-file-field {
  min-height: 156px;
  align-content: center;
  border: 1px dashed #aebed2;
  border-radius: 8px;
  background: #fafcff;
}

body.app-mode .ddt-file-heading > b {
  border-radius: 6px;
  background: var(--enterprise-blue-soft);
  color: var(--enterprise-blue);
}

body.app-mode .ddt-file-field input[type="file"] {
  border-color: #ccd5e1;
  border-radius: 6px;
  background: #ffffff;
}

body.app-mode .ddt-file-field input[type="file"]::file-selector-button {
  border-radius: 5px;
  background: var(--enterprise-blue-soft);
  color: var(--enterprise-blue);
}

body.app-mode .ddt-upload-checks {
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  background: #fbfcfe;
}

body.app-mode .ddt-upload-checks li b {
  border-radius: 5px;
  background: #eef2f7;
  color: #526174;
}

body.app-mode .ddt-upload-actions button {
  border-radius: 6px;
  background: var(--enterprise-blue);
  box-shadow: none;
}

body.app-mode .inbound-upload-form {
  gap: 18px;
  padding: 20px;
}

body.app-mode .inbound-upload-grid {
  grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(150px, 1fr));
  gap: 14px;
  align-items: end;
}

body.app-mode .inbound-upload-grid .span-2 {
  grid-column: span 1;
}

body.app-mode .inbound-upload-grid .advanced-fields.span-2 {
  grid-column: 1 / -1;
}

body.app-mode .inbound-upload-grid input,
body.app-mode .inbound-upload-grid select {
  min-height: 40px;
  border-color: #ccd5e1;
  border-radius: 6px;
  background: #ffffff;
  font-weight: 600;
}

body.app-mode .advanced-fields {
  border: 1px solid var(--enterprise-line);
  border-radius: 6px;
  background: #fbfcfe;
}

body.app-mode .subnav {
  display: flex;
  gap: 0;
  padding: 0 16px;
  border: 1px solid var(--enterprise-line);
  border-radius: 8px 8px 0 0;
  background: #ffffff;
}

body.app-mode .subnav button {
  min-height: 44px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--enterprise-muted);
}

body.app-mode .subnav button.active {
  border-bottom-color: var(--enterprise-blue);
  color: var(--enterprise-blue);
}

body.app-mode .ddt-feedback-board,
body.app-mode .ddt-feedback-summary,
body.app-mode .ddt-issue-group,
body.app-mode .ddt-feedback-clear {
  border-radius: 8px;
}

body.app-mode .ddt-feedback-summary {
  padding: 16px;
  border: 1px solid var(--enterprise-line);
  background: #fbfcfe;
}

body.app-mode .ddt-feedback-board.ok .ddt-feedback-summary,
body.app-mode .ddt-feedback-clear {
  border-color: #b7dfd0;
  background: #f2fbf7;
}

body.app-mode .ddt-feedback-board.warn .ddt-feedback-summary,
body.app-mode .ddt-feedback-board.blocked .ddt-feedback-summary {
  border-color: #ead4b2;
  background: #fffaf2;
}

body.app-mode .ddt-feedback-stats span,
body.app-mode .ddt-issue-metrics span {
  border-radius: 6px;
  background: #ffffff;
}

body.app-mode .ddt-issue-group {
  border: 1px solid var(--enterprise-line);
  background: #ffffff;
}

body.app-mode .ddt-issue-group.danger,
body.app-mode .ddt-issue-group.warn,
body.app-mode .ddt-issue-group.note {
  border-color: var(--enterprise-line);
  background: #ffffff;
}

body.app-mode .ddt-issue-card {
  border: 1px solid var(--enterprise-line);
  border-radius: 6px;
  background: #fbfcfe;
  box-shadow: none;
}

body.app-mode .ddt-detail-shell {
  gap: 16px;
}

body.app-mode .ddt-detail-header {
  min-height: 116px;
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  background: var(--enterprise-panel);
  box-shadow: none;
}

body.app-mode .ddt-detail-nav {
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  background: var(--enterprise-panel);
  box-shadow: none;
}

body.app-mode .ddt-detail-nav button {
  min-height: 52px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--enterprise-muted);
}

body.app-mode .ddt-detail-nav button.active {
  border-bottom-color: var(--enterprise-blue);
  background: var(--enterprise-blue-soft);
  color: var(--enterprise-blue);
}

body.app-mode .ddt-detail-surface {
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  background: var(--enterprise-panel);
  box-shadow: none;
}

body.app-mode .ddt-more-menu summary {
  border: 1px solid #cfd8e5;
  border-radius: 6px;
  background: #ffffff;
  color: #344054;
}

body.app-mode .ddt-more-menu > div {
  border: 1px solid var(--enterprise-line);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.12);
}

body.app-mode .ddt-check-strip {
  border-radius: 6px;
  background: #f2fbf7;
}

body.app-mode .ddt-check-strip.warn {
  background: #fffaf2;
}

@media (max-width: 1120px) and (min-width: 861px) {
  body.app-mode {
    grid-template-columns: 224px minmax(0, 1fr);
  }

  body.app-mode .metrics,
  body.app-mode .inventory-metrics,
  body.app-mode .dashboard-metrics,
  body.app-mode .decision-metrics,
  body.app-mode .flow-metrics,
  body.app-mode .flow-result-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.app-mode .metric:nth-child(2) {
    border-right: 0;
  }

  body.app-mode .metric:nth-child(-n + 2) {
    border-bottom: 1px solid var(--enterprise-line);
  }

  body.app-mode .ops-filter-grid .ops-span-6,
  body.app-mode .ops-filter-grid .ops-span-4 {
    grid-column: span 6;
  }

  body.app-mode .inbound-upload-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.app-mode .inbound-upload-grid .span-2 {
    grid-column: span 2;
  }
}

@media (max-width: 860px) {
  body.app-mode {
    display: block;
  }

  body.app-mode .sidebar {
    position: static;
    width: 100%;
    min-height: auto;
    height: auto;
  }

  body.app-mode #nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.app-mode .auth {
    display: flex;
    flex-wrap: wrap;
  }

  body.app-mode main {
    padding: 0 16px 24px;
  }

  body.app-mode main > header {
    margin: 0 -16px 18px;
    padding: 14px 16px;
  }

  body.app-mode .metrics,
  body.app-mode .inventory-metrics,
  body.app-mode .dashboard-metrics,
  body.app-mode .decision-metrics,
  body.app-mode .flow-metrics,
  body.app-mode .flow-result-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.app-mode .metric {
    border-bottom: 1px solid var(--enterprise-line);
  }

  body.app-mode .metric:nth-child(2n) {
    border-right: 0;
  }

  .inventory-query-form,
  .enterprise-batch-form {
    grid-template-columns: 1fr;
  }

  .inventory-query-tabs {
    gap: 16px;
    overflow-x: auto;
  }

  .enterprise-batch-form .inventory-batch-actions {
    justify-content: flex-start;
  }

  body.app-mode .page-toolbar,
  body.app-mode .workflow-identity {
    align-items: flex-start;
  }

  body.app-mode .ops-filter-grid .ops-span-6,
  body.app-mode .ops-filter-grid .ops-span-4 {
    grid-column: span 6;
  }

  body.app-mode .ddt-upload-workbench,
  body.app-mode .inbound-upload-grid {
    grid-template-columns: 1fr;
  }

  body.app-mode .inbound-upload-grid .span-2,
  body.app-mode .inbound-upload-grid .advanced-fields.span-2 {
    grid-column: 1;
  }

  body.app-mode .ddt-detail-header {
    grid-template-columns: 1fr auto;
  }

  body.app-mode .ddt-detail-identity {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  body.app-mode #nav {
    grid-template-columns: 1fr;
  }

  /* 手机端保持 2x2 紧凑网格。改成单列会让 4 张指标卡铺满整个首屏，
     仓库现场用手机时要滚动一千多像素才能看到第一条数据。 */
  body.app-mode .metrics,
  body.app-mode .inventory-metrics,
  body.app-mode .dashboard-metrics,
  body.app-mode .decision-metrics,
  body.app-mode .flow-metrics,
  body.app-mode .flow-result-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.app-mode .metric {
    min-height: 0;
    padding: 10px 12px;
  }

  body.app-mode .metric strong {
    margin-top: 3px;
    font-size: 18px;
  }

  body.app-mode .metric span {
    font-size: 10px;
  }

  body.app-mode .metric small {
    margin-top: 2px;
    font-size: 11px;
  }

  body.app-mode .metric:nth-child(2n) {
    border-right: 0;
  }

  .inventory-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .inventory-query-tabs {
    padding: 0 16px;
  }

  .inventory-query-form,
  .enterprise-batch-form {
    padding: 16px;
  }

  body.app-mode .page-toolbar,
  body.app-mode .workflow-identity {
    flex-direction: column;
  }

  body.app-mode .page-toolbar .mini-actions,
  body.app-mode .workflow-identity > button {
    width: 100%;
  }

  body.app-mode .page-toolbar .mini-actions button,
  body.app-mode .workflow-identity > button {
    width: 100%;
  }

  body.app-mode .ops-filter-grid .ops-span-6,
  body.app-mode .ops-filter-grid .ops-span-4 {
    grid-column: 1 / -1;
  }

  body.app-mode .ops-control-pair.date-pair {
    grid-template-columns: 1fr;
  }

  body.app-mode .ops-control-pair.date-pair i {
    display: none;
  }

  body.app-mode .ops-actions {
    justify-content: stretch;
  }

  body.app-mode .ops-actions button {
    flex: 1;
  }

  body.app-mode .ddt-upload-workbench {
    padding: 16px;
  }

  body.app-mode .ddt-upload-actions {
    align-items: stretch;
    flex-direction: column;
  }

  body.app-mode .ddt-upload-actions button {
    width: 100%;
  }

  body.app-mode .ddt-feedback-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  body.app-mode .ddt-feedback-stats {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.app-mode .ddt-detail-header {
    display: flex;
    flex-direction: column;
  }

  body.app-mode .ddt-detail-tools {
    align-self: flex-end;
  }
}

/* M2.16: Tasks and Non-Standard enterprise workspaces */
body.app-mode .tasks-list-workspace,
body.app-mode .non-standard-list-workspace,
body.app-mode .enterprise-detail-surface {
  overflow: hidden;
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  background: var(--enterprise-panel);
  box-shadow: none;
}

body.app-mode .task-filter-form.ops-filter-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--enterprise-line);
}

body.app-mode .task-filter-form.ops-filter-grid label {
  display: grid;
  grid-column: span 2;
  gap: 6px;
  color: var(--enterprise-muted);
  font-size: 12px;
  font-weight: 700;
}

body.app-mode .task-filter-form.ops-filter-grid label.ops-span-6 {
  grid-column: span 4;
}

body.app-mode .task-filter-form.ops-filter-grid input,
body.app-mode .task-filter-form.ops-filter-grid select {
  height: 40px;
  border: 1px solid #cfd8e5;
  border-radius: 6px;
  background: #ffffff;
}

body.app-mode .task-filter-form.ops-filter-grid .ops-actions {
  grid-column: span 2;
  align-self: end;
  padding: 0;
}

body.app-mode .task-filter-form.ops-filter-grid button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--enterprise-blue);
  box-shadow: none;
}

body.app-mode .task-filter-form.ops-filter-grid button.secondary {
  border-color: #cfd8e5;
  background: #ffffff;
  color: #344054;
}

body.app-mode .tasks-list-workspace .task-queue {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: none;
  min-height: 0;
  overflow: visible;
  padding: 18px;
}

body.app-mode .task-card {
  min-height: 116px;
  border: 1px solid var(--enterprise-line);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: none;
}

body.app-mode .task-card:hover,
body.app-mode .task-card.active {
  border-color: #98bff2;
  background: var(--enterprise-blue-soft);
}

body.app-mode .task-priority,
body.app-mode .task-card-foot b,
body.app-mode .task-chip-row span {
  border-radius: 999px;
}

/* 任务队列：紧凑表格 + 多选，替代原双列卡片。 */
body.app-mode .task-queue-table {
  margin: 0 18px 18px;
  border: 1px solid var(--enterprise-line);
  border-radius: 6px;
}

body.app-mode .task-queue-table table {
  min-width: 780px;
}

body.app-mode .task-queue-table th,
body.app-mode .task-queue-table td {
  vertical-align: middle;
}

body.app-mode .task-select-cell {
  width: 40px;
  text-align: center;
}

body.app-mode .task-select-cell input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--enterprise-blue);
}

body.app-mode .task-queue-row.selected {
  background: var(--enterprise-blue-soft);
}

body.app-mode .task-priority-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475467;
  font-size: 11px;
  white-space: nowrap;
}

body.app-mode .task-queue-row .link-cell {
  padding: 0;
  border: 0;
  background: none;
  color: var(--enterprise-blue);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

body.app-mode .task-queue-row .link-cell:hover {
  text-decoration: underline;
}

/* 批量操作栏：仅在有选中项时出现。 */
body.app-mode .task-batch-bar {
  margin: 0 18px 14px;
  padding: 12px 14px;
  border: 1px solid #98bff2;
  border-radius: 6px;
  background: var(--enterprise-blue-soft);
}

body.app-mode .task-batch-bar.empty {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  border-color: #f0d7a8;
  background: #fdf7ec;
  font-size: 13px;
}

body.app-mode .task-batch-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
}

body.app-mode .task-batch-head > strong {
  padding-bottom: 8px;
  font-size: 14px;
  white-space: nowrap;
}

body.app-mode .task-batch-head label {
  display: grid;
  gap: 4px;
  min-width: 150px;
}

body.app-mode .task-batch-head label span {
  color: var(--enterprise-muted);
  font-size: 12px;
}

body.app-mode .task-batch-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

body.app-mode .task-batch-rows {
  display: grid;
  gap: 6px;
  max-height: 320px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #c7ddf7;
  overflow-y: auto;
}

body.app-mode .task-batch-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 90px 110px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

body.app-mode .task-batch-row-sku {
  font-weight: 600;
}

body.app-mode .task-batch-row-desc,
body.app-mode .task-batch-row-current {
  color: var(--enterprise-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 860px) {
  body.app-mode .task-batch-actions {
    margin-left: 0;
  }

  body.app-mode .task-batch-row {
    grid-template-columns: minmax(0, 1fr) 110px;
  }

  body.app-mode .task-batch-row-desc,
  body.app-mode .task-batch-row-current {
    grid-column: 1 / -1;
  }
}

body.app-mode .task-detail-workspace,
body.app-mode .non-standard-detail-workspace {
  display: grid;
  gap: 14px;
}

body.app-mode .enterprise-detail-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 112px;
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  padding: 20px;
  background: var(--enterprise-panel);
  box-shadow: none;
}

body.app-mode .enterprise-detail-header.red,
body.app-mode .enterprise-detail-header.amber {
  background: var(--enterprise-panel);
}

body.app-mode .enterprise-detail-header > button,
body.app-mode .enterprise-detail-tabs button {
  border: 1px solid #cfd8e5;
  border-radius: 6px;
  background: #ffffff;
  color: #344054;
  box-shadow: none;
}

body.app-mode .task-detail-identity h2 {
  margin: 3px 0 0;
  color: var(--enterprise-text);
  font-size: 26px;
}

body.app-mode .task-detail-identity p {
  margin: 6px 0 0;
  color: var(--enterprise-muted);
}

body.app-mode .enterprise-detail-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  padding: 0 18px;
  background: var(--enterprise-panel);
}

body.app-mode .enterprise-detail-tabs button {
  min-height: 50px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0 18px;
  background: transparent;
}

body.app-mode .enterprise-detail-tabs button.active {
  border-bottom-color: var(--enterprise-blue);
  color: var(--enterprise-blue);
}

body.app-mode .enterprise-detail-surface {
  display: grid;
  gap: 16px;
  padding: 20px;
}

body.app-mode .detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

body.app-mode .detail-section-head.spaced {
  margin-top: 8px;
  border-top: 1px solid var(--enterprise-line);
  padding-top: 20px;
}

body.app-mode .detail-section-head h2 {
  margin: 0;
  color: var(--enterprise-text);
  font-size: 18px;
}

body.app-mode .task-info-grid article,
body.app-mode .task-action-form,
body.app-mode .task-evidence-list article {
  border: 1px solid var(--enterprise-line);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: none;
}

body.app-mode .task-action-form input,
body.app-mode .task-action-form select,
body.app-mode .form-grid input,
body.app-mode .form-grid select {
  border-radius: 6px;
  background: #ffffff;
}

body.app-mode .task-action-form button,
body.app-mode .form-grid button {
  border-radius: 6px;
  background: var(--enterprise-blue);
  box-shadow: none;
}

body.app-mode .non-standard-list-workspace .table-wrap {
  border: 0;
  border-radius: 0;
}

body.app-mode .non-standard-list-workspace button.small {
  min-height: 32px;
  border: 1px solid var(--enterprise-blue);
  border-radius: 6px;
  padding: 6px 11px;
  background: var(--enterprise-blue);
  color: #ffffff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

body.app-mode .non-standard-detail-header > div:last-child {
  justify-self: end;
}

@media (max-width: 980px) {
  body.app-mode .tasks-list-workspace .task-queue {
    grid-template-columns: 1fr;
  }

  body.app-mode .task-filter-form.ops-filter-grid label,
  body.app-mode .task-filter-form.ops-filter-grid label.ops-span-6,
  body.app-mode .task-filter-form.ops-filter-grid .ops-actions {
    grid-column: span 6;
  }
}

@media (max-width: 680px) {
  body.app-mode .task-filter-form.ops-filter-grid label,
  body.app-mode .task-filter-form.ops-filter-grid label.ops-span-6,
  body.app-mode .task-filter-form.ops-filter-grid .ops-actions {
    grid-column: 1 / -1;
  }

  body.app-mode .enterprise-detail-header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  body.app-mode .enterprise-detail-header > button {
    justify-self: start;
  }

  body.app-mode .non-standard-detail-header > div:last-child {
    justify-self: start;
  }

  body.app-mode .enterprise-detail-tabs {
    overflow-x: auto;
  }

  body.app-mode .task-info-grid,
  body.app-mode .task-action-form,
  body.app-mode .task-action-form.compact,
  body.app-mode .task-instructions div,
  body.app-mode .task-evidence-list article {
    grid-template-columns: 1fr;
  }
}

/* M2.17: Dashboard, Decision and governance workspaces */
body.app-mode .enterprise-data-panel {
  overflow: hidden;
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  background: var(--enterprise-panel);
  box-shadow: none;
}

body.app-mode .enterprise-panel-head {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--enterprise-line);
  padding: 14px 18px;
}

body.app-mode .enterprise-panel-head h2 {
  margin: 0;
  color: var(--enterprise-text);
  font-size: 17px;
}

body.app-mode .enterprise-panel-head small,
body.app-mode .record-count {
  color: var(--enterprise-muted);
  font-size: 12px;
}

body.app-mode .dashboard-status-toolbar {
  min-height: 84px;
}

body.app-mode .dashboard-meta {
  display: grid;
  justify-items: end;
  gap: 2px;
  color: var(--enterprise-muted);
  font-size: 12px;
}

body.app-mode .dashboard-meta strong {
  color: var(--enterprise-text);
  font-size: 14px;
}

body.app-mode .dashboard-enterprise-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  gap: 14px;
  align-items: start;
}

body.app-mode .dashboard-recent-panel {
  grid-column: 1 / -1;
}

body.app-mode .enterprise-data-panel .table-wrap {
  border: 0;
  border-radius: 0;
}

body.app-mode .dashboard-priority-list {
  display: grid;
}

body.app-mode .dashboard-priority-list article {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--enterprise-line);
  border-left: 3px solid #9bbcf0;
  padding: 13px 16px;
}

body.app-mode .dashboard-priority-list article:last-child {
  border-bottom: 0;
}

body.app-mode .dashboard-priority-list article.red {
  border-left-color: var(--enterprise-red);
}

body.app-mode .dashboard-priority-list article.amber {
  border-left-color: var(--enterprise-amber);
}

body.app-mode .dashboard-priority-list article.green {
  border-left-color: var(--enterprise-green);
}

body.app-mode .dashboard-priority-list article div {
  display: grid;
  gap: 4px;
}

body.app-mode .dashboard-priority-list article strong {
  color: var(--enterprise-text);
  font-size: 14px;
}

body.app-mode .dashboard-priority-list article small {
  color: var(--enterprise-muted);
  font-size: 12px;
}

body.app-mode .dashboard-priority-list article b {
  color: var(--enterprise-text);
  font-size: 24px;
}

body.app-mode .decision-workspace-head > div {
  display: grid;
  gap: 4px;
}

body.app-mode .decision-workspace .decision-toolbar {
  display: flex;
  gap: 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--enterprise-line);
  padding: 0 18px;
}

body.app-mode .decision-workspace .decision-toolbar button {
  min-height: 50px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0 16px;
  background: transparent;
  color: var(--enterprise-muted);
  box-shadow: none;
}

body.app-mode .decision-workspace .decision-toolbar button.active {
  border-bottom-color: var(--enterprise-blue);
  color: var(--enterprise-blue);
}

body.app-mode .logs-workspace .table-wrap {
  max-height: 68vh;
  overflow: auto;
}

body.app-mode .export-workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

body.app-mode .export-option {
  min-height: 180px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  padding: 22px;
  background: var(--enterprise-panel);
}

body.app-mode .export-option > div {
  display: grid;
  gap: 8px;
}

body.app-mode .export-option span {
  color: var(--enterprise-blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

body.app-mode .export-option h2 {
  margin: 0;
  color: var(--enterprise-text);
  font-size: 20px;
}

body.app-mode .export-option p {
  max-width: 520px;
  margin: 0;
  color: var(--enterprise-muted);
  font-size: 13px;
  line-height: 1.55;
}

body.app-mode .export-option button {
  min-height: 40px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--enterprise-blue);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 900px) {
  body.app-mode .dashboard-enterprise-grid,
  body.app-mode .export-workspace {
    grid-template-columns: 1fr;
  }

  body.app-mode .dashboard-recent-panel {
    grid-column: auto;
  }
}

@media (max-width: 600px) {
  body.app-mode .dashboard-meta {
    justify-items: start;
  }

  body.app-mode .export-option {
    align-items: stretch;
    flex-direction: column;
  }

  body.app-mode .export-option button {
    width: 100%;
  }
}

/* M2.18: global copy and responsive release polish */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: 6px;
  color: #ffffff;
  background: #0f5fbf;
  box-shadow: 0 4px 12px rgba(15, 95, 191, 0.2);
  transform: translateY(calc(-100% - 16px));
}

.skip-link:focus-visible {
  transform: translateY(0);
}

body.app-mode :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid rgba(23, 105, 210, 0.32);
  outline-offset: 2px;
}

body.app-mode main > header .actions input {
  width: min(320px, 34vw);
}

body.app-mode .table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

body.app-mode .table-wrap table {
  min-width: 720px;
}

body.app-mode .drawer-head button {
  min-width: 64px;
  border-radius: 6px;
}

@media (max-width: 860px) {
  body.app-mode .sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    overflow: visible;
  }

  body.app-mode .brand {
    padding: 0;
    border: 0;
  }

  body.app-mode .brand span,
  body.app-mode .nav-group-label {
    display: none;
  }

  body.app-mode #nav {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  body.app-mode .nav-group,
  body.app-mode .nav-group > div {
    display: flex;
    gap: 3px;
  }

  body.app-mode #nav button {
    min-height: 36px;
    white-space: nowrap;
  }

  body.app-mode .auth {
    position: static;
    top: auto;
    right: auto;
    display: flex;
    margin: 0;
    padding: 0;
    border: 0;
  }

  body.app-mode .auth .google,
  body.app-mode .auth #devAuth {
    display: none;
  }

  body.app-mode .auth button {
    width: auto;
    margin: 0;
    white-space: nowrap;
  }

  body.app-mode main > header .actions input {
    width: min(280px, 42vw);
  }
}

@media (max-width: 520px) {
  body.app-mode .sidebar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  body.app-mode .brand > div:last-child,
  body.app-mode .auth {
    display: none;
  }

  body.app-mode main > header {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  body.app-mode main > header .actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  body.app-mode main > header .actions input {
    width: 100%;
    min-width: 0;
  }

  body.app-mode .drawer {
    inset: 0;
    width: 100%;
    border: 0;
    border-radius: 0;
  }

  body.app-mode .drawer-body {
    padding: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.app-mode *,
  body.app-mode *::before,
  body.app-mode *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* M2.27: multi-pool inbound and special-stock workspaces */
body.app-mode .inbound-pool-tabs,
body.app-mode .special-stock-tabs {
  display: flex;
  gap: 8px;
  padding: 8px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.68);
  scrollbar-width: thin;
}

body.app-mode .inbound-pool-tabs button,
body.app-mode .special-stock-tabs button {
  flex: 0 0 auto;
  min-height: 38px;
  white-space: nowrap;
}

body.app-mode .inbound-pool-tabs button small {
  display: inline-flex;
  margin-left: 6px;
  opacity: 0.72;
}

body.app-mode .inbound-classification-form {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(160px, 1.2fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 420px;
}

body.app-mode .inbound-classification-form :where(input, select, button) {
  width: 100%;
  min-height: 36px;
}

body.app-mode .classification-rules-panel,
body.app-mode .ddt-manual-material {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
}

body.app-mode .classification-rules-panel > summary,
body.app-mode .ddt-manual-material > summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
}

body.app-mode .classification-rule-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

body.app-mode .classification-rule-form label {
  display: grid;
  gap: 6px;
}

body.app-mode .classification-rule-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

body.app-mode .classification-rule-form :where(input, select, button) {
  width: 100%;
  min-height: 40px;
}

body.app-mode .ddt-manual-material .compact-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

body.app-mode .ddt-manual-material .compact-list > span {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

@media (max-width: 860px) {
  body.app-mode .classification-rule-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  body.app-mode .classification-rule-form {
    grid-template-columns: 1fr;
  }

  body.app-mode .inbound-classification-form {
    grid-template-columns: 1fr;
    min-width: 260px;
  }
}

/* ===== M2.41 列表页操作体验 ===== */

/* 顶部加载进度条。整块 innerHTML 重建期间内容会短暂空白，
   给出明确反馈，而不是让用户对着闪烁的空白猜。 */
body.is-loading::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--enterprise-blue), transparent);
  background-size: 40% 100%;
  background-repeat: no-repeat;
  animation: dasqua-loading 1s linear infinite;
}

@keyframes dasqua-loading {
  from { background-position: -40% 0; }
  to { background-position: 140% 0; }
}

@media (prefers-reduced-motion: reduce) {
  body.is-loading::before {
    animation: none;
    background: var(--enterprise-blue);
  }
}

/* 激活筛选标签条：一眼看到"现在筛了什么"，可逐条或一键清除。 */
body.app-mode .active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--enterprise-line);
  background: #fbfcfe;
}

body.app-mode .active-filters-label {
  color: var(--enterprise-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

body.app-mode .filter-chip {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 3px 6px 3px 9px;
  border: 1px solid #c7ddf7;
  border-radius: 999px;
  background: var(--enterprise-blue-soft);
  color: var(--enterprise-muted);
  font-size: 12px;
}

body.app-mode .filter-chip b {
  color: var(--enterprise-text);
  font-weight: 700;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.app-mode .filter-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(23, 105, 210, 0.14);
  color: var(--enterprise-blue);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

body.app-mode .filter-chip button:hover {
  background: var(--enterprise-blue);
  color: #ffffff;
}

body.app-mode .filter-chip-reset {
  padding: 3px 10px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--enterprise-blue);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* 粘性表头：长列表滚动时列名不再滚出视野。 */
body.app-mode .table-wrap {
  max-height: min(72vh, 780px);
  overflow-y: auto;
}

body.app-mode .table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: inset 0 -1px 0 var(--enterprise-line);
}

/* ===== M2.41 个人设置 ===== */
body.app-mode .settings-grid {
  display: grid;
  gap: 0;
}

body.app-mode .settings-row {
  display: flex;
  gap: 16px;
  align-items: baseline;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--enterprise-line);
}

body.app-mode .settings-row span {
  color: var(--enterprise-muted);
  font-size: 13px;
}

body.app-mode .settings-note {
  margin: 0;
  padding: 12px 16px;
  color: var(--enterprise-muted);
  font-size: 12px;
  line-height: 1.6;
}

body.app-mode .settings-locale-form {
  display: grid;
  gap: 0;
}

body.app-mode .settings-locale-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 16px 4px;
}

body.app-mode .settings-locale-option {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--enterprise-line);
  border-radius: 6px;
  background: #ffffff;
  font-size: 14px;
  cursor: pointer;
}

body.app-mode .settings-locale-option.active {
  border-color: var(--enterprise-blue);
  background: var(--enterprise-blue-soft);
  font-weight: 700;
}

body.app-mode .settings-locale-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--enterprise-blue);
}

body.app-mode .settings-locale-form > button {
  justify-self: start;
  min-height: 38px;
  margin: 8px 16px 16px;
  padding: 8px 16px;
  border: 1px solid var(--enterprise-blue);
  border-radius: 6px;
  background: var(--enterprise-blue);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* ===== M2.41 产品编辑模式 ===== */
body.app-mode .sku-edit-toggle {
  margin-left: auto;
  min-height: 30px;
  padding: 5px 14px;
  border: 1px solid var(--enterprise-blue);
  border-radius: 999px;
  background: #ffffff;
  color: var(--enterprise-blue);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

body.app-mode .sku-edit-toggle.active {
  background: var(--enterprise-blue);
  color: #ffffff;
}

/* 编辑态横幅（Claude Design 3a）：编辑中提示 + 取消/保存。 */
body.app-mode .sku-edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border: 1px solid var(--enterprise-blue);
  border-radius: 10px;
  background: rgba(23, 105, 210, 0.08);
}

body.app-mode .sku-edit-banner-text {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

body.app-mode .sku-edit-banner-text strong {
  color: var(--enterprise-blue);
}

body.app-mode .sku-edit-banner-text span {
  color: var(--enterprise-muted);
  font-size: 13px;
}

body.app-mode .sku-edit-banner-actions {
  display: flex;
  gap: 8px;
  flex: none;
}

body.app-mode .sku-edit-banner-actions button {
  min-height: 36px;
  padding: 7px 16px;
  border: 1px solid var(--enterprise-blue);
  border-radius: 6px;
  background: #ffffff;
  color: var(--enterprise-blue);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

body.app-mode .sku-edit-banner-actions button.primary {
  background: var(--enterprise-blue);
  color: #ffffff;
}

body.app-mode .sku-edit-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

body.app-mode .sku-edit-form-grid label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

body.app-mode .sku-edit-form-grid label.wide {
  grid-column: 1 / -1;
}

body.app-mode .sku-edit-form-grid label span {
  color: var(--enterprise-muted);
  font-size: 12px;
  font-weight: 600;
}

body.app-mode .sku-edit-form-grid input,
body.app-mode .sku-edit-form-grid select {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--enterprise-line);
  border-radius: 6px;
  font: inherit;
}

body.app-mode .checkbox-field {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
}

body.app-mode .sku-lot-edit-list {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

body.app-mode .sku-lot-edit-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
  padding: 12px;
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
}

body.app-mode .sku-lot-edit-row label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

body.app-mode .sku-lot-edit-row label span {
  color: var(--enterprise-muted);
  font-size: 12px;
  font-weight: 600;
}

body.app-mode .sku-lot-edit-row input,
body.app-mode .sku-lot-edit-row select {
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid var(--enterprise-line);
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
}

body.app-mode .sku-lot-edit-ref {
  grid-column: 1 / -1;
  display: flex;
  gap: 16px;
  color: var(--enterprise-muted);
  font-size: 12px;
}

body.app-mode .sku-add-allocation {
  margin-top: 4px;
}

body.app-mode .sku-add-allocation > summary {
  color: var(--enterprise-blue);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

body.app-mode .sku-add-allocation > summary::-webkit-details-marker {
  display: none;
}

body.app-mode .sku-edit-note {
  display: grid;
  gap: 4px;
  padding: 4px 2px;
}

body.app-mode .sku-edit-note span {
  color: var(--enterprise-muted);
  font-size: 12px;
  font-weight: 600;
}

body.app-mode .sku-edit-note input {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--enterprise-line);
  border-radius: 6px;
  font: inherit;
}

body.app-mode .sku-relation-list {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

body.app-mode .sku-relation-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  padding: 8px 10px;
  border: 1px solid var(--enterprise-line);
  border-radius: 6px;
  font-size: 13px;
}

body.app-mode .sku-relation-list span {
  flex: 1 1 160px;
  color: var(--enterprise-muted);
}

body.app-mode .sku-relation-list em {
  color: var(--enterprise-text);
  font-style: normal;
  font-weight: 700;
}

@media (max-width: 640px) {
  body.app-mode .sku-edit-form-grid,
  body.app-mode .sku-lot-edit-row {
    grid-template-columns: 1fr;
  }

  body.app-mode .sku-edit-banner {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ===== M2.42 Inbound 分类：固定底部操作条 ===== */

/* 编辑对象可能在 139 行的任意位置，操作入口和结果反馈必须始终可见，
   不能让用户为了点按钮或看结果去滚动整页。 */
body.app-mode .inbound-batch-bar {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 264px;
  z-index: 40;
  border: 1px solid #98bff2;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 28px rgba(16, 40, 80, 0.16);
}

/* 操作条浮在内容上方，给页面底部留出空间，避免遮住最后几行。 */
body.has-inbound-batch-bar main {
  padding-bottom: 140px;
}

body.app-mode .inbound-batch-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
  padding: 12px 14px;
}

body.app-mode .inbound-batch-count {
  padding-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

body.app-mode .inbound-batch-form label {
  display: grid;
  gap: 4px;
  min-width: 140px;
}

body.app-mode .inbound-batch-form label.grow {
  flex: 1 1 200px;
}

body.app-mode .inbound-batch-form label span {
  color: var(--enterprise-muted);
  font-size: 12px;
  font-weight: 600;
}

body.app-mode .inbound-batch-hint {
  padding-bottom: 10px;
  color: var(--enterprise-muted);
  font-size: 12px;
}

body.app-mode .inbound-batch-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* 二次确认：按钮自身变色并说明影响行数，替代原生 confirm 弹窗。 */
body.app-mode .inbound-batch-actions button.armed {
  border-color: var(--enterprise-warning);
  background: var(--enterprise-warning);
  color: #ffffff;
}

body.app-mode .inbound-batch-result {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--enterprise-line);
  border-radius: 8px 8px 0 0;
  background: #eef8f2;
  font-size: 13px;
}

body.app-mode .inbound-batch-result.has-error {
  background: #fdf7ec;
}

body.app-mode .inbound-batch-result span {
  color: var(--enterprise-muted);
}

body.app-mode .inbound-batch-result button {
  margin-left: auto;
  padding: 4px 12px;
  border: 1px solid var(--enterprise-line);
  border-radius: 6px;
  background: #ffffff;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

/* 选中行高亮，滚动中也能一眼看出选了哪些。 */
body.app-mode tr.selected {
  background: var(--enterprise-blue-soft);
}

/* 表格里的复选框：不加约束会继承全局 input 样式，
   渲染成和文本框一样大的方框，看不出是复选框。 */
body.app-mode .panel table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border-radius: 3px;
  accent-color: var(--enterprise-blue);
  cursor: pointer;
}

body.app-mode .panel table th:first-child,
body.app-mode .panel table td:first-child {
  width: 40px;
  text-align: center;
}

/* 分类徽标不换行，否则"大货库存"会被拆成两行。 */
body.app-mode .panel table .badge {
  white-space: nowrap;
}

@media (max-width: 860px) {
  body.app-mode .inbound-batch-bar {
    right: 8px;
    bottom: 8px;
    left: 8px;
    max-height: 60vh;
    overflow-y: auto;
  }

  body.app-mode .inbound-batch-actions {
    margin-left: 0;
    width: 100%;
  }

  body.has-inbound-batch-bar main {
    padding-bottom: 220px;
  }
}


/* 显式确认条：说明将要做什么、影响多少行，不会超时自动消失。 */
body.app-mode .inbound-batch-confirm {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #f0d7a8;
  border-radius: 8px 8px 0 0;
  background: #fdf7ec;
  font-size: 13px;
}

body.app-mode .inbound-batch-confirm strong {
  color: var(--enterprise-warning);
}

body.app-mode .inbound-batch-confirm span {
  color: var(--enterprise-muted);
}

body.app-mode .inbound-batch-confirm button {
  min-height: 34px;
  padding: 6px 16px;
  border: 1px solid var(--enterprise-warning);
  border-radius: 6px;
  background: var(--enterprise-warning);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

body.app-mode .inbound-batch-confirm button[data-inbound-confirm-go] {
  order: 3;
}

body.app-mode .inbound-batch-confirm button.secondary {
  margin-left: auto;
  order: 2;
  border-color: var(--enterprise-line);
  background: #ffffff;
  color: var(--enterprise-text);
  font-weight: 600;
}

/* ===== M2.44 到货批次信息编辑 ===== */
body.app-mode .inbound-meta-form {
  display: grid;
  /* auto-fit + minmax 在容器较窄时会把列压到 minmax 下限之下，
     导致标签与输入框互相重叠。用 auto-fill 并给出足够的下限。 */
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px 12px;
  align-items: end;
  padding: 16px;
}

body.app-mode .inbound-meta-form label.span-all {
  grid-column: 1 / -1;
}

body.app-mode .inbound-meta-form input,
body.app-mode .inbound-meta-form select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

body.app-mode .inbound-meta-form label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

body.app-mode .inbound-meta-form label span {
  color: var(--enterprise-muted);
  font-size: 12px;
  font-weight: 600;
}

body.app-mode .inbound-meta-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.app-mode .inbound-meta-actions button {
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid var(--enterprise-blue);
  border-radius: 6px;
  background: var(--enterprise-blue);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

body.app-mode .inbound-meta-actions button.secondary {
  border-color: var(--enterprise-line);
  background: #ffffff;
  color: var(--enterprise-text);
}

/* 删除不可恢复，视觉上与取消区分开。 */
body.app-mode .inbound-meta-actions button.danger-text {
  margin-left: auto;
  border-color: #e5b4ae;
  color: var(--enterprise-danger);
}

/* ===== M2.46 运输时间轴 ===== */
body.app-mode .shipment-timeline {
  display: grid;
  gap: 6px;
  min-width: 190px;
}

body.app-mode .timeline-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: #e6ebf2;
  overflow: hidden;
}

body.app-mode .timeline-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--enterprise-blue);
  transition: width 240ms ease;
}

@media (prefers-reduced-motion: reduce) {
  body.app-mode .timeline-fill { transition: none; }
}

body.app-mode .shipment-timeline.soon .timeline-fill { background: var(--enterprise-warning); }
body.app-mode .shipment-timeline.overdue .timeline-fill { background: var(--enterprise-danger); }
body.app-mode .shipment-timeline.done .timeline-fill { background: var(--enterprise-success); }
body.app-mode .shipment-timeline.missing-eta .timeline-track {
  background: repeating-linear-gradient(90deg, #e6ebf2 0 6px, transparent 6px 12px);
}

body.app-mode .timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  align-items: baseline;
  font-size: 11px;
  line-height: 1.5;
}

body.app-mode .timeline-meta span {
  color: var(--enterprise-muted);
  white-space: nowrap;
}

body.app-mode .timeline-meta b {
  color: var(--enterprise-text);
  font-weight: 650;
}

/* 状态文字始终存在，不靠颜色单独表达逾期。 */
body.app-mode .timeline-meta strong {
  font-size: 12px;
  white-space: nowrap;
}

body.app-mode .shipment-timeline.overdue .timeline-meta strong { color: var(--enterprise-danger); }
body.app-mode .shipment-timeline.soon .timeline-meta strong { color: var(--enterprise-warning); }
body.app-mode .shipment-timeline.done .timeline-meta strong { color: var(--enterprise-success); }
body.app-mode .shipment-timeline.missing-eta .timeline-meta strong { color: var(--enterprise-muted); }

body.app-mode .timeline-meta small {
  color: var(--enterprise-muted);
  font-size: 11px;
  white-space: nowrap;
}

body.app-mode .rail-timeline {
  padding: 10px 12px;
  border: 1px solid var(--enterprise-line);
  border-radius: 6px;
  background: #ffffff;
}

body.app-mode .muted-cell { color: var(--enterprise-muted); }

/* ===== M2.46 时间戳列 ===== */
/* 日期为主、时刻弱化，避免长时间戳在等宽列里折成参差的两三行。 */
body.app-mode .stamp-cell strong {
  display: block;
  font-weight: 600;
  white-space: nowrap;
}

/* 副行（文件名、入账时间等）是补充信息，过长时截断并用 title 保留完整值，
   不让它把列撑宽或折成多行。 */
body.app-mode .stamp-cell small,
body.app-mode .history-table td small {
  display: block;
  max-width: 100%;
  color: var(--enterprise-muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.app-mode .history-table td strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 自动布局下，全局的 overflow-wrap: break-word 会让时间戳列的最小内容宽度
   变成一个字符，于是被压到 40px 而内容溢出。列宽要设在表头上（表头驱动列尺寸），
   同时让单元格不换行，把最小内容宽度抬回完整时间戳。 */
body.app-mode .history-table thead th:first-child {
  width: 112px;
}

body.app-mode .history-table td.stamp-cell {
  white-space: nowrap;
  overflow-wrap: normal;
}

/* 数字列右对齐，扫读更快。 */
body.app-mode .history-table td:nth-last-child(2),
body.app-mode .history-table th:nth-last-child(2) {
  text-align: right;
}

/* ===== M2.47 待办看板 ===== */
body.app-mode .task-view-tabs {
  margin-bottom: 14px;
}

body.app-mode .todo-overdue-note {
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid #f0c8c3;
  border-left: 3px solid var(--enterprise-danger);
  border-radius: 6px;
  background: #fdf2f1;
  color: var(--enterprise-danger);
  font-size: 13px;
  font-weight: 600;
}

body.app-mode .todo-create-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: flex-end;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  background: #ffffff;
}

body.app-mode .todo-create-form label {
  display: grid;
  gap: 4px;
  min-width: 140px;
}

body.app-mode .todo-create-form label.grow { flex: 1 1 260px; }

body.app-mode .todo-create-form label span {
  color: var(--enterprise-muted);
  font-size: 12px;
  font-weight: 600;
}

body.app-mode .todo-create-actions button {
  min-height: 38px;
  padding: 8px 20px;
  border: 1px solid var(--enterprise-blue);
  border-radius: 6px;
  background: var(--enterprise-blue);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

body.app-mode .todo-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

body.app-mode .todo-column {
  display: flex;
  flex-direction: column;
  min-height: 160px;
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  background: #f7f9fc;
}

body.app-mode .todo-column.drop-target {
  border-color: var(--enterprise-blue);
  background: var(--enterprise-blue-soft);
}

body.app-mode .todo-column > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--enterprise-line);
}

body.app-mode .todo-column > header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

body.app-mode .todo-column > header span {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #e6ebf2;
  color: var(--enterprise-muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

body.app-mode .todo-column-body {
  display: grid;
  gap: 8px;
  padding: 10px;
}

body.app-mode .todo-empty {
  margin: 0;
  padding: 14px 0;
  color: var(--enterprise-muted);
  font-size: 12px;
  text-align: center;
}

body.app-mode .todo-card {
  display: grid;
  gap: 7px;
  padding: 10px 11px;
  border: 1px solid var(--enterprise-line);
  border-left: 3px solid var(--enterprise-line);
  border-radius: 6px;
  background: #ffffff;
  cursor: grab;
}

body.app-mode .todo-card.dragging { opacity: 0.5; }
body.app-mode .todo-card.priority-urgent { border-left-color: var(--enterprise-danger); }
body.app-mode .todo-card.priority-high { border-left-color: var(--enterprise-warning); }
body.app-mode .todo-card.priority-normal { border-left-color: var(--enterprise-blue); }
body.app-mode .todo-card.priority-low { border-left-color: #c3cbd8; }

body.app-mode .todo-card-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
}

body.app-mode .todo-card-head strong {
  font-size: 13px;
  line-height: 1.45;
}

body.app-mode .todo-delete {
  flex: none;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--enterprise-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

body.app-mode .todo-delete:hover {
  background: #fdf2f1;
  color: var(--enterprise-danger);
}

body.app-mode .todo-card p {
  margin: 0;
  color: var(--enterprise-muted);
  font-size: 12px;
  line-height: 1.5;
}

body.app-mode .todo-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

body.app-mode .todo-chip,
body.app-mode .todo-due {
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--enterprise-muted);
  font-size: 11px;
  white-space: nowrap;
}

body.app-mode .todo-chip.prio-urgent { background: #fdecea; color: var(--enterprise-danger); font-weight: 700; }
body.app-mode .todo-chip.prio-high { background: #fdf3e6; color: var(--enterprise-warning); font-weight: 700; }
body.app-mode .todo-chip.link { background: var(--enterprise-blue-soft); color: var(--enterprise-blue); }

/* 逾期同时用颜色和文字表达，不依赖颜色单独承载信息。 */
body.app-mode .todo-due.overdue { background: #fdecea; color: var(--enterprise-danger); font-weight: 700; }
body.app-mode .todo-due.soon { background: #fdf3e6; color: var(--enterprise-warning); font-weight: 700; }

body.app-mode .todo-move select {
  width: 100%;
  min-height: 30px;
  font-size: 12px;
}

body.app-mode .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1100px) {
  body.app-mode .todo-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  body.app-mode .todo-board { grid-template-columns: 1fr; }
}

/* 非标库存归属列：客户与业务员分行显示。 */
body.app-mode .non-standard-list-workspace td strong {
  display: block;
  font-weight: 650;
}

body.app-mode .non-standard-list-workspace td small {
  display: block;
  color: var(--enterprise-muted);
  font-size: 11px;
}

body.app-mode .non-standard-list-workspace td small.owner-line {
  color: var(--enterprise-text);
}

/* ===== M2.48 业务员归属筛选与跟进 ===== */
body.app-mode .owner-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  background: #ffffff;
}

body.app-mode .owner-filter-label {
  margin-right: 4px;
  color: var(--enterprise-muted);
  font-size: 12px;
  font-weight: 700;
}

body.app-mode .owner-filter-bar button {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 5px 11px;
  border: 1px solid var(--enterprise-line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--enterprise-text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

body.app-mode .owner-filter-bar button small {
  padding: 0 5px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--enterprise-muted);
  font-size: 11px;
}

body.app-mode .owner-filter-bar button.active {
  border-color: var(--enterprise-blue);
  background: var(--enterprise-blue);
  color: #ffffff;
  font-weight: 700;
}

body.app-mode .owner-filter-bar button.active small {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

body.app-mode .owner-filter-bar button.warn {
  border-color: #f0d7a8;
  color: var(--enterprise-warning);
}

body.app-mode .owner-notify-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid #98bff2;
  border-radius: 8px;
  background: var(--enterprise-blue-soft);
}

body.app-mode .owner-notify-bar strong { display: block; font-size: 14px; }
body.app-mode .owner-notify-bar small { color: var(--enterprise-muted); font-size: 12px; }

body.app-mode .owner-notify-bar button {
  min-height: 36px;
  padding: 8px 16px;
  border: 1px solid var(--enterprise-blue);
  border-radius: 6px;
  background: var(--enterprise-blue);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* Excel 原文与登记名不同时弱化显示，便于核对但不喧宾夺主。 */
body.app-mode .raw-owner { color: var(--enterprise-muted); font-weight: 400; }
body.app-mode .owner-line.unmapped { color: var(--enterprise-warning); }
body.app-mode .stale-days { color: var(--enterprise-warning); font-weight: 700; }

/* ===== M2.49 批次编辑与销售期限 ===== */
body.app-mode .lot-edit-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px 12px;
  align-items: start;
  padding: 16px;
}

body.app-mode .lot-edit-form label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

body.app-mode .lot-edit-form label.span-all,
body.app-mode .lot-edit-form fieldset { grid-column: 1 / -1; }

body.app-mode .lot-edit-form label > span {
  color: var(--enterprise-muted);
  font-size: 12px;
  font-weight: 600;
}

body.app-mode .lot-edit-form label > small {
  color: var(--enterprise-muted);
  font-size: 11px;
  line-height: 1.4;
}

body.app-mode .lot-edit-form input { width: 100%; box-sizing: border-box; }

body.app-mode .lot-owner-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--enterprise-line);
  border-radius: 6px;
}

body.app-mode .lot-owner-picker legend {
  padding: 0 4px;
  color: var(--enterprise-muted);
  font-size: 12px;
  font-weight: 600;
}

body.app-mode .owner-check {
  display: inline-flex !important;
  gap: 6px;
  align-items: center;
  cursor: pointer;
}

body.app-mode .owner-check input {
  width: 16px !important;
  height: 16px;
  margin: 0;
  accent-color: var(--enterprise-blue);
}

body.app-mode .lot-edit-actions { grid-column: 1 / -1; }

body.app-mode .lot-edit-actions button {
  min-height: 38px;
  padding: 8px 20px;
  border: 1px solid var(--enterprise-blue);
  border-radius: 6px;
  background: var(--enterprise-blue);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

body.app-mode .sell-by.overdue { color: var(--enterprise-danger); font-weight: 700; }
body.app-mode .sell-by.soon { color: var(--enterprise-warning); font-weight: 700; }

/* ===== M2.52 划拨面板与非标搜索 ===== */
body.app-mode .allocation-available {
  color: var(--enterprise-muted);
  font-size: 12px;
  white-space: nowrap;
}

body.app-mode .allocation-available strong {
  color: var(--enterprise-blue);
  font-size: 16px;
}

body.app-mode .sku-allocate-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px 12px;
  align-items: start;
  padding: 14px 0 0;
}

body.app-mode .sku-allocate-form label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

body.app-mode .sku-allocate-form label.span-all { grid-column: 1 / -1; }

body.app-mode .sku-allocate-form label > span {
  color: var(--enterprise-muted);
  font-size: 12px;
  font-weight: 600;
}

body.app-mode .sku-allocate-form label > small {
  color: var(--enterprise-muted);
  font-size: 11px;
}

body.app-mode .sku-allocate-form input,
body.app-mode .sku-allocate-form select { width: 100%; box-sizing: border-box; }

body.app-mode .special-stock-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 12px;
}

body.app-mode .special-stock-search label.grow { flex: 1 1 320px; }
body.app-mode .special-stock-search input { width: 100%; box-sizing: border-box; }

body.app-mode .special-stock-search button {
  min-height: 38px;
  padding: 8px 18px;
  border: 1px solid var(--enterprise-blue);
  border-radius: 6px;
  background: var(--enterprise-blue);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

body.app-mode .special-stock-search button.secondary {
  border-color: var(--enterprise-line);
  background: #ffffff;
  color: var(--enterprise-text);
}

/* M2.54：物理总量 − 已预留 = 大货可售。只在存在预留时出现，用于解释
   为什么可售数字比仓库里点到的件数少，避免被当成库存错误反复追查。 */
.stock-formula {
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface-subtle, rgba(148, 163, 184, 0.12));
  color: var(--text-secondary, #475569);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* M2.55：客户专属库存保持共享读取；库存写操作按既有权限显示。 */
body.app-mode .customer-stock-metrics {
  margin-bottom: 14px;
}

body.app-mode .customer-stock-pool-tabs {
  margin-bottom: 12px;
}

body.app-mode .customer-stock-controls {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px 16px 0;
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  background: #ffffff;
}

body.app-mode .customer-stock-controls .special-stock-search {
  margin: 0;
}

body.app-mode .customer-stock-controls .owner-filter-bar {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

body.app-mode .customer-stock-lifecycle {
  display: flex;
  gap: 2px;
  margin: 0 -16px;
  padding: 0 16px;
  overflow-x: auto;
  border-top: 1px solid var(--enterprise-line);
}

body.app-mode .customer-stock-lifecycle button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--enterprise-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

body.app-mode .customer-stock-lifecycle button:hover {
  color: var(--enterprise-text);
}

body.app-mode .customer-stock-lifecycle button.active {
  border-bottom-color: var(--enterprise-blue);
  color: var(--enterprise-blue);
}

body.app-mode .customer-stock-lifecycle button span {
  display: inline-grid;
  min-width: 23px;
  height: 23px;
  padding: 0 6px;
  place-items: center;
  border-radius: 999px;
  background: var(--enterprise-blue-soft);
  color: var(--enterprise-blue);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

body.app-mode .customer-stock-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 360px);
  align-items: start;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  background: #ffffff;
}

body.app-mode .customer-stock-list {
  min-width: 0;
  border-right: 1px solid var(--enterprise-line);
}

body.app-mode .customer-stock-list > header {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--enterprise-line);
}

body.app-mode .customer-stock-list > header h2,
body.app-mode .customer-stock-detail h2,
body.app-mode .customer-stock-detail h3 {
  margin: 0;
  color: var(--enterprise-text);
}

body.app-mode .customer-stock-list > header h2 {
  font-size: 16px;
}

body.app-mode .customer-stock-list > header p {
  margin: 4px 0 0;
  color: var(--enterprise-muted);
  font-size: 12px;
}

body.app-mode .customer-stock-list > header > span {
  color: var(--enterprise-muted);
  font-size: 12px;
  white-space: nowrap;
}

body.app-mode .customer-stock-table-wrap {
  max-width: 100%;
  overflow-x: hidden;
}

body.app-mode .customer-stock-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

body.app-mode .customer-stock-table col.select { width: 34px; }
body.app-mode .customer-stock-table col.customer { width: 13%; }
body.app-mode .customer-stock-table col.product { width: 15%; }
body.app-mode .customer-stock-table col.owner { width: 15%; }
body.app-mode .customer-stock-table col.qty { width: 7%; }
body.app-mode .customer-stock-table col.arrival { width: 14%; }
body.app-mode .customer-stock-table col.location { width: 10%; }
body.app-mode .customer-stock-table col.stage { width: 11%; }
body.app-mode .customer-stock-table col.outbound { width: 15%; }
body.app-mode .customer-stock-incoming-table col.customer { width: 14%; }
body.app-mode .customer-stock-incoming-table col.product { width: 18%; }
body.app-mode .customer-stock-incoming-table col.owner { width: 17%; }
body.app-mode .customer-stock-incoming-table col.qty { width: 9%; }
body.app-mode .customer-stock-incoming-table col.stage { width: 13%; }
body.app-mode .customer-stock-incoming-table col.shipment { width: 14%; }
body.app-mode .customer-stock-incoming-table col.eta { width: 15%; }

body.app-mode .customer-stock-table th {
  height: 42px;
  padding: 0 12px;
  border-bottom: 1px solid var(--enterprise-line);
  background: #f8fafc;
  color: var(--enterprise-muted);
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

body.app-mode .customer-stock-table td {
  height: 64px;
  min-width: 0;
  padding: 9px 8px;
  border-bottom: 1px solid var(--enterprise-line);
  color: var(--enterprise-text);
  font-size: 12px;
  vertical-align: middle;
}

body.app-mode .customer-stock-table tbody tr:last-child td {
  border-bottom: 0;
}

body.app-mode .customer-stock-table tbody tr:hover td {
  background: #f8fbff;
}

body.app-mode .customer-stock-table tbody tr.selected td {
  background: #eef6ff;
}

body.app-mode .customer-stock-table tbody tr.selected td:first-child {
  box-shadow: inset 3px 0 var(--enterprise-blue);
}

body.app-mode .customer-stock-table td > strong,
body.app-mode .customer-stock-table td > small,
body.app-mode .customer-stock-cell-content > strong,
body.app-mode .customer-stock-cell-content > small {
  display: block;
}

body.app-mode .customer-stock-table td > strong,
body.app-mode .customer-stock-table td > small,
body.app-mode .customer-stock-table td > span,
body.app-mode .customer-stock-cell-content > strong,
body.app-mode .customer-stock-cell-content > small,
body.app-mode .customer-stock-cell-content > span {
  max-width: 100%;
  overflow-wrap: anywhere;
}

body.app-mode .customer-stock-cell-content {
  min-width: 0;
}

body.app-mode .customer-stock-description {
  display: -webkit-box !important;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body.app-mode .customer-stock-select-col {
  width: 34px;
  padding-right: 4px !important;
  padding-left: 8px !important;
  text-align: center;
}

body.app-mode .customer-stock-table td > strong,
body.app-mode .customer-stock-cell-content > strong,
body.app-mode .customer-stock-record {
  color: var(--enterprise-text);
  font-size: 12px;
  font-weight: 700;
}

body.app-mode .customer-stock-table td > small,
body.app-mode .customer-stock-cell-content > small {
  margin-top: 4px;
  color: var(--enterprise-muted);
  font-size: 11px;
  line-height: 1.3;
}

body.app-mode .customer-stock-table .customer-stock-record {
  padding: 0;
  text-align: left;
}

body.app-mode .customer-stock-table .customer-stock-record:hover {
  color: var(--enterprise-blue);
}

body.app-mode .customer-stock-age,
body.app-mode .customer-stock-status {
  display: inline-flex;
  width: max-content;
  align-items: center;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}

body.app-mode .customer-stock-age {
  padding: 3px 7px;
}

body.app-mode .customer-stock-age.ok {
  background: #eaf8ef;
  color: #16803b;
}

body.app-mode .customer-stock-age.warn {
  background: #fff4d6;
  color: #a35d00;
}

body.app-mode .customer-stock-age.danger {
  background: #ffebee;
  color: #bd2636;
}

body.app-mode .customer-stock-status {
  padding: 5px 8px;
  background: #eaf3ff;
  color: var(--enterprise-blue);
  font-size: 11px;
}

body.app-mode .customer-stock-status.received {
  background: #eaf8ef;
  color: #16803b;
}

body.app-mode .customer-stock-status.dispatched,
body.app-mode .customer-stock-status.depleted,
body.app-mode .customer-stock-status.collected {
  background: #f1f5f9;
  color: #475569;
}

body.app-mode .customer-stock-status.transferred_to_bulk,
body.app-mode .customer-stock-status.cancelled {
  background: #fff4d6;
  color: #8a5200;
}

body.app-mode .customer-stock-detail {
  position: sticky;
  top: 0;
  min-width: 0;
  max-height: calc(100vh - 104px);
  overflow: auto;
  background: #ffffff;
}

body.app-mode .customer-stock-detail.empty {
  min-height: 360px;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--enterprise-muted);
  text-align: center;
}

body.app-mode .customer-stock-detail.empty strong {
  color: var(--enterprise-text);
}

body.app-mode .customer-stock-detail.empty p {
  max-width: 220px;
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.6;
}

body.app-mode .customer-stock-detail > header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin: 0;
  padding: 18px 18px 14px;
  border: 0;
  border-bottom: 1px solid var(--enterprise-line);
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
  backdrop-filter: none;
}

body.app-mode .customer-stock-detail > header > div > span {
  display: block;
  margin-bottom: 6px;
  color: var(--enterprise-muted);
  font-size: 11px;
  font-weight: 700;
}

body.app-mode .customer-stock-detail h2 {
  font-size: 19px;
}

body.app-mode .customer-stock-product {
  display: grid;
  gap: 3px;
  padding: 0 18px 16px;
  border-bottom: 1px solid var(--enterprise-line);
}

body.app-mode .customer-stock-product strong {
  font-size: 15px;
}

body.app-mode .customer-stock-product span,
body.app-mode .customer-stock-product small {
  color: var(--enterprise-muted);
  font-size: 12px;
}

body.app-mode .customer-stock-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-bottom: 1px solid var(--enterprise-line);
}

body.app-mode .customer-stock-facts > div {
  min-width: 0;
  padding: 13px 16px;
  border-right: 1px solid var(--enterprise-line);
  border-bottom: 1px solid var(--enterprise-line);
}

body.app-mode .customer-stock-facts > div:nth-child(2n) {
  border-right: 0;
}

body.app-mode .customer-stock-facts > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

body.app-mode .customer-stock-facts dt,
body.app-mode .customer-stock-source dt {
  color: var(--enterprise-muted);
  font-size: 10px;
  font-weight: 700;
}

body.app-mode .customer-stock-facts dd {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--enterprise-text);
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.app-mode .customer-stock-detail-section {
  padding: 16px 18px;
  border-bottom: 1px solid var(--enterprise-line);
}

body.app-mode .customer-stock-detail-section:last-child {
  border-bottom: 0;
}

body.app-mode .customer-stock-detail-section h3 {
  margin-bottom: 12px;
  font-size: 14px;
}

body.app-mode .customer-stock-source {
  display: grid;
  gap: 9px;
  margin: 0;
}

body.app-mode .customer-stock-source > div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
}

body.app-mode .customer-stock-source dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--enterprise-text);
  font-size: 11px;
  font-weight: 650;
  text-align: right;
}

body.app-mode .customer-stock-timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

body.app-mode .customer-stock-timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 10px;
  min-height: 54px;
}

body.app-mode .customer-stock-timeline li:not(:last-child)::before {
  position: absolute;
  top: 13px;
  bottom: -2px;
  left: 5px;
  width: 2px;
  background: #d9e3ef;
  content: "";
}

body.app-mode .customer-stock-timeline .timeline-dot {
  position: relative;
  z-index: 1;
  width: 10px;
  height: 10px;
  margin-top: 3px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--enterprise-blue);
  box-shadow: 0 0 0 2px #b9d6fb;
}

body.app-mode .customer-stock-timeline li.outbound .timeline-dot {
  background: #16803b;
  box-shadow: 0 0 0 2px #bce8ca;
}

body.app-mode .customer-stock-timeline li > div {
  display: grid;
  gap: 2px;
  padding-bottom: 12px;
}

body.app-mode .customer-stock-timeline strong {
  color: var(--enterprise-text);
  font-size: 12px;
}

body.app-mode .customer-stock-timeline time,
body.app-mode .customer-stock-timeline small {
  color: var(--enterprise-muted);
  font-size: 10px;
}

body.app-mode .customer-stock-note {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid #e4a11b;
  background: #fff9e9;
  color: #71500a;
  font-size: 11px;
  line-height: 1.6;
}

body.app-mode .customer-stock-operations {
  padding: 16px 18px 20px;
  border-top: 1px solid var(--enterprise-line);
  background: #f8fafc;
}

body.app-mode .customer-stock-operations .lot-edit-details,
body.app-mode .customer-stock-operations .lot-action {
  background: #ffffff;
}

body.app-mode .customer-stock-operations .detail-section-head {
  margin-top: 16px;
}

body.app-mode .customer-stock-operations .lot-edit-form {
  grid-template-columns: minmax(0, 1fr);
}

body.app-mode .customer-stock-empty {
  display: grid;
  gap: 6px;
  min-height: 260px;
  place-content: center;
  padding: 24px;
  color: var(--enterprise-muted);
  font-size: 12px;
  text-align: center;
}

body.app-mode .customer-stock-empty strong {
  color: var(--enterprise-text);
  font-size: 14px;
}

body.app-mode .customer-stock-empty.compact {
  min-height: 80px;
  padding: 12px;
}

@media (max-width: 1440px) {
  body.app-mode .customer-stock-board {
    grid-template-columns: minmax(0, 1fr);
  }

  body.app-mode .customer-stock-list {
    border-right: 0;
  }

  body.app-mode .customer-stock-detail {
    position: static;
    max-height: none;
    border-top: 1px solid var(--enterprise-line);
  }
}

@media (max-width: 720px) {
  body.app-mode .customer-stock-controls {
    padding: 12px 12px 0;
  }

  body.app-mode .customer-stock-controls .special-stock-search {
    align-items: stretch;
  }

  body.app-mode .customer-stock-controls .special-stock-search label.grow,
  body.app-mode .customer-stock-controls .special-stock-search button {
    flex: 1 1 100%;
  }

  body.app-mode .customer-stock-lifecycle {
    margin: 0 -12px;
    padding: 0 12px;
  }

  body.app-mode .customer-stock-list > header {
    align-items: flex-start;
  }

  body.app-mode .customer-stock-list > header p {
    display: none;
  }

  body.app-mode .customer-stock-table-wrap {
    padding: 10px;
  }

  body.app-mode .customer-stock-table,
  body.app-mode .customer-stock-table tbody,
  body.app-mode .customer-stock-table tr,
  body.app-mode .customer-stock-table td {
    display: block;
    width: 100%;
  }

  body.app-mode .customer-stock-table colgroup,
  body.app-mode .customer-stock-table thead {
    display: none;
  }

  body.app-mode .customer-stock-table tr {
    overflow: hidden;
    margin-bottom: 10px;
    border: 1px solid var(--enterprise-line);
    border-radius: 8px;
    background: #ffffff;
  }

  body.app-mode .customer-stock-table tr:last-child {
    margin-bottom: 0;
  }

  body.app-mode .customer-stock-table td {
    display: grid;
    grid-template-columns: minmax(90px, 34%) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    height: auto;
    min-height: 42px;
    padding: 10px 12px;
  }

  body.app-mode .customer-stock-table td::before {
    color: var(--enterprise-muted);
    font-size: 11px;
    font-weight: 700;
    content: attr(data-label);
  }

  body.app-mode .customer-stock-table .customer-stock-select-col {
    display: flex;
    width: 100%;
    min-height: 36px;
    justify-content: flex-end;
  }

  body.app-mode .customer-stock-table .customer-stock-select-col::before {
    margin-right: auto;
  }

  body.app-mode .customer-stock-table tbody tr.selected td:first-child {
    box-shadow: none;
  }

  body.app-mode .customer-stock-table tbody tr.selected {
    box-shadow: inset 3px 0 var(--enterprise-blue);
  }
}

/* M2.56：客户专属库存的复杂操作离开窄详情栏，进入独立工作区。 */
body.app-mode .customer-stock-operation-buttons,
body.app-mode .customer-stock-batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

body.app-mode .customer-stock-operation-buttons button,
body.app-mode .customer-stock-batch-actions button {
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid var(--enterprise-blue);
  border-radius: 6px;
  background: var(--enterprise-blue);
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

body.app-mode .customer-stock-operation-buttons button.secondary,
body.app-mode .customer-stock-batch-actions button.secondary {
  border-color: var(--enterprise-line);
  background: #ffffff;
  color: var(--enterprise-text);
}

body.app-mode .customer-stock-batch-actions {
  padding: 12px 16px;
}

body.app-mode .customer-stock-batch-actions .batch-clear {
  margin-left: auto;
  border-color: transparent;
  background: transparent;
  color: var(--enterprise-muted);
}

body.app-mode .customer-stock-batch-actions > small {
  flex-basis: 100%;
  color: var(--enterprise-danger);
  font-size: 12px;
}

body.app-mode .customer-stock-operation-workspace {
  display: grid;
  gap: 16px;
}

body.app-mode .customer-stock-operation-layout {
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

body.app-mode .customer-stock-operation-summary,
body.app-mode .customer-stock-operation-form-card {
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  background: #ffffff;
}

body.app-mode .customer-stock-operation-summary {
  display: grid;
  gap: 8px;
  padding: 20px;
}

body.app-mode .customer-stock-operation-summary > .customer-stock-status {
  justify-self: start;
}

body.app-mode .customer-stock-operation-summary h2,
body.app-mode .customer-stock-operation-summary p,
body.app-mode .customer-stock-operation-form-card > header h2,
body.app-mode .customer-stock-operation-form-card > header p {
  margin: 0;
}

body.app-mode .customer-stock-operation-summary h2 {
  margin-top: 8px;
  font-size: 22px;
}

body.app-mode .customer-stock-operation-summary > p,
body.app-mode .customer-stock-operation-form-card > header p {
  color: var(--enterprise-muted);
  font-size: 13px;
  line-height: 1.6;
}

body.app-mode .customer-stock-operation-summary .customer-stock-source {
  margin-top: 10px;
}

body.app-mode .customer-stock-operation-form-card {
  min-width: 0;
  padding: 22px;
}

body.app-mode .customer-stock-operation-form-card.full-width {
  width: auto;
}

body.app-mode .customer-stock-operation-form-card > header {
  display: grid;
  gap: 6px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--enterprise-line);
}

body.app-mode .customer-stock-operation-form-card > header h2,
body.app-mode .customer-stock-batch-shared-fields h2 {
  color: var(--enterprise-text);
  font-size: 18px;
}

body.app-mode .customer-stock-transfer-form,
body.app-mode .customer-stock-owner-batch-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.app-mode .customer-stock-impact {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
  border: 1px solid var(--enterprise-line);
  border-radius: 7px;
  overflow: hidden;
}

body.app-mode .customer-stock-impact > div {
  display: grid;
  gap: 5px;
  padding: 14px;
  border-right: 1px solid var(--enterprise-line);
}

body.app-mode .customer-stock-impact > div:last-child { border-right: 0; }
body.app-mode .customer-stock-impact span { color: var(--enterprise-muted); font-size: 11px; }
body.app-mode .customer-stock-impact strong { color: var(--enterprise-text); font-size: 13px; }

body.app-mode .customer-stock-batch-count {
  min-width: 70px;
  color: var(--enterprise-blue);
  font-size: 15px;
  font-weight: 800;
  text-align: right;
}

body.app-mode .customer-stock-batch-table {
  display: grid;
  margin-top: 16px;
  border: 1px solid var(--enterprise-line);
  border-radius: 8px;
  overflow: hidden;
}

body.app-mode .customer-stock-batch-row {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(180px, 1.5fr) minmax(100px, .8fr) 70px minmax(90px, .7fr) minmax(130px, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--enterprise-line);
}

body.app-mode .customer-stock-batch-row:last-child { border-bottom: 0; }
body.app-mode .customer-stock-batch-row.heading { background: #f8fafc; color: var(--enterprise-muted); font-size: 11px; font-weight: 700; }
body.app-mode .customer-stock-batch-row.disabled { background: #f8fafc; opacity: .7; }
body.app-mode .customer-stock-batch-row > div { min-width: 0; }
body.app-mode .customer-stock-batch-row > div strong,
body.app-mode .customer-stock-batch-row > div small { display: block; overflow: hidden; text-overflow: ellipsis; }
body.app-mode .customer-stock-batch-row > div small { margin-top: 4px; color: var(--enterprise-muted); white-space: nowrap; }
body.app-mode .customer-stock-batch-row input[type="number"],
body.app-mode .customer-stock-batch-row input[type="text"],
body.app-mode .customer-stock-batch-row label:not(.batch-include) input { width: 100%; box-sizing: border-box; }
body.app-mode .customer-stock-batch-row .batch-row-error { grid-column: 2 / -1; color: var(--enterprise-danger); }

body.app-mode .customer-stock-batch-shared-fields {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--enterprise-line);
}

body.app-mode .customer-stock-batch-shared-fields h2 { margin: 0 0 14px; }

body.app-mode .customer-stock-operation-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--enterprise-line);
}

body.app-mode .customer-stock-operation-footer button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid #1769e0;
  border-radius: 8px;
  background: #1769e0;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

body.app-mode .customer-stock-operation-footer button.secondary {
  border-color: var(--enterprise-line-strong);
  background: #fff;
  color: var(--enterprise-text);
}

@media (max-width: 980px) {
  body.app-mode .customer-stock-operation-layout { grid-template-columns: minmax(0, 1fr); }
  body.app-mode .customer-stock-batch-row {
    grid-template-columns: 34px minmax(160px, 1.4fr) minmax(90px, .8fr) 60px minmax(84px, .7fr) minmax(120px, 1fr);
    gap: 8px;
    padding-inline: 10px;
  }
}

@media (max-width: 720px) {
  body.app-mode .customer-stock-operation-form-card { padding: 16px; }
  body.app-mode .customer-stock-operation-header { grid-template-columns: 1fr; }
  body.app-mode .customer-stock-operation-header .customer-stock-batch-count { text-align: left; }
  body.app-mode .customer-stock-transfer-form,
  body.app-mode .customer-stock-owner-batch-form,
  body.app-mode .customer-stock-impact { grid-template-columns: 1fr; }
  body.app-mode .customer-stock-impact > div { border-right: 0; border-bottom: 1px solid var(--enterprise-line); }
  body.app-mode .customer-stock-impact > div:last-child { border-bottom: 0; }
  body.app-mode .customer-stock-batch-row.heading { display: none; }
  body.app-mode .customer-stock-batch-row {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
    padding: 14px;
  }
  body.app-mode .customer-stock-batch-row > *:not(.batch-include):not(input[type="hidden"]) { grid-column: 2; }
  body.app-mode .customer-stock-batch-row > strong::before,
  body.app-mode .customer-stock-batch-row > label:not(.batch-include)::before {
    display: block;
    margin-bottom: 4px;
    color: var(--enterprise-muted);
    font-size: 10px;
    font-weight: 600;
  }
  body.app-mode .customer-stock-batch-row > strong:nth-of-type(1)::before { content: "专属库位"; }
  body.app-mode .customer-stock-batch-row > strong:nth-of-type(2)::before { content: "可用数量"; }
  body.app-mode .customer-stock-batch-row > label:nth-of-type(2)::before { content: "划拨数量"; }
  body.app-mode .customer-stock-batch-row > label:nth-of-type(3)::before { content: "目标大货库位"; }
  body.app-mode .customer-stock-batch-actions .batch-clear { margin-left: 0; }
  body.app-mode .customer-stock-operation-footer { flex-direction: column-reverse; }
  body.app-mode .customer-stock-operation-footer button { width: 100%; }
}
