:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #dce3ef;
  --text: #1f2937;
  --muted: #697386;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #b42318;
  --warn: #b7791f;
  --shadow: 0 16px 40px rgba(24, 39, 75, .08);
  --order-color-normal: #ffffff;
  --order-color-cancel-pending: #fff1f0;
  --order-color-closed: #f1f3f5;
  --order-color-change-pending: #fff8e6;
  --order-color-contract-locked: #fff7ed;
  --order-color-active: #dbeafe;
  --order-color-duplicate: #fef3c7;
  --procurement-color-confirmed: #92d050;
  --procurement-color-cancel-pending: #fee2e2;
  --order-query-fixed-head-height: 0px;
  --procurement-fixed-head-height: 0px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

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

button {
  border: 0;
  cursor: pointer;
}

.small-btn,
.icon-btn {
  min-height: 24px;
  padding: 3px 7px;
  line-height: 1;
}

.icon-btn {
  width: 24px;
  min-width: 24px;
  padding: 0;
  text-align: center;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }

.environment-banner {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 2147483646;
  min-height: 36px;
  padding: 8px 16px;
  background: #b54708;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .04em;
  text-align: center;
  box-shadow: 0 2px 10px rgba(91, 33, 0, .28);
}

html[data-app-environment="test"] body {
  padding-top: 36px;
}

#systemWatermark {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  grid-auto-rows: 132px;
  gap: 16px 34px;
  align-content: start;
  overflow: hidden;
  padding: 20px;
  color: rgba(55, 65, 81, .08);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.watermark-tile {
  align-self: center;
  justify-self: center;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
  transform: rotate(-24deg);
  white-space: nowrap;
}

@media (max-width: 640px) {
  #systemWatermark {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    grid-auto-rows: 116px;
    gap: 10px 18px;
    padding: 12px;
  }
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(15,118,110,.15), transparent 42%),
    linear-gradient(300deg, rgba(37,99,235,.12), transparent 48%),
    var(--bg);
}

.boot-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.boot-panel {
  display: grid;
  justify-items: center;
  gap: 12px;
  color: var(--muted);
}

.boot-panel strong {
  color: var(--text);
  font-size: 18px;
}

.boot-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: boot-spin .8s linear infinite;
}

@keyframes boot-spin {
  to { transform: rotate(360deg); }
}

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

.login-panel h1 { margin: 0 0 8px; font-size: 26px; }
.login-panel p { margin: 0 0 24px; color: var(--muted); }

.login-captcha-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: center;
}

.login-captcha-image {
  width: 100%;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  object-fit: cover;
}

.login-captcha-refresh {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
}

.sidebar {
  background: #102027;
  color: #e9f3f3;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 0;
  min-height: 34px;
  height: auto;
  z-index: 30;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.brand strong { display: block; font-size: 14px; white-space: nowrap; }

.account-menu-shell {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: auto;
  min-width: 0;
}

.account-menu-trigger {
  min-width: 0;
  min-height: 24px;
  padding: 3px 6px;
  color: #a8c7c4;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.1;
  white-space: nowrap;
  text-align: right;
}

.account-menu-trigger:not(:disabled):hover,
.account-menu-trigger:not(:disabled)[aria-expanded="true"] {
  color: #fff;
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.18);
}

.account-menu-trigger:disabled {
  cursor: default;
  opacity: 1;
}

.account-menu {
  position: absolute;
  z-index: 1600;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  min-width: 148px;
  padding: 4px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.account-menu button {
  width: 100%;
  padding: 8px 10px;
  color: var(--text);
  background: transparent;
  border: 0;
  text-align: left;
  white-space: nowrap;
}

.account-menu button:hover,
.account-menu button:focus-visible {
  background: #e7f5f3;
}

.account-menu button:disabled {
  color: var(--muted);
  background: transparent;
  cursor: not-allowed;
  opacity: .7;
}

nav {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  overflow: visible;
  scrollbar-width: thin;
  flex: 1 1 auto;
}

nav button {
  text-align: center;
  padding: 4px 8px;
  color: #d9e8e6;
  background: transparent;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.1;
  min-height: 24px;
  white-space: nowrap;
  flex: 0 0 auto;
}

nav button.active, nav button:hover {
  background: rgba(255,255,255,.12);
}

/* 顶部一级菜单统一承载页面入口，二级菜单悬停、聚焦或移动端点击后展开。 */
.nav-item,
.nav-group-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.nav-group {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.nav-group-trigger {
  border: 1px solid transparent;
}

.nav-group.active > .nav-group-trigger,
.nav-group-trigger[aria-expanded="true"] {
  background: rgba(255,255,255,.12);
}

.nav-group-caret {
  font-size: 11px;
  line-height: 1;
  opacity: .78;
  transform: translateY(-1px);
}

.nav-submenu {
  position: absolute;
  z-index: 1600;
  top: calc(100% + 5px);
  left: 0;
  display: grid;
  min-width: 178px;
  padding: 5px;
  border: 1px solid rgba(148, 163, 184, .42);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
}

.nav-group:hover > .nav-submenu,
.nav-group.open > .nav-submenu,
.nav-group:focus-within > .nav-submenu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.nav-submenu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 31px;
  padding: 6px 9px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 5px;
  text-align: left;
  white-space: nowrap;
}

.nav-submenu-item:hover,
.nav-submenu-item:focus-visible,
.nav-submenu-item.active {
  color: #075985;
  background: #eef6ff;
}

.nav-submenu-item:disabled {
  color: #94a3b8;
  cursor: not-allowed;
  opacity: .72;
}

.nav-submenu-count {
  min-width: 24px;
  padding: 1px 5px;
  border-radius: 999px;
  color: #475569;
  background: #e5e7eb;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
}

.nav-submenu-item.active .nav-submenu-count {
  color: #fff;
  background: #0f6fb7;
}

.nav-submenu-divider {
  height: 1px;
  margin: 4px 3px;
  background: #e2e8f0;
}

.main {
  min-width: 0;
  padding: 10px 12px 14px;
}

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

.topbar h2 { margin: 0 0 2px; font-size: 20px; }
.topbar p { margin: 0; color: var(--muted); font-size: 12px; }

.topbar[data-page="procurementCost"] > div {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.topbar[data-page="procurementCost"] h2 {
  flex: 0 0 auto;
}

.topbar[data-page="procurementCost"] p {
  line-height: 1.4;
}

.panel, .table-card, .stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(24, 39, 75, .04);
}

.panel { padding: 16px; }
.panel h3 { margin: 0 0 14px; }

.primary {
  background: var(--primary);
  color: white;
  padding: 10px 14px;
  border-radius: 6px;
}
.primary:hover { background: var(--primary-dark); }
.accent-btn {
  background: #2563eb;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .18);
}
.accent-btn:hover { background: #1d4ed8; }
.ghost {
  background: rgba(255,255,255,.12);
  color: inherit;
  border: 1px solid rgba(255,255,255,.18);
  padding: 10px 12px;
  border-radius: 6px;
}
.main .ghost {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
}

.stack { display: grid; gap: 14px; }

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #344054;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  background: white;
  color: var(--text);
}

textarea { resize: vertical; }

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

.order-form-sheet {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
  overflow: visible;
}
.order-form-sheet > label,
.order-form-sheet > .form-actions,
.order-form-sheet > .smart-input-block {
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
}
.order-form-sheet > label {
  min-height: auto;
  justify-content: stretch;
  align-content: start;
}
.order-form-sheet input,
.order-form-sheet select,
.order-form-sheet textarea {
  min-height: 42px;
}
.order-form-sheet textarea {
  min-height: 154px;
}
.sheet-sale-date { grid-column: 1; grid-row: 1; }
.sheet-original { grid-column: 2; grid-row: 1; }
.sheet-handler { grid-column: 3; grid-row: 1; }
.sheet-smart { grid-column: 4 / span 2; grid-row: 1 / span 2; }
.sheet-receiver { grid-column: 1; grid-row: 2; }
.sheet-phone { grid-column: 2; grid-row: 2; }
.sheet-address { grid-column: 3; grid-row: 2; }
.sheet-model { grid-column: 1 / span 2; grid-row: 3; }
.sheet-quantity { grid-column: 3; grid-row: 3; }
.sheet-price { grid-column: 4; grid-row: 3; }
.sheet-total { grid-column: 5; grid-row: 3; }
.sheet-bottom {
  grid-column: 1 / -1;
  grid-row: 4;
}

.intake-form {
  grid-template-columns: minmax(340px, .48fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 14px 18px;
  background: #fff;
  border-color: #cdd9ea;
  box-shadow: 0 12px 28px rgba(24, 39, 75, .06);
}

.intake-left {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  align-self: stretch;
  padding-bottom: 46px;
  box-sizing: border-box;
}

.intake-fields {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  grid-auto-rows: minmax(64px, auto);
  gap: 12px;
  align-content: start;
}

.intake-fields label {
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
}

.intake-form .sheet-smart {
  grid-column: 2;
  grid-row: 1;
  min-height: 100%;
}

.smart-input-block {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  align-content: stretch;
  min-width: 0;
}

.smart-meta-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  min-width: 0;
}

.smart-customer-field,
.smart-tax-field {
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
}

.smart-customer-field input,
.smart-tax-field select {
  width: 100%;
}

.smart-input-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
}

.smart-clear-btn {
  min-width: 88px;
  height: 36px;
  padding: 0 14px;
}

.smart-input-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.parse-batch-inline {
  min-width: 150px;
  height: 38px;
  padding: 0 16px;
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
  box-shadow: 0 8px 18px rgba(29, 78, 216, .18);
}

.parse-batch-inline:hover {
  background: #1e40af;
  border-color: #1e40af;
}

.intake-form .sheet-smart textarea {
  min-height: 0;
  height: 100%;
  line-height: 1.5;
  border-color: #bfd0e6;
  background: #fafdff;
}

.manual-model-memory-panel {
  margin: 0;
  padding: 12px;
  border: 1px solid #dbe5f3;
  border-radius: 8px;
  background: #f8fbff;
  flex: 1 1 auto;
  align-self: stretch;
  display: grid;
  align-content: start;
}

.manual-memory-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}

.manual-memory-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.manual-memory-row label {
  gap: 4px;
  min-width: 0;
}

.manual-memory-row input {
  min-height: 34px;
  padding: 7px 9px;
}

.manual-memory-row button {
  grid-column: 1 / -1;
  justify-self: end;
  height: 34px;
  padding: 0 12px;
  white-space: nowrap;
}

.intake-form .sheet-bottom {
  grid-column: 1;
  grid-row: 2;
  align-self: end;
}

.intake-actions {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(96px, .55fr);
  gap: 10px;
  align-items: stretch;
}

.intake-actions button {
  min-width: 0;
  height: 42px;
}

.wide { grid-column: span 2; }
.full { grid-column: 1 / -1; }
.address-field { grid-column: span 2; }
.model-field { grid-column: span 1; }
.form-actions {
  display: block;
}
.submit-detail-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(130px, 1fr) minmax(112px, .8fr) minmax(145px, 1fr) minmax(145px, 1fr) minmax(145px, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.submit-detail-row label {
  min-width: 0;
}
.submit-detail-row input,
.submit-detail-row select {
  min-height: 42px;
}
.customer-submit-field {
  width: 100%;
}
.action-buttons {
  display: grid;
  grid-template-columns: auto auto;
  gap: 10px;
  align-items: end;
}
.action-buttons button {
  min-width: 92px;
  height: 42px;
}

.autocomplete-field {
  position: relative;
}

.suggestions {
  position: absolute;
  z-index: 1200;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 260px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.floating-suggestions {
  position: fixed;
  z-index: 1000;
  max-height: 260px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, .28);
  padding: 18px;
  overflow: auto;
}

#confirmModal {
  z-index: 3200;
}

.workbench-notice-modal {
  z-index: 3400;
  background: rgba(15, 23, 42, .34);
}

.workbench-notice-card {
  width: min(560px, calc(100vw - 36px));
}

.workbench-notice-message {
  margin: 0;
  max-height: min(46vh, 360px);
  overflow: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.modal-card {
  width: min(760px, 100%);
  max-width: calc(100vw - 36px);
  max-height: calc(100vh - 36px);
  box-sizing: border-box;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

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

/* 弹窗内容滚动时固定标题栏，保证标题和关闭按钮始终可操作。 */
.modal-card > .modal-head {
  position: sticky;
  top: -1px;
  z-index: 10;
  padding-bottom: 10px;
  background: #fff;
}

.modal-close-btn {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.modal-close-btn:hover {
  background: #eef2f7;
  color: var(--text);
}

.modal-card h3 {
  margin: 0 0 8px;
}

.modal-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.duplicate-sku-import-list {
  display: grid;
  gap: 10px;
  max-height: min(46vh, 420px);
  overflow: auto;
  margin-top: 12px;
}

.duplicate-sku-import-group {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.duplicate-sku-import-item {
  align-items: flex-start;
  color: var(--text);
}

.contract-modal {
  width: min(980px, 100%);
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.contract-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
  min-height: 0;
  flex: 1 1 auto;
}

.contract-form-scroll {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

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

.contract-form-grid .wide {
  grid-column: span 2;
}

.contract-save-profile {
  display: flex;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
}

.contract-save-profile input {
  width: auto;
}

.contract-selected-summary,
.contract-summary-card {
  display: grid;
  gap: 4px;
}

.contract-manual-items {
  margin: 10px 0;
}

.contract-manual-items .section-head {
  margin-bottom: 6px;
}

.contract-manual-items .compact-table {
  min-width: 760px;
}

.contract-manual-items input {
  min-width: 0;
  width: 100%;
  height: 30px;
}

.contract-manual-items .manual-item-remove {
  min-width: 30px;
  padding: 4px 7px;
}

.contract-summary-card {
  padding: 10px 12px;
  border: 1px solid #d8e8e5;
  border-radius: 6px;
  background: #f2fbf9;
  font-size: 13px;
}

.contract-preview-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.contract-preview-tools button {
  min-height: 30px;
  padding: 5px 10px;
}

.contract-preview-actions {
  margin: 0 0 10px;
}

.contract-preview-action-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
}

.contract-download-drawer {
  position: relative;
  flex: 0 0 auto;
}

.contract-download-drawer summary {
  list-style: none;
  min-height: 30px;
  padding: 5px 12px;
  border: 1px solid #0f766e;
  border-radius: 6px;
  background: #0f766e;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.contract-download-drawer summary::-webkit-details-marker {
  display: none;
}

.contract-download-drawer summary::after {
  content: "▾";
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  opacity: .9;
}

.contract-download-drawer[open] summary::after {
  transform: rotate(180deg);
}

.contract-download-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  min-width: 178px;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(15, 23, 42, .14);
}

.contract-download-panel .small-btn {
  min-height: 28px;
  padding: 5px 8px;
  text-align: left;
  justify-content: flex-start;
  color: #1f2937;
  background: #fff;
}

.contract-download-panel .small-btn:hover {
  background: #f1f5f9;
}

.contract-download-panel .small-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.contract-preview-action-row .muted {
  margin-left: auto;
  font-size: 12px;
}

.contract-preview-box {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  padding: 10px;
  box-sizing: border-box;
}

.contract-preview-box.large {
  max-height: min(76vh, 780px);
}

.contract-file-preview {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 420px;
  background: #fff;
}

.contract-stamp-surface {
  position: relative;
}

.contract-stamp-image-sheet {
  display: inline-block;
  line-height: 0;
  max-width: 100%;
}

.contract-stamp-image-sheet img {
  display: block;
  max-width: 100%;
  height: auto;
}

.contract-page-placeholder {
  display: grid;
  place-items: center;
  gap: 6px;
  width: min(760px, 72vw);
  min-height: 360px;
  padding: 18px;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  color: #475569;
  line-height: 1.4;
  text-align: center;
}

.contract-page-placeholder strong {
  color: #0f172a;
}

.contract-file-pages {
  display: grid;
  gap: 14px;
}

.stamp-page-active {
  outline: 2px solid #93c5fd;
  outline-offset: 3px;
}

.contract-stamp-pdf-preview {
  display: block;
}

.contract-draggable-stamp {
  position: absolute;
  z-index: 5;
  width: clamp(58px, 13%, 108px);
  height: auto;
  transform: translate(-50%, -50%);
  cursor: grab;
  user-select: none;
  touch-action: none;
  filter: drop-shadow(0 2px 3px rgba(15, 23, 42, .25));
}

.contract-draggable-stamp:active {
  cursor: grabbing;
}

.contract-draggable-stamp.confirmed {
  outline: 2px solid #16a34a;
  outline-offset: 2px;
  cursor: default;
}

.contract-draggable-stamp.cross-seal-preview {
  width: clamp(64px, 12%, 108px);
  height: clamp(12px, 2.5vw, 34px);
  transform: translate(-100%, -50%);
  background-repeat: no-repeat;
  background-color: transparent;
  background-origin: border-box;
  border: 0;
}

.paste-box {
  min-height: 88px;
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px dashed var(--line);
  background: #f8fafc;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
}

.paste-box:focus {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
  border-color: #60a5fa;
}

.contract-file-preview img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
}

.contract-file-frame {
  width: 100%;
  height: min(72vh, 760px);
  border: 1px solid var(--line);
  background: #fff;
}

.contract-preview-modal {
  width: min(980px, 96vw);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.contract-preview-modal .contract-preview-box.large {
  flex: 1 1 auto;
  min-height: 0;
}

.contract-items-edit-modal {
  width: min(980px, 96vw);
}

.contract-items-edit-table {
  min-width: 820px;
}

.contract-items-edit-table th,
.contract-items-edit-table td {
  white-space: nowrap;
}

.contract-items-edit-table input {
  width: 100%;
  min-width: 72px;
}

.contract-items-edit-table th:nth-child(1),
.contract-items-edit-table td:nth-child(1) {
  min-width: 210px;
}

.contract-items-edit-table th:nth-child(2),
.contract-items-edit-table td:nth-child(2) {
  min-width: 170px;
}

.contract-items-edit-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.contract-image-editor-modal {
  width: min(940px, 96vw);
}

.image-editor-stage {
  display: grid;
  place-items: center;
  min-height: 280px;
  margin: 12px 0;
  padding: 10px;
  overflow: auto;
  background: #f1f5f9;
  border: 1px solid #dbe3ee;
  border-radius: 6px;
}

.image-editor-stage canvas {
  max-width: 100%;
  max-height: 58vh;
  touch-action: none;
  background: #fff;
}

.image-editor-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.image-editor-controls label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
}

.contract-preview-doc {
  width: 100%;
  max-width: 794px;
  margin: 0 auto;
  padding: 20px 22px;
  background: #fff;
  border: 1px solid #e5e7eb;
  box-sizing: border-box;
  color: #111827;
  font-family: "SimSun", "Microsoft YaHei", Arial, sans-serif;
  font-size: 12px;
  line-height: 1.58;
}

.contract-preview-doc h1 {
  text-align: center;
  margin: 0 0 12px;
  font-size: 24px;
  letter-spacing: 2px;
}

.contract-preview-doc h2 {
  margin: 12px 0 6px;
  font-size: 15px;
}

.contract-preview-doc .contract-receipt-title {
  text-align: center;
}

.batch-table .batch-derived-field {
  background: #f8fafc;
  color: #334155;
  cursor: default;
}

.contract-party-info {
  margin: 10px 0 14px;
}

.contract-party-info td {
  width: 50%;
  vertical-align: top;
}

.contract-party-info p,
.contract-preview-terms p {
  margin: 4px 0;
}

.contract-preview-page-break {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.contract-preview-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.contract-preview-doc table {
  width: 100%;
  max-width: 100%;
  min-width: 0 !important;
  table-layout: fixed;
  border-collapse: collapse;
  margin: 8px 0 10px;
}

.contract-preview-doc .contract-items col:nth-child(1) { width: 8%; }
.contract-preview-doc .contract-items col:nth-child(2) { width: 21%; }
.contract-preview-doc .contract-items col:nth-child(3) { width: 21%; }
.contract-preview-doc .contract-items col:nth-child(4) { width: 9%; }
.contract-preview-doc .contract-items col:nth-child(5) { width: 8%; }
.contract-preview-doc .contract-items col:nth-child(6) { width: 13%; }
.contract-preview-doc .contract-items col:nth-child(7) { width: 14%; }
.contract-preview-doc .contract-items col:nth-child(8) { width: 6%; }

.contract-preview-doc .contract-shipping {
  width: 92%;
  margin-left: auto;
  margin-right: auto;
}

.contract-preview-doc .contract-shipping col:nth-child(1) { width: 7%; }
.contract-preview-doc .contract-shipping col:nth-child(2) { width: 12%; }
.contract-preview-doc .contract-shipping col:nth-child(3) { width: 17%; }
.contract-preview-doc .contract-shipping col:nth-child(4) { width: 34%; }
.contract-preview-doc .contract-shipping col:nth-child(5) { width: 8%; }
.contract-preview-doc .contract-shipping col:nth-child(6) { width: 9%; }
.contract-preview-doc .contract-shipping col:nth-child(7) { width: 13%; }

.contract-preview-doc th,
.contract-preview-doc td {
  border: 1px solid #374151;
  padding: 4px 5px;
  text-align: center;
  vertical-align: middle;
  word-break: normal;
  overflow-wrap: break-word;
  white-space: normal;
  line-height: 1.45;
}

.contract-preview-doc th {
  background: #f1f5f9;
}

.contract-preview-doc .left {
  text-align: left;
}

.contract-preview-doc .contract-sign td {
  text-align: left !important;
  vertical-align: top;
  padding: 10px 14px;
}

.contract-preview-doc .receipt-confirm-row td {
  height: 34px;
}

.contract-preview-doc .seq-cell,
.contract-preview-doc .receiver-cell,
.contract-preview-doc .phone-cell,
.contract-preview-doc .qty-cell,
.contract-preview-doc .logistics-cell,
.contract-preview-doc .tracking-cell {
  word-break: keep-all;
  overflow-wrap: normal;
}

#confirmMessage {
  white-space: normal;
  overflow: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-height: min(46vh, 360px);
  padding-bottom: 4px;
}

#confirmModal .modal-card {
  width: min(560px, calc(100vw - 36px));
}

#confirmModal.wide-confirm .modal-card {
  width: min(1120px, calc(100vw - 36px));
}

#confirmModal.wide-confirm #confirmMessage {
  max-height: min(68vh, 680px);
}

.confirm-line {
  display: block;
  white-space: normal;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  background: #fff;
  flex: 0 0 auto;
}

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

.suggestion-item > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-standard-suggestions .suggestion-item {
  align-items: center;
}

.manual-standard-suggestions {
  right: auto;
  width: min(860px, calc(100vw - 36px));
  max-width: calc(100vw - 36px);
  overflow-x: auto;
}

.manual-standard-suggestions .suggestion-item {
  width: max-content;
  min-width: 100%;
}

.manual-standard-suggestions .suggestion-item > span:first-child {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  overflow-wrap: normal;
  line-height: 1.4;
}

.suggestion-item:hover,
.suggestion-item.active {
  background: #e7f5f3;
}

.suggestion-price {
  flex: 0 0 auto;
  color: var(--primary);
  font-weight: 700;
  white-space: nowrap;
}

