:root {
  --accent: #175b91;
  --accent-strong: #104a78;
  --accent-soft: #eaf2f8;
  --ink: #182230;
  --ink-soft: #344054;
  --muted: #667085;
  --subtle: #98a2b3;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --canvas: #f3f5f7;
  --surface: #ffffff;
  --surface-soft: #fafbfc;
  --success: #087a55;
  --success-soft: #eaf7f1;
  --warning: #a15c07;
  --warning-soft: #fff7e8;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 3px 10px rgba(16, 24, 40, .035);
  --shadow-md: 0 12px 34px rgba(16, 24, 40, .075);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Microsoft YaHei", sans-serif;
}

/* Employee accounts use a free-form position title and explicit permissions.
   Keep legacy columns in the database, but remove them from the operator UI. */
.employee-account-form input[name="department"],
.employee-account-form input[name="assigned_warehouse"],
.employee-account-form select[name="role"] {
  display: none !important;
}

.employee-account-form label:has(input[name="department"]),
.employee-account-form label:has(input[name="assigned_warehouse"]),
.employee-account-form label:has(select[name="role"]) {
  display: none !important;
}

.employee-account-form label:has(input[name="password"])::after {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  content: "初始密码至少 12 位";
}

/* Platform integration workbench */
.workflow-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.workflow-step {
  position: relative;
  min-height: 88px;
  padding: 14px 14px 14px 52px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.workflow-step > span {
  position: absolute;
  top: 14px;
  left: 14px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-soft);
  font-weight: 700;
}

.workflow-step strong,
.workflow-step small {
  display: block;
}

.workflow-step small {
  margin-top: 5px;
  color: var(--muted);
}

.workflow-step.active {
  border-color: #94b9d6;
  box-shadow: inset 0 3px 0 var(--accent);
}

.workflow-step.done > span {
  color: #fff;
  background: var(--success);
}

.integration-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, .8fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

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

.form-span-2 {
  grid-column: 1 / -1;
}

.panel-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-title-row h3,
.panel-title-row p {
  margin: 0;
}

.panel-title-row p {
  margin-top: 4px;
  color: var(--muted);
}

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

.switch-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start;
  gap: 10px;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.switch-row input {
  flex: none;
  margin-top: 3px;
}

.switch-row span,
.switch-row strong,
.switch-row small {
  display: block;
}

.switch-row small {
  margin-top: 2px;
  color: var(--muted);
}

.status-list {
  margin: 0 0 14px;
}

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

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

