/* Sales and customer workspaces. Load after the shared palette and layout.
   Screen-only; the output dialog and printed documents retain their own layout. */
@media screen {
  .sales-shell,
  #editor.sales-editor {
    --cw44-ink: var(--erp44-ink, #553e53);
    --cw44-muted: var(--erp44-muted, #816978);
    --cw44-line: var(--erp44-line, #e7d8df);
    --cw44-brand: var(--erp44-brand, #a83c72);
    --cw44-soft: var(--erp44-soft, #f9edf3);
    --cw44-radius: 12px;
    color: var(--cw44-ink);
  }

  .sales-shell { background: var(--erp44-bg, #f8f4ef); }
  .sales-shell #s-content { min-width: 0; }
  .sales-shell :is(.cw-heading, .s-heading) {
    align-items: center;
    justify-content: space-between !important;
    gap: 14px 24px;
    margin-bottom: 20px;
  }
  .sales-shell :is(.cw-heading, .s-heading) h1 {
    font-size: 22px;
    font-weight: 650;
    line-height: 1.45;
  }
  .sales-shell :is(.cw-heading, .s-heading) p {
    max-width: 780px;
    margin-top: 6px;
    color: var(--cw44-muted);
    font-size: 13px;
    line-height: 1.7;
  }
  .sales-shell :is(.cw-actions, .s-actions),
  #editor.sales-editor :is(.cw-actions, .s-actions) { gap: 8px; }
  .sales-shell :is(.cw-actions, .s-actions, .cw-toolbar, .s-toolbar, .ca-filter) button,
  #editor.sales-editor :is(.cw-actions, .s-actions, .s-footer) button {
    min-height: 36px;
    padding: 7px 12px;
    border-radius: 7px;
    font-size: 13px;
    line-height: 1.5;
    white-space: nowrap;
  }
  /* This replaces the legacy orange new-order override; semantic status colors remain. */
  html body #app .sales-shell button[data-cw="order-new"] {
    background: var(--erp44-brand, #a83c72) !important;
    border-color: var(--erp44-brand, #a83c72) !important;
    color: #fff !important;
  }
  html body #app .sales-shell button[data-cw="order-new"]:hover {
    background: var(--erp44-brand-strong, #89305d) !important;
    border-color: var(--erp44-brand-strong, #89305d) !important;
  }
  /* Beat form_refinements25.css's ID-scoped important customer-new colors. */
  html body #app .sales-shell button[data-cw="customer-new"] {
    background: var(--erp44-soft, #f9edf3) !important;
    border-color: var(--erp44-line, #e7d8df) !important;
    color: var(--erp44-purple, #75436e) !important;
  }
  html body #app .sales-shell button[data-cw="customer-new"]:hover:not(:disabled) {
    background: #f3e0eb !important;
    border-color: #cfa4bb !important;
    color: var(--erp44-brand-strong, #89305d) !important;
  }
  html body #app .shell > aside .brandmark {
    background: var(--erp44-brand, #a83c72) !important;
    color: #fff !important;
  }

  /* Customer identity is prominent once; supporting cards stay compact. */
  .sales-shell .cw-client-switch {
    max-width: 560px;
    gap: 14px;
    margin-bottom: 14px;
    padding: 11px 14px;
    border: 1px solid var(--cw44-line);
    border-radius: 9px;
    background: var(--erp44-surface, #fffdfa);
    font-size: 13px;
  }
  .sales-shell .cw-client-switch select { min-height: 38px; font-size: 14px; }
  .sales-shell .cw-customer-strip {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
    max-height: 246px;
    margin-bottom: 18px;
    padding-bottom: 3px;
    scrollbar-gutter: stable;
  }
  .sales-shell .cw-customer-strip > button {
    padding: 14px 16px;
    border-width: 1px;
    border-left-width: 3px;
    border-radius: 10px;
    line-height: 1.5;
  }
  .sales-shell .cw-customer-strip strong { font-size: 17px; font-weight: 650; }
  .sales-shell .cw-customer-strip small { margin-top: 8px; font-size: 12px; }
  .sales-shell .cw-customer-logo {
    width: 44px;
    height: 40px;
    margin-right: 10px;
    border-color: var(--erp44-line, #e7d8df);
    border-radius: 7px;
  }
  .sales-shell .cw-profile {
    gap: 18px 24px;
    padding: 20px 22px;
    margin: 16px 0;
    background: var(--erp44-surface, #fffdfa);
    border: 1px solid var(--cw44-line);
    border-left: 4px solid var(--cw44-brand);
    border-radius: var(--cw44-radius);
    box-shadow: 0 3px 12px #715a6808;
  }
  .sales-shell .cw-profile h2 { margin: 4px 0 9px; font-size: 24px; line-height: 1.4; }
  .sales-shell .cw-profile p { margin: 5px 0; color: var(--cw44-muted); font-size: 13px; }
  .sales-shell .cw-profile > div { min-width: 0; overflow-wrap: anywhere; }
  .sales-shell .cw-profile > .cw-actions { flex-shrink: 0; }
  .sales-shell .cw-tabs { gap: 6px; margin: 18px 0; padding-bottom: 7px; border-color: var(--cw44-line); }
  .sales-shell .cw-tabs button { min-height: 38px; padding: 8px 14px; border-radius: 7px; font-size: 13px; }
  .sales-shell .cw-customer-group {
    margin: 18px 0 24px;
    border-color: var(--cw44-line);
    border-radius: var(--cw44-radius);
    background: var(--erp44-surface, #fffdfa);
  }
  .sales-shell .cw-customer-group > header {
    padding: 15px 18px;
    gap: 16px;
    background: var(--erp44-surface, #fffdfa);
    border-color: var(--cw44-line);
  }
  .sales-shell .cw-customer-group > header > div { min-width: 0; }
  .sales-shell .cw-customer-group h2 { margin: 4px 0; font-size: 20px; line-height: 1.5; overflow-wrap: anywhere; }
  .sales-shell .cw-customer-group header :is(span, small) { margin: 3px 0; font-size: 12px; color: var(--cw44-muted); }
  .sales-shell .cw-customer-group header button { margin-top: 5px; min-height: 32px; padding: 5px 10px; font-size: 12px; border-radius: 6px; }

  /* Summary and filters share a consistent, shallow vertical rhythm. */
  .sales-shell :is(.cw-metrics, .s-cards) { gap: 12px; margin: 0 0 18px; }
  .sales-shell .cw-metrics > :is(button, section),
  .sales-shell .s-stat {
    padding: 14px 17px;
    border: 1px solid var(--cw44-line);
    border-radius: 10px;
    background: var(--erp44-surface, #fffdfa);
    text-align: left;
  }
  .sales-shell .cw-metrics > button small { font-size: 13px; color: var(--erp44-muted, #816978); }
  .sales-shell :is(.cw-metrics, .s-stat) strong { margin: 6px 0 4px; font-size: 26px; line-height: 1.2; font-weight: 650; font-variant-numeric: tabular-nums; }
  .sales-shell .s-stat strong { color: var(--erp44-purple, #75436e); }
  .sales-shell .cw-metrics > button span { color: var(--cw44-muted); font-size: 12px; }
  /* A metric marked primary has a solid brand background. Its nested labels
     and money spans must not retain the light-card text palette. */
  html body #app .sales-shell :is(.cw-metrics,.cd-metrics,.dash-metrics) > button:is(.primary,[data-erp-tone=primary],[data-erp-tone=order]) :is(span,strong,small,b,[data-erp-value]) {
    color: #fff !important;
    opacity: 1;
  }
  html body #app .sales-shell :is(.cw-metrics,.cd-metrics,.dash-metrics) > button:is(:hover,:focus-visible) {
    outline: 2px solid var(--erp44-brand, #a83c72);
    outline-offset: 3px;
  }
  .sales-shell .cw-status-bar44 { gap: 7px; margin: 16px 0 11px; }
  .sales-shell .cw-status-bar44 button { min-height: 36px; gap: 8px; padding: 7px 11px; font-size: 13px; }
  .sales-shell .cw-status-bar44 button b { font-weight: 600; font-variant-numeric: tabular-nums; }
  /* workflow.css styles #cw-filter with an important background; the selected
     status also carries an explicit legacy blue inset underline. */
  html body .sales-shell :is(#cw-filter,#wf-client-filter) {
    background: var(--erp44-surface, #fffdfa) !important;
    border-color: var(--erp44-line, #e7d8df);
  }
  html body .sales-shell .cw-status-bar44 button[aria-pressed=true] {
    background: var(--erp44-soft, #f9edf3) !important;
    border-color: #d3a5bd !important;
    color: var(--erp44-brand-strong, #89305d) !important;
    box-shadow: inset 0 -2px var(--erp44-brand, #a83c72);
  }
  .sales-shell .cw-status-bar44 button:not([data-status=attention]) b { background: var(--erp44-soft, #f9edf3); color: var(--erp44-purple, #75436e); }
  .sales-shell :is(.cw-toolbar, .s-toolbar, .ca-filter) {
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    padding: 15px 16px;
    margin: 0 0 16px;
    border: 1px solid var(--cw44-line);
    border-radius: 10px;
    background: var(--erp44-surface, #fffdfa);
  }
  .sales-shell :is(.cw-toolbar, .s-toolbar, .ca-filter) > label {
    gap: 6px;
    min-width: 130px;
    flex: 0 1 154px;
    color: var(--erp44-muted, #816978);
    font-size: 12px;
    font-weight: 500;
  }
  .sales-shell :is(.cw-toolbar, .ca-filter) > label:has(input[type=search]) { flex: 1 1 240px; max-width: 370px; }
  .sales-shell .cw-toolbar > label:has(input[type=checkbox]) { display: flex; flex-direction: row; align-items: center; flex-basis: auto; min-height: 38px; }
  .sales-shell :is(.cw-toolbar, .s-toolbar, .ca-filter) :is(input:not([type=checkbox]):not([type=radio]), select) {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 8px 10px;
    border-color: var(--erp44-line, #e7d8df);
    border-radius: 7px;
    font-size: 13px;
  }
  .sales-shell :is(.cw-toolbar, .s-toolbar, .ca-filter) button { min-height: 38px; }
  .sales-shell .cw-result-count44 { margin: 10px 1px; color: var(--cw44-muted); }
  .sales-shell .cw-service-heading { flex-wrap: wrap; gap: 12px 20px; padding: 14px 0; }
  .sales-shell .cw-service-heading .cw-actions { min-width: 0; }

  /* List cells retain full content; horizontal scrolling is local to the table. */
  .sales-shell #s-content .table-wrap,
  #editor.sales-editor :is(.table-wrap, .erp-table-scroll34) {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    border: 1px solid var(--cw44-line);
    border-radius: 10px;
    background: var(--erp44-surface, #fffdfa);
  }
  .sales-shell .cw-customer-group > .table-wrap { border: 0; border-radius: 0; }
  .sales-shell #s-content .s-table,
  #editor.sales-editor .s-table { font-size: 14px; line-height: 1.65; }
  .sales-shell #s-content .s-table :is(th, td),
  #editor.sales-editor .s-table :is(th, td) {
    padding: 12px 13px;
    border-left: 0;
    border-right: 0;
    font-size: 14px;
    line-height: 1.65;
  }
  .sales-shell #s-content .s-table th,
  #editor.sales-editor .s-table th { font-size: 12px; font-weight: 600; }
  .sales-shell #s-content .s-table td { vertical-align: top; }
  .sales-shell .s-table .cw-sub { margin-top: 5px; color: var(--cw44-muted); font-size: 12px; line-height: 1.55; }
  .sales-shell .s-table .cw-order-customer { font-size: 14px; font-weight: 500; margin: 5px 0 2px; color: var(--erp44-muted, #816978); }
  .sales-shell .s-table .cw-envelope { min-height: 27px; margin: 3px 0 3px 5px; padding: 3px 6px; font-size: 11px; }
  .sales-shell .s-table :is(.cw-alert, .s-badge, .cw-export-label) { font-size: 11px; line-height: 1.55; padding: 3px 6px; border-radius: 5px; }
  .sales-shell .s-table .cw-alert { white-space: normal; }
  .sales-shell .s-table .s-badge { display: inline-block; margin-block: 3px; }
  .sales-shell .s-table .ca-order-summary { min-width: 138px; padding-left: 10px; border-left-width: 2px; line-height: 1.7; }
  .sales-shell .s-table:has([data-wf-all]) { min-width: 1030px; }
  .sales-shell .s-table:has([data-wf-all]) :is(th, td):first-child { width: 38px; padding-inline: 11px; }
  .sales-shell .s-table:has([data-wf-all]) td:nth-child(2) { min-width: 148px; overflow-wrap: anywhere; }
  .sales-shell .s-table:has([data-wf-all]) td:nth-child(3) { min-width: 118px; max-width: 180px; overflow-wrap: anywhere; }
  .sales-shell .s-table:has([data-wf-all]) td:nth-child(4) { min-width: 152px; font-variant-numeric: tabular-nums; }
  .sales-shell .s-table:has([data-wf-all]) td:nth-child(4) > strong { display: block; white-space: nowrap; color: var(--erp44-gold, #a66117); font-size: 14px; font-weight: 650; }
  .sales-shell .s-table:has([data-wf-all]) td:nth-child(5) { min-width: 125px; max-width: 174px; font-variant-numeric: tabular-nums; }
  .sales-shell .s-table:has([data-wf-all]) td:nth-child(5) > strong { font-weight: 600; }
  .sales-shell .s-table:has([data-wf-all]) td:nth-child(6) { min-width: 185px; max-width: 246px; }
  .sales-shell .s-table:has([data-wf-all]) td:nth-child(6) > strong { font-size: 12px; font-weight: 600; }
  .sales-shell .s-table:has([data-wf-all]) td:nth-child(6) > .cw-sub:last-child { color: var(--erp44-muted, #816978); font-size: 11px; }
  .sales-shell .s-table:has([data-wf-all]) td:has(> .cw-actions) { min-width: 186px; width: 186px; }
  .sales-shell .s-table:has([data-wf-all]) td > .cw-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 6px; }
  .sales-shell .s-table:has([data-wf-all]) td > .cw-actions button { min-height: 34px; padding: 6px 7px; font-size: 12px; }
  .sales-shell .s-table:has([data-wf-all]) .cw-actions button[data-erp-tone] { --erp-action-soft34: var(--erp44-surface, #fffdfa); }
  .sales-shell .s-table:has([data-wf-all]) .cw-actions button[data-cw="progress"] { --erp-action-soft34: var(--erp44-soft, #f9edf3); --erp-action-line34: var(--erp44-line, #e7d8df); --erp-action34: var(--erp44-brand, #a83c72); }
  .sales-shell .s-table:has([data-wf-all]) .cw-actions button[data-cw="order-delete"] { grid-column: 1 / -1; --erp-action-soft34: var(--erp44-surface, #fffdfa); --erp-action-line34: #f0d2d2; }
  .sales-shell .order-selection-bar { gap: 10px 14px; margin: 12px; padding: 10px 12px; border-radius: 8px; box-shadow: 0 3px 10px #715a6810; }
  .sales-shell .order-selection-bar button { min-height: 34px; padding: 6px 10px; font-size: 12px; border-radius: 6px; }
  .sales-shell :is(.s-panel, .s-step) { border-color: var(--cw44-line); border-radius: var(--cw44-radius); }
  .sales-shell .s-panel { padding: 18px; }

  /* Existing drawer head and footer stay fixed; only the form body scrolls. */
  html body #editor.sales-editor .erp-drawer-head34 { padding: 18px 24px !important; }
  html body #editor.sales-editor .erp-drawer-head34 h2 { font-size: 20px; font-weight: 650; }
  html body #editor.sales-editor .erp-drawer-scroll34 { padding: 22px 24px !important; background: var(--erp44-bg, #f8f4ef); }
  html body #editor.sales-editor .erp-drawer-foot34 { padding: 13px 24px !important; background: var(--erp44-surface, #fffdfa); gap: 9px; }
  #editor.sales-editor .erp-drawer-foot34 > button { min-height: 40px; min-width: 82px; }
  #editor.sales-editor .erp-drawer-foot34 > [data-cw="order-delete"] { margin-right: auto; }
  #editor.sales-editor .s-formgrid { gap: 16px 18px; }
  #editor.sales-editor .s-formgrid > label { gap: 6px; font-size: 13px; font-weight: 500; color: var(--erp44-muted, #816978); }
  #editor.sales-editor .s-formgrid :is(input:not([type=checkbox]):not([type=radio]), select, textarea) { border-color: var(--erp44-line, #e7d8df); border-radius: 7px; font-size: 14px; }
  #editor.sales-editor .s-formgrid textarea { min-height: 82px; line-height: 1.7; }
  #editor.sales-editor :is(.s-formgrid, .cw-line-grid) :is(input, select, textarea):focus { outline: 2px solid var(--erp44-brand, #a83c72); outline-offset: 1px; border-color: var(--erp44-brand, #a83c72); }
  #editor.sales-editor .s-section { margin: 18px 0; padding: 0; border: 1px solid var(--cw44-line); border-radius: 10px; background: var(--erp44-surface, #fffdfa); }
  #editor.sales-editor .s-section > summary { padding: 13px 15px; border: 0; border-radius: 9px; background: var(--erp44-soft, #f9edf3); color: var(--erp44-purple, #75436e); font-size: 14px; font-weight: 600; }
  #editor.sales-editor .s-section[open] { padding-bottom: 15px; }
  #editor.sales-editor .s-section[open] > summary { margin-bottom: 15px; border-bottom: 1px solid var(--cw44-line); border-radius: 9px 9px 0 0; }
  #editor.sales-editor .s-section > :not(summary) { margin-inline: 15px; }
  #editor.sales-editor .s-section:not(details) { padding: 15px; }
  #editor.sales-editor .s-section:not(details) > * { margin-inline: 0; }
  #editor.sales-editor .cw-picker { margin: 22px 0 14px; }
  #editor.sales-editor .cw-picker h3 { margin: 0 0 12px; font-size: 16px; font-weight: 650; }
  #editor.sales-editor .cw-picker .cw-actions input { flex: 1 1 240px; min-width: 0; max-width: 420px; min-height: 38px; }
  #editor.sales-editor .cw-pick-row { gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px; background: var(--erp44-surface, #fffdfa); }
  #editor.sales-editor #cw-lines { border-color: var(--cw44-line); border-radius: 10px; background: var(--erp44-surface, #fffdfa); }
  #editor.sales-editor .cw-grid-head { background: var(--erp44-soft, #f9edf3); border-color: var(--erp44-line, #e7d8df); color: var(--erp44-muted, #816978); font-size: 12px; font-weight: 600; padding-block: 11px; }
  #editor.sales-editor .cw-line-grid { padding-block: 12px; margin-bottom: 0; }
  #editor.sales-editor .compact-order-line { border-bottom-color: var(--erp44-line, #e7d8df) !important; }
  #editor.sales-editor .compact-order-line:nth-child(odd) { background: var(--erp44-surface, #fffdfa); }
  #editor.sales-editor .compact-order-line:focus-within { background: var(--erp44-soft, #f9edf3); }
  #editor.sales-editor .cw-line-grid input { min-height: 38px; padding: 7px; border-color: var(--erp44-line, #e7d8df); border-radius: 6px; font-size: 13px; }
  #editor.sales-editor .cw-line-grid input[type=number] { text-align: right; font-variant-numeric: tabular-nums; }
  #editor.sales-editor .cw-line-grid .row-index { color: var(--erp44-muted, #816978); text-align: center; font-size: 12px; }
  #editor.sales-editor .cw-line-grid .row-amount { font-size: 13px; font-variant-numeric: tabular-nums; }
  #editor.sales-editor .cw-line-grid > button { min-height: 34px; padding: 5px; font-size: 12px; }
  #editor.sales-editor .row-extra { padding-bottom: 12px; color: var(--cw44-muted); }
  #editor.sales-editor .row-extra summary { cursor: pointer; line-height: 1.6; }
  #editor.sales-editor .row-extra textarea { width: 100%; max-width: 650px; }
  #editor.sales-editor .cw-line-match:not(:empty) { margin: 0 12px 12px; padding: 9px 11px; background: #f0f8f5; border-color: #cce7dc; font-size: 12px; }
  #editor.sales-editor #cw-total { position: static; margin: 12px 0 20px; padding: 13px 16px; border-color: #efdcc7; background: #fff8ef; line-height: 1.7; font-size: 14px; }
  #editor.sales-editor .s-formgrid > .cw-total { grid-column: 1 / -1; margin: 0; padding: 10px 13px; background: #fff8ef; font-size: 12px; line-height: 1.7; }
  #editor.sales-editor .confirmed-hint { align-self: stretch; margin: 0; padding: 12px 14px; border: 1px solid #d7eadd; font-size: 13px; line-height: 1.7; }
  #editor.sales-editor .cw-footnote { margin: 16px 0 0; color: var(--cw44-muted); font-size: 12px; }

  /* Detail cards use headings for labels, leaving values free to wrap fully. */
  .sales-shell .cw-info:not(.shipment-workspace),
  #editor.sales-editor .cw-info:not(.shipment-workspace) { gap: 12px; margin: 18px 0; }
  .sales-shell .cw-info > section,
  #editor.sales-editor .cw-info > section { min-width: 0; padding: 15px 17px; background: var(--erp44-surface, #fffdfa); border: 1px solid var(--cw44-line); border-radius: 10px; }
  .sales-shell .cw-info h3,
  #editor.sales-editor .cw-info h3 { margin: 0 0 8px; color: var(--erp44-muted, #816978); font-size: 12px; font-weight: 500; }
  .sales-shell .cw-info p,
  #editor.sales-editor .cw-info p { color: var(--erp44-ink, #553e53); font-size: 13px; line-height: 1.85; }
  #editor.sales-editor .erp-drawer-scroll34 > .cw-actions { padding-bottom: 13px; border-bottom: 1px solid var(--cw44-line); }
  #editor.sales-editor .erp-drawer-scroll34 > .cw-actions + .cw-info > section { border-color: var(--erp44-line, #e7d8df); background: var(--erp44-soft, #f9edf3); }
  #editor.sales-editor .erp-drawer-scroll34 > .cw-actions + .cw-info h3 { color: var(--erp44-purple, #75436e); font-size: 16px; font-weight: 650; }
  #editor.sales-editor .s-table { min-width: 640px; }
  #editor.sales-editor .s-table td { max-width: 320px; vertical-align: top; white-space: normal; overflow-wrap: anywhere; }
  #editor.sales-editor #s-variants .s-table { min-width: 850px; }
  #editor.sales-editor .s-table .s-photo { width: 54px; height: 62px; margin-right: 0; border: 1px solid var(--erp44-line, #e7d8df); background: var(--erp44-surface, #fffdfa); }
  #editor.sales-editor .s-error:not(:empty) { padding: 12px 14px; border: 1px solid #f0cbca; border-radius: 8px; background: #fff5f4; font-size: 13px; line-height: 1.7; }

  @media (max-width: 1100px) {
    .sales-shell :is(.cw-heading, .s-heading) { align-items: flex-start; }
    .sales-shell .cw-profile { flex-wrap: wrap; }
    .sales-shell :is(.cw-toolbar, .ca-filter) > label:has(input[type=search]) { max-width: none; }
    .sales-shell .cw-customer-strip { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
  }

  @media (max-width: 800px) {
    .sales-shell :is(.cw-heading, .s-heading) { gap: 12px; }
    .sales-shell .cw-profile { padding: 17px; }
    .sales-shell .cw-profile h2 { font-size: 21px; }
    .sales-shell .cw-customer-group > header { padding: 13px 15px; flex-wrap: wrap; }
    .sales-shell .cw-customer-group h2 { font-size: 18px; }
    .sales-shell .cw-customer-group > header > div:last-child { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
    .sales-shell .cw-customer-group header button { margin-top: 0; }
    .sales-shell :is(.cw-toolbar, .ca-filter) > label { flex: 1 1 140px; }
    .sales-shell :is(.cw-toolbar, .ca-filter) > label:has(input[type=search]) { flex-basis: 100%; }
    .sales-shell :is(.cw-info, .s-formgrid) { grid-template-columns: minmax(0, 1fr); }

    /* Column headings become the same visible labels on each editable field. */
    #editor.sales-editor #cw-lines { overflow-x: visible; border: 0; border-radius: 0; background: transparent; }
    #editor.sales-editor .cw-grid-head { display: none; }
    #editor.sales-editor .cw-line.compact-order-line {
      min-width: 0;
      margin: 0 0 14px !important;
      border: 1px solid var(--erp44-line, #e7d8df) !important;
      border-radius: 10px !important;
      background: var(--erp44-surface, #fffdfa);
    }
    #editor.sales-editor .cw-line-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; gap: 12px; padding: 14px; align-items: end; }
    #editor.sales-editor .cw-line-grid > .row-index { grid-column: 1 / -1; text-align: left; color: var(--erp44-purple, #75436e); font-size: 13px; font-weight: 600; }
    #editor.sales-editor .cw-line-grid > .row-index::before { content: "货品 "; }
    #editor.sales-editor .cw-line-grid > .cw-line-photo { grid-column: 1 / -1; border-bottom: 0; padding-bottom: 0; }
    #editor.sales-editor .cw-line-grid .s-upload { display: flex !important; flex-wrap: wrap; align-items: center; gap: 10px; }
    #editor.sales-editor .cw-line-grid .s-upload img { width: 64px !important; height: 64px !important; margin: 0; }
    #editor.sales-editor .cw-line-grid .s-upload label { min-width: 0; font-size: 12px; }
    #editor.sales-editor .cw-line-grid .s-upload input[type=file] { width: 100%; max-width: 240px; min-height: 34px; font-size: 12px; }
    #editor.sales-editor .cw-line-grid label { display: grid; gap: 6px; }
    #editor.sales-editor .cw-line-grid > label:nth-of-type(3) { grid-column: 1 / -1; }
    #editor.sales-editor .cw-line-grid .cell-label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; color: var(--erp44-muted, #816978); font-size: 12px; font-weight: 500; }
    #editor.sales-editor .cw-line-grid input { min-height: 40px; font-size: 14px; }
    #editor.sales-editor .cw-line-grid .row-amount { padding-block: 8px; text-align: left; }
    #editor.sales-editor .cw-line-grid .row-amount::before { content: "未税金额 "; color: var(--erp44-muted, #816978); font-size: 12px; font-weight: 400; }
    #editor.sales-editor .cw-line-grid > button { justify-self: end; min-width: 70px; min-height: 38px; }
    #editor.sales-editor .row-extra { padding: 0 14px 14px; font-size: 13px; }
    #editor.sales-editor .cw-line-match:not(:empty) { margin-inline: 14px; }
  }

  @media (max-width: 600px) {
    .sales-shell :is(.cw-toolbar, .s-toolbar, .ca-filter) { gap: 10px; padding: 13px; }
    .sales-shell .cw-client-switch { display: grid; gap: 8px; width: 100%; }
    .sales-shell .cw-client-switch select { min-width: 0; width: 100%; }
    .sales-shell .cw-customer-strip { grid-template-columns: minmax(0, 1fr); max-height: 216px; }
    .sales-shell .cw-metrics { gap: 7px; }
    .sales-shell .cw-metrics > :is(button, section) { padding: 12px 10px; min-width: 0; }
    .sales-shell .cw-metrics > button small { font-size: 12px; }
    .sales-shell .cw-metrics strong { font-size: 22px; }
    .sales-shell .cw-metrics > button span { font-size: 11px; }
    .sales-shell .cw-tabs { gap: 5px; }
    .sales-shell .cw-tabs button { padding: 8px 10px; font-size: 12px; }
    .sales-shell .cw-status-bar44 button { flex: 1 0 auto; justify-content: center; }
    .sales-shell .order-selection-bar { margin: 10px; }
    .sales-shell .order-selection-bar details { min-width: 115px; }
    html body #editor.sales-editor .erp-drawer-head34 { padding: 15px 16px !important; }
    html body #editor.sales-editor .erp-drawer-head34 h2 { font-size: 18px; }
    html body #editor.sales-editor .erp-drawer-scroll34 { padding: 16px !important; }
    html body #editor.sales-editor .erp-drawer-foot34 { padding: 12px 16px max(12px, env(safe-area-inset-bottom)) !important; }
    #editor.sales-editor .cw-info { grid-template-columns: minmax(0, 1fr); }
    #editor.sales-editor .cw-info > section { padding: 14px; }
    #editor.sales-editor .s-section > :not(summary) { margin-inline: 12px; }
    #editor.sales-editor .s-section:not(details) > * { margin-inline: 0; }
    #editor.sales-editor .cw-picker .cw-actions input { flex-basis: 100%; max-width: none; }
    #editor.sales-editor .cw-picker .cw-actions button { flex: 1 1 auto; }
  }
}

/* Brand-color completion for catalog details and the shared AI widget.
   Color properties only: visibility, selected/disabled state and geometry stay
   with the original components. Green/red inventory values retain their meaning. */
@media screen {
  .sales-shell :is(.price-value, .peer-summary-row strong),
  #editor.sales-editor .pricing-hero .price-value { color: var(--erp44-gold, #a66117); }
  .sales-shell :is(.price-basis, .comparison-caption, .peer-summary-row small, .cc42-no-photo),
  #editor.sales-editor :is(.detail-eyebrow, .pricing-hero small, .cc42-selection p, .cc42-status-intro p) { color: var(--erp44-muted, #816978); }
  #editor.sales-editor .pricing-hero { background: var(--erp44-soft, #f9edf3); border-color: var(--erp44-line, #e7d8df); }
  #editor.sales-editor .pricing-hero h2 { color: var(--erp44-purple, #75436e); }
  #editor.sales-editor .pricing-hero .s-photo { background: var(--erp44-surface, #fffdfa); }
  #editor.sales-editor .form-section-title { background: var(--erp44-soft, #f9edf3); border-color: var(--erp44-brand, #a83c72); color: var(--erp44-purple, #75436e); }
  #editor.sales-editor .cc42-info dl > div { border-color: var(--erp44-line, #e7d8df); }
  #editor.sales-editor .cc42-info dd { color: var(--erp44-ink, #553e53); }
  .sales-shell .cc42-card:not(.card-chosen) { border-color: var(--erp44-line, #e7d8df); box-shadow: 0 5px 18px #75436e08; }
  .sales-shell .cc42-card:not(.card-chosen):hover { border-color: #d0a6bd; box-shadow: 0 8px 24px #75436e13; }
  .sales-shell .cc42-off .cc42-price { color: var(--erp44-muted, #816978); }
  .sales-shell .cc42-card-foot button:not(.primary):not(:disabled) {
    --erp-action34: var(--erp44-brand-strong, #89305d);
    --erp-action-soft34: var(--erp44-soft, #f9edf3);
    --erp-action-line34: var(--erp44-line, #e7d8df);
    background: var(--erp44-soft, #f9edf3);
    border-color: var(--erp44-line, #e7d8df);
    color: var(--erp44-brand-strong, #89305d);
  }
  /* The green quote/picked controls and unavailable-state colors are unchanged. */
  html body #app .sales-shell #s-content .cc43-selection-bar [data-card-order] {
    background: var(--erp44-soft, #f9edf3) !important;
    border-color: var(--erp44-line, #e7d8df) !important;
    color: var(--erp44-brand-strong, #89305d) !important;
  }
  .sales-shell .card-compact-body [data-catalog-stock38],
  #editor.sales-editor :is(.cs38-product, .cs38-preview) { background: var(--erp44-soft, #f9edf3); border-color: var(--erp44-line, #e7d8df); color: var(--erp44-ink, #553e53); }
  .sales-shell :is(.cs38-summary, .cs38-spec > span:first-child),
  #editor.sales-editor .cs38-editor { color: var(--erp44-ink, #553e53); }
  .sales-shell :is(.cs38-value small, .cs38-caption),
  #editor.sales-editor :is(.cs38-ledger-note, .cs38-delta, .cs38-history article small) { color: var(--erp44-muted, #816978); }
  .sales-shell .cs38-specs,
  #editor.sales-editor :is(.cs38-stock-table, .cs38-stock-table td, .cs38-history, .cs38-history article) { border-color: var(--erp44-line, #e7d8df); }
  .sales-shell .cs38-more > summary,
  #editor.sales-editor .cs38-history summary { color: var(--erp44-brand, #a83c72); }
  .sales-shell .cs38-page-note { background: var(--erp44-soft, #f9edf3); border-color: var(--erp44-line, #e7d8df); color: var(--erp44-muted, #816978); }
  .sales-shell .cs38-page-note > b { color: var(--erp44-purple, #75436e); }
  html body #app .sales-shell button.cs38-edit,
  html body #editor.sales-editor button.cs38-submit {
    background: var(--erp44-brand, #a83c72) !important;
    border-color: var(--erp44-brand, #a83c72) !important;
    color: #fff !important;
  }
  html body #app .sales-shell button.cs38-edit:hover:not(:disabled),
  html body #editor.sales-editor button.cs38-submit:hover:not(:disabled) {
    background: var(--erp44-brand-strong, #89305d) !important;
    border-color: var(--erp44-brand-strong, #89305d) !important;
    color: #fff !important;
  }
  html body #app .sales-shell button.cs38-view {
    background: var(--erp44-soft, #f9edf3) !important;
    border-color: var(--erp44-line, #e7d8df) !important;
    color: var(--erp44-brand-strong, #89305d) !important;
  }

  #erp-ai-widget,
  dialog.aq-dialog { color: var(--erp44-ink, #553e53); }
  #erp-ai-widget .aq-chat,
  dialog.aq-dialog { background: var(--erp44-surface, #fffdfa); border-color: var(--erp44-line, #e7d8df); box-shadow: 0 18px 64px #553e5326, 0 2px 9px #553e5309; }
  #erp-ai-widget .aq-chat-head { background: linear-gradient(110deg, var(--erp44-soft, #f9edf3), var(--erp44-surface, #fffdfa)); border-color: var(--erp44-line, #e7d8df); }
  #erp-ai-widget .aq-chat-avatar { background: var(--erp44-brand, #a83c72); color: #fff; }
  /* The <use> instance has its own SVG shadow tree. Match the symbol's own
     paint nodes directly, without requiring the outer widget ancestor. */
  #aq-chat-icon > circle { fill: var(--erp44-brand, #a83c72) !important; }
  #aq-chat-icon > path[stroke="#17ad68"] { stroke: var(--erp44-brand, #a83c72) !important; }
  #erp-ai-widget :is(.aq-launcher, .aq-chat-avatar) > svg,
  #erp-ai-widget use[href="#aq-chat-icon"] { color: #fff !important; }
  #erp-ai-widget :is(.aq-chat-title h2, .aq-greeting),
  dialog.aq-dialog :is(h2, h3) { color: var(--erp44-purple, #75436e); }
  #erp-ai-widget :is(.aq-chat-title p, .aq-scope, .aq-intro-label, .aq-intro-copy, .aq-suggest-label, .aq-intro-tip, .aq-time, .aq-assistant-label, .aq-source dt, .aq-source-footer, .aq-answer-foot, .aq-key-hint, .aq-disclosure) { color: var(--erp44-muted, #816978); }
  #erp-ai-widget :is(.aq-scope strong, .aq-scope svg, .aq-assistant-label svg, .aq-suggest svg) { color: var(--erp44-brand, #a83c72); }
  #erp-ai-widget .aq-scope { border-color: var(--erp44-line, #e7d8df); }
  #erp-ai-widget .aq-scope select,
  dialog.aq-dialog input { background: #fff; border-color: var(--erp44-line, #e7d8df); color: var(--erp44-ink, #553e53); }
  #erp-ai-widget .aq-messages { background: var(--erp44-bg, #f8f4ef); scrollbar-color: #dac3d2 transparent; }
  #erp-ai-widget .aq-bubble-user { background: var(--erp44-soft, #f9edf3); border-color: var(--erp44-line, #e7d8df); color: var(--erp44-ink, #553e53); }
  #erp-ai-widget :is(.aq-source, .aq-compose) { background: var(--erp44-surface, #fffdfa); border-color: var(--erp44-line, #e7d8df); }
  #erp-ai-widget .aq-source dd { color: var(--erp44-ink, #553e53); }
  #erp-ai-widget .aq-source-footer,
  dialog.aq-dialog td { border-color: var(--erp44-line, #e7d8df); }
  #erp-ai-widget .aq-composer-box { background: #fff; border-color: var(--erp44-line, #e7d8df); }
  #erp-ai-widget .aq-composer-box:focus-within { border-color: var(--erp44-brand, #a83c72); box-shadow: 0 0 0 2px var(--erp44-soft, #f9edf3); }
  #erp-ai-widget textarea { color: var(--erp44-ink, #553e53); }
  #erp-ai-widget textarea::placeholder { color: var(--erp44-muted, #816978); }
  #erp-ai-widget .aq-quick-follow { background: var(--erp44-soft, #f9edf3); border-color: var(--erp44-line, #e7d8df); color: var(--erp44-brand-strong, #89305d); }
  html body #erp-ai-widget button:is(.aq-launcher, .aq-send),
  html body dialog.aq-dialog button[type=submit] {
    background: var(--erp44-brand, #a83c72) !important;
    border-color: var(--erp44-brand, #a83c72) !important;
    color: #fff !important;
  }
  #erp-ai-widget .aq-launcher { box-shadow: 0 7px 24px #a83c7229; }
  html body #erp-ai-widget button:is(.aq-launcher, .aq-send):hover:not(:disabled),
  html body dialog.aq-dialog button[type=submit]:hover:not(:disabled) {
    background: var(--erp44-brand-strong, #89305d) !important;
    border-color: var(--erp44-brand-strong, #89305d) !important;
    color: #fff !important;
  }
  html body #erp-ai-widget .aq-icon-button { color: var(--erp44-muted, #816978) !important; }
  html body #erp-ai-widget .aq-icon-button:hover:not(:disabled) { background: var(--erp44-soft, #f9edf3) !important; color: var(--erp44-brand-strong, #89305d) !important; }
  html body #erp-ai-widget .aq-suggest { background: var(--erp44-surface, #fffdfa) !important; border-color: var(--erp44-line, #e7d8df); color: var(--erp44-ink, #553e53) !important; }
  html body #erp-ai-widget .aq-suggest:hover:not(:disabled) { background: var(--erp44-soft, #f9edf3) !important; border-color: #d0a6bd; }
  html body #erp-ai-widget .aq-source-footer button { color: var(--erp44-brand, #a83c72) !important; }
  #erp-ai-widget button:focus-visible,
  dialog.aq-dialog :is(button, input, a):focus-visible { outline-color: var(--erp44-brand, #a83c72); }
  dialog.aq-dialog::backdrop { background: #553e5340; }
}