.import-box {
  margin: 12px 0 18px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.import-box h4,
.import-box p {
  margin: 0;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr 180px auto;
  gap: 12px;
  margin-bottom: 12px;
}

.order-filter-toolbar {
  grid-template-columns: 130px minmax(120px, .8fr) minmax(150px, 1fr) 118px minmax(210px, 1.4fr) auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.suggestion-item small {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.order-filter-toolbar input,
.order-filter-toolbar select {
  min-height: 32px;
  padding: 6px 9px;
}

.batch-panel,
.order-workbench-table {
  margin-top: 16px;
}

.batch-panel {
  background: #fff;
}

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

.section-head h3,
.section-head p {
  margin: 0;
}

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

.batch-command-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #fbfcff;
  overflow-x: auto;
  scrollbar-width: thin;
}

.batch-submit-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.batch-submit-tools .primary {
  min-width: 150px;
  height: 34px;
  padding: 0 14px;
}

.batch-submit-tools .muted {
  font-size: 12px;
  white-space: nowrap;
}

.batch-bulk-tools {
  display: grid;
  grid-template-columns: 150px minmax(150px, 220px) repeat(4, max-content);
  gap: 6px;
  align-items: center;
  justify-content: start;
  margin-top: 0;
  min-width: 0;
  max-width: 100%;
}

.batch-bulk-tools input,
.batch-bulk-tools select {
  width: 100%;
  min-height: 34px;
  padding-top: 7px;
  padding-bottom: 7px;
}

.batch-bulk-tools button {
  min-height: 34px;
  padding: 0 10px;
  white-space: nowrap;
}

.quote-import-tools {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.quote-toolbar {
  grid-template-columns: minmax(260px, 1fr) minmax(140px, 180px) auto auto;
  gap: 8px;
  align-items: center;
}

.quote-manage-mode .quote-card {
  border-color: rgba(15, 118, 110, 0.28);
  box-shadow: 0 0 0 1px rgba(15, 118, 110, 0.08) inset;
}

.contract-table-wrap {
  max-height: calc(100vh - 210px);
}

.contract-menu-bar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.contract-menu-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.contract-menu-tabs button {
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #374151;
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.contract-menu-tabs button.active {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.contract-menu-tabs span {
  margin-left: 5px;
  font-weight: 700;
}

.contract-menu-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.contract-table th,
.contract-table td {
  font-size: 12px;
}

.contract-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  white-space: nowrap;
}

.contract-order-detail-modal .mini-table th,
.contract-order-detail-modal .mini-table td {
  font-size: 12px;
  white-space: nowrap;
}

.contract-actions button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.contract-template-panel {
  margin-top: 12px;
}

.contract-template-workbench {
  display: grid;
  grid-template-columns: minmax(320px, .82fr) minmax(0, 1.18fr);
  gap: 14px;
  align-items: start;
}

.contract-template-single-workbench {
  display: block;
}

.contract-template-editor-pane,
.contract-template-preview-pane {
  min-width: 0;
}

.contract-template-fields {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.contract-template-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 7px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: #f8fafc;
}

.contract-template-toolbar select,
.contract-template-toolbar button {
  min-height: 28px;
  padding: 4px 8px;
}

.contract-template-toolbar button {
  min-width: 30px;
}

.contract-template-rich-editor {
  min-height: 330px;
  max-height: 58vh;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 0 0 6px 6px;
  outline: none;
  background: #fff;
  color: #1f2937;
  font-family: "SimSun", "Microsoft YaHei", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.65;
}

.contract-template-rich-editor:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, .12);
}

.contract-template-rich-editor:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
}

.contract-template-rich-editor h2,
.contract-template-rich-editor h3,
.contract-template-rich-editor p {
  margin: 5px 0;
}

.contract-template-rich-editor ul,
.contract-template-rich-editor ol {
  margin: 5px 0;
  padding-left: 24px;
}

.contract-template-editor-help {
  margin: 7px 0 0;
  font-size: 12px;
}

.contract-template-preview-pane {
  border-left: 1px solid var(--line);
  padding-left: 14px;
}

.contract-template-single-pane {
  border-left: 0;
  padding-left: 0;
}

.contract-template-detail-fields {
  margin-bottom: 10px;
}

.contract-template-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.contract-template-preview-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.contract-template-preview-actions {
  flex-wrap: wrap;
  gap: 6px;
}

.contract-template-detail-toolbar {
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.contract-template-detail-editor {
  min-height: 120px;
  padding: 10px;
  border: 1px dashed #0f766e;
  border-radius: 6px;
  outline: none;
  background: #f0fdfa;
  cursor: text;
}

.contract-template-detail-editor:focus {
  border-style: solid;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, .14);
}

.contract-template-preview-box {
  max-height: min(70vh, 760px);
  min-height: 420px;
}

@media (max-width: 1100px) {
  .contract-template-workbench {
    grid-template-columns: 1fr;
  }

  .contract-template-preview-pane {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding-top: 14px;
    padding-left: 0;
  }
}

.contract-upload-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
}

.contract-upload-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.contract-upload-btn.disabled {
  opacity: .55;
  pointer-events: none;
}

.contract-stamp-panel {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
}

.stamp-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 30px;
}

.stamp-row select,
.stamp-row input[type="number"] {
  min-height: 28px;
  padding: 3px 7px;
  font-size: 12px;
}

.stamp-seal-choice {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  font-size: 12px;
  white-space: nowrap;
}

.stamp-row-secondary {
  font-size: 12px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  white-space: nowrap;
}

.stamp-page-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  white-space: nowrap;
}

.stamp-page-count input {
  width: 64px;
}

.stamp-page-list {
  display: grid;
  gap: 4px;
}

.stamp-page-float-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  background: #f8fbff;
}

.stamp-page-float-list .stamp-page-item {
  display: block;
  padding: 5px 8px;
  cursor: grab;
  user-select: none;
  border-color: #bfdbfe;
  background: #fff;
}

.stamp-page-float-list .stamp-page-item.dragging {
  opacity: .45;
}

.stamp-reject-box {
  display: inline-flex;
  padding: 3px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fff7f7;
}

.stamp-page-item {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto auto auto;
  gap: 6px;
  align-items: center;
  padding: 5px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
}

.stamp-page-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tiny-btn {
  min-height: 24px;
  padding: 2px 6px;
  font-size: 12px;
}

.seal-usage-table th,
.seal-usage-table td {
  white-space: nowrap;
}

.contract-detail-row td {
  background: #f8fafc;
}

.contract-table tr.contract-completed-row > td,
.contract-detail-row.contract-completed-row td {
  background: #ecfdf5;
}

.contract-table tr.contract-void-row > td,
.contract-detail-row.contract-void-row td {
  background: #f8fafc;
  color: var(--muted);
  text-decoration: line-through;
}

.order-query-table tr.contract-locked-order-row > td {
  background: var(--order-color-contract-locked);
}

.order-query-table tr.contract-locked-order-row .order-row-check {
  cursor: not-allowed;
  opacity: 0.45;
}

.order-query-table tr.contract-locked-order-row .select-col {
  color: var(--muted);
}

.contract-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: var(--muted);
  font-size: 12px;
  white-space: normal;
}

.remaining-warn {
  color: var(--danger);
  font-weight: 700;
}

.contract-invoice-details {
  margin: 10px 0 4px;
}

.contract-invoice-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.contract-invoice-complete {
  padding: 10px 12px;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  background: #ecfdf5;
  color: #166534;
}

.mini-table-wrap {
  max-height: 220px;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.mini-table th,
.mini-table td {
  border: 1px solid var(--line);
  padding: 5px 6px;
  text-align: left;
}

.mini-table th {
  background: #f8fafc;
}

.finance-section {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.finance-drawer {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  margin-bottom: 10px;
  overflow: hidden;
}

.finance-drawer summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 10px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  color: #0f172a;
  background: #f8fafc;
  border-bottom: 1px solid transparent;
}

.finance-drawer summary::-webkit-details-marker {
  display: none;
}

.finance-drawer summary::before {
  content: ">";
  color: #64748b;
  transition: transform .15s ease;
}

.finance-drawer[open] summary {
  border-bottom-color: #e2e8f0;
}

.finance-drawer[open] summary::before {
  transform: rotate(90deg);
}

.finance-drawer summary small {
  margin-left: auto;
  color: #64748b;
  font-size: 12px;
  font-weight: 400;
}

.finance-drawer-body {
  padding: 8px 10px 10px;
}

.finance-filter-toolbar {
  display: flex;
  align-items: stretch;
  margin: 0 0 10px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 3px;
  scrollbar-gutter: stable;
}

.finance-filter-toolbar input,
.finance-filter-toolbar select {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
}

.finance-filter-toolbar-inline .finance-filter-fields {
  flex: 0 0 auto;
  width: max-content;
  min-width: max-content;
}

.finance-filter-fields {
  grid-template-columns: 116px 132px 132px 210px 112px 112px 136px 132px 80px 132px 124px 124px 112px 72px;
  gap: 4px;
  align-items: stretch;
}

.finance-filter-fields input,
.finance-filter-fields select,
.finance-filter-fields button {
  height: 32px;
  white-space: nowrap;
}

.finance-filter-fields #financeKeywordFilter,
.finance-filter-fields #financeTrackingFilter {
  grid-column: auto;
}

.finance-layout {
  display: block;
}

.finance-confirm-panel {
  position: sticky;
  top: 10px;
}

.finance-side-drawer {
  grid-column: 2;
}

.finance-side-drawer .finance-confirm-panel {
  position: static;
  top: auto;
}

.finance-side-drawer > form,
.finance-side-drawer > .stack {
  padding: 10px;
}

#financeList {
  min-width: 0;
}

.finance-embedded-card .finance-confirm-panel {
  position: static;
  top: auto;
}

#financeList .workspace-menu-shell {
  display: grid;
  grid-template-columns: 132px 210px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-top: 0;
}

#financeList .finance-menu-shell {
  grid-template-columns: 132px 210px minmax(0, 1fr);
}

#financeList .workspace-menu {
  position: sticky;
  top: 10px;
  max-height: calc(100vh - 28px);
  max-height: calc(100dvh - 28px);
  overflow: auto;
  padding: 8px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fff;
}

#financeList .finance-suite-groups,
#financeList .finance-suite-branches {
  display: grid;
  gap: 4px;
}

#financeList .finance-suite-groups {
  padding: 6px;
}

.finance-suite-title {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 4px 7px;
  background: #fff;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 6px;
}

#financeList .finance-suite-group-button,
#financeList .finance-suite-item {
  width: 100%;
  min-height: 28px;
  justify-content: space-between;
  padding: 5px 6px;
  font-size: 12px;
  line-height: 1.25;
  text-align: left;
}

#financeList .finance-suite-group-button {
  min-height: 34px;
  font-size: 13px;
  font-weight: 700;
}

#financeList .finance-suite-branches {
  padding: 8px;
}

#financeList .finance-suite-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#financeList .workspace-menu .master-menu-title {
  padding: 4px 6px 8px;
  font-size: 13px;
  color: #334155;
}

#financeList .workspace-menu .master-menu-item {
  min-height: 30px;
  padding: 6px 7px;
  border-radius: 6px;
  font-size: 12px;
}

#financeList .workspace-menu .master-menu-item strong {
  min-width: 24px;
  padding: 1px 5px;
  font-size: 11px;
  text-align: center;
}

#financeList .workspace-menu-content {
  min-width: 0;
}

.finance-workspace-panel {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.finance-current-toolbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 6px 8px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
}

.finance-current-title {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.finance-current-title strong {
  font-size: 15px;
  color: #0f172a;
  white-space: nowrap;
}

.finance-current-title span {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}

.finance-current-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.finance-aging-settings {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 8px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.finance-content-stack {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.purchase-template-panel {
  position: static;
}

.finance-embedded-card {
  width: 100%;
  max-width: none;
}

.finance-embedded-card .finance-confirm-panel,
.purchase-template-panel .finance-confirm-panel {
  width: 100%;
  max-width: none;
}

.finance-confirm-panel h3 {
  margin: 0;
  font-size: 15px;
}

.purchase-template-panel textarea {
  min-height: 150px;
  font-size: 12px;
  line-height: 1.45;
}

.purchase-template-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.finance-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 8px;
  margin-bottom: 0;
}

.finance-return-stat strong,
.finance-negative {
  color: #b42318;
  font-weight: 700;
}

.section-head.compact {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0;
}

.section-head.compact h3 {
  margin: 0;
  font-size: 15px;
}

.finance-summary-wrap,
.finance-order-wrap,
.finance-purchase-wrap,
.finance-freight-wrap {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

.finance-summary-table,
.finance-order-table,
.finance-purchase-table,
.finance-freight-table {
  min-width: 980px;
}

.finance-summary-table th,
.finance-summary-table td,
.finance-order-table th,
.finance-order-table td,
.finance-purchase-table th,
.finance-purchase-table td,
.finance-freight-table th,
.finance-freight-table td {
  white-space: nowrap;
}

.finance-summary-table th:nth-child(2),
.finance-summary-table td:nth-child(2),
.finance-summary-table th:nth-child(3),
.finance-summary-table td:nth-child(3),
.finance-order-table th:nth-child(4),
.finance-order-table td:nth-child(4) {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.finance-pending-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.finance-order-table th:first-child,
.finance-order-table td:first-child {
  width: 34px;
  text-align: center;
}

.finance-order-receiver-cell,
.finance-order-product-cell,
.finance-order-model-cell {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.finance-order-receiver-cell strong,
.finance-order-receiver-cell span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.finance-order-receiver-cell span {
  margin-top: 2px;
  color: #64748b;
  font-size: 12px;
}

.finance-order-table tr.finance-order-selected td {
  background: #eaf5ee;
  box-shadow: inset 0 1px #7eb590, inset 0 -1px #7eb590;
}

#ordersTable tr.order-row-checkbox-selected > td,
#procurementList tr.procurement-row-checkbox-selected > td,
#financeList tr.finance-row-checkbox-selected > td,
#dailyBillingCustomers tr.daily-bill-row-checkbox-selected > td,
#invoiceInventoryMovements tr.invoice-inventory-row-checkbox-selected > td {
  background: #f4faf6;
  box-shadow: inset 0 1px #d2ead8, inset 0 -1px #d2ead8;
}

#ordersTable .select-col,
#procurementList .select-col,
#financeList .finance-sales-check,
#financeList .finance-purchase-check,
#dailyBillingCustomers [data-daily-receipt-check],
#dailyBillingCustomers [data-daily-receipt-customer],
#invoiceInventoryMovements [data-invoice-inventory-check],
#invoiceInventoryMovements #invoiceInventoryMovementSelectAll {
  cursor: pointer;
  user-select: none;
}

#ordersTable.checkbox-drag-selecting,
#ordersTable.checkbox-drag-selecting *,
#procurementList.checkbox-drag-selecting,
#procurementList.checkbox-drag-selecting *,
#financeList table.checkbox-drag-selecting,
#financeList table.checkbox-drag-selecting *,
#dailyBillingCustomers table.checkbox-drag-selecting,
#dailyBillingCustomers table.checkbox-drag-selecting *,
#invoiceInventoryMovements table.checkbox-drag-selecting,
#invoiceInventoryMovements table.checkbox-drag-selecting * {
  -webkit-user-select: none;
  user-select: none;
}

.finance-confirm-selection {
  margin: 8px 0 12px;
  padding: 10px 12px;
  border-left: 3px solid #397a55;
  background: #f1f7f3;
}

.finance-ledger-sale-total td {
  font-weight: 700;
  background: #f4f6f7;
}

.finance-purchase-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.finance-overview-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.finance-overview-section {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.finance-overview-section h3 {
  margin: 0;
  font-size: 14px;
  color: #0f172a;
}

.finance-report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#financeList .mini-table th,
#financeList .mini-table td,
#financeList .master-application-table th,
#financeList .master-application-table td {
  padding: 5px 7px;
  font-size: 12px;
  line-height: 1.25;
}

#financeList .mini-table th,
#financeList .master-application-table th {
  position: sticky;
  top: 0;
  z-index: 3;
}

#financeList .number-cell,
#financeList .finance-summary-table td:nth-child(n+4),
#financeList .finance-sales-table td:nth-child(n+9),
#financeList .finance-purchase-table td:nth-child(n+9),
#financeList .finance-ledger-table td:nth-child(n+2),
#financeList .receipt-bill-table td:nth-child(n+5),
#financeList .finance-monthly-ledger-table td:nth-child(n+2) {
  text-align: right;
}

.finance-return-actions {
  border-color: #fecaca;
  background: #fff7f7;
}

.compact-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #475569;
  white-space: nowrap;
}

.finance-purchase-table {
  min-width: 1120px;
}

.finance-return-table {
  min-width: 1280px;
}

.finance-return-row td {
  background: #fffafa;
}

.finance-purchase-table th:nth-child(7),
.finance-purchase-table td:nth-child(7),
.finance-purchase-table th:nth-child(8),
.finance-purchase-table td:nth-child(8) {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.finance-freight-table th,
.finance-freight-table td {
  padding: 4px 5px;
}

.finance-freight-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.finance-freight-tools .compact-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  color: #475569;
}

.finance-freight-tools .compact-field select {
  width: 128px;
  min-height: 30px;
  padding: 4px 8px;
}

.finance-profit-board {
  display: grid;
  gap: 10px;
}

.finance-profit-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}

.finance-profit-chart {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.finance-profit-bar-row {
  display: grid;
  grid-template-columns: 42px minmax(120px, 1fr) 76px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.finance-profit-bar-track {
  height: 10px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.finance-profit-bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #16a34a;
}

.finance-profit-bar-track i.negative {
  background: #dc2626;
}

.finance-profit-bar-row strong {
  text-align: right;
  font-size: 12px;
  font-weight: 700;
}

.finance-profit-table-wrap {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

.finance-profit-table {
  min-width: 760px;
}

.finance-freight-table th:nth-child(2),
.finance-freight-table td:nth-child(2),
.finance-freight-table th:nth-child(3),
.finance-freight-table td:nth-child(3),
.finance-freight-table th:nth-child(4),
.finance-freight-table td:nth-child(4),
.finance-freight-table th:nth-child(5),
.finance-freight-table td:nth-child(5),
.finance-freight-table th:nth-child(6),
.finance-freight-table td:nth-child(6) {
  max-width: 128px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.finance-freight-input {
  width: 76px;
  min-height: 26px;
  padding: 3px 5px;
  font-size: 12px;
}

.freight-rate-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  padding: 7px 8px;
  border: 1px solid #dbe3ef;
  background: #f8fafc;
}

.freight-rate-filter-fields,
.freight-rate-actions,
.freight-rate-table .row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.freight-rate-filter-fields input {
  width: min(280px, 70vw);
}

.freight-rate-filter-fields select {
  width: 190px;
}

.freight-new-company-input {
  width: 180px;
}

.freight-company-sheets {
  display: grid;
  gap: 14px;
}

.freight-company-sheet {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
}

.freight-company-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid #dbe3ef;
  background: #f8fafc;
}

.freight-company-name {
  display: grid;
  grid-template-columns: auto minmax(180px, 280px);
  align-items: center;
  gap: 8px;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.freight-company-name input {
  width: 100%;
  min-height: 30px;
  font-weight: 700;
}

.freight-company-count,
.freight-formula-preview {
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
}

.freight-company-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.freight-company-fixed {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(180px, 260px);
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid #dbe3ef;
  background: #fff7ed;
}

.freight-company-fixed label {
  display: grid;
  gap: 4px;
  color: #7c2d12;
  font-size: 12px;
  font-weight: 700;
}

.freight-company-fixed input {
  width: 100%;
  min-height: 32px;
}

.freight-company-formula {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(260px, 1.4fr) 108px auto auto;
  align-items: end;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #cbd5e1;
  background: #f0fdfa;
}

.freight-company-formula label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.freight-company-formula .freight-company-description {
  min-width: 0;
}

.freight-company-formula input {
  width: 100%;
  min-height: 32px;
  font-family: Consolas, "Microsoft YaHei", sans-serif;
  font-size: 12px;
}

.freight-company-formula > select {
  width: 108px;
  min-height: 32px;
}

/* 异地调货公司固定条件保持在紧凑表头内，避免挤压线路表。 */
.freight-city-company-formulas {
  display: grid;
  gap: 4px;
  padding: 5px 8px;
  border-bottom: 1px solid #dbe3ef;
  background: #fff7ed;
}

.freight-city-company-config {
  display: grid;
  grid-template-columns: 120px repeat(8, minmax(68px, 88px)) minmax(220px, 1fr) minmax(220px, 1fr) auto;
  align-items: end;
  gap: 5px;
  min-width: 0;
}

.freight-city-company-config > strong,
.freight-city-company-config > label {
  min-width: 0;
  color: #7c2d12;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.freight-city-company-config > label {
  display: grid;
  gap: 2px;
}

.freight-city-company-config input {
  width: 100%;
  min-height: 27px;
  padding: 3px 6px;
  font-size: 12px;
}

.freight-city-company-config .freight-city-formula-input {
  color: #334155;
}

.freight-city-company-config .freight-city-description-input {
  color: #475569;
}

.freight-city-company-config .freight-city-formula-input input {
  font-family: Consolas, "Microsoft YaHei", sans-serif;
}

.freight-city-manual-tools {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 7px;
  padding: 6px 8px;
}

/* 市到市报价按物流公司拆分，避免不同公司的线路在同一张表内交错。 */
.freight-city-company-sections {
  display: grid;
  gap: 10px;
  padding: 0 8px 8px;
}

.freight-city-company-section {
  overflow: hidden;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #fff;
}

.freight-city-company-section > summary {
  list-style: none;
  cursor: pointer;
}

.freight-city-company-section > summary::-webkit-details-marker {
  display: none;
}

.freight-city-company-section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 34px;
  padding: 6px 10px;
  color: #0f3b68;
  background: #f4f8fc;
  border-bottom: 1px solid #dbe3ef;
  font-size: 12px;
}

.freight-city-company-section-head::before {
  content: ">";
  display: inline-block;
  color: #64748b;
  font-size: 15px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform .15s ease;
}

.freight-city-company-section[open] > .freight-city-company-section-head::before {
  transform: rotate(90deg);
}

.freight-city-company-section-head strong {
  font-size: 13px;
}

.freight-city-company-section-head span {
  color: #64748b;
  font-size: 11px;
}

.freight-city-company-section .freight-rate-table-wrap {
  margin: 0;
  border: 0;
}

.freight-city-manual-tools > label {
  display: grid;
  gap: 2px;
  min-width: 110px;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.freight-city-manual-tools select,
.freight-city-manual-tools input[type="number"] {
  min-height: 28px;
  padding: 3px 6px;
}

.freight-city-service-checks {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  color: #475569;
  font-size: 11px;
}

.freight-city-service-checks label {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}

.freight-city-quote-result {
  display: inline-block;
  margin-left: 4px;
  color: #b91c1c;
  font-size: 12px;
}

.freight-quote-form > label,
.freight-quote-fields label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: #475569;
  font-size: 12px;
}

.freight-quote-form input,
.freight-quote-form select {
  width: 100%;
  min-height: 32px;
}

.freight-quote-form small {
  color: #64748b;
  line-height: 1.4;
}

.freight-sheet-count,
.freight-sheet-dirty {
  color: #64748b;
  font-size: 12px;
}

.freight-sheet-dirty.active {
  color: #b45309;
  font-weight: 700;
}

.freight-rate-table-wrap {
  max-height: min(480px, calc(100vh - 245px));
  overflow: auto;
  border: 0;
  background: #fff;
}

.freight-rate-table {
  width: 2260px;
  min-width: 2260px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  color: #0f172a;
  font-size: 12px;
}

.freight-rate-table th,
.freight-rate-table td {
  height: 34px;
  padding: 0;
  border-right: 1px solid #64748b;
  border-bottom: 1px solid #64748b;
  vertical-align: middle;
}

.freight-rate-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 42px;
  padding: 4px 5px;
  background: #b91c1c;
  color: #fff;
  font-weight: 700;
  text-align: center;
  white-space: normal;
}

.freight-rate-table tbody tr:nth-child(even) td {
  background: #f8fafc;
}

.freight-rate-table tbody tr:hover td {
  background: #fff7ed;
}

.freight-rate-table input,
.freight-rate-table select {
  width: 100%;
  height: 33px;
  min-height: 33px;
  padding: 4px 6px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: #0f172a;
  font: inherit;
}

.freight-rate-table input:focus,
.freight-rate-table select:focus {
  box-shadow: inset 0 0 0 2px #0f766e;
  background: #fff;
}

.freight-rate-table input:disabled,
.freight-rate-table select:disabled {
  color: #334155;
  opacity: 1;
}

.freight-sheet-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
}

.freight-sheet-heading select {
  width: 48px;
  height: 24px;
  min-height: 24px;
  padding: 1px 2px;
  border: 1px solid #fecaca;
  background: #fff;
  color: #166534;
  font-size: 10px;
}

.freight-rate-table .freight-sheet-index {
  background: #f1f5f9;
  color: #475569;
  text-align: center;
}

.freight-rate-table thead .freight-sheet-index {
  z-index: 5;
  background: #991b1b;
  color: #fff;
}

.freight-rate-table th:nth-child(2),
.freight-rate-table td:nth-child(2) {
  background: #fff;
}

.freight-rate-table thead th:nth-child(2) {
  z-index: 4;
  background: #b91c1c;
}

.freight-rate-table tbody tr:nth-child(even) td:nth-child(2) {
  background: #f8fafc;
}

.freight-rate-table tbody tr:hover td:nth-child(2) {
  background: #fff7ed;
}

.freight-rate-table .row-actions {
  justify-content: center;
  flex-wrap: nowrap;
  padding: 2px 4px;
}

.freight-rate-table .row-actions button {
  min-height: 26px;
  padding: 3px 5px !important;
}

.freight-sheet-empty {
  padding: 18px !important;
  color: #64748b;
  text-align: center;
}

.freight-calculator-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.8fr) minmax(420px, 1.2fr);
  gap: 14px;
  align-items: start;
}

.freight-quote-form,
.freight-quote-result {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fff;
}

.freight-quote-results {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.freight-quote-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 3px 12px;
  padding: 10px 12px;
  border: 1px solid #86b6a8;
  border-radius: 6px;
  background: #f0fdfa;
}

.freight-quote-summary span,
.freight-quote-summary small {
  color: #475569;
  font-size: 12px;
}

.freight-quote-summary strong {
  color: #166534;
  font-size: 24px;
}

.freight-quote-summary small {
  grid-column: 1 / -1;
}

.freight-quote-summary em {
  grid-column: 1 / -1;
  color: #166534;
  font-size: 12px;
  font-style: normal;
}

.freight-quote-company {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
}

.freight-quote-company-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-bottom: 1px solid #cbd5e1;
  background: #f8fafc;
  font-size: 12px;
}

.freight-quote-company-head span,
.freight-quote-formula {
  color: #64748b;
  font-size: 11px;
}

.freight-quote-table-wrap {
  overflow: auto;
}

.freight-quote-table {
  min-width: 1180px;
}

.freight-quote-table th,
.freight-quote-table td {
  white-space: nowrap;
}

.freight-quote-table tr.freight-quote-lowest td {
  background: #ecfdf5;
  color: #166534;
  font-weight: 600;
}