.integration-status-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.status-list > div {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.status-list dt {
  color: var(--muted);
  white-space: nowrap;
}

.status-list dd {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.status-message {
  color: var(--ink);
}

.status-details {
  margin: -2px 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.status-details summary {
  padding: 9px 11px;
  color: var(--accent-strong, var(--accent));
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  list-style-position: inside;
}

.status-details[open] summary {
  border-bottom: 1px solid var(--line);
}

.status-list-secondary {
  margin: 0;
  padding: 0 11px 5px;
}

.status-list-secondary > div:last-child {
  border-bottom: 0;
}

.block-btn {
  width: 100%;
  margin-top: 8px;
}

.notice-box {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  color: var(--ink-soft);
  background: var(--accent-soft);
}

.notice-box p {
  margin: 5px 0 0;
}

.advanced-panel {
  margin-top: 14px;
}

.advanced-panel > summary {
  cursor: pointer;
  font-weight: 700;
}

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 18px;
}

.cell-wrap {
  max-width: 420px;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .workflow-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .integration-layout,
  .advanced-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .workflow-strip,
  .integration-config-form,
  .switch-grid {
    grid-template-columns: 1fr;
  }

  .form-span-2 {
    grid-column: auto;
  }

  .workflow-step {
    min-height: 74px;
  }
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body {
  background: var(--canvas);
  color: var(--ink);
  letter-spacing: -.008em;
}
a { color: inherit; }
img, svg { max-width: 100%; }
.main > *, .content-grid > *, .cards > *, .form-grid > * { min-width: 0; }
input, select, textarea, button { max-width: 100%; }

/* Application frame */
.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 100vh;
  padding: 18px 14px 24px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: rgba(250, 251, 252, .96);
  backdrop-filter: blur(18px) saturate(130%);
}
.brand {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  margin: 0 4px 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}
.brand img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 270px;
  max-width: none;
  max-height: none;
  transform: translate(-50%, -50%);
}
.sidebar nav { display: grid; gap: 2px; padding-bottom: 18px; }
.nav-group-label {
  display: block;
  margin: 18px 10px 7px;
  color: #8b95a5;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
}
.nav-group-label:first-child { margin-top: 0; }
.nav-item {
  --nav-color: #2563c5;
  --nav-soft: #eaf2fc;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #596579;
  font-size: 13px;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.nav-item span {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  border-radius: 8px;
  background: var(--nav-soft);
  color: var(--nav-color);
  font-size: 12px;
  font-weight: 750;
}
.nav-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-ai_intake, .nav-orders, .nav-customers, .nav-products { --nav-color: #7652c7; --nav-soft: #f1edfb; }
.nav-inventory, .nav-procurement, .nav-tenders, .nav-suppliers, .nav-fulfillment, .nav-finance, .nav-returns { --nav-color: #147a61; --nav-soft: #e9f6f1; }
.nav-integrations, .nav-admin { --nav-color: #526273; --nav-soft: #edf0f3; }
.nav-item strong { font-weight: 620; }
.nav-item:hover { color: var(--ink); background: #f0f3f7; }
.nav-item.active {
  border-color: color-mix(in srgb, var(--nav-color) 20%, white);
  color: var(--nav-color);
  background: var(--nav-soft);
}
.nav-item.active span { color: #fff; background: var(--nav-color); }

.main { min-width: 0; padding: 0 32px 48px; overflow: visible; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  min-height: 78px;
  margin: 0 -32px 24px;
  padding: 14px 32px;
  border-bottom: 1px solid rgba(228, 231, 236, .92);
  background: rgba(245, 246, 248, .88);
  backdrop-filter: blur(20px) saturate(150%);
}
.page-kicker, .section-label {
  display: block;
  margin-bottom: 4px;
  color: #7b8494;
  font-size: 11px;
  font-weight: 650;
}
.topbar h1 { margin: 0; font-size: 24px; line-height: 1.25; letter-spacing: -.035em; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.system-ok {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .78);
  color: var(--muted);
  font-size: 12px;
}
.system-ok i { background: var(--success); }
.user-brief {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 9px 3px 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.user-brief > span:last-child { display: grid; }
.user-brief strong { font-size: 12px; }
.user-brief small { color: var(--muted); font-size: 10px; }
.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
}
.nav-toggle, .sidebar-mask { display: none; }
.sidebar-toggle {
  display: none;
  position: absolute;
  right: -15px;
  top: 92px;
  z-index: 45;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--ink-soft);
  background: #fff;
  box-shadow: 0 4px 14px rgba(16, 24, 40, .12);
  font-size: 22px;
  line-height: 1;
}
.sidebar-toggle:hover { color: var(--accent-strong); border-color: var(--accent); }
.wangdian-warehouse-simple {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfe;
}
.wangdian-warehouse-simple .panel-title-row { margin-bottom: 12px; }
.wangdian-warehouse-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.wangdian-warehouse-row label { min-width: 0; }
.wangdian-warehouse-simple > small { display: block; margin-top: 5px; color: var(--muted); }
@media (max-width: 820px) {
  .wangdian-warehouse-row { grid-template-columns: 1fr; gap: 8px; }
}

/* Mobile business workspace -------------------------------------------------
   Phone users complete an order one product at a time.  These rules deliberately
   stop inheriting desktop column widths and turn the two order editors into
   compact business cards. */
 /* Legacy mobile order rules disabled: the unified phone layout below is the
    single source of truth for manual order and AI review. */
 @media (max-width: 0px) {
  .page-content,
  .content-shell,
  .work-content { padding-inline: 10px !important; }

  .simple-order-form,
  .ai-review-form { padding-bottom: 92px; }

  .simple-order-form .form-grid,
  .ai-review-form .form-grid,
  .order-header-fields,
  .order-address-fields { grid-template-columns: minmax(0, 1fr) !important; }

  .simple-order-form .panel,
  .ai-review-form .panel,
  .order-lines-panel { border-radius: 12px; }

  .order-entry-table tr,
  .draft-items-table tr {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 12px;
    position: relative;
    padding: 12px !important;
  }

  .order-entry-table td,
  .draft-items-table td {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 7px 0 !important;
  }

  .order-entry-table td::before,
  .draft-items-table td::before {
    display: block;
    margin-bottom: 5px;
    color: #667085;
    font-size: 12px;
    font-weight: 650;
  }

  .order-entry-table td:nth-child(1),
  .draft-items-table td:nth-child(1) {
    grid-column: 1 / -1;
    width: auto !important;
    padding-bottom: 4px !important;
    color: #167d8c;
    font-weight: 700;
  }

  .order-entry-table td:nth-child(2) {
    position: absolute;
    top: 7px;
    right: 8px;
    width: 38px !important;
    padding: 0 !important;
  }
  .order-entry-table td:nth-child(2)::before { display: none; }

  .order-entry-table td:nth-child(3),
  .order-entry-table td:nth-child(5),
  .order-entry-table td:nth-child(8),
  .order-entry-table td:nth-child(12),
  .draft-items-table td:nth-child(2),
  .draft-items-table td:nth-child(3),
  .draft-items-table td:nth-child(4),
  .draft-items-table td:nth-child(8),
  .draft-items-table td:nth-child(10),
  .draft-items-table td:nth-child(11) { grid-column: 1 / -1; }

  /* Original price, discount and virtual stock are supporting information on a
     phone. They remain available in the price summary instead of consuming rows. */
  .order-entry-table td:nth-child(7),
  .order-entry-table td:nth-child(8),
  .order-entry-table td:nth-child(11) { display: none !important; }

  .order-product-picker {
    display: grid !important;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 10px;
    min-width: 0 !important;
    width: 100%;
  }
  .order-product-preview { width: 52px; height: 52px; }
  .product-search-box,
  .ai-product-search-box,
  [data-searchable-select] { min-width: 0 !important; width: 100%; }
  .selected-product-summary,
  .price-policy,
  .match-status { line-height: 1.45; overflow-wrap: anywhere; }

  .order-entry-table input,
  .order-entry-table select,
  .draft-items-table input,
  .draft-items-table select,
  .draft-items-table .select-filter-input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 44px;
    box-sizing: border-box;
  }

  .manual-price-cell,
  .ai-price-cell { display: grid !important; gap: 8px; }
  .manual-price-cell .compact-check,
  .ai-price-cell .compact-check { min-height: 40px; align-items: center; }
  .line-total,
  .ai-line-total { color: #b42318; font-size: 18px; font-weight: 750; }

  /* Search results are a phone bottom sheet.  Both manual and intelligent order
     editors portal their result panels to <body>, so fixed positioning is the
     only reliable layout on a narrow viewport. */
  .product-suggestions,
  .select-filter-results {
    position: fixed !important;
    inset: auto 8px max(72px, env(safe-area-inset-bottom)) 8px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: 55vh !important;
    overflow: auto !important;
    z-index: 5000 !important;
    border: 1px solid #b8c7d9;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 -10px 34px rgba(16, 37, 61, .2);
    overscroll-behavior: contain;
  }
  .product-suggestions[hidden],
  .select-filter-results[hidden] { display: none !important; }
  .product-suggestion-item,
  .select-filter-result {
    min-height: 58px;
    padding: 12px !important;
    touch-action: manipulation;
  }

  .sticky-submit {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 3500;
    display: grid;
    grid-template-columns: minmax(90px, .7fr) minmax(160px, 1.3fr);
    gap: 8px;
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.97);
    border-top: 1px solid #dfe5ec;
    box-shadow: 0 -5px 18px rgba(16, 37, 61, .1);
  }

  .customer-order-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
  }
  .customer-order-summary > span { min-width: 0; }

  /* Query pages: filters become touch-friendly and lists keep a readable width. */
  .filter-grid,
  .filter-bar,
  .search-toolbar { grid-template-columns: minmax(0, 1fr) !important; }
  .filter-grid label,
  .filter-bar label { min-width: 0 !important; width: 100%; }
  .filter-grid input,
  .filter-grid select,
  .filter-bar input,
  .filter-bar select { min-height: 44px; width: 100%; }
  .mobile-card-list { gap: 10px; }
}

.low-margin-rate {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #b42318;
  font-weight: 750;
}
.low-margin-rate::before { content: "!"; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: #fff; background: #d92d20; font-size: 12px; }
.low-margin-row { background: #fff5f4 !important; }
.margin-ok-rate { color: var(--ink); font-weight: 700; }
.margin-missing { color: #b54708; font-weight: 650; }

/* Browser-like workspace tabs: keep them on one compact row and let the
   operator close a tab without changing the current page layout. */
.workspace-tabs {
  display: flex;
  align-items: stretch;
  gap: 4px;
  max-width: calc(100vw - 420px);
  overflow-x: auto;
  scrollbar-width: none;
}
.workspace-tabs::-webkit-scrollbar { display: none; }
.workspace-tab {
  display: inline-flex !important;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  min-height: 45px !important;
  padding: 0 8px 0 14px !important;
  border-radius: 8px 8px 0 0;
  color: var(--muted) !important;
  background: transparent !important;
  font-size: 13px !important;
  white-space: nowrap;
}
.workspace-tab.active {
  color: var(--ink) !important;
  background: #fff !important;
  font-weight: 700;
  box-shadow: 0 -1px 0 rgba(16, 24, 40, .06);
}
.workspace-tab > a { min-height: auto !important; padding: 0 2px !important; }
.workspace-tab-close {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  color: #8792a2;
  background: transparent;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.workspace-tab-close:hover { color: var(--ink); background: #eef2f6; }
.workspace-close-all {
  flex: 0 0 auto;
  margin-left: 6px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.workspace-close-all:hover { color: var(--ink); background: #f3f6f8; }
@media (max-width: 700px) { .workspace-close-all { padding-inline: 7px; font-size: 0; } .workspace-close-all::after { content: '全关'; font-size: 12px; } }

/* The salesperson filter should be a compact multi-select, not a tall
   single-column panel. */
.filter-grid .filter-salespeople {
  grid-column: span 2;
  min-width: 0;
}
.filter-salespeople .filter-check-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  max-height: 104px;
  overflow-y: auto;
  padding: 4px 0;
}
.filter-salespeople .check-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 92px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  white-space: nowrap;
}
@media (max-width: 820px) {
  .workspace-tabs { max-width: calc(100vw - 150px); }
  .workspace-tab { min-height: 40px !important; padding-left: 10px !important; padding-right: 6px !important; }
  .filter-grid .filter-salespeople { grid-column: 1 / -1; }
}

/* Dashboard */
.home-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(270px, .65fr);
  gap: 14px;
  margin-bottom: 14px;
}
.welcome-panel, .focus-panel, .quick-work, .panel, .process-panel, .toolbar, .detail-head, .status-line {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.welcome-panel {
  min-height: 216px;
  padding: 30px 32px;
  border-radius: 18px;
  background: #fff;
}
.welcome-panel h2 {
  max-width: 760px;
  margin: 7px 0 12px;
  font-size: clamp(27px, 2.8vw, 34px);
  line-height: 1.18;
  letter-spacing: -.045em;
}
.welcome-panel p { max-width: 760px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.welcome-panel p strong { color: var(--ink); }
.command-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.text-btn { padding: 9px 4px; color: var(--accent); font-size: 13px; font-weight: 650; }
.text-btn span { margin-left: 3px; }
.focus-panel { padding: 19px; border-radius: 18px; }
.focus-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; padding: 0 2px 13px; border-bottom: 1px solid #edf0f3; }
.focus-head span { color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.focus-head strong { color: var(--ink); font-size: 25px; }
.focus-panel > a { display: flex; align-items: center; justify-content: space-between; min-height: 42px; padding: 8px 3px; border-bottom: 1px solid #f0f2f4; }
.focus-panel > a:last-child { border-bottom: 0; }
.focus-panel > a span { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.focus-panel > a strong { font-size: 16px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #98a2b3; }
.status-dot.blue { background: var(--accent); }
.status-dot.amber { background: #d89a28; }
.status-dot.orange { background: #dd6b20; }
.status-dot.red { background: #d92d20; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 14px; }
.metrics.compact { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.metric-card, .metrics article {
  display: block;
  min-width: 0;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.metric-card:hover { transform: translateY(-1px); border-color: #c6d7eb; box-shadow: var(--shadow-md); }
.metric-card span, .metric-card small, .metrics span, .metrics small { display: block; color: var(--muted); }
.metric-card span, .metrics span { font-size: 12px; font-weight: 650; }
.metric-card strong, .metrics strong { display: block; margin: 8px 0 5px; font-size: 28px; line-height: 1; }
.metric-card small, .metrics small { font-size: 11px; }
.metric-card.warning { border-left: 3px solid #d89a28; }
.metric-card.danger { border-left: 3px solid #d92d20; }

.quick-work { margin-bottom: 14px; padding: 19px; border-radius: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid #edf0f3; }
.section-head h3, .panel h3 { margin: 0; font-size: 17px; letter-spacing: -.025em; }
.section-head > a { color: var(--accent); font-size: 12px; font-weight: 650; }
.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.action-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 10px;
  padding: 13px;
  border: 1px solid #e9edf2;
  border-radius: 11px;
  background: var(--surface-soft);
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.action-card:hover { transform: translateY(-1px); border-color: #cbdcf0; background: #f5f9fe; }
.action-card > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 750; }
.action-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.action-card div { display: grid; gap: 2px; }
.action-card strong { font-size: 13px; }
.action-card small { color: var(--muted); font-size: 11px; }
.action-card b { color: #98a2b3; font-size: 17px; font-weight: 500; }

/* Shared content */
.panel, .process-panel { padding: 19px; border-radius: 15px; }
.content-grid { gap: 13px; }
.main > .content-grid, .main > .panel, .main > .metrics, .main > .hero, .main > .toolbar, .main > .detail-head, .main > .status-line { margin-bottom: 13px; }
.hero { padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow-sm); }
.hero h2 { font-size: 27px; }
.hero p, .panel p, .entity-card p { color: var(--muted); }
.dark { color: var(--ink); background: #fff; }
.dark p, .dark .eyebrow { color: var(--muted); }
.chips span { color: var(--ink-soft); background: #f1f3f6; }
.list { display: grid; gap: 6px; }
.list-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; border: 1px solid #edf0f3; border-radius: 10px; background: #fff; transition: background .14s ease, border-color .14s ease; }
.list-row:hover { border-color: #d5dfeb; background: #fafcff; }
.list-row p, td small { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.empty-state { padding: 32px; text-align: center; color: var(--subtle); }

.primary-btn, .secondary-btn, .danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 15px;
  border-radius: 9px;
  font-weight: 650;
  font-size: 13px;
  transition: background .14s ease, border-color .14s ease, transform .14s ease;
}
.primary-btn { border: 1px solid var(--accent); color: #fff; background: var(--accent); box-shadow: 0 4px 12px rgba(23, 105, 210, .16); }
.primary-btn:hover { transform: translateY(-1px); border-color: var(--accent-strong); background: var(--accent-strong); }
.secondary-btn { margin-right: 0; border: 1px solid var(--line-strong); color: var(--ink-soft); background: #fff; }
.secondary-btn:hover { border-color: #b9c2cf; background: #f8f9fb; }
.danger-btn { color: var(--danger); border: 1px solid #f0b8b3; background: #fff; }

.toolbar { padding: 13px 15px; border-radius: 13px; }
.search { width: min(390px, 100%); padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #f8f9fb; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 11px 12px; border-bottom: 1px solid #edf0f3; text-align: left; }
th { color: #596579; background: #f8f9fb; font-size: 11px; font-weight: 700; letter-spacing: .015em; }
thead th { position: sticky; top: 0; z-index: 2; }
td { font-size: 12px; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #fafcff; }
tbody tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; padding: 4px 8px; border-radius: 6px; color: #536176; background: #eef1f5; font-size: 11px; font-weight: 700; }
.badge.ok { color: var(--success); background: var(--success-soft); }
.badge.warn { color: var(--warning); background: var(--warning-soft); }
.badge.aftersales-return {
  color: #a12f5d;
  border: 1px solid #efc3d4;
  background: #fcecf3;
}
.badge.aftersales-exchange {
  color: #6741b5;
  border: 1px solid #d9cdf4;
  background: #f2eefa;
}

.detail-head { padding: 21px; border-radius: 15px; }
.status-line { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); padding: 6px; border-radius: 13px; }
.status-line div { padding: 11px; border-radius: 8px; background: #f8f9fb; }
.flow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.flow-card { border: 1px solid var(--line); border-radius: 11px; background: #fbfcfd; }
.cards { gap: 11px; }
.entity-card { border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: var(--shadow-sm); }

/* Forms and administration */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 13px 15px;
}
.form-grid label { gap: 7px; color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.form-grid input, .form-grid select, .form-grid textarea, .stack-actions input, .inline-fields input, .inline-fields select {
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .025);
}
.inline-fields {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
.inline-fields select { min-width: 118px; }
.check-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 4px;
  color: var(--ink-soft);
  font-size: 12px;
  white-space: nowrap;
}
.check-field input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  outline: 3px solid rgba(23, 105, 210, .11);
  border-color: #6b9bd8;
}
.page-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.page-actions .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.toolbar small { display: block; margin-top: 3px; }
.form-grid input[type="checkbox"], .form-grid input[type="radio"], .check-line input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  border-radius: 4px;
  box-shadow: none;
  accent-color: var(--accent);
}
.form-grid label:has(input[type="checkbox"]), .form-grid label:has(input[type="radio"]) {
  display: flex;
  align-items: center;
  align-self: end;
  min-height: 40px;
}
.admin-tabs {
  position: sticky;
  top: 83px;
  z-index: 20;
  display: flex;
  gap: 3px;
  margin: 0 0 14px;
  padding: 5px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
}

.permission-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.permission-actions label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
}

/* Role permissions: keep module capabilities in the table and show
   sensitive actions once per role instead of repeating them on every row. */
.role-permission-editor {
  display: grid;
  gap: 12px;
}

.role-permission-editor > form {
  display: grid;
  gap: 12px;
}

.simple-role-selector {
  max-width: 420px;
}

.simple-permission-note {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid #bfd6dd;
  border-radius: 10px;
  background: #f4fafb;
  color: var(--ink-soft);
}

.simple-permission-note strong {
  color: var(--ink);
}

.simple-module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.simple-module-group {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.simple-module-group legend {
  padding: 0 6px;
  font-weight: 700;
}

.simple-module-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  margin: 0;
  padding: 6px 8px;
  border-radius: 7px;
  background: var(--surface-soft);
}

.simple-module-group input {
  flex: 0 0 auto;
}

.role-permission-editor .table-wrap {
  max-height: min(58vh, 620px);
  overflow: auto;
  overscroll-behavior: contain;
}

.role-permission-editor .compact-permission-table {
  min-width: 720px;
}

.role-permission-editor .compact-permission-table th,
.role-permission-editor .compact-permission-table td {
  white-space: nowrap;
}

.permission-sensitive-panel {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  box-shadow: none;
}

.permission-boundary-guide {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #c9d9ea;
  border-left: 4px solid #158ea0;
  border-radius: 9px;
  background: #f7fbfe;
}

.permission-boundary-title {
  color: var(--ink-strong);
  font-size: 15px;
  font-weight: 700;
}

.permission-boundary-guide p {
  margin: 5px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.permission-boundary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.permission-boundary-grid > div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #dce7ef;
  border-radius: 7px;
  background: var(--surface);
}

.permission-boundary-grid strong,
.permission-boundary-grid span {
  display: block;
}

.permission-boundary-grid strong {
  margin-bottom: 3px;
  color: var(--ink-strong);
  font-size: 13px;
}

.permission-boundary-grid span,
.permission-boundary-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.permission-boundary-note {
  margin-top: 9px;
}

.permission-boundary-detail {
  margin: 14px 0;
  overflow: hidden;
  border: 1px solid #c9d9ea;
  border-radius: 9px;
  background: var(--surface);
}

.permission-boundary-detail-title {
  padding: 10px 12px;
  color: var(--ink-strong);
  background: #edf7f8;
  font-size: 14px;
  font-weight: 700;
}

.permission-boundary-table-wrap {
  max-height: min(44vh, 390px);
  margin: 0;
}

.permission-boundary-table {
  min-width: 980px;
}

.permission-boundary-table th,
.permission-boundary-table td {
  padding: 8px 9px;
  white-space: normal;
  vertical-align: top;
  line-height: 1.45;
}

.permission-boundary-table td:first-child {
  min-width: 145px;
  color: var(--ink-strong);
}

.permission-boundary-table td code {
  color: #0f7f8c;
  font-size: 11px;
}

.permission-action-group-title {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 7px 10px;
  border-left: 3px solid #158ea0;
  background: #edf7f8;
  color: var(--ink-strong);
  font-size: 13px;
  font-weight: 700;
}

.role-sensitive-global-list {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.permission-action-group {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.permission-action-group h5 {
  margin: 0 0 8px;
  color: var(--ink-strong);
  font-size: 14px;
}

.permission-action-group .role-action-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.role-sensitive-global-list .permission-action-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.permission-action-row span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.permission-action-row strong {
  font-size: 13px;
  line-height: 1.3;
}

.permission-action-row small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.permission-action-row .permission-action-lane {
  display: inline-flex;
  width: max-content;
  padding: 2px 7px;
  border: 1px solid #9adbe1;
  border-radius: 999px;
  background: #eaf9fa;
  color: #0f7f8c;
  font-weight: 700;
}

.permission-action-row .permission-action-meta {
  color: #5d7087;
}

.permission-action-row .permission-action-meta:first-of-type {
  color: #0f7f8c;
  font-weight: 600;
}

.role-sensitive-global-list label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

@media (max-width: 720px) {
  .simple-module-grid {
    grid-template-columns: 1fr;
  }

  .role-permission-editor .table-wrap {
    max-height: 52vh;
  }

  .permission-sensitive-panel {
    padding: 12px;
  }

  .permission-boundary-grid {
    grid-template-columns: 1fr;
  }

  .permission-boundary-table-wrap {
    max-height: 46vh;
  }

  .permission-boundary-table {
    min-width: 900px;
  }

  .role-sensitive-global-list {
    gap: 8px;
  }

  .permission-action-group .role-action-list {
    grid-template-columns: 1fr;
  }
}

/* The old five-checkbox permission editor remains available for legacy
   records but is removed from the normal employee workflow. */
form[data-user-permission-form],
form[data-user-permission-form] + section {
  display: none !important;
}

.accounts-layout {
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  align-items: start;
}

.accounts-layout > .employee-account-form {
  grid-template-columns: 1fr;
  align-content: start;
  align-self: start;
}

.accounts-layout > section.panel {
  min-width: 0;
  align-self: start;
}

.accounts-layout > section.panel .table-wrap {
  max-height: min(58vh, 560px);
  overflow: auto;
  overscroll-behavior: contain;
}

.accounts-layout > section.panel table {
  min-width: 680px;
}

.accounts-layout > section.panel th:last-child,
.accounts-layout > section.panel td:last-child {
  min-width: 150px;
}

.module-permission-editor {
  display: grid;
  gap: 12px;
  max-height: min(58vh, 560px);
  overflow: auto;
  padding-right: 3px;
}

.module-permission-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.module-permission-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.module-permission-group summary {
  padding: 10px 12px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.module-permission-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  padding: 0 10px 10px;
}

.accounts-layout .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.accounts-layout .compact-disclosure {
  margin-top: 4px;
}

.accounts-layout .compact-disclosure[open] {
  padding: 6px;
  border-radius: 6px;
  background: var(--surface-soft);
}

.module-permission-item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 5px 7px;
  border-radius: 7px;
  cursor: pointer;
}

.module-permission-item:hover {
  background: var(--accent-soft);
}

.module-permission-note {
  margin: 0;
  font-size: 12px;
}

@media (max-width: 760px) {
  .accounts-layout {
    grid-template-columns: 1fr;
  }

  .accounts-layout > section.panel .table-wrap {
    max-height: none;
  }

  .module-permission-groups,
  .module-permission-items {
    grid-template-columns: 1fr;
  }

  .module-permission-editor {
    max-height: none;
  }
}

/* 订单明细：表格保持完整宽度，窄屏用表格自身横向滚动，不裁掉右侧字段。 */
.order-entry-wrap,
.ai-review-items-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

.order-entry-wrap .order-entry-table {
  min-width: 1320px;
}

.ai-review-items-wrap .draft-items-table {
  width: max-content;
  min-width: 1500px;
  table-layout: auto;
}

.draft-items-table th:nth-child(5),
.draft-items-table td:nth-child(5) {
  width: 76px;
  min-width: 76px;
  max-width: 90px;
}

.draft-items-table th:nth-child(6),
.draft-items-table td:nth-child(6) {
  width: 92px;
  min-width: 92px;
  max-width: 112px;
}

/* 搜索结果由 JS 按输入框的屏幕坐标定位，避免被表格或卡片裁剪。 */
.product-suggestions,
.select-filter-results {
  z-index: 1000 !important;
  max-height: min(430px, calc(100vh - 24px));
  overflow-y: auto;
}

.product-suggestion-item,
.select-filter-result {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
}
.select-filter-result {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: start;
  gap: 11px;
  min-height: 72px;
  padding: 10px 12px;
  text-align: left;
}
.select-filter-result-image {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f5f7fa;
  color: var(--muted);
  object-fit: contain;
}
.select-filter-result-copy { min-width: 0; }
.select-filter-result-copy strong,
.select-filter-result-copy small { display: block; overflow-wrap: anywhere; }
.select-filter-result-copy small { color: var(--muted); margin-top: 3px; }
.select-filter-result em { color: var(--accent); font-style: normal; white-space: nowrap; }

@media print {
  .mobile-bottom-nav,
  .mobile-business-hub,
  .sidebar,
  .sidebar-mask,
  .nav-toggle,
  .topbar {
    display: none !important;
  }
}

/* Order entry: keep the high-value fields compact and the amounts visible. */
.order-entry-table {
  min-width: 1180px;
}

.order-entry-table th:nth-child(3),
.order-entry-table td:nth-child(3) {
  min-width: 320px;
}

.order-entry-table th:nth-child(4),
.order-entry-table td:nth-child(4) {
  width: 76px;
  min-width: 76px;
}

.order-entry-table th:nth-child(5),
.order-entry-table td:nth-child(5) {
  width: 92px;
  min-width: 92px;
}

.order-entry-table .quantity-input {
  width: 70px;
  min-width: 70px;
  padding-inline: 8px;
}

.order-entry-table .unit-select {
  width: 92px;
  min-width: 92px;
  padding-inline: 8px;
}

.order-entry-table .line-total {
  min-width: 116px;
  color: #b42318;
  font-weight: 700;
  white-space: nowrap;
}

.order-total-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  box-shadow: 0 -8px 20px rgba(16, 24, 40, .08);
}

.customer-quote-form {
  grid-template-columns: minmax(300px, 2.2fr) 115px 135px 145px auto;
  align-items: end;
}

.customer-quote-form .customer-quote-product-picker {
  min-width: 0;
}

.customer-quote-form .product-suggestions {
  z-index: 20;
  max-height: 360px;
}

@media (max-width: 760px) {
  .order-entry-table {
    min-width: 0;
  }

  .order-entry-table .quantity-input,
  .order-entry-table .unit-select {
    width: 100%;
    min-width: 0;
  }

  .customer-quote-form {
    grid-template-columns: 1fr;
  }
}

.compact-disclosure {
  margin-top: 8px;
}

.compact-disclosure summary {
  color: var(--primary);
  cursor: pointer;
  font-size: 13px;
}

.compact-disclosure form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  min-width: 260px;
}
.admin-tab { padding: 8px 12px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 650; white-space: nowrap; }
.admin-tab.active { color: #1559ae; background: var(--accent-soft); }
.main [hidden] { display: none !important; }
.main .eyebrow { display: none; }
.analytics-tables { grid-template-columns: 1fr 1fr; }
.analytics-tables table { min-width: 0; }
.bar-row { grid-template-columns: 100px 1fr 42px; }
.error-panel { max-width: 760px; margin: 8vh auto; }
.return-simple-form { display:grid; gap:18px; max-width:980px; margin:16px auto; }
.return-order-overview { max-width:980px; margin:16px auto 0; }
.return-type-switch { display:flex; gap:12px; }
.return-type-switch label {
  display:flex; align-items:center; gap:8px; padding:12px 18px;
  border:1px solid var(--line); border-radius:10px; background:#fff; cursor:pointer;
}
.return-type-switch input { width:auto; min-height:0; }
.return-line-fields { display:grid; grid-template-columns:1fr 1fr 1fr; gap:14px; }
.exchange-fields { padding:16px; border:1px solid var(--line); border-radius:12px; background:var(--surface-soft); }
.exchange-fields h3 { margin:0 0 14px; }
.exchange-fields label { display:grid; gap:7px; }
.exchange-fields #exchange-product-search { margin-bottom:8px; }
@media (max-width: 720px) {
  .return-simple-form { margin:12px 0; padding:14px; }
  .return-order-overview { margin:12px 0 0; }
  .return-line-fields { grid-template-columns:1fr 1fr; }
  .return-line-fields label:first-child { grid-column:1 / -1; }
  .return-type-switch { display:grid; grid-template-columns:1fr 1fr; }
  .return-simple-form .form-actions { position:sticky; bottom:8px; z-index:5; }
  .return-simple-form .form-actions button { width:100%; }
}
.alert { border: 1px solid #f1cac6; border-radius: 10px; color: var(--danger); background: var(--danger-soft); }

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f2f4f7;
}
.login-card {
  width: min(430px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 24px 70px rgba(16, 24, 40, .11);
}
.login-card > img { display: block; width: 290px; height: 82px; max-width: 100%; margin: -8px auto 18px; object-fit: cover; object-position: center; }
.login-card > .eyebrow { display: none; }
.login-card h1 { margin: 0 0 8px; font-size: 27px; letter-spacing: -.035em; }
.login-card form { gap: 14px; margin-top: 22px; }
.login-card label { color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.login-card input { height: 42px; border: 1px solid var(--line-strong); border-radius: 8px; }
.login-card .check-line { font-weight: 500; }
.login-card .primary-btn { width: 100%; }

@media (max-width: 1180px) {
  .shell { grid-template-columns: 214px minmax(0, 1fr); }
  .main { padding-left: 22px; padding-right: 22px; }
  .topbar { margin-left: -22px; margin-right: -22px; padding-left: 22px; padding-right: 22px; }
  .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 窄屏桌面/浏览器缩放：保留侧栏图标，并提供明显的展开按钮；只有手机断点才改为抽屉。 */
@media (min-width: 821px) and (max-width: 1100px) {
  .shell { grid-template-columns: 72px minmax(0, 1fr); }
  .sidebar { padding-left: 8px; padding-right: 8px; }
  .sidebar-toggle { display: grid; }
  .brand { min-height: 58px; margin-left: 0; margin-right: 0; }
  .brand img { width: 58px; height: 42px; object-fit: contain; }
  .sidebar .nav-item,
  .sidebar .nav-group > summary { justify-content: center; padding-left: 6px; padding-right: 6px; }
  .sidebar .nav-item strong,
  .sidebar .nav-group > summary strong,
  .sidebar .nav-group > summary b,
  .sidebar .role-quick-nav { display: none; }
  .sidebar .nav-children { display: none; }
  .sidebar-expanded .shell { grid-template-columns: 232px minmax(0, 1fr); }
  .sidebar-expanded .sidebar { padding-left: 14px; padding-right: 14px; }
  .sidebar-expanded .brand { margin-left: 4px; margin-right: 4px; }
  .sidebar-expanded .brand img { width: 270px; height: auto; }
  .sidebar-expanded .sidebar .nav-item,
  .sidebar-expanded .sidebar .nav-group > summary { justify-content: flex-start; padding-left: 10px; padding-right: 10px; }
  .sidebar-expanded .sidebar .nav-item strong,
  .sidebar-expanded .sidebar .nav-group > summary strong,
  .sidebar-expanded .sidebar .nav-group > summary b { display: inline; }
  .sidebar-expanded .sidebar .nav-children { display: grid; }
  .sidebar-expanded .sidebar-toggle span { transform: rotate(0deg); }
}

@media (max-width: 820px) {
  html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
  .shell { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 80; width: min(84vw, 300px); height: 100vh; transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow-md); }
  .nav-open .sidebar { transform: translateX(0); }
  .sidebar-mask { position: fixed; inset: 0; z-index: 70; background: rgba(16, 24, 40, .36); backdrop-filter: blur(2px); }
  .nav-open .sidebar-mask { display: block; }
  .sidebar-toggle { display: none; }
  .nav-toggle { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 90; display: grid; place-items: center; width: 48px; height: 48px; border: 0; border-radius: 14px; color: #fff; background: var(--accent); box-shadow: 0 10px 28px rgba(23, 105, 210, .28); }
  .main { padding: 0 14px 82px; }
  .topbar { position: static; min-height: 72px; margin: 0 -14px 16px; padding: 13px 14px; }
  .top-actions { gap: 6px; }
  .system-ok, .user-brief small { display: none; }
  .top-actions form { display: block; }
  .top-actions form .secondary-btn { min-width: 54px; padding-inline: 10px; }
  .home-overview { grid-template-columns: 1fr; }
  .welcome-panel { min-height: auto; padding: 23px; }
  .welcome-panel h2 { font-size: 27px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-grid, .content-grid, .cards, .analytics-tables, .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide-field { grid-column: auto; }
  .toolbar, .topbar { align-items: start; }
  .admin-tabs { top: 0; }
  .flow { grid-template-columns: 1fr; }
  .inline-fields { display: grid; }
  .toolbar { display: grid; gap: 14px; }
  .toolbar .inline-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .toolbar .inline-fields > input,
  .toolbar .inline-fields > select,
  .toolbar .inline-fields > button,
  .toolbar .inline-fields > a { width: 100%; min-width: 0; }
  .toolbar .inline-fields > span { display: none; }
  .toolbar .check-field { grid-column: 1 / -1; }
  .search { width: 100%; }
  .page-actions { align-items: stretch; flex-direction: column; }
  .page-actions .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .page-actions .actions > * { width: 100%; }
  .page-actions .actions .primary-btn, .page-actions .actions .secondary-btn { width: 100%; }
  .nav-item { min-height: 44px; }
  .primary-btn, .secondary-btn, .danger-btn, .admin-tab { min-height: 44px; }
  input, select, textarea { font-size: 16px; }
  .table-wrap { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 680px; }
  .list-row { gap: 12px; }
  .list-row > div { min-width: 0; }
  .list-row strong, .list-row p { overflow-wrap: anywhere; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media (max-width: 480px) {
  .metrics { grid-template-columns: 1fr; }
  .command-actions { display: grid; }
  .command-actions a { width: 100%; text-align: center; }
  .topbar h1 { font-size: 21px; }
  .page-kicker { font-size: 10px; }
  .welcome-panel h2 { font-size: 25px; }
  .login-card { padding: 28px 22px; }
  .focus-panel, .welcome-panel, .quick-work, .panel, .process-panel { border-radius: 14px; }
  .welcome-panel { padding: 21px 19px; }
  .focus-panel { padding: 17px; }
  .action-card { grid-template-columns: 38px minmax(0, 1fr) 14px; }
  .toolbar .inline-fields { grid-template-columns: 1fr; }
  .toolbar .check-field { grid-column: auto; }
  .detail-head { display: grid; gap: 14px; }
  .detail-head > div:last-child { display: grid; gap: 8px; }
  .detail-head .primary-btn, .detail-head .secondary-btn { width: 100%; }
}

/* Dense enterprise workspace */
:root {
  --accent: #168b99;
  --accent-strong: #0f7480;
  --accent-soft: #e8f5f6;
  --canvas: #f4f6f8;
  --sidebar: #f7f9fb;
}
.shell { grid-template-columns: 184px minmax(0, 1fr); }
.sidebar {
  padding: 0 0 20px;
  border-right: 1px solid #dfe5eb;
  color: #344054;
  background: var(--sidebar);
}
.brand {
  min-height: 66px;
  margin: 0 10px 7px;
  border: 0;
  border-bottom: 1px solid #e4e9ee;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}
.brand img { width: 202px; filter: contrast(1.05) saturate(1.04); }
.b2b-nav { gap: 2px; padding: 4px 8px 18px; }
.role-quick-nav {
  display: grid;
  gap: 7px;
  margin: 4px 0 10px;
  padding: 12px;
  border: 1px solid #cfe5e8;
  border-radius: 8px;
  background: #eef9fa;
}
.role-quick-nav > span { color: #172033; font-weight: 700; }
.role-quick-nav > small { color: #667085; font-size: 12px; line-height: 1.45; }
.role-quick-nav > a {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid #c9d6df;
  border-radius: 6px;
  color: #344054;
  text-align: center;
  background: #fff;
}
.role-quick-nav > a.primary {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}
.b2b-nav > .nav-item { margin-bottom: 2px; }
.nav-item {
  min-height: 40px;
  padding: 7px 10px;
  border-radius: 4px;
  color: #475467;
  font-size: 13px;
}
.nav-item span { background: #e9eef3; color: #526174; }
.nav-item:hover { color: #1d2939; background: #edf2f5; }
.nav-item.active { border-color: transparent; color: #fff; background: var(--accent); }
.nav-item.active span { color: #fff; background: rgba(255,255,255,.14); }
.nav-group { margin: 2px 0; }
.nav-group summary {
  display: grid;
  grid-template-columns: 27px minmax(0,1fr) 14px;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 7px 10px;
  border-radius: 4px;
  color: #475467;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary:hover, .nav-group[open] > summary { color: #1d2939; background: #edf2f5; }
.nav-group summary .nav-icon { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 4px; background: #e9eef3; }
.nav-group summary .nav-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.nav-group summary b { transition: transform .16s ease; }
.nav-group[open] summary b { transform: rotate(180deg); }
.nav-children { padding: 2px 0 4px 20px; }
.nav-children .nav-item { min-height: 34px; padding-block: 4px; }
.nav-dot { width: 5px !important; height: 5px !important; flex: 0 0 5px !important; border-radius: 50% !important; background: #98a2b3 !important; }
.nav-children .nav-item.active .nav-dot { background: #fff !important; }

.main { padding: 0 22px 32px; }
.topbar {
  min-height: 58px;
  margin: 0 -22px;
  padding: 0 22px;
  background: #eef1f5;
}
.workspace-tabs { display: flex; align-self: stretch; align-items: end; gap: 2px; }
.workspace-tabs a, .workspace-tabs span { display: flex; align-items: center; min-height: 45px; padding: 0 18px; color: #596579; font-size: 13px; }
.workspace-tabs span { border-radius: 7px 7px 0 0; color: var(--ink); background: #fff; font-weight: 700; }
.page-heading {
  display: flex;
  align-items: center;
  min-height: 58px;
  margin: 0 -22px 16px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.page-heading h1 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.top-actions .system-ok { background: transparent; border-color: transparent; }
.user-brief { border-radius: 6px; }
.avatar { border-radius: 5px; background: var(--accent); }

.panel, .process-panel, .toolbar, .detail-head, .status-line, .metric-card, .metrics article {
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(16,24,40,.045);
}
.toolbar { min-height: 58px; margin-bottom: 12px; padding: 10px 12px; }
.list-toolbar { gap: 12px; }
.list-toolbar > .actions, .list-toolbar > div:last-child { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.inline-fields input, .inline-fields select { min-height: 36px; border-radius: 4px; }
.primary-btn, .secondary-btn, .danger-btn { min-height: 36px; padding: 7px 13px; border-radius: 4px; }
.primary-btn { background: var(--accent); border-color: var(--accent); box-shadow: none; }
.primary-btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.icon-btn { min-height: 30px; padding: 4px 9px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.utility-panel { margin-bottom: 12px; padding: 14px; border-left: 3px solid var(--accent); }
.utility-panel .section-head { margin-bottom: 10px; padding-bottom: 9px; }
.list-panel { padding: 0; overflow: hidden; }
.list-panel .table-wrap { border: 0; border-radius: 0; }
.list-summary { display: flex; align-items: center; justify-content: space-between; min-height: 42px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.list-summary span, .list-count { font-size: 12px; font-weight: 700; }
.list-summary small { color: var(--muted); }
table { min-width: 900px; }
th, td { height: 48px; padding: 8px 10px; }
th { background: #f2f5f8; font-size: 11px; }
td { font-size: 12px; }
tbody tr:hover { background: #edf8f9; }
.badge { border-radius: 3px; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-height: 48px; padding: 8px 12px; border-top: 1px solid var(--line); background: #fff; }
.pagination span { margin-right: auto; color: var(--muted); font-size: 12px; }
.pagination a { padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; font-size: 12px; }
.page-jump { display:flex; align-items:center; gap:6px; margin:0 0 0 4px; }
.page-jump label { display:flex; align-items:center; gap:5px; color:var(--muted); font-size:12px; white-space:nowrap; }
.page-jump select { min-width:64px; height:30px; padding:3px 24px 3px 8px; border:1px solid var(--line-strong); border-radius:5px; background:#fff; }
.page-jump button { height:30px; padding:4px 10px; border:1px solid var(--line-strong); border-radius:5px; background:#fff; font-size:12px; }

.master-list-layout { display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 12px; }
.category-rail { align-self: start; display: grid; padding: 12px 8px; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.category-rail strong { padding: 5px 10px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.category-rail a { padding: 8px 10px; border-radius: 3px; color: var(--ink-soft); font-size: 12px; }
.category-rail a:hover, .category-rail a.active { color: var(--accent-strong); background: var(--accent-soft); font-weight: 700; }
.batch-toolbar { min-height: 48px; margin-bottom: 8px; }
.product-thumb { display: grid; place-items: center; width: 42px; height: 42px; overflow: hidden; border: 1px solid var(--line); border-radius: 3px; background: #fafafa; }
.product-thumb img { width: 100%; height: 100%; object-fit: contain; }
.product-thumb span { color: var(--subtle); font-size: 8px; text-align: center; }
.row-actions { white-space: nowrap; }
.row-actions > a { color: var(--accent-strong); font-weight: 650; }
.link-button { padding: 0; border: 0; color: var(--accent-strong); background: transparent; font-size: 12px; font-weight: 650; }
.filter-panel { border-left: 0; }
.filter-grid { display: grid; grid-template-columns: repeat(5,minmax(130px,1fr)) auto; align-items: end; gap: 10px; }
.filter-grid label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.filter-grid input, .filter-grid select { width: 100%; min-height: 36px; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; }
.filter-actions { display: flex; gap: 6px; }
.sticky-actions { position: sticky; right: 0; z-index: 2; background: #fff; box-shadow: -1px 0 var(--line); }
thead .sticky-actions { z-index: 3; background: #f2f5f8; }
tbody tr:hover .sticky-actions { background: #edf8f9; }
.table-row-actions { display: flex; gap: 10px; opacity: .42; transition: opacity .14s ease; }
tbody tr:hover .table-row-actions, .table-row-actions:focus-within { opacity: 1; }
.back-row { margin: -4px 0 10px; }
.back-row a { color: var(--accent-strong); font-size: 12px; font-weight: 650; }
.action-toolbar > div { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }

/* 智能收单：内部使用统一订单草稿，不向业务人员暴露模型 JSON。 */
.intake-header, .draft-review-head { display:flex; align-items:center; justify-content:space-between; gap:24px; margin-bottom:14px; padding:20px 22px; border:1px solid var(--line); border-radius:14px; background:#fff; }
.intake-header h2, .draft-review-head h2 { margin:0 0 6px; font-size:24px; }
.intake-header p, .draft-review-head p { margin:0; color:var(--muted); }
.intake-service { display:flex; align-items:center; gap:10px; min-width:150px; padding:10px 13px; border:1px solid var(--line); border-radius:10px; background:#f8fafc; }
.intake-service small { display:block; color:var(--muted); }
.status-dot { width:10px; height:10px; border-radius:50%; background:#d08a18; }
.status-dot.online { background:#16835b; box-shadow:0 0 0 4px rgba(22,131,91,.12); }
.intake-compose { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(280px,.5fr); gap:20px; }
.intake-source, .intake-upload { display:grid; align-content:start; gap:9px; }
.intake-source > label, .intake-upload > label:not(.upload-drop) { font-weight:700; }
.intake-compose textarea { resize:vertical; min-height:172px; }
.intake-upload > input[type=file] { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
.upload-drop { display:grid; place-items:center; min-height:118px; padding:18px; border:1px dashed #9fb3c8; border-radius:12px; background:#f7fafc; color:#34475c; cursor:pointer; }
.upload-drop small { color:var(--muted); font-weight:400; }
.upload-icon { display:grid; place-items:center; width:34px; height:34px; margin-bottom:5px; border-radius:50%; background:#e5f0fa; color:#1268b3; font-size:20px; }
.intake-legend { display:flex; gap:8px; flex-wrap:wrap; }
.intake-legend span { padding:6px 9px; border-radius:6px; background:#f2f6fa; color:var(--muted); font-size:12px; }
.intake-table td { vertical-align:middle; }
.intake-table small { max-width:260px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.match-count { display:inline-block; min-width:40px; color:#a26100; font-weight:800; }
.match-count.complete, .match-ok { color:#16835b; }
.match-warn { color:#a26100; }
.empty-cell { padding:34px !important; text-align:center; color:var(--muted); }
.back-link { display:inline-block; margin-bottom:8px; color:#1268b3; font-size:13px; }
.review-alert { margin-bottom:14px; padding:14px 18px; border:1px solid #f0d39b; border-radius:12px; background:#fff9eb; color:#6d4b09; }
.review-alert-danger { border-color:#efb4b0; background:#fff3f2; color:#8f2f2a; }
.review-alert ul { margin:8px 0 0; padding-left:20px; }
.order-sheet { padding:0; overflow:hidden; }
.order-sheet-title { display:flex; align-items:center; justify-content:space-between; padding:17px 20px; border-bottom:1px solid var(--line); }
.order-sheet-title h3 { margin:0 0 3px; font-size:18px; }
.order-sheet-title small { color:var(--muted); }
.order-sheet-title > span { padding:5px 9px; border-radius:6px; background:#eef4fa; color:#1268b3; font-weight:700; }
.order-header-fields { padding:20px; }
.draft-items-table { min-width:1120px; table-layout:auto; }
.draft-items-table th { white-space:nowrap; }
.draft-items-table td { vertical-align:top; }
.draft-items-table th:nth-child(1), .draft-items-table td:nth-child(1) { width:48px; }
.draft-items-table th:nth-child(2), .draft-items-table td:nth-child(2) { width:76px; }
.draft-items-table th:nth-child(5), .draft-items-table td:nth-child(5) { width:92px; }
.draft-items-table th:nth-child(6), .draft-items-table td:nth-child(6) { width:110px; }
.draft-items-table th:nth-child(7), .draft-items-table td:nth-child(7) { width:100px; }
.draft-items-table th:nth-child(8), .draft-items-table td:nth-child(8) { width:112px; }
.draft-items-table select { min-width:240px; max-width:360px; }
.draft-items-table input { min-width:86px; }
.draft-items-table .select-filter-input { min-width:0; width:100%; margin-bottom:5px; }
.draft-items-table [data-searchable-select] { min-width:240px; }
.ai-review-items-wrap,
.order-edit-lines {
  position: relative;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #9bb4ca #edf2f7;
  touch-action: pan-x pan-y;
}
.ai-review-items-wrap:focus-visible,
.order-edit-lines:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ai-review-items-wrap::-webkit-scrollbar,
.order-edit-lines::-webkit-scrollbar { height: 9px; }
.ai-review-items-wrap::-webkit-scrollbar-thumb,
.order-edit-lines::-webkit-scrollbar-thumb { border-radius: 10px; background: #9bb4ca; }
.ai-review-items-wrap::-webkit-scrollbar-track,
.order-edit-lines::-webkit-scrollbar-track { background: #edf2f7; }
.select-filter-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 1px);
  z-index: 120;
  display: grid;
  max-height: 280px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid #a9c4dc;
  border-radius: 0 0 9px 9px;
  background: #fff;
  box-shadow: 0 10px 22px rgba(15, 42, 66, .15);
}
.select-filter-result {
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.select-filter-result:hover,
.select-filter-result:focus-visible { background: #edf7fa; color: #0d7180; }
.select-filter-empty { padding: 9px 10px; color: var(--muted); font-size: 13px; }
[data-searchable-select] { position: relative; }
/* 搜索结果就是唯一可见的商品选择入口；隐藏原生下拉，避免同一商品
   同时出现“搜索结果行”和“原生选项行”，但仍保留 select 作为表单值。 */
[data-searchable-select] > select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}
.order-edit-lines [data-searchable-select] { min-width:250px; }
.order-edit-lines .select-filter-input { width:100%; min-width:0; margin-bottom:5px; }
.order-edit-lines .order-edit-product { width:100%; min-width:0; max-width:none; }
.compact-check { display:flex !important; align-items:center; gap:5px; margin-top:5px; color:var(--muted); font-size:12px; font-weight:400 !important; }
.compact-check input { min-width:0; width:14px; height:14px; }
.pricing-rule-note { padding:12px 20px; border-top:1px solid var(--line); background:#f8fafc; color:var(--muted); font-size:13px; }
.source-review details { cursor:pointer; }
.source-review p { margin-top:12px; white-space:pre-wrap; color:#334155; }
.review-confirm { display:block; margin:14px 0; padding:13px 16px; border:1px solid var(--line); border-radius:10px; background:#fff; }
.sticky-submit { position:sticky; bottom:10px; z-index:5; display:flex; align-items:center; justify-content:flex-end; gap:8px; margin-top:14px; padding:12px; border:1px solid var(--line); border-radius:12px; background:rgba(255,255,255,.96); box-shadow:0 12px 35px rgba(15,23,42,.12); }
@media(max-width:800px){
  .intake-header, .draft-review-head { display:grid; }
  .intake-compose { grid-template-columns:1fr; }
  .intake-service { min-width:0; }
  .order-header-fields { grid-template-columns:1fr; }
  .sticky-submit { bottom:4px; }
  .sticky-submit .primary-btn, .sticky-submit .secondary-btn { flex:1; text-align:center; }
  .ai-review-items-wrap,
  .order-edit-lines { margin-inline: 0; padding-bottom: 8px; }
  .draft-items-table { min-width: 1120px; }
  .order-edit-lines table { min-width: 980px; }
  .order-edit-lines select.order-edit-product { min-width: 260px; max-width: 320px; }
  .order-inline-edit { margin-inline:10px; padding:10px; }
  .order-inline-footer { align-items:stretch; display:grid; }
  .order-inline-footer label, .order-inline-footer .primary-btn { width:100%; }
  .order-edit-lines input,
  .order-edit-lines select { min-height: 40px; }
}

/* 正式订单详情：高密度 B 端信息架构，保持现代视觉和清晰操作层级。 */
.order-command-bar { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:10px; }
.order-command-actions { display:flex; align-items:center; justify-content:flex-end; gap:7px; flex-wrap:wrap; }
.reject-inline { display:flex; gap:6px; }
.reject-inline input { width:150px; }
.more-actions { position:relative; }
.more-actions summary { padding:9px 13px; border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--ink-soft); font-size:13px; cursor:pointer; list-style:none; }
.more-actions[open] > div { position:absolute; right:0; top:42px; z-index:220; display:grid; gap:5px; width:max-content; min-width:240px; max-width:min(340px, calc(100vw - 32px)); padding:9px; border:1px solid var(--line); border-radius:10px; background:#fff; box-shadow:var(--shadow-md); white-space:normal; }
.order-command-bar,
.order-command-actions,
.order-command-bar .more-actions { overflow: visible; }
.order-command-bar:has(.more-actions[open]) { z-index: 1000; }
.order-command-bar .more-actions[open] > div { z-index: 1100; max-height:min(70vh, 520px); overflow-y:auto; }
.more-actions form { display:grid; gap:6px; margin:0; }
.more-actions button { width:100%; padding:9px 10px; border:0; border-radius:7px; background:#f7f8fa; text-align:left; }
.more-actions input { width:100%; }
.more-actions .danger-text { color:var(--danger); }
.export-menu { display:inline-flex; align-items:stretch; vertical-align:middle; }
.export-menu .export-primary { margin:0; border-radius:8px 0 0 8px; }
.export-options { position:relative; }
.export-options > summary { display:grid; place-items:center; min-width:36px; height:100%; padding:0 10px; border:1px solid var(--line); border-left:0; border-radius:0 8px 8px 0; background:#fff; color:var(--ink-soft); cursor:pointer; list-style:none; }
.export-options > summary::-webkit-details-marker { display:none; }
.export-options[open] > div { position:absolute; top:calc(100% + 6px); right:0; z-index:40; display:grid; min-width:240px; padding:7px; border:1px solid var(--line); border-radius:10px; background:#fff; box-shadow:var(--shadow-md); }
.export-options a { display:grid; gap:2px; padding:9px 10px; border-radius:7px; }
.export-options a:hover { background:#f4f6f8; }
.export-options a small { color:var(--muted); font-size:11px; }
.toolbar:has(.export-options[open]),.role-workbench-head:has(.export-options[open]) { position:relative; z-index:80; overflow:visible; }
.export-options[open] { z-index:90; }
.badge.danger { color:#a33a32; background:#fff0ee; }
.todo-head { margin-bottom:10px; }
.todo-summary { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin-bottom:13px; }
.todo-summary a { display:flex; align-items:center; justify-content:space-between; min-height:70px; padding:14px 16px; border:1px solid var(--line); border-radius:11px; background:#fff; color:var(--ink-soft); }
.todo-summary a strong { font-size:23px; color:var(--ink); }
.todo-summary a:hover,.todo-summary a.active { border-color:#94b9d8; background:#f5f9fd; box-shadow:0 4px 14px rgba(15,62,104,.08); }
.todo-summary a.active { box-shadow:inset 0 -3px 0 var(--accent); }
.todo-summary a.danger strong { color:#b64136; }
.todo-create { margin-bottom:13px; }
.todo-list-panel { padding:0; overflow:visible; }
.todo-list-head { padding:17px 18px 11px; margin:0; border-bottom:1px solid var(--line); }
.todo-list { display:grid; }
.todo-item { display:grid; grid-template-columns:105px minmax(260px,1fr) 150px 130px 150px; gap:15px; align-items:center; min-height:94px; padding:14px 18px; border-bottom:1px solid var(--line); background:#fff; transition:background .16s ease,transform .16s ease; }
.todo-item:last-child { border-bottom:0; }
.todo-item:hover { background:#fbfcfe; }
.todo-item.is-overdue { box-shadow:inset 3px 0 0 #d55349; }
.todo-priority,.todo-owner,.todo-due,.todo-action { display:grid; gap:5px; align-content:center; }
.todo-priority .badge { justify-self:start; }
.todo-item small { color:var(--muted); font-size:12px; }
.todo-main { min-width:0; }
.todo-main > strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:15px; }
.todo-main p { margin:5px 0; overflow:hidden; color:var(--muted); text-overflow:ellipsis; white-space:nowrap; }
.todo-action details { position:relative; }
.todo-action summary { text-align:center; list-style:none; }
.todo-action summary::-webkit-details-marker { display:none; }
.todo-action details[open] form { position:absolute; right:0; top:44px; z-index:30; display:grid; gap:10px; width:300px; padding:14px; border:1px solid var(--line); border-radius:11px; background:#fff; box-shadow:var(--shadow-md); }
.todo-action textarea { width:100%; resize:vertical; }
.todo-empty { padding:50px 20px; text-align:center; }
.todo-empty p { margin:7px 0 0; color:var(--muted); }
.order-tabs { display:flex; gap:24px; margin-bottom:0; padding:0 18px; border:1px solid var(--line); border-bottom:0; border-radius:12px 12px 0 0; background:#fff; }
.order-tabs a { position:relative; padding:14px 2px 12px; color:var(--muted); font-size:13px; }
.order-tabs a:hover, .order-tabs a.active { color:var(--accent); }
.order-tabs a.active::after { content:""; position:absolute; left:0; right:0; bottom:0; height:2px; border-radius:2px; background:var(--accent); }
.order-overview { display:flex; align-items:stretch; justify-content:space-between; gap:24px; margin-bottom:0; padding:20px 22px; border:1px solid var(--line); background:#fff; }
.order-overview-main { min-width:0; }
.order-state-row { display:flex; align-items:center; gap:8px; color:var(--warning); font-size:13px; }
.order-state-mark { width:9px; height:9px; border-radius:50%; background:#ef7b26; box-shadow:0 0 0 4px #fff0e5; }
.order-overview h2 { margin:13px 0 10px; font-size:20px; }
.order-meta { display:flex; align-items:center; gap:24px; flex-wrap:wrap; color:var(--muted); font-size:13px; }
.order-meta strong { color:var(--ink-soft); }
.order-meta.secondary { margin-top:9px; color:var(--subtle); }
.order-total { display:grid; align-content:center; min-width:190px; padding-left:26px; border-left:1px solid var(--line); text-align:right; }
.order-total small, .order-total span { color:var(--muted); }
.order-total strong { margin:5px 0; color:var(--danger); font-size:27px; }
.exchange-final-note { color:#9a3412 !important; font-size:12px; }
.order-progress { display:grid; grid-template-columns:repeat(7,minmax(110px,1fr)); margin-bottom:13px; padding:12px 16px; overflow:auto; border:1px solid var(--line); border-top:0; border-radius:0 0 12px 12px; background:#fafbfc; }
.order-progress div { position:relative; display:grid; grid-template-columns:16px 1fr; grid-template-rows:auto auto; column-gap:7px; min-width:105px; }
.order-progress div:not(:last-child)::after { content:""; position:absolute; top:6px; left:14px; right:4px; height:1px; background:var(--line-strong); }
.order-progress i { z-index:1; width:9px; height:9px; margin-top:2px; border:2px solid #c9d0d9; border-radius:50%; background:#fff; }
.order-progress .done i { border-color:var(--success); background:var(--success); }
.order-progress span { z-index:1; color:var(--muted); font-size:11px; }
.order-progress strong { grid-column:2; margin-top:3px; font-size:12px; }
.order-lines-panel { padding:0; overflow:hidden; }
.formal-order-table { min-width:1120px; }
.formal-order-table td { vertical-align:middle; }
.formal-order-table th:nth-child(1), .formal-order-table td:nth-child(1) { width:48px; }
.formal-order-table th:nth-child(2), .formal-order-table td:nth-child(2) { width:250px; }
.formal-order-table th:nth-child(3), .formal-order-table td:nth-child(3) { width:165px; }
.formal-order-table th:nth-child(4), .formal-order-table td:nth-child(4) { width:88px; }
.formal-order-table th:nth-child(5), .formal-order-table td:nth-child(5) { width:72px; }
.formal-order-table th:nth-child(6), .formal-order-table td:nth-child(6) { width:72px; }
.formal-order-table th:nth-child(7), .formal-order-table td:nth-child(7) { width:125px; }
.formal-order-table th:nth-child(8), .formal-order-table td:nth-child(8) { width:125px; }
.formal-order-table th:nth-child(4), .formal-order-table td:nth-child(4) { width:64px; max-width:64px; }
.formal-order-table th:nth-child(5), .formal-order-table td:nth-child(5) { width:58px; max-width:58px; }
.formal-order-table th:nth-child(6), .formal-order-table td:nth-child(6) { width:60px; max-width:60px; }
.formal-order-table th:nth-child(7), .formal-order-table td:nth-child(7) { width:112px; max-width:112px; }
.formal-order-table th:nth-child(8), .formal-order-table td:nth-child(8) { width:112px; max-width:112px; }
.formal-order-table th:nth-child(6), .formal-order-table td:nth-child(6) { width:95px; max-width:95px; }
.formal-order-table th:nth-child(7), .formal-order-table td:nth-child(7) { width:60px; max-width:60px; }
.formal-order-table th:nth-child(8), .formal-order-table td:nth-child(8) { width:112px; max-width:112px; }
.formal-order-table th:nth-child(9), .formal-order-table td:nth-child(9) { width:112px; max-width:112px; }
.product-cost { display:block; margin-top:3px; color:var(--muted); font-size:11px; font-weight:400; white-space:nowrap; }
.order-inline-edit { margin:0 20px 16px; padding:14px; border:1px solid #c9dceb; border-radius:10px; background:#f8fbfd; }
.order-inline-edit .section-head { margin:0 0 10px; }
.order-inline-edit h4 { margin:0 0 3px; font-size:15px; }
.order-inline-edit-wrap { max-width:100%; overflow-x:auto; }
.order-inline-edit-table { min-width:1040px; table-layout:fixed; }
.order-inline-edit-table th:nth-child(1), .order-inline-edit-table td:nth-child(1) { width:360px; }
.order-inline-edit-table th:nth-child(2), .order-inline-edit-table td:nth-child(2) { width:82px; }
.order-inline-edit-table th:nth-child(3), .order-inline-edit-table td:nth-child(3) { width:82px; }
.order-inline-edit-table th:nth-child(4), .order-inline-edit-table td:nth-child(4) { width:95px; }
.order-inline-edit-table th:nth-child(5), .order-inline-edit-table td:nth-child(5) { width:120px; }
.order-inline-edit-table th:nth-child(6), .order-inline-edit-table td:nth-child(6) { width:110px; }
.order-inline-edit-table th:nth-child(7), .order-inline-edit-table td:nth-child(7) { width:90px; }
.order-inline-edit-table th:nth-child(8), .order-inline-edit-table td:nth-child(8) { width:72px; }
.order-inline-edit-table input, .order-inline-edit-table select { width:100%; min-width:0; }
.order-inline-edit-table .select-filter-input { margin-bottom:0; }
.order-inline-edit-table .cost-cell, .order-inline-subtotal { white-space:nowrap; font-variant-numeric:tabular-nums; }
.order-inline-footer { display:flex; align-items:end; justify-content:flex-end; gap:14px; flex-wrap:wrap; padding-top:12px; }
.order-inline-footer label { display:grid; gap:4px; min-width:220px; color:var(--muted); font-size:12px; }
.order-inline-footer input { min-height:36px; }
.select-filter-results { position:fixed; left:auto; right:auto; top:auto; max-height:min(320px, 50vh); overflow-y:auto; white-space:normal; }
.select-filter-result { white-space:normal; line-height:1.4; overflow-wrap:anywhere; }
.order-items-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #9bb4ca #edf2f7;
  touch-action: pan-x pan-y;
}
.order-items-wrap:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.order-items-wrap::-webkit-scrollbar { height:9px; }
.order-items-wrap::-webkit-scrollbar-thumb { border-radius:10px; background:#9bb4ca; }
.order-items-wrap::-webkit-scrollbar-track { background:#edf2f7; }
.formal-order-table tfoot td { background:#fafbfc; font-weight:700; }
.product-cell { display:flex; align-items:center; gap:10px; min-width:220px; }
.product-cell img, .product-placeholder { width:42px; height:42px; flex:0 0 42px; border:1px solid var(--line); border-radius:7px; object-fit:cover; }
.product-placeholder { display:grid; place-items:center; background:#f1f4f7; color:var(--subtle); font-size:10px; }
.select-filter-input {
  width: 100%;
  min-width: 180px;
  margin-bottom: 6px;
}
.number-cell { text-align:right; font-variant-numeric:tabular-nums; }
.strong-number { color:var(--ink); font-weight:750; }
.order-amount-strip { display:flex; align-items:center; justify-content:flex-end; gap:32px; padding:16px 20px; border-top:1px solid var(--line); background:#fff; font-size:13px; }
.order-amount-strip span { color:var(--muted); }
.order-amount-strip strong { margin-left:7px; color:var(--ink); }
.amount-due { color:var(--danger) !important; font-size:18px; }
.order-flow-actions { box-shadow:none; }
.order-command-bar:has(.more-actions[open]) {
  position: relative;
  z-index: 230;
  overflow: visible;
}
.order-primary-actions {
  display: grid;
  grid-template-columns: minmax(180px, .55fr) minmax(0, 1.45fr);
  gap: 18px;
  align-items: center;
  margin: 12px 0 16px;
  padding: 16px 18px;
  border: 1px solid #b9dfe3;
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  background: linear-gradient(135deg, #f4fbfc 0%, #fff 68%);
  box-shadow: 0 8px 24px rgba(23, 73, 81, .08);
}
.order-primary-actions__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.order-primary-actions__head > div { display: grid; gap: 3px; }
.order-primary-actions__head small { color: var(--ink-muted); font-size: 12px; }
.order-primary-actions__head strong { font-size: 17px; color: var(--ink); }
.order-primary-actions__body {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}
.order-primary-actions__body form { margin: 0; }
.order-primary-actions__body input { min-height: 40px; }
.order-sync-summary {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
}
.order-sync-summary strong { color: var(--ink); }
.order-sync-summary small { margin-left: auto; }
.order-sync-summary .order-sync-error {
  flex-basis: 100%;
  margin-left: 0;
  color: var(--danger);
  line-height: 1.55;
}
.order-credit-summary {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink-muted);
}
.order-credit-summary strong { margin-left: 5px; color: var(--ink); }
.order-main-submit { min-height: 42px; padding-inline: 20px; font-weight: 700; }
.order-info-grid { display:grid; grid-template-columns:1.35fr .65fr; gap:13px; margin-bottom:13px; }
.order-info-grid .panel { margin:0; }
.order-info-grid h3 { margin:0; padding-bottom:12px; border-bottom:1px solid var(--line); font-size:17px; }
.order-info-grid dl { grid-template-columns:90px 1fr; }
@media(max-width:900px){
  .order-command-bar, .order-overview { display:grid; }
  .order-primary-actions { grid-template-columns: 1fr; }
  .order-primary-actions__body { justify-content: flex-start; }
  .order-command-actions { justify-content:flex-start; }
  .order-total { min-width:0; padding:14px 0 0; border-left:0; border-top:1px solid var(--line); text-align:left; }
  .order-info-grid { grid-template-columns:1fr; }
  .order-amount-strip { justify-content:flex-start; overflow:auto; }
}

@media(max-width:600px){
  .order-command-bar .more-actions[open] > div {
    position: fixed;
    top: auto;
    right: 14px;
    bottom: 74px;
    left: 14px;
    width: auto;
    max-width: none;
    max-height: 64vh;
    overflow-y: auto;
  }
  .order-primary-actions {
    position: sticky;
    top: 6px;
    z-index: 90;
    margin-inline: -2px;
    padding: 13px;
    border-radius: 10px;
  }
  .order-primary-actions__body,
  .order-primary-actions__body form,
  .order-primary-actions__body button,
  .order-primary-actions__body input {
    width: 100%;
  }
  .order-primary-actions__body .inline-form,
  .order-primary-actions__body .reject-inline,
  .order-primary-actions__body .finance-approval-form {
    display: grid;
    grid-template-columns: 1fr;
  }
  .order-sync-summary {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .order-sync-summary small {
    width: 100%;
    margin-left: 0;
  }
}
@media(max-width:600px){
  .order-command-actions, .reject-inline { display:grid; grid-template-columns:1fr 1fr; width:100%; }
  .reject-inline { grid-column:1/-1; }
  .reject-inline input { width:100%; }
  .order-tabs { gap:16px; overflow:auto; white-space:nowrap; }
  .order-meta { display:grid; gap:6px; }
  .order-progress { grid-template-columns:repeat(7,120px); }
}

/* 采购、库存、招标岗位工作台 */
.role-workbench-head { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:13px; padding:20px 22px; border:1px solid var(--line); border-radius:14px; background:#fff; }
.role-workbench-head h2 { margin:0 0 6px; font-size:23px; }
.role-workbench-head p { margin:0; color:var(--muted); }
.workbench-actions { display:flex; align-items:center; gap:8px; }
.more-actions a { display:block; padding:9px 10px; border-radius:7px; color:var(--ink-soft); font-size:13px; }
.more-actions a:hover { background:#f4f6f8; }

.toolbar:has(.more-actions[open]),
.role-workbench-head:has(.more-actions[open]),
.work-page-head:has(.more-actions[open]) {
  position: relative;
  z-index: 110;
  overflow: visible;
}

.warehouse-profile-form {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafb;
}

.invitation-link-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.simple-flow { display:grid; grid-template-columns:repeat(4,1fr); gap:0; margin-bottom:13px; padding:16px; border:1px solid var(--line); border-radius:14px; background:#fff; }
.simple-flow > div { position:relative; display:flex; align-items:center; gap:10px; min-width:0; padding:5px 16px; }
.simple-flow > div:not(:last-child)::after { content:"→"; position:absolute; right:-5px; color:#aab2bd; }
.simple-flow b { display:grid; place-items:center; width:28px; height:28px; flex:0 0 28px; border-radius:50%; background:#eef1f4; color:#748093; }
.simple-flow .active b { background:var(--accent); color:#fff; }
.simple-flow span { display:grid; min-width:0; }
.simple-flow strong { font-size:13px; }
.simple-flow small { overflow:hidden; color:var(--muted); font-size:11px; text-overflow:ellipsis; white-space:nowrap; }
.task-cards { display:grid; grid-template-columns:repeat(3,1fr); gap:13px; margin-bottom:13px; }
.task-cards article { display:grid; gap:8px; align-content:start; min-height:142px; padding:18px; border:1px solid var(--line); border-radius:13px; background:#fff; }
.task-cards article > span { color:var(--muted); font-size:12px; }
.task-cards article > strong { font-size:26px; }
.task-cards form { margin:0; }
.task-cards a:not(.secondary-btn), .task-cards article > form { margin-top:auto; color:var(--accent); font-size:13px; }
.compact-btn { padding:7px 11px; border-radius:7px; font-size:12px; }
.decision-summary { display:flex; align-items:center; justify-content:space-between; gap:24px; margin-bottom:13px; padding:21px; border:1px solid var(--line); border-radius:14px; background:#fff; }
.decision-summary h2 { margin:9px 0 5px; }
.decision-summary p { margin:0; color:var(--muted); }
.decision-help { display:grid; gap:4px; min-width:290px; padding:13px 15px; border-radius:10px; background:#f5f8fb; font-size:12px; }
.decision-help span { color:var(--muted); }
.procurement-choice { display:grid; grid-template-columns:1fr 1fr; gap:13px; }
.choice-card { align-self:start; border:1px solid var(--line); border-radius:13px; background:#fff; overflow:hidden; }
.choice-card > summary { display:flex; align-items:center; gap:12px; padding:18px; cursor:pointer; list-style:none; }
.choice-card > summary > span:nth-child(2) { display:grid; gap:3px; }
.choice-card summary small { color:var(--muted); font-weight:400; }
.choice-icon { display:grid; place-items:center; width:38px; height:38px; flex:0 0 38px; border-radius:10px; background:#e8f2fb; color:var(--accent); font-weight:800; }
.choice-icon.tender { background:#f0edfb; color:#7652c7; }
.choice-card[open] > summary { border-bottom:1px solid var(--line); }
.choice-card form { padding:18px; }
.selection-lines { display:grid; gap:7px; max-height:190px; padding:10px; overflow:auto; border:1px solid var(--line); border-radius:8px; }
.selection-lines label { display:flex; align-items:center; gap:7px; font-size:12px; font-weight:400; }
.collapsible-panel { padding:0; overflow:visible; }
.collapsible-panel > summary, .warehouse-setting > summary, .project-bids > summary { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:17px 20px; cursor:pointer; list-style:none; }
.collapsible-panel > summary span, .warehouse-setting > summary span, .project-bids > summary span { display:grid; gap:3px; }
.collapsible-panel > summary small, .warehouse-setting > summary small, .project-bids > summary small { color:var(--muted); font-weight:400; }
.collapsible-panel > summary b, .warehouse-setting > summary b, .project-bids > summary b { color:var(--accent); font-size:12px; }
.collapsible-panel > summary .open-label { display:none; }
.collapsible-panel[open] > summary .closed-label { display:none; }
.collapsible-panel[open] > summary .open-label { display:block; }
.collapsible-panel[open] > summary, .warehouse-setting[open] > summary, .project-bids[open] > summary { border-bottom:1px solid var(--line); }
.collapsible-panel > .table-wrap, .collapsible-panel > form { margin:16px; }
.collapsible-panel > .pagination { margin:0 16px 16px; border:1px solid var(--line); border-radius:6px; }
.settings-list { display:grid; gap:10px; }
.warehouse-setting { padding:0; overflow:hidden; }
.warehouse-setting > .content-grid { padding:18px; }
.tender-project-list { display:grid; gap:13px; margin-bottom:13px; }
.tender-project { padding:0; overflow:hidden; }
.tender-project-head { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:18px 20px; }
.tender-project-head h3 { margin:8px 0 4px; font-size:18px; }
.tender-project-head small { color:var(--muted); }
.tender-project-count { display:grid; min-width:80px; text-align:right; }
.tender-project-count strong { font-size:27px; }
.tender-project-count span { color:var(--muted); font-size:11px; }
.next-action { display:flex; align-items:center; gap:12px; margin:0 20px; padding:11px 13px; border-radius:9px; background:#fff7e8; color:#80500a; font-size:12px; }
.next-action.success { background:var(--success-soft); color:var(--success); }
.project-actions { display:flex; align-items:center; gap:7px; flex-wrap:wrap; padding:14px 20px; }
.project-actions form { margin:0; }
.project-invite-form { display:flex; gap:7px; }
.project-invite-form select { min-width:260px; }
.comparison-summary { margin:0 20px 14px; padding:13px; border-left:3px solid #7652c7; background:#f7f5fc; }
.comparison-summary p { margin:4px 0 0; }
.tender-scope { margin:0 20px 10px; padding:12px 14px; border:1px solid var(--line); border-radius:9px; background:#fafbfc; }
.tender-scope p { margin:5px 0 0; white-space:pre-wrap; }
.tender-brief { border-top:4px solid var(--accent); }
.award-to-order { margin:0 20px 14px; border:1px solid #9dd7bf; border-radius:10px; background:#f3fbf7; overflow:hidden; }
.award-to-order > summary { padding:13px 15px; color:var(--success); cursor:pointer; }
.award-to-order form { display:grid; gap:12px; padding:14px; border-top:1px solid #c9eadb; }
.award-to-order form > label { max-width:260px; }
.award-to-order table input[type=number] { width:150px; }
.project-bids { border-top:1px solid var(--line); }
.project-bids .table-wrap { border:0; border-radius:0; }
.score-cell { color:var(--accent); font-size:19px; font-weight:800; }
.review-mini { display:grid; gap:6px; min-width:170px; }
.empty-guide { text-align:center; padding:42px; }
.empty-guide p { margin-bottom:16px; }
@media(max-width:950px){
  .simple-flow { grid-template-columns:1fr 1fr; }
  .simple-flow > div:nth-child(2)::after { display:none; }
  .task-cards, .procurement-choice { grid-template-columns:1fr; }
}
@media(max-width:700px){
  .role-workbench-head, .decision-summary, .tender-project-head { display:grid; }
  .workbench-actions { flex-wrap:wrap; }
  .simple-flow { grid-template-columns:1fr; }
  .simple-flow > div::after { display:none !important; }
  .decision-help { min-width:0; }
  .project-invite-form { display:grid; width:100%; }
  .project-invite-form select { min-width:0; width:100%; }
}
.driver-task-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.driver-task-card { display:grid; gap:14px; padding:18px; border:1px solid var(--line); border-radius:14px; background:#fff; }
.driver-task-card > div:first-child { display:grid; gap:5px; }
.driver-task-card > div:first-child .badge { justify-self:start; }
.driver-task-card > div:first-child > strong { margin-top:4px; font-size:18px; }
.driver-task-card small { color:var(--muted); }
.driver-task-card dl { grid-template-columns:64px 1fr; margin:0; font-size:13px; }
.driver-task-card.completed { opacity:.72; }
.toolbar > div:first-child { display:grid; gap:4px; }
.toolbar > div:first-child small { color:var(--muted); }
.delivery-order-picker { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; min-width:0; margin:0; padding:14px; border:1px solid var(--line); border-radius:10px; }
.delivery-order-picker legend { padding:0 6px; color:var(--ink); font-weight:750; }
.delivery-order-option { display:flex !important; align-items:flex-start; gap:10px; min-width:0; padding:12px; border:1px solid var(--line); border-radius:8px; background:#fff; cursor:pointer; }
.delivery-order-option:has(input:checked) { border-color:var(--accent); background:var(--accent-soft); box-shadow:inset 3px 0 0 var(--accent); }
.delivery-order-option input { flex:0 0 auto; width:18px; height:18px; margin-top:2px; }
.delivery-order-option span { display:grid; gap:4px; min-width:0; }
.delivery-order-option small { overflow-wrap:anywhere; color:var(--muted); font-weight:400; }
.delivery-point-toolbar { display:flex; align-items:center; justify-content:flex-end; gap:8px; }
.delivery-point-toolbar > span { margin-right:auto; color:var(--muted); }
.delivery-point-list { display:grid; gap:12px; }
.delivery-point-group { overflow:hidden; border:1px solid var(--line); border-radius:11px; background:#fff; }
.delivery-point-group > header { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:14px; background:#f8fafb; border-bottom:1px solid var(--line); }
.delivery-point-group > header > div { display:grid; gap:3px; min-width:0; }
.delivery-point-group > header small, .delivery-point-group > header p { margin:0; color:var(--muted); font-size:12px; overflow-wrap:anywhere; }
.delivery-point-orders { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; padding:10px; }
.delivery-mobile-list { display:none; }
.delivery-mobile-card { display:grid; gap:8px; padding:14px; border:1px solid var(--line); border-radius:10px; background:#fff; }
.delivery-mobile-card > div { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.delivery-mobile-card p { margin:0; color:var(--muted); font-size:13px; overflow-wrap:anywhere; }
.warehouse-mobile-list { display:none; }
.warehouse-mobile-card { display:grid; gap:9px; padding:14px; border:1px solid var(--line); border-radius:10px; background:#fff; }
.warehouse-mobile-card > div { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.warehouse-mobile-card > small { color:var(--muted); overflow-wrap:anywhere; }
.warehouse-mobile-card dl { grid-template-columns:82px minmax(0,1fr); gap:7px; margin:2px 0; font-size:13px; }
.driver-product-list { display:grid; gap:0; margin-top:18px; border:1px solid var(--line); border-radius:10px; overflow:hidden; }
.driver-product-list > div { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:13px; border-bottom:1px solid var(--line); }
.driver-product-list > div:last-child { border-bottom:0; }
.driver-product-list span { display:grid; gap:3px; }
.driver-product-list small { color:var(--muted); }
.driver-exception { margin-top:18px; border-top:1px solid var(--line); }
.driver-exception summary { padding:15px 0; color:var(--danger); cursor:pointer; }
.driver-exception form { padding-top:8px; }
.success-alert { background:#ecf8f2; color:#087443; }
.simple-order-form { display:grid; gap:12px; padding-bottom:74px; }
.order-step { padding:0; overflow:hidden; }
.order-step-head { display:flex; align-items:center; gap:12px; padding:16px 18px; border-bottom:1px solid var(--line); background:#fafbfc; }
.order-step-head > b { display:grid; place-items:center; width:30px; height:30px; border-radius:50%; background:var(--accent); color:#fff; }
.order-step-head h3 { margin:0 0 3px; font-size:18px; }
.order-step-head small { color:var(--muted); }
.order-step > .form-grid { padding:18px; }
.order-entry-wrap { border:0; border-radius:0; }
.order-entry-table { min-width:960px; }
.order-entry-table td { vertical-align:middle; }
.order-product-picker { display:flex; align-items:center; gap:10px; min-width:330px; }
.order-product-picker select { flex:1; min-width:250px; }
.order-product-preview { display:grid; place-items:center; width:52px; height:52px; flex:0 0 52px; overflow:hidden; border:1px solid var(--line); border-radius:8px; background:#f5f7f9; }
.order-product-preview img { width:100%; height:100%; object-fit:cover; }
.order-product-preview span { padding:4px; color:var(--muted); font-size:9px; text-align:center; }
.ai-product-preview { width:48px; height:48px; }
.add-line-btn { margin:12px 18px 16px; }
.order-advanced { padding:0; }
.order-advanced > summary { padding:15px 18px; color:var(--muted); cursor:pointer; }
.order-advanced[open] > summary { border-bottom:1px solid var(--line); color:var(--ink); }
.order-advanced > .form-grid { padding:18px; }
.simple-order-submit { transition:box-shadow .18s ease, transform .18s ease; }
.simple-order-form.is-submitting .simple-order-submit { box-shadow:0 -8px 26px rgba(13,98,159,.12); }
.simple-order-form.is-submitting .simple-order-submit .primary-btn { pointer-events:none; opacity:.72; }
.row-reveal { animation:row-reveal .24s ease-out both; }

/* 克制的业务动效：用于层级、反馈和状态变化，不妨碍高频操作。 */
.main > .page-heading, .main > .alert, .main > form, .main > section, .main > nav {
  animation:page-enter .28s ease-out both;
}
.main > :nth-child(3) { animation-delay:.025s; }
.main > :nth-child(4) { animation-delay:.05s; }
.panel, .driver-task-card, .warehouse-mobile-card, .delivery-mobile-card {
  transition:transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.panel:hover, .driver-task-card:hover, .warehouse-mobile-card:hover, .delivery-mobile-card:hover {
  border-color:#d5dee7;
  box-shadow:0 8px 24px rgba(20,38,58,.07);
}
.primary-btn, .secondary-btn, .danger-btn {
  transition:transform .12s ease, box-shadow .16s ease, background .16s ease, opacity .16s ease;
}
.primary-btn:hover { transform:translateY(-1px); box-shadow:0 7px 18px rgba(13,98,159,.2); }
.primary-btn:active, .secondary-btn:active, .danger-btn:active { transform:translateY(1px) scale(.99); }
.badge.warn { animation:status-soft-pulse 2.8s ease-in-out infinite; }
@keyframes page-enter { from { opacity:0; transform:translateY(5px); } to { opacity:1; transform:none; } }
@keyframes row-reveal { from { opacity:0; transform:translateY(-5px); } to { opacity:1; transform:none; } }
@keyframes status-soft-pulse { 0%,100% { box-shadow:0 0 0 0 rgba(184,103,0,0); } 50% { box-shadow:0 0 0 3px rgba(184,103,0,.08); } }
@media(max-width:700px){
  .driver-task-grid { grid-template-columns:1fr; }
  .driver-task-card { padding:15px; }
  .driver-task-card .primary-btn { width:100%; min-height:48px; text-align:center; }
  .dispatch-create, .batch-delivery-sign { padding:14px; }
  .batch-delivery-sign:not([hidden]) { padding-bottom:88px; }
  .batch-delivery-sign .section-head { align-items:center; }
  .batch-delivery-sign .section-head h3 { font-size:18px; }
  .delivery-order-picker { grid-template-columns:1fr; padding:10px; }
  .delivery-order-option { min-height:76px; padding:13px; }
  .delivery-order-option input { width:22px; height:22px; }
  .delivery-order-option strong { font-size:15px; line-height:1.35; }
  .delivery-order-option small { font-size:13px; line-height:1.4; }
  .delivery-point-toolbar { flex-wrap:wrap; justify-content:flex-start; }
  .delivery-point-toolbar > span { width:100%; margin:0; }
  .delivery-point-group > header { align-items:flex-start; }
  .delivery-point-group > header .secondary-btn { flex:0 0 auto; margin:0; padding:9px 10px; }
  .delivery-point-orders { grid-template-columns:1fr; }
  .delivery-desktop-table { display:none; }
  .delivery-mobile-list { display:grid; gap:10px; }
  .warehouse-desktop-table { display:none; }
  .warehouse-mobile-list { display:grid; gap:10px; }
  .warehouse-mobile-card .primary-btn { width:100%; min-height:48px; text-align:center; }
  .driver-detail-head { align-items:flex-start; }
  .driver-detail-head .chips { margin-top:8px; }
  .driver-portal-grid { display:grid; grid-template-columns:1fr; }
  .driver-action-panel { order:-1; }
  .driver-primary-action { width:100%; min-height:54px; font-size:17px; }
  .mobile-camera-field {
    min-height:74px;
    padding:13px;
    border:1px dashed var(--brand);
    border-radius:12px;
    background:var(--brand-soft);
    color:var(--ink);
  }
  .mobile-camera-field input {
    width:100%;
    min-height:44px;
    margin-top:8px;
    font-size:14px;
  }
  .mobile-camera-field > span {
    display:block;
    margin-top:5px;
    color:var(--muted);
    font-size:12px;
    font-weight:500;
  }
  .mobile-primary-action {
    position:sticky;
    z-index:20;
    bottom:max(0px, env(safe-area-inset-bottom));
    margin:12px -14px -88px;
    padding:12px 14px;
    border-top:1px solid var(--line);
    background:rgba(255,255,255,.96);
    box-shadow:0 -10px 28px rgba(24,39,58,.12);
    backdrop-filter:blur(16px);
  }
  .mobile-primary-action .primary-btn {
    justify-content:space-between;
    width:100%;
    min-height:54px;
    font-size:16px;
  }
  .portal-shell .main { width:100%; padding:14px; }
  .portal-shell .topbar { display:grid; gap:12px; }
  .portal-shell .detail-list { grid-template-columns:82px minmax(0,1fr); }
  .portal-shell dd { overflow-wrap:anywhere; }
  .simple-order-form { padding-bottom:84px; }
  .order-step > .form-grid { padding:14px; }
  .order-entry-table, .order-entry-table tbody, .order-entry-table tr, .order-entry-table td { display:block; width:100%; min-width:0; }
  .order-entry-table thead { display:none; }
  .order-entry-table tr { padding:13px; border-bottom:1px solid var(--line); }
  .order-entry-table td { display:grid; grid-template-columns:82px minmax(0,1fr); align-items:center; gap:8px; padding:5px 0; border:0; }
  .order-entry-table td::before { color:var(--muted); font-size:12px; }
  .order-entry-table td:nth-child(1)::before { content:"序号"; }
  .order-entry-table td:nth-child(2)::before { content:"操作"; }
  .order-entry-table td:nth-child(3)::before { content:"商品"; }
  .order-entry-table td:nth-child(4)::before { content:"数量"; }
  .order-entry-table td:nth-child(5)::before { content:"规格"; }
  .order-entry-table td:nth-child(6)::before { content:"单位"; }
  .order-entry-table td:nth-child(7)::before { content:"原价"; }
  .order-entry-table td:nth-child(8)::before { content:"折扣"; }
  .order-entry-table td:nth-child(9)::before { content:"成交单价"; }
  .order-entry-table td:nth-child(10)::before { content:"金额小计"; }
  .order-entry-table td:nth-child(11)::before { content:"可用库存"; }
  .order-entry-table td:nth-child(12)::before { content:"备注"; }
  .order-product-picker { min-width:0; }
  .order-product-picker select { min-width:0; width:100%; }
  .order-entry-table input { width:100%; min-height:44px; }
  .simple-order-submit { left:0; right:0; bottom:0; z-index:24; padding:12px 16px max(12px,env(safe-area-inset-bottom)); background:rgba(255,255,255,.96); box-shadow:0 -8px 24px rgba(20,38,58,.1); }
  .simple-order-submit .primary-btn { flex:1; min-height:48px; text-align:center; }
}

/* 明确提醒，而不是让员工从十几个状态字段里自行寻找异常。 */
.attention-row { position:relative; background:#fff9f8; box-shadow:inset 4px 0 0 #d92d20; animation:attention-enter .38s ease-out both; }
.attention-row:hover { background:#fff4f2; }
.attention-tag { display:inline-flex; margin-top:6px; padding:3px 7px; border:1px solid #f5b7b1; border-radius:6px; background:#fff0ee; color:#b42318; font-size:11px; font-weight:750; }
@keyframes attention-enter { from { opacity:.45; transform:translateX(-4px); } to { opacity:1; transform:translateX(0); } }

/* AI识别过程使用业务语言展示，隐藏底层模型和JSON细节。 */
.ai-processing { position:fixed; inset:0; z-index:100; display:grid; place-items:center; padding:20px; background:rgba(15,23,42,.38); backdrop-filter:blur(5px); }
.ai-processing[hidden] { display:none; }
.ai-processing-card { width:min(440px,100%); padding:30px; border:1px solid rgba(255,255,255,.8); border-radius:18px; background:#fff; box-shadow:0 28px 80px rgba(15,23,42,.22); text-align:center; }
.ai-processing-card h3 { margin:16px 0 7px; font-size:22px; }
.ai-processing-card p { margin:0 0 8px; color:var(--ink-soft); }
.ai-processing-card small { color:var(--muted); }
.ai-orbit { position:relative; display:inline-grid; place-items:center; width:54px; height:54px; border:2px solid #dce9f5; border-radius:50%; }
.ai-orbit::before { content:"AI"; color:var(--accent); font-size:13px; font-weight:850; }
.ai-orbit i { position:absolute; inset:-3px; border:3px solid transparent; border-top-color:var(--accent); border-radius:50%; animation:ai-spin .9s linear infinite; }
@keyframes ai-spin { to { transform:rotate(360deg); } }
.ai-is-processing { overflow:hidden; }

.manual-requirement { border-left:4px solid var(--accent); }
.mobile-entry-table select { min-width:420px; }
.mobile-entry-table input { width:160px; }
.product-thumb { width:58px; height:58px; overflow:hidden; border:1px solid var(--line); border-radius:9px; background:#f5f7f9; }
.product-thumb img { width:100%; height:100%; object-fit:cover; transition:transform .18s ease; }
.product-thumb:hover img { transform:scale(1.08); }
.product-thumb span { display:grid; place-items:center; height:100%; padding:4px; color:var(--subtle); font-size:10px; text-align:center; }
@media(max-width:700px){
  .mobile-entry-table { min-width:0; }
  .mobile-entry-table thead { display:none; }
  .mobile-entry-table, .mobile-entry-table tbody, .mobile-entry-table tr, .mobile-entry-table td { display:block; width:100%; }
  .mobile-entry-table tr { padding:10px; border-bottom:1px solid var(--line); }
  .mobile-entry-table td { padding:4px; border:0; }
  .mobile-entry-table select, .mobile-entry-table input { width:100%; min-width:0; min-height:46px; }
  .portal-shell .content-grid { grid-template-columns:1fr; }
  .portal-shell .primary-btn, .portal-shell .danger-btn { width:100%; min-height:50px; font-size:16px; }
}
.row-menu { position: relative; display: inline-block; margin-left: 8px; }
.row-menu summary { color: var(--accent-strong); cursor: pointer; list-style: none; }
.popover-form { position: absolute; z-index: 12; right: 0; top: 24px; width: 300px; padding: 12px; border: 1px solid var(--line); border-radius: 5px; background: #fff; box-shadow: var(--shadow-md); }
.popover-form input { width: 100%; }
.report-tabs { display: flex; gap: 2px; margin-bottom: 10px; overflow-x: auto; border-bottom: 1px solid var(--line); background: #fff; }
.report-tabs a { padding: 10px 16px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 12px; white-space: nowrap; }
.report-tabs a:hover, .report-tabs a.active { color: var(--accent-strong); border-color: var(--accent); }
.ai-report-toolbar form { margin: 0; }
.ai-report-toolbar button:disabled { cursor: not-allowed; opacity: .5; }
.product-movement-panel { margin-bottom:12px; }
.movement-top-five { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px; margin-bottom:12px; }
.movement-top-five article { display:grid; gap:5px; padding:12px; border:1px solid var(--line); border-radius:7px; background:#fafbfc; }
.movement-top-five article > small { color:var(--muted); }
.movement-top-five article > strong { min-height:38px; line-height:1.35; }
.movement-top-five article > span { font-size:12px; }
.ai-analysis-report { margin-bottom: 12px; }
.executive-summary { padding: 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); }
.executive-summary p { margin: 8px 0; color: var(--ink); font-size: 15px; line-height: 1.7; }
.ai-report-grid, .ai-chart-grid { display: grid; gap: 10px; margin-top: 12px; }
.ai-report-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.ai-chart-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.ai-report-grid > article, .report-chart { padding: 14px; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.ai-report-grid h4, .report-chart h4 { margin: 0 0 10px; }
.analysis-item { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.analysis-item:last-child { border-bottom: 0; }
.analysis-item p, .analysis-item small { grid-column: 1/-1; margin: 0; line-height: 1.55; }
.mini-chart-row { display: grid; grid-template-columns: 92px minmax(80px,1fr) 74px; align-items: center; gap: 8px; min-height: 30px; font-size: 11px; }
.mini-chart-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-chart-row > i { height: 9px; overflow: hidden; border-radius: 2px; background: #edf1f4; }
.mini-chart-row > i > b { display: block; height: 100%; background: var(--accent); }
.mini-chart-row > strong { text-align: right; }
.chart-insights, .data-limitations { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); background: #fafbfc; }
.chart-insights p { margin: 4px 0; }
.data-limitations ul { margin-bottom: 0; }
.metrics { gap: 8px; }
.metric-card, .metrics article { padding: 14px; }
.metric-card strong, .metrics strong { font-size: 24px; }

/* Executive operations dashboard */
.role-focus-card {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  align-items: center;
  gap: 24px;
  margin-bottom: 14px;
  padding: 22px 24px;
  border: 1px solid #cfe4e7;
  border-radius: 8px;
  background: linear-gradient(120deg, #f2fbfb 0%, #fff 68%);
  box-shadow: 0 3px 12px rgba(22, 139, 153, .07);
}
.role-focus-kicker {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
}
.role-focus-card h2 { margin: 3px 0 4px; font-size: 24px; }
.role-focus-card p { margin: 0; color: var(--muted); }
.role-focus-counts { display: flex; gap: 24px; }
.role-focus-counts span { display: grid; min-width: 76px; }
.role-focus-counts strong { color: #172033; font-size: 25px; }
.role-focus-counts small { color: var(--muted); }
.role-focus-actions { display: flex; gap: 8px; }
.dashboard-section { margin-bottom: 14px; padding: 22px 24px; border: 1px solid var(--line); border-radius: 6px; background: #fff; box-shadow: 0 1px 3px rgba(16,24,40,.05); }
.dashboard-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.dashboard-head h2 { margin: 0; color: #172033; font-size: 20px; }
.dashboard-head small { display: block; margin-top: 5px; color: var(--muted); }
.dashboard-head a, .dashboard-actions a { color: var(--accent-strong); font-size: 13px; }
.dashboard-actions { display: flex; gap: 20px; }
.todo-grid { display: grid; grid-template-columns: repeat(6,minmax(140px,1fr)); gap: 16px; }
.todo-card { display: flex; align-items: center; gap: 14px; min-height: 92px; padding: 15px; border-radius: 4px; background: #e8f7f8; transition: transform .15s,box-shadow .15s; }
.todo-card:hover { transform: translateY(-2px); box-shadow: 0 7px 18px rgba(22,139,153,.12); }
.todo-icon { display: grid; place-items: center; width: 52px; height: 52px; flex: 0 0 52px; border-radius: 50%; color: #fff; background: #18b3bd; font-size: 18px; font-weight: 800; }
.todo-card strong,.todo-card small { display: block; }
.todo-card strong { margin-bottom: 4px; color: #172033; font-size: 25px; }
.todo-card small { color: #526174; font-size: 14px; }
.period-tabs { display: flex; border: 1px solid var(--line-strong); border-radius: 4px; overflow: hidden; }
.period-tabs a { min-width: 76px; padding: 10px 15px; border-right: 1px solid var(--line-strong); color: #344054; text-align: center; }
.period-tabs a:last-child { border-right: 0; }
.period-tabs a.active { color: var(--accent-strong); background: var(--accent-soft); }
.business-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 28px; }
.business-summary article { padding: 20px 24px; border: 1px solid #d5dde7; border-radius: 5px; }
.business-summary article:first-child { border: 2px solid #19b3bd; }
.business-summary h3 { margin: 0 0 18px; font-size: 16px; font-weight: 600; }
.business-summary article > div { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; text-align: center; }
.business-summary strong,.business-summary small { display: block; }
.business-summary strong { margin-bottom: 10px; color: #172033; font-size: 23px; }
.business-summary small { color: #344054; font-size: 14px; }
.dashboard-charts { display: grid; grid-template-columns: 1.15fr .85fr; gap: 28px; }
.chart-panel { min-width: 0; padding: 18px 8px 6px; }
.chart-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.chart-title h3 { margin: 0; font-size: 18px; font-weight: 600; }
.chart-title span { color: var(--muted); font-size: 12px; }
.chart-title i { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 50%; }
.legend-sales { background: #2388e8; }.legend-profit { background: #ff8a1f; }
#sales-trend { width: 100%; height: 280px; }
.category-chart { display: grid; grid-template-columns: minmax(220px,.9fr) minmax(180px,1.1fr); align-items: center; gap: 24px; min-height: 280px; }
.donut-wrap { display: grid; place-items: center; }
.donut { display: grid; place-items: center; width: 220px; height: 220px; border-radius: 50%; background: #edf1f5; position: relative; }
.donut::after { content: ""; position: absolute; inset: 46px; border-radius: 50%; background: #fff; }
.donut span { position: relative; z-index: 1; text-align: center; }
.donut strong,.donut small { display: block; }.donut strong { font-size: 21px; }.donut small { margin-top: 4px; color: var(--muted); }
.category-legend { display: grid; gap: 12px; }
.category-legend > div { display: grid; grid-template-columns: 10px minmax(0,1fr) auto; align-items: center; gap: 9px; font-size: 13px; }
.category-legend i { width: 9px; height: 9px; border-radius: 50%; }
.category-legend span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-bottom { display: grid; grid-template-columns: 1.6fr .7fr; gap: 14px; }
.compact-orders { display: grid; }
.compact-orders a { display: grid; grid-template-columns: minmax(0,1fr) 110px 110px; align-items: center; gap: 15px; min-height: 58px; border-top: 1px solid var(--line); }
.compact-orders a:first-child { border-top: 0; }
.compact-orders strong,.compact-orders small { display: block; }.compact-orders small { margin-top: 3px; color: var(--muted); }
.compact-orders b { text-align: right; }.compact-orders em { color: var(--accent-strong); font-style: normal; text-align: right; }
.risk-summary > a { display: flex; align-items: center; justify-content: space-between; min-height: 56px; border-top: 1px solid var(--line); color: #344054; }
.risk-summary > a strong { font-size: 20px; }

/* Customer sales analysis */
.analysis-tabs { margin: 0; border: 0; }
.customer-analysis-filter { display: grid; grid-template-columns: 1.5fr 1.2fr repeat(5,minmax(125px,.8fr)); gap: 12px; margin-bottom: 12px; padding: 16px; }
.customer-analysis-filter > label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
.customer-analysis-filter input,.customer-analysis-filter select { width: 100%; }
.customer-analysis-filter .date-range { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; }
.customer-analysis-filter .date-range i { color: var(--subtle); font-style: normal; }
.customer-analysis-filter .filter-actions { grid-column: 1/-1; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.customer-analysis-kpis { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 10px; margin-bottom: 12px; }
.customer-analysis-kpis article { min-width: 0; padding: 17px 18px; border: 1px solid var(--line); border-radius: 5px; background: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.customer-analysis-kpis span,.customer-analysis-kpis strong,.customer-analysis-kpis small { display: block; }
.customer-analysis-kpis span { color: var(--muted); font-size: 12px; }
.customer-analysis-kpis strong { margin: 8px 0 5px; overflow: hidden; color: #172033; font-size: 23px; text-overflow: ellipsis; }
.customer-analysis-kpis small { color: var(--subtle); }
.customer-share-panel { margin-bottom: 12px; }
.segmented-control { display: flex; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 4px; }
.segmented-control a { min-width: 72px; padding: 7px 12px; color: var(--muted); text-align: center; }
.segmented-control a.active { color: var(--accent-strong); background: var(--accent-soft); }
.customer-share-chart { display: grid; grid-template-columns: minmax(240px,.7fr) minmax(380px,1.3fr); align-items: center; gap: 36px; min-height: 300px; padding: 8px 28px 20px; }
.customer-donut { margin: auto; transition: transform .22s ease; }
.customer-donut:hover { transform: scale(1.025); }
.customer-chart-legend { display: grid; gap: 7px; }
.customer-chart-legend > div { display: grid; grid-template-columns: 10px minmax(120px,1fr) 120px 64px; align-items: center; gap: 10px; min-height: 30px; border-bottom: 1px solid #f0f2f5; font-size: 12px; }
.customer-chart-legend i { width: 9px; height: 9px; border-radius: 50%; }
.customer-chart-legend span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-chart-legend strong,.customer-chart-legend em { text-align: right; }
.customer-chart-legend em { color: var(--accent-strong); font-style: normal; }
.customer-analysis-table table { min-width: 1780px; }
.customer-analysis-table th { position: sticky; top: 0; z-index: 1; }
.customer-analysis-table td { white-space: nowrap; }
.table-primary-link { display: grid; min-width: 210px; color: var(--ink); }
.table-primary-link:hover strong { color: var(--accent-strong); }
.table-primary-link small,.number-positive small,.number-negative small { display: block; margin-top: 3px; color: var(--subtle); }
.comparison { display: inline-flex; min-width: 70px; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.comparison.up,.number-positive { color: #db5b4b; }
.comparison.down,.number-negative { color: #16986a; }
.comparison.new { color: #8a63c7; }
.comparison.flat { color: var(--subtle); }
.detail-kpis { grid-template-columns: repeat(4,minmax(0,1fr)); }
.alert.warning { border-color: #efd59b; color: #7a5511; background: #fff9e9; }

@media (max-width: 820px) {
  .movement-top-five { grid-template-columns:1fr 1fr; }
  .sidebar { width: min(86vw, 290px); }
  .main { padding: 0 10px 78px; }
  .topbar { min-height: 52px; margin: 0 -10px; padding: 0 10px; }
  .workspace-tabs a, .workspace-tabs span { min-height: 40px; padding: 0 11px; }
  .page-heading { min-height: 52px; margin: 0 -10px 10px; padding: 0 12px; }
  .page-heading h1 { font-size: 18px; }
  .master-list-layout { grid-template-columns: 1fr; }
  .category-rail { display: flex; overflow-x: auto; padding: 6px; }
  .category-rail strong { display: none; }
  .category-rail a { white-space: nowrap; }
  .list-toolbar { display: grid; }
  .list-toolbar .inline-fields { grid-template-columns: 1fr 1fr; }
  .list-toolbar > .actions, .list-toolbar > div:last-child { display: grid; grid-template-columns: 1fr 1fr; }
  .popover-form { position: fixed; left: 12px; right: 12px; bottom: 72px; top: auto; width: auto; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .ai-report-grid, .ai-chart-grid { grid-template-columns: 1fr; }
  .filter-actions { grid-column: 1/-1; justify-content: flex-end; }
  .table-row-actions { opacity: 1; }
  .todo-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .business-summary,.dashboard-charts,.dashboard-bottom { grid-template-columns: 1fr; }
  .category-chart { grid-template-columns: 1fr 1fr; }
  .customer-analysis-filter { grid-template-columns: 1fr 1fr; }
  .customer-analysis-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .customer-share-chart { grid-template-columns: 1fr; gap: 14px; padding: 8px 8px 18px; }
  .todo-summary { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .todo-list-head { display:grid; gap:10px; }
  .todo-item { grid-template-columns:86px minmax(0,1fr) 110px; gap:10px; padding:14px 12px; }
  .todo-owner { display:none; }
  .todo-action { grid-column:2/-1; }
  .todo-action details[open] form { position:static; width:100%; margin-top:8px; }
}

@media (max-width: 480px) {
  .workspace-tabs a:first-child { display: none; }
  .top-actions .user-brief { display: none; }
  .list-toolbar .inline-fields, .list-toolbar > .actions, .list-toolbar > div:last-child { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-actions { grid-column: auto; }
  .metric-card strong, .metrics strong { font-size: 21px; }
  .dashboard-section { padding: 16px 12px; }
  .dashboard-head { align-items: flex-start; }
  .dashboard-head h2 { font-size: 18px; }
  .period-tabs a { min-width: auto; padding: 8px 10px; }
  .todo-grid { gap: 8px; }
  .todo-card { min-height: 76px; padding: 10px; gap: 9px; }
  .todo-icon { width: 40px; height: 40px; flex-basis: 40px; }
  .todo-card strong { font-size: 21px; }
  .todo-card small { font-size: 12px; }
  .business-summary { gap: 8px; }
  .business-summary article { padding: 15px 10px; }
  .business-summary strong { font-size: 17px; }
  .category-chart { grid-template-columns: 1fr; }
  .donut { width: 190px; height: 190px; }
  .compact-orders a { grid-template-columns: minmax(0,1fr) auto; }
  .compact-orders em { grid-column: 1/-1; text-align: left; }
  .customer-analysis-filter { grid-template-columns: 1fr; }
  .customer-analysis-filter .filter-actions { align-items: stretch; display: grid; grid-template-columns: 1fr 1fr; }
  .customer-analysis-filter .check-field { grid-column: 1/-1; }
  .customer-analysis-kpis { gap: 7px; }
  .customer-analysis-kpis article { padding: 13px 12px; }
  .customer-analysis-kpis strong { font-size: 18px; }
  .customer-chart-legend > div { grid-template-columns: 9px minmax(90px,1fr) 90px 52px; gap: 6px; }
  .todo-summary a { min-height:58px; padding:11px 12px; }
  .todo-summary a strong { font-size:20px; }
  .todo-item { grid-template-columns:74px minmax(0,1fr); }
  .todo-due { grid-column:2; }
  .todo-action { grid-column:1/-1; }
  .todo-action .primary-btn { width:100%; }
  .pagination { flex-wrap:wrap; justify-content:flex-start; }
  .pagination > span { flex-basis:100%; }
  .page-jump { margin-left:auto; }
}

/* Readability and product catalogue */
body { font-size: 15px; line-height: 1.55; }
.nav-item { min-height: 45px; font-size: 14px; }
.nav-group-label { font-size: 11px; }
.topbar h1, .page-heading h1 { font-size: 25px; }
.page-kicker, .section-label { font-size: 12px; }
.user-brief strong, .system-ok { font-size: 13px; }
.user-brief small { font-size: 12px; }
.section-head h3, .panel h3 { font-size: 18px; }
input, select, textarea, button, .primary-btn, .secondary-btn, .danger-btn { font-size: 14px; }
.form-grid label, .filter-grid label { font-size: 13px; }
th { font-size: 13px; }
td { font-size: 14px; }
td small, .list-row p { font-size: 12px; line-height: 1.45; }
.badge, .link-button, .pagination a, .pagination span, .page-jump label, .page-jump button { font-size: 13px; }
.category-rail { grid-auto-rows: minmax(38px, auto); }
.category-rail strong { font-size: 14px; }
.category-rail a { display: flex; align-items: center; font-size: 14px; }

.product-list-table { min-width: 940px; }
.product-list-table th, .product-list-table td { height: 68px; }
.product-list-table th:nth-child(1) { width: 60px; }
.product-list-table th:nth-child(2) { width: 82px; }
.product-list-table th:nth-child(3) { min-width: 200px; }
.product-list-table th:nth-child(4) { min-width: 120px; }
.product-list-table th:nth-child(5) { min-width: 115px; }
.product-list-table th:nth-child(6) { min-width: 125px; }
.product-price-cell { min-width: 122px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.product-price-cell strong, .product-price-cell small { display: block; }
.product-price-cell strong { color: var(--danger); }
.product-name-link { display: grid; gap: 4px; color: var(--ink); }
.product-name-link strong { font-size: 15px; font-weight: 680; line-height: 1.45; }
.product-name-link small { color: var(--muted); }
.product-name-link:hover strong { color: var(--accent-strong); }
.product-list-table .product-thumb { width: 58px; height: 58px; background: #fff; }
.product-list-table .row-actions { display: flex; align-items: center; gap: 12px; }

.product-detail-hero {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 34px;
  padding: 28px;
}
.product-detail-image {
  display: grid;
  place-items: center;
  min-height: 340px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
}
.product-detail-image img { width: 100%; height: 340px; object-fit: contain; }
.product-detail-image span { color: var(--subtle); }
.product-detail-main { min-width: 0; }
.product-detail-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.product-detail-title h2 { margin: 0 0 6px; font-size: 24px; line-height: 1.4; }
.product-detail-title p { margin: 0; color: var(--muted); }
.product-price-board {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 1px;
  margin: 24px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}
.product-price-board > div { min-height: 96px; padding: 18px 20px; background: #f7f9fb; }
.product-price-board span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.product-price-board strong { color: var(--danger); font-size: 27px; }
.product-price-board b { font-size: 18px; font-weight: 680; }
.product-key-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; }
.product-info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 0; }
.product-key-facts > div, .product-info-grid > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; padding: 11px 0; border-bottom: 1px solid #eef1f4; }
.product-key-facts dt, .product-info-grid dt { color: var(--muted); }
.product-key-facts dd, .product-info-grid dd { margin: 0; overflow-wrap: anywhere; }
.product-info-grid .wide { grid-column: 1 / -1; }
.product-detail-actions { display: flex; justify-content: flex-end; margin-top: 22px; }
.product-detail-tabs {
  position: sticky;
  top: 58px;
  z-index: 12;
  display: flex;
  gap: 28px;
  margin: 14px 0;
  padding: 0 22px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, .96);
}
.product-detail-tabs a { min-height: 50px; padding: 15px 2px 12px; border-bottom: 3px solid transparent; color: var(--muted); white-space: nowrap; }
.product-detail-tabs a:hover { border-color: var(--accent); color: var(--accent-strong); }
.product-detail-section { margin-bottom: 14px; padding: 22px; scroll-margin-top: 120px; }
.subsection-head { margin: 24px 0 10px; }
.subsection-head h4 { margin: 0; font-size: 16px; }
.product-stock-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.product-stock-summary article { padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: #fafbfc; }
.product-stock-summary span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.product-stock-summary strong { font-size: 20px; }

@media (max-width: 820px) {
  body { font-size: 15px; }
  .topbar h1, .page-heading h1 { font-size: 21px; }
  .product-detail-hero { grid-template-columns: 1fr; gap: 20px; padding: 18px; }
  .product-detail-image { min-height: 260px; }
  .product-detail-image img { height: 260px; }
  .product-price-board { grid-template-columns: 1fr; }
  .product-price-board > div { min-height: auto; }
  .product-key-facts, .product-info-grid { grid-template-columns: 1fr 1fr; }
  .product-stock-summary { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  th { font-size: 12px; }
  td { font-size: 13px; }
  .product-detail-title h2 { font-size: 21px; }
  .product-key-facts, .product-info-grid { grid-template-columns: 1fr; }
  .product-stock-summary { grid-template-columns: 1fr; }
  .product-detail-tabs { gap: 20px; margin-left: 0; margin-right: 0; padding: 0 14px; }
}

@media (max-width: 700px) {
  .product-list-table,
  .product-list-table tbody,
  .product-list-table tr,
  .product-list-table td { display: block; width: 100%; min-width: 0; }
  .product-list-table thead { display: none; }
  .product-list-table tbody { padding: 8px; background: #f4f6f8; }
  .product-list-table tr {
    display: grid;
    grid-template-columns: 32px 64px minmax(0, 1fr);
    gap: 5px 10px;
    margin-bottom: 9px;
    padding: 13px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
  }
  .product-list-table td { height: auto; padding: 0; border: 0; }
  .product-list-table td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .product-list-table td:nth-child(2) { grid-column: 2; grid-row: 1 / span 3; }
  .product-list-table td:nth-child(3) { grid-column: 3; grid-row: 1; }
  .product-list-table td:nth-child(4) { grid-column: 3; grid-row: 2; color: var(--muted); }
  .product-list-table td:nth-child(5) { grid-column: 3; grid-row: 3; color: var(--muted); }
  .product-list-table td:nth-child(6) { grid-column: 2 / -1; grid-row: 4; padding-top: 8px; }
  .product-list-table td:nth-child(7) { grid-column: 2 / -1; grid-row: 5; padding-top: 6px; }
  .product-list-table td:nth-child(8) { grid-column: 2 / -1; grid-row: 6; align-self: center; padding-top: 5px; }
  .product-list-table td:nth-child(9) { grid-column: 2 / -1; grid-row: 7; padding-top: 5px; }
  .product-list-table td:nth-child(10) { display: none; }
  .product-list-table td:nth-child(11) { grid-column: 2 / -1; grid-row: 8; width: auto; padding-top: 9px; border-top: 1px solid #eef1f4; }
  .product-list-table td:nth-child(6)::before { content:"进货价 "; color:var(--muted); }
  .product-list-table td:nth-child(7)::before { content:"订货基准价 "; color:var(--muted); }
  .product-list-table td:nth-child(8)::before { content:"市场价 "; color:var(--muted); }
  .product-list-table .sticky-actions { position: static; box-shadow: none; background: transparent; }
  .product-list-table .product-thumb { width: 58px; height: 58px; }
  .product-price-cell { display: flex !important; flex-wrap: wrap; gap: 4px 12px; min-width: 0; }
  .product-price-cell strong, .product-price-cell small { display: inline; margin: 0; }
  .product-list-table .row-actions { justify-content: flex-end; }
}

@media (max-width: 700px) {
  .customer-list-table,
  .customer-list-table tbody,
  .customer-list-table tr,
  .customer-list-table td,
  .order-list-table,
  .order-list-table tbody,
  .order-list-table tr,
  .order-list-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .customer-list-table thead,
  .order-list-table thead {
    display: none;
  }

  .customer-list-table tbody,
  .order-list-table tbody {
    display: grid;
    gap: 10px;
    padding: 9px;
    background: #f4f6f8;
  }

  .customer-list-table tr,
  .order-list-table tr {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .035);
  }

  .customer-list-table td,
  .order-list-table td {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    gap: 10px;
    padding: 7px 0;
    border: 0;
    border-bottom: 1px solid #eef1f4;
  }

  .customer-list-table td:last-child,
  .order-list-table td:last-child {
    border-bottom: 0;
  }

  .customer-list-table td::before,
  .order-list-table td::before {
    color: var(--muted);
    font-size: 12px;
  }

  .customer-list-table td:nth-child(1)::before { content:"客户"; }
  .customer-list-table td:nth-child(2)::before { content:"客户编码"; }
  .customer-list-table td:nth-child(3),
  .customer-list-table td:nth-child(4),
  .customer-list-table td:nth-child(5) { display:none; }
  .customer-list-table td:nth-child(6)::before { content:"结算方式"; }
  .customer-list-table td:nth-child(7)::before { content:"账期额度"; }
  .customer-list-table td:nth-child(8)::before { content:"已占用"; }
  .customer-list-table td:nth-child(9)::before { content:"可用额度"; }
  .customer-list-table td:nth-child(10)::before { content:"收货信息"; }
  .customer-list-table td:nth-child(11)::before { content:"操作"; }

  .order-list-table td:nth-child(1)::before { content:"订单"; }
  .order-list-table td:nth-child(2)::before { content:"下单时间"; }
  .order-list-table td:nth-child(3),
  .order-list-table td:nth-child(6),
  .order-list-table td:nth-child(9),
  .order-list-table td:nth-child(11),
  .order-list-table td:nth-child(13) { display:none; }
  .order-list-table td:nth-child(4)::before { content:"客户"; }
  .order-list-table td:nth-child(5)::before { content:"订单金额"; }
  .order-list-table td:nth-child(7)::before { content:"财务确认"; }
  .order-list-table td:nth-child(8)::before { content:"收款"; }
  .order-list-table td:nth-child(10)::before { content:"配送"; }
  .order-list-table td:nth-child(12)::before { content:"旺店通"; }
  .order-list-table td:nth-child(14)::before { content:"操作"; }

  .customer-list-table .row-actions,
  .order-list-table .row-actions {
    position: static;
    justify-content: flex-end;
    box-shadow: none;
    background: transparent;
  }
}
/* Practical order entry */
.customer-picker-row {
  display: grid;
  grid-template-columns: minmax(240px, .8fr) minmax(320px, 1.2fr);
  gap: 12px;
  margin: 16px 0;
}
.customer-picker-row input,
.customer-picker-row select { min-height: 44px; }
.quick-create-panel,
.bulk-paste-panel {
  margin: 14px 0 18px;
  padding: 18px;
  border: 1px solid #cdd9e5;
  border-radius: 10px;
  background: #f8fafc;
}
.quick-create-panel h4 { margin: 0 0 12px; }
.bulk-paste-panel textarea { width: 100%; margin-top: 8px; }
.product-search-box { min-width: 260px; flex: 1; }
.product-search-input { width: 100%; min-height: 42px; }
.price-policy { display: block; margin-top: 5px; color: #64748b; line-height: 1.35; }
.selected-product-summary {
  display: block;
  margin-top: 5px;
  color: #0f766e;
  font-weight: 700;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}
.selected-product-summary[hidden] { display: none; }
.workspace-page { width: 100%; min-width: 0; }
.order-entry-table th { white-space: nowrap; }
.order-entry-table td { vertical-align: middle; }
.order-entry-table .quantity-input { width: 92px; }
.order-entry-table .unit-price-input { width: 112px; font-weight: 700; }
.order-entry-table .original-price,
.order-entry-table .discount-rate,
.order-entry-table .line-total,
.order-entry-table .available-stock { white-space: nowrap; }
.order-entry-table .line-total { font-weight: 700; color: #0f766e; }
.price-warning-row { box-shadow: inset 4px 0 #dc2626; background: #fff8f8; }
.price-warning-row .price-policy { color: #b91c1c; }
.order-total-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 28px;
  padding: 18px 4px 4px;
  font-size: 15px;
}
.order-total-bar strong { font-size: 20px; color: #dc2626; }
.product-list-simple th,
.product-list-simple td { font-size: 15px; }
.plain-help { margin: 16px 0; color: #475569; }
.sales-unit-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.sales-unit-chips span { color: #64748b; }
.sales-unit-chips b { padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; }
.inline-price-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(5, minmax(130px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid #cdd9e5;
  border-radius: 10px;
  background: #f8fafc;
}
.inline-price-form label { display: grid; gap: 6px; }
.customer-quote-product-picker {
  position: relative;
  min-width: 320px;
}
.customer-quote-product-picker .product-suggestions {
  width: min(680px, 72vw);
  max-height: 360px;
}
.customer-quote-form small {
  color: #64748b;
  font-size: 12px;
}
.quotation-filter-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 12px;
}
.quotation-filter-row label {
  display: grid;
  gap: 6px;
  width: min(420px, 100%);
  color: #475569;
  font-size: 13px;
}
.quotation-filter-row small {
  color: #64748b;
  white-space: nowrap;
}
.danger-text { color: #b91c1c; }
.ok-text { color: #047857; }
.exchange-amount-summary {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
}
.exchange-amount-summary strong { color: #0f172a; }

@media (max-width: 760px) {
  .customer-picker-row { grid-template-columns: 1fr; }
  .inline-price-form { grid-template-columns: 1fr; }
  .quotation-filter-row { align-items: stretch; flex-direction: column; }
  .order-step-head { align-items: flex-start; flex-wrap: wrap; }
  .order-entry-wrap { overflow-x: auto; }
  .order-entry-table { min-width: 1180px; }
  .order-total-bar {
    position: sticky;
    left: 0;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
  }
  .order-total-bar strong { width: 100%; text-align: right; }
}

.order-customer-note {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
  padding: 11px 14px;
  border: 1px solid #cfe8e7;
  border-radius: 9px;
  background: #f2fbfa;
}
.order-customer-note span { flex: 1; }
.order-customer-note small { color: var(--ink-soft); white-space: nowrap; }

.order-task-panel { padding: 16px; }
.order-task-create,
.order-task-row {
  display: grid;
  grid-template-columns: 150px minmax(240px, 1fr) 180px auto;
  align-items: center;
  gap: 8px;
}
.order-task-create select,
.order-task-create input,
.order-task-row input { min-width: 0; margin: 0; }
.order-task-list { display: grid; gap: 7px; margin-top: 10px; }
.order-task-row {
  grid-template-columns: minmax(160px, .8fr) minmax(180px, 1fr) minmax(180px, 1fr) auto;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.order-task-row small { overflow: hidden; color: var(--ink-soft); text-overflow: ellipsis; white-space: nowrap; }
.order-task-history { margin-top: 10px; color: var(--ink-soft); }
.order-task-history p {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 6px 0;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}
.order-after-sales-row {
  display: grid;
  grid-template-columns: 1.2fr .7fr .7fr 1fr;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  color: inherit;
}
.order-after-sales-row:hover { color: var(--primary); }

@media (max-width: 760px) {
  .order-customer-note,
  .order-task-create,
  .order-task-row,
  .order-after-sales-row { display: grid; grid-template-columns: 1fr; }
  .order-task-create button,
  .order-task-row button { width: 100%; }
  .order-task-row small { white-space: normal; }
  .order-after-sales-row { gap: 4px; }
}

/* Inventory mode and order-demand counting */
.inventory-mode-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-left: 4px solid var(--brand, #0f9aa8);
}

.inventory-mode-panel h3 {
  margin: 3px 0 6px;
}

.inventory-mode-panel p {
  margin: 0;
  color: var(--muted, #64748b);
}

.inventory-restore-toolbar,
.count-status-tabs {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.count-status-tabs {
  align-items: center;
  padding: 10px 16px;
}

.count-status-tabs > a {
  padding: 10px 16px;
  border-radius: 8px;
  color: var(--muted, #64748b);
  font-weight: 600;
}

.count-status-tabs > a.active {
  color: var(--brand, #0f9aa8);
  background: color-mix(in srgb, var(--brand, #0f9aa8) 10%, white);
}

.count-status-tabs form {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.inventory-entry-table input {
  min-width: 150px;
}

.order-count-submit {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 16px;
  padding-top: 16px;
}

.order-count-submit label {
  min-width: min(480px, 70vw);
}

.counting-mobile-list,
.counting-record-mobile {
  display: none;
}

.mobile-camera-field {
  position: relative;
}

.mobile-camera-field > span {
  display: none;
}

.camera-preview-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line, #dce4eb);
  border-radius: 12px;
  background: #f8fafc;
}

.camera-preview-wrap[hidden] {
  display: none;
}

.camera-preview {
  width: min(260px, 66vw);
  max-height: 240px;
  object-fit: cover;
  border-radius: 10px;
  background: #e8edf2;
}

.portal-heading {
  display: grid;
  gap: 5px;
}

.portal-brand {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  color: #172331;
  text-decoration: none;
}

.portal-brand img {
  width: 132px;
  height: 46px;
  object-fit: contain;
  object-position: left center;
}

.portal-brand span {
  display: grid;
  gap: 1px;
  padding-left: 12px;
  border-left: 1px solid #d8e1e8;
}

.portal-brand strong {
  font-size: 20px;
  letter-spacing: .04em;
}

.portal-brand small {
  color: #64748b;
}

.portal-center-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}

.tender-query-code {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: #eef8f8;
  color: #165f66;
}

.tender-query-code strong {
  user-select: all;
}

.tender-help-card ol {
  display: grid;
  gap: 10px;
  padding-left: 22px;
  color: #3f4d5d;
}

.tender-result-card {
  border-top: 4px solid #169aa4;
}

.result-success {
  color: #087f5b;
  font-size: 20px;
}

.ai-price-cell {
  min-width: 150px;
}

.ai-price-cell > strong,
.ai-price-cell > small {
  display: block;
  margin-bottom: 4px;
}

.ai-system-price {
  color: #0f766e;
  font-size: 17px;
}

.ai-price-source {
  max-width: 240px;
  color: #64748b;
  white-space: normal;
}

.ai-unit-price-input[readonly] {
  border-color: transparent;
  background: #f4f7f9;
  color: #334155;
}

.mobile-primary-action .primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.mobile-primary-action .primary-btn span {
  font-size: 12px;
  font-weight: 500;
  opacity: .78;
}

.unit-chip {
  display: inline-flex;
  padding: 4px 8px;
  margin: 2px;
  border-radius: 999px;
  background: #eef6f7;
  color: #176d75;
  white-space: nowrap;
}

.order-number-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.order-number-list a {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  background: #fff;
}

.order-number-list small {
  color: var(--muted, #64748b);
}

@media (max-width: 700px) {
  .portal-center-grid {
    grid-template-columns: 1fr;
  }

  .portal-brand img {
    width: 112px;
    height: 40px;
  }

  .portal-brand strong {
    font-size: 18px;
  }

  .camera-preview-wrap {
    display: grid;
  }

  .camera-preview {
    width: 100%;
    max-height: 320px;
  }
}

@media (max-width: 760px) {
  .inventory-mode-panel,
  .inventory-restore-toolbar,
  .count-status-tabs,
  .order-count-submit {
    align-items: stretch;
    flex-direction: column;
  }

  .count-status-tabs form,
  .order-count-submit label {
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }

  .order-count-panel {
    padding: 14px 12px 88px;
  }

  .order-count-panel .warehouse-desktop-table,
  .counting-record-desktop,
  .desktop-count-action {
    display: none;
  }

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

  .counting-mobile-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 104px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow-xs);
  }

  .counting-mobile-card:has(input:checked) {
    border-color: var(--brand);
    background: var(--brand-soft);
    box-shadow: inset 4px 0 0 var(--brand);
  }

  .counting-mobile-card > input {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    margin: 2px 0 0;
  }

  .counting-mobile-body {
    display: grid;
    flex: 1;
    gap: 5px;
    min-width: 0;
    color: var(--ink);
  }

  .counting-mobile-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
  }

  .counting-mobile-title strong {
    overflow-wrap: anywhere;
  }

  .counting-mobile-body small {
    color: var(--muted);
    overflow-wrap: anywhere;
  }

  .counting-mobile-body .secondary-btn {
    width: 100%;
    margin: 5px 0 0;
    text-align: center;
  }

  .order-count-submit {
    position: sticky;
    z-index: 18;
    bottom: max(0px, env(safe-area-inset-bottom));
    margin: 14px -12px -88px;
    padding: 12px;
    border-top: 1px solid var(--line);
    background: rgba(255,255,255,.96);
    box-shadow: 0 -10px 28px rgba(24,39,58,.12);
    backdrop-filter: blur(16px);
  }

  .order-count-submit .primary-btn {
    display: flex;
    justify-content: space-between;
    width: 100%;
    min-height: 52px;
  }

  .order-count-submit .primary-btn span {
    font-size: 12px;
    font-weight: 500;
    opacity: .8;
  }

  .counting-record-mobile {
    display: grid;
    gap: 8px;
  }

  .counting-record-mobile > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 66px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
  }

  .counting-record-mobile > a > span:first-child {
    display: grid;
    gap: 4px;
    min-width: 0;
  }

  .counting-record-mobile small {
    color: var(--muted);
    overflow-wrap: anywhere;
  }

  .count-result-panel .table-wrap {
    overflow: visible;
    border: 0;
  }

  .count-result-panel table,
  .count-result-panel tbody,
  .count-result-panel tr,
  .count-result-panel td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .count-result-panel thead {
    display: none;
  }

  .count-result-panel tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px 12px;
    margin-bottom: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
  }

  .count-result-panel td {
    padding: 0;
    border: 0;
  }

  .count-result-panel td:first-child,
  .count-result-panel td:nth-child(3),
  .count-result-panel td:last-child {
    grid-column: 1 / -1;
  }

  .count-result-panel td:nth-child(2)::before { content: "仓库："; color: var(--muted); }
  .count-result-panel td:nth-child(4)::before { content: "订单："; color: var(--muted); }
  .count-result-panel td:nth-child(5)::before { content: "退货："; color: var(--muted); }
  .count-result-panel td:nth-child(6)::before { content: "净需求："; color: var(--muted); }
}

/* Order workspace: dense, calm and predictable for daily business entry. */
.order-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0 0 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
  box-shadow: var(--shadow-sm);
}
.order-mode-tabs a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 64px;
  padding: 11px 16px;
  background: #fff;
  color: var(--muted);
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}
.order-mode-tabs a:hover { color: var(--ink); background: #fbfcfd; }
.order-mode-tabs a.active {
  position: relative;
  color: var(--accent);
  background: #f8fbfe;
  box-shadow: inset 0 -3px 0 var(--accent);
}
.order-mode-tabs a > span:last-child { display: grid; gap: 2px; min-width: 0; }
.order-mode-tabs strong { color: currentColor; font-size: 14px; }
.order-mode-tabs small { color: var(--muted); font-size: 11px; }
.order-mode-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  background: #eef2f6;
  color: #526273;
  font-size: 17px;
  font-weight: 750;
}
.order-mode-tabs a.active .order-mode-icon { background: var(--accent); color: #fff; }

.order-master-panel { overflow: visible; }
.order-step-head {
  min-height: 62px;
  justify-content: space-between;
  padding: 13px 18px;
  background: #fff;
}
.order-step-head h3 { font-size: 17px; }
.order-head-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.order-master-grid {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(280px, 1.25fr) minmax(180px, .72fr) minmax(150px, .58fr);
  gap: 13px;
  padding: 18px 18px 14px;
}
.order-master-grid label,
.order-address-fields label { display: grid; align-content: start; gap: 7px; color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.order-master-grid input,
.order-master-grid select,
.order-address-fields input,
.order-address-fields select { min-height: 42px; background: #fff; }
.customer-order-summary {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 0 18px 18px;
  overflow: hidden;
  border: 1px solid #dbe6ef;
  border-radius: 9px;
  background: #f7fafc;
}
.customer-order-summary[hidden] { display: none; }
.customer-order-summary > span {
  display: grid;
  gap: 3px;
  min-width: 130px;
  padding: 11px 14px;
  border-right: 1px solid #e3eaf0;
}
.customer-order-summary small { color: var(--muted); font-size: 10px; }
.customer-order-summary strong { color: var(--ink); font-size: 13px; }
.customer-order-summary .customer-price-note {
  display: flex;
  align-items: center;
  flex: 1;
  border-right: 0;
  color: var(--accent);
  font-size: 12px;
}
.order-address-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 15px 18px 0;
  border-top: 1px solid var(--line);
}
.order-address-title strong { font-size: 14px; }
.order-address-title small { color: var(--muted); font-size: 11px; }
.order-address-fields { grid-template-columns: repeat(6, minmax(130px, 1fr)); }
.order-address-fields .wide-field { grid-column: span 2; }

.order-entry-wrap { overflow: visible; }
.order-entry-table { min-width: 1320px; table-layout: auto; }
.order-entry-table thead th {
  height: 44px;
  padding: 10px 11px;
  border-color: #dfe5eb;
  background: #f3f6f9;
  color: #273547;
  font-size: 12px;
  font-weight: 750;
}
.order-entry-table tbody tr { transition: background .14s ease, box-shadow .14s ease; }
.order-entry-table tbody tr:hover { background: #f9fcfe; }
.order-entry-table td { padding: 10px 9px; }
.order-entry-table th:nth-child(1),
.order-entry-table td:nth-child(1) { width: 52px; text-align: center; }
.order-entry-table th:nth-child(2),
.order-entry-table td:nth-child(2) { width: 54px; text-align: center; }
.order-entry-table th:nth-child(3) { min-width: 390px; }
.order-entry-table .order-row-number { color: var(--muted); font-variant-numeric: tabular-nums; }
.order-row-remove {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #98a2b3;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}
.order-row-remove:hover { border-color: #f4c7c3; background: #fff4f2; color: var(--danger); }
.order-product-picker { min-width: 370px; }
.order-product-preview { width: 50px; height: 50px; flex-basis: 50px; border-radius: 6px; background: #fff; }
.product-search-box { position: relative; min-width: 300px; }
.product-search-input { min-height: 40px; padding-right: 34px; border-color: #ccd6e0; }
.product-search-input:focus { border-color: #4e90c2; box-shadow: 0 0 0 3px rgba(23,91,145,.09); }
.product-suggestions {
  position: absolute;
  z-index: 90;
  top: calc(100% + 5px);
  left: 0;
  width: min(680px, 72vw);
  max-height: 430px;
  overflow-y: auto;
  border: 1px solid #ccd6df;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(16,24,40,.16);
  overscroll-behavior: contain;
  scrollbar-width: thin;
  box-sizing: border-box;
  padding-bottom: 2px;
}
.product-suggestions[hidden] { display: none; }
.product-suggestion-item { 
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: start;
  gap: 11px;
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid #edf0f3;
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  overflow: visible;
}
.product-suggestion-item > span:nth-child(2) { min-width: 0; overflow: visible; }
.product-suggestion-item strong { display: block; overflow: visible; white-space: normal; line-height: 1.35; }
.product-suggestion-item small { display: block; overflow: visible; white-space: normal; line-height: 1.35; }
.product-suggestion-item:last-child { border-bottom: 0; }
.product-suggestion-item:hover,
.product-suggestion-item:focus { outline: 0; background: #eef7fb; }
.product-suggestion-item > img,
.product-suggestion-item > span:first-child {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f6f8;
  color: var(--subtle);
  font-size: 10px;
  object-fit: contain;
}
.product-suggestion-item > span:nth-child(2) { display: grid; gap: 4px; min-width: 0; }
.product-suggestion-item strong { overflow: visible; color: #1f2937; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; white-space: normal; }
.product-suggestion-item small { display: block; color: var(--muted); font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; white-space: normal; }
.product-suggestion-item em { color: var(--accent); font-size: 12px; font-style: normal; font-weight: 700; }
.product-suggestion-empty { padding: 22px; color: var(--muted); text-align: center; }
.price-policy { max-width: 360px; overflow: hidden; color: #64748b; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.order-entry-table .quantity-input { width: 86px; text-align: right; }
.order-entry-table .unit-select { min-width: 110px; }
.order-entry-table .unit-price-input { width: 104px; text-align: right; }
.order-entry-table .line-total { color: #b42318; }
.add-line-btn { margin: 12px 18px; }
.order-total-bar {
  display: flex;
  justify-content: flex-end;
  gap: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  background: #fbfcfd;
}
.order-total-bar > span,
.order-total-bar > strong {
  display: grid;
  gap: 3px;
  min-width: 145px;
  padding: 13px 18px;
  border-left: 1px solid var(--line);
  text-align: right;
}
.order-total-bar small { color: var(--muted); font-size: 10px; font-weight: 600; }
.order-total-bar b { color: var(--ink); font-size: 15px; }
.order-total-bar strong { min-width: 180px; color: #d92d20; font-size: 22px; }

/* Intelligent order intake uses the same visual language as manual order entry. */
.intake-workspace-head {
  margin-bottom: 14px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(112deg, #fff 0%, #f6fafc 68%, #edf6fa 100%);
  box-shadow: var(--shadow-sm);
}
.intake-workspace-head h2 { margin-top: 2px; font-size: 23px; }
.intake-compose-premium { padding: 0; overflow: hidden; }
.intake-compose-premium .intake-source,
.intake-compose-premium .intake-upload { padding: 22px; }
.intake-compose-premium .intake-upload { border-left: 1px solid var(--line); background: #fafbfd; }
.intake-field-head { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; }
.intake-field-head > span:last-child { display: grid; gap: 2px; }
.intake-field-head strong { font-size: 15px; }
.intake-field-head small { color: var(--muted); font-size: 11px; font-weight: 400; }
.intake-field-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.intake-compose-premium textarea {
  min-height: 210px;
  padding: 15px;
  border-color: #ccd6df;
  border-radius: 9px;
  font-size: 14px;
  line-height: 1.75;
}
.intake-source-hints { display: flex; flex-wrap: wrap; gap: 6px; }
.intake-source-hints span {
  padding: 4px 8px;
  border: 1px solid #d9e5ee;
  border-radius: 999px;
  background: #f7fafc;
  color: #526273;
  font-size: 10px;
}
.intake-compose-premium .upload-drop {
  min-height: 150px;
  border: 1.5px dashed #aebdcc;
  border-radius: 10px;
  background: #fff;
}
.intake-compose-premium .upload-drop:hover { border-color: var(--accent); background: #f4f9fc; }
.selected-file {
  padding: 9px 11px;
  border: 1px solid #cce5d9;
  border-radius: 7px;
  background: #f0faf5;
  color: var(--success);
  font-size: 12px;
}
.selected-file[hidden] { display: none; }
.intake-compose-premium .form-actions {
  grid-column: 1 / -1;
  justify-content: space-between;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.intake-submit-note { color: var(--muted); font-size: 12px; }
.intake-submit-btn { min-width: 210px; }
.intake-submit-btn span { margin-left: 8px; }

@media (max-width: 1180px) {
  .order-master-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-address-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .customer-order-summary { flex-wrap: wrap; }
  .customer-order-summary .customer-price-note { min-width: 100%; border-top: 1px solid #e3eaf0; }
}

@media (max-width: 760px) {
  .order-mode-tabs { grid-template-columns: 1fr; }
  .order-mode-tabs a { min-height: 52px; }
  .order-mode-tabs small { display: none; }
  .order-master-grid,
  .order-address-fields { grid-template-columns: 1fr; }
  .order-address-fields .wide-field { grid-column: auto; }
  .customer-order-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-order-summary > span { min-width: 0; border-bottom: 1px solid #e3eaf0; }
  .customer-order-summary .customer-price-note { grid-column: 1 / -1; }
  .order-address-title { display: grid; gap: 3px; }
  .order-head-actions { width: 100%; margin-left: 0; }
  .order-head-actions .secondary-btn { flex: 1; text-align: center; }
  .order-entry-wrap { overflow: visible; }
  .order-entry-table { min-width: 0; }
  .order-entry-table tr {
    margin: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
  }
  .order-entry-table td { display: grid; grid-template-columns: 90px minmax(0, 1fr); }
  .order-entry-table td:nth-child(1)::before { content:"序号"; }
  .order-entry-table td:nth-child(2)::before { content:"操作"; }
  .order-entry-table td:nth-child(3)::before { content:"商品"; }
  .order-entry-table td:nth-child(4)::before { content:"数量"; }
  .order-entry-table td:nth-child(5)::before { content:"规格"; }
  .order-entry-table td:nth-child(6)::before { content:"单位"; }
  .order-entry-table td:nth-child(7)::before { content:"原价"; }
  .order-entry-table td:nth-child(8)::before { content:"折扣"; }
  .order-entry-table td:nth-child(9)::before { content:"成交单价"; }
  .order-entry-table td:nth-child(10)::before { content:"金额小计"; }
  .order-entry-table td:nth-child(11)::before { content:"可用库存"; }
  .order-entry-table td:nth-child(12)::before { content:"备注"; }
  .order-entry-table td:nth-child(1),
  .order-entry-table td:nth-child(2) { width: 100%; text-align: left; }
  .order-product-picker { min-width: 0; align-items: flex-start; }
  .product-search-box { min-width: 0; }
  .product-suggestions { position: fixed; inset: auto 12px 74px; width: auto; max-height: 56vh; }
  .order-entry-table .quantity-input,
  .order-entry-table .unit-price-input,
  .order-entry-table .unit-select { width: 100%; min-width: 0; }
  .order-total-bar { position: static; display: grid; grid-template-columns: repeat(2, 1fr); }
  .order-total-bar > span,
  .order-total-bar > strong { min-width: 0; border-bottom: 1px solid var(--line); }
  .order-total-bar strong { width: auto; text-align: right; }
  .intake-compose-premium .intake-upload { border-top: 1px solid var(--line); border-left: 0; }
  .intake-compose-premium .form-actions { display: grid; gap: 10px; }
  .intake-submit-btn { width: 100%; min-height: 48px; }
}
@media (max-width: 820px) {
  .role-focus-card { grid-template-columns: 1fr; gap: 15px; padding: 18px 14px; }
  .role-focus-counts { justify-content: flex-start; }
  .role-focus-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .role-focus-actions a { width: 100%; }
}

/* Procurement and tender pages: show today's work before process documentation. */
.work-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 12px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.work-page-head h2 { margin: 3px 0 4px; font-size: 24px; }
.work-page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.work-page-kicker {
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .06em;
}
.work-page-head .more-actions { position: relative; }
.work-page-head .more-actions > summary {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.work-page-head .more-actions > div {
  position: absolute;
  z-index: 90;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  min-width: 190px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(16, 24, 40, .14);
}
.work-page-head .more-actions > div > a,
.work-page-head .more-actions > div > button {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: 8px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.work-page-head .more-actions > div > a:hover,
.work-page-head .more-actions > div > button:hover { background: #f4f7f9; }
.work-page-head .export-options { width: 100%; }
.work-page-head .export-options > summary {
  padding: 8px 9px;
  color: var(--ink-soft);
  font-size: 12px;
}
.quick-create-form,
.manual-requirement { margin-bottom: 12px; }

.work-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.work-summary > a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  min-height: 78px;
  padding: 15px 18px;
  color: var(--ink);
}
.work-summary > a:not(:last-child) { border-right: 1px solid var(--line); }
.work-summary > a:hover { background: #f8fbfc; }
.work-summary span { color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.work-summary strong {
  grid-row: span 2;
  align-self: center;
  color: var(--accent);
  font-size: 28px;
  font-variant-numeric: tabular-nums;
}
.work-summary small { color: var(--muted); font-size: 11px; }
.work-summary .urgent { background: #fffaf1; box-shadow: inset 0 -3px 0 #d88b18; }
.work-summary .urgent strong { color: #b96809; }

.work-section-head,
.work-list-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.work-section-head > div,
.work-list-title > div { display: flex; align-items: center; gap: 11px; }
.work-section-head h3,
.work-list-title h3 { margin: 0 0 2px; font-size: 16px; }
.work-section-head small,
.work-list-title small { color: var(--muted); font-size: 11px; }
.section-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.work-queue { margin-bottom: 12px; padding: 0; overflow: hidden; }
.work-queue-list { display: grid; }
.work-queue-item {
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) minmax(360px, 1.7fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 92px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.work-queue-item:last-child { border-bottom: 0; }
.work-queue-item:hover { background: #fafcfd; }
.queue-main { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 5px 9px; }
.queue-main > small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.work-queue-item dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  margin: 0;
}
.work-queue-item dl > div { display: grid; gap: 3px; }
.work-queue-item dt { color: var(--muted); font-size: 10px; }
.work-queue-item dd { margin: 0; font-size: 13px; font-weight: 700; }
.queue-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 35px 18px;
  color: var(--ink-soft);
  text-align: center;
}
.queue-empty span { color: var(--muted); font-size: 12px; }
.queue-empty .primary-btn { margin-top: 8px; }
.work-history { margin-top: 12px; }
.history-groups { display: grid; gap: 22px; padding: 18px; }
.history-groups h4 { margin: 0 0 9px; font-size: 13px; }

.tender-work-list { display: grid; gap: 12px; margin-bottom: 12px; }
.work-list-title {
  padding: 8px 2px 4px;
  border: 0;
}
.tender-work-card { padding: 0; overflow: visible; }
.tender-work-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 19px 13px;
}
.tender-work-head > div:first-child { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 9px; }
.tender-work-head h3 { margin: 0; font-size: 17px; }
.tender-work-head small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.tender-bid-count { display: grid; min-width: 68px; text-align: right; }
.tender-bid-count strong { font-size: 25px; line-height: 1; }
.tender-bid-count span { color: var(--muted); font-size: 10px; }
.tender-current-step {
  display: grid;
  grid-template-columns: minmax(230px, .8fr) minmax(360px, 1.2fr);
  align-items: center;
  gap: 20px;
  margin: 0 19px;
  padding: 13px 15px;
  border: 1px solid #e9dcc4;
  border-radius: 9px;
  background: #fffbf3;
}
.tender-current-step > div:first-child { display: grid; gap: 2px; }
.tender-current-step > div:first-child > span { color: #9a650e; font-size: 10px; font-weight: 800; }
.tender-current-step > div:first-child > strong { font-size: 14px; }
.tender-current-step > div:first-child > small { color: var(--muted); font-size: 11px; }
.current-step-actions { display: flex; justify-content: flex-end; gap: 8px; }
.current-step-actions form { margin: 0; }
.tender-secondary-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 48px;
  padding: 10px 19px;
  color: var(--muted);
  font-size: 11px;
}
.tender-secondary-actions a,
.tender-secondary-actions summary,
.tender-secondary-actions > button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.tender-secondary-actions details { position: relative; }
.tender-secondary-actions details > p,
.tender-secondary-actions details > form {
  position: absolute;
  z-index: 70;
  top: calc(100% + 7px);
  left: 0;
  width: min(480px, 70vw);
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(16, 24, 40, .14);
}
/* 项目配置是完整编辑表单，不应沿用“采购范围”小弹层的定位规则。 */
.tender-secondary-actions details.tender-config-details[open] {
  flex: 1 1 100%;
  min-width: 0;
}
.tender-secondary-actions details.tender-config-details[open] > form.tender-config-form {
  position: static;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.tender-bids-panel { border-top: 1px solid var(--line); }
.tender-bids-panel[hidden] { display: none; }
.tender-bids-panel .table-wrap { border: 0; border-radius: 0 0 12px 12px; }
.tender-bids-panel table { min-width: 1050px; }
.tender-history { margin-bottom: 12px; }
.completed-tender-list { display: grid; }
.completed-tender {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.completed-tender:last-child { border-bottom: 0; }
.completed-tender > div { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 9px; }
.completed-tender > div small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.completed-tender > div:nth-child(2) { display: grid; text-align: right; }
.completed-tender > div:nth-child(2) strong { font-size: 20px; }
.completed-tender .award-to-order { grid-column: 1 / -1; }

@media (max-width: 980px) {
  .work-queue-item { grid-template-columns: 1fr auto; }
  .work-queue-item dl { grid-column: 1 / -1; grid-row: 2; }
  .tender-current-step { grid-template-columns: 1fr; }
  .current-step-actions { justify-content: flex-start; }
}

@media (max-width: 700px) {
  .work-page-head { display: grid; padding: 17px 15px; }
  .work-page-head .workbench-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .work-page-head .workbench-actions > :first-child { grid-column: 1 / -1; }
  .work-page-head .workbench-actions .primary-btn,
  .work-page-head .workbench-actions .secondary-btn { text-align: center; }
  .work-page-head .more-actions > summary { text-align: center; }
  .work-summary { grid-template-columns: 1fr; }
  .work-summary > a { min-height: 62px; }
  .work-summary > a:not(:last-child) { border-right: 0; border-bottom: 1px solid var(--line); }
  .work-section-head { align-items: flex-start; }
  .work-section-head > form { flex: 0 0 auto; }
  .work-section-head small,
  .work-list-title small { display: none; }
  .work-queue-item { grid-template-columns: 1fr; gap: 13px; }
  .work-queue-item dl { grid-column: auto; grid-row: auto; }
  .work-queue-item > .primary-btn { width: 100%; text-align: center; }
  .tender-work-head { align-items: flex-start; }
  .tender-work-head h3 { grid-column: 1 / -1; margin-top: 2px; }
  .tender-current-step { margin: 0 12px; padding: 12px; }
  .project-invite-form,
  .current-step-actions { display: grid; width: 100%; }
  .project-invite-form select { width: 100%; min-width: 0; }
  .tender-secondary-actions { flex-wrap: wrap; padding: 10px 13px; }
  .completed-tender { grid-template-columns: 1fr auto; padding: 13px; }
  .history-groups { padding: 12px; }
}
.customer-history-panel {
  padding: 0;
  overflow: hidden;
}

.customer-history-toggle {
  width: 100%;
  min-height: 72px;
  padding: 16px 20px;
  border: 0;
  background: #fff;
  color: var(--text, #182230);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  text-align: left;
  cursor: pointer;
}

.customer-history-toggle:hover {
  background: #f8fafc;
}

.customer-history-toggle > span {
  display: grid;
  gap: 4px;
}

.customer-history-toggle strong {
  font-size: 16px;
}

.customer-history-toggle small,
.customer-history-order-card small,
.customer-history-product-card small {
  color: #667085;
}

.customer-history-toggle > b {
  color: #087f8c;
  white-space: nowrap;
}

.customer-history-body {
  padding: 18px 20px 22px;
  border-top: 1px solid #e6eaf0;
  background: #fbfcfd;
}

.customer-history-tools {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-bottom: 16px;
}

.customer-history-tools label {
  flex: 1 1 420px;
}

.customer-history-tools input {
  width: 100%;
}

.customer-history-message,
.customer-history-panel .empty-state {
  padding: 22px;
  color: #667085;
  text-align: center;
  border: 1px dashed #d9e0e8;
  border-radius: 10px;
  background: #fff;
}

.customer-recent-orders,
.customer-all-orders {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.customer-history-order-card,
.customer-history-product-card {
  border: 1px solid #e3e8ef;
  border-radius: 10px;
  background: #fff;
}

.customer-history-order-card {
  padding: 14px;
}

.customer-history-order-card header,
.customer-history-order-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.customer-history-order-card header span {
  display: grid;
  gap: 3px;
}

.customer-history-order-card ul {
  margin: 12px 0;
  padding: 10px 0;
  border-top: 1px solid #eef1f5;
  border-bottom: 1px solid #eef1f5;
  list-style: none;
}

.customer-history-order-card li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  font-size: 13px;
}

.customer-history-order-card li span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-history-order-card li b {
  flex: 0 0 auto;
  font-weight: 500;
}

.customer-products-head {
  margin-top: 22px;
}

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

.customer-history-product-card {
  min-width: 0;
  padding: 10px;
  display: flex;
  gap: 10px;
}

.customer-history-product-card > img,
.customer-history-product-card > .product-placeholder {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border-radius: 8px;
  object-fit: contain;
  background: #f2f5f8;
}

.customer-history-product-card > .product-placeholder {
  display: grid;
  place-items: center;
  color: #98a2b3;
  font-size: 12px;
}

.customer-history-product-card > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.customer-history-product-card strong,
.customer-history-product-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-history-product-card span {
  font-size: 13px;
}

.customer-all-orders {
  margin-top: 16px;
}

.customer-history-pagination {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.customer-history-pagination button {
  min-width: 34px;
  height: 34px;
  border: 1px solid #d9e0e8;
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}

.customer-history-pagination button.active {
  border-color: #1198a5;
  background: #1198a5;
  color: #fff;
}

@media (max-width: 1100px) {
  .customer-recent-orders,
  .customer-all-orders {
    grid-template-columns: 1fr;
  }

  .customer-history-products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .customer-history-toggle,
  .customer-history-body {
    padding-left: 14px;
    padding-right: 14px;
  }

  .customer-history-toggle small {
    display: none;
  }

  .customer-history-tools {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .customer-history-tools label {
    flex-basis: 100%;
  }

  .customer-history-products {
    grid-template-columns: 1fr;
  }

  .customer-history-order-card li {
    display: grid;
  }
}

@media print {
  .sidebar,
  .sidebar-mask,
  .nav-toggle,
  .topbar,
  .page-heading,
  .workbench-actions,
  .order-command-bar,
  .sticky-submit,
  .form-actions,
  button,
  .secondary-btn,
  .primary-btn {
    display: none !important;
  }

  .shell,
  .main {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .panel,
  .order-overview {
    break-inside: avoid;
    box-shadow: none !important;
  }

  .table-wrap {
    overflow: visible !important;
  }
}

.mobile-card-list {
  display: none;
}

.mobile-business-card {
  padding: 15px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .04);
}

.mobile-business-card.attention-card {
  border-left: 4px solid #dc2626;
}

.mobile-card-head,
.mobile-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mobile-card-head > a {
  color: var(--text-strong, #172033);
  font-weight: 700;
}

.mobile-business-card > p,
.product-mobile-card p {
  margin: 6px 0;
  color: var(--text-muted, #667085);
}

.mobile-business-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 10px 0;
  font-size: 14px;
}

.mobile-business-card dt {
  color: var(--text-muted, #667085);
}

.mobile-business-card dd {
  margin: 0;
  text-align: right;
}

.mobile-card-actions {
  justify-content: flex-start;
  margin-top: 12px;
}

.product-mobile-card {
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
}

.product-mobile-card .product-thumb {
  width: 72px;
  height: 72px;
}

.mobile-bottom-nav,
.mobile-business-hub {
  display: none;
}

@media (max-width: 760px) {
  body {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }

  .main {
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
  }

  .mobile-bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 95;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: 64px;
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
    border-top: 1px solid #dfe5eb;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, .08);
    backdrop-filter: blur(14px);
  }

  .mobile-bottom-nav > a,
  .mobile-bottom-nav > button {
    position: static;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 3px;
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 54px;
    margin: 0;
    padding: 4px 2px;
    border: 0;
    border-radius: 10px;
    color: #667085;
    background: transparent;
    box-shadow: none;
    transform: none;
  }

  .mobile-bottom-nav > a.active,
  .mobile-bottom-nav > button[aria-expanded="true"] {
    color: var(--accent-strong);
    background: var(--accent-soft);
  }

  .mobile-bottom-nav small {
    font-size: 11px;
    font-weight: 650;
    white-space: nowrap;
  }

  .mobile-nav-icon,
  .mobile-nav-menu {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    font-size: 20px;
  }

  .mobile-nav-icon svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mobile-business-hub {
    display: block;
  }

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

  .mobile-business-grid > a {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 64px;
    padding: 11px;
    border: 1px solid #e1e7ee;
    border-radius: 12px;
    color: #253044;
    background: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .04);
  }

  .mobile-business-grid > a:active {
    border-color: #9dd9de;
    background: #effafa;
    transform: scale(.985);
  }

  .mobile-business-grid strong {
    min-width: 0;
    font-size: 14px;
    line-height: 1.25;
  }

  .mobile-business-grid small {
    color: #98a2b3;
    font-size: 11px;
  }

  .mobile-business-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    color: var(--accent-strong);
    background: var(--accent-soft);
  }

  .mobile-business-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mobile-stack-auto,
  .mobile-stack-auto tbody,
  .mobile-stack-auto tr,
  .mobile-stack-auto td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .mobile-stack-auto thead {
    display: none;
  }

  .mobile-stack-auto tbody {
    display: grid;
    gap: 10px;
  }

  .mobile-stack-auto tbody tr {
    overflow: hidden;
    padding: 8px 12px;
    border: 1px solid #e1e7ee;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .035);
  }

  .mobile-stack-auto tbody td {
    display: grid;
    grid-template-columns: minmax(82px, 34%) minmax(0, 1fr);
    gap: 10px;
    height: auto;
    min-height: 48px;
    padding: 8px 0;
    border: 0;
    border-bottom: 1px solid #eef1f5;
    text-align: right;
    overflow-wrap: anywhere;
  }

  .mobile-stack-auto tbody td:last-child {
    border-bottom: 0;
  }

  .mobile-stack-auto tbody td::before {
    content: attr(data-label);
    color: #667085;
    font-size: 12px;
    font-weight: 650;
    text-align: left;
  }

  .mobile-stack-auto tbody td.mobile-empty-cell {
    display: none;
  }

  .mobile-stack-auto tbody td[colspan] {
    display: block;
    text-align: left;
  }

  .mobile-stack-auto tbody td[colspan]::before {
    display: none;
  }

  .mobile-stack-auto input,
  .mobile-stack-auto select,
  .mobile-stack-auto textarea {
    width: 100%;
    min-width: 0;
  }

  /* AI 草稿复核：一格内可能同时包含搜索、选择、价格来源和改价控件。
     手机端统一放入右侧内容列，避免自动网格把后续控件挤到标签列。 */
  .draft-items-table.mobile-stack-auto tbody td {
    align-items: start;
    text-align: left;
  }

  .draft-items-table.mobile-stack-auto tbody td > * {
    grid-column: 2;
    min-width: 0;
    max-width: 100%;
  }

  .draft-items-table.mobile-stack-auto [data-searchable-select],
  .draft-items-table.mobile-stack-auto .ai-price-cell {
    width: 100%;
  }

  .draft-items-table.mobile-stack-auto .select-filter-input,
  .draft-items-table.mobile-stack-auto select,
  .draft-items-table.mobile-stack-auto input:not([type="checkbox"]) {
    width: 100%;
    min-width: 0;
  }

  .draft-items-table.mobile-stack-auto .compact-check {
    display: flex !important;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    width: 100%;
    text-align: left;
  }

  .draft-items-table.mobile-stack-auto .compact-check input[type="checkbox"] {
    width: 18px;
    min-width: 18px;
    height: 18px;
    margin: 0;
  }

  .draft-items-table.mobile-stack-auto .order-product-preview {
    width: 64px;
    height: 64px;
  }

  .draft-items-table.mobile-stack-auto .ai-price-cell > strong,
  .draft-items-table.mobile-stack-auto .ai-price-cell > small {
    width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .draft-items-table.mobile-stack-auto tbody td:nth-child(4),
  .draft-items-table.mobile-stack-auto tbody td:nth-child(8) {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 7px 10px;
  }

  .draft-items-table.mobile-stack-auto tbody td:nth-child(4)::before,
  .draft-items-table.mobile-stack-auto tbody td:nth-child(8)::before {
    flex: 0 0 calc(34% - 5px);
  }

  .draft-items-table.mobile-stack-auto tbody td:nth-child(4) > *,
  .draft-items-table.mobile-stack-auto tbody td:nth-child(8) > * {
    flex: 0 0 calc(66% - 5px);
    margin-left: auto;
  }

  .list-panel > .table-wrap,
  .master-list-main .list-panel > .table-wrap {
    display: none;
  }

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

  .product-mobile-card {
    display: grid;
  }

  .mobile-card-actions .primary-btn,
  .mobile-card-actions .secondary-btn {
    flex: 1 1 auto;
    min-height: 44px;
    text-align: center;
  }
}

.customer-name-link {
  display: grid;
  gap: 3px;
  color: var(--text-strong, #172033);
}

.customer-name-link small {
  color: var(--text-muted, #718096);
  font-weight: 400;
}

.customer-account-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.customer-account-hero h2 {
  margin: 10px 0 4px;
  font-size: clamp(24px, 2.2vw, 32px);
}

.customer-account-hero p {
  margin: 0;
  color: var(--text-muted, #667085);
}

.customer-account-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.table-inline-action {
  display: inline-block;
  margin-left: 8px;
  color: #0d8494;
  font-size: 12px;
  white-space: nowrap;
}

.table-inline-action:hover,
.table-inline-action:focus-visible {
  color: #075e69;
  text-decoration: underline;
}

.customer-account-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.customer-account-cards article {
  padding: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .045);
}

.customer-account-cards span {
  display: block;
  margin-bottom: 7px;
  color: #667085;
}

.customer-account-cards strong {
  font-size: 22px;
  color: #172033;
}

.address-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.address-card-grid article {
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.address-card-grid p {
  margin: 8px 0;
}

@media (max-width: 900px) {
  .customer-account-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .customer-account-actions {
    justify-content: flex-start;
  }

  .customer-account-cards,
  .address-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .customer-account-cards,
  .address-card-grid {
    grid-template-columns: 1fr;
  }

  .customer-account-actions > * {
    flex: 1 1 100%;
    text-align: center;
  }
}
/* Customer payment and internal payment-link controls */
.payment-shell {
  max-width: 920px;
  margin: 0 auto;
}

.payment-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.payment-summary > div {
  display: grid;
  gap: 6px;
}

.payment-amount {
  text-align: right;
}

.payment-amount strong {
  color: #e5484d;
  font-size: 30px;
}

.payment-items {
  display: grid;
}

.payment-item {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 110px 110px 130px;
  gap: 16px;
  align-items: center;
  min-height: 72px;
  border-bottom: 1px solid var(--line, #e5e7eb);
}

.payment-item > div {
  display: grid;
  gap: 4px;
}

.payment-item img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  float: left;
  margin-right: 12px;
}

.payment-action {
  position: sticky;
  bottom: 0;
  padding: 14px;
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--line, #e5e7eb);
  text-align: center;
}

.order-payment-link {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px;
  background: #fff;
}

.order-link-tools {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.order-warehouse-link {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px;
  background: #fff;
}

.order-warehouse-link form { margin: 0; }
.order-warehouse-link small { color: var(--ink-muted, #64748b); line-height: 1.5; }

  @media (max-width: 800px) {
    .order-link-tools { grid-template-columns: 1fr; }
  }

.payment-link-copy {
  display: flex;
  gap: 8px;
}

.payment-link-copy input {
  flex: 1;
  min-width: 0;
}

.customer-confirm-panel form,
.payment-action form {
  display: grid;
  gap: 14px;
}

.payment-methods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.payment-methods label,
.confirm-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px;
  background: #fff;
}

.manual-payment-instructions {
  padding: 14px;
  border-radius: 10px;
  background: #f5f7fa;
  white-space: pre-wrap;
  line-height: 1.7;
}

.payment-qr {
  display: block;
  width: min(240px, 70vw);
  max-height: 240px;
  object-fit: contain;
  margin: 0 auto 16px;
}

.payment-success,
.payment-pending {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 10px;
  background: #edf9f3;
}

.payment-pending {
  background: #fff8e8;
}

.correction-request {
  margin-top: 14px;
}

.correction-request form {
  margin-top: 12px;
}

@media (max-width: 720px) {
  .payment-summary {
    align-items: flex-start;
  }

  .payment-item {
    grid-template-columns: 1fr auto;
    padding: 12px 0;
  }

  .payment-item > span,
  .payment-item > strong {
    text-align: right;
  }

  .payment-link-copy {
    display: grid;
  }
}

/* Production workspace polish */
.work-page-head,
.dashboard-section,
.panel {
  border: 1px solid #e4e9f0;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(22, 34, 51, .035);
}

.work-page-head {
  padding: 20px 22px;
  background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
}

.work-page-head h2,
.section-head h3,
.dashboard-head h2 {
  color: #182230;
  letter-spacing: -.01em;
}

.work-page-head p,
.section-head small {
  color: #667085;
}

.panel {
  background: #fff;
}

table {
  font-size: 14px;
}

table thead th {
  height: 46px;
  color: #344054;
  font-weight: 650;
  background: #f6f8fb;
  border-bottom: 1px solid #dfe5ec;
}

table tbody td {
  min-height: 50px;
  color: #344054;
  border-bottom-color: #edf0f4;
}

table tbody tr {
  transition: background-color .15s ease;
}

table tbody tr:hover {
  background: #f8fbfd;
}

.order-list-table td > strong,
.order-list-table td > a:first-child {
  color: #182230;
  font-weight: 650;
}

.order-list-table td small {
  display: block;
  max-width: 360px;
  margin-top: 5px;
  color: #7b8494;
  line-height: 1.45;
}

.badge.neutral {
  color: #475467;
  background: #f2f4f7;
  border-color: #e4e7ec;
}

.finance-summary,
.procurement-summary {
  margin-bottom: 16px;
}

.finance-payment-panel .form-grid {
  margin-top: 4px;
}

.work-queue-item {
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.work-queue-item:hover {
  transform: translateY(-1px);
  border-color: #c9d5e3;
  box-shadow: 0 7px 18px rgba(22, 34, 51, .06);
}

@media (max-width: 760px) {
  .work-page-head {
    padding: 16px;
    border-radius: 10px;
  }

  .work-page-head h2 {
    font-size: 21px;
  }

  .work-page-head p {
    margin-top: 5px;
    font-size: 14px;
  }

  .workbench-actions {
    width: 100%;
  }

  .workbench-actions > a,
  .workbench-actions > button,
  .workbench-actions > details {
    flex: 1 1 auto;
  }

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

  .finance-payment-panel .form-grid {
    grid-template-columns: 1fr;
  }

  .finance-payment-panel .wide-field {
    grid-column: auto;
  }
}

/* 最终覆盖：订单明细不得被外层卡片裁掉，窄屏用表格自身横向滚动。 */
.order-entry-wrap,
.ai-review-items-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: touch;
}

.order-entry-wrap .order-entry-table { min-width: 1320px; }
.ai-review-items-wrap .draft-items-table {
  width: max-content;
  min-width: 1500px;
  table-layout: auto;
}
.draft-items-table th:nth-child(5),
.draft-items-table td:nth-child(5) {
  width: 76px;
  min-width: 76px;
  max-width: 90px;
}
.draft-items-table th:nth-child(6),
.draft-items-table td:nth-child(6) {
  width: 92px;
  min-width: 92px;
  max-width: 112px;
}
.ai-review-items-wrap .draft-items-table .ai-quantity-input {
  width: 78px;
  min-width: 78px;
  max-width: 86px;
}
.ai-review-items-wrap .draft-items-table .ai-unit-select {
  width: 96px;
  min-width: 96px;
  max-width: 116px;
}
.product-suggestions,
.select-filter-results {
  z-index: 1000 !important;
  max-height: min(430px, calc(100vh - 24px));
  overflow-y: auto;
}
.product-suggestion-item,
.select-filter-result {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

@media print {
  .mobile-bottom-nav,
  .mobile-business-hub,
  .sidebar,
  .sidebar-mask,
  .nav-toggle,
  .topbar { display: none !important; }
}
/* Final responsive order-entry pass: keep every important field usable on a
   small screen instead of forcing a wide desktop table into a phone. */
.column-resizable > thead > tr > th {
  position: relative;
}
.column-resizable > thead > tr > th:not(:last-child) {
  /* Keep column boundaries visible before the pointer reaches them. */
  box-shadow: inset -2px 0 0 rgba(35, 157, 219, .72);
}
.column-resizer {
  position: absolute;
  top: 0;
  right: -6px;
  width: 12px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
  z-index: 6;
  opacity: 1;
}
.column-resizer::before {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 5px;
  width: 2px;
  border-radius: 2px;
  background: #239ddb;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .7);
}
.column-resizer:hover,
.column-resizer.is-dragging {
  background: rgba(20, 132, 210, .16);
}
.column-resizer:hover::before,
.column-resizer.is-dragging::before {
  left: 4px;
  width: 4px;
  background: #006fbd;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .9), 0 0 7px rgba(0, 111, 189, .55);
}
.table-layout-tools {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 34px;
  padding: 4px 2px 7px;
}
.table-layout-tools label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}
.table-layout-tools select {
  width: auto;
  min-width: 82px;
  height: 30px;
  padding: 3px 26px 3px 9px;
}
table[data-row-density="compact"] th,
table[data-row-density="compact"] td { padding-top: 5px !important; padding-bottom: 5px !important; }
table[data-row-density="normal"] th,
table[data-row-density="normal"] td { padding-top: 9px; padding-bottom: 9px; }
table[data-row-density="comfortable"] th,
table[data-row-density="comfortable"] td { padding-top: 14px !important; padding-bottom: 14px !important; }
@media (min-width: 801px) {
  .order-entry-table, .formal-order-table, .order-inline-edit-table,
  .draft-items-table { table-layout: fixed; }
  .order-entry-table th, .formal-order-table th,
  .order-inline-edit-table th, .draft-items-table th { overflow: hidden; text-overflow: ellipsis; }
}
 /* Legacy table-stacking rules disabled; keep only the unified phone cards. */
 @media (max-width: 0px) {
  .table-layout-tools { display: none; }
  .order-entry-wrap, .order-items-wrap, .order-inline-edit-wrap,
  .ai-review-items-wrap { overflow: visible !important; }
  .order-entry-wrap .order-entry-table,
  .ai-review-items-wrap .draft-items-table {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  .order-entry-table, .formal-order-table, .order-inline-edit-table,
  .draft-items-table,
  .order-entry-table tbody, .formal-order-table tbody,
  .order-inline-edit-table tbody, .draft-items-table tbody,
  .order-entry-table tr, .formal-order-table tr,
  .order-inline-edit-table tr, .draft-items-table tr,
  .order-entry-table td, .formal-order-table td,
  .order-inline-edit-table td, .draft-items-table td { display: block; width: 100%; min-width: 0; }
  .order-entry-table thead, .formal-order-table thead,
  .order-inline-edit-table thead, .draft-items-table thead { display: none; }
  .order-entry-table tr, .formal-order-table tr,
  .order-inline-edit-table tr, .draft-items-table tr {
    margin: 10px 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(24,42,62,.05);
  }
  .order-entry-table td, .formal-order-table td,
  .order-inline-edit-table td, .draft-items-table td {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding: 7px 0;
    border: 0;
    overflow-wrap: anywhere;
  }
  .order-entry-table td::before, .formal-order-table td::before,
  .order-inline-edit-table td::before, .draft-items-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
  }
  .order-entry-table td input, .order-entry-table td select,
  .order-inline-edit-table td input, .order-inline-edit-table td select,
  .draft-items-table td input, .draft-items-table td select { width: 100%; min-width: 0; min-height: 42px; }
  .draft-items-table .ai-price-cell { display: block; }
  .draft-items-table .ai-price-cell::before { display: block; margin-bottom: 5px; }
  .draft-items-table .ai-price-cell > * { max-width: 100%; }
  .product-suggestions { left: 10px !important; right: 10px !important; width: auto !important; max-height: 56vh !important; }
  /* Keep manual-order results attached to the field instead of pinning them
     near the bottom of the phone viewport. */
  .product-search-box { position: relative; z-index: 12; }
  /* The shared picker portals its panel to document.body and positions it
     from getBoundingClientRect(). The old mobile override changed that
     body-level panel back to absolute positioning and forced top:100%, so
     the result list was rendered far away or outside the viewport. */
  .product-suggestions {
    position: fixed !important;
    right: auto !important;
    bottom: auto !important;
  }
  .order-entry-table input[type="number"],
  .order-entry-table select,
  .draft-items-table input[type="number"],
  .draft-items-table select { width: 100% !important; min-width: 0 !important; box-sizing: border-box; }
}

/* The compact mobile tab rule above must not hide the home tab label. */
 /* Legacy business-workspace mobile rules disabled; the final phone layout
    below replaces this duplicate order editor implementation. */
 @media (max-width: 0px) {
  .workspace-tabs .home-tab a {
    display: inline-flex !important;
    min-height: auto !important;
    padding: 0 2px !important;
  }
}

/* Mobile business workspace: forms become touch-friendly cards instead of a
   mechanically stacked desktop table. This block intentionally comes last so
   it also overrides legacy mobile rules and JS inline popup coordinates. */
@media (max-width: 820px) {
  :root { --mobile-action-bar: 72px; }

  .page-shell,
  .content-shell,
  .content-area { min-width: 0; overflow-x: clip; }

  .panel,
  .utility-panel,
  .detail-panel { padding: 14px; border-radius: 14px; }

  .master-data-form,
  .order-header-form,
  .ai-review-form,
  .filter-grid,
  .customer-form-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }

  .master-data-form > *,
  .order-header-form > *,
  .ai-review-form > *,
  .filter-grid > *,
  .customer-form-grid > * { grid-column: 1 !important; min-width: 0; }

  .order-entry-table,
  .formal-order-table,
  .order-inline-edit-table,
  .draft-items-table,
  .order-entry-table tbody,
  .formal-order-table tbody,
  .order-inline-edit-table tbody,
  .draft-items-table tbody { display: block !important; width: 100% !important; min-width: 0 !important; }

  .order-entry-table thead,
  .formal-order-table thead,
  .order-inline-edit-table thead,
  .draft-items-table thead { display: none !important; }

  .order-entry-table tr,
  .formal-order-table tr,
  .order-inline-edit-table tr,
  .draft-items-table tr {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 0 12px;
    width: 100% !important;
    margin: 0 0 14px !important;
    padding: 12px !important;
    border: 1px solid #d9e3ec !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: 0 4px 16px rgba(24, 42, 62, .06);
  }

  .order-entry-table td,
  .formal-order-table td,
  .order-inline-edit-table td,
  .draft-items-table td {
    display: grid !important;
    grid-template-columns: 72px minmax(0, 1fr) !important;
    align-items: center;
    gap: 8px;
    width: auto !important;
    min-width: 0 !important;
    padding: 8px 0 !important;
    border: 0 !important;
    overflow: visible !important;
  }

  .order-entry-table td::before,
  .formal-order-table td::before,
  .order-inline-edit-table td::before,
  .draft-items-table td::before {
    content: attr(data-label) !important;
    color: #637386;
    font-size: 12px;
    font-weight: 700;
  }

  .order-entry-table td[data-label="商品"],
  .order-entry-table td[data-label="备注"],
  .formal-order-table td[data-label="商品"],
  .formal-order-table td[data-label="规格/编码"],
  .formal-order-table td[data-label="备注"],
  .order-inline-edit-table td[data-label="商品"],
  .draft-items-table td[data-label="图片"],
  .draft-items-table td[data-label="客户填写内容"],
  .draft-items-table td[data-label="系统商品"],
  .draft-items-table td[data-label="成交单价"],
  .draft-items-table td[data-label="备注"] { grid-column: 1 / -1 !important; }

  .order-entry-table td[data-label="商品"],
  .draft-items-table td[data-label="客户填写内容"],
  .draft-items-table td[data-label="系统商品"] {
    grid-template-columns: 1fr !important;
    padding-top: 10px !important;
  }

  .order-entry-table td[data-label="商品"]::before,
  .draft-items-table td[data-label="客户填写内容"]::before,
  .draft-items-table td[data-label="系统商品"]::before { margin-bottom: 2px; }

  .order-entry-table td[data-label="原价"],
  .order-entry-table td[data-label="折扣"],
  .order-entry-table td[data-label="可用库存"] { display: none !important; }

  .order-entry-table input,
  .order-entry-table select,
  .order-inline-edit-table input,
  .order-inline-edit-table select,
  .draft-items-table input,
  .draft-items-table select {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px;
    box-sizing: border-box;
  }

  .product-search-box { position: static !important; }

  .product-suggestions,
  .select-filter-results {
    position: fixed !important;
    z-index: 10020 !important;
    inset: auto 8px 8px 8px !important;
    top: auto !important;
    left: 8px !important;
    right: 8px !important;
    bottom: 8px !important;
    width: auto !important;
    max-width: none !important;
    max-height: min(62vh, 520px) !important;
    padding: 8px !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    border: 1px solid #cbd9e6 !important;
    border-radius: 16px !important;
    background: #fff !important;
    box-shadow: 0 -10px 40px rgba(20, 42, 66, .22) !important;
  }

  .product-suggestion,
  .select-filter-result {
    min-height: 64px;
    padding: 10px !important;
    border-radius: 10px;
    text-align: left;
  }

  .product-suggestion + .product-suggestion,
  .select-filter-result + .select-filter-result { border-top: 1px solid #edf1f5; }

  .mobile-card-list { display: grid; gap: 10px; }
  .mobile-business-card,
  .delivery-mobile-card,
  .driver-task-card { border-radius: 14px; padding: 13px; }

  .delivery-desktop-table { display: none !important; }
  .delivery-mobile-list { display: grid !important; gap: 10px; }

  .form-actions.mobile-primary-action,
  .order-submit-actions,
  .ai-review-form > .form-actions:last-child {
    position: sticky;
    z-index: 100;
    bottom: calc(8px + env(safe-area-inset-bottom));
    padding: 8px;
    border: 1px solid #dbe4ec;
    border-radius: 14px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 8px 28px rgba(22, 43, 64, .14);
  }

  .form-actions.mobile-primary-action .primary-btn,
  .order-submit-actions .primary-btn,
  .ai-review-form > .form-actions:last-child .primary-btn { width: 100%; min-height: 48px; }
}

.low-margin-row { background: #fff5f5 !important; }
.margin-low { color: #c62828; font-weight: 800; }
.margin-ok { color: #17785f; font-weight: 700; }
.margin-missing { color: #a06000; font-weight: 700; }
/* Project-specific tender questionnaire */
.tender-field-builder {
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  padding: 14px;
  background: #f8fafc;
}

.tender-field-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(130px, .7fr) minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid #e4ebf2;
}

.tender-field-row:first-child { border-top: 0; }
.tender-field-row input,
.tender-field-row select,
.tender-field-row textarea { width: 100%; }

.tender-config-form {
  min-width: min(900px, 86vw);
  padding: 14px 0;
}

.tender-project-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tender-project-files > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid #d7e2ea;
  border-radius: 8px;
  background: #f7fafc;
}

.required-mark { color: #c7372f; }

.order-edit-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid #cbdbe8;
  border-radius: 10px;
  background: #f7fbfd;
}

.order-edit-entry small { display: block; margin-top: 4px; color: #66788a; }

@media (max-width: 760px) {
  .tender-field-row { grid-template-columns: 1fr; }
  .tender-config-form { min-width: 0; }
  .order-edit-entry { align-items: stretch; flex-direction: column; }
}

/* Final phone layout -------------------------------------------------------
   The order editor is a dense table on desktop, but it is a sequence of
   touch-friendly product cards on a phone.  This block is intentionally last:
   older responsive rules in this stylesheet used different card models and
   could leave the desktop min-width on the search controls. */
@media (max-width: 820px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .shell,
  .main,
  .workspace-page,
  .page-heading,
  .page-content,
  .content-shell,
  .work-content,
  .simple-order-form,
  .ai-review-form,
  .order-step,
  .order-lines-panel,
  .order-entry-wrap,
  .ai-review-items-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  .main { padding: 12px !important; }
  .page-heading { margin: 0 0 10px; }
  .page-heading h1 { font-size: 22px; line-height: 1.25; }

  .order-mode-tabs,
  .order-master-grid,
  .order-header-fields,
  .order-address-fields,
  .ai-review-form .form-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    min-width: 0 !important;
  }

  .order-mode-tabs > a,
  .order-head-actions > *,
  .workbench-actions > *,
  .list-toolbar .actions > * {
    min-width: 0;
    max-width: 100%;
  }

  .order-head-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .order-head-actions > * {
    width: 100%;
    margin: 0;
    text-align: center;
  }

  .order-entry-wrap,
  .ai-review-items-wrap {
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
  }

  .order-entry-table,
  .draft-items-table {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    table-layout: auto !important;
  }

  .order-entry-table thead,
  .draft-items-table thead { display: none !important; }

  .order-entry-table tbody,
  .draft-items-table tbody {
    display: grid !important;
    gap: 12px;
    width: 100% !important;
    min-width: 0 !important;
  }

  .order-entry-table tbody tr,
  .draft-items-table tbody tr {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 12px;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 12px !important;
    overflow: hidden;
    border: 1px solid #d7e3ee !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: 0 4px 16px rgba(24, 42, 62, .06);
  }

  .order-entry-table tbody td,
  .draft-items-table tbody td {
    display: grid !important;
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    width: auto !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 8px 0 !important;
    overflow-wrap: anywhere;
    border: 0 !important;
    text-align: left !important;
  }

  .order-entry-table tbody td::before,
  .draft-items-table tbody td::before {
    content: attr(data-label) !important;
    min-width: 0;
    color: #637386;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
  }

  .order-entry-table tbody td[data-label="商品"],
  .order-entry-table tbody td[data-label="规格"],
  .order-entry-table tbody td[data-label="成交单价"],
  .order-entry-table tbody td[data-label="备注"],
  .draft-items-table tbody td[data-label="图片"],
  .draft-items-table tbody td[data-label="客户填写内容"],
  .draft-items-table tbody td[data-label="系统商品"],
  .draft-items-table tbody td[data-label="规格"],
  .draft-items-table tbody td[data-label="成交单价"],
  .draft-items-table tbody td[data-label="备注"],
  .draft-items-table tbody td[data-label="操作"] {
    grid-column: 1 / -1 !important;
  }

  .order-entry-table tbody td[data-label="商品"],
  .draft-items-table tbody td[data-label="客户填写内容"],
  .draft-items-table tbody td[data-label="系统商品"] {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding-top: 10px !important;
  }

  .order-entry-table tbody td[data-label="商品"]::before,
  .draft-items-table tbody td[data-label="客户填写内容"]::before,
  .draft-items-table tbody td[data-label="系统商品"]::before { margin-bottom: 3px; }

  .order-entry-table tbody td[data-label="序号"] {
    grid-column: 1 / -1 !important;
    display: block !important;
    padding-bottom: 4px !important;
    color: #167d8c;
    font-weight: 750;
  }

  .order-entry-table tbody td[data-label="操作"] {
    position: absolute;
    top: 9px;
    right: 10px;
    display: block !important;
    width: 32px !important;
    padding: 0 !important;
  }

  .order-entry-table tbody td[data-label="操作"]::before { display: none; }

  .order-entry-table tbody td[data-label="原价"],
  .order-entry-table tbody td[data-label="折扣"],
  .order-entry-table tbody td[data-label="可用库存"] { display: none !important; }

  .order-product-picker {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) !important;
    gap: 9px;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  .order-product-preview,
  .draft-items-table .order-product-preview {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
  }

  .product-search-box,
  .ai-product-search-box,
  .product-search-input,
  .selected-product-summary,
  .price-policy,
  .match-status,
  .order-product-picker > * {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  .product-search-input,
  .order-entry-table input,
  .order-entry-table select,
  .draft-items-table input,
  .draft-items-table select {
    min-height: 44px;
    font-size: 16px;
  }

  .order-entry-table .manual-price-cell,
  .draft-items-table .ai-price-cell {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    width: 100%;
  }

  .order-entry-table .line-total,
  .draft-items-table .ai-line-total {
    color: #b42318;
    font-size: 18px;
    font-weight: 750;
  }

  .order-total-bar {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .order-total-bar > strong { grid-column: 1 / -1; }

  .simple-order-submit,
  .order-submit-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
  }

  .simple-order-submit > *,
  .order-submit-actions > * {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100%;
    margin: 0 !important;
    text-align: center;
  }

  .simple-order-submit .compact-field,
  .simple-order-submit #order-draft-status,
  .simple-order-submit button[value="finance"] {
    grid-column: 1 / -1;
  }

  /* Result lists are deliberately independent from the card's overflow. */
  .product-suggestions,
  .select-filter-results {
    position: fixed !important;
    inset: auto 8px max(76px, env(safe-area-inset-bottom)) 8px !important;
    width: auto !important;
    max-width: none !important;
    max-height: min(56vh, 520px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    z-index: 10020 !important;
    border: 1px solid #b8c7d9 !important;
    border-radius: 16px !important;
    background: #fff !important;
    box-shadow: 0 -10px 40px rgba(20, 42, 66, .22) !important;
  }

  .product-suggestion-item,
  .select-filter-result {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 60px;
    padding: 10px !important;
    text-align: left;
    white-space: normal;
  }

  /* Customer and product lists use cards, not a clipped wide table. */
  .list-toolbar,
  .list-toolbar > form,
  .list-toolbar > .actions,
  .batch-toolbar,
  .batch-toolbar .inline-fields {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    min-width: 0;
  }

  .list-toolbar input,
  .list-toolbar select,
  .list-toolbar button,
  .list-toolbar a,
  .batch-toolbar select,
  .batch-toolbar button { width: 100%; min-width: 0; margin: 0; }

  .master-list-layout { display: block !important; min-width: 0; }
  .category-rail {
    display: flex !important;
    gap: 6px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    padding: 8px !important;
    white-space: nowrap;
  }
  .category-rail strong { flex: 0 0 auto; border: 0; padding: 8px; }
  .category-rail a { flex: 0 0 auto; }
  .master-list-main { min-width: 0; }
  .list-panel { width: 100%; max-width: 100%; overflow: visible !important; }
  .list-panel > .table-wrap,
  .master-list-main .list-panel > .table-wrap { display: none !important; }
  .mobile-card-list { display: grid !important; gap: 10px; width: 100%; }
  .mobile-business-card,
  .product-mobile-card { width: 100%; min-width: 0; box-sizing: border-box; }
  .mobile-card-head { align-items: flex-start; flex-wrap: wrap; }
  .mobile-card-head > a { min-width: 0; overflow-wrap: anywhere; }
  .mobile-card-actions { flex-wrap: wrap; }
  .mobile-card-actions > * { flex: 1 1 44%; min-width: 0; margin: 0 !important; text-align: center; }
  .product-mobile-card { grid-template-columns: 56px minmax(0, 1fr); gap: 10px; }
  .product-mobile-card .product-thumb { width: 56px; height: 56px; }
}

/* Shared customer picker: the native select remains the submitted form
   value, but the visible search/result interaction is identical on desktop
   and mobile. This prevents iOS/Android from replacing it with a clipped
   one-line native option list. */
.farmlink-native-customer-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}
.farmlink-customer-search-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.customer-suggestions {
  display: grid;
  gap: 0;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #cbd9e6;
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(20, 42, 66, .22);
  overscroll-behavior: contain;
}
.customer-suggestions[hidden] { display: none !important; }
.customer-suggestion-item {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 58px;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid #edf1f5;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
  touch-action: manipulation;
}
.customer-suggestion-item:last-child { border-bottom: 0; }
.customer-suggestion-item:hover,
.customer-suggestion-item:focus-visible { background: #edf7fa; color: #0d7180; }
.customer-suggestion-item strong {
  display: block;
  font-size: 15px;
  line-height: 1.45;
  font-weight: 700;
}
.customer-suggestion-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.customer-suggestion-empty {
  padding: 18px 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}
