:root {
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  color: #17212b;
  background: #eef1f4;
  font-synthesis: none;
  --navy: #18364a;
  --blue: #246b8e;
  --green: #2d775d;
  --red: #b5433f;
  --amber: #a96d16;
  --line: #d8dee4;
  --muted: #66727d;
  --panel: #ffffff;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.login-shell { min-height: 100vh; display: grid; place-items: center; background: #e8edf0; padding: 24px; }
.login-panel { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 32px; box-shadow: 0 16px 36px rgba(24,54,74,.12); }
.brand-lockup { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; background: var(--navy); color: #fff; border-radius: 6px; }
.brand-lockup h1 { margin: 0; font-size: 22px; }
.brand-lockup p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.field { display: grid; gap: 7px; margin-bottom: 15px; }
.field label { font-size: 13px; font-weight: 700; color: #394651; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #cbd3da; border-radius: 5px; padding: 10px 11px; background: #fff; color: #17212b; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid rgba(36,107,142,.18); border-color: var(--blue); }
.choice-picker { position: relative; width: 100%; }
.field .choice-picker > input, .field .choice-picker > textarea { padding-right: 42px; }
.choice-picker-toggle { position: absolute; top: 1px; right: 1px; bottom: 1px; width: 38px; display: grid; place-items: center; border: 0; border-left: 1px solid #d7dee4; border-radius: 0 4px 4px 0; background: #fff; color: #314554; cursor: pointer; }
.choice-picker-toggle:hover, .choice-picker-toggle:focus-visible { background: #f1f6f8; color: var(--blue); }
.choice-picker-toggle svg { width: 17px; height: 17px; }
.choice-picker-menu { position: absolute; z-index: 80; top: calc(100% + 4px); left: 0; right: 0; max-height: 260px; overflow-y: auto; padding: 5px; border: 1px solid #cbd3da; border-radius: 5px; background: #fff; box-shadow: 0 10px 24px rgba(22, 42, 55, .16); }
.choice-picker-menu.opens-up { top: auto; bottom: calc(100% + 4px); }
.choice-picker-option { width: 100%; padding: 9px 10px; border: 0; border-radius: 4px; background: transparent; color: #17212b; text-align: left; cursor: pointer; white-space: normal; overflow-wrap: anywhere; }
.choice-picker-option:hover, .choice-picker-option:focus-visible { background: #e9f3f6; outline: none; }
.choice-picker-empty { padding: 10px; color: #74828d; font-size: 13px; text-align: center; }
.history-autocomplete-menu {
  position: fixed;
  z-index: 1400;
  max-width: calc(100vw - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  padding: 5px;
  border: 1px solid var(--border-color, #dce6df);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(21, 63, 53, .16);
}
.history-autocomplete-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: stretch;
  gap: 2px;
  border-radius: 6px;
}
.history-autocomplete-option {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary, #263c34);
  font: inherit;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.history-autocomplete-remove {
  display: grid;
  place-items: center;
  min-width: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #98a79f;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: .48;
}
.history-autocomplete-row:hover .history-autocomplete-remove,
.history-autocomplete-remove:focus-visible {
  color: var(--status-danger, #d85c53);
  background: #fff3f1;
  opacity: 1;
  outline: none;
}
.history-autocomplete-option:hover,
.history-autocomplete-option:focus-visible,
.history-autocomplete-option.active {
  outline: none;
  background: var(--brand-primary-soft, #edf3ef);
  color: var(--brand-primary, #153f35);
}
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { background: var(--navy); color: #fff; padding: 20px 14px; display: flex; flex-direction: column; min-height: 100vh; position: sticky; top: 0; height: 100vh; }
.sidebar .brand-lockup { padding: 0 8px; margin-bottom: 24px; }
.sidebar .brand-mark { background: #fff; color: var(--navy); }
.sidebar .brand-lockup h1 { font-size: 16px; white-space: nowrap; }
.sidebar .brand-lockup p { color: #bfcbd3; }
.nav { display: grid; gap: 4px; }
.nav button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-radius: 5px; padding: 10px 11px; color: #dce6eb; background: transparent; text-align: left; }
.nav button:hover, .nav button.active { background: rgba(255,255,255,.12); color: #fff; }
.nav svg, .btn svg, .icon-btn svg { width: 17px; height: 17px; flex: 0 0 auto; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.16); padding: 16px 8px 0; font-size: 13px; color: #c7d3da; display: grid; gap: 4px; }
.sidebar-footer strong { color: #fff; font-size: 14px; }
.sidebar-footer span { color: #bfcbd3; }
.workspace { min-width: 0; }
.topbar { height: 64px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 5; }
.topbar h2 { margin: 0; font-size: 19px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.content { padding: 24px 28px 48px; max-width: 1560px; margin: 0 auto; }
.btn { border: 1px solid transparent; border-radius: 5px; min-height: 36px; padding: 8px 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: #fff; color: #23313c; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.success { background: var(--green); color: #fff; }
.btn.secondary { border-color: #cbd3da; }
.btn.danger { color: var(--red); border-color: #e2c4c2; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 36px; height: 36px; border: 1px solid #cbd3da; background: #fff; border-radius: 5px; display: grid; place-items: center; color: #34434f; }
.icon-btn:disabled { opacity: .45; cursor: not-allowed; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar > select.btn.secondary { min-width: 128px; }
.toolbar .spacer { flex: 1; }
.export-date-range { display: flex; align-items: center; gap: 7px; min-height: 40px; padding: 4px 7px; border: 1px solid #ccd4da; border-radius: 5px; background: #fff; }
.export-date-range label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.export-date-range input { width: 128px; min-height: 30px; border: 0; padding: 3px 4px; background: transparent; color: #17212b; font: inherit; }
.export-date-range input:focus { outline: 2px solid #9fc4d5; outline-offset: 1px; }
.date-range-separator { color: var(--muted); font-size: 12px; }
.search { position: relative; width: min(340px, 100%); }
.search input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid #cbd3da; border-radius: 5px; }
.search svg { position: absolute; left: 11px; top: 10px; width: 17px; color: #7a8791; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; }
.panel-header { min-height: 50px; padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-header h3 { margin: 0; font-size: 15px; }
.panel-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dashboard-list-tools { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex: 1; min-width: 0; }
.dashboard-search { width: min(360px, 100%); }
.dashboard-party-picker { position: relative; width: min(250px, 100%); flex: 0 1 250px; }
.dashboard-party-trigger { width: 100%; min-height: 38px; border: 1px solid #cbd3da; border-radius: 5px; padding: 8px 10px; background: #fff; color: #23313c; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dashboard-party-trigger span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.dashboard-party-trigger svg { width: 16px; height: 16px; flex: 0 0 auto; }
.dashboard-party-menu { position: absolute; z-index: 12; top: calc(100% + 5px); left: 0; width: min(340px, calc(100vw - 32px)); min-width: 100%; padding: 8px; border: 1px solid #cbd3da; border-radius: 6px; background: #fff; box-shadow: 0 12px 30px rgba(24,54,74,.18); }
.dashboard-party-search { position: relative; margin-bottom: 7px; }
.dashboard-party-search input { width: 100%; min-height: 36px; border: 1px solid #cbd3da; border-radius: 5px; padding: 7px 9px 7px 32px; }
.dashboard-party-search svg { position: absolute; left: 9px; top: 10px; width: 15px; height: 15px; color: #7a8791; }
.dashboard-party-options { max-height: 240px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-width: thin; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.dashboard-party-options::-webkit-scrollbar { width: 8px; }
.dashboard-party-options::-webkit-scrollbar-thumb { border-radius: 8px; background: #aebbc4; }
.dashboard-party-options::-webkit-scrollbar-track { background: #eef2f4; }
.dashboard-party-option { width: 100%; min-height: 36px; border: 0; border-radius: 4px; padding: 8px 9px; background: #fff; color: #23313c; text-align: left; line-height: 1.4; }
.dashboard-party-option:hover, .dashboard-party-option.selected { background: #e7f1f5; color: #175b7b; }
.dashboard-party-option[hidden] { display: none; }
.panel-body { padding: 16px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric { background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 18px; display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: center; }
.dashboard-metric { position: relative; width: 100%; color: inherit; text-align: left; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.dashboard-metric:hover { border-color: #9eb8c6; box-shadow: 0 5px 14px rgba(24,54,74,.09); transform: translateY(-1px); }
.dashboard-metric:focus-visible { outline: 2px solid rgba(36,107,142,.38); outline-offset: 2px; }
.dashboard-metric-arrow { position: absolute; right: 16px; width: 18px; height: 18px; color: #8b9aa4; }
.dashboard-metric:hover .dashboard-metric-arrow { color: var(--blue); }
.metric-icon { width: 42px; height: 42px; border-radius: 6px; display: grid; place-items: center; background: #e7f0f4; color: var(--blue); }
.metric-icon.warn { background: #fff2dc; color: var(--amber); }
.metric-icon.danger { background: #f8e6e5; color: var(--red); }
.metric-icon.good { background: #e3f1eb; color: var(--green); }
.metric strong { display: block; font-size: 25px; line-height: 1; margin-bottom: 6px; }
.metric span { font-size: 13px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); gap: 18px; }
.dashboard-summary-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.dashboard-summary-stack > .panel { min-width: 0; }
.work-tips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.work-tip { min-width: 0; padding: 8px 14px; border: 0; border-left: 1px solid var(--line); background: transparent; color: inherit; text-align: left; cursor: pointer; }
.work-tip:first-child { padding-left: 0; border-left: 0; }
.work-tip strong { display: block; margin-bottom: 6px; font-size: 22px; line-height: 1; }
.work-tip span { display: block; color: var(--muted); font-size: 12px; line-height: 1.45; }
.work-tip:hover { background: #f2f7f9; }
.work-tip.active { background: #e7f1f5; box-shadow: inset 0 -3px 0 var(--blue); }
.work-tip:focus-visible { outline: 2px solid rgba(36,107,142,.35); outline-offset: 2px; }
.table-wrap { overflow: auto; }
.dashboard-scroll { max-height: 300px; overflow: auto; }
.dashboard-scroll thead th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 #d8dee4; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
.product-names { min-width: 150px; max-width: 260px; white-space: normal; line-height: 1.45; }
.stacked-values { min-width: 120px; vertical-align: top; }
.stacked-values > div { min-height: 24px; padding: 3px 0; border-bottom: 1px dashed #dfe5e9; line-height: 18px; }
.stacked-values > div:last-child { border-bottom: 0; }
.order-table { min-width: 1240px; }
.order-table th { text-align: center; }
.order-table td { vertical-align: top; line-height: 1.45; }
.order-table .cell-order { min-width: 132px; white-space: nowrap; }
.order-table .cell-customer { min-width: 110px; }
.order-table .cell-project { min-width: 130px; }
.order-table .cell-supplier { min-width: 170px; }
.order-table .cell-center { min-width: 82px; text-align: center; vertical-align: middle; white-space: nowrap; }
.business-table { min-width: 820px; }
.business-table th { text-align: center; }
.business-table td { vertical-align: middle; }
.cell-center { text-align: center; white-space: nowrap; }
th { background: #f3f6f8; color: #4a5762; font-weight: 700; text-align: left; white-space: nowrap; }
th, td { padding: 11px 12px; border-bottom: 1px solid #e4e8ec; vertical-align: middle; }
tbody tr:hover { background: #f8fafb; }
.order-link { border: 0; background: transparent; padding: 0; color: #17658c; font-weight: 700; }
.status { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 9px; font-size: 12px; background: #eef1f4; color: #53616d; white-space: nowrap; }
.status.进行中 { background: #e6f0f5; color: #1f6686; }
.status.已完成 { background: #e1f0e9; color: #25674f; }
.status.逾期 { background: #f8e4e3; color: #a33b37; }
.status.待审核, .status.待采购, .status.待下单中 { background: #fff2dc; color: #8a5a13; }
.status.已审核, .status.已转采购, .status.已下采购 { background: #e1f0e9; color: #25674f; }
.status.已驳回 { background: #f8e4e3; color: #a33b37; }
.status.草稿 { background: #eef1f4; color: #53616d; }
.status.待确认, .status.待检验, .status.待出货 { background: #fff2dc; color: #8a5a13; }
.status.已确认, .status.已排产, .status.生产中, .status.生产完成 { background: #e6f0f5; color: #1f6686; }
.status.检验合格, .status.已出货 { background: #e1f0e9; color: #25674f; }
.status.检验异常 { background: #f8e4e3; color: #a33b37; }
.status.部分出货 { background: #fff2dc; color: #8a5a13; }
.status.已对账, .status.已开票, .status.已收款, .status.已收票, .status.已付款 { background: #e1f0e9; color: #25674f; }
.status.部分对账, .status.部分开票, .status.部分收款, .status.部分收票, .status.部分付款 { background: #fff2dc; color: #8a5a13; }
.order-overdue { background: #fff1f0; }
.order-overdue:hover { background: #ffe8e6; }
.overdue-deadline { color: #b42318; font-weight: 700; }
.overdue-flag { display: inline-flex; margin-left: 6px; border-radius: 999px; padding: 2px 7px; background: #b42318; color: #fff; font-size: 11px; font-weight: 700; white-space: nowrap; }
.muted { color: var(--muted); }
.empty { padding: 42px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 32px; height: 32px; margin-bottom: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-4 { grid-column: span 4; }
.supplier-field { padding-top: 2px; }
.section-title { margin: 26px 0 10px; font-size: 15px; display: flex; align-items: center; justify-content: space-between; }
.item-table input, .item-table textarea { min-width: 90px; width: 100%; border: 1px solid #ccd4da; border-radius: 4px; padding: 7px 8px; }
.item-table textarea { min-height: 72px; line-height: 1.5; overflow: hidden; resize: vertical; }
.item-table .wide { min-width: 180px; }
.item-table .xwide { min-width: 230px; }
.item-table th, .item-table td { padding: 7px; }
.contract-item-table { min-width: 1500px; }
.contract-design-cell { min-width: 112px; text-align: center; vertical-align: middle; }
.contract-design-cell:focus, .contract-design-cell.design-drop-target { outline: 2px solid #2d7fa3; outline-offset: -2px; background: #eef8fb; }
.contract-design-preview { width: 96px; min-height: 70px; margin: 0 auto 5px; border: 1px dashed #c7d1d8; background: #f7f9fa; display: grid; place-items: center; overflow: hidden; }
.contract-design-thumb { display: block; width: 92px; height: 68px; margin: 0 auto; object-fit: contain; background: #fff; }
.contract-design-empty { color: var(--muted); font-size: 12px; }
.contract-design-empty small { font-size: 10px; color: #7b8a93; }
.contract-design-actions { display: flex; justify-content: center; gap: 5px; }
.contract-design-actions .icon-btn { width: 30px; height: 30px; }
.contract-status-editor { display: flex; align-items: center; gap: 8px; max-width: 280px; }
.contract-status-editor select { min-width: 120px; }
.contract-status-editor .btn { white-space: nowrap; }
.summary-strip { display: flex; gap: 24px; padding: 13px 16px; background: #f5f8f9; border-top: 1px solid var(--line); justify-content: flex-end; font-size: 13px; }
.summary-strip strong { font-size: 16px; }
.form-actions { justify-content: flex-end; margin-top: 16px; }
.sales-contract-form > .panel { overflow: visible; box-shadow: 0 3px 14px rgba(24,54,74,.035); }
.sales-contract-form .panel-body { padding: 20px 22px 0; }
.sales-contract-form .form-grid { column-gap: 18px; row-gap: 2px; }
.sales-contract-form .field { margin-bottom: 16px; }
.sales-contract-form .field label { color: #304552; letter-spacing: .01em; }
.sales-contract-form .field input, .sales-contract-form .field select, .sales-contract-form .field textarea { min-height: 42px; border-color: #c7d3da; transition: border-color .15s ease, box-shadow .15s ease; }
.sales-contract-form .field textarea { line-height: 1.55; resize: vertical; }
.sales-contract-form .field input:hover, .sales-contract-form .field select:hover, .sales-contract-form .field textarea:hover { border-color: #9eb8c6; }
.sales-contract-form .section-title { margin: 24px -22px 0; padding: 13px 22px; border-top: 1px solid #e1e7ea; border-bottom: 1px solid #e1e7ea; background: #f7f9fa; }
.sales-contract-form .section-title strong { color: #244b5d; }
.sales-contract-form .table-wrap { margin: 0 -22px; border-bottom: 1px solid var(--line); }
.sales-contract-form .summary-strip { margin: 0 -22px; border-radius: 0 0 7px 7px; }
.sales-contract-form .form-actions { padding-right: 2px; }
.customer-create-form { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(320px, 2fr) auto; gap: 12px; align-items: end; }
.customer-create-form .field { margin-bottom: 0; }
.customer-list-panel { margin-top: 18px; }
.customer-table { min-width: 760px; }
.customer-table th:last-child { width: 72px; text-align: center; }
.customer-name-cell { width: 28%; vertical-align: top; }
.customer-address-list { display: grid; gap: 5px; }
.customer-address-row { display: grid; grid-template-columns: 1fr 36px; gap: 8px; align-items: center; min-height: 38px; border-bottom: 1px solid #edf0f2; }
.customer-address-row:last-child { border-bottom: 0; }
.dashboard-orders { margin-top: 18px; }
.related-orders { margin-top: 16px; }
.linked-purchase-table { min-width: 1120px; }
.linked-purchase-table .product-names { min-width: 220px; }
.linked-purchase-table .linked-contract-select { width: 42px; min-width: 42px; padding-left: 14px; padding-right: 6px; text-align: center; }
.linked-purchase-table .linked-contract-select input { width: 16px; height: 16px; margin: 0; accent-color: var(--green); }
.linked-contract-actions { align-items: center; }
.linked-contract-actions .muted { white-space: nowrap; }
.linked-purchase-total td { background: #edf4f7; border-top: 2px solid #9fb6c3; font-weight: 700; }
.linked-purchase-total td:first-child { text-align: right; color: #31566a; }
.linked-purchase-total td:nth-child(2) { color: #123f56; font-size: 15px; }
.request-item-table { min-width: 1080px; }
.auxiliary-mark { display: inline-flex; margin-left: 7px; padding: 2px 6px; border-radius: 999px; background: #e7f0f4; color: var(--blue); font-size: 11px; white-space: nowrap; vertical-align: middle; }
.compact-empty { padding: 22px 16px; }
.source-banner { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; padding: 10px 12px; border-left: 3px solid var(--blue); background: #edf4f7; color: #31566a; font-size: 13px; }
.source-banner svg { width: 17px; height: 17px; }
.document-flow { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; color: #8a959d; font-size: 13px; }
.document-flow svg { width: 16px; height: 16px; }
.flow-node { padding: 7px 10px; border-bottom: 2px solid #cbd3da; }
.flow-node.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 700; }
.review-panel { margin-top: 16px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.detail-head h3 { margin: 0 0 5px; font-size: 22px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.contract { background: #fff; border: 1px solid var(--line); padding: 28px; overflow: auto; }
.contract-title { text-align: center; font-size: 24px; font-weight: 700; margin-bottom: 24px; }
.contract-meta { display: grid; grid-template-columns: 110px 1fr 110px 1fr; border-top: 1px solid #aeb8bf; border-left: 1px solid #aeb8bf; margin-bottom: 18px; min-width: 720px; }
.contract-meta > div { padding: 9px 10px; border-right: 1px solid #aeb8bf; border-bottom: 1px solid #aeb8bf; }
.contract-meta .label { background: #eef1f3; font-weight: 700; }
.contract-preview-stage {
  padding: 22px;
  overflow: auto;
  position: relative;
  z-index: 0;
  scroll-margin-top: 96px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: #edf1ee;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}
body.purchase-contract-open { scroll-padding-top: 96px; }
.contract-sheet {
  box-sizing: border-box;
  width: 297mm;
  min-width: 297mm;
  min-height: 210mm;
  margin: 0 auto;
  padding: 10mm;
  overflow: visible;
  border: 1px solid #c8c8c8;
  border-radius: 0;
  background: #fff;
  color: #111;
  font-family: "SimSun", "Songti SC", "Microsoft YaHei", serif;
  font-size: 9pt;
  line-height: 1.4;
  box-shadow: 0 4px 16px rgba(20, 38, 31, .08);
}
.contract-page + .contract-page { margin-top: 22px; }
.contract-sheet .contract-title {
  margin: 0 0 4mm;
  color: #000;
  font-family: inherit;
  font-size: 16pt;
  line-height: 1.2;
  letter-spacing: 9px;
}
.contract-sheet .contract-title small { margin-left: 3mm; font-size: 9pt; font-weight: 400; letter-spacing: 0; }
.contract-parties {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, .48fr);
  gap: 28px;
  margin-bottom: 3mm;
  color: #000;
  font-size: 8.5pt;
  line-height: 1.4;
}
.contract-parties > div { min-width: 0; }
.contract-party-stack,
.contract-reference-block { display: grid; align-content: start; gap: 4px; }
.contract-party-stack strong,
.contract-reference-block strong,
.contract-reference-block span { display: block; overflow-wrap: anywhere; }
.contract-table-wrap { width: 100%; overflow: visible; }
.contract-products {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border: 1px solid #111;
  border-collapse: collapse;
  color: #000;
  font-family: inherit;
  font-size: 7.5pt;
  line-height: 1.3;
}
.contract-products .contract-col-index { width: 4%; }
.contract-products .contract-col-material { width: 10%; }
.contract-products .contract-col-product { width: 16%; }
.contract-products .contract-col-model { width: 10%; }
.contract-products .contract-col-process { width: 21%; }
.contract-products .contract-col-quantity { width: 6%; }
.contract-products .contract-col-price { width: 7%; }
.contract-products .contract-col-amount { width: 9%; }
.contract-products .contract-col-date { width: 7%; }
.contract-products .contract-col-notes { width: 10%; }
.contract-products th,
.contract-products td {
  height: 7.5mm;
  padding: 1mm;
  border: 1px solid #111;
  background: #fff;
  color: #000;
  vertical-align: middle;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.contract-products th { height: 6mm; text-align: center; font-weight: 700; }
.contract-products tbody tr:hover,
.contract-products tbody tr:hover td { background: #fff; }
.contract-product-row { break-inside: avoid; page-break-inside: avoid; }
.contract-product-row:not(.contract-empty-row) td { height: auto; min-height: 7.5mm; }
.contract-empty-row td { height: 7.5mm; }
.contract-cell-index,
.contract-cell-material,
.contract-cell-model,
.contract-cell-date { text-align: center; }
.contract-cell-product,
.contract-cell-process,
.contract-cell-notes { text-align: left; }
.contract-cell-material { font-variant-numeric: tabular-nums; }
.contract-cell-number,
.contract-cell-money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap !important; }
.contract-total { break-inside: avoid; page-break-inside: avoid; }
.contract-total td { height: 7mm; font-weight: 700; text-align: right; border: 1px solid #111 !important; }
.contract-terms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin-top: 3mm;
  color: #000;
  font-size: 8pt;
  line-height: 1.45;
  break-inside: avoid;
  page-break-inside: avoid;
}
.contract-term-column { min-width: 0; padding: 1mm 4mm 1.5mm 0; }
.inspection-terms { padding: 1mm 0 1.5mm 4mm; border-left: 1px solid #aaa; }
.contract-terms h4 { margin: 0 0 1.5mm; color: #000; font-size: 9pt; line-height: 1.35; }
.contract-terms p {
  margin: 1mm 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.inspection-heading { border-left: 1px solid #333; padding-left: 12px !important; }
.contract-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10mm;
  margin-top: 5mm;
  color: #000;
  font-size: 8pt;
  line-height: 1.55;
  background: #fff;
  break-inside: avoid;
  page-break-inside: avoid;
}
.contract-signature-column {
  min-width: 0;
  min-height: 52mm;
  display: flex;
  flex-direction: column;
  background: #fff;
}
.contract-signature-title {
  display: block;
  padding: 0 0 1.5mm;
  border-bottom: .5pt solid #d6d6d6;
  color: #000;
  font-size: 9pt;
  line-height: 1.35;
}
.contract-signature-details {
  display: grid;
  gap: 1.3mm;
  padding-top: 2mm;
}
.contract-signature-details span { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.contract-signature-space { min-height: 18mm; flex: 1 0 18mm; }

@media (max-width: 900px) {
  .contract-preview-stage { scroll-margin-top: 84px; }
  body.purchase-contract-open { scroll-padding-top: 84px; }
}

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  html,
  body:has(.contract-preview-stage) { background: #fff !important; }
  .app-shell:has(.contract-preview-stage) { display: block; min-height: 0; }
  .app-shell:has(.contract-preview-stage) .sidebar,
  .app-shell:has(.contract-preview-stage) .topbar,
  .app-shell:has(.contract-preview-stage) .detail-head,
  .app-shell:has(.contract-preview-stage) .document-flow,
  .app-shell:has(.contract-preview-stage) .tabs,
  body:has(.contract-preview-stage) .toast { display: none !important; }
  .app-shell:has(.contract-preview-stage) .workspace,
  .app-shell:has(.contract-preview-stage) .content { width: auto; max-width: none; margin: 0; padding: 0; background: #fff; }
  .contract-preview-stage { padding: 0; overflow: visible; border: 0; border-radius: 0; background: #fff; }
  .contract-sheet { width: 100%; min-width: 0; min-height: 0; margin: 0; padding: 0; overflow: visible; border: 0; box-shadow: none; font-size: 8.5pt; break-after: page; page-break-after: always; }
  .contract-sheet:last-child { break-after: auto; page-break-after: auto; }
  .contract-sheet .contract-title { margin-bottom: 4mm; font-size: 16pt; }
  .contract-parties { margin-bottom: 3mm; font-size: 8.5pt; }
  .contract-products { font-size: 7.5pt; }
  .contract-products thead { display: table-header-group; }
  .contract-products tr { break-inside: avoid; page-break-inside: avoid; }
  .contract-products th,
  .contract-products td { padding: 1mm; }
  .contract-terms { font-size: 8pt; }
  .contract-term-column { padding-right: 4mm; }
  .inspection-terms { padding-left: 4mm; }
  .contract-signatures { gap: 10mm; margin-top: 5mm; font-size: 8pt; }
  .contract-signature-column { min-height: 52mm; }
  .contract-signature-space { min-height: 18mm; flex-basis: 18mm; }
}
.delivery-note-table { min-width: 1050px; }
.delivery-note-table th { text-align: center; }
.delivery-note-table td { vertical-align: middle; }
.delivery-note-table input, .delivery-note-table textarea { width: 100%; min-width: 120px; border: 1px solid #cbd3da; border-radius: 4px; padding: 8px; }
.delivery-note-table textarea { min-width: 260px; resize: vertical; }
.material-labels-table { min-width: 820px; }
.material-labels-table th { text-align: center; }
.material-labels-table td { vertical-align: middle; }
.material-labels-table input { width: 100%; min-width: 130px; border: 1px solid #cbd3da; border-radius: 4px; padding: 8px; }
.document-preview-section { margin-top: 18px; }
.document-preview-section > h3 { margin: 0 0 10px; font-size: 15px; }
.document-preview-wrap { padding: 24px; border: 1px solid var(--line); background: #eef2f4; overflow: auto; }
.preview-error { padding: 28px; background: #fff; color: #8a5a13; text-align: center; }
.delivery-note-preview-pages { display: grid; gap: 18px; min-width: 297mm; }
.delivery-note-sheet {
  box-sizing: border-box;
  width: 297mm;
  min-height: 210mm;
  margin: 0 auto;
  padding: 12mm 14mm;
  background: #fff;
  color: #111;
  box-shadow: 0 2px 10px rgba(22,48,64,.1);
  font-family: "SimSun", "Microsoft YaHei", serif;
  font-size: 9pt;
}
.delivery-note-heading { text-align: center; }
.delivery-note-company { font-family: "Microsoft YaHei", "SimSun", sans-serif; font-size: 17pt; font-weight: 700; line-height: 1.15; }
.delivery-note-company-detail { margin-top: 2mm; font-size: 9pt; line-height: 1.25; }
.document-preview-title { margin: 3mm 0 5mm; text-align: center; font-family: "Microsoft YaHei", "SimSun", sans-serif; font-size: 17pt; font-weight: 700; letter-spacing: 6px; line-height: 1.15; }
.delivery-note-meta { display: grid; gap: 2mm; margin-bottom: 3mm; font-size: 9pt; line-height: 1.35; }
.delivery-note-meta-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10mm; align-items: start; }
.delivery-note-meta-line span:last-child { white-space: nowrap; text-align: right; }
.delivery-note-address { overflow-wrap: anywhere; word-break: break-word; }
.document-preview-table { width: 100%; min-width: 820px; border-collapse: collapse; font-family: "SimSun", "Microsoft YaHei", serif; }
.delivery-note-document-table { min-width: 0; table-layout: fixed; border: .75pt solid #666; font-size: 9pt; line-height: 1.25; }
.delivery-note-document-table th,
.delivery-note-document-table td {
  height: 10mm;
  padding: 1mm 1.3mm;
  border: .75pt solid #666;
  background: #fff;
  color: #111;
  vertical-align: middle;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.delivery-note-document-table th { height: 9mm; background: #f2f2f2; font-weight: 700; }
.delivery-note-document-table tr { break-inside: avoid; page-break-inside: avoid; }
.delivery-note-document-table .delivery-note-text-cell { text-align: left; }
.delivery-note-document-table .delivery-note-number-cell { font-variant-numeric: tabular-nums; }
.delivery-note-empty-row td { height: 10mm; }
.delivery-note-signatures {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6mm;
  min-height: 9mm;
  margin-top: 5mm;
  align-items: center;
  font-size: 9pt;
  line-height: 1.35;
  break-inside: avoid;
  page-break-inside: avoid;
}
.delivery-note-signatures span { white-space: nowrap; }
@media print {
  html,
  body:has(.delivery-note-preview-pages) { background: #fff !important; }
  .app-shell:has(.delivery-note-preview-pages) { display: block; min-height: 0; }
  .app-shell:has(.delivery-note-preview-pages) .sidebar,
  .app-shell:has(.delivery-note-preview-pages) .topbar,
  .app-shell:has(.delivery-note-preview-pages) .detail-head,
  .app-shell:has(.delivery-note-preview-pages) .document-flow,
  .app-shell:has(.delivery-note-preview-pages) .tabs,
  #delivery-note-form > .panel,
  #delivery-note-form > .document-preview-section > h3,
  body:has(.delivery-note-preview-pages) .toast { display: none !important; }
  .app-shell:has(.delivery-note-preview-pages) .workspace,
  .app-shell:has(.delivery-note-preview-pages) .content,
  #delivery-note-form,
  #delivery-note-form > .document-preview-section { width: auto; max-width: none; margin: 0; padding: 0; background: #fff; }
  .document-preview-wrap { padding: 0; overflow: visible; border: 0; background: #fff; }
  .delivery-note-preview-pages { display: block; min-width: 0; }
  .delivery-note-sheet {
    width: 277mm;
    min-height: 190mm;
    margin: 0;
    padding: 2mm 4mm;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }
  .delivery-note-sheet:last-child { break-after: auto; page-break-after: auto; }
  .delivery-note-document-table { font-size: 9pt; }
  .delivery-note-document-table thead { display: table-header-group; }
  .delivery-note-document-table tr { break-inside: avoid; page-break-inside: avoid; }
}
.material-label-preview-grid { display: grid; grid-template-columns: repeat(2, minmax(420px, 1fr)); gap: 18px; }
.material-label-preview { background: #fff; border: 1px solid #111; color: #111; font-family: "SimSun", serif; }
.material-label-title { padding: 10px; border-bottom: 1px solid #111; text-align: center; font-size: 24px; font-weight: 700; }
.material-label-row, .material-label-split > div { display: grid; grid-template-columns: 105px 1fr; min-height: 48px; border-bottom: 1px solid #111; }
.material-label-row > span, .material-label-row > strong, .material-label-split span, .material-label-split strong { display: flex; align-items: center; justify-content: center; padding: 7px 9px; text-align: center; overflow-wrap: anywhere; }
.material-label-row > span, .material-label-split span { border-right: 1px solid #111; font-weight: 400; }
.material-label-row > strong, .material-label-split strong { font-weight: 700; }
.material-label-split { display: grid; grid-template-columns: 1fr 1fr; }
.material-label-split > div:first-child { border-right: 1px solid #111; }
.material-label-preview > :last-child { border-bottom: 0; }
@media (max-width: 1050px) {
  .material-label-preview-grid { grid-template-columns: 1fr; }
}
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; color: #65727c; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 700; }
.delivery-form { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1.5fr auto auto; gap: 10px; align-items: end; }
.workflow-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.workflow-step { position: relative; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--blue); border-radius: 6px; padding: 18px 14px 14px; display: grid; grid-template-columns: 24px 1fr; gap: 8px; align-items: center; }
.workflow-step svg { width: 20px; height: 20px; color: var(--blue); }
.workflow-step strong { font-size: 14px; }
.workflow-step select { grid-column: 1 / -1; width: 100%; border: 1px solid #cbd3da; border-radius: 5px; padding: 8px; background: #fff; }
.step-number { position: absolute; right: 10px; top: 8px; color: #9aa5ad; font-size: 12px; font-weight: 700; }
.workflow-info { margin-top: 16px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; background: #20313d; color: #fff; border-radius: 6px; padding: 12px 16px; box-shadow: 0 10px 28px rgba(0,0,0,.2); max-width: 360px; }
.toast.error { background: #9d3d39; }
.finance-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.finance-order-export-panel { margin-bottom: 18px; }
.finance-order-export-panel .finance-filter-actions { flex: 1; justify-content: flex-end; min-width: 0; }
.finance-order-export-search { width: min(280px, 100%); }
.finance-tabs { margin-top: 2px; }
.finance-list-header { align-items: center; }
.finance-table { min-width: 1540px; }
.finance-sales-table { min-width: 1260px; }
.finance-record-table { min-width: 900px; }
.finance-record-table .finance-record-summary { max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finance-record-panel .table-wrap { max-height: 560px; overflow: auto; }
.finance-record-panel .finance-record-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-muted, #f3f6f8); }
.finance-record-panel { margin-top: 18px; }
.finance-filter-actions select { min-height: 38px; max-width: 260px; border: 1px solid #cbd3da; border-radius: 5px; padding: 8px 30px 8px 10px; background: #fff; }
.finance-selection-tools { min-height: 52px; padding: 8px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #f8fafb; }
.finance-selection-tools select { min-height: 36px; min-width: 180px; border: 1px solid #cbd3da; border-radius: 5px; padding: 7px 30px 7px 10px; background: #fff; }
.finance-selection-tools .btn { min-height: 34px; padding: 6px 10px; }
.finance-selection-tools > #finance-selected-count { color: var(--muted); font-size: 13px; white-space: nowrap; }
.finance-table-date-range { margin-left: auto; }
.finance-check-cell { width: 42px; min-width: 42px; text-align: center; }
.finance-check-cell input { width: 16px; height: 16px; accent-color: var(--blue); }
.finance-product-cell { min-width: 220px; max-width: 320px; white-space: normal; }
.finance-product-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 7px; align-items: center; padding: 5px 0; border-bottom: 1px dashed #dfe5e9; line-height: 1.45; cursor: pointer; }
.finance-product-row:last-child { border-bottom: 0; }
.finance-product-row input { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); }
.finance-product-row input:disabled { cursor: not-allowed; }
.finance-product-heading { display: flex; align-items: center; gap: 8px; }
.finance-product-heading input { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); }
.money-cell { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.number-cell { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.finance-statuses { display: grid; gap: 5px; justify-items: start; }
.finance-actions { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.finance-actions .btn { min-height: 32px; padding: 6px 9px; font-size: 12px; }
.finance-state-btn {
  min-width: 82px;
  min-height: 32px;
  padding: 6px 9px;
  border: 0;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 12px;
  cursor: pointer;
}
.finance-state-btn svg { width: 15px; height: 15px; }
.finance-state-btn.pending { color: #53616d; background: #eef1f4; }
.finance-state-btn.partial { color: #8a5a13; background: #fff2dc; }
.finance-state-btn.complete { color: #25674f; background: #e1f0e9; }
.finance-state-btn:not(:disabled):hover { box-shadow: inset 0 0 0 1px currentColor; filter: brightness(.97); }
.finance-state-btn:disabled { cursor: default; opacity: .75; }
.icon-btn.danger { color: var(--red); border-color: #e2c4c2; }
.finance-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; border: 0; border-radius: 8px; padding: 0; color: #17212b; box-shadow: 0 24px 70px rgba(18, 34, 45, .28); }
.one-click-dialog { width: min(980px, calc(100vw - 32px)); }
.one-click-note { margin: 0 0 14px; line-height: 1.6; }
.one-click-table { min-width: 760px; }
.one-click-table th, .one-click-table td { vertical-align: middle; }
.one-click-table td:first-child { width: 42px; text-align: center; }
.one-click-table input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--green); }
.one-click-table select, .one-click-table input[type="number"] { width: 100%; min-width: 130px; min-height: 36px; border: 1px solid #cbd3da; border-radius: 5px; padding: 7px 9px; background: #fff; color: #17212b; }
.finance-dialog::backdrop { background: rgba(25, 39, 49, .48); }
.finance-dialog-head { min-height: 58px; padding: 12px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.finance-dialog-head h3 { margin: 0; font-size: 17px; }
.finance-dialog-body { padding: 18px; }
.finance-dialog [hidden] { display: none !important; }
.finance-order-summary { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 11px 13px; margin-bottom: 18px; border-left: 3px solid var(--blue); background: #edf4f7; font-size: 13px; }
.finance-batch-summary { display: grid; gap: 14px; margin-bottom: 18px; padding: 14px; border-left: 3px solid var(--green); background: #edf6f2; }
.finance-batch-summary > div:first-child { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.finance-batch-products { display: flex; flex-wrap: wrap; gap: 6px; }
.finance-batch-products span { padding: 4px 8px; border: 1px solid #cddfd7; border-radius: 4px; background: #fff; font-size: 12px; }
.finance-confirm-note { margin: 0; color: #31566a; font-size: 13px; }
.finance-dialog-actions { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.user-management { grid-template-columns: minmax(0, 2fr) minmax(300px, .75fr); }
.user-table { min-width: 830px; }
.user-panel-note { margin-top: 4px; font-size: 12px; font-weight: 400; }
.user-actions { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.user-actions .icon-btn { width: 33px; height: 33px; }
.current-user-mark { display: inline-flex; margin-left: 7px; padding: 2px 6px; border-radius: 999px; background: #e6f0f5; color: #1f6686; font-size: 11px; font-weight: 400; white-space: nowrap; }
.role-help { display: grid; gap: 5px; margin: 14px 0 16px; padding: 12px; border-left: 3px solid var(--blue); background: #f3f7f9; color: var(--muted); font-size: 12px; line-height: 1.45; }
.role-help strong { color: #2b3944; }
.user-edit-dialog { width: min(680px, calc(100vw - 32px)); }
@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .finance-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work-tips { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; }
  .work-tip:nth-child(3) { padding-left: 0; border-left: 0; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid .span-4 { grid-column: span 2; }
}
@media (max-width: 720px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; height: auto; position: static; padding: 12px; }
  .sidebar .brand-lockup { margin-bottom: 10px; }
  .nav { grid-template-columns: repeat(6, 1fr); }
  .nav button { justify-content: center; padding: 9px 6px; }
  .nav button span { display: none; }
  .sidebar-footer { display: none; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 14px 36px; }
  .metric-grid { grid-template-columns: 1fr; }
  .work-tips { grid-template-columns: 1fr; }
  .work-tip { padding-left: 0; border-left: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2, .form-grid .span-4 { grid-column: span 1; }
  .delivery-form { grid-template-columns: 1fr; }
  .workflow-grid { grid-template-columns: 1fr; }
  .detail-head { flex-direction: column; }
  .customer-create-form { grid-template-columns: 1fr; }
  .dashboard-list-header { align-items: stretch; flex-direction: column; }
  .dashboard-list-tools { align-items: stretch; flex-direction: column; }
  .dashboard-search { width: 100%; }
  .dashboard-party-picker { width: 100%; flex-basis: auto; }
  .dashboard-party-menu { width: 100%; }
  .finance-metrics { grid-template-columns: 1fr; }
  .finance-list-header { align-items: stretch; flex-direction: column; }
  .finance-list-header .panel-actions { width: 100%; }
  .finance-list-header .search { width: 100%; }
  .export-date-range { width: 100%; justify-content: space-between; }
  .export-date-range label { flex: 1; }
  .export-date-range input { width: 100%; min-width: 0; }
}

/* Integrated document stamping workspace */
.content.seal-content{padding:0;overflow:hidden}.seal-embed{width:100%;height:calc(100dvh - 82px);min-height:640px}.seal-embed iframe{display:block;border:0;width:100%;height:100%;background:#f8fafb}@media(max-width:780px){.seal-embed{height:calc(100dvh - 140px);min-height:660px}}

/* Customer profile management */
.customer-page-head{display:flex;align-items:center;justify-content:space-between;gap:18px;margin-bottom:14px}.customer-page-head h3{margin:0 0 4px;font-size:20px}.customer-list-panel{margin-top:0}.customer-list-header{min-height:62px}.customer-list-header .search{width:min(360px,100%)}.customer-profile-table{min-width:1000px}.customer-profile-table th:last-child{width:210px;text-align:center}.customer-row-actions{display:flex;align-items:center;justify-content:center;gap:6px;white-space:nowrap}.customer-row-actions .btn{padding:7px 11px}.customer-dialog{width:min(760px,calc(100vw - 32px))}.customer-profile-form textarea{resize:vertical}.customer-list-footer{display:flex;justify-content:space-between;gap:16px;padding:12px 16px;border-top:1px solid var(--line);color:var(--muted);font-size:12px}.customer-view-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 24px}.customer-view-grid>div{display:grid;gap:5px;min-width:0}.customer-view-grid .span-2{grid-column:span 2}.customer-view-grid label{color:var(--muted);font-size:12px}.customer-view-grid span,.customer-view-grid strong{overflow-wrap:anywhere}.customer-view-addresses{display:grid;gap:6px}.customer-view-address{padding:9px 11px;border-left:3px solid #91b7c8;background:#f3f7f9;line-height:1.5}
@media(max-width:720px){.customer-page-head{align-items:flex-start}.customer-list-header{align-items:stretch;flex-direction:column}.customer-list-header .search{width:100%}.customer-list-footer{flex-direction:column}.customer-view-grid{grid-template-columns:1fr}.customer-view-grid .span-2{grid-column:span 1}}

/* Mobile workspace */
@media (max-width: 720px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  body { background: #eef1f4; }
  .app-shell { width: 100%; }
  .sidebar { width: 100%; padding: 10px 10px 8px; overflow: hidden; }
  .sidebar .brand-lockup { padding: 0 4px; margin-bottom: 8px; }
  .sidebar .brand-mark { width: 40px; height: 40px; }
  .sidebar .brand-lockup h1 { font-size: 15px; }
  .sidebar .brand-lockup p { font-size: 12px; }
  .nav {
    display: flex;
    gap: 4px;
    width: 100%;
    padding-bottom: 2px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .nav::-webkit-scrollbar, .tabs::-webkit-scrollbar, .topbar-actions::-webkit-scrollbar { display: none; }
  .nav button {
    flex: 0 0 68px;
    width: 68px;
    min-height: 54px;
    padding: 7px 3px 6px;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    text-align: center;
  }
  .nav button span { display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
  .nav button svg { width: 18px; height: 18px; }
  .workspace { width: 100%; }
  .topbar {
    height: auto;
    min-height: 58px;
    padding: 10px 12px;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 9px;
  }
  .topbar h2 { flex: 1 1 100%; min-width: 0; font-size: 18px; line-height: 1.35; overflow-wrap: anywhere; }
  .topbar-actions {
    width: 100%;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .topbar-actions > .panel-actions { flex: 0 0 auto; flex-wrap: nowrap; }
  .topbar-actions .btn { flex: 0 0 auto; min-height: 42px; white-space: nowrap; }
  .topbar-actions > .icon-btn { flex: 0 0 42px; width: 42px; height: 42px; margin-left: auto; }
  .content { width: 100%; padding: 12px 10px max(32px, env(safe-area-inset-bottom)); }
  .btn { min-height: 42px; }
  .icon-btn { width: 42px; height: 42px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
  .metric { min-height: 92px; padding: 13px 12px; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; }
  .metric-icon { width: 38px; height: 38px; }
  .metric strong { font-size: 22px; }
  .dashboard-metric-arrow { display: none; }
  .dashboard-summary-stack { gap: 12px; }
  .dashboard-orders { margin-top: 12px; }
  .panel-header { min-height: 48px; padding: 11px 12px; align-items: flex-start; flex-wrap: wrap; }
  .panel-header > .panel-actions { width: 100%; }
  .panel-header > .panel-actions .btn { flex: 1 1 140px; }
  .panel-body { padding: 12px; }
  .dashboard-scroll { max-height: 420px; }
  .table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    touch-action: pan-x pan-y;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
  }
  th, td { padding: 10px; }
  .toolbar { align-items: stretch; gap: 8px; }
  .toolbar .spacer { display: none; }
  .toolbar > .search, .toolbar > select, .toolbar > .export-date-range { flex: 1 1 100%; width: 100%; max-width: none; }
  .toolbar > .btn { flex: 1 1 145px; }
  .export-date-range { min-height: 46px; overflow-x: auto; }
  .section-title { align-items: flex-start; flex-wrap: wrap; gap: 8px; }
  .section-title .btn { width: 100%; }
  .detail-head { gap: 12px; }
  .detail-head h3 { font-size: 20px; overflow-wrap: anywhere; }
  .detail-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .detail-actions .btn { width: 100%; min-width: 0; padding-inline: 8px; }
  .document-flow, .tabs {
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .tabs button { flex: 0 0 auto; min-height: 44px; padding: 10px 12px; }
  .summary-strip { gap: 10px 18px; flex-wrap: wrap; }
  .form-actions { width: 100%; }
  .form-actions .btn { flex: 1 1 130px; }
  .customer-page-head { gap: 10px; }
  .customer-page-head .btn { flex: 0 0 auto; }
  .customer-list-footer { gap: 6px; padding: 10px 12px; }
  .finance-selection-tools { align-items: stretch; }
  .finance-selection-tools select, .finance-selection-tools .export-date-range { flex: 1 1 100%; min-width: 0; }
  .finance-selection-tools .btn { flex: 1 1 130px; }
  .finance-table-date-range { margin-left: 0; }
  .finance-dialog, .user-edit-dialog, .customer-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .finance-dialog-head { min-height: 52px; padding: 10px 12px; }
  .finance-dialog-body { padding: 12px; }
  .finance-dialog-actions { padding: 10px 12px; }
  .finance-dialog-actions .btn { flex: 1 1 120px; }
  .contract { padding: 16px 12px; }
  .contract-title { margin-bottom: 18px; font-size: 21px; }
  .document-preview-wrap { padding: 10px; }
  .source-banner { align-items: flex-start; }
  .toast { left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); max-width: none; text-align: center; }
}

@media (max-width: 380px) {
  .metric-grid { grid-template-columns: 1fr; }
  .metric { min-height: 84px; }
  .detail-actions { grid-template-columns: 1fr; }
}

/* Compact mobile dashboard */
@media (max-width: 720px) {
  .dashboard-summary-stack .panel-body { padding: 8px; }
  .metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
  .metric {
    min-height: 74px;
    padding: 8px 7px;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 5px;
  }
  .metric-icon { width: 26px; height: 26px; }
  .metric-icon svg { width: 15px; height: 15px; }
  .metric strong { margin-bottom: 4px; font-size: 18px; }
  .metric span { display: block; font-size: 11px; line-height: 1.25; }
  .work-tips { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
  .work-tip, .work-tip:nth-child(3) { min-height: 76px; padding: 9px 6px; border-left: 1px solid var(--line); text-align: center; }
  .work-tip:first-child { border-left: 0; }
  .work-tip strong { margin-bottom: 7px; font-size: 19px; }
  .work-tip span { font-size: 10px; line-height: 1.35; }
  #dashboard-sales-results .business-table th:nth-child(3),
  #dashboard-sales-results .business-table td:nth-child(3) { min-width: 155px; width: 155px; white-space: normal; line-height: 1.45; }
}

@media (max-width: 360px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 70px; }
}
.customer-dialog{overflow:hidden}.customer-dialog[open]{display:flex;flex-direction:column}.customer-dialog .finance-dialog-body{overflow:auto}.customer-dialog .finance-dialog-head,.customer-dialog .finance-dialog-actions{flex:0 0 auto;background:#fff}
.customer-dialog>form{display:flex;min-height:0;max-height:calc(100dvh - 32px);flex-direction:column}.customer-dialog>form .finance-dialog-body{min-height:0;overflow:auto}

/* ZiPACK enterprise theme */
:root {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  color: #263c34;
  background: #f7f9f7;
  --brand-primary: #153f35;
  --brand-primary-hover: #205747;
  --brand-accent: #31745b;
  --brand-primary-soft: #edf3ef;
  --sidebar-bg: #153f35;
  --sidebar-active: #31745b;
  --page-bg: #f7f9f7;
  --card-bg: #fff;
  --text-primary: #263c34;
  --text-secondary: #708178;
  --border-color: #dce6df;
  --status-success: #268663;
  --status-warning: #d69a36;
  --status-danger: #d85c53;
  --navy: var(--brand-primary);
  --blue: var(--brand-accent);
  --green: var(--status-success);
  --red: var(--status-danger);
  --amber: var(--status-warning);
  --line: var(--border-color);
  --muted: var(--text-secondary);
  --panel: var(--card-bg);
}
body { background: var(--page-bg); color: var(--text-primary); font-size: 14px; }
button, input, select, textarea { color: var(--text-primary); }
button, .btn, .icon-btn, input, select, textarea { transition: border-color .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease; }
:focus-visible { outline: 3px solid rgba(49,116,91,.24); outline-offset: 2px; }
.app-shell { grid-template-columns: 236px minmax(0, 1fr); background: var(--page-bg); }
.sidebar { padding: 22px 14px 18px; background: var(--sidebar-bg); box-shadow: 8px 0 28px rgba(21,63,53,.08); }
.sidebar .brand-lockup { min-height: 52px; padding: 0 8px; margin-bottom: 22px; gap: 11px; }
.sidebar .brand-mark { width: 42px; height: 42px; border-radius: 8px; background: #fff; color: var(--brand-primary); box-shadow: 0 5px 14px rgba(0,0,0,.12); }
.sidebar .brand-lockup h1 { font-size: 16px; font-weight: 700; letter-spacing: 0; }
.sidebar .brand-lockup p { color: #b9cec4; }
.nav { gap: 5px; }
.nav button { min-height: 44px; padding: 10px 12px; border-radius: 8px; color: #d7e6df; font-size: 14px; }
.nav button svg { width: 19px; height: 19px; color: #a9c6b9; }
.nav button:hover { background: rgba(237,243,239,.1); color: #fff; }
.nav button.active { background: var(--sidebar-active); color: #fff; box-shadow: 0 6px 14px rgba(8,35,28,.2); }
.nav button.active svg, .nav button:hover svg { color: #fff; }
.sidebar-footer { margin-top: auto; padding: 18px 10px 2px; border-top-color: rgba(255,255,255,.14); color: #d7e6df; }
.sidebar-footer strong { font-size: 14px; }
.sidebar-footer span { color: #9fbbae; }
.workspace { background: var(--page-bg); }
.topbar { height: 82px; padding: 0 28px; border-bottom-color: var(--border-color); background: rgba(255,255,255,.96); box-shadow: 0 1px 0 rgba(21,63,53,.02); }
.topbar-title { display: grid; gap: 4px; min-width: 0; }
.topbar h2 { color: #17382f; font-size: 24px; font-weight: 700; line-height: 1.2; }
.topbar-title p { margin: 0; color: var(--text-secondary); font-size: 13px; }
.topbar-actions { gap: 10px; }
.content { max-width: 1800px; padding: 24px 28px 48px; }
.btn { min-height: 40px; padding: 9px 15px; border-radius: 8px; font-weight: 600; }
.btn.primary, .btn.success { background: var(--brand-primary); color: #fff; }
.btn.primary:hover, .btn.success:hover { background: var(--brand-primary-hover); box-shadow: 0 5px 12px rgba(21,63,53,.16); }
.btn.secondary { border-color: #cbdad2; color: var(--brand-primary); }
.btn.secondary:hover { border-color: #8fb4a3; background: var(--brand-primary-soft); }
.icon-btn { width: 40px; height: 40px; border-color: #cbdad2; border-radius: 8px; color: var(--brand-primary); }
.icon-btn:hover { border-color: #8fb4a3; background: var(--brand-primary-soft); }
.field input, .field select, .field textarea, .search input, .dashboard-party-trigger, .dashboard-party-search input { border-color: #cbdad2; border-radius: 8px; }
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus, .dashboard-party-search input:focus { outline: 3px solid rgba(49,116,91,.12); border-color: var(--brand-accent); }
.search svg { color: #81968c; }
.panel { border-color: var(--border-color); border-radius: 12px; background: var(--card-bg); box-shadow: 0 5px 18px rgba(29,69,55,.045); overflow: hidden; }
.panel-header { min-height: 58px; padding: 12px 16px; border-bottom-color: var(--border-color); }
.panel-header h3 { display: flex; align-items: center; gap: 9px; color: #1e3d34; font-size: 16px; font-weight: 700; }
.section-icon { width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 7px; background: var(--brand-primary-soft); color: var(--brand-accent); }
.section-icon svg { width: 16px; height: 16px; }
.metric-grid { gap: 18px; margin-bottom: 20px; }
.metric { min-height: 104px; padding: 20px 22px; border-color: var(--border-color); border-radius: 12px; grid-template-columns: 48px minmax(0, 1fr); gap: 16px; box-shadow: 0 5px 18px rgba(29,69,55,.045); }
.dashboard-metric:hover { border-color: #a8c5b7; box-shadow: 0 10px 24px rgba(29,69,55,.09); transform: translateY(-2px); }
.dashboard-metric:focus-visible { outline-color: rgba(49,116,91,.38); }
.metric-icon { width: 48px; height: 48px; border-radius: 10px; background: #eaf3ee; color: #287258; }
.metric-icon svg { width: 23px; height: 23px; }
.metric-grid .dashboard-metric:nth-child(2) .metric-icon { background: #fff4df; color: #c98317; }
.metric-grid .dashboard-metric:nth-child(3) .metric-icon { background: #e7f4ed; color: #268663; }
.metric-grid .dashboard-metric:nth-child(4) .metric-icon { background: #f0edfa; color: #7562b9; }
.metric strong { margin-bottom: 7px; color: #17382f; font-size: 30px; font-weight: 700; }
.metric span { color: var(--text-secondary); font-size: 14px; }
.dashboard-metric-arrow { right: 18px; color: #8ea59a; }
.dashboard-metric:hover .dashboard-metric-arrow { color: var(--brand-accent); }
.dashboard-summary-stack { gap: 20px; }
.dashboard-orders { margin-top: 20px; }
.dashboard-list-header { gap: 18px; }
.dashboard-list-tools { gap: 10px; }
.dashboard-party-picker { flex-basis: 230px; width: min(230px,100%); }
.dashboard-party-trigger { min-height: 40px; }
.dashboard-party-menu { border-color: var(--border-color); border-radius: 10px; box-shadow: 0 14px 32px rgba(21,63,53,.14); }
.dashboard-party-option:hover, .dashboard-party-option.selected { background: var(--brand-primary-soft); color: var(--brand-primary); }
.dashboard-search { width: min(390px,100%); }
.dashboard-scroll { max-height: 314px; }
table { color: #30463e; font-size: 13px; }
th { height: 44px; padding: 10px 12px; background: #f0f5f2; color: #52685e; font-size: 13px; }
td { height: 46px; padding: 10px 12px; border-bottom-color: #e7eee9; }
tbody tr:hover { background: #f5f9f6; }
.dashboard-scroll thead th { box-shadow: inset 0 -1px 0 var(--border-color); }
.order-link { color: #1f7154; }
.order-link:hover { color: #104d3a; text-decoration: underline; text-underline-offset: 3px; }
.cell-money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell-center { font-variant-numeric: tabular-nums; }
.table-truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { padding: 4px 10px; font-weight: 600; }
.status.进行中, .status.已确认, .status.已排产, .status.生产中, .status.生产完成 { background: #e9f0f7; color: #3d6692; }
.status.已完成, .status.已审核, .status.已转采购, .status.已下采购, .status.检验合格, .status.已出货, .status.已对账, .status.已开票, .status.已收款, .status.已收票, .status.已付款 { background: #e6f4ed; color: #247455; }
.status.待审核, .status.待采购, .status.待下单中, .status.待确认, .status.待检验, .status.待出货, .status.部分出货, .status.部分对账, .status.部分开票, .status.部分收款, .status.部分收票, .status.部分付款 { background: #fff3df; color: #9a6415; }
.status.逾期, .status.已驳回, .status.检验异常 { background: #fae9e7; color: #aa413a; }
.work-panel .panel-body { padding: 0 16px; }
.work-tips { min-height: 112px; align-items: stretch; }
.work-tip { display: grid; grid-template-columns: 42px minmax(0,1fr); align-items: center; gap: 13px; padding: 18px 20px; border-left-color: var(--border-color); }
.work-tip:first-child { padding-left: 4px; }
.work-tip:hover { background: #f5f9f6; }
.work-tip.active { background: var(--brand-primary-soft); box-shadow: inset 0 -3px 0 var(--brand-accent); }
.work-tip .work-tip-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: #e9f3ee; color: #2c7a5e; }
.work-tip-icon svg { width: 20px; height: 20px; }
.work-tip.production .work-tip-icon { background: #e6f4ed; color: #27835f; }
.work-tip.inspection .work-tip-icon { background: #f0edfa; color: #7562b9; }
.work-tip.shipment .work-tip-icon { background: #fff3df; color: #c17d18; }
.work-tip strong { margin-bottom: 7px; color: #17382f; font-size: 26px; }
.work-tip > div > span { color: var(--text-secondary); font-size: 13px; }
.delivery-progress { min-width: 104px; display: grid; gap: 6px; text-align: left; }
.delivery-progress span { color: #53685f; font-size: 12px; font-variant-numeric: tabular-nums; }
.delivery-progress i { display: block; width: 100%; height: 5px; overflow: hidden; border-radius: 999px; background: #e5ece8; }
.delivery-progress b { display: block; height: 100%; border-radius: inherit; background: var(--brand-accent); }
.order-overdue { background: #fff5f4; }
.order-overdue:hover { background: #fcede9; }
.overdue-flag { background: var(--status-danger); }

@media (max-width: 1200px) {
  .dashboard-list-header { align-items: stretch; flex-direction: column; }
  .dashboard-list-tools { justify-content: flex-start; }
}
@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 720px) {
  body { background: var(--page-bg); }
  .sidebar { padding: 11px 10px 9px; box-shadow: none; }
  .nav button { border-radius: 7px; }
  .topbar { min-height: 76px; padding: 12px; }
  .topbar-title { flex: 1 1 100%; }
  .topbar h2 { font-size: 21px; }
  .topbar-title p { font-size: 12px; line-height: 1.45; }
  .content { padding: 14px 10px max(32px,env(safe-area-inset-bottom)); }
  .metric-grid { grid-template-columns: 1fr; gap: 10px; }
  .metric { min-height: 88px; padding: 15px; grid-template-columns: 42px minmax(0,1fr); gap: 12px; }
  .metric-icon { width: 42px; height: 42px; }
  .metric strong { font-size: 25px; }
  .dashboard-list-tools { flex-direction: column; }
  .dashboard-party-picker, .dashboard-search { width: 100%; max-width: none; flex-basis: auto; }
  .panel { border-radius: 10px; }
  .work-panel .panel-body { padding: 0 12px; }
  .work-tips { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .work-tip, .work-tip:nth-child(3) { min-height: 88px; padding: 12px 8px; grid-template-columns: 32px minmax(0,1fr); gap: 8px; border-left: 0; border-top: 1px solid var(--border-color); text-align: left; }
  .work-tip:nth-child(-n+2) { border-top: 0; }
  .work-tip .work-tip-icon { width: 32px; height: 32px; }
  .work-tip-icon svg { width: 17px; height: 17px; }
  .work-tip strong { margin-bottom: 5px; font-size: 21px; }
  .work-tip > div > span { font-size: 11px; }
}

/* ZiPACK dashboard refinement */
@media (min-width: 721px) {
  .topbar { height: 74px; padding-inline: 26px; }
  .content { padding: 18px 26px 40px; }
  .metric-grid { gap: 16px; margin-bottom: 16px; }
  .metric { min-height: 94px; padding: 17px 20px; }
  .dashboard-summary-stack { gap: 16px; }
  .dashboard-orders { margin-top: 16px; }
}

.topbar-actions .btn { min-height: 38px; }
.nav button { gap: 11px; }
.dashboard-panel .panel-header { min-height: 54px; }
.dashboard-list-header { padding-block: 9px; }
.dashboard-list-tools .btn,
.dashboard-list-tools .dashboard-party-trigger,
.dashboard-list-tools .search input { min-height: 38px; }

.dashboard-metric { align-items: center; }
.dashboard-metric > div:nth-child(2) { min-width: 0; display: grid; gap: 3px; text-align: left; }
.dashboard-metric strong { margin: 0; line-height: 1; font-variant-numeric: tabular-nums; }
.dashboard-metric span { line-height: 1.35; }
.dashboard-metric:active { transform: translateY(0); box-shadow: 0 4px 12px rgba(29,69,55,.07); }

.dashboard-scroll { max-height: 286px; scrollbar-color: #afc2b8 #edf3ef; }
.dashboard-scroll table { width: 100%; table-layout: fixed; }
.dashboard-scroll th,
.dashboard-scroll td { overflow: hidden; text-overflow: ellipsis; }
.dashboard-scroll tbody tr { transition: background-color .16s ease, box-shadow .16s ease; }
.dashboard-scroll tbody tr:hover { background: #f2f7f4; box-shadow: inset 3px 0 0 #75a58f; }
.dashboard-scroll .cell-center { text-align: center; white-space: nowrap; }
.dashboard-scroll .cell-number,
.dashboard-scroll .cell-money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dashboard-scroll .stacked-values > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#dashboard-sales-results .business-table { min-width: 1180px; }
#dashboard-sales-results th:nth-child(1) { width: 145px; }
#dashboard-sales-results th:nth-child(2) { width: 108px; }
#dashboard-sales-results th:nth-child(3) { width: 190px; }
#dashboard-sales-results th:nth-child(4) { width: 220px; }
#dashboard-sales-results th:nth-child(5) { width: 165px; }
#dashboard-sales-results th:nth-child(6) { width: 112px; }
#dashboard-sales-results th:nth-child(7) { width: 105px; text-align: right; }
#dashboard-sales-results th:nth-child(8) { width: 125px; text-align: right; }
#dashboard-sales-results th:nth-child(9) { width: 100px; text-align: center; }

#dashboard-order-results .order-table { min-width: 1460px; }
#dashboard-order-results th:nth-child(1) { width: 150px; }
#dashboard-order-results th:nth-child(2) { width: 105px; }
#dashboard-order-results th:nth-child(3) { width: 180px; }
#dashboard-order-results th:nth-child(4) { width: 190px; }
#dashboard-order-results th:nth-child(5) { width: 125px; }
#dashboard-order-results th:nth-child(6) { width: 190px; }
#dashboard-order-results th:nth-child(7) { width: 180px; }
#dashboard-order-results th:nth-child(8) { width: 110px; }
#dashboard-order-results th:nth-child(9) { width: 86px; }
#dashboard-order-results th:nth-child(10) { width: 100px; }
#dashboard-order-results th:nth-child(11) { width: 130px; }

.work-tips { min-height: 96px; }
.work-tip {
  position: relative;
  grid-template-columns: 40px minmax(0,1fr) 18px;
  gap: 12px;
  min-width: 0;
  padding: 14px 18px;
  cursor: pointer;
}
.work-tip:first-child { padding-left: 8px; }
.work-tip .work-tip-icon { width: 40px; height: 40px; }
.work-tip strong { margin-bottom: 5px; font-size: 24px; font-variant-numeric: tabular-nums; }
.work-tip-arrow { width: 17px; height: 17px; color: #9bb0a6; transition: color .18s ease, transform .18s ease; }
.work-tip:hover .work-tip-arrow,
.work-tip.active .work-tip-arrow { color: var(--brand-accent); transform: translateX(2px); }
.work-tip.has-pending strong { color: var(--brand-primary); }
.work-tip.shipment.has-pending strong { color: #ad6c12; }
.work-tip:active { background: #edf4f0; }

@media (max-width: 720px) {
  .dashboard-scroll { max-height: 320px; }
  .work-tip,
  .work-tip:nth-child(3) { grid-template-columns: 32px minmax(0,1fr) 14px; }
  .work-tip-arrow { width: 14px; height: 14px; }
}

/* ZiPACK finance workspace */
.finance-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.finance-metric {
  min-height: 100px;
  padding: 18px 20px;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 15px;
  border-color: var(--border-color);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(29,69,55,.045);
}
.finance-metric > div:last-child { min-width: 0; display: grid; gap: 7px; }
.finance-metric strong {
  margin: 0;
  overflow: hidden;
  color: var(--brand-primary);
  font-size: 26px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.finance-metric span { color: var(--text-secondary); font-size: 13px; }
.finance-metric .metric-icon { width: 46px; height: 46px; border-radius: 10px; }
.finance-metric.warn { border-color: #ead9b8; }
.finance-metric.warn strong { color: #a66a13; }
.finance-metric.danger { border-color: #ebcfcc; }
.finance-metric.danger strong { color: #b4473f; }

.finance-order-export-panel { margin-bottom: 18px; }
.finance-order-export-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
  padding: 16px;
}
.finance-export-filters {
  display: grid;
  grid-template-columns: minmax(230px, 1.25fr) minmax(180px, .8fr) minmax(180px, .8fr) auto;
  gap: 10px;
  align-items: end;
  min-width: 0;
}
.finance-order-export-search { width: 100%; }
.finance-export-filters > select,
.finance-account-filters > select,
.finance-selection-filters > select {
  width: 100%;
  min-height: 40px;
  min-width: 0;
  border: 1px solid #cbdad2;
  border-radius: 8px;
  padding: 8px 32px 8px 11px;
  background: #fff;
}
.finance-export-filters > select:focus,
.finance-account-filters > select:focus,
.finance-selection-filters > select:focus {
  outline: 3px solid rgba(49,116,91,.12);
  border-color: var(--brand-accent);
}
.finance-order-export-panel .export-date-range,
.finance-selection-tools .export-date-range { border-color: #cbdad2; border-radius: 8px; }
.finance-export-actions { display: grid; grid-template-columns: repeat(2, max-content); gap: 8px; }
.finance-export-actions .btn { min-width: 142px; justify-content: center; white-space: nowrap; }

.finance-tabs { margin: 2px 0 14px; gap: 4px; }
.finance-tabs button { min-height: 42px; padding: 9px 18px; border-radius: 8px 8px 0 0; }
.finance-tabs button:hover { color: var(--brand-primary); background: #f0f5f2; }
.finance-tabs button.active { color: var(--brand-primary); border-bottom-color: var(--brand-accent); background: var(--brand-primary-soft); }

.finance-account-header {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 14px 16px;
}
.finance-account-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.finance-account-filters { display: grid; grid-template-columns: minmax(180px, 230px) minmax(270px, 420px); gap: 8px; min-width: 0; }
.finance-account-filters .search { width: 100%; min-width: 0; }
.finance-account-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: nowrap; }
.finance-account-actions .btn { min-height: 38px; padding: 8px 12px; justify-content: center; white-space: nowrap; }
.finance-account-actions .btn:disabled { opacity: .48; box-shadow: none; cursor: not-allowed; }

.finance-selection-tools {
  min-height: 58px;
  padding: 9px 16px;
  justify-content: space-between;
  gap: 12px;
  background: #f6f9f7;
  border-bottom-color: var(--border-color);
}
.finance-selection-filters,
.finance-selection-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.finance-selection-filters > select { width: 180px; }
.finance-selection-tools .finance-table-date-range { margin-left: 0; }
.finance-selection-actions .btn { min-height: 36px; padding: 7px 11px; white-space: nowrap; }
.finance-selection-actions #finance-selected-count {
  min-width: 78px;
  padding: 7px 10px;
  border-radius: 7px;
  background: #eaf2ed;
  color: var(--brand-primary);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.finance-account-panel > .table-wrap {
  max-height: min(62vh, 680px);
  overflow: auto;
  scrollbar-gutter: stable;
  scrollbar-color: #afc2b8 #edf3ef;
}
.finance-account-panel .finance-table {
  width: 100%;
  min-width: 1420px;
  table-layout: fixed;
}
.finance-account-panel .finance-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef4f0;
  color: #50675d;
  box-shadow: inset 0 -1px 0 var(--border-color);
}
.finance-account-panel .finance-table th:nth-child(1) { width: 105px; }
.finance-account-panel .finance-table th:nth-child(2) { width: 150px; }
.finance-account-panel .finance-table th:nth-child(3) { width: 200px; }
.finance-account-panel .finance-table th:nth-child(4) { width: 235px; }
.finance-account-panel .finance-table th:nth-child(5) { width: 90px; text-align: right; }
.finance-account-panel .finance-table th:nth-child(6) { width: 105px; text-align: right; }
.finance-account-panel .finance-table th:nth-child(7) { width: 120px; text-align: right; }
.finance-account-panel .finance-table th:nth-child(8),
.finance-account-panel .finance-table th:nth-child(9),
.finance-account-panel .finance-table th:nth-child(10) { width: 102px; text-align: center; }
.finance-account-panel .finance-table th:nth-child(11) { width: 110px; text-align: center; }
.finance-account-panel .finance-table tbody tr { transition: background-color .16s ease, box-shadow .16s ease; }
.finance-account-panel .finance-table tbody tr:hover { background: #f2f7f4; box-shadow: inset 3px 0 0 #75a58f; }
.finance-account-panel .finance-table td { vertical-align: middle; }
.finance-order-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finance-order-cell strong { color: #294a3f; font-variant-numeric: tabular-nums; }
.finance-party-cell { max-width: none; }
.finance-product-cell { min-width: 0; max-width: none; }
.finance-product-row { grid-template-columns: 18px minmax(0, 1fr); gap: 8px; padding: 2px 0; border-bottom: 0; }
.finance-product-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finance-product-row input,
.finance-product-heading input { accent-color: var(--brand-accent); }
.finance-product-heading { justify-content: flex-start; }

.finance-state-btn { min-width: 78px; min-height: 30px; border-radius: 7px; font-weight: 600; }
.finance-state-btn.pending { color: #8b5c17; background: #fff4e2; }
.finance-state-btn.partial { color: #9a6415; background: #ffefd2; }
.finance-state-btn.complete { color: #246e52; background: #e4f3eb; }
.finance-state-btn:not(:disabled):hover { transform: translateY(-1px); box-shadow: inset 0 0 0 1px currentColor, 0 3px 8px rgba(29,69,55,.08); }

.finance-record-panel { margin-top: 18px; }
.finance-record-panel .panel-header { gap: 14px; }
.finance-record-panel .table-wrap { scrollbar-color: #afc2b8 #edf3ef; }
.finance-record-panel tbody tr:hover { background: #f2f7f4; }
.finance-record-table .money-cell { color: #294a3f; font-weight: 600; }

@media (max-width: 1450px) {
  .finance-order-export-body { grid-template-columns: 1fr; }
  .finance-export-actions { justify-content: end; }
  .finance-account-toolbar { align-items: stretch; flex-direction: column; }
  .finance-account-filters { grid-template-columns: minmax(180px, 230px) minmax(280px, 1fr); }
  .finance-account-actions { justify-content: flex-start; }
}

@media (max-width: 1120px) {
  .finance-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-export-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-export-filters .export-date-range { grid-column: 1 / -1; }
  .finance-selection-tools { align-items: stretch; flex-direction: column; }
  .finance-selection-filters,
  .finance-selection-actions { flex-wrap: wrap; }
}

@media (max-width: 720px) {
  .finance-metrics { grid-template-columns: 1fr; gap: 10px; }
  .finance-metric { min-height: 88px; padding: 15px; }
  .finance-metric strong { font-size: 23px; }
  .finance-order-export-body { padding: 12px; }
  .finance-export-filters,
  .finance-account-filters { grid-template-columns: 1fr; }
  .finance-export-filters .export-date-range { grid-column: auto; }
  .finance-export-actions,
  .finance-account-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .finance-export-actions .btn,
  .finance-account-actions .btn { min-width: 0; width: 100%; white-space: normal; }
  .finance-selection-filters,
  .finance-selection-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .finance-selection-filters > select { width: 100%; }
  .finance-selection-actions .btn { width: 100%; justify-content: center; }
  .finance-selection-actions #finance-selected-count { width: 100%; }
  .finance-record-panel .panel-header { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 420px) {
  .finance-export-actions,
  .finance-account-actions { grid-template-columns: 1fr; }
}

/* ZiPACK sales contracts workspace */
.contract-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.contract-toolbar-left {
  display: grid;
  grid-template-columns: minmax(340px, 580px) minmax(150px, 180px);
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.contract-search { width: 100%; }
.contract-toolbar input,
.contract-toolbar select,
.contract-toolbar .btn { min-height: 40px; border-radius: 8px; }
.contract-toolbar select {
  width: 100%;
  min-width: 0;
  padding: 8px 32px 8px 11px;
  border: 1px solid #cbdad2;
  background: #fff;
  color: var(--text-primary);
}
.contract-toolbar select:focus {
  outline: 3px solid rgba(49,116,91,.12);
  border-color: var(--brand-accent);
}
.contract-toolbar > .btn { flex: 0 0 auto; padding-inline: 17px; white-space: nowrap; }

.module-flow-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(29,69,55,.035);
  scrollbar-width: thin;
  scrollbar-color: #afc2b8 #edf3ef;
}
.module-flow-step {
  min-width: 150px;
  min-height: 44px;
  flex: 1 1 0;
  display: grid;
  grid-template-columns: 24px 18px minmax(0,1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid #dce6df;
  border-radius: 8px;
  background: #f3f7f4;
  color: #5f756b;
  text-align: left;
  cursor: pointer;
}
.module-flow-step:hover { border-color: #aac5b8; background: #edf4f0; color: var(--brand-primary); }
.module-flow-step.active {
  border-color: var(--brand-primary);
  background: var(--brand-primary);
  color: #fff;
  box-shadow: 0 5px 12px rgba(21,63,53,.14);
}
.module-flow-step > svg { width: 17px; height: 17px; }
.module-flow-step strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.module-flow-index {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dfeae4;
  color: #49685a;
  font-size: 12px;
  font-weight: 700;
}
.module-flow-step.active .module-flow-index { background: rgba(255,255,255,.18); color: #fff; }
.module-flow-arrow { width: 17px; height: 17px; flex: 0 0 auto; color: #9cb1a7; }

.sales-contract-panel { overflow: hidden; }
.sales-contract-panel .panel-header { min-height: 56px; }
.sales-contract-panel .table-wrap {
  overflow: auto;
  scrollbar-color: #afc2b8 #edf3ef;
}
.sales-contract-table {
  width: 100%;
  min-width: 1120px;
  table-layout: fixed;
}
.sales-contract-table th {
  height: 44px;
  background: #eef4f0;
  color: #50675d;
  box-shadow: inset 0 -1px 0 var(--border-color);
}
.sales-contract-table td { height: 48px; vertical-align: middle; }
.sales-contract-table th:nth-child(1) { width: 155px; }
.sales-contract-table th:nth-child(2) { width: 220px; }
.sales-contract-table th:nth-child(3) { width: 260px; }
.sales-contract-table th:nth-child(4) { width: 110px; text-align: center; }
.sales-contract-table th:nth-child(5) { width: 130px; text-align: right; }
.sales-contract-table th:nth-child(6) { width: 110px; text-align: center; }
.sales-contract-table th:nth-child(7) { width: 105px; text-align: center; }
.sales-contract-table th:nth-child(8) { width: 160px; text-align: center; }
.sales-contract-table tbody tr { transition: background-color .16s ease, box-shadow .16s ease; }
.sales-contract-table tbody tr:hover { background: #f2f7f4; box-shadow: inset 3px 0 0 #75a58f; }
.sales-contract-table .table-truncate { max-width: none; }
.contract-number-link { font-weight: 700; }
.contract-order-link,
.contract-order-missing {
  max-width: 100%;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 12px;
  white-space: nowrap;
}
.contract-order-link {
  overflow: hidden;
  border: 1px solid #c8ded3;
  background: #e7f3ec;
  color: #246e52;
  text-overflow: ellipsis;
  cursor: pointer;
}
.contract-order-link:hover { border-color: #83b49e; background: #dceee5; color: #174f3b; }
.contract-order-link svg { width: 14px; height: 14px; flex: 0 0 auto; }
.contract-order-missing { border: 1px solid #dfe5e1; background: #f2f4f3; color: #7a8982; }

@media (max-width: 900px) {
  .contract-toolbar { align-items: stretch; flex-direction: column; }
  .contract-toolbar-left { grid-template-columns: minmax(0, 1fr) minmax(150px, 190px); }
  .contract-toolbar > .btn { align-self: flex-end; }
  .sales-contract-panel .panel-header { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 720px) {
  .contract-toolbar-left { grid-template-columns: 1fr; }
  .contract-toolbar > .btn { align-self: stretch; width: 100%; }
  .module-flow-nav { gap: 6px; padding: 8px; }
  .module-flow-step { min-width: 142px; }
  .sales-contract-panel .panel-header .muted { line-height: 1.5; }
}

/* ZiPACK sales order editor */
.sales-order-editor { display: grid; gap: 16px; padding-bottom: 4px; }
.sales-form-card { overflow: visible; border-radius: 12px; box-shadow: 0 4px 16px rgba(29,69,55,.04); }
.sales-form-card > .panel-header { min-height: 54px; padding: 11px 16px; border-bottom-color: var(--border-color); }
.sales-form-card > .panel-body { padding: 16px; }
.sales-form-card .field { min-width: 0; margin-bottom: 0; }
.sales-form-card .field label {
  display: block;
  margin-bottom: 7px;
  color: #40594f;
  font-size: 13px;
  font-weight: 600;
}
.sales-form-card .field input,
.sales-form-card .field select,
.sales-form-card .field textarea {
  width: 100%;
  min-height: 40px;
  border-color: #cbdad2;
  border-radius: 8px;
  background: #fff;
}
.sales-form-card .field input:hover,
.sales-form-card .field select:hover,
.sales-form-card .field textarea:hover { border-color: #a8c3b6; }
.sales-form-card .field input:focus,
.sales-form-card .field select:focus,
.sales-form-card .field textarea:focus {
  outline: 3px solid rgba(49,116,91,.12);
  border-color: var(--brand-accent);
}

.sales-basic-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}
.sales-field-date { grid-column: span 2; }
.sales-field-customer { grid-column: span 3; }
.sales-field-po { grid-column: span 2; }
.sales-field-project { grid-column: span 3; }
.sales-field-address { grid-column: span 12; }
.sales-delivery-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.quality-requirements-input { min-height: 40px; max-height: 112px; overflow-y: hidden; line-height: 1.5; resize: none; }
.auto-resize-textarea {
  box-sizing: border-box;
  overflow-y: hidden;
  resize: none;
  transition: height .16s ease, border-color .18s ease, box-shadow .18s ease;
}

.sales-items-card { overflow: hidden; }
.sales-items-card > .panel-header .btn { min-height: 38px; }
.sales-items-wrap { overflow: auto; scrollbar-gutter: stable; scrollbar-color: #afc2b8 #edf3ef; }
.sales-order-item-table {
  width: 100%;
  min-width: 1480px;
  table-layout: fixed;
}
.sales-order-item-table th {
  height: 44px;
  background: #eef4f0;
  color: #50675d;
  box-shadow: inset 0 -1px 0 var(--border-color);
}
.sales-order-item-table th:nth-child(1) { width: 130px; }
.sales-order-item-table th:nth-child(2) { width: 200px; }
.sales-order-item-table th:nth-child(3) { width: 160px; }
.sales-order-item-table th:nth-child(4) { width: 280px; }
.sales-order-item-table th:nth-child(5) { width: 100px; text-align: right; }
.sales-order-item-table th:nth-child(6) { width: 90px; }
.sales-order-item-table th:nth-child(7) { width: 115px; text-align: right; }
.sales-order-item-table th:nth-child(8) { width: 125px; text-align: right; }
.sales-order-item-table th:nth-child(9) { width: 210px; }
.sales-order-item-table th:nth-child(10) { width: 70px; text-align: center; }
.sales-order-item-table td { height: 56px; padding: 8px; vertical-align: top; background: #fff; }
.sales-order-item-table tbody tr { transition: background-color .16s ease, box-shadow .16s ease; }
.sales-order-item-table tbody tr:hover { box-shadow: inset 3px 0 0 #75a58f; }
.sales-order-item-table tbody tr:hover td { background: #f7faf8; }
.sales-order-item-table input,
.sales-order-item-table textarea {
  min-width: 0;
  width: 100%;
  border-color: #cbdad2;
  border-radius: 7px;
  background: #fff;
}
.sales-order-item-table input { min-height: 38px; }
.sales-order-item-table textarea {
  min-height: 74px;
  max-height: 150px;
  overflow-y: auto;
  line-height: 1.45;
  resize: vertical;
}
.sales-order-item-table .sales-product-name-textarea,
.sales-order-item-table .sales-notes-textarea {
  min-height: 40px;
  max-height: 96px;
  overflow-y: hidden;
  resize: none;
}
.sales-order-item-table .sales-process-textarea {
  min-height: 40px;
  max-height: 112px;
  overflow-y: hidden;
  resize: none;
}
.sales-order-item-table input:focus,
.sales-order-item-table textarea:focus {
  outline: 3px solid rgba(49,116,91,.11);
  border-color: var(--brand-accent);
}
.sales-order-item-table td:nth-child(5) input,
.sales-order-item-table td:nth-child(7) input,
.sales-order-item-table td:nth-child(8) input { text-align: right; font-variant-numeric: tabular-nums; }
.sales-order-item-table td:nth-child(10) { text-align: center; }
.sales-order-item-table .remove-sales-item { margin: 1px auto 0; color: var(--status-danger); border-color: #ebcfcc; }
.sales-order-item-table .remove-sales-item:hover { background: #faecea; }

/* Purchase order editor: compact auto-growing fields shared with sales editors */
.purchase-form-card > .panel-body { padding: 16px; }
.purchase-form-groups { display: grid; gap: 15px; }
.purchase-form-section {
  min-width: 0;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
}
.purchase-form-section:first-child { padding-top: 0; border-top: 0; }
.purchase-section-heading,
.purchase-section-label {
  display: flex;
  align-items: center;
  gap: 9px;
}
.purchase-section-heading { margin-bottom: 12px; }
.purchase-section-heading h4,
.purchase-section-label strong {
  margin: 0;
  color: var(--brand-primary);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}
.purchase-section-heading .section-icon,
.purchase-section-label .section-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
}
.purchase-section-heading .section-icon svg,
.purchase-section-label .section-icon svg { width: 18px; height: 18px; }
.purchase-form-section .form-grid { align-items: start; gap: 14px; }
.purchase-form-section .field { min-width: 0; margin-bottom: 0; align-self: start; }
.purchase-form-section .field label {
  display: block;
  margin-bottom: 7px;
  color: #40594f;
  font-size: 13px;
  font-weight: 600;
}
.purchase-form-section .field input,
.purchase-form-section .field select,
.purchase-form-section .field textarea {
  min-height: 40px;
  border-color: #cbdad2;
  border-radius: 8px;
}
.purchase-form-section .field input:hover,
.purchase-form-section .field select:hover,
.purchase-form-section .field textarea:hover { border-color: #a8c3b6; }
.purchase-form-section .field input:focus,
.purchase-form-section .field select:focus,
.purchase-form-section .field textarea:focus {
  outline: 3px solid rgba(49,116,91,.12);
  border-color: var(--brand-accent);
}
.purchase-status-grid {
  grid-template-columns: repeat(4, minmax(180px, 240px));
  justify-content: start;
}
.purchase-quality-section .purchase-section-heading { margin-bottom: 10px; }
.purchase-quality-section .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.purchase-products-title {
  min-height: 55px;
  margin: 18px -16px 0;
  padding: 9px 16px;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  background: #f8faf8;
}
.purchase-order-editor .purchase-quality-textarea {
  min-height: 40px;
  max-height: 112px;
  overflow-y: hidden;
  resize: none;
}
.purchase-items-wrap {
  overflow: auto;
  scrollbar-gutter: stable;
  scrollbar-color: #afc2b8 #edf3ef;
}
.purchase-order-item-table {
  width: 100%;
  min-width: 1480px;
  table-layout: fixed;
}
.purchase-order-item-table th {
  height: 44px;
  background: #eef4f0;
  color: #50675d;
  box-shadow: inset 0 -1px 0 var(--border-color);
}
.purchase-order-item-table th:nth-child(1) { width: 130px; }
.purchase-order-item-table th:nth-child(2) { width: 205px; }
.purchase-order-item-table th:nth-child(3) { width: 155px; }
.purchase-order-item-table th:nth-child(4) { width: 285px; }
.purchase-order-item-table th:nth-child(5) { width: 100px; text-align: right; }
.purchase-order-item-table th:nth-child(6) { width: 85px; }
.purchase-order-item-table th:nth-child(7) { width: 110px; text-align: right; }
.purchase-order-item-table th:nth-child(8) { width: 120px; text-align: right; }
.purchase-order-item-table th:nth-child(9) { width: 210px; }
.purchase-order-item-table th:nth-child(10) { width: 65px; text-align: center; }
.purchase-order-item-table td {
  height: 56px;
  padding: 8px;
  vertical-align: top;
  background: #fff;
}
.purchase-order-item-table tbody tr { transition: background-color .16s ease, box-shadow .16s ease; }
.purchase-order-item-table tbody tr:hover { box-shadow: inset 3px 0 0 #75a58f; }
.purchase-order-item-table tbody tr:hover td { background: #f7faf8; }
.purchase-order-item-table input,
.purchase-order-item-table textarea {
  min-width: 0;
  width: 100%;
  border-color: #cbdad2;
  border-radius: 7px;
  background: #fff;
}
.purchase-order-item-table input { min-height: 38px; }
.purchase-order-item-table .purchase-product-name-textarea,
.purchase-order-item-table .purchase-notes-textarea {
  min-height: 40px;
  max-height: 96px;
  overflow-y: hidden;
  resize: none;
}
.purchase-order-item-table .purchase-process-textarea {
  min-height: 40px;
  max-height: 112px;
  overflow-y: hidden;
  resize: none;
}
.purchase-order-item-table input:focus,
.purchase-order-item-table textarea:focus {
  outline: 3px solid rgba(49,116,91,.11);
  border-color: var(--brand-accent);
}
.purchase-order-item-table td:nth-child(5) input,
.purchase-order-item-table td:nth-child(7) input,
.purchase-order-item-table td:nth-child(8) input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.purchase-order-item-table td:nth-child(10) { text-align: center; }
.purchase-order-item-table .remove-item {
  margin: 1px auto 0;
  color: var(--status-danger);
  border-color: #ebcfcc;
}
.purchase-order-item-table .remove-item:hover { background: #faecea; }

@media (max-width: 1300px) {
  .purchase-status-grid { grid-template-columns: repeat(2, minmax(180px, 260px)); }
}

@media (max-width: 720px) {
  .purchase-form-card > .panel-body { padding: 14px 12px; }
  .purchase-form-groups { gap: 13px; }
  .purchase-form-section { padding-top: 13px; }
  .purchase-status-grid { grid-template-columns: 1fr; }
  .purchase-products-title { margin-right: -12px; margin-left: -12px; padding-right: 12px; padding-left: 12px; }
}

.sales-order-summary {
  min-height: 62px;
  gap: 36px;
  padding: 12px 18px;
  border-top-color: var(--border-color);
  background: #f0f5f2;
}
.sales-order-summary > span { min-width: 126px; display: grid; gap: 5px; text-align: right; }
.sales-order-summary small { color: var(--text-secondary); font-size: 12px; }
.sales-order-summary strong { margin: 0; color: var(--brand-primary); font-size: 18px; font-variant-numeric: tabular-nums; }
.sales-order-summary b { font: inherit; }

.sales-form-actions {
  position: sticky;
  z-index: 4;
  bottom: 10px;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 10px 28px rgba(21,63,53,.1);
  backdrop-filter: blur(8px);
}
.sales-form-actions .btn { min-width: 108px; min-height: 40px; }
.sales-form-actions .sales-draft-action { border-color: #7ea993; color: var(--brand-primary); background: #fff; }
.sales-form-actions .sales-draft-action:hover { border-color: var(--brand-accent); background: var(--brand-primary-soft); }

@media (max-width: 1200px) {
  .sales-basic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sales-basic-grid > .field { grid-column: span 1; }
  .sales-basic-grid > .sales-field-address { grid-column: span 2; }
  .sales-delivery-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .sales-order-editor { gap: 12px; }
  .sales-form-card > .panel-header { align-items: flex-start; flex-direction: column; }
  .sales-form-card > .panel-header .btn { width: 100%; }
  .sales-form-card > .panel-body { padding: 14px 12px; }
  .sales-basic-grid,
  .sales-delivery-grid { grid-template-columns: 1fr; gap: 12px; }
  .sales-basic-grid > .field,
  .sales-basic-grid > .sales-field-address { grid-column: span 1; }
  .sales-order-summary { justify-content: space-between; gap: 14px; }
  .sales-order-summary > span { min-width: 0; }
  .sales-form-actions { bottom: 6px; flex-wrap: wrap; padding: 9px; }
  .sales-form-actions .btn { flex: 1 1 110px; min-width: 0; }
}

/* ZiPACK sales contract editor */
.sales-contract-editor { display: grid; gap: 16px; padding-bottom: 4px; }
.contract-form-card > .panel-header { min-height: 54px; }
.contract-form-card .choice-picker-toggle {
  border-left-color: #d2dfd8;
  border-radius: 0 7px 7px 0;
  color: var(--brand-primary);
}
.contract-form-card .choice-picker-toggle:hover { background: var(--brand-primary-soft); color: var(--brand-accent); }
.contract-form-card .choice-picker-menu { border-color: #cbdad2; border-radius: 8px; box-shadow: 0 12px 28px rgba(21,63,53,.14); }
.contract-form-card .choice-picker-option:hover,
.contract-form-card .choice-picker-option:focus-visible { background: var(--brand-primary-soft); color: var(--brand-primary); }

.contract-basic-grid,
.contract-party-grid,
.contract-terms-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}
.contract-field-number { grid-column: span 3; }
.contract-field-date { grid-column: span 2; }
.contract-field-status { grid-column: span 2; }
.contract-field-project { grid-column: span 3; }
.contract-party-name { grid-column: span 4; }
.contract-party-address { grid-column: span 8; }
.contract-party-phone { grid-column: span 3; }
.contract-party-tax { grid-column: span 4; }
.contract-party-bank { grid-column: span 5; }
.contract-delivery-method,
.contract-payment { grid-column: span 6; }
.contract-delivery-address { grid-column: span 12; }
.contract-delivery-tolerance { grid-column: span 12; }
.contract-quality,
.contract-other-terms { grid-column: span 6; }
.contract-terms-grid textarea { min-height: 82px; max-height: 190px; overflow-y: auto; line-height: 1.5; resize: vertical; }
.contract-terms-grid .contract-term-input {
  padding: 9px 11px;
  overflow-y: auto;
  line-height: 1.5;
  resize: vertical;
}
.contract-terms-grid .contract-tolerance-input { min-height: 40px; max-height: 120px; }
.contract-terms-grid .contract-payment-input { min-height: 40px; max-height: 120px; }
.contract-terms-grid .contract-quality-input,
.contract-terms-grid .contract-other-input { min-height: 42px; max-height: 104px; }
.contract-terms-grid .contract-auto-textarea,
.contract-editor-item-table .contract-auto-textarea {
  overflow-y: hidden;
  resize: none;
  transition: height .16s ease, border-color .18s ease, box-shadow .18s ease;
}
.contract-payment .choice-picker > textarea { padding-right: 50px; }
.contract-payment .choice-picker-toggle { width: 40px; }

.contract-items-card { overflow: hidden; }
.contract-items-card > .panel-header .btn { min-height: 38px; }
.contract-items-wrap { overflow: auto; scrollbar-gutter: stable; scrollbar-color: #afc2b8 #edf3ef; }
.contract-editor-item-table {
  width: 100%;
  min-width: 1580px;
  table-layout: fixed;
}
.contract-editor-item-table th {
  height: 44px;
  background: #eef4f0;
  color: #50675d;
  box-shadow: inset 0 -1px 0 var(--border-color);
}
.contract-editor-item-table th:nth-child(1) { width: 125px; }
.contract-editor-item-table th:nth-child(2) { width: 180px; }
.contract-editor-item-table th:nth-child(3) { width: 125px; text-align: center; }
.contract-editor-item-table th:nth-child(4) { width: 150px; }
.contract-editor-item-table th:nth-child(5) { width: 280px; }
.contract-editor-item-table th:nth-child(6) { width: 95px; text-align: right; }
.contract-editor-item-table th:nth-child(7) { width: 80px; }
.contract-editor-item-table th:nth-child(8) { width: 110px; text-align: right; }
.contract-editor-item-table th:nth-child(9) { width: 120px; text-align: right; }
.contract-editor-item-table th:nth-child(10) { width: 190px; }
.contract-editor-item-table th:nth-child(11) { width: 65px; text-align: center; }
.contract-editor-item-table td { height: 116px; padding: 8px; vertical-align: top; background: #fff; }
.contract-editor-item-table tbody tr { transition: box-shadow .16s ease; }
.contract-editor-item-table tbody tr:hover { box-shadow: inset 3px 0 0 #75a58f; }
.contract-editor-item-table tbody tr:hover td { background: #f7faf8; }
.contract-editor-item-table input,
.contract-editor-item-table textarea {
  min-width: 0;
  width: 100%;
  border-color: #cbdad2;
  border-radius: 7px;
  background: #fff;
}
.contract-editor-item-table input { min-height: 38px; }
.contract-editor-item-table textarea {
  min-height: 76px;
  max-height: 160px;
  overflow-y: auto;
  line-height: 1.45;
  resize: vertical;
}
.contract-editor-item-table .contract-item-auto-textarea {
  min-height: 38px;
  max-height: 82px;
  overflow-y: hidden;
  resize: none;
}
.contract-editor-item-table .contract-product-name-textarea {
  min-height: 40px;
  max-height: 96px;
  overflow-y: hidden;
  resize: none;
}
.contract-editor-item-table input:focus,
.contract-editor-item-table textarea:focus {
  outline: 3px solid rgba(49,116,91,.11);
  border-color: var(--brand-accent);
}
.contract-editor-item-table td:nth-child(6) input,
.contract-editor-item-table td:nth-child(8) input,
.contract-editor-item-table td:nth-child(9) input { text-align: right; font-variant-numeric: tabular-nums; }
.contract-editor-item-table td:nth-child(11) { text-align: center; }
.contract-editor-item-table .contract-design-cell { vertical-align: middle; }
.contract-editor-item-table .contract-design-cell:focus,
.contract-editor-item-table .contract-design-cell.design-drop-target { outline-color: var(--brand-accent); background: #edf5f1; }
.contract-editor-item-table .contract-design-preview { border-color: #c6d7ce; border-radius: 7px; background: #f5f8f6; }
.contract-editor-item-table .contract-design-actions .icon-btn { border-radius: 7px; }
.contract-editor-item-table .remove-sales-item { margin: 1px auto 0; color: var(--status-danger); border-color: #ebcfcc; }
.contract-editor-item-table .remove-sales-item:hover { background: #faecea; }
.contract-summary { flex: 0 0 auto; }
.contract-form-actions { margin-top: 0; }

@media (max-width: 1200px) {
  .contract-basic-grid,
  .contract-party-grid,
  .contract-terms-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contract-basic-grid > .field,
  .contract-party-grid > .field,
  .contract-terms-grid > .field { grid-column: span 1; }
  .contract-basic-grid > .contract-field-project,
  .contract-party-grid > .contract-party-address,
  .contract-party-grid > .contract-party-bank,
  .contract-terms-grid > .contract-delivery-address,
  .contract-terms-grid > .contract-delivery-tolerance { grid-column: span 2; }
}

@media (max-width: 900px) {
  .contract-terms-grid { grid-template-columns: 1fr; gap: 12px; }
  .contract-terms-grid > .field,
  .contract-terms-grid > .contract-delivery-address,
  .contract-terms-grid > .contract-delivery-tolerance { grid-column: span 1; }
}

@media (max-width: 720px) {
  .sales-contract-editor { gap: 12px; }
  .contract-form-card > .panel-header { align-items: flex-start; flex-direction: column; }
  .contract-form-card > .panel-header .btn { width: 100%; }
  .contract-basic-grid,
  .contract-party-grid,
  .contract-terms-grid { grid-template-columns: 1fr; gap: 12px; }
  .contract-basic-grid > .field,
  .contract-party-grid > .field,
  .contract-terms-grid > .field,
  .contract-basic-grid > .contract-field-project,
  .contract-party-grid > .contract-party-address,
  .contract-party-grid > .contract-party-bank,
  .contract-terms-grid > .contract-delivery-address,
  .contract-terms-grid > .contract-delivery-tolerance,
  .contract-terms-grid > .contract-other-terms { grid-column: span 1; }
}

/* Customer and supplier profiles */
.customer-page-head { min-height: 48px; margin-bottom: 14px; }
.customer-page-head h3 { color: var(--text-primary); font-size: 21px; }
.customer-page-head p { margin: 0; }
.customer-list-panel { overflow: hidden; }
.customer-list-header { min-height: 58px; padding: 10px 16px; }
.customer-list-header .search { width: min(420px, 100%); }
.customer-list-header .search input { min-height: 40px; }
.customer-profile-table { width: 100%; min-width: 1000px; table-layout: fixed; }
.customer-profile-table th {
  height: 44px;
  padding: 10px 12px;
  background: #eef4f0;
  color: #50675d;
  font-size: 13px;
  box-shadow: inset 0 -1px 0 var(--border-color);
}
.customer-profile-table td { height: 50px; padding: 9px 12px; vertical-align: middle; }
.customer-profile-table th:nth-child(1) { width: 140px; }
.customer-profile-table th:nth-child(2) { width: 280px; }
.customer-profile-table th:nth-child(3) { width: 140px; }
.customer-profile-table th:nth-child(4) { width: 155px; }
.customer-profile-table th:nth-child(5) { width: 90px; text-align: center; }
.customer-profile-table th:nth-child(6) { width: 90px; text-align: center; }
.customer-profile-table th:nth-child(7) { width: 220px; text-align: center; }
.customer-profile-table tbody tr { transition: background-color .16s ease, box-shadow .16s ease; }
.customer-profile-table tbody tr:hover { box-shadow: inset 3px 0 0 #75a58f; }
.customer-profile-table tbody tr:hover td { background: #f2f7f4; }
.customer-name-cell { min-width: 0; }
.customer-name-cell strong {
  display: block;
  overflow: hidden;
  color: var(--text-primary);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-row-actions { gap: 6px; }
.customer-row-actions .btn {
  min-height: 34px;
  height: 34px;
  padding: 6px 11px;
  border-radius: 7px;
  font-size: 13px;
}
.customer-row-actions .btn.danger { border-color: #e6c8c5; background: #fff; color: #b9544d; }
.customer-row-actions .btn.danger:hover { border-color: #dba9a4; background: #fbefee; color: #a43e38; }
.customer-list-footer {
  min-height: 44px;
  align-items: center;
  padding: 10px 16px;
  border-top-color: var(--border-color);
  background: #fbfcfb;
}
.customer-dialog {
  width: min(840px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  border-radius: 12px;
}
.customer-dialog[open] { display: flex; flex-direction: column; }
.customer-dialog > form {
  display: flex;
  width: 100%;
  min-height: 0;
  max-height: calc(100dvh - 32px);
  flex-direction: column;
}
.customer-dialog .finance-dialog-head {
  position: relative;
  z-index: 2;
  min-height: 60px;
  padding: 12px 20px;
  flex: 0 0 auto;
  background: #fff;
}
.customer-dialog .finance-dialog-body {
  min-height: 0;
  padding: 18px 20px;
  flex: 1 1 auto;
  overflow-y: auto;
  scroll-padding-block: 72px;
}
.customer-dialog .finance-dialog-actions {
  position: relative;
  z-index: 2;
  padding: 12px 20px;
  flex: 0 0 auto;
  background: #fff;
}
.customer-profile-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.customer-profile-form .field { min-width: 0; margin-bottom: 0; grid-column: span 1; }
.customer-profile-form .span-2 { grid-column: span 1; }
.customer-profile-form .span-4 { grid-column: 1 / -1; }
.customer-profile-form .field label {
  min-height: 18px;
  color: #40564d;
  font-size: 13px;
  line-height: 18px;
}
.customer-profile-form input,
.customer-profile-form select,
.customer-profile-form textarea {
  min-height: 40px;
  border-color: #cbdad2;
  border-radius: 8px;
  background: #fff;
  color: var(--text-primary);
}
.customer-profile-form input:focus,
.customer-profile-form select:focus,
.customer-profile-form textarea:focus {
  outline: 3px solid rgba(49,116,91,.12);
  border-color: var(--brand-accent);
}
.customer-profile-form .profile-auto-textarea {
  min-height: 40px;
  max-height: 112px;
  overflow-y: hidden;
  line-height: 1.5;
  resize: none;
}
.customer-view-address {
  border-left-color: #75a58f;
  border-radius: 0 7px 7px 0;
  background: #f2f7f4;
}

@media (max-width: 720px) {
  .customer-page-head { align-items: flex-start; }
  .customer-page-head .btn { min-height: 40px; }
  .customer-list-header { align-items: stretch; flex-direction: column; }
  .customer-list-header .search { width: 100%; }
  .customer-list-footer { align-items: flex-start; flex-direction: column; }
  .customer-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .customer-dialog > form { max-height: calc(100dvh - 16px); }
  .customer-dialog .finance-dialog-head { min-height: 54px; padding: 10px 14px; }
  .customer-dialog .finance-dialog-body { padding: 14px; }
  .customer-dialog .finance-dialog-actions { padding: 10px 14px; }
  .customer-profile-form { grid-template-columns: 1fr; gap: 12px; }
  .customer-profile-form .field,
  .customer-profile-form .span-2,
  .customer-profile-form .span-4 { grid-column: span 1; }
  .customer-view-grid { grid-template-columns: 1fr; }
  .customer-view-grid .span-2 { grid-column: span 1; }
}

/* ZiPACK unified business lists */
.business-list-toolbar {
  min-height: 40px;
  align-items: center;
  gap: 10px;
}
.business-list-toolbar .search {
  width: min(460px, 100%);
  min-width: 280px;
  flex: 1 1 360px;
}
.business-list-toolbar .search input,
.business-list-toolbar > select,
.business-list-toolbar > .btn {
  min-height: 40px;
  height: 40px;
  border-radius: 8px;
}
.business-list-toolbar > select {
  min-width: 150px;
  max-width: 220px;
  padding-block: 0;
}
.business-list-toolbar > .btn { flex: 0 0 auto; white-space: nowrap; }
.business-list-panel {
  overflow: hidden;
  border-color: var(--border-color);
  border-radius: 12px;
  box-shadow: 0 5px 18px rgba(29,69,55,.045);
}
.business-list-panel > .table-wrap {
  scrollbar-color: #afc2b8 #edf3ef;
  scrollbar-gutter: stable;
}
.business-list-table {
  width: 100%;
  table-layout: fixed;
  color: var(--text-primary);
  font-size: 13px;
}
.business-list-table th {
  height: 44px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  background: #f0f5f2;
  color: #50665c;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}
.business-list-table td {
  height: 48px;
  padding: 10px 12px;
  border-bottom-color: #e7eee9;
}
.business-list-table tbody tr {
  transition: background-color .16s ease, box-shadow .16s ease;
}
.business-list-table tbody tr:hover {
  background: #f2f7f4;
  box-shadow: inset 3px 0 0 #75a58f;
}
.business-list-table .table-truncate {
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.business-list-table .cell-number,
.business-list-table .cell-money {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.business-list-table .cell-center {
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.business-list-table .order-link {
  color: var(--brand-accent);
  font-weight: 700;
}
.business-list-table .order-link:hover {
  color: var(--brand-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

#sales-order-results .sales-orders-list-table.has-source { min-width: 1470px; }
#sales-order-results .sales-orders-list-table.has-source th:nth-child(1) { width: 150px; }
#sales-order-results .sales-orders-list-table.has-source th:nth-child(2) { width: 108px; }
#sales-order-results .sales-orders-list-table.has-source th:nth-child(3) { width: 150px; }
#sales-order-results .sales-orders-list-table.has-source th:nth-child(4) { width: 190px; }
#sales-order-results .sales-orders-list-table.has-source th:nth-child(5) { width: 237px; }
#sales-order-results .sales-orders-list-table.has-source th:nth-child(6) { width: 180px; }
#sales-order-results .sales-orders-list-table.has-source th:nth-child(7) { width: 110px; }
#sales-order-results .sales-orders-list-table.has-source th:nth-child(8) { width: 115px; text-align: right; }
#sales-order-results .sales-orders-list-table.has-source th:nth-child(9) { width: 130px; text-align: right; }
#sales-order-results .sales-orders-list-table.has-source th:nth-child(10) { width: 100px; }

#purchase-request-results .purchase-requests-list-table { min-width: 1210px; }
#purchase-request-results .purchase-requests-list-table th:nth-child(1) { width: 165px; }
#purchase-request-results .purchase-requests-list-table th:nth-child(2) { width: 165px; }
#purchase-request-results .purchase-requests-list-table th:nth-child(3) { width: 230px; }
#purchase-request-results .purchase-requests-list-table th:nth-child(4) { width: 300px; }
#purchase-request-results .purchase-requests-list-table th:nth-child(5),
#purchase-request-results .purchase-requests-list-table th:nth-child(6) { width: 120px; }
#purchase-request-results .purchase-requests-list-table th:nth-child(7) { width: 110px; }

#order-results .purchase-orders-list-table { min-width: 1540px; }
#order-results .purchase-orders-list-table th:nth-child(1) { width: 150px; }
#order-results .purchase-orders-list-table th:nth-child(2) { width: 105px; }
#order-results .purchase-orders-list-table th:nth-child(3) { width: 170px; }
#order-results .purchase-orders-list-table th:nth-child(4) { width: 180px; }
#order-results .purchase-orders-list-table th:nth-child(5) { width: 120px; }
#order-results .purchase-orders-list-table th:nth-child(6) { width: 220px; }
#order-results .purchase-orders-list-table th:nth-child(7) { width: 180px; }
#order-results .purchase-orders-list-table th:nth-child(8) { width: 108px; }
#order-results .purchase-orders-list-table th:nth-child(9) { width: 82px; }
#order-results .purchase-orders-list-table th:nth-child(10) { width: 100px; }
#order-results .purchase-orders-list-table th:nth-child(11) { width: 125px; }

.purchase-orders-list-table td { padding: 8px 10px; vertical-align: top; }
.purchase-orders-list-table .cell-center { padding-top: 13px; vertical-align: top; }
.purchase-orders-list-table .order-item-material,
.purchase-orders-list-table .order-item-product {
  min-height: 40px;
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 20px;
}
.purchase-orders-list-table .purchase-order-item-row td {
  height: 40px;
  padding-top: 9px;
  padding-bottom: 9px;
}
.purchase-orders-list-table .purchase-order-row-group:hover td { background: #f2f7f4; }
.purchase-orders-list-table .purchase-order-row-group .order-overdue td { background: #fff5f4; }
.purchase-orders-list-table .purchase-order-row-group:hover .order-overdue td { background: #fcede9; }

@media (max-width: 980px) {
  .business-list-toolbar .search { flex-basis: 100%; max-width: none; }
  .business-list-toolbar .spacer { display: none; }
}

@media (max-width: 720px) {
  .business-list-toolbar .search { min-width: 0; }
  .business-list-toolbar > select { width: 100%; max-width: none; }
  .business-list-toolbar > .btn { width: 100%; }
  .business-list-panel { border-radius: 10px; }
}
.purchase-request-summary {
  margin-bottom: 16px;
}

.request-procurement-section {
  margin-bottom: 18px;
}

.request-section-title,
.request-section-title > div,
.request-product-head,
.request-product-title,
.request-component-toolbar,
.request-component-toolbar > div {
  display: flex;
  align-items: center;
}

.request-section-title {
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 12px;
}

.request-section-title > div {
  gap: 10px;
}

.request-section-title h3 {
  margin: 0;
  color: var(--text-primary, #263c34);
  font-size: 16px;
}

.request-section-title p {
  margin: 3px 0 0;
  color: var(--text-secondary, #708178);
  font-size: 12px;
}

.request-product-list {
  display: grid;
  gap: 14px;
}

.request-product-card {
  overflow: hidden;
  border: 1px solid var(--border-color, #dce6df);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(21, 63, 53, 0.045);
}

.request-product-head {
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color, #dce6df);
  background: #fbfdfb;
}

.request-product-title {
  min-width: 0;
  gap: 12px;
}

.request-product-title > div {
  min-width: 0;
}

.request-product-title strong,
.request-product-title span {
  display: block;
}

.request-product-title strong {
  overflow: hidden;
  margin-bottom: 4px;
  color: var(--text-primary, #263c34);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-product-title span {
  color: var(--text-secondary, #708178);
  font-size: 12px;
}

.request-product-index {
  display: grid !important;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: var(--brand-primary-soft, #edf3ef);
  color: var(--brand-primary, #153f35) !important;
  font-weight: 700;
}

.request-mode-control {
  display: grid;
  flex: 0 0 190px;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
}

.request-mode-control label {
  color: var(--text-secondary, #708178);
  font-size: 12px;
}

.request-mode-control select {
  min-width: 0;
  height: 38px;
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.mode-pill svg {
  width: 15px;
  height: 15px;
}

.mode-pill.finished {
  background: #e8f5ef;
  color: #17694d;
}

.mode-pill.component {
  background: #eef1e8;
  color: #59672d;
}

.request-finished-mode {
  display: grid;
  grid-template-columns: auto minmax(360px, 0.8fr) minmax(260px, 1.2fr);
  align-items: center;
  gap: 18px;
  padding: 16px;
}

.request-quantity-stat {
  display: grid;
  grid-template-columns: repeat(4, minmax(70px, 1fr));
  gap: 8px;
}

.request-quantity-stat span {
  padding: 8px 10px;
  border-radius: 8px;
  background: #f7faf8;
  color: var(--text-secondary, #708178);
  font-size: 12px;
}

.request-quantity-stat strong {
  display: block;
  margin-top: 3px;
  color: var(--text-primary, #263c34);
  font-size: 14px;
}

.request-finished-description {
  display: grid;
  min-width: 0;
  gap: 4px;
  color: var(--text-secondary, #708178);
  font-size: 13px;
}

.request-finished-description span {
  overflow-wrap: anywhere;
}

.request-component-toolbar {
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color, #dce6df);
}

.request-component-toolbar > div {
  gap: 9px;
}

.request-component-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.request-component-actions .component-entry-btn {
  border-color: #b8d7c8;
  color: var(--brand-primary, #153f35);
  white-space: nowrap;
}

.request-component-actions .component-entry-btn:hover {
  border-color: var(--brand-accent, #31745b);
  background: var(--brand-primary-soft, #edf3ef);
  color: var(--brand-primary, #153f35);
}

.request-components-wrap {
  border: 0;
  border-radius: 0;
}

.request-components-table {
  min-width: 1420px;
}

.request-components-table th {
  background: #f3f7f4;
  white-space: nowrap;
}

.request-components-table td {
  vertical-align: top;
}

.request-process-cell {
  min-width: 220px;
  max-width: 360px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.request-allocation-list {
  display: grid;
  min-width: 150px;
  gap: 4px;
}

.request-allocation-link {
  display: grid;
  gap: 1px;
  width: fit-content;
  max-width: 220px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--brand-accent, #31745b);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.request-allocation-link small {
  color: var(--text-secondary, #708178);
  font-size: 11px;
}

.request-allocation-link:hover {
  text-decoration: underline;
}

.procurement-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 66px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.procurement-type svg {
  width: 13px;
  height: 13px;
}

.procurement-type.physical {
  background: var(--brand-primary-soft, #edf3ef);
  color: var(--brand-primary, #153f35);
}

.procurement-type.outsourcing {
  background: #fff3df;
  color: #936016;
}

.procurement-type.legacy {
  background: #f0f2f1;
  color: #66736d;
}

.icon-btn.supplement {
  border-color: #b8d7c8;
  color: var(--brand-accent, #31745b);
}

.icon-btn.supplement:hover {
  background: var(--brand-primary-soft, #edf3ef);
}

.pending-quantity {
  color: #b87515 !important;
  font-weight: 700;
}

.complete-quantity {
  color: var(--status-success, #268663) !important;
  font-weight: 700;
}

.component-dialog {
  width: min(880px, calc(100vw - 32px));
}

.purchase-candidate-dialog {
  width: min(1120px, calc(100vw - 32px));
}

.purchase-candidate-dialog .finance-dialog-head > div {
  display: grid;
  gap: 3px;
}

.purchase-candidate-dialog .finance-dialog-head p {
  margin: 0;
  color: var(--text-secondary, #708178);
  font-size: 12px;
}

.purchase-candidate-body {
  padding: 0;
}

.purchase-candidate-table {
  min-width: 920px;
}

.purchase-candidate-table th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: #f3f7f4;
  white-space: nowrap;
}

.purchase-candidate-table td {
  vertical-align: middle;
}

.purchase-candidate-table tbody tr {
  transition: background 160ms ease;
}

.purchase-candidate-table tbody tr:hover,
.purchase-candidate-table tbody tr.selected {
  background: var(--brand-primary-soft, #edf3ef);
}

.purchase-candidate-table .candidate-check {
  width: 44px;
  text-align: center;
}

.purchase-candidate-table input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--brand-accent, #31745b);
}

.candidate-dialog-actions {
  gap: 10px;
}

.candidate-dialog-actions #candidate-selection-count {
  margin-right: auto;
  color: var(--text-secondary, #708178);
  font-size: 13px;
}

.procurement-type-segments {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.procurement-type-segments label {
  cursor: pointer;
}

.procurement-type-segments label[hidden] {
  display: none;
}

.procurement-type-segments input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.procurement-type-segments span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--border-color, #dce6df);
  border-radius: 8px;
  background: #fff;
  color: var(--text-secondary, #708178);
  font-size: 13px;
  font-weight: 650;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.procurement-type-segments span svg {
  width: 17px;
  height: 17px;
}

.procurement-type-segments input:checked + span {
  border-color: var(--brand-accent, #31745b);
  background: var(--brand-primary-soft, #edf3ef);
  color: var(--brand-primary, #153f35);
  box-shadow: 0 0 0 2px rgba(49, 116, 91, 0.12);
}

.procurement-type-segments input:focus-visible + span {
  outline: 2px solid var(--brand-accent, #31745b);
  outline-offset: 2px;
}

.component-material-only[hidden] {
  display: none;
}

.component-reference-field {
  position: relative;
  z-index: 4;
}

.component-reference-input {
  position: relative;
}

.component-reference-input svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-secondary, #708178);
  transform: translateY(-50%);
  pointer-events: none;
}

.component-reference-input input {
  width: 100%;
  padding-left: 38px;
}

.component-reference-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  max-height: 280px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 1px solid var(--border-color, #dce6df);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(21, 63, 53, 0.15);
}

.component-reference-results > button {
  display: grid;
  width: 100%;
  min-height: 56px;
  gap: 4px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid #edf2ee;
  background: #fff;
  color: var(--text-primary, #263c34);
  text-align: left;
  cursor: pointer;
}

.component-reference-results > button:last-child {
  border-bottom: 0;
}

.component-reference-results > button:hover,
.component-reference-results > button.active {
  background: var(--brand-primary-soft, #edf3ef);
}

.component-reference-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.component-reference-main > svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: var(--brand-accent, #31745b);
}

.component-reference-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-reference-main .procurement-type {
  min-width: auto;
  margin-left: auto;
  padding: 3px 7px;
  font-style: normal;
}

.component-reference-results small {
  overflow: hidden;
  color: var(--text-secondary, #708178);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-reference-empty {
  padding: 16px;
  color: var(--text-secondary, #708178);
  font-size: 13px;
  text-align: center;
}

.supplement-dialog {
  width: min(620px, calc(100vw - 32px));
}

.field-hint {
  display: block;
  margin-top: 5px;
  color: var(--text-secondary, #708178);
  font-size: 12px;
  line-height: 1.45;
}

.supplement-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f6f9f7;
  color: var(--text-secondary, #708178);
  font-size: 13px;
  line-height: 1.5;
}

.supplement-warning svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  color: var(--brand-accent, #31745b);
}

.component-parent-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border-color, #dce6df);
  border-radius: 8px;
  background: var(--brand-primary-soft, #edf3ef);
  color: var(--text-secondary, #708178);
  font-size: 13px;
}

.component-parent-summary strong {
  color: var(--brand-primary, #153f35);
}

@media (max-width: 1000px) {
  .request-finished-mode {
    grid-template-columns: 1fr;
  }

  .request-product-head {
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar,
  .workspace {
    width: 100%;
    min-width: 0;
  }

  .request-section-title,
  .request-product-head,
  .request-component-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .request-component-actions {
    justify-content: flex-start;
  }

  .request-mode-control {
    flex: none;
    width: 100%;
  }

  .request-quantity-stat {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Enterprise information recognition shared by customer and supplier profiles */
.enterprise-profile-dialog-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.enterprise-profile-dialog-title .btn.compact {
  min-height: 34px;
  padding: 6px 10px;
  white-space: nowrap;
}

.enterprise-recognition-dialog {
  width: min(940px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}

.enterprise-recognition-dialog[open] {
  display: flex;
  flex-direction: column;
}

.enterprise-recognition-dialog > .finance-dialog-head {
  flex: 0 0 auto;
  background: #fff;
}

.enterprise-recognition-dialog > .finance-dialog-head > div {
  display: grid;
  gap: 3px;
}

.enterprise-recognition-dialog > .finance-dialog-head p,
.enterprise-recognition-section-head p {
  margin: 0;
  color: var(--text-secondary, #708178);
  font-size: 12px;
  line-height: 1.45;
}

.enterprise-recognition-dialog > form {
  display: flex;
  min-height: 0;
  max-height: calc(100dvh - 92px);
  flex: 1 1 auto;
  flex-direction: column;
}

.enterprise-recognition-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.enterprise-recognition-source-grid {
  display: grid;
  grid-template-columns: minmax(260px, .85fr) minmax(360px, 1.4fr);
  gap: 16px;
  align-items: stretch;
}

.enterprise-recognition-upload {
  display: flex;
  min-height: 156px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  padding: 18px;
  border: 1px dashed #9dbbae;
  border-radius: 10px;
  background: #f8faf8;
  color: var(--text-primary, #263c34);
  text-align: center;
  cursor: pointer;
}

.enterprise-recognition-upload:hover {
  border-color: var(--brand-accent, #31745b);
  background: var(--brand-primary-soft, #edf3ef);
}

.enterprise-recognition-upload > svg {
  width: 26px;
  height: 26px;
  color: var(--brand-accent, #31745b);
}

.enterprise-recognition-upload span,
.enterprise-recognition-upload small {
  color: var(--text-secondary, #708178);
  line-height: 1.45;
}

.enterprise-recognition-upload small { font-size: 12px; }
.enterprise-recognition-upload input { max-width: 100%; margin-top: 4px; }

.enterprise-recognition-source-grid .field {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.enterprise-recognition-text {
  min-height: 156px !important;
  max-height: 220px !important;
  resize: vertical;
}

.enterprise-recognition-notice,
.enterprise-recognition-status {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #d8e6dd;
  border-radius: 8px;
  background: #f4f8f5;
  color: var(--text-secondary, #708178);
  font-size: 13px;
  line-height: 1.5;
}

.enterprise-recognition-notice svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  color: var(--brand-accent, #31745b);
}

.enterprise-recognition-status.error {
  border-color: #efd0cd;
  background: #fcf3f2;
  color: #a74740;
}

.enterprise-recognition-results {
  margin-top: 18px;
  border-top: 1px solid var(--border-color, #dce6df);
  padding-top: 16px;
}

.enterprise-recognition-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.enterprise-recognition-section-head h4 { margin: 0 0 3px; color: var(--brand-primary, #153f35); font-size: 16px; }
.recognition-source-badge { padding: 5px 9px; border-radius: 999px; background: var(--brand-primary-soft, #edf3ef); color: var(--brand-primary, #153f35); font-size: 12px; }

.enterprise-duplicate-warning {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #ead6ae;
  border-radius: 9px;
  background: #fffaf0;
  color: #6c5428;
}

.enterprise-duplicate-title { display: flex; align-items: center; gap: 8px; }
.enterprise-duplicate-title svg { width: 17px; height: 17px; color: var(--status-warning, #d69a36); }
.enterprise-duplicate-warning > p { margin: 5px 0 10px; font-size: 12px; }
.enterprise-duplicate-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.enterprise-duplicate-cards article { display: grid; min-width: 0; gap: 3px; padding: 9px 10px; border: 1px solid #eadfc7; border-radius: 7px; background: #fff; font-size: 12px; }
.enterprise-duplicate-cards article span { overflow-wrap: anywhere; color: #705f3d; }
.enterprise-duplicate-cards article .btn { width: fit-content; min-height: 30px; margin-top: 4px; padding: 4px 8px; font-size: 12px; }

.enterprise-recognition-fields {
  display: grid;
  gap: 8px;
}

.enterprise-recognition-row {
  display: grid;
  grid-template-columns: minmax(130px, .55fr) minmax(280px, 1.45fr) minmax(150px, .7fr);
  gap: 12px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--border-color, #dce6df);
  border-radius: 8px;
  background: #fff;
}

.recognition-check {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  color: var(--text-primary, #263c34);
  font-weight: 600;
  cursor: pointer;
}

.recognition-check input { width: 16px; height: 16px; accent-color: var(--brand-primary, #153f35); }
.recognition-value { display: grid; min-width: 0; gap: 4px; }
.recognition-value input,
.recognition-address-target select { width: 100%; min-height: 40px; border: 1px solid var(--border-color, #dce6df); border-radius: 8px; background: #fff; color: var(--text-primary, #263c34); }
.recognition-value input:focus,
.recognition-address-target select:focus { border-color: var(--brand-accent, #31745b); box-shadow: 0 0 0 3px rgba(49, 116, 91, .12); outline: none; }
.recognition-value small { overflow: hidden; color: var(--text-secondary, #708178); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.recognition-review,
.recognition-address-target { display: grid; gap: 4px; }
.recognition-address-target label { color: var(--text-secondary, #708178); font-size: 11px; }
.recognition-confidence { width: fit-content; padding: 4px 7px; border-radius: 999px; font-size: 11px; }
.recognition-confidence.high { background: #e6f4ed; color: #177052; }
.recognition-confidence.medium { background: #fff2dc; color: #976511; }
.recognition-review small,
.recognition-address-target small { overflow-wrap: anywhere; color: var(--text-secondary, #708178); font-size: 11px; }
.recognition-overwrite-note { color: #ae5a21 !important; }

.enterprise-recognition-empty {
  display: flex;
  min-height: 120px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  color: var(--text-secondary, #708178);
  text-align: center;
}

.enterprise-recognition-empty svg { width: 26px; height: 26px; color: #91a69b; }
.enterprise-recognition-actions { flex: 0 0 auto; background: #fff; }

@media (max-width: 760px) {
  .enterprise-profile-dialog-title { align-items: flex-start; flex-direction: column; gap: 7px; }
  .enterprise-profile-dialog-title .btn.compact { min-height: 32px; }
  .enterprise-recognition-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .enterprise-recognition-dialog > form { max-height: calc(100dvh - 76px); }
  .enterprise-recognition-source-grid { grid-template-columns: 1fr; }
  .enterprise-recognition-upload { min-height: 130px; }
  .enterprise-recognition-text { min-height: 130px !important; }
  .enterprise-recognition-section-head { flex-direction: column; }
  .enterprise-duplicate-cards { grid-template-columns: 1fr; }
  .enterprise-recognition-row { grid-template-columns: 1fr; gap: 7px; }
  .recognition-check { min-height: 28px; }
  .enterprise-recognition-actions { flex-wrap: wrap; }
}