.freight-quote-table tr.freight-quote-second td {
  background: #fffbeb;
}

.freight-quote-table td small {
  display: block;
  color: #64748b;
  font-size: 10px;
  font-weight: 400;
}

.freight-quote-formula {
  overflow: hidden;
  padding: 6px 9px;
  border-top: 1px solid #e2e8f0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.freight-quote-errors {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border-left: 3px solid #b91c1c;
  background: #fff7ed;
  color: #7f1d1d;
  font-size: 12px;
}

.freight-quote-form h3 {
  margin: 0 0 2px;
  font-size: 15px;
}

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

.freight-option-fields {
  display: flex;
  gap: 8px 14px;
  flex-wrap: wrap;
  margin: 0;
  padding: 8px 10px 10px;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
}

.freight-option-fields legend {
  padding: 0 5px;
  color: #475569;
  font-size: 12px;
}

.freight-option-fields label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}

.freight-option-fields input {
  width: 15px;
  min-height: 15px;
}

.freight-quote-total,
.freight-quote-order-total {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 12px;
}

.freight-quote-total > span,
.freight-quote-order-total span {
  color: #475569;
  font-size: 12px;
}

.freight-quote-total > strong {
  color: #1d4ed8;
  font-size: 26px;
}

.freight-quote-total > small {
  grid-column: 1 / -1;
  color: #64748b;
}

.freight-quote-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
  border-top: 1px solid #e2e8f0;
}

.freight-quote-breakdown span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid #eef2f7;
  color: #475569;
  font-size: 12px;
}

.freight-quote-breakdown strong {
  color: #0f172a;
}

.freight-quote-order-total {
  padding-top: 4px;
}

.freight-quote-order-total strong {
  color: #1d4ed8;
  font-size: 18px;
}

@media (max-width: 900px) {
  .workspace-menu-shell,
  #contractList {
    grid-template-columns: 1fr;
  }

  #financeList .workspace-menu-shell {
    grid-template-columns: 1fr;
  }

  #financeList .finance-suite-groups,
  #financeList .finance-suite-branches {
    max-height: none;
  }

  .workspace-menu,
  #contractList > .contract-menu-bar {
    position: static;
  }

  #financeList .workspace-menu {
    position: static;
    max-height: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #contractList > .contract-menu-bar,
  #contractList > .contract-menu-bar + *,
  #contractList > .contract-main-content {
    grid-column: 1;
  }

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

  .workspace-menu .master-menu-title {
    grid-column: 1 / -1;
  }

  .finance-current-toolbar {
    position: static;
  }

  .freight-calculator-layout {
    grid-template-columns: 1fr;
  }

  .freight-company-head,
  .freight-company-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .freight-company-actions {
    margin-left: 0;
  }

  .freight-company-name,
  .freight-company-formula,
  .freight-company-fixed {
    grid-template-columns: 1fr;
  }

  .freight-city-company-config {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .freight-city-company-config > strong,
  .freight-city-company-config .freight-city-description-input,
  .freight-city-company-config .freight-city-formula-input,
  .freight-city-company-config > button {
    grid-column: 1 / -1;
  }

  .freight-quote-fields,
  .freight-quote-breakdown {
    grid-template-columns: 1fr;
  }

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

  .finance-drawer summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .finance-drawer summary small {
    margin-left: 18px;
  }
}

.purchase-contract-preview {
  max-width: min(92vw, 980px);
  max-height: 68vh;
  overflow: auto;
}

.purchase-contract-modal {
  width: min(1080px, calc(100vw - 36px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.purchase-contract-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.purchase-contract-tabs button {
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  font-size: 12px;
}

.purchase-contract-tabs button.active {
  border-color: var(--primary);
  background: #ecfdf5;
  color: #0f766e;
  font-weight: 700;
}

.purchase-contract-preview-box {
  min-height: 0;
  max-height: min(72vh, 760px);
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.purchase-contract-doc {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 12px;
  background: #fff;
  color: #111827;
  box-sizing: border-box;
}

.purchase-contract-doc h1 {
  margin: 0 0 12px;
  text-align: center;
  font-size: 20px;
}

.purchase-contract-meta,
.purchase-contract-sign {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0;
  font-size: 12px;
}

.purchase-contract-doc table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.purchase-contract-party td {
  width: 50%;
}

.purchase-contract-doc th,
.purchase-contract-doc td {
  border: 1px solid #1f2937;
  padding: 5px 6px;
  text-align: left;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.quote-price {
  color: var(--primary);
  font-weight: 700;
  white-space: nowrap;
}

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

.quote-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.quote-card h4 {
  margin: 0 0 10px;
  font-size: 16px;
  line-height: 1.35;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  overflow-wrap: normal;
  scrollbar-width: none;
}

.quote-card h4::-webkit-scrollbar {
  display: none;
}

.quote-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quote-meta span {
  padding: 4px 8px;
  border-radius: 6px;
  background: #f5f7fb;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.quote-params,
.quote-source {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.quote-card-price {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 0 0;
}

.quote-price-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}

.quote-card-price span {
  color: var(--muted);
  font-size: 12px;
}

.quote-card-price strong {
  color: var(--primary);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.quote-card-price b {
  color: var(--primary);
  font-size: 20px;
  line-height: 1.2;
  white-space: nowrap;
}

.quote-price-line {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.quote-national-price-line {
  margin: 0;
}

.quote-price-change {
  margin-top: 6px;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.quote-price-change.price-up {
  color: #b42318;
  background: #ffebe9;
}

.quote-price-change.price-down {
  color: #16794c;
  background: #e7f7ed;
}

.quote-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.quote-edit-btn,
.quote-stock-btn {
  min-height: 26px;
  margin: 0;
  padding: 3px 7px;
  font-size: 12px;
}

.quote-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.quote-footer .quote-source {
  margin: 0;
}

.price-history-modal-card {
  max-width: 860px;
}

.price-history-curve {
  position: relative;
  height: 180px;
  margin: 8px 0 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(to top, rgba(15, 23, 42, .06) 1px, transparent 1px) 0 0 / 100% 25%,
    var(--surface);
}

.price-history-point {
  position: absolute;
  width: 11px;
  height: 11px;
  transform: translate(-50%, 50%);
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .18);
}

.price-history-line-chart {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.price-history-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.price-history-control {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.price-history-control label {
  min-width: 220px;
}

.price-history-detail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.price-history-detail div {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.price-history-detail dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.price-history-detail dd {
  margin: 0;
  font-weight: 600;
}

.price-history-table-wrap {
  max-height: 280px;
}

.price-history-empty {
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.price-tool-shell {
  margin-top: 2px;
}

.price-tool-menu {
  top: 76px;
}

.price-tool-content {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.price-tool-panel {
  display: grid;
  gap: 12px;
}

.price-tool-cta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.price-tool-content .price-tool-panel.hidden {
  display: none;
}

.price-quote-main {
  min-width: 0;
}

.xiaomi-stock-panel {
  display: grid;
  gap: 14px;
}

.xiaomi-stock-form {
  display: grid;
  grid-template-columns: minmax(320px, 1.4fr) minmax(220px, .8fr) minmax(360px, 1fr);
  gap: 12px;
  align-items: end;
}

.xiaomi-stock-form .wide {
  grid-column: span 1;
}

.xiaomi-mode-group {
  min-width: 0;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.xiaomi-mode-group legend {
  padding: 0 5px;
  color: var(--muted);
  font-size: 12px;
}

.xiaomi-mode-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  white-space: nowrap;
}

.xiaomi-mode-group input,
.xiaomi-city-item input {
  width: auto;
}

.xiaomi-city-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dbe5f3;
  border-radius: 8px;
  background: #f8fbff;
}

.xiaomi-region-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
}

.xiaomi-region-controls label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.xiaomi-region-controls select {
  width: 100%;
}

.xiaomi-city-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 7px;
  max-height: 210px;
  overflow: auto;
}

.xiaomi-district-paste-help {
  font-size: 12px;
}

.xiaomi-district-match-preview {
  display: grid;
  gap: 5px;
  max-height: 180px;
  overflow: auto;
  padding: 7px 8px;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #fff;
}

.xiaomi-district-match-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  font-size: 12px;
}

.xiaomi-district-match-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xiaomi-district-match-row small {
  flex: 0 0 auto;
  color: var(--muted);
}

.xiaomi-district-match-row.is-matched small,
.xiaomi-district-match-row.is-duplicate small {
  color: var(--success, #16803c);
}

.xiaomi-district-match-row.is-ambiguous small,
.xiaomi-district-match-row.is-limit small {
  color: var(--warn, #a15c00);
}

.xiaomi-district-match-row.is-unmatched small {
  color: var(--danger, #c0392b);
}

.xiaomi-city-item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 30px;
  padding: 5px 7px;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #fff;
}

.xiaomi-city-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xiaomi-city-item.is-disabled {
  color: var(--muted);
  background: #f2f4f7;
}

@media (max-width: 640px) {
  .xiaomi-region-controls {
    grid-template-columns: 1fr;
  }
}

.xiaomi-stock-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.xiaomi-stock-actions .muted.warn {
  color: var(--warn);
}

.xiaomi-result-panel {
  margin-top: 12px;
}

.xiaomi-stock-summary-list {
  display: grid;
  gap: 8px;
}

.xiaomi-stock-summary-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  line-height: 1.65;
}

.xiaomi-stock-summary-main {
  font-weight: 600;
}

.xiaomi-stock-summary-cities {
  color: var(--text);
}

.xiaomi-sale-price {
  color: #e85d04;
  font-size: 15px;
}

.xiaomi-market-price {
  color: var(--muted);
  font-size: 12px;
}

.xiaomi-coupon-text {
  color: #9a3412;
  font-size: 12px;
  font-weight: 600;
}

.usd-quote-modal {
  width: min(1480px, 96vw);
  max-height: 92vh;
}

.usd-quote-form-grid {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.usd-quote-form-grid .wide {
  grid-column: span 3;
}

.usd-quote-search-field {
  position: relative;
}

.usd-quote-product-dropdown {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 80;
  display: flex;
  flex-direction: column;
  width: min(980px, calc(96vw - 80px));
  max-height: 300px;
  overflow: auto;
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.2);
}

.usd-quote-product-option {
  width: max-content;
  min-width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #111827;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
}

.usd-quote-product-option:hover {
  background: #e8f0ff;
}

.usd-quote-picker {
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.usd-quote-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.usd-quote-product-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.usd-quote-product-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
}

.usd-quote-product-main {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usd-quote-empty {
  padding: 12px;
}

.usd-quote-table-wrap {
  max-height: 42vh;
  overflow: auto;
}

.usd-quote-table {
  min-width: 1500px;
  font-size: 12px;
}

.usd-quote-business .usd-quote-table {
  min-width: 720px;
}

.usd-quote-business .usd-quote-form-grid {
  grid-template-columns: minmax(320px, 2fr) minmax(160px, 1fr);
}

.usd-quote-business .usd-quote-form-grid .wide {
  grid-column: 1 / -1;
}

.usd-quote-table th,
.usd-quote-table td {
  white-space: nowrap;
  padding: 6px 8px;
}

.usd-quote-price-input {
  width: 118px;
  min-width: 118px;
  height: 30px;
  padding: 4px 6px;
  text-align: right;
}

.usd-quote-ledger {
  margin-top: 12px;
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
}

.usd-quote-ledger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.usd-quote-ledger-wrap {
  max-height: 220px;
  overflow: auto;
}

.split-actions {
  justify-content: space-between;
  gap: 12px;
}

@media (max-width: 640px) {
  .usd-quote-form-grid .wide {
    grid-column: 1 / -1;
  }

  .quote-card-price {
    padding-top: 10px;
  }
}

.table-action-bar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.model-memory-review-panel {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #dbe5f3;
  border-radius: 8px;
  background: #fff;
}

.model-memory-review-panel .manual-memory-head {
  margin-bottom: 8px;
}

.model-memory-review-panel .manual-memory-head .compact {
  margin-left: auto;
  min-height: 28px;
  padding: 0 9px;
}

.model-memory-review-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.model-memory-review-tools input {
  min-width: 0;
  flex: 1 1 auto;
  min-height: 30px;
  padding: 5px 8px;
}

.model-memory-review-list {
  display: grid;
  gap: 6px;
  max-height: 300px;
  overflow: auto;
}

.model-memory-review-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  padding: 7px;
  border: 1px solid #e3eaf4;
  border-radius: 6px;
  background: #fbfdff;
}

.model-memory-review-item.is-disabled {
  opacity: .62;
  background: #f5f6f8;
}

.model-memory-review-item input {
  min-width: 0;
  min-height: 29px;
  padding: 4px 7px;
}

.model-memory-review-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.model-memory-review-actions button {
  min-height: 29px;
  padding: 0 7px;
  font-size: 12px;
}

@media (max-width: 720px) {
  .model-memory-review-item {
    grid-template-columns: 1fr;
  }
  .model-memory-review-actions {
    justify-content: flex-end;
  }
}

.table-row-height-control {
  display: inline-flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 4px;
  width: auto;
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
}

.table-row-height-control input {
  width: 58px;
  min-width: 58px;
  padding: 7px 6px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.table-row-height-control span:last-child {
  color: var(--muted);
}

.order-display-control {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: auto;
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
}

.order-display-control select {
  min-width: 122px;
  padding: 7px 8px;
}

.table-action-bar .primary {
  min-width: 170px;
  background: #1d4ed8;
}

.table-action-bar .primary:hover {
  background: #1e40af;
}

.batch-empty {
  padding: 12px 0 0;
}

.batch-table {
  margin-top: 12px;
  border-radius: 8px;
}

.batch-table table {
  min-width: 1680px;
  table-layout: fixed;
}

.batch-table td {
  padding: 6px;
}

.batch-table th[data-batch-column-key] {
  position: relative;
  padding-right: 14px;
  white-space: nowrap;
}

.batch-table th[data-batch-column-key] > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.batch-column-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  bottom: 0;
  z-index: 2;
  width: 8px;
  cursor: col-resize;
  touch-action: none;
}

.batch-column-resizer::after {
  content: '';
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 3px;
  width: 2px;
  background: transparent;
  border-radius: 2px;
}

.batch-column-resizer:hover::after,
.batch-column-resizing .batch-column-resizer::after {
  background: #2563eb;
}

.batch-column-resizing,
.batch-column-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.batch-table input,
.batch-table select {
  min-width: 0;
  width: 100%;
  max-width: none;
  padding: 8px;
  white-space: nowrap;
  box-sizing: border-box;
}

input.needs-manual,
.batch-table input.needs-manual {
  border-color: #e2a008;
  background: #fff9e8;
}

.batch-table input[data-batch-key],
.batch-table select[data-batch-key] {
  min-width: 0;
}
.batch-table input.batch-contact-copyable {
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}

.compact-cell {
  display: inline-block;
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

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

.stat-card {
  padding: 16px;
}
.stat-card span {
  color: var(--muted);
  font-size: 13px;
}
.stat-card strong {
  display: block;
  font-size: 28px;
  margin-top: 8px;
}

.dashboard-scope {
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #f8fafc;
  font-size: 13px;
}

.dashboard-target-panel {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.dashboard-target-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-target-main h3,
.dashboard-target-main p {
  margin: 0;
}

.dashboard-target-main strong {
  font-size: 24px;
  color: #0f766e;
}

.dashboard-target-track {
  height: 8px;
  margin: 10px 0;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.dashboard-target-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #0f766e;
}

.dashboard-target-form {
  display: grid;
  grid-template-columns: 120px minmax(180px, 1fr) 140px minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.dashboard-target-form label {
  font-size: 12px;
  color: var(--muted);
}

.dashboard-target-form input,
.dashboard-target-form select {
  margin-top: 4px;
  height: 32px;
}

.dashboard-target-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.dashboard-target-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  font-size: 12px;
}

.dashboard-target-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-target-row em {
  color: #0f766e;
  font-style: normal;
  font-weight: 700;
}

.dashboard-operating-panel {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
}

.dashboard-operating-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.dashboard-operating-head h3 {
  margin: 0;
}

.dashboard-operating-head span {
  color: var(--muted);
  font-size: 12px;
}

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

.dashboard-operating-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.dashboard-operating-card strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  white-space: nowrap;
}

.dashboard-operating-card.receivable strong { color: #dc2626; }
.dashboard-operating-card.payable strong { color: #9333ea; }
.dashboard-operating-card.cash-in strong { color: #047857; }
.dashboard-operating-card.cash-out strong { color: #2563eb; }

.dashboard-alert-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  margin-bottom: 14px;
}

.dashboard-alert-panel.has-alerts {
  border-color: #fecaca;
  background: #fffafa;
}

.dashboard-alert-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.dashboard-alert-head h3,
.dashboard-alert-head p {
  margin: 0;
}

.dashboard-alert-head strong {
  min-width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: #dc2626;
}

.dashboard-alert-settings {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr)) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
}

.dashboard-alert-settings label {
  font-size: 12px;
  color: var(--muted);
}

.dashboard-alert-settings input {
  margin-top: 4px;
  height: 32px;
}

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

.finance-aging-table th,
.finance-aging-table td,
.finance-monthly-ledger-table th,
.finance-monthly-ledger-table td {
  white-space: nowrap;
}

.dashboard-alert-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  min-width: 0;
}

.dashboard-alert-block summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.dashboard-alert-block summary::-webkit-details-marker {
  display: none;
}

.dashboard-alert-block summary::before {
  content: "›";
  color: var(--muted);
  transform: rotate(0deg);
  transition: transform .15s ease;
}

.dashboard-alert-block[open] summary::before {
  transform: rotate(90deg);
}

.dashboard-alert-block summary span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-alert-block summary b {
  color: #fff;
  background: #64748b;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 12px;
  line-height: 18px;
  min-width: 24px;
  text-align: center;
}

.dashboard-alert-body {
  margin-top: 8px;
}

.dashboard-alert-block.danger summary b { background: #dc2626; }
.dashboard-alert-block.warn summary b { background: #d97706; }
.dashboard-alert-block.inventory summary b { background: #0f766e; }

.dashboard-alert-item {
  display: grid;
  gap: 3px;
  padding: 7px 0;
  border-top: 1px solid #f1f5f9;
  font-size: 12px;
}

.dashboard-alert-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-alert-item span {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-analysis-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.dashboard-top-row {
  display: grid;
  grid-template-columns: 2fr minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 14px;
  align-items: stretch;
}

.dashboard-trend-card .dashboard-line-chart svg {
  height: 190px;
}

.analysis-card {
  grid-column: span 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  min-width: 0;
}

.analysis-card-wide {
  grid-column: span 3;
}

.analysis-card-full {
  grid-column: 1 / -1;
}

.analysis-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.analysis-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.dashboard-bars {
  display: grid;
  gap: 10px;
}

.dashboard-bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.dashboard-bar-meta span {
  color: var(--muted);
  white-space: nowrap;
}

.dashboard-bar-track {
  height: 7px;
  margin-top: 5px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.dashboard-bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #0f766e;
}

.dashboard-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.dashboard-pie-layout {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.dashboard-pie {
  width: 92px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 14px #fff;
}

.dashboard-legend {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.dashboard-legend-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.dashboard-legend-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-legend-item em {
  grid-column: 2;
  color: var(--muted);
  font-style: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dashboard-column-chart {
  height: 190px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
  gap: 10px;
  align-items: end;
  padding-top: 18px;
}

.dashboard-column-item {
  height: 100%;
  min-width: 0;
  display: grid;
  grid-template-rows: 18px 1fr 30px;
  align-items: end;
  gap: 4px;
}

.dashboard-column-value {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-column-bar {
  width: 100%;
  min-height: 8px;
  border-radius: 6px 6px 2px 2px;
}

.dashboard-column-label {
  align-self: start;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  color: #334155;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dashboard-line-chart {
  display: grid;
  gap: 8px;
}

.dashboard-line-summary {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.dashboard-line-summary strong {
  color: #111827;
}

.dashboard-line-summary .trend-up {
  color: #0f766e;
}

.dashboard-line-summary .trend-down {
  color: #dc2626;
}

.dashboard-line-chart svg {
  width: 100%;
  height: 240px;
  display: block;
}

.dashboard-line-grid {
  stroke: #e5e7eb;
  stroke-width: 1;
}

.dashboard-line-axis {
  fill: #64748b;
  font-size: 11px;
}

.dashboard-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-line.current {
  stroke: #0f766e;
}

.dashboard-line.previous {
  stroke: #94a3b8;
  stroke-dasharray: 6 5;
}

.dashboard-line-dot.current {
  fill: #0f766e;
}

.dashboard-line-dot.previous {
  fill: #94a3b8;
}

.dashboard-line-legend {
  display: flex;
  gap: 14px;
  justify-content: flex-end;
  font-size: 12px;
  color: var(--muted);
}

.dashboard-line-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dashboard-line-legend i {
  width: 18px;
  height: 3px;
  border-radius: 999px;
  display: inline-block;
}

.dashboard-line-legend i.current {
  background: #0f766e;
}

.dashboard-line-legend i.previous {
  background: #94a3b8;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, .7fr);
  gap: 16px;
  align-items: start;
}

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

.address-cell {
  min-width: 260px;
  white-space: normal;
  line-height: 1.5;
}

.date-cell {
  min-width: 64px;
  white-space: nowrap;
}

.order-query-head {
  align-items: center;
  margin-bottom: 8px;
}

/* 订单查询和采购处理的操作、筛选区域随页面内容一起固定，表格表头从其下方开始吸附。 */
.order-query-fixed-head,
.procurement-fixed-head {
  position: sticky;
  top: 0;
  z-index: 8;
  margin: 0 -16px;
  padding: 0 16px;
  background: var(--panel);
  box-shadow: 0 4px 10px rgba(15, 23, 42, .08);
}

#orderQueryPage .order-query-head .table-action-bar {
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap !important;
  justify-content: flex-end;
}

.order-query-head h3 {
  margin: 0;
}

/* 订单与采购表头共用颜色图例，并与订单行颜色变量保持一致。 */
.status-color-legend {
  display: flex;
  flex: 1 1 520px;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.status-color-legend-title {
  color: var(--text);
  white-space: nowrap;
}

.status-color-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.status-color-swatch {
  display: inline-block;
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
}

.status-color-normal { background: var(--order-color-normal); }
.status-color-cancel-pending { background: var(--order-color-cancel-pending); }
.status-color-closed { background: var(--order-color-closed); }
.status-color-change-pending { background: var(--order-color-change-pending); }
.status-color-contract-locked { background: var(--order-color-contract-locked); }
.status-color-active { background: var(--order-color-active); }
.status-color-duplicate { background: var(--order-color-duplicate); }
.status-color-procurement-handled { background: #dcfce7; }
.status-color-procurement-confirmed { background: var(--procurement-color-confirmed); }
.status-color-procurement-cancel { background: var(--procurement-color-cancel-pending); }

.procurement-status-color-legend {
  /* 采购工作台是纵向弹性容器，图例只按内容高度显示，不能挤压下方工具栏和列表。 */
  flex: 0 0 auto;
  margin-bottom: 8px;
}

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

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

th {
  background: #eef4f7;
  white-space: nowrap;
}

table.table-column-resizable th.table-column-resizable-header {
  position: sticky;
  top: 0;
}

/* 首次拖动后冻结列宽，避免正文内容和页面专用 min-width 把列重新撑回去。 */
table.table-column-resizable.table-column-resizable-active {
  table-layout: fixed;
}

table.table-column-resizable.table-column-resizable-active > thead > tr > th,
table.table-column-resizable.table-column-resizable-active > tbody > tr > td,
table.table-column-resizable.table-column-resizable-active > tfoot > tr > td {
  min-width: 0 !important;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 订单查询和采购处理调整列宽后，以 colgroup 宽度为准，避免页面专用 max-width 抢回布局。 */
table.order-query-table.table-column-resizable.table-column-resizable-active > thead > tr > th,
table.order-query-table.table-column-resizable.table-column-resizable-active > tbody > tr > td,
table.order-query-table.table-column-resizable.table-column-resizable-active > tfoot > tr > td,
table.procurement-table.table-column-resizable.table-column-resizable-active > thead > tr > th,
table.procurement-table.table-column-resizable.table-column-resizable-active > tbody > tr > td,
table.procurement-table.table-column-resizable.table-column-resizable-active > tfoot > tr > td {
  width: auto !important;
  max-width: none !important;
}

/* 订单查询和采购处理的业务列保留一个中文字符的可用空间，避免缩窄后无法辨认或继续拖动。 */
table.order-query-table.table-column-resizable.table-column-resizable-active > thead > tr > th,
table.order-query-table.table-column-resizable.table-column-resizable-active > tbody > tr > td,
table.order-query-table.table-column-resizable.table-column-resizable-active > tfoot > tr > td,
table.procurement-table.table-column-resizable.table-column-resizable-active > thead > tr > th,
table.procurement-table.table-column-resizable.table-column-resizable-active > tbody > tr > td,
table.procurement-table.table-column-resizable.table-column-resizable-active > tfoot > tr > td {
  min-width: 32px !important;
}

/* 短文本和备注容器必须跟随单元格宽度，超出部分仍使用省略号保护表格布局。 */
table.order-query-table.table-column-resizable.table-column-resizable-active .compact-cell,
table.procurement-table.table-column-resizable.table-column-resizable-active .compact-cell,
table.procurement-table.table-column-resizable.table-column-resizable-active .procurement-wrap-text {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: none !important;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 采购日期按钮也不能在列宽放大后继续被默认紧凑宽度限制。 */
table.procurement-table.table-column-resizable.table-column-resizable-active .single-date-picker,
table.procurement-table.table-column-resizable.table-column-resizable-active .single-date-trigger {
  display: block;
  width: 100%;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

/* 输入控件也不能在列缩窄时反向撑宽单元格。 */
table.table-column-resizable.table-column-resizable-active :is(input, select, textarea) {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

/* 表格内编辑控件与单元格共用列宽和行高，避免控件自身的最小尺寸撑开列。 */
table.order-query-table.table-column-resizable.table-column-resizable-active .order-inline-field,
table.procurement-table.table-column-resizable.table-column-resizable-active .procurement-input,
table.procurement-table.table-column-resizable.table-column-resizable-active .single-date-picker {
  width: 100%;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 100%;
  box-sizing: border-box;
}

table.order-query-table.table-column-resizable.table-column-resizable-active .order-inline-field .order-inline-input,
table.procurement-table.table-column-resizable.table-column-resizable-active .procurement-input,
table.procurement-table.table-column-resizable.table-column-resizable-active .single-date-trigger {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 100%;
  box-sizing: border-box;
  background: transparent !important;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

/* 勾选和序号列保留可操作的最小空间，业务数据列仍可自由缩窄。 */
table.table-column-resizable.table-column-resizable-active .select-col {
  min-width: 42px !important;
}

table.table-column-resizable.table-column-resizable-active .row-num-col,
table.table-column-resizable.table-column-resizable-active .procurement-row-num-col {
  min-width: 54px !important;
}

.table-column-resize-handle {
  position: absolute;
  z-index: 2;
  top: 0;
  right: -5px;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
}

.table-column-resize-handle::after {
  content: '';
  position: absolute;
  top: 22%;
  right: 4px;
  width: 2px;
  height: 56%;
  border-radius: 2px;
  background: transparent;
}

th.table-column-resizable-header:hover > .table-column-resize-handle::after,
body.table-column-resizing .table-column-resize-handle::after {
  background: var(--primary);
}

body.table-column-resizing,
body.table-column-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

tr:hover td {
  background: #edf6ff;
}

tr.cancel-request-row td {
  background: var(--order-color-cancel-pending);
  color: #7a271a;
}

tr.cancel-request-row:hover td {
  background: #eaf4ff;
  box-shadow: inset 0 0 0 1px #bfdbfe;
}

tr.recycled-order-row td,
tr.recycled-order-row:hover td {
  background: var(--order-color-closed);
  color: #8a939d;
  box-shadow: none;
}

tr.recycled-order-row {
  opacity: .72;
}


tr.change-request-row td,
tr.procurement-change-row td {
  background: var(--order-color-change-pending);
  color: #5f4200;
}

tr.change-request-row:hover td,
tr.procurement-change-row:hover td {
  background: #eaf4ff;
  box-shadow: inset 0 0 0 1px #bfdbfe;
}

/* 已同意的订单修改申请：使用浅绿色，与待审核的浅黄色明确区分。 */
tr.change-approved-row td,
tr.procurement-change-approved-row td {
  background: #ecfdf5;
  color: #166534;
}

tr.change-approved-row:hover td,
tr.procurement-change-approved-row:hover td {
  background: #eaf4ff;
  box-shadow: inset 0 0 0 1px #bfdbfe;
}

tr.procurement-duplicate-row td {
  background: #fff7ed;
  color: #7c2d12;
}

tr.procurement-duplicate-row:hover td {
  background: #eaf4ff;
  box-shadow: inset 0 0 0 1px #bfdbfe;
}

#procurementList tr.procurement-confirmed-row > td {
  background: var(--procurement-color-confirmed);
  color: #14532d;
}

#procurementList tr.procurement-confirmed-row:hover > td {
  background: var(--procurement-color-confirmed);
  box-shadow: inset 0 0 0 1px #65a30d;
}

#procurementList tr.procurement-handled-row > td {
  background: #dcfce7;
  color: #166534;
}

#procurementList tr.procurement-handled-row:hover > td {
  background: #d1fae5;
  box-shadow: inset 0 0 0 1px #86efac;
}

#procurementList tr.procurement-autosave-pending > td {
  box-shadow: inset 0 -2px #f59e0b;
}

#procurementList tr.procurement-autosave-error > td {
  box-shadow: inset 0 -2px #dc2626;
}

.duplicate-warning-badge {
  display: inline-flex;
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 16px;
  height: 16px;
  margin: 0;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f97316;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(249, 115, 22, .25);
  pointer-events: auto;
}

.duplicate-warning-panel {
  max-height: 52vh;
  overflow: auto;
  text-align: left;
}

.duplicate-warning-card {
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 8px;
  margin-top: 8px;
  background: #fff7ed;
}

.duplicate-warning-card strong,
.duplicate-warning-card span,
.duplicate-warning-card em {
  display: block;
}

.duplicate-warning-match {
  margin-top: 6px;
  padding: 6px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #ffedd5;
}

.duplicate-warning-match b {
  color: #9a3412;
}

.duplicate-warning-match em {
  color: #64748b;
  font-style: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-query-wrap {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  position: relative;
}

.order-query-load-status {
  position: sticky;
  top: 0;
  z-index: 11;
  padding: 5px 10px;
  text-align: center;
  background: rgba(248, 250, 252, .96);
  border-bottom: 1px solid #dbe5ee;
  font-size: 12px;
}

.order-query-table {
  user-select: text;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1280px;
}

.order-query-table th,
.order-query-table td {
  white-space: nowrap;
  border-right: 1px solid #dbe5ee;
  border-bottom: 1px solid #dbe5ee;
  padding: 7px 9px;
}

.order-query-table tbody > tr > td:not(.select-col),
.procurement-table tbody > tr > td:not(.select-col) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-query-table th {
  position: sticky;
  top: var(--order-query-fixed-head-height, 0px);
  z-index: 3;
  background: #e8f0f5;
  box-shadow: inset 0 -1px 0 #cbd7e2;
}

#orderQueryPage .order-query-table thead th {
  z-index: 12;
  background-clip: padding-box;
  box-shadow: inset 0 -1px 0 #cbd7e2, 0 2px 4px rgba(15, 23, 42, .08);
}

.order-query-table .address-cell {
  min-width: 360px;
  max-width: 680px;
  white-space: nowrap;
  line-height: 1.5;
}

.order-query-table .former-name-cell,
.procurement-table .former-name-cell {
  min-width: 0;
  white-space: nowrap;
}

/* 曾用名复用短文本提示，但正文宽度必须跟随用户调整后的表格列宽。 */
.order-query-table .former-name-cell .compact-cell,
.procurement-table .former-name-cell .compact-cell {
  display: block;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 收货人、电话和地址允许浏览器原生框选复制，不参与订单表格的拖选。 */
.order-query-table .order-contact-copyable,
#draftOrdersTable .order-contact-copyable {
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}

/* 即使订单表正处于复选框拖选状态，三项收货信息仍须可以原生框选。 */
#ordersTable.checkbox-drag-selecting .order-contact-copyable,
#ordersTable.checkbox-drag-selecting .order-contact-copyable * {
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}

.order-query-table .select-col {
  width: 42px;
  min-width: 42px;
  background: #f8fbfd;
}

.table-column-header {
  display: flex;
  min-height: 28px;
  gap: 4px;
  min-width: 0;
  align-items: center;
}

.table-column-title {
  min-width: 0;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-column-filter-slot {
  flex: 0 0 28px;
  min-width: 0;
  margin-left: auto;
}

.filter-popover {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.filter-icon-button {
  position: relative;
  display: inline-grid;
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 5px;
  place-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #475569;
  cursor: pointer;
}

.filter-icon-button:hover,
.filter-icon-button:focus-visible,
.filter-icon-button.filter-active {
  border-color: var(--primary);
  color: var(--primary);
  background: #ecfdf5;
}

.filter-icon-button.filter-active {
  border-color: #2563eb;
  color: #fff;
  background: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .18);
}

.filter-icon-button.filter-active:hover,
.filter-icon-button.filter-active:focus-visible {
  border-color: #1d4ed8;
  color: #fff;
  background: #1d4ed8;
}

.filter-icon-button:focus-visible {
  outline: 2px solid rgba(47, 128, 128, .22);
  outline-offset: 1px;
}

.filter-icon-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.filter-active-count:empty {
  display: none;
}

.filter-active-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: #0f766e;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

.filter-icon-button.filter-active .filter-active-count {
  background: #f97316;
  color: #fff;
}

.filter-popover-panel {
  position: fixed;
  z-index: 1500;
  display: none;
  width: min(340px, calc(100vw - 16px));
  max-height: min(70vh, 560px);
  overflow: auto;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, .18);
}

.filter-popover.open .filter-popover-panel {
  display: block;
}

.toolbar-filter-popover,
.finance-filter-toolbar .filter-popover {
  flex: 0 0 auto;
}

.toolbar-filter-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.toolbar-filter-fields input,
.toolbar-filter-fields select,
.toolbar-filter-fields button,
.toolbar-filter-fields .date-range-filter,
.toolbar-filter-fields .inventory-check-filter {
  min-width: 0;
  width: 100%;
}

.toolbar-filter-fields .date-range-filter,
.toolbar-filter-fields .inventory-check-filter {
  min-height: 32px;
}

.toolbar-filter-fields .date-range-filter input {
  width: 100%;
}

.toolbar-filter-fields .inventory-check-filter {
  display: flex;
}

.toolbar-filter-fields .inventory-check-filter input {
  width: 14px;
}

.filter-popover-compact .filter-popover-panel {
  width: min(320px, calc(100vw - 16px));
  padding: 8px;
}

/* 表头统一使用 Excel 式候选值筛选：搜索候选值、勾选后确认提交。 */
.excel-value-filter {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.excel-filter-search {
  width: 100%;
  min-height: 30px;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 5px 8px;
}

.excel-filter-actions,
.excel-filter-footer {
  display: flex;
  align-items: center;
  gap: 6px;
}

.excel-filter-actions button {
  border: 0;
  background: transparent;
  color: #0f766e;
  padding: 1px 2px;
  cursor: pointer;
}

.excel-filter-options {
  max-height: min(46vh, 340px);
  overflow: auto;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  padding: 4px 0;
}

.excel-filter-options label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  min-height: 27px;
  padding: 0 4px;
  cursor: pointer;
}

.excel-filter-options label:hover { background: #f1f5f9; }
.excel-filter-options input { width: 15px; height: 15px; margin: 0; accent-color: #10b981; }
.excel-filter-options span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.excel-filter-options em { color: #94a3b8; font-size: 11px; font-style: normal; }
/* 候选项检索后的 hidden 属性需要覆盖标签默认网格布局，确保不匹配项不占用视觉空间。 */
.excel-filter-options [data-excel-filter-option][hidden] { display: none !important; }
.excel-filter-footer { justify-content: flex-end; }

.filter-popover-compact .toolbar-filter-fields {
  grid-template-columns: minmax(0, 1fr);
}

.filter-popover-compact .order-column-filter,
.filter-popover-compact .procurement-column-filter,
.filter-popover-compact .cost-column-filter,
.filter-popover-compact .date-range-filter,
.filter-popover-compact .table-date-range-trigger {
  width: 100%;
  min-width: 0;
}

.order-column-filter {
  width: 100%;
  min-width: 72px;
  border: 1px solid #d7e0ea;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
  background: #fff;
}

.order-date-column-filter {
  min-width: 102px;
  padding-right: 4px;
}

.order-column-filter:focus {
  outline: 2px solid rgba(47, 128, 128, .18);
  border-color: var(--primary);
}

.date-range-filter {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 32px;
  padding: 0;
  white-space: nowrap;
}

.date-range-filter label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.date-range-filter label span {
  color: #64748b;
  font-size: 11px;
}

.date-range-filter input {
  width: 118px;
  min-width: 108px;
  border: 0;
  outline: 0;
  padding: 4px 2px;
  font-size: 12px;
  background: transparent;
}

.date-range-filter > span {
  color: var(--muted);
  font-size: 12px;
}

.single-date-range-filter,
.single-date-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.date-range-trigger,
.single-date-trigger {
  height: 28px;
  min-width: 74px;
  border: 1px solid #d7e0ea;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.date-range-trigger:hover,
.single-date-trigger:hover {
  border-color: var(--primary);
  background: #f8fbfd;
}

.table-date-range-trigger {
  width: 100%;
  min-width: 74px;
  max-width: 128px;
  padding-left: 6px;
  padding-right: 6px;
}

.date-range-native,
.single-date-native {
  position: fixed !important;
  left: -10000px !important;
  top: 0 !important;
  z-index: 5000 !important;
  width: 1px !important;
  min-width: 1px !important;
  max-width: none !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  cursor: pointer !important;
  color: transparent !important;
  background: transparent !important;
}

.date-range-native.date-picker-active,
.single-date-native.date-picker-active {
  height: 30px !important;
  min-width: 136px !important;
  padding: 3px 6px !important;
  border: 1px solid #94a3b8 !important;
  border-radius: 6px !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  color: #0f172a !important;
  background: #fff !important;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .18) !important;
}

.date-picker-calendar {
  position: fixed;
  z-index: 6000;
  width: 220px;
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, .18);
}

.date-calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.date-calendar-head strong {
  font-size: 13px;
  color: #0f172a;
}

.date-calendar-head button,
.date-calendar-grid button {
  border: 1px solid #d7e0ea;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  cursor: pointer;
}

.date-calendar-head button {
  width: 28px;
  height: 26px;
}

.date-calendar-mode {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 7px;
  color: #64748b;
  font-size: 11px;
}

.date-calendar-mode button {
  flex: 0 0 auto;
  min-height: 24px;
  border: 1px solid #b7d9d1;
  border-radius: 6px;
  padding: 3px 6px;
  background: #f0faf8;
  color: #0f766e;
  cursor: pointer;
}

.date-calendar-mode button[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.date-calendar-week,
.date-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.date-calendar-week span {
  text-align: center;
  color: #64748b;
  font-size: 11px;
  line-height: 22px;
}

.date-calendar-grid button,
.date-calendar-empty {
  height: 26px;
  text-align: center;
  font-size: 12px;
}

.date-calendar-grid button:hover {
  border-color: var(--primary);
  background: #edf7f5;
}

.date-calendar-grid button.in-range {
  background: #e6f4f1;
  border-color: #b7d9d1;
}

.date-calendar-grid button.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
}

.empty-table-cell {
  text-align: center;
  color: var(--muted);
  padding: 22px 12px !important;
}

.notification-center-modal {
  width: min(760px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
}

.notification-center-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 10px;
  border-bottom: 1px solid #e4ebf0;
}

.notification-status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.notification-status-tabs button {
  border: 1px solid #d7e0e8;
  border-radius: 6px;
  background: #fff;
  color: #456173;
  padding: 6px 11px;
  cursor: pointer;
}

.notification-status-tabs button.active {
  border-color: var(--primary);
  background: #e7f6f1;
  color: #176b5b;
  font-weight: 700;
}

.notification-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 0 2px;
}

.notification-category-tabs button {
  border: 1px solid #d7e0e8;
  border-radius: 6px;
  background: #f8fbfc;
  color: #456173;
  padding: 5px 10px;
  cursor: pointer;
}

.notification-category-tabs button.active {
  border-color: #5d9a91;
  background: #edf8f5;
  color: #176b5b;
  font-weight: 700;
}

.notification-center-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
  padding: 10px 0 6px;
}

.notification-center-list {
  overflow: auto;
  display: grid;
  gap: 8px;
  min-height: 100px;
  padding: 2px 2px 4px;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #dfe8ee;
  border-left: 3px solid #b9c8d2;
  border-radius: 6px;
  background: #fff;
  padding: 10px 11px;
}

.notification-item.is-unread {
  border-left-color: #2a8f7c;
  background: #fbfffe;
}

.notification-item.is-handled {
  opacity: .78;
}

.notification-item-main {
  min-width: 0;
  flex: 1;
}

.notification-item-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.notification-item-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-item-title span {
  flex: 0 0 auto;
  color: #527181;
  font-size: 12px;
}

.notification-item-main p {
  margin: 6px 0;
  color: #40596a;
  line-height: 1.5;
}

.notification-item-main time {
  color: var(--muted);
  font-size: 12px;
}

.notification-item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}

@media (max-width: 720px) {
  .notification-center-toolbar,
  .notification-item {
    align-items: stretch;
    flex-direction: column;
  }

  .notification-item-actions {
    justify-content: flex-start;
  }

  .notification-item-title strong {
    white-space: normal;
  }
}

.work-alert-float {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1500;
  width: min(280px, calc(100vw - 36px));
  background: #fff;
  border: 1px solid #f4b4ae;
  border-left: 4px solid #d92d20;
  border-radius: 8px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, .18);
  padding: 8px;
}

.work-alert-float.expanded {
  width: min(360px, calc(100vw - 36px));
}

/* 采购重复收件预警独立于待处理浮窗，避免两个提示相互遮挡。 */
.procurement-duplicate-alert-float {
  bottom: 86px;
  border-color: #f5c98f;
  border-left-color: #d97706;
}

.procurement-duplicate-alert-float .work-alert-head strong,
.procurement-duplicate-alert-float .work-alert-item span {
  color: #9a3412;
}

.procurement-duplicate-alert-float .work-alert-summary span {
  background: #fff7ed;
  color: #9a3412;
}

.work-alert-head {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 6px;
}

.work-alert-head strong {
  color: #9b1c12;
}

.work-alert-summary {
  display: flex;
  gap: 5px;
  margin-left: auto;
}

.work-alert-summary span {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #fff1f0;
  color: #b42318;
  font-size: 12px;
  font-weight: 700;
}

.work-alert-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.work-alert-item {
  display: grid;
  grid-template-columns: 62px minmax(70px, .8fr) minmax(100px, 1.2fr);
  gap: 6px;
  width: 100%;
  border: 1px solid #f4d2ce;
  border-radius: 6px;
  background: #fffafa;
  padding: 7px 8px;
  text-align: left;
  cursor: pointer;
}

.work-alert-item:hover {
  background: #fff1f0;
}

.work-alert-item span {
  color: #b42318;
  font-weight: 700;
}

.work-alert-item strong,
.work-alert-item em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: normal;
}

.work-alert-more {
  color: var(--muted);
  font-size: 12px;
  padding: 2px 4px;
}

.work-alert-bulk {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  margin-top: 6px;
  border-top: 1px solid #fee2e2;
}

.order-query-table .row-num-col {
  width: 54px;
  min-width: 54px;
  text-align: center;
  color: #587083;
  background: #f8fbfd;
}

.order-query-table thead .select-col,
.order-query-table thead .row-num-col {
  z-index: 5;
  background: #e8f0f5;
}

.order-inline-input {
  width: 100%;
  min-width: 120px;
  border: 1px solid #d7e0ea;
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
  font-size: 13px;
}

.order-inline-input[data-order-field="tracking_no"],
.order-inline-input[data-order-field="sn_code"] {
  min-width: 160px;
}

.sn-return-modal {
  width: min(1120px, 100%);
}

.sn-return-input-row {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(320px, 1fr);
  gap: 12px;
  align-items: start;
}

.sn-return-text-label textarea {
  min-height: 150px;
  resize: vertical;
}

.sn-return-errors {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.sn-return-errors > div:not(.success-text) {
  color: var(--danger);
}

.sn-return-preview {
  max-height: 42vh;
}

@media (max-width: 720px) {
  .sn-return-input-row {
    grid-template-columns: 1fr;
  }
}

.order-duplicate-alert-float {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1500;
  width: min(300px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid #f5c46b;
  border-left: 4px solid #d97706;
  border-radius: 8px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, .18);
  padding: 8px;
}

.order-duplicate-alert-float.expanded { width: min(430px, calc(100vw - 36px)); }
.order-duplicate-alert-head { display: flex; flex: 0 0 auto; flex-shrink: 0; align-items: center; gap: 6px; }
.order-duplicate-alert-head strong { color: #92400e; }
.order-duplicate-alert-head span { margin-right: auto; color: #9a6700; font-size: 12px; }
.order-duplicate-alert-list { display: grid; min-height: 0; gap: 6px; margin-top: 8px; overflow-y: auto; overscroll-behavior: contain; }
.order-duplicate-alert-item { display: grid; width: 100%; gap: 3px; padding: 8px; border: 1px solid transparent; border-radius: 6px; background: #fffbeb; color: inherit; font: inherit; text-align: left; }
.order-duplicate-alert-item:hover { border-color: #f59e0b; background: #fef3c7; }
.order-duplicate-alert-locate { display: grid; width: 100%; gap: 3px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.order-duplicate-alert-locate:hover, .order-duplicate-alert-locate:focus-visible { outline: none; }
.order-duplicate-alert-item strong { color: #78350f; }
.order-duplicate-alert-item em { color: #92400e; font-style: normal; overflow-wrap: anywhere; }
.order-duplicate-alert-item span, .order-duplicate-alert-item small { color: #7c5a13; font-size: 12px; overflow-wrap: anywhere; }
.order-duplicate-alert-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
.order-duplicate-alert-ignore { color: #fff; white-space: normal; }

.order-inline-field { display: flex; min-width: 0; align-items: center; gap: 6px; }
.order-inline-field .order-inline-input { flex: 1 1 auto; min-width: 0; }
.order-inline-field .order-inline-input { width: 100%; height: 100%; box-sizing: border-box; }
.order-inline-save { flex: 0 0 auto; white-space: nowrap; }

.order-inline-input.save-failed {
  border-color: #dc2626;
  background: #fff7f7;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12);
}

.order-row-active td,
.order-row-selected td {
  background: var(--order-color-active) !important;
  box-shadow: inset 0 0 0 1px #93c5fd;
}

/* 重复收件提示定位后的订单使用醒目底色，便于同时核对同组多张订单。 */
.order-query-table tr.order-duplicate-locate-row > td {
  background: var(--order-color-duplicate) !important;
  box-shadow: none;
}
.order-query-table tr.order-duplicate-locate-row.order-row-active > td {
  background: var(--order-color-duplicate) !important;
  box-shadow: none;
}

/* 采购状态颜色在采购管理和订单查询列表中保持一致，选中/定位状态仍按交互优先级覆盖。 */
#procurementList tr.procurement-confirmed-row.procurement-row-checkbox-selected > td,
#procurementList tr.procurement-confirmed-row.order-row-active > td {
  background: #e9f7ec !important;
  color: #166534;
  box-shadow: inset 0 0 0 1px #c5e5ca;
}

/* 消息中心定位到采购订单时使用独立高亮，避免被状态底色或重复预警底色淹没。 */
#procurementList tr.procurement-locate-row > td {
  background: #fff1cc !important;
  color: #7c2d12;
  box-shadow: inset 0 0 0 2px #f59e0b;
}

.order-col-selected {
  background: #e0f2fe !important;
  box-shadow: inset 0 0 0 1px #7dd3fc;
}

.order-cell-selected {
  background: #dbeafe !important;
  box-shadow: inset 0 0 0 2px #60a5fa;
}

#ordersTable.table-cell-selecting,
#ordersTable.table-cell-selecting *,
#procurementList.table-cell-selecting,
#procurementList.table-cell-selecting * {
  -webkit-user-select: none;
  user-select: none;
}

.procurement-cell-selected {
  background: #dbeafe !important;
  box-shadow: inset 0 0 0 2px #60a5fa;
}

/* 选中行或单元格时，输入控件透明化并显示父单元格的统一纯色。 */
#ordersTable :is(tr.order-row-active, tr.order-row-selected, tr.order-row-checkbox-selected) > td :is(.order-inline-input, .procurement-input, .single-date-trigger),
#procurementList :is(tr.order-row-active, tr.order-row-selected, tr.procurement-row-checkbox-selected) > td :is(.procurement-input, .single-date-trigger),
#ordersTable td.order-cell-selected :is(.order-inline-input, .procurement-input, .single-date-trigger),
#procurementList td.procurement-cell-selected :is(.procurement-input, .single-date-trigger) {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.table-cell-selection-status {
  margin: 6px 0;
  padding: 5px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.context-menu {
  position: fixed;
  z-index: 60;
  min-width: 160px;
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.context-menu button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 9px 10px;
  text-align: left;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
}

.context-menu button:hover {
  background: #eef7f6;
}

.order-operation-log-modal {
  width: min(820px, calc(100vw - 32px));
  max-height: min(84vh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.order-operation-log-modal > .modal-head,
.order-operation-log-modal > .order-operation-log-toolbar,
.order-operation-log-modal > .modal-actions {
  flex: 0 0 auto;
}

.order-operation-log-toolbar {
  display: flex;
  justify-content: flex-end;
  padding-bottom: 10px;
}

.order-operation-log-toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-operation-log-list {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding: 4px 8px 4px 2px;
}

.order-operation-log-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  position: relative;
  padding-bottom: 16px;
}

.order-operation-log-item::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 16px;
  bottom: 0;
  border-left: 1px solid #b8c3c8;
}

.order-operation-log-marker {
  width: 15px;
  height: 15px;
  margin-top: 3px;
  border: 3px solid #397a55;
  border-radius: 50%;
  background: #fff;
  z-index: 1;
}

.order-operation-log-content {
  min-width: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.order-operation-log-head,
.order-operation-log-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.order-operation-log-head span {
  color: #397a55;
  font-size: 12px;
}

.order-operation-log-content p {
  margin: 6px 0;
}

.order-operation-log-meta,
.order-operation-log-details {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.column-modal {
  width: min(760px, calc(100vw - 32px));
}

.column-settings-button {
  min-width: 170px;
}

.column-config-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
  max-height: 56vh;
  overflow: auto;
  margin-top: 12px;
  padding: 4px 2px 12px;
}

.column-config-row {
  display: inline-flex;
  flex: 0 1 188px;
  min-width: 140px;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  cursor: grab;
  user-select: none;
  transition: border-color .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.column-config-row:hover,
.column-config-row:focus-visible {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, .12);
}

.column-config-row.is-selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.column-config-row.is-dragging {
  opacity: .48;
  cursor: grabbing;
}

.column-config-check {
  display: inline-grid;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
}

.column-config-label {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.column-config-drag {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 15px;
  letter-spacing: -2px;
}

.column-config-row.is-selected .column-config-drag {
  color: rgba(255, 255, 255, .78);
}

.order-change-modal {
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.batch-tracking-return-modal {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.batch-tracking-return-preview {
  max-height: 38vh;
  overflow: auto;
  border: 1px solid #d7e0ea;
  border-radius: 8px;
  background: #f8fafc;
}

.batch-tracking-return-preview .batch-tracking-summary {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid #d7e0ea;
  color: #475569;
}

.batch-tracking-return-preview table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.batch-tracking-return-preview th,
.batch-tracking-return-preview td {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
}

.batch-tracking-return-preview th {
  position: sticky;
  top: 0;
  background: #eef5f6;
}

.batch-tracking-return-errors {
  margin: 0;
  padding: 10px 12px 10px 30px;
  color: #b91c1c;
}

.order-change-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.order-change-grid .wide {
  grid-column: span 3;
}

.order-change-note {
  margin-top: 10px;
}

.order-change-diff {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 52vh;
  overflow: auto;
}

.order-change-info {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

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

.order-application-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.order-application-summary strong {
  color: var(--text);
  font-size: 15px;
}

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

.order-application-reason {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf5;
}

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

.order-application-reason p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.order-change-info-item {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.order-change-info-item span {
  color: var(--muted);
  font-size: 12px;
}

.order-change-info-item strong {
  font-size: 13px;
  font-weight: 600;
  white-space: normal;
  word-break: break-word;
}

.order-change-diff-row {
  display: grid;
  grid-template-columns: 90px 1fr 1fr;
  gap: 8px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fbfdff;
}

.order-change-diff-row strong {
  white-space: nowrap;
}

.order-change-diff-row span {
  white-space: pre-wrap;
  word-break: break-word;
}

.order-change-old {
  color: var(--muted);
}

.order-change-new {
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 720px) {
  .order-change-info {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-application-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}
.export-select-all {
  margin: 12px 0 8px;
}

.export-column-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  max-height: 46vh;
  overflow: auto;
  padding: 4px 2px;
}

.export-column-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  font-size: 13px;
  cursor: grab;
  user-select: none;
  transition: border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.export-column-row:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, .12);
}

.export-column-row.is-dragging {
  opacity: .48;
  cursor: grabbing;
}

.export-column-row input {
  width: auto;
}

.export-column-check {
  min-width: 0;
}

.export-column-check span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-column-drag {
  color: var(--muted);
  font-size: 15px;
  letter-spacing: -2px;
  cursor: grab;
}

.export-column-move-actions {
  display: flex;
  gap: 6px;
}

.procurement-top-toolbar {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.procurement-bulk-toolbar {
  display: grid;
  grid-template-columns: 132px minmax(220px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.procurement-bulk-toolbar select,
.procurement-bulk-toolbar input {
  width: 100%;
  min-height: 32px;
  padding: 5px 8px;
}

.procurement-bulk-toolbar button,
.procurement-page-actions button {
  min-height: 32px;
  padding: 0 10px;
  white-space: nowrap;
}

.procurement-page-actions {
  justify-content: flex-end;
  flex-wrap: nowrap;
  min-width: max-content;
}

.procurement-table-wrap {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  position: relative;
}

.procurement-table {
  min-width: 1500px;
  border-collapse: separate;
  border-spacing: 0;
}

.procurement-table th {
  position: sticky;
  top: var(--procurement-fixed-head-height, 0px);
  z-index: 3;
  background: #e8f0f5;
}

#procurementPage .procurement-table thead th {
  z-index: 12;
  background-clip: padding-box;
  box-shadow: inset 0 -1px 0 #cbd7e2, 0 2px 4px rgba(15, 23, 42, .08);
}

.procurement-table td,
.procurement-table th {
  white-space: nowrap;
  border-right: 1px solid #dbe5ee;
  border-bottom: 1px solid #dbe5ee;
}

.procurement-table .address-cell {
  min-width: 340px;
  max-width: 620px;
  white-space: nowrap;
}

.procurement-input {
  width: 100%;
  min-width: 110px;
  border: 1px solid #d7e0ea;
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
  font-size: 13px;
}

.procurement-table [data-procurement-field="address"] {
  min-width: 320px;
}

.procurement-table [data-procurement-field="supplier"] {
  min-width: 180px;
}

.procurement-row-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e7f5f3;
  color: #0f766e;
  font-size: 12px;
  white-space: nowrap;
}
.pill.warn { background: #fff6db; color: var(--warn); }
.pill.danger { background: #fee4e2; color: var(--danger); }
.pill.purchase { background: #e0f2fe; color: #0369a1; }
.pill.finance { background: #f3e8ff; color: #7e22ce; }
.pill.procurement-handled-pill { background: #bbf7d0; color: #166534; }

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

.mini-item {
  display: grid;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.mini-item button {
  justify-self: start;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
}
.check input { width: auto; }

.inline-form {
  display: grid;
  grid-template-columns: 180px 1fr 100px;
  gap: 10px;
  margin: 12px 0 18px;
}

.master-grid {
  display: block;
}

.master-menu-shell {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

/* 基础资料分类工具栏位于页面内容上方，横向占满可用宽度。 */
.master-menu-top-host {
  display: block;
}

.master-menu {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.master-menu-title {
  padding: 2px 4px 6px;
  font-size: 12px;
  color: var(--muted);
}

.master-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.master-menu-item:hover {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.master-menu-item.active {
  background: #eef6ff;
  border-color: #bfdbfe;
  color: #075985;
  font-weight: 700;
}

.master-menu-item strong {
  min-width: 28px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #475569;
  font-size: 11px;
  text-align: center;
}

.master-menu-item.active strong {
  background: #0f6fb7;
  color: #fff;
}

.master-menu-actions {
  display: grid;
  gap: 7px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}

.master-menu-actions button {
  width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.master-menu-content {
  min-width: 0;
}

/* Shared left-menu workspace used by contracts, inventory, freight and finance. */
.workspace-menu-shell {
  margin-top: 2px;
}

.workspace-menu {
  top: 76px;
}

.workspace-menu-content {
  min-width: 0;
}

.workspace-static-section > details {
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.workspace-static-section > details > summary {
  display: none;
}

.workspace-static-section .inventory-drawer-body {
  padding: 0;
}

.inventory-menu-content > .inventory-page-actions {
  margin-bottom: 10px;
}

#contractList {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

#contractList > .contract-menu-bar {
  grid-column: 1;
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

#contractList > .contract-menu-bar + * {
  grid-column: 2;
  min-width: 0;
}

#contractList > .contract-main-content {
  grid-column: 2;
  min-width: 0;
  display: grid;
  gap: 10px;
}

.contract-menu-tabs {
  display: grid;
  gap: 6px;
}

.contract-menu-tabs button {
  justify-content: space-between;
  width: 100%;
  min-height: 34px;
  text-align: left;
}

.contract-menu-actions {
  display: grid;
  gap: 7px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}

.contract-menu-actions button {
  width: 100%;
}

.aftersales-quick-form,
.aftersales-detail-list {
  display: grid;
  gap: 10px;
}

.aftersales-quick-form label {
  display: grid;
  gap: 5px;
  font-size: 13px;
}

.aftersales-detail-item {
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
}

.aftersales-detail-item p {
  margin: 6px 0 0;
}

.master-action-modal {
  width: min(460px, calc(100vw - 28px));
}

.master-import-modal {
  width: min(760px, calc(100vw - 28px));
}

.master-action-modal form label,
.master-import-modal form label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  color: #475569;
}

.master-import-modal textarea {
  min-height: 220px;
  resize: vertical;
}

#masterUserPanelHost .user-management-panel {
  margin: 0;
}

.master-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcff;
  max-height: none;
  overflow: visible;
}
.master-box h4 { margin: 0; }

.master-box[data-master-type="product"] {
  max-height: none;
}

.master-inline-add {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin: 0 0 8px;
}

.master-inline-add input {
  height: 30px;
  min-width: 0;
  padding: 5px 8px;
  font-size: 12px;
}

.master-inline-add button {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.master-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.master-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.master-current-category {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.master-actions .compact-select {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.master-actions .compact-select select {
  height: 30px;
  min-width: 88px;
  padding: 4px 6px;
  font-size: 12px;
}

.master-select-btn {
  padding: 6px 8px !important;
  font-size: 12px;
}

.danger-btn {
  color: var(--danger) !important;
  padding: 6px 8px !important;
  font-size: 12px;
}

.master-row {
  display: flex;
  grid-template-columns: none;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed #e6edf5;
  font-size: 13px;
}

.master-row input {
  width: auto;
}

.master-row-list {
  max-height: 58vh;
  overflow: auto;
  padding-right: 4px;
}

.master-product-wrap {
  max-height: 58vh;
  overflow: auto;
}

.product-master-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  margin: 0;
  padding: 0;
  background: #fff;
}

.product-master-modal {
  width: min(900px, calc(100vw - 28px));
}

.product-detail-modal {
  width: min(820px, calc(100vw - 28px));
}

.product-detail-body {
  display: grid;
  gap: 12px;
  max-height: min(70vh, 680px);
  overflow: auto;
}

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

.product-detail-field {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #f8fafc;
}

.product-detail-field span,
.product-detail-files span {
  color: #64748b;
  font-size: 12px;
}

.product-detail-field strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
  white-space: pre-wrap;
  word-break: break-word;
}

.product-detail-files {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.product-detail-files > div {
  display: grid;
  gap: 6px;
  align-content: start;
  min-height: 74px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #fff;
}

.procurement-bulk-model-modal {
  width: min(560px, calc(100vw - 28px));
}

.procurement-bulk-model-field {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  font-size: 13px;
  color: #334155;
}

.procurement-bulk-model-field input {
  width: 100%;
  min-height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 13px;
}

.procurement-bulk-model-suggestions {
  margin-top: 8px;
  max-height: min(320px, 46vh);
  overflow: auto;
  border: 1px solid #d7e0ea;
  border-radius: 8px;
  background: #fff;
}

.procurement-bulk-model-suggestions .suggestion-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #edf2f7;
  border-radius: 0;
  background: #fff;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
}

.procurement-bulk-model-suggestions .suggestion-item:last-child {
  border-bottom: 0;
}

.procurement-bulk-model-suggestions .suggestion-item:hover {
  background: #eef6ff;
}

.procurement-bulk-model-suggestions .suggestion-item span,
.procurement-bulk-model-suggestions .suggestion-item small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-suggestion {
  padding: 14px;
  color: #64748b;
  font-size: 13px;
  text-align: center;
}

.product-master-form label {
  display: grid;
  gap: 4px;
  color: #475569;
  font-size: 12px;
  min-width: 0;
}

/* 基础资料新增表单统一以颜色和文字提示标识浏览器必填字段。 */
.master-required-form label:has(> input:required, > select:required, > textarea:required) {
  position: relative;
  padding-right: 38px;
  color: #b42318;
}

.master-required-form label:has(> input:required, > select:required, > textarea:required)::after {
  content: '必填';
  position: absolute;
  top: 0;
  right: 0;
  padding: 1px 5px;
  border-radius: 999px;
  background: #fef0ef;
  color: #c4322b;
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
}

.master-required-form :is(input, select, textarea):required {
  border-color: #e26d68;
  background: #fff8f7;
}

.master-required-form :is(input, select, textarea):required:focus {
  border-color: #c4322b;
  box-shadow: 0 0 0 3px rgb(196 50 43 / 14%);
}

.required-field-hint {
  margin: 0;
  color: #b42318;
  font-size: 12px;
}

.product-identity-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.product-master-form input {
  height: 32px;
  padding: 6px 8px;
  font-size: 12px;
  min-width: 0;
}

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

@media (max-width: 640px) {
  .product-identity-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.product-image-field {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid #dbe3ee;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
}

.product-image-field input[type="file"] {
  display: none;
}

.product-image-field span {
  min-width: 0;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-image-field span.uploaded {
  color: #16803c;
}

.product-file-clear-btn {
  flex: 0 0 auto;
  min-height: 24px;
  padding: 3px 7px;
  font-size: 11px;
}

.product-doc-download {
  min-height: 26px;
  padding: 4px 8px;
  font-size: 12px;
}

.product-doc-quick-actions {
  display: inline-flex;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
  white-space: nowrap;
}

.product-doc-quick-actions .product-doc-download {
  min-height: 22px;
  padding: 2px 6px;
  font-size: 11px;
}

.order-model-with-docs,
.batch-model-doc-cell {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
}

.batch-table .batch-model-doc-cell {
  display: flex;
  width: 100%;
  min-width: 0;
  flex: 1 1 0;
}

.batch-table .batch-model-doc-cell input {
  flex: 1 1 0;
  width: 100%;
  max-width: none !important;
  min-width: 0 !important;
}

.batch-table .product-doc-quick-actions {
  flex: 0 0 auto;
  margin-left: 0;
}

.product-master-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  white-space: nowrap;
}

.product-master-actions .primary,
.product-master-actions .ghost {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.master-product-table {
  min-width: 900px;
  font-size: 12px;
}

.company-master-table {
  min-width: 1180px;
}

.company-master-edit-modal {
  width: min(940px, 100%);
}

.company-master-edit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.company-master-edit-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.company-master-edit-grid input,
.company-master-edit-grid select {
  min-width: 0;
  height: 34px;
}

.company-master-edit-wide {
  grid-column: span 3;
}

.master-product-table th,
.master-product-table td {
  padding: 6px 8px;
  vertical-align: top;
}

.master-product-table th:first-child,
.master-product-table td:first-child {
  width: 34px;
  text-align: center;
}

.master-product-table input[type="checkbox"] {
  width: auto;
}

.product-row-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  min-width: 132px;
}

.product-image-thumb {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #dbe3ee;
  background: #f8fafc;
  display: block;
}

.image-thumb-btn {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.image-preview-modal {
  width: min(980px, calc(100vw - 24px));
  max-height: calc(100vh - 28px);
  display: flex;
  flex-direction: column;
}

.image-preview-stage {
  min-height: 0;
  margin: 12px 0;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  overflow: auto;
  text-align: center;
}

.image-preview-stage img {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
}

.customer-doc-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 160px;
}

.customer-doc-summary-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 5px;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #f8fafc;
  font-size: 11px;
  white-space: nowrap;
}

.customer-doc-thumb,
.customer-doc-mini-thumb {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #fff;
  display: block;
}

.customer-doc-mini-thumb {
  width: 24px;
  height: 24px;
}

.doc-file-chip {
  display: inline-flex;
  max-width: 120px;
  padding: 3px 6px;
  border-radius: 6px;
  background: #eef2f7;
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-upload-btn input {
  display: none;
}

.customer-master-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
  align-items: center;
  margin: 8px 0 10px;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.customer-master-form input,
.customer-master-form select {
  height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

.customer-master-modal {
  width: min(1040px, calc(100vw - 32px));
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  overflow: auto;
}

.customer-master-modal-form {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  align-items: start;
}

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

.customer-company-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 8px;
}

.party-account-section {
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  padding: 8px;
  background: #f8fafc;
}

.party-account-list {
  display: grid;
  gap: 6px;
}

.party-account-row {
  display: grid;
  grid-template-columns: minmax(100px, .7fr) minmax(140px, 1fr) minmax(160px, 1.1fr) minmax(160px, 1.1fr) auto;
  gap: 6px;
  align-items: end;
}

@media (max-width: 700px) {
  .customer-master-modal-form,
  .customer-company-fields,
  .party-account-row {
    grid-template-columns: 1fr;
  }

  .company-master-edit-grid {
    grid-template-columns: 1fr;
  }

  .company-master-edit-wide {
    grid-column: auto;
  }
}

.customer-file-field {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  background: #f8fafc;
}

.customer-file-field input {
  width: 100%;
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.customer-doc-bulk {
  grid-column: span 2;
}

.customer-doc-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 8px;
}

.company-seal-grid {
  grid-template-columns: repeat(2, minmax(160px, 220px));
  justify-content: start;
}

.customer-doc-item {
  display: grid;
  gap: 5px;
  min-height: 76px;
  padding: 8px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 12px;
}

.customer-doc-item span {
  font-weight: 700;
  color: var(--text);
}

.customer-doc-item em {
  min-height: 16px;
  color: var(--muted);
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-doc-item em.uploaded {
  color: #0f766e;
}

.customer-doc-item input[type="file"] {
  width: 100%;
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 11px;
}

.customer-doc-clear-btn {
  justify-self: start;
  min-height: 24px;
  padding: 3px 7px;
  font-size: 11px;
}

.customer-master-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.customer-master-wrap {
  max-height: 58vh;
  overflow: auto;
}

.master-application-form {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  margin-bottom: 12px;
}

.application-top-row,
.application-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 8px;
  align-items: end;
}

.application-form-grid .wide {
  grid-column: span 2;
}

.application-doc-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(128px, 1fr));
  gap: 8px;
}

.application-doc-item {
  display: grid;
  gap: 5px;
  min-height: 92px;
  padding: 8px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
}

.application-doc-item span {
  font-weight: 700;
}

.application-doc-item em {
  color: #dc2626;
  font-style: normal;
  font-weight: 700;
}

.application-doc-item strong {
  color: #64748b;
  font-size: 11px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.application-doc-item strong.uploaded,
[data-application-product-image-status].uploaded {
  color: #16803c;
}

.application-doc-item input[type="file"] {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 11px;
}

.master-application-wrap {
  max-height: 62vh;
  overflow: auto;
}

.master-application-table {
  min-width: 920px;
  font-size: 12px;
}

.master-application-table th,
.master-application-table td {
  padding: 7px 8px;
  vertical-align: top;
}

.application-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.application-status.pending {
  background: #fff7ed;
  color: #c2410c;
}

.application-status.ok {
  background: #ecfdf3;
  color: #16803c;
}

.application-status.danger {
  background: #fef2f2;
  color: #dc2626;
}

.customer-master-table {
  min-width: 980px;
  font-size: 12px;
}

.customer-master-table th,
.customer-master-table td {
  padding: 6px 8px;
  vertical-align: top;
}

.customer-master-table th:first-child,
.customer-master-table td:first-child {
  width: 34px;
  text-align: center;
}

.quote-search-summary {
  margin: 0 0 10px;
  font-size: 12px;
}

@media (max-width: 900px) {
  .product-master-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-master-actions {
    grid-column: 1 / -1;
  }
}

.user-management-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  padding: 12px;
  margin: 12px 0 16px;
  overflow: hidden;
  position: relative;
  max-width: 100%;
}

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

.user-management-panel .section-head {
  align-items: center;
  flex-wrap: wrap;
}

.user-management-panel .section-head h4 {
  margin: 0 0 4px;
}

.user-management-panel .section-head p {
  margin: 0;
}

.user-management-panel .primary,
.user-management-panel .ghost {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 13px;
  line-height: 1.2;
}

.master-column-header {
  padding: 4px 5px;
  background: #eef4f8;
  vertical-align: middle;
}

.master-column-filter-label {
  display: block;
  min-height: 18px;
  margin-bottom: 4px;
  white-space: nowrap;
}

.master-header-search {
  width: 100%;
  height: 28px;
  min-width: 82px;
  padding: 4px 7px;
  font-size: 12px;
  border: 1px solid #d7e2ec;
  border-radius: 4px;
  background: #fff;
}

.master-column-search {
  min-width: 82px;
}

.master-plain-wrap {
  max-width: 720px;
}

.master-plain-table {
  width: 100%;
}

.master-warehouse-wrap {
  margin-bottom: 10px;
}

.master-warehouse-table {
  width: 100%;
}

.admin-data-integrity-panel {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid #dbe5f1;
  border-radius: 8px;
  background: #fff;
}

.admin-data-integrity-head,
.admin-data-integrity-summary,
.admin-data-integrity-check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-data-integrity-head {
  justify-content: space-between;
}

.admin-data-integrity-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-data-integrity-head strong {
  display: block;
}

.admin-data-integrity-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.admin-data-integrity-summary {
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 12px;
}

.admin-data-integrity-error {
  color: #b91c1c;
}

.admin-data-integrity-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.admin-data-integrity-check {
  min-width: 0;
  flex-wrap: wrap;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
}

.admin-data-integrity-check strong {
  flex: 1 1 140px;
}

.admin-data-integrity-check.has-violations {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #92400e;
}

.admin-data-integrity-check small {
  flex-basis: 100%;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.admin-data-integrity-history {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.admin-data-integrity-history-state {
  margin-top: 12px;
  padding: 10px;
  border-top: 1px solid #e2e8f0;
  font-size: 12px;
}

.admin-data-integrity-history-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
}

.admin-data-integrity-trend {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 92px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
}

.admin-data-integrity-trend > span {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: end;
  justify-items: center;
  gap: 3px;
  width: min(28px, 8%);
  height: 100%;
  min-width: 10px;
}

.admin-data-integrity-trend i {
  display: block;
  width: 100%;
  height: var(--integrity-height);
  min-height: 3px;
  border-radius: 3px 3px 0 0;
  background: #22c55e;
}

.admin-data-integrity-trend .has-violations i {
  background: #f59e0b;
}

.admin-data-integrity-trend small {
  font-size: 10px;
  color: var(--muted);
}

.admin-data-integrity-history-list {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

.admin-data-integrity-audit {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
}

.admin-data-integrity-audit summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 12px;
}

.admin-data-integrity-audit summary small {
  margin-left: auto;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.admin-data-integrity-audit > div {
  padding: 0 10px 8px;
  border-top: 1px solid #f1f5f9;
  font-size: 12px;
}

.admin-data-integrity-audit p {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

.user-admin-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.user-admin-main {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.user-filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(130px, 150px) minmax(130px, 150px) auto;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 10px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.user-filter-bar input,
.user-filter-bar select {
  height: 36px;
  font-size: 12px;
  min-width: 0;
  line-height: 20px;
}

.user-filter-bar input {
  width: 100%;
  padding: 7px 10px;
}

.user-filter-bar select {
  width: 100%;
  padding: 7px 32px 7px 10px;
  line-height: 20px;
  background-position: right 10px center;
}

.user-filter-bar button {
  min-height: 36px;
  height: 36px;
  padding: 7px 14px;
  line-height: 20px;
  white-space: nowrap;
}

.user-editor-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  position: fixed;
  top: 74px;
  right: 14px;
  z-index: 120;
  width: min(380px, calc(100% - 24px));
  max-height: calc(100vh - 92px);
  max-width: 100%;
}

.user-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.user-editor-head > div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.user-editor-badge {
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.user-editor-head .icon-btn {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
  border-radius: 6px;
}

.user-editor-form {
  display: grid;
  gap: 10px;
  padding: 12px 14px 14px;
  max-height: calc(100vh - 162px);
  overflow: auto;
}

.user-editor-section {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #eef2f7;
  border-radius: 8px;
  background: #fcfdff;
}

.user-editor-section label:not(.check):not(.switch-line) {
  display: grid;
  gap: 5px;
  font-size: 12px;
  color: #475569;
}

.user-editor-section input[type="text"],
.user-editor-section input:not([type]) {
  width: 100%;
}

.user-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.switch-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #475569;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px;
  margin-top: 6px;
}

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

.user-check-group-title {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.user-check-group-title strong,
.user-check-group-title span {
  display: block;
}

.user-check-group-title span {
  margin-top: 2px;
  color: var(--muted);
  font-weight: 400;
}

.user-permission-scope-summary {
  margin: 6px 0 0;
  padding-left: 18px;
  line-height: 1.7;
}

.dashboard-target-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-target-heading h3,
.dashboard-target-heading p {
  margin: 0;
}

.dashboard-target-periods {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.dashboard-target-period {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.dashboard-target-period > span,
.dashboard-target-period > small {
  color: var(--muted);
  font-size: 11px;
}

.dashboard-target-period > strong {
  color: #0f766e;
  font-size: 15px;
}

.dashboard-target-period > small,
.dashboard-target-period > i {
  grid-column: 1 / -1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-target-period > i {
  height: 3px;
  background: #e2e8f0;
}

.dashboard-target-period > i > b {
  display: block;
  height: 100%;
  background: #0f766e;
}

.dashboard-target-people {
  display: flex;
  gap: 10px;
  margin-top: 7px;
  overflow-x: auto;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.dashboard-target-people b {
  color: #334155;
}

.dashboard-target-modal {
  width: min(520px, calc(100vw - 28px));
}

.permission-disabled {
  color: #94a3b8;
  cursor: not-allowed;
}

.permission-disabled input {
  cursor: not-allowed;
}

.permission-copy-modal {
  width: min(760px, calc(100vw - 24px));
  max-height: min(760px, calc(100vh - 24px));
  overflow: auto;
}

.permission-copy-section {
  margin: 12px 0;
}

.permission-copy-targets {
  max-height: 220px;
  padding: 8px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.permission-copy-preview {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.permission-copy-preview p {
  margin: 6px 0;
}

.user-cost-check {
  margin-top: 2px;
}

.user-editor-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 2px;
}

.user-table-wrap {
  max-height: 360px;
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.user-table {
  width: 100%;
  min-width: 720px;
  table-layout: fixed;
  font-size: 12px;
}

.user-table th,
.user-table td {
  padding: 7px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-table th:first-child,
.user-table td:first-child {
  width: 34px;
}

.user-table th:nth-child(2),
.user-table td:nth-child(2),
.user-table th:nth-child(3),
.user-table td:nth-child(3) {
  width: 92px;
}

.user-table th:nth-child(7),
.user-table td:nth-child(7),
.user-table th:nth-child(8),
.user-table td:nth-child(8),
.user-table th:nth-child(9),
.user-table td:nth-child(9) {
  width: 72px;
  text-align: center;
}

.user-permission-cell {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
}

.user-status.active {
  color: #047857;
  background: #ecfdf5;
}

.user-status.inactive {
  color: #991b1b;
  background: #fef2f2;
}

@media (max-width: 1180px) {
  .user-admin-shell,
  .user-admin-shell.editor-open {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .user-filter-bar {
    grid-template-columns: minmax(0, 1fr) minmax(120px, 150px);
  }
}

@media (max-width: 560px) {
  .dashboard-operating-grid {
    grid-template-columns: 1fr;
  }

  .user-filter-bar {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .user-head-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

.compact-sku-cell {
  width: 82px !important;
  min-width: 70px !important;
  max-width: 96px !important;
}

.compact-customer-cell {
  width: 108px !important;
  min-width: 86px !important;
  max-width: 136px !important;
}

.order-query-table .compact-customer-cell,
.order-query-table .compact-sku-cell,
.procurement-table .compact-customer-cell,
.procurement-table .compact-sku-cell {
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-query-table .compact-customer-cell {
  width: 108px;
  min-width: 86px;
  max-width: 136px;
}

.order-query-table .compact-sku-cell {
  width: 82px;
  min-width: 70px;
  max-width: 96px;
}

.compact-product-model-cell {
  min-width: 110px !important;
}

.cost-tool-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcff;
  padding: 8px;
  display: grid;
  gap: 6px;
  align-content: start;
}

.cost-tool-card h4 {
  margin: 0;
  font-size: 14px;
}

.cost-tool-card p {
  margin: 0;
  font-size: 12px;
}

.cost-tool-card input,
.cost-tool-card textarea,
.cost-tool-card button {
  font-size: 12px;
}

.cost-tool-card .primary,
.cost-tool-card .ghost {
  padding: 6px 9px;
}

.cost-tool-card textarea {
  min-height: 68px;
  resize: vertical;
}

.cost-import-sections {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.cost-import-section {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #f8fafc;
}

.cost-import-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.cost-import-section-head strong {
  font-size: 13px;
}

.cost-import-section-head span {
  color: #64748b;
  font-size: 12px;
}

.cost-import-section-head select {
  flex: 0 0 280px;
  width: 280px;
  min-width: 240px;
  height: 40px;
  min-height: 40px;
  padding: 0 38px 0 12px;
  line-height: 40px;
  font-size: 13px;
}

.cost-form-grid {
  display: grid;
  grid-template-columns: 140px minmax(160px, 1fr);
  gap: 6px;
}

.cost-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
}

.cost-table-toolbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px 8px;
  flex-wrap: wrap;
  overflow: visible;
  padding: 7px 8px;
  margin: 8px 0;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
}

#procurementCostPage .order-workbench-table {
  margin-top: 0;
}

.cost-table-toolbar > * {
  flex: 0 0 auto;
}

.cost-table-toolbar input,
.cost-table-toolbar select,
.cost-table-toolbar button,
.cost-import-menu summary {
  height: 30px;
  font-size: 12px;
  max-width: 100%;
}

.cost-table-toolbar button,
.cost-import-menu summary {
  padding: 5px 9px;
  white-space: nowrap;
}

#costCategoryFilter,
#supplierTableImportMode {
  appearance: none;
  -webkit-appearance: none;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, transparent 50%, #475569 50%),
    linear-gradient(135deg, #475569 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  box-sizing: border-box;
  height: 40px !important;
  min-height: 40px;
  padding: 0 38px 0 12px !important;
  line-height: 40px !important;
  font-size: 13px;
  vertical-align: middle;
  white-space: nowrap;
}

#costCategoryFilter {
  width: 240px;
  min-width: 240px;
}

#newCostCategoryInput {
  width: 108px;
  min-width: 108px;
}

.cost-import-menu {
  position: relative;
}

.cost-import-menu summary {
  list-style: none;
  cursor: pointer;
  border-radius: 5px;
  background: var(--primary);
  color: white;
  display: inline-flex;
  align-items: center;
}

.cost-import-menu summary::-webkit-details-marker {
  display: none;
}

.cost-import-menu[open] summary {
  background: var(--primary-dark);
}

.cost-import-panel {
  position: absolute;
  top: 34px;
  left: 0;
  z-index: 20;
  width: min(1000px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: minmax(280px, .38fr) minmax(560px, .62fr);
  gap: 8px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

#batchModelSuggestions {
  border-radius: 6px;
}

.cost-inline-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
}

.file-picker {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #fff;
  color: #0f172a;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.file-picker:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.file-picker input[type="file"] {
  display: none;
}

.file-name {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #64748b;
  font-size: 12px;
}

.cost-search-box {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  flex: 1 1 260px;
  min-width: 230px;
  max-width: 340px;
  padding: 0 8px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  color: #64748b;
}

.cost-search-box span {
  font-size: 16px;
  line-height: 1;
}

.cost-search-box input {
  height: 26px;
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 0;
  outline: none;
  background: transparent;
}

@media (max-width: 980px) {
  .dashboard-operating-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cost-import-panel {
    grid-template-columns: 1fr;
    width: min(560px, calc(100vw - 24px));
  }
  .cost-actions,
  .cost-inline-actions {
    flex-wrap: wrap;
  }
}

.cost-quote-table {
  min-width: max-content;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.cost-compare-table {
  min-width: max-content;
}

.cost-quote-wrap {
  max-height: calc(100vh - 178px);
  min-height: 360px;
  overflow: auto;
}

.cost-quote-table th,
.cost-quote-table td {
  white-space: nowrap;
  border-right: 1px solid #d9e2ec;
  border-bottom: 1px solid #d9e2ec;
  padding: 5px 7px;
  line-height: 1.35;
  background: #fff;
  vertical-align: middle;
}

.cost-quote-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #eef3f8;
  color: #0f172a;
  font-weight: 700;
  box-shadow: inset 0 -1px #cbd5e1;
}

.cost-quote-table thead tr:first-child th {
  top: 0;
  z-index: 6;
}

.supplier-cost-header {
  min-width: 92px;
  max-width: 118px;
}

.supplier-cost-header span {
  display: block;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.warehouse-cost-header span {
  color: #075985;
}

.supplier-tax-tag {
  display: inline-block;
  margin: 0 3px 3px;
  padding: 1px 3px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
}

.supplier-tax-taxable .supplier-tax-tag { background: #dcfce7; color: #166534; }
.supplier-tax-untaxed .supplier-tax-tag { background: #ffedd5; color: #9a3412; }
.supplier-tax-unknown .supplier-tax-tag { background: #e2e8f0; color: #475569; }

.supplier-delete-btn {
  border: 1px solid #fca5a5;
  background: #fff1f2;
  color: #b42318;
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 11px;
  cursor: pointer;
}

.supplier-delete-btn:hover {
  background: #fee2e2;
}

.xiaomi-sync-btn {
  border: 1px solid #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 11px;
  cursor: pointer;
}

.xiaomi-sync-btn:hover {
  background: #dbeafe;
}

.xiaomi-sync-btn:disabled {
  cursor: wait;
  opacity: 0.72;
}

.cost-quote-table th:first-child,
.cost-quote-table td:first-child {
  background: #f8fafc;
  min-width: 68px;
  width: 68px;
}

.cost-quote-table th:nth-child(2),
.cost-quote-table td:nth-child(2) {
  background: #f8fafc;
  min-width: 96px;
  width: 96px;
  max-width: 118px;
}

.cost-quote-table th:first-child,
.cost-quote-table th:nth-child(2) {
  z-index: 5;
}

.cost-quote-table th:nth-child(3),
.cost-quote-table td:nth-child(3) {
  min-width: 120px;
  max-width: 220px;
}

.cost-quote-table th:nth-child(4),
.cost-quote-table td:nth-child(4) {
  min-width: 92px;
  max-width: 140px;
}

.cost-quote-table th:nth-child(n+5),
.cost-quote-table td:nth-child(n+5) {
  min-width: 78px;
  max-width: 118px;
}

.cost-quote-table tbody tr:hover td {
  background: #f8fbff;
}

.cost-quote-table tbody tr[draggable="true"] {
  cursor: default;
}

.cost-quote-table.cost-drag-active tbody tr,
.cost-quote-table.cost-drag-active tbody tr td,
.cost-quote-table tbody tr.cost-row-dragging {
  cursor: grabbing;
}

.cost-quote-table tbody tr.cost-row-dragging {
  opacity: .45;
}

.cost-quote-table tbody tr.cost-row-drag-over td {
  background: #eff6ff;
  box-shadow: inset 0 2px 0 #60a5fa, inset 0 -1px 0 #d9e2ec;
}

.cost-product-picker-modal {
  width: min(680px, calc(100vw - 28px));
}

.cost-product-picker-modal select {
  width: 100%;
  min-height: 260px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.cost-row-order {
  display: flex;
  align-items: center;
  gap: 3px;
}

.cost-check-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #0f172a;
  white-space: nowrap;
}

.cost-row-check,
#costSelectAll {
  width: 13px;
  height: 13px;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
}

.cost-row-order span {
  display: inline-block;
  min-width: 18px;
  text-align: center;
}

.mini-icon-btn {
  width: 22px;
  height: 22px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.mini-icon-btn:hover:not(:disabled) {
  background: #eaf2ff;
  border-color: #93c5fd;
}

.mini-icon-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.cost-quote-table .wide-text-cell,
.cost-quote-table .model-text-cell {
  white-space: normal;
  min-width: 120px;
  max-width: 220px;
}

.cost-quote-table .model-text-cell {
  min-width: 92px;
  max-width: 140px;
}

.cost-quote-table .price-cell {
  color: #0f5132;
}

/* 成本报价库紧凑列宽 */
.cost-quote-table th,
.cost-quote-table td { padding: 4px 5px; }
.cost-quote-table .supplier-cost-header { min-width: 66px; max-width: 82px; }
.cost-quote-table th:first-child,
.cost-quote-table td:first-child { min-width: 48px; width: 48px; }
.cost-quote-table th:nth-child(2),
.cost-quote-table td:nth-child(2) { min-width: 74px; width: 74px; max-width: 88px; }
.cost-quote-table th:nth-child(3),
.cost-quote-table td:nth-child(3) { min-width: 94px; max-width: 132px; }
.cost-quote-table th:nth-child(4),
.cost-quote-table td:nth-child(4) { min-width: 78px; max-width: 104px; }
.cost-quote-table th:nth-child(n+5),
.cost-quote-table td:nth-child(n+5) { min-width: 62px; max-width: 78px; }
.cost-quote-table .wide-text-cell,
.cost-quote-table .model-text-cell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 94px; max-width: 132px; }
.cost-quote-table .model-text-cell { min-width: 78px; max-width: 104px; }
.cost-quote-table .cost-price-input,
.cost-quote-table .cost-cell-input { width: 58px; min-width: 58px; padding: 3px 4px; }

.cost-quote-table { font-size: 11px; }
.cost-quote-table .supplier-cost-header { min-width: 56px; max-width: 68px; }
.cost-quote-table th:nth-child(n+5),
.cost-quote-table td:nth-child(n+5) { min-width: 54px; max-width: 68px; }
.cost-quote-table .cost-price-input,
.cost-quote-table .cost-cell-input { width: 52px; min-width: 52px; font-size: 11px; }

.cost-price-input,
.cost-cell-input {
  width: 72px;
  min-width: 72px;
  padding: 4px 5px;
  box-sizing: border-box;
}

.cost-cell-input {
  width: 76px;
  min-width: 76px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
}

.warehouse-cost-readonly {
  display: grid;
  gap: 2px;
  min-width: 76px;
  color: #075985;
}

.warehouse-cost-readonly strong {
  font-weight: 700;
}

.warehouse-cost-readonly small {
  color: var(--muted);
  font-size: 11px;
}

.supplier-inventory-cost-header {
  background: #f0fdf4;
}

.supplier-inventory-cost-header .supplier-tax-tag {
  color: #047857;
}

.supplier-inventory-modal-card {
  width: min(620px, calc(100vw - 28px));
}

.supplier-inventory-otp-card {
  width: min(420px, calc(100vw - 28px));
}

.supplier-inventory-form {
  margin-top: 14px;
}

.supplier-inventory-status {
  min-height: 22px;
  margin: 14px 0 0;
  line-height: 1.6;
}

.cost-category-select {
  min-width: 96px;
  padding: 5px 6px;
}

.lowest-cost-value {
  background: #fff;
  color: #0f172a;
  font-weight: 400;
}

.lowest-cost-cell {
  background: #fff;
  color: #15803d;
  font-weight: 700;
}

.lowest-cost-cell .cost-cell-input {
  background: #fff;
  border-color: #cbd5e1;
  color: #15803d;
  font-weight: 700;
}

.recent-cost-update-cell {
  background: #fff7cc !important;
  box-shadow: inset 0 0 0 1px #f6c453;
}

.recent-cost-update-cell .cost-cell-input,
.recent-cost-update-input {
  background: #fff4b8 !important;
  border-color: #eab308 !important;
}

.profit-positive {
  color: #166534;
  font-weight: 700;
}

.profit-negative {
  color: #b42318;
  font-weight: 700;
}

.unmatched-cost-panel {
  margin-top: 16px;
  border: 1px solid #facc15;
  background: #fffbeb;
  border-radius: 8px;
  padding: 14px;
}

.unmatched-cost-panel h4 {
  margin: 0 0 6px;
}

.cost-unmatched-table {
  min-width: 1280px;
}

.unmatched-bulk-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
}

.unmatched-row-check {
  width: 16px;
  height: 16px;
}

.raw-quote-cell {
  white-space: pre-wrap;
  min-width: 360px;
  max-width: 620px;
  line-height: 1.45;
}

.memory-sku-input {
  width: 160px;
  min-width: 160px;
  padding: 7px 8px;
}

.lowest-cost-row {
  background: #dcfce7;
}

.lowest-cost-row .price-cell {
  background: #16a34a;
  color: #fff;
  border-radius: 6px;
}

.unmatched-cost-row {
  background: #fef3c7;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 3600;
  background: #111827;
  color: white;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 360px;
}

.error-recovery-modal {
  z-index: 4100;
  padding: 18px;
  background: rgba(17, 24, 39, 0.62);
}

.error-recovery-card {
  width: min(620px, calc(100vw - 36px));
  max-height: min(760px, calc(100dvh - 36px));
  overflow: auto;
  border-top: 4px solid #dc2626;
}

.error-recovery-modal.is-recovered .error-recovery-card { border-top-color: #15803d; }
.error-recovery-modal.is-write-pending .error-recovery-card { border-top-color: #d97706; }
.error-recovery-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.error-recovery-head h3 { margin: 2px 0 0; font-size: 20px; }
.error-recovery-kicker { color: #b91c1c; font-size: 12px; font-weight: 700; }
.error-recovery-modal.is-recovered .error-recovery-kicker { color: #166534; }
.error-recovery-modal.is-write-pending .error-recovery-kicker { color: #92400e; }
.error-recovery-live { flex: 0 0 auto; color: #6b7280; font-size: 12px; }
.error-recovery-summary { margin: 14px 0; color: #374151; line-height: 1.6; overflow-wrap: anywhere; }
.error-recovery-meta { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; padding: 12px; background: #f3f4f6; border-radius: 6px; }
.error-recovery-meta span:last-child { grid-column: 1 / -1; }
.error-recovery-meta span { min-width: 0; color: #374151; font-size: 12px; overflow-wrap: anywhere; }
.error-recovery-meta b { display: block; margin-bottom: 3px; color: #6b7280; font-weight: 600; }
.error-recovery-diagnosis { margin-top: 14px; border: 1px solid #e5e7eb; border-radius: 6px; overflow: hidden; }
.error-recovery-diagnosis-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 12px; background: #f9fafb; }
.error-recovery-diagnosis-head span { color: #6b7280; font-size: 12px; text-align: right; }
.error-recovery-check { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-top: 1px solid #e5e7eb; font-size: 13px; }
.error-recovery-check b { color: #6b7280; font-weight: 600; text-align: right; }
.error-recovery-check.ok b { color: #166534; }
.error-recovery-check.error b { color: #b91c1c; }
.error-recovery-check.checking b { color: #1d4ed8; }
.error-recovery-actions { flex-wrap: wrap; }

@media (max-width: 640px) {
  .error-recovery-modal { align-items: flex-end; padding: 10px; }
  .error-recovery-card { width: 100%; max-height: calc(100dvh - 20px); padding: 16px; }
  .error-recovery-head { gap: 8px; }
  .error-recovery-meta { grid-template-columns: 1fr; }
  .error-recovery-meta span:last-child { grid-column: auto; }
  .error-recovery-diagnosis-head { align-items: flex-start; flex-direction: column; }
  .error-recovery-diagnosis-head span { text-align: left; }
  .error-recovery-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .error-recovery-actions button { width: 100%; min-width: 0; }
}

@media (max-width: 1240px) {
  .dashboard-alert-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-top-row {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-trend-card {
    grid-column: 1 / -1;
  }

  .intake-form {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .intake-left {
    padding-bottom: 0;
  }

  .intake-form .sheet-smart,
  .intake-form .sheet-bottom,
  .intake-form .manual-model-memory-panel {
    grid-column: auto;
    grid-row: auto;
  }
  .smart-meta-row {
    grid-template-columns: 1fr;
  }

  .intake-form .sheet-smart textarea {
    min-height: 220px;
  }
}

@media (min-width: 1241px) {
  #dashboardPage .dashboard-scope { margin-bottom: 6px; padding: 4px 8px; }
  #dashboardPage .dashboard-target-panel,
  #dashboardPage .dashboard-operating-panel,
  #dashboardPage .dashboard-alert-panel { margin-bottom: 6px; padding: 7px 9px; }
  #dashboardPage .dashboard-operating-head,
  #dashboardPage .dashboard-alert-head { margin-bottom: 5px; }
  #dashboardPage .dashboard-target-people,
  #dashboardPage .dashboard-operating-head { display: none; }
  #dashboardPage .dashboard-target-periods { margin-top: 5px; }
  #dashboardPage .dashboard-target-period { padding: 4px 6px; }
  #dashboardPage .dashboard-alert-head p { display: none; }
  #dashboardPage .dashboard-alert-head strong { min-width: 24px; width: 24px; height: 24px; }
  #dashboardPage .dashboard-operating-card { padding: 6px 8px; }
  #dashboardPage .dashboard-operating-card strong { margin-top: 2px; font-size: 17px; }
  #dashboardPage .dashboard-alert-block { padding: 6px 8px; }
  #dashboardPage .stats { gap: 6px; margin-bottom: 6px; }
  #dashboardPage .stat-card { padding: 7px 10px; }
  #dashboardPage .stat-card strong { margin-top: 2px; font-size: 19px; }
  #dashboardPage .dashboard-top-row,
  #dashboardPage .dashboard-analysis-grid { gap: 6px; margin-bottom: 6px; }
  #dashboardPage .analysis-card { padding: 7px 9px; }
  #dashboardPage .analysis-card h3 { margin-bottom: 4px; font-size: 13px; }
  #dashboardPage .dashboard-column-chart { height: 72px; padding-top: 2px; }
  #dashboardPage .dashboard-trend-card .dashboard-line-chart svg,
  #dashboardPage .dashboard-line-chart svg { height: 62px; }
  #dashboardPage .dashboard-line-legend { display: none; }
  #dashboardPage .dashboard-empty { min-height: 72px; }
  #dashboardPage .dashboard-pie { width: 58px; }
  #dashboardPage .dashboard-pie-layout { grid-template-columns: 58px minmax(0, 1fr); }
  #dashboardPage .dashboard-legend { gap: 3px; }
  #dashboardPage .dashboard-legend-item { grid-template-columns: 8px minmax(0, 1fr) auto; gap: 3px 5px; }
  #dashboardPage .dashboard-legend-item em { grid-column: 3; grid-row: 1; font-size: 10px; }
}

@media (max-width: 900px) {
  .dashboard-target-periods {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    height: auto;
    flex-wrap: wrap;
  }
  nav {
    order: 3;
    flex-basis: 100%;
  }
  .form-grid, .split, .stats, .master-grid, .procurement-cost-layout, .finance-layout {
    grid-template-columns: 1fr;
  }
  .finance-confirm-panel {
    position: static;
  }
  #financeList,
  #financeForm,
  .purchase-template-panel {
    grid-column: auto;
    grid-row: auto;
  }
  .finance-stat-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
  .dashboard-analysis-grid,
  .dashboard-top-row,
  .dashboard-alert-grid,
  .dashboard-alert-settings,
  .dashboard-target-form,
  .customer-master-form,
  .customer-doc-grid,
  .application-top-row,
  .application-form-grid,
  .application-doc-grid {
    grid-template-columns: 1fr;
  }
  .analysis-card,
  .analysis-card-wide,
  .analysis-card-full {
    grid-column: auto;
  }
  .dashboard-pie-layout {
    grid-template-columns: 112px minmax(0, 1fr);
  }
  .dashboard-pie {
    width: 112px;
  }
.dashboard-alert-settings {
    align-items: stretch;
  }
  .application-form-grid .wide {
    grid-column: auto;
  }
  .master-menu-shell {
    grid-template-columns: 1fr;
  }
  .master-menu {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .master-menu-title {
    grid-column: 1 / -1;
  }
  .order-form-sheet {
    display: grid;
    grid-template-columns: 1fr;
  }
  .order-form-sheet > label,
  .order-form-sheet > .form-actions,
  .order-form-sheet > .smart-input-block {
    grid-column: auto;
    grid-row: auto;
  }
  .intake-form {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .intake-form .sheet-smart,
  .intake-form .sheet-bottom,
  .intake-form .manual-model-memory-panel {
    grid-column: auto;
    grid-row: auto;
  }
  .intake-form .sheet-smart textarea {
    min-height: 220px;
  }
  .smart-clear-btn {
    min-width: 76px;
  }
  .intake-actions {
    grid-template-columns: 1fr 1fr;
  }
  .wide, .full, .address-field, .model-field { grid-column: auto; }
  .form-actions { display: block; }
  .submit-detail-row { grid-template-columns: 1fr; }
  .action-buttons { display: grid; grid-template-columns: 1fr 1fr; }
  .toolbar, .inline-form { grid-template-columns: 1fr; }
  .cost-form-grid { grid-template-columns: 1fr; }
  .batch-command-row { grid-template-columns: 1fr; }
  .batch-bulk-tools {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    justify-content: stretch;
  }
  .table-action-bar { display: grid; }
  .table-action-bar .primary { width: 100%; }
  .section-head { display: grid; }
  .batch-actions { justify-content: stretch; }
  .export-column-list { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .intake-fields,
  .manual-memory-row,
  .batch-bulk-tools,
  .intake-actions,
  .action-buttons {
    grid-template-columns: 1fr;
  }
  .contract-preview-doc {
    padding: 14px 12px;
    font-size: 11px;
  }
  .contract-party-info td {
    display: block;
    width: 100%;
  }
  .smart-input-head {
    align-items: stretch;
  }
}

.cost-column-filter {
  width: 100%;
  min-width: 52px;
  box-sizing: border-box;
  height: 22px;
  padding: 2px 4px;
  border: 0;
  border-bottom: 1px solid #cbd5e1;
  border-radius: 0;
  font-size: 11px;
  background: transparent;
  outline: none;
  color: #475569;
}

.cost-column-filter:focus {
  border-bottom-color: var(--primary);
  background: #fff;
}

.cost-column-filter::placeholder {
  color: #94a3b8;
}

.procurement-table {
  min-width: 1450px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

@media (max-width: 1200px) {
  .procurement-cost-layout {
    grid-template-columns: 1fr;
  }
}

.procurement-table th,
.procurement-table td {
  white-space: nowrap;
  border-right: 1px solid #d9e2ec;
  border-bottom: 1px solid #d9e2ec;
  padding: 5px 6px;
  background: #fff;
  vertical-align: middle;
}

.procurement-table th {
  position: sticky;
  top: var(--procurement-fixed-head-height, 0px);
  z-index: 2;
  background: #eef3f8;
}

.procurement-table .address-cell {
  white-space: nowrap;
  min-width: 260px;
  max-width: 460px;
}

.procurement-table .model-text-cell {
  white-space: nowrap;
  min-width: 180px;
  max-width: 320px;
}

.procurement-input {
  width: 100%;
  max-width: none;
  min-width: 92px;
  padding: 4px 5px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  box-sizing: border-box;
  font-size: 12px;
}

/* 表格内可编辑控件与单元格融为一体，只保留单元格边框，不再显示独立输入框。 */
.order-query-table .order-inline-input,
.procurement-table .procurement-input {
  border: 0;
  border-radius: 0;
  padding: 2px 0;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
  cursor: default;
}

.order-query-table .order-inline-input:focus,
.procurement-table .procurement-input:focus {
  outline: 0;
  box-shadow: none;
}

.order-query-table td.order-query-cell-editing .order-inline-input {
  pointer-events: auto;
  cursor: text;
}

.procurement-table td.procurement-cell-editing .procurement-input,
.procurement-table td.procurement-cell-editing .single-date-trigger {
  pointer-events: auto;
  cursor: text;
}

.procurement-table td.procurement-cell-editing .single-date-trigger {
  cursor: pointer;
}

/* 采购字段恢复为可直接点击输入的控件，并保留候选下拉浮层。 */
.procurement-table td[data-procurement-key="supplier"] .procurement-input,
.procurement-table td[data-procurement-key="cost_price"] .procurement-input,
.procurement-table td[data-procurement-key="warehouse"] .procurement-input,
.procurement-table td[data-procurement-key="logistics"] .procurement-input,
.procurement-table td[data-procurement-key="handler"] .procurement-input,
.procurement-table td[data-procurement-key="purchase_tax"] .procurement-input {
  pointer-events: auto;
  cursor: pointer;
  border: 0;
  border-radius: 0;
  padding: 2px 0;
  background: transparent;
}

.procurement-table td[data-procurement-key="supplier"] .procurement-input,
.procurement-table td[data-procurement-key="cost_price"] .procurement-input,
.procurement-table td[data-procurement-key="warehouse"] .procurement-input,
.procurement-table td[data-procurement-key="logistics"] .procurement-input,
.procurement-table td[data-procurement-key="handler"] .procurement-input {
  cursor: text;
}

/* 已处理与已确认订单的关键采购字段保持整行状态色，避免输入框白色背景切断颜色。 */
#procurementList tr.procurement-confirmed-row > td[data-procurement-key="supplier"] .procurement-input,
#procurementList tr.procurement-confirmed-row > td[data-procurement-key="cost_price"] .procurement-input,
#procurementList tr.procurement-confirmed-row > td[data-procurement-key="warehouse"] .procurement-input,
#procurementList tr.procurement-confirmed-row > td[data-procurement-key="logistics"] .procurement-input {
  background: var(--procurement-color-confirmed);
  color: #14532d;
  border-color: #65a30d;
}

#procurementList tr.procurement-handled-row > td[data-procurement-key="supplier"] .procurement-input,
#procurementList tr.procurement-handled-row > td[data-procurement-key="cost_price"] .procurement-input,
#procurementList tr.procurement-handled-row > td[data-procurement-key="warehouse"] .procurement-input,
#procurementList tr.procurement-handled-row > td[data-procurement-key="logistics"] .procurement-input {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

#procurementList tr.procurement-confirmed-row:hover > td[data-procurement-key="supplier"] .procurement-input,
#procurementList tr.procurement-confirmed-row:hover > td[data-procurement-key="cost_price"] .procurement-input,
#procurementList tr.procurement-confirmed-row:hover > td[data-procurement-key="warehouse"] .procurement-input,
#procurementList tr.procurement-confirmed-row:hover > td[data-procurement-key="logistics"] .procurement-input {
  background: var(--procurement-color-confirmed);
  border-color: #65a30d;
}

#procurementList tr.procurement-handled-row:hover > td[data-procurement-key="supplier"] .procurement-input,
#procurementList tr.procurement-handled-row:hover > td[data-procurement-key="cost_price"] .procurement-input,
#procurementList tr.procurement-handled-row:hover > td[data-procurement-key="warehouse"] .procurement-input,
#procurementList tr.procurement-handled-row:hover > td[data-procurement-key="logistics"] .procurement-input {
  background: #d1fae5;
  border-color: #86efac;
}

.procurement-cost-input {
  width: 88px;
  min-width: 88px;
}

.procurement-supplier-input {
  min-width: 140px;
}

.procurement-table .select-col {
  width: 38px;
  min-width: 38px;
  max-width: 38px;
  padding: 6px 4px;
  text-align: center;
  vertical-align: middle;
  overflow: visible;
}

.procurement-table th.select-col {
  z-index: 5;
  background: #e8f0f5;
}

.procurement-table .select-col input[type="checkbox"] {
  width: 14px;
  min-width: 14px;
  height: 14px;
  margin: 0 auto;
  padding: 0;
  display: block;
}

.procurement-table thead .select-col,
.procurement-table tbody .select-col {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  padding-left: 4px;
  padding-right: 4px;
}

.procurement-table .procurement-row-num-col {
  width: 54px;
  min-width: 54px;
  padding: 6px 8px;
  text-align: center;
  color: #587083;
  background: #f8fbfd;
}

.procurement-table thead .procurement-row-num-col {
  background: #e8f0f5;
}

.procurement-column-filter {
  width: 100%;
  min-width: 54px;
  box-sizing: border-box;
  border: 1px solid #d6e0ea;
  border-radius: 5px;
  padding: 4px 6px;
  font-size: 12px;
}

.procurement-table .compact-number-cell,
.procurement-table .compact-money-cell {
  width: 88px;
  min-width: 78px;
  max-width: 108px;
}

.procurement-table .compact-select-cell {
  width: 132px;
  min-width: 116px;
  max-width: 170px;
}

.procurement-table .compact-date-cell {
  width: 70px;
  min-width: 64px;
  max-width: 78px;
}

.procurement-table .compact-date-cell,
.order-query-table .compact-date-cell {
  width: 78px;
  min-width: 72px;
  max-width: none;
}

.procurement-table .compact-number-cell {
  width: 54px;
  min-width: 48px;
  max-width: 64px;
}

.procurement-table .compact-receiver-cell {
  width: 78px;
  min-width: 64px;
  max-width: 110px;
}

.procurement-table .compact-phone-cell {
  width: 120px;
  min-width: 110px;
  max-width: 136px;
}

.procurement-table .compact-customer-cell {
  width: 108px;
  min-width: 86px;
  max-width: 136px;
}

.procurement-table .compact-warehouse-cell,
.procurement-table .compact-logistics-cell {
  width: 124px;
  min-width: 108px;
  max-width: 160px;
}

.procurement-table .compact-tax-cell {
  width: 78px;
  min-width: 66px;
  max-width: 94px;
}

.procurement-table .compact-status-cell {
  width: 84px;
  min-width: 76px;
  max-width: 104px;
}

.procurement-table .compact-handler-cell {
  width: 72px;
  min-width: 62px;
  max-width: 96px;
}

.procurement-table .compact-note-cell {
  width: 132px;
  min-width: 108px;
  max-width: 172px;
  white-space: nowrap;
  vertical-align: middle;
}

.procurement-wrap-text {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-size: 11px;
  line-height: 1.2;
  color: #334155;
  padding-bottom: 2px;
}

.procurement-table .compact-number-cell .procurement-input,
.procurement-table .compact-money-cell .procurement-input {
  min-width: 72px;
  max-width: 100%;
  padding-left: 5px;
  padding-right: 5px;
}

.procurement-table .compact-number-cell .procurement-input {
  min-width: 46px;
  max-width: 100%;
}

.procurement-table .compact-select-cell .procurement-input {
  min-width: 108px;
  max-width: 100%;
}

.procurement-input.procurement-recommended-placeholder::placeholder {
  color: #15803d;
  font-weight: 700;
  opacity: 1;
}

.procurement-table .compact-date-cell .procurement-input,
.procurement-table .compact-receiver-cell .procurement-input {
  min-width: 58px;
  max-width: 96px;
}

.procurement-table .compact-date-cell .procurement-input,
.procurement-table .compact-date-cell .single-date-trigger {
  min-width: 58px;
  max-width: 70px;
  padding-left: 4px;
  padding-right: 4px;
}

.procurement-table .compact-note-cell .procurement-input {
  min-width: 104px;
  max-width: 164px;
  white-space: nowrap;
}

.procurement-table .compact-phone-cell .procurement-input {
  min-width: 104px;
  max-width: 128px;
}

.procurement-table .compact-customer-cell .procurement-input {
  min-width: 82px;
  max-width: 124px;
}

.procurement-table .compact-warehouse-cell .procurement-input,
.procurement-table .compact-logistics-cell .procurement-input {
  min-width: 104px;
  max-width: 152px;
}

.procurement-table .compact-tax-cell .procurement-input,
.procurement-table .compact-status-cell .procurement-input,
.procurement-table .compact-handler-cell .procurement-input {
  min-width: 58px;
  max-width: 92px;
}

.procurement-table .compact-status-cell .pill {
  padding: 2px 5px;
  font-size: 11px;
  border-radius: 6px;
}

.procurement-row-actions button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.recommend-cell {
  color: #15803d;
  font-weight: 700;
}

.procurement-cancel-row td {
  background: var(--procurement-color-cancel-pending);
}

.procurement-cancel-done-row td {
  background: var(--order-color-closed);
  color: #94a3b8;
}

.procurement-cancel-done-row .procurement-input,
.procurement-cancel-done-row .pill {
  color: #94a3b8;
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.procurement-cancel-done-row .procurement-row-check {
  cursor: not-allowed;
}

.procurement-row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.procurement-table {
  width: max-content;
  min-width: 1280px;
  table-layout: auto;
}

.procurement-table-wrap {
  padding-left: 0;
}

.procurement-table .select-col {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  box-sizing: border-box;
  background: #fff;
}

.procurement-table thead .select-col {
  z-index: 7;
  background: #e8f0f5;
}

.inventory-page-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}

.inventory-drawer {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  margin-bottom: 10px;
  overflow: hidden;
}

.inventory-drawer summary {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  color: #0f172a;
  background: #f8fafc;
  border-bottom: 1px solid transparent;
}

.inventory-drawer summary::-webkit-details-marker {
  display: none;
}

.inventory-drawer summary::before {
  content: "▸";
  display: inline-block;
  width: 18px;
  color: #64748b;
  transition: transform .15s ease;
}

.inventory-drawer[open] summary {
  border-bottom-color: #e2e8f0;
}

.inventory-drawer[open] summary::before {
  transform: rotate(90deg);
}

.inventory-drawer-body {
  padding: 10px 12px 12px;
}

.inventory-form {
  display: grid;
  grid-template-columns: 120px 92px minmax(240px, 1.4fr) 140px minmax(220px, 1fr) 160px 86px 110px 140px minmax(200px, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin: 0 0 8px;
}

/* 手工出库字段固定为两行五列，避免继承入库宽表网格后隐藏提交按钮。 */
#inventoryOutboundForm {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.inventory-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #475569;
}

.inventory-form input,
.inventory-form select {
  min-height: 32px;
  padding: 6px 8px;
}

.inventory-serial-mode-toggle,
.inventory-serial-issue-toggle {
  flex-direction: row !important;
  align-items: center;
  min-height: 32px;
  white-space: nowrap;
}

.inventory-serial-mode-toggle input,
.inventory-serial-issue-toggle input {
  min-height: 0;
  width: 16px;
  height: 16px;
  margin: 0;
}

.inventory-serial-fields {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, auto);
  gap: 10px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-left: 3px solid #2563eb;
  background: #f8fbff;
}

.inventory-serial-fields.hidden,
.inventory-serial-issue-fields.hidden {
  display: none;
}

.inventory-serial-fields-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: #334155;
  font-size: 12px;
}

.inventory-serial-fields-head span {
  color: #64748b;
}

.inventory-serial-attachments,
.inventory-serial-issue-fields {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.inventory-serial-issue-fields {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.inventory-serial-issue-fields .wide {
  grid-column: 1 / -1;
}

.inventory-serial-preview {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}

.inventory-serial-preview-item {
  display: inline-flex;
  align-items: center;
  max-width: 260px;
  padding: 5px 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.inventory-table [data-inventory-serial-detail] {
  display: block;
  margin-top: 4px;
}

.inventory-serial-detail-summary {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
  padding: 10px;
  border-left: 3px solid #2563eb;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
}

.procurement-serial-column {
  min-width: 170px;
  max-width: 260px;
}

.procurement-serial-picker {
  display: grid;
  gap: 6px;
  align-items: start;
}

.procurement-serial-selection,
.procurement-serial-readonly,
.procurement-serial-not-required {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.procurement-serial-options {
  display: grid;
  gap: 5px;
  min-width: 230px;
  max-height: 220px;
  padding: 8px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .12);
}

.procurement-serial-options-head,
.procurement-serial-option {
  display: flex;
  align-items: center;
  gap: 7px;
}

.procurement-serial-options-head {
  justify-content: space-between;
  position: sticky;
  top: -8px;
  padding: 4px 0;
  background: var(--panel);
  z-index: 1;
}

.procurement-serial-option {
  padding: 5px 6px;
  border-radius: 6px;
  background: var(--bg);
  cursor: pointer;
}

.procurement-serial-option span {
  flex: 1;
  overflow-wrap: anywhere;
}

.procurement-serial-option em {
  color: var(--primary);
  font-size: 11px;
  font-style: normal;
}

.procurement-serial-option.has-issue em {
  color: var(--danger);
}

.inventory-product-hint {
  min-height: 20px;
  margin: 2px 0 8px;
}

.inventory-batch-panel {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  margin: 8px 0 10px;
  background: #f8fafc;
}

.inventory-batch-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.inventory-batch-head strong {
  margin-right: 8px;
}

.inventory-batch-panel textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
}

.inventory-batch-summary {
  margin: 8px 0 6px;
  font-size: 13px;
  color: #475569;
}

.danger-text {
  color: #b91c1c !important;
}

.inventory-batch-preview table {
  min-width: 1280px;
}

.inventory-batch-invalid td {
  background: #fff7ed;
}

.inventory-batch-raw {
  white-space: normal;
  min-width: 260px;
  max-width: 520px;
  line-height: 1.45;
}

.inventory-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 8px;
}

.inventory-toolbar input,
.inventory-toolbar select {
  max-width: 420px;
  min-height: 32px;
  padding: 6px 8px;
}

.inventory-toolbar select {
  max-width: 180px;
}

.inventory-check-filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 8px;
  font-size: 13px;
  color: #475569;
  white-space: nowrap;
}

.inventory-check-filter input {
  width: 14px;
  height: 14px;
  min-height: 0;
  padding: 0;
}

.dashboard-alert-config {
  margin-bottom: 8px;
}

.dashboard-alert-config > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-alert-config[open] > summary {
  margin-bottom: 8px;
}

.inventory-details-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0;
}

.pagination-actions {
  display: inline-flex;
  gap: 6px;
}

.export-request-panel {
  margin-top: 12px;
}

.export-request-modal-card {
  width: min(1120px, calc(100vw - 36px));
}

#orderExportHistoryModal,
#orderExportReviewModal {
  z-index: 3100;
}

html[data-app-environment="test"] #orderExportHistoryModal,
html[data-app-environment="test"] #orderExportReviewModal {
  inset: 36px 0 0;
}

.export-request-modal-content {
  margin-top: 16px;
}

.export-request-modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.export-request-modal-table table {
  min-width: 760px;
}

.export-request-modal-table td:last-child {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .export-request-modal-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .export-request-modal-toolbar button {
    width: 100%;
  }
}

.export-request-empty {
  padding: 10px 0;
}

.inventory-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 6px 0 8px;
  font-size: 13px;
  color: #475569;
}

.inventory-stats strong,
.inventory-stock {
  color: #0f172a;
  font-weight: 700;
}

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

.inventory-pending-chip {
  display: inline-flex;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 999px;
  background: #fffbeb;
  color: #b45309;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

.inventory-table table {
  width: max-content;
  min-width: 1120px;
  table-layout: auto;
}

.inventory-table th,
.inventory-table td {
  white-space: nowrap;
}

.inventory-table .inventory-warehouse-cell {
  white-space: normal;
  min-width: 220px;
  max-width: 420px;
  line-height: 1.45;
}

.inventory-table .inventory-total-stock-cell,
.inventory-table .inventory-warehouse-stock-cell,
.inventory-table .inventory-warehouse-stock-head {
  min-width: 72px;
  max-width: 96px;
  text-align: right;
}

.inventory-table .number-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.invoice-inventory-table table {
  min-width: 1180px;
}

.invoice-inventory-table .small-btn {
  min-height: 24px;
  padding: 3px 7px;
  white-space: nowrap;
}

.invoice-inventory-date-filter,
.inventory-date-filter {
  display: grid;
  grid-template-columns: repeat(2, 132px);
  gap: 4px;
  min-width: 268px;
}

.invoice-inventory-header-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 400;
  white-space: nowrap;
}

.invoice-inventory-header-check input {
  flex: 0 0 auto;
  width: 14px;
  min-width: 14px;
  height: 14px;
  min-height: 14px;
  margin: 0;
  padding: 0;
}

.inventory-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
}

.inventory-range-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(64px, 1fr));
  gap: 4px;
  min-width: 136px;
}

.finance-header-filter-cell .inventory-range-filter input:not([type="checkbox"]) {
  min-width: 64px;
  height: 28px;
  padding: 3px 5px;
}

.inventory-date-range-filter {
  grid-template-columns: repeat(2, 132px);
  min-width: 268px;
}

.finance-header-filter-cell .inventory-date-range-filter input[type="date"] {
  min-width: 132px;
}

.inventory-review-cell {
  min-width: 150px;
}

.inventory-review-cell .pill {
  margin-right: 4px;
}

.inventory-review-cell .small-btn {
  min-height: 24px;
  padding: 3px 7px;
}

.inventory-in {
  color: #15803d;
  font-weight: 700;
}

.inventory-out,
.inventory-negative .inventory-stock {
  color: #b91c1c;
  font-weight: 700;
}

.inventory-negative td {
  background: #fff1f2;
}

.inventory-review-pending td {
  background: #fff8e6;
}

.inventory-review-rejected td {
  background: #f8fafc;
  color: #64748b;
}

.inventory-log-note {
  margin: 0 0 8px;
}

.inventory-daily-section {
  margin-top: 14px;
}

.inventory-daily-section h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.inventory-daily-empty {
  margin-top: 12px;
}

.receipt-bill-detail > td {
  padding: 8px;
  background: #f8fafc;
}

.receipt-bill-seq-cell {
  white-space: nowrap;
}

.receipt-bill-toggle {
  margin-right: 6px;
  vertical-align: middle;
}

.receipt-bill-seq {
  min-width: 16px;
  display: inline-block;
  font-weight: 700;
  color: #334155;
}

.receipt-order-detail-wrap {
  max-width: 100%;
  background: #fff;
}

.receipt-order-detail-wrap .mini-table {
  min-width: 920px;
}

.receipt-order-detail-wrap th,
.receipt-order-detail-wrap td {
  white-space: nowrap;
}

.receipt-order-detail-wrap .address-cell {
  min-width: 240px;
  white-space: normal;
  line-height: 1.45;
}

.finance-document-review-dialog {
  display: grid;
  gap: 12px;
}

.finance-document-review-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.finance-document-review-summary > div,
.finance-document-review-note,
.finance-document-review-input {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px 10px;
}

.finance-document-review-summary span,
.finance-document-review-note span,
.finance-document-review-input span {
  display: block;
  margin-bottom: 4px;
  color: #64748b;
  font-size: 12px;
}

.finance-document-review-summary strong {
  display: block;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.finance-document-review-note p {
  margin: 0;
  color: #334155;
  line-height: 1.5;
}

.finance-document-review-evidence {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.finance-document-review-orders .mini-table {
  min-width: 1420px;
}

.finance-document-review-input textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
}

.receipt-allocation-wrap {
  display: grid;
  gap: 6px;
}

.receipt-allocation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 12px;
}

.receipt-allocation-table {
  min-width: 1320px;
}

.receipt-allocation-input {
  width: 96px;
  min-height: 26px;
  padding: 3px 6px;
  font-size: 12px;
  text-align: right;
}

.receipt-allocation-blocked {
  color: #b91c1c;
  font-weight: 700;
}

.receipt-allocation-blocked small {
  display: block;
  margin-top: 3px;
  white-space: normal;
  line-height: 1.3;
}

.receipt-allocation-blocked .receipt-allocation-input {
  border-color: #fecaca;
  background: #fff1f2;
  color: #b91c1c;
}

.receipt-submit-hint {
  padding: 9px 10px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff1f2;
  color: #b91c1c;
  font-weight: 700;
}

.receipt-submit-hint[data-type="success"] {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.receipt-balance-positive {
  color: #15803d;
  font-weight: 700;
}

.receipt-balance-negative {
  color: #b91c1c;
  font-weight: 700;
}

.address-unreachable-input {
  border-color: #dc2626 !important;
  background: #fff1f2 !important;
  color: #991b1b !important;
}

@media (max-width: 1200px) {
  .inventory-form {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }

  .freight-city-company-config {
    grid-template-columns: 100px repeat(8, minmax(55px, 1fr)) minmax(160px, 2fr) minmax(160px, 2fr) auto;
  }
}

/* Global adaptive viewport rules: keep pages usable on low-resolution screens. */
html {
  min-width: 0;
}

body,
#appView,
.app {
  min-width: 0;
}

.app {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}

.main {
  min-height: 0;
  overflow: auto;
  max-width: 100vw;
}

.main.table-scroll-page {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

html.table-scroll-page {
  overflow: hidden;
}

html.table-scroll-page body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

html.table-scroll-page #appView {
  height: calc(100vh - var(--app-top-offset));
  height: calc(100dvh - var(--app-top-offset));
}

.main.table-scroll-page > .topbar {
  flex: 0 0 auto;
}

.main.table-scroll-page > #orderQueryPage:not(.hidden),
.main.table-scroll-page > #procurementPage:not(.hidden) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#orderQueryPage > .order-workbench-table,
#procurementPage > .order-workbench-table {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#ordersTable,
#procurementList {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#ordersTable > .order-render-footer,
#ordersTable > .procurement-render-footer,
#ordersTable > .order-pagination,
#procurementList > .procurement-render-footer {
  flex: 0 0 auto;
}

.order-render-footer,
.procurement-render-footer {
  min-height: 24px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background: var(--panel-bg, #fff);
  border-top: 1px solid var(--line, #e2e8f0);
  font-size: 12px;
}

.page,
.panel,
.table-card,
.stat-card,
.workspace-menu-shell,
.workspace-menu-content,
.master-menu-shell,
.master-menu-content,
.finance-section,
.inventory-drawer,
.finance-drawer {
  min-width: 0;
  max-width: 100%;
}

.toolbar,
.section-head,
.table-action-bar,
.finance-filter-toolbar,
.inventory-toolbar,
.procurement-top-toolbar,
.procurement-bulk-toolbar,
.cost-table-toolbar,
.master-actions,
.inventory-page-actions,
.finance-freight-tools {
  max-width: 100%;
  flex-wrap: wrap;
}

/* 桌面端表头优先保持标题、图例和操作区同排，窄屏交给响应式规则换行。 */
@media (min-width: 901px) {
  .section-head {
    flex-wrap: nowrap;
  }

  .section-head > .table-action-bar {
    flex: 0 0 auto;
    min-width: max-content;
    flex-wrap: nowrap;
  }

  #orderQueryPage .order-query-head .table-action-bar {
    flex: 0 0 auto;
    min-width: max-content;
  }

  .procurement-top-toolbar .procurement-status-color-legend {
    margin-bottom: 0;
  }
}

.table-wrap,
.mini-table-wrap,
.contract-table-wrap,
.finance-summary-wrap,
.finance-order-wrap,
.finance-purchase-wrap,
.finance-freight-wrap,
.finance-profit-table-wrap,
.procurement-table-wrap,
.master-product-wrap,
.customer-master-wrap,
.master-application-wrap,
.inventory-table,
.invoice-inventory-table,
.inventory-batch-preview,
.receipt-order-detail-wrap,
.usd-quote-table-wrap,
.user-table-wrap {
  max-width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap table,
.mini-table-wrap table,
.contract-table,
.finance-summary-table,
.finance-order-table,
.finance-purchase-table,
.finance-freight-table,
.finance-profit-table,
.procurement-table,
.master-product-table,
.customer-master-table,
.master-application-table,
.inventory-table table,
.invoice-inventory-table table,
.receipt-order-detail-wrap table,
.usd-quote-table,
.user-table {
  max-width: none;
}

#financeList .table-wrap,
#financeList .finance-summary-wrap,
#financeList .finance-order-wrap,
#financeList .finance-purchase-wrap,
#financeList .finance-freight-wrap,
#financeList .finance-profit-table-wrap,
#financeList .receipt-order-detail-wrap {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

#financeList .finance-content-stack,
#financeList .finance-overview-section,
#financeList .workspace-menu-content {
  overflow-y: visible;
}

.modal-backdrop {
  padding: 12px;
  align-items: flex-start;
  overflow: auto;
}

.modal-card,
.contract-modal,
.contract-preview-modal,
.purchase-contract-modal,
.product-master-modal,
.product-detail-modal,
.master-import-modal,
.company-master-edit-modal,
.image-preview-modal {
  width: min(var(--adaptive-modal-width, 980px), calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
}

.contract-preview-modal,
.purchase-contract-modal,
.contract-image-editor-modal,
.image-preview-modal {
  overflow: hidden;
}

.contract-preview-box,
.contract-preview-box.large,
.purchase-contract-preview-box,
.image-preview-body {
  min-height: 0;
  max-height: calc(100vh - 128px);
  max-height: calc(100dvh - 128px);
  overflow: auto;
}

.user-editor-panel {
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
}

@media (max-width: 1180px) {
  .topbar {
    align-items: stretch;
  }

  .order-form-sheet,
  .form-grid,
  .product-master-form,
  .customer-master-form,
  .master-application-form,
  .inventory-form,
  .company-master-edit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .intake-left,
  .sheet-smart,
  .form-actions,
  .smart-input-block,
  .company-master-edit-wide {
    grid-column: 1 / -1;
  }

  .workspace-menu-shell,
  .master-menu-shell,
  .finance-layout,
  .procurement-cost-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .app {
    grid-template-rows: auto minmax(0, 1fr);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .sidebar {
    position: sticky;
    top: 0;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 6px;
    width: 100%;
    min-width: 0;
    max-width: 100vw;
  }

  .brand {
    flex: 1 1 0;
    overflow: visible;
  }

  nav {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    overflow: visible;
  }

  .nav-group {
    flex: 0 0 auto;
  }

  .nav-submenu {
    max-width: min(86vw, 260px);
  }

  .main {
    padding: 8px;
  }

  .topbar,
  .section-head,
  .section-head.compact,
  .order-query-head,
  .inventory-batch-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .topbar > *,
  .section-head > *,
  .table-action-bar,
  .toolbar {
    min-width: 0;
  }

  .table-action-bar,
  .toolbar,
  .finance-filter-toolbar,
  .inventory-toolbar,
  .cost-table-toolbar,
  .batch-command-row,
  .batch-bulk-tools,
  .batch-submit-tools,
  .procurement-bulk-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 6px;
  }

  .table-action-bar > *,
  .toolbar > *,
  .finance-filter-toolbar > *,
  .inventory-toolbar > *,
  .cost-table-toolbar > *,
  .batch-bulk-tools > *,
  .procurement-bulk-toolbar > * {
    flex: 1 1 150px;
    min-width: 0;
  }

  .order-form-sheet,
  .form-grid,
  .product-master-form,
  .customer-master-form,
  .master-application-form,
  .inventory-form,
  .company-master-edit-grid,
  .finance-stat-grid,
  .finance-profit-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .modal-backdrop {
    padding: 6px;
  }

  .modal-card,
  .contract-modal,
  .contract-preview-modal,
  .purchase-contract-modal,
  .product-master-modal,
  .product-detail-modal,
  .master-import-modal,
  .company-master-edit-modal,
  .image-preview-modal {
    width: calc(100vw - 12px);
    max-width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
    max-height: calc(100dvh - 12px);
  }

  .modal-actions {
    flex-wrap: wrap;
  }

  .modal-actions > button {
    flex: 1 1 120px;
  }

  .user-editor-panel {
    inset: 6px;
    width: auto;
    max-height: calc(100vh - 12px);
    max-height: calc(100dvh - 12px);
  }
}

@media (max-width: 560px) {
  .login-panel,
  .panel,
  .table-card,
  .stat-card {
    padding: 10px;
  }

  .main {
    padding: 6px;
  }

  .order-query-fixed-head,
  .procurement-fixed-head {
    margin-right: -10px;
    margin-left: -10px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .topbar h2 {
    font-size: 18px;
  }

  .table-action-bar > *,
  .toolbar > *,
  .finance-filter-toolbar > *,
  .inventory-toolbar > *,
  .cost-table-toolbar > *,
  .batch-bulk-tools > *,
  .procurement-bulk-toolbar > *,
  .primary,
  .ghost {
    flex-basis: 100%;
  }

  input,
  select,
  textarea,
  button {
    min-width: 0;
  }
}

@media (max-height: 720px) {
  .main {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .topbar {
    margin-bottom: 6px;
  }

  .panel {
    padding: 10px;
  }

  .modal-backdrop {
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .modal-card,
  .contract-modal,
  .contract-preview-modal,
  .purchase-contract-modal,
  .product-master-modal,
  .product-detail-modal,
  .master-import-modal,
  .company-master-edit-modal,
  .image-preview-modal {
    max-height: calc(100vh - 8px);
    max-height: calc(100dvh - 8px);
  }

  .contract-preview-box,
  .contract-preview-box.large,
  .purchase-contract-preview-box,
  .image-preview-body {
    max-height: calc(100vh - 104px);
    max-height: calc(100dvh - 104px);
  }
}

/* Desktop-scale mode: when viewport width is insufficient, keep the desktop
   layout and scale the whole app instead of wrapping controls into extra rows. */
body.app-scale-active {
  overflow: hidden;
}

body.app-scale-active #appView {
  transform-origin: 0 0;
  min-width: 1440px;
  max-width: none;
}

body.app-scale-active .modal-backdrop {
  width: var(--app-scaled-width);
  height: var(--app-scaled-height);
  max-width: none;
  max-height: none;
  transform: scale(var(--app-scale));
  transform-origin: 0 0;
}

body.app-scale-active .modal-card,
body.app-scale-active .contract-modal,
body.app-scale-active .contract-preview-modal,
body.app-scale-active .purchase-contract-modal,
body.app-scale-active .product-master-modal,
body.app-scale-active .product-detail-modal,
body.app-scale-active .master-import-modal,
body.app-scale-active .company-master-edit-modal,
body.app-scale-active .image-preview-modal {
  max-width: calc(1440px - 32px) !important;
}

body.app-scale-active .main {
  max-width: none;
  padding: 10px 12px 14px;
}

body.app-scale-active .sidebar {
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 8px !important;
}

body.app-scale-active nav {
  order: 0 !important;
  flex: 1 1 auto !important;
}

body.app-scale-active .brand {
  flex: 0 0 auto !important;
}

body.app-scale-active .topbar,
body.app-scale-active .section-head,
body.app-scale-active .section-head.compact,
body.app-scale-active .order-query-head,
body.app-scale-active .inventory-batch-head {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  grid-template-columns: none !important;
}

body.app-scale-active .toolbar,
body.app-scale-active .section-head,
body.app-scale-active .table-action-bar,
body.app-scale-active .finance-filter-toolbar,
body.app-scale-active .inventory-toolbar,
body.app-scale-active .procurement-top-toolbar,
body.app-scale-active .procurement-bulk-toolbar,
body.app-scale-active .cost-table-toolbar,
body.app-scale-active .master-actions,
body.app-scale-active .inventory-page-actions,
body.app-scale-active .finance-freight-tools,
body.app-scale-active .batch-bulk-tools,
body.app-scale-active .batch-submit-tools,
body.app-scale-active .finance-overview-actions,
body.app-scale-active .modal-actions {
  flex-wrap: nowrap !important;
}

body.app-scale-active .inventory-toolbar {
  flex-wrap: wrap !important;
}

body.app-scale-active .table-action-bar > *,
body.app-scale-active .toolbar > *,
body.app-scale-active .finance-filter-toolbar > *,
body.app-scale-active .inventory-toolbar > *,
body.app-scale-active .cost-table-toolbar > *,
body.app-scale-active .batch-bulk-tools > *,
body.app-scale-active .procurement-bulk-toolbar > *,
body.app-scale-active .modal-actions > button {
  flex: 0 0 auto !important;
}

body.app-scale-active .finance-filter-toolbar {
  display: grid !important;
  grid-template-columns: 132px 150px 140px 132px 132px 132px 132px minmax(260px, 1fr) auto !important;
}

body.app-scale-active .form-grid {
  grid-template-columns: minmax(170px, .9fr) minmax(170px, .9fr) minmax(220px, 1.2fr) minmax(170px, .9fr) !important;
}

body.app-scale-active .order-form-sheet {
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
}

body.app-scale-active .order-form-sheet > .smart-input-block,
body.app-scale-active .sheet-smart {
  grid-column: 4 / span 2 !important;
}

body.app-scale-active .workspace-menu-shell,
body.app-scale-active .master-menu-shell {
  grid-template-columns: 190px minmax(0, 1fr) !important;
}

body.app-scale-active #financeList .workspace-menu-shell,
body.app-scale-active #financeList .finance-menu-shell {
  grid-template-columns: 132px 210px minmax(0, 1fr) !important;
}

body.app-scale-active .finance-stat-grid,
body.app-scale-active .finance-profit-cards {
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)) !important;
}

body.app-scale-active .inventory-form {
  grid-template-columns: 120px 92px minmax(240px, 1.4fr) 140px minmax(220px, 1fr) 160px 86px 110px 140px minmax(200px, 1fr) auto !important;
}

body.app-scale-active #inventoryOutboundForm {
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
}

body.app-scale-active .application-form-grid,
body.app-scale-active .customer-master-form,
body.app-scale-active .company-master-edit-grid {
  grid-template-columns: repeat(3, minmax(160px, 1fr)) !important;
}

body.app-scale-active .application-form-grid .wide,
body.app-scale-active .company-master-edit-wide {
  grid-column: span 2 !important;
}
/* 客户账单与实时提醒 */
.topbar-actions,
.daily-billing-toolbar,
.daily-billing-actions,
.receipt-screenshot-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.batch-receipt-group-list {
  display: grid;
  gap: 8px;
}

.batch-receipt-group-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid #d8e1e8;
  border-radius: 4px;
  background: #fff;
}

.batch-receipt-group-row div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.batch-receipt-group-row span {
  color: #64748b;
  font-size: 13px;
}

.notification-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #b42318;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.daily-billing-shell {
  display: grid;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
}

.daily-billing-toolbar {
  justify-content: space-between;
  flex-wrap: wrap;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

/* 错误中心属于视口级故障处理界面，不跟随业务工作台的桌面缩放。 */
body.app-scale-active .error-recovery-modal {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  transform: none;
}

body.app-scale-active .error-recovery-card {
  max-width: 620px !important;
}

@media (max-width: 640px) {
  body.app-scale-active .error-recovery-card { max-width: 100% !important; }
}

.daily-billing-filter-bar {
  width: 100%;
  min-width: 0;
  margin-top: 8px;
}

.daily-bill-filter-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.daily-bill-filter-fields #dailyBillKeywordFilter,
.daily-bill-filter-fields #dailyBillClearFiltersBtn {
  grid-column: span 2;
}

.daily-billing-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
  flex: 1 1 680px;
  min-width: 0;
}

.daily-billing-actions button {
  white-space: nowrap;
}

.daily-billing-events,
.daily-billing-customers,
.daily-customer-group,
.daily-bill-table-wrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.daily-bill-table-wrap {
  overflow-x: auto;
}

.daily-billing-stats > div {
  min-width: 0;
  padding: 10px 12px;
  border-left: 3px solid #2563eb;
  background: #f8fafc;
}

.daily-billing-stats span,
.daily-billing-stats strong {
  display: block;
}

.daily-billing-stats span {
  color: #64748b;
  font-size: 12px;
}

.daily-billing-stats strong {
  margin-top: 3px;
  font-size: 18px;
}

.daily-billing-stats .daily-overdue {
  border-left-color: #b42318;
  background: #fff4f2;
  color: #912018;
}

.daily-event-feed,
.daily-customer-group {
  border: 1px solid #d8dee8;
  border-radius: 6px;
  background: #fff;
}

.daily-event-feed > summary,
.daily-customer-group > summary {
  cursor: pointer;
  list-style: none;
  padding: 11px 13px;
}

.daily-customer-group > summary {
  display: grid;
  grid-template-columns: minmax(220px, 1.8fr) auto auto;
  align-items: center;
  gap: 8px 16px;
}

.daily-customer-group > summary strong {
  min-width: 0;
}

.daily-customer-group > summary span {
  justify-self: end;
  white-space: nowrap;
  color: #475569;
  font-size: 12px;
}

.daily-customer-group > summary .daily-bill-summary-amount {
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
}

.daily-customer-group[open] > summary,
.daily-event-feed[open] > summary {
  border-bottom: 1px solid #d8dee8;
}

.daily-remaining {
  color: #9a3412;
  font-weight: 700;
}

.daily-credit {
  color: #047857;
  font-weight: 700;
}

.daily-bill-total-row td {
  background: #f8fafc;
  border-top: 1px solid #d8dee8;
  font-weight: 700;
}

.daily-bill-total-label {
  text-align: right;
  color: #475569;
}

.daily-overdue-text {
  color: #b42318;
}

.daily-event-feed > div {
  max-height: 220px;
  overflow: auto;
}

.daily-event-feed p {
  display: grid;
  grid-template-columns: 130px 1fr 150px;
  gap: 10px;
  margin: 0;
  padding: 8px 12px;
  border-bottom: 1px solid #eef1f5;
}

.daily-event-feed p.unread {
  background: #eff6ff;
}

.daily-event-feed time {
  color: #64748b;
  text-align: right;
}

.daily-bill-table-wrap {
  border: 0;
  border-radius: 0;
}

.daily-bill-table {
  min-width: 1680px;
}

.daily-customer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 7px 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
  font-size: 12px;
}

.daily-aftersale-row > td {
  padding: 0;
  background: #fff9ed;
}

.daily-bill-aftersales > div {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(200px, 1fr));
  gap: 8px;
  padding: 9px 12px;
  color: #6b4f1d;
}

.receipt-screenshot-tools {
  align-items: stretch;
  flex-wrap: wrap;
}

.receipt-screenshot-tools .paste-box {
  flex: 1 1 360px;
}

.receipt-file-button {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.receipt-screenshot-preview {
  min-height: 0;
}

.receipt-screenshot-preview .image-thumb-btn {
  width: 64px;
  height: 64px;
}

.receipt-bill-table .image-thumb-btn {
  width: 38px;
  height: 38px;
}

.receipt-ocr-amount {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
}

.aftersale-finance-review,
.aftersale-original-summary {
  display: grid;
  gap: 8px;
}

.aftersale-original-summary {
  padding: 10px 12px;
  border-left: 3px solid #0f766e;
  background: #f0fdfa;
}

@media (max-width: 900px) {
  .daily-billing-stats {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    flex-basis: 100%;
    width: 100%;
    min-width: 0;
  }

  .daily-billing-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
  }

  .daily-billing-actions > * {
    width: 100%;
    min-width: 0;
  }

  .daily-customer-group > summary {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .daily-event-feed p,
  .daily-bill-aftersales > div {
    grid-template-columns: 1fr;
  }

  .daily-event-feed time {
    text-align: left;
  }
}

.toolbar > .toolbar-filter-popover,
.cost-table-toolbar > .toolbar-filter-popover,
.inventory-toolbar > .toolbar-filter-popover,
.user-filter-bar > .toolbar-filter-popover,
.finance-filter-toolbar > .filter-popover {
  flex: 0 0 auto;
  width: auto;
}

body.app-scale-active .toolbar > .toolbar-filter-popover,
body.app-scale-active .cost-table-toolbar > .toolbar-filter-popover,
body.app-scale-active .inventory-toolbar > .toolbar-filter-popover,
body.app-scale-active .finance-filter-toolbar > .filter-popover {
  flex: 0 0 auto !important;
}

.finance-filter-toolbar-inline {
  flex-wrap: nowrap;
}

.finance-filter-toolbar-inline > .finance-filter-fields {
  flex: 0 0 auto;
  width: max-content;
  min-width: max-content;
}

.finance-filter-header-row > th {
  padding: 6px 8px;
  background: #f8fafc;
  border-top: 1px solid #dbe3ee;
  border-bottom: 1px solid #dbe3ee;
  text-align: left;
}

.finance-filter-header-row .finance-filter-toolbar {
  margin: 0;
  padding: 0;
  overflow-x: auto;
}

.finance-filter-header-row .finance-filter-fields {
  margin: 0;
}

.finance-header-filter-cell {
  min-width: 86px;
  padding: 4px 6px !important;
  font-weight: 400 !important;
}

.finance-header-filter-cell input:not([type="checkbox"]),
.finance-header-filter-cell select {
  display: block;
  width: 100%;
  min-width: 86px;
  height: 28px;
  padding: 3px 6px;
  font-size: 12px;
  font-weight: 400;
}

.finance-header-filter-cell input[type="date"] {
  min-width: 132px;
}

.finance-header-filter-cell input[type="checkbox"] {
  display: inline-block;
  width: 14px;
  min-width: 14px;
  height: 14px;
  min-height: 14px;
  padding: 0;
}

.finance-header-clear-filters {
  display: block;
  width: 28px;
  min-width: 28px;
  height: 28px;
  margin: 0 auto;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  color: #475569;
  font-size: 18px;
  line-height: 24px;
  cursor: pointer;
}

.finance-header-clear-filters:hover {
  border-color: #94a3b8;
  background: #f8fafc;
  color: #0f172a;
}

.finance-header-clear-filters.is-active {
  border-color: #0284c7;
  background: #e0f2fe;
  color: #0369a1;
}

body.app-scale-active .finance-filter-toolbar {
  display: flex !important;
  grid-template-columns: none !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

body.app-scale-active .finance-filter-toolbar-inline > .finance-filter-fields {
  flex: 0 0 auto !important;
  width: max-content !important;
  min-width: max-content !important;
}

/* 订单与采购的整页筛选入口并入冻结表头，避免单独占一整行并让表头紧贴操作区。 */
#orderQueryPage .order-filter-toolbar.table-filter-toolbar-docked,
#procurementPage .procurement-filter-toolbar.table-filter-toolbar-docked {
  display: none !important;
  margin: 0 !important;
}

.table-select-filter-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 26px;
}

.table-toolbar-filter-dock {
  display: inline-flex;
  flex: 0 0 auto;
}

.table-toolbar-filter-dock:empty {
  display: none;
}

.table-toolbar-filter-dock > .toolbar-filter-popover {
  display: inline-flex;
  width: auto;
  margin: 0;
}

.table-toolbar-filter-dock .filter-icon-button {
  width: 26px;
  min-width: 26px;
  height: 26px;
  padding: 4px;
}

@media (max-width: 900px) {
  .finance-filter-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .finance-filter-toolbar-inline > .finance-filter-fields {
    flex: 0 0 auto;
    width: max-content;
    min-width: max-content;
  }
}

@media (max-width: 560px) {
  .finance-filter-toolbar-inline > .finance-filter-fields {
    flex-basis: auto;
  }
}

/* 自动获客和线索管理共用紧凑表格、状态与编辑布局。 */
.smart-lead-tabs {
  display: inline-flex;
  gap: 4px;
  margin: 0 0 16px;
  padding: 4px;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  background: #f8fafc;
}

.smart-lead-tabs button {
  min-height: 36px;
  padding: 7px 18px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #475569;
  font-weight: 600;
  cursor: pointer;
}

.smart-lead-tabs button:hover {
  color: #0f172a;
  background: #eef2f7;
}

.smart-lead-tabs button.active {
  color: #fff;
  background: #2563eb;
  box-shadow: 0 1px 3px rgb(15 23 42 / 18%);
}

.lead-source-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  white-space: nowrap;
}

.status-pill.ok {
  background: #dcfce7;
  color: #166534;
}

.status-pill.warn {
  background: #fef3c7;
  color: #92400e;
}

.lead-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.lead-table th,
.lead-table td {
  padding: 10px 9px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
}

.lead-row-actions,
.lead-form-actions,
.lead-pagination {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.lead-task-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}

.lead-task-form > label,
.lead-task-form > fieldset {
  display: grid;
  gap: 6px;
}

.lead-task-form textarea {
  resize: vertical;
}

.lead-task-form fieldset {
  grid-template-columns: repeat(3, auto);
  align-content: center;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  padding: 8px 12px;
}

.lead-task-form fieldset legend {
  padding: 0 5px;
}

.lead-task-form .lead-form-actions {
  grid-column: 1 / -1;
}

.lead-filter-bar {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) repeat(4, minmax(120px, 1fr)) auto auto;
  gap: 8px;
  margin-bottom: 14px;
}

.lead-pagination {
  justify-content: flex-end;
  margin-top: 14px;
}

.lead-detail-panel {
  margin-top: 16px;
}

.lead-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.lead-followup-form .wide {
  grid-column: 1 / -1;
}

.wecom-link-panel {
  border-color: rgba(7, 193, 96, .28);
  background: linear-gradient(145deg, rgba(7, 193, 96, .07), rgba(255, 255, 255, .98));
}

.wecom-link-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.wecom-link-list > div {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 2fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: 12px;
  background: #fff;
}

.wecom-link-list span,
.wecom-link-list em {
  color: var(--muted);
  font-size: 12px;
}

.wecom-link-list em {
  grid-column: 1 / -1;
  color: #b45309;
  font-style: normal;
}

.lead-detail-grid > div {
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #f8fafc;
}

@media (max-width: 900px) {
  .lead-task-form,
  .lead-detail-grid {
    grid-template-columns: 1fr;
  }

  .lead-filter-bar {
    grid-template-columns: 1fr 1fr;
  }
}

/* 采购表格自身是横向滚动容器，表头应吸附在容器顶部，不能重复叠加外层固定工具栏高度。 */
.procurement-table-wrap .procurement-table th {
  top: 0;
}

/* 桌面端页面顶部与工作台采用紧凑垂直节奏，移动端继续使用独立响应式间距。 */
@media (min-width: 901px) {
  .main {
    padding: 6px 12px 10px;
  }

  .topbar {
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
  }

  .topbar > div:first-child {
    display: flex;
    align-items: baseline;
    gap: 12px;
    min-width: 0;
  }

  .topbar > div:first-child h2 {
    flex: 0 0 auto;
  }

  .topbar > div:first-child p {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar h2 {
    margin-bottom: 1px;
    font-size: 18px;
    line-height: 1.2;
  }

  .topbar p,
  .topbar[data-page="procurementCost"] p {
    line-height: 1.2;
  }

  .topbar-actions {
    gap: 6px;
  }

  .topbar-actions > button {
    min-height: 30px;
    padding: 6px 10px;
  }

  .panel {
    padding: 12px;
  }

  .order-workbench-table {
    margin-top: 10px;
  }

  .section-head {
    gap: 10px;
    margin-bottom: 8px;
  }

  .order-query-head {
    margin-bottom: 6px;
  }

  .order-query-fixed-head,
  .procurement-fixed-head {
    margin-right: -12px;
    margin-left: -12px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .procurement-top-toolbar {
    gap: 8px;
    margin-bottom: 6px;
  }
}

/* 订单查询和采购处理共用列宽与行高基础规则。 */
.order-query-table th,
.procurement-table th {
  padding: 7px 9px;
}

.order-query-table td,
.procurement-table td {
  padding-left: 9px;
  padding-right: 9px;
}

.order-query-table .select-col,
.procurement-table .select-col {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
}

.order-query-table .row-num-col,
.procurement-table .procurement-row-num-col {
  width: 54px;
  min-width: 54px;
  max-width: 54px;
}

.order-query-table tbody > tr,
.procurement-table tbody > tr {
  height: var(--table-row-height, 36px);
}

.order-query-table tbody > tr > td,
.procurement-table tbody > tr > td {
  height: auto;
  line-height: 18px;
  padding-top: max(0px, calc((var(--table-row-height, 36px) - 18px) / 2));
  padding-bottom: max(0px, calc((var(--table-row-height, 36px) - 18px) / 2));
}

/* 订单查询和采购处理操作按钮按内容收紧，避免固定最小尺寸撑大色块。 */
@media (min-width: 901px) {
  #orderQueryPage .table-action-bar > button,
  #procurementPage .table-action-bar > button {
    min-width: auto;
    min-height: 30px;
    height: auto;
    padding: 4px 10px;
    line-height: 1.2;
    white-space: nowrap;
  }

  #orderQueryPage .column-settings-button,
  #procurementPage .column-settings-button {
    min-width: auto;
  }
}

/* 合同菜单改为顶部导航，内容区不再预留左侧空栏。 */
#contractList {
  display: block;
}

#contractList > .contract-main-content {
  grid-column: auto;
}

.contract-subnav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(15, 23, 42, .06);
}

.contract-subnav .contract-menu-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.contract-subnav .contract-menu-tabs button {
  width: auto;
  min-height: 34px;
  text-align: center;
}

.contract-subnav .contract-menu-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-top: 0;
  border-top: 0;
  white-space: nowrap;
}

.contract-subnav .contract-menu-actions button {
  width: auto;
}

.contract-template-order-note {
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px dashed #94a3b8;
  border-radius: 6px;
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
  line-height: 1.7;
}

@media (max-width: 900px) {
  .contract-subnav {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .contract-subnav .contract-menu-tabs,
  .contract-subnav .contract-menu-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contract-subnav .contract-menu-tabs button,
  .contract-subnav .contract-menu-actions button {
    width: 100%;
  }
}
