/* Shared, readable screen typography and purchasing layout. Print documents keep their own styles. */
body { font-size: 14px; line-height: 1.5; }
button, input, select, textarea { font-family: inherit; }
body:not([data-ui-primitives="v1"]) :is(input:focus, select:focus, textarea:focus, .input:focus) {
  border-color: #aebfcd !important; box-shadow: none !important; outline: none !important;
}
body:not([data-ui-primitives="v1"]) :is(input:focus-visible, select:focus-visible, textarea:focus-visible) {
  outline: 1px solid #8198aa !important; outline-offset: 1px;
}
body:not([data-ui-primitives="v1"]) :is(.unit-picker:focus-within, .component-supplier-line:focus-within) {
  border-color: #aebfcd !important; box-shadow: none !important;
}
.input, button, select, textarea, .field input, .field select { font-size: 14px; }
.field > span, label.field > span, .criteria-label, .deal-source-field > span,
.sales-table .lead-time-title, .sales-table .position-lead-time label span,
.sales-table .purchase-routing-field > label > span,
.sales-table .component-purchase-row > td[data-column]::before,
.sales-table > thead > tr > th, .sales-table > thead > tr > th span { font-size: 14px; }
.help, .muted, small, .badge, .field > span, .server-session-label { font-size: 13px; }
.app-rail { width: 88px; }
.workspace { margin-left: 88px; }
.rail-button { width: 80px; font-size: 12px; white-space: nowrap; padding-left: 3px; padding-right: 3px; }
.page-heading { gap: 20px; flex-wrap: wrap; }
.page-heading h1 { font-size: 26px; line-height: 1.3; overflow-wrap: anywhere; }
#main .back-link, .deal-heading-left > .muted, .deal-heading-left > .muted span,
.deal-heading-left > .muted label, .deal-source-field > span, .deal-repeat-toggle { font-size: 13px; }
.deal-heading-left .deal-manager-input, #main .button, #main .link-button { font-size: 14px; }
.deal-source-field { flex: 0 1 auto; width: max-content; max-width: 100%; min-width: 0; }
.deal-source-field select { width: 100%; min-width: 0; max-width: 100%; field-sizing: content; }
.deal-source-field .input { width: max-content; min-width: min(100%, 39ch); padding-right: 30px; }
.page-actions { max-width: 100%; flex-wrap: wrap; }
.crm-settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 20px; }
.crm-settings-grid h2 { font-size: 18px; margin: 0 0 18px; }
.settings-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.deal-badge-card .card-body { display: flex; gap: 18px; align-items: end; flex-wrap: wrap; }
.deal-badge-card .field { width: 240px; max-width: 100%; margin: 0; }
.deal-badge { display: inline-block; width: fit-content; max-width: 100%; border-radius: 20px; padding: 4px 14px; font-size: 13px; line-height: 1.5; font-weight: 600; white-space: nowrap; }
.deal-badge-urgent { background: #f9dce1; color: #91283e; }
.deal-badge-remember { background: #e1efcf; color: #3e611d; }
.deal-badge-tolerates { background: #d7eef6; color: #235f78; }
.deal-badge-not-urgent { background: #ffebcb; color: #79551b; }
.deal-tile .deal-badge { margin: 10px 0 4px; }
.view-switcher { display: flex; gap: 0; border: 1px solid #bdc8d1; border-radius: 6px; overflow: hidden; width: fit-content; }
.view-switcher .button { border: 0; border-radius: 0; margin: 0; padding: 9px 16px; }
.view-switcher .button[aria-pressed=true] { background: #dde8e0; color: #294e36; box-shadow: inset 0 -2px #7d9d86; }
.deals-list-mode, .production-list { min-width: 0; width: 100%; }
.crm-data-list { width: 100%; table-layout: fixed; border-collapse: collapse; border: 1px solid #dce2e7; background: white; }
.crm-data-list th, .crm-data-list td { width: auto; text-align: left; padding: 14px 12px; vertical-align: top; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; border-bottom: 1px solid #e2e7eb; }
.crm-data-list th { color: #536772; background: #eaf0f4; font-size: 13px; font-weight: 600; }
.crm-data-list th:first-child { width: 24%; }
.crm-data-list .list-title { text-align: left; padding: 0; color: #334e61; font-size: 15px; font-weight: 600; white-space: normal; }
.crm-data-list tbody tr:hover { background: #f7faf8; }
.crm-data-list .deal-badge { white-space: normal; }
@media(max-width:1100px) {
  .crm-data-list, .crm-data-list tbody { display: block; }
  .crm-data-list thead { display: none; }
  .crm-data-list tbody tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding: 12px; gap: 12px; border-bottom: 1px solid #dce2e7; }
  .crm-data-list td { display: block; width: auto; min-width: 0; padding: 0; border: 0; }
  .crm-data-list td:first-child { grid-column: 1 / -1; }
  .crm-data-list td::before { content: attr(data-label); display: block; font-size: 13px; color: #536772; margin-bottom: 4px; }
}
@media(max-width:500px) {
  .crm-data-list tbody tr { grid-template-columns: minmax(0,1fr); }
}
.crm-settings-grid .card-body { padding: 22px; }
.production-settings-dialog { width: min(900px,94vw); max-height: 90vh; padding: 0; border: 0; border-radius: 10px; overflow: auto; }
.production-settings-dialog fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.production-stage-setting { display: grid; grid-template-columns: 40px minmax(0,1fr) auto 32px 32px; gap: 10px; align-items: center; margin-bottom: 10px; }
.production-stage-setting .input { width: 100%; min-width: 0; }
@media(max-width:600px) { .production-stage-setting { grid-template-columns: 32px minmax(0,1fr) 32px 32px; } .production-stage-setting label { grid-column: 2; grid-row: span 1; } }

.sales-table-wrap { overflow-x: visible; }
.sales-table { width: 100%; min-width: 0; --sale-row-padding: 12px; --measure-number-width: 72px; --measure-unit-width: var(--crm-measure-unit-width,80px); }
.sales-table input:not([type=checkbox]), .sales-table select, .sales-table .input,
.production-form .input { min-height: 36px; height: auto; font-size: 14px; }
.sales-table input:not([type=checkbox]), .sales-table select, .sales-table button:not(.icon-button),
.sales-table .component-kind, .sales-table .component-inline-supplier { font-size: 14px !important; }
.sales-table .unit-picker > .unit-choice { font-size: 0 !important; }
.sales-table .item-number, .sales-table .sales-inline-value > .item-number,
.sales-table .component-inline-value > .input, .sales-table .availability-editor > .availability-quantity,
.sales-table .unit-picker > input.input { font-size: 14px; min-height: 34px; height: 34px; }
.sales-table .unit-picker { height: 36px; }
.sales-table .unit-picker > .unit-choice { min-height: 34px; height: 34px; font-size: 0; }
.sales-table .sales-inline-value, .sales-table .component-inline-value, .sales-table .availability-editor { height: auto; }
.sales-table .sales-inline-value > span, .sales-table .component-inline-value > span { height: auto; min-height: 36px; line-height: 36px; font-size: 13px; }
.sales-table .sales-inline-value > span, .sales-table .component-inline-value > span,
.sales-table .sale-price-unit, .sales-table .sale-amount-values > strong,
.sales-table .sale-amount-values > small, .sales-table .technical-spec-cell,
.sales-table .technical-spec-cell .technical-spec-link, .sales-table .technical-spec-cell small,
.sales-table .technical-spec-state, .sales-table .technical-spec-stale,
.sales-table .technical-spec-unneeded { font-size: 14px !important; }
.sales-table .sales-inline-value > .item-number, .sales-table .unit-picker > input.input {
  min-height: 36px; height: 36px;
}
.sales-table .sales-inline-value > .item-number[data-field=price] { height: 36px; min-height: 36px; }
.sales-table .sales-inline-value { max-width: none; grid-template-columns: var(--measure-number-width) var(--measure-unit-width); }
.sales-table .position-lead-time input[data-lead-time-field=from] { width: var(--measure-number-width); }
.sales-table .position-lead-time input[data-lead-time-field=to] { width: var(--measure-unit-width); }
.sales-table .sale-amount-values > strong { display: block; min-height: 36px; line-height: 36px !important; }
.sales-table .sale-position-actions { min-height: 36px; align-items: center; }
.sales-table .technical-spec-unneeded { display: flex; align-items: center; min-height: 36px; }
.sales-table .sale-position-type { width: 145px; max-width: 100%; min-width: 0; padding-right: 22px; font-size: 14px; }
.sales-table .sale-type-heading { flex-basis: 145px; }
.sales-table .sale-name-line { display: grid; grid-template-columns: minmax(0,145px) 24px 20px minmax(0,1fr); justify-content: start; gap: 8px; }
.sales-table .sale-name-line > input[data-field=name], .sales-table .sale-name-line > [data-product-search] { grid-column: 1 / -1; min-width: 0; width: 100%; font-size: 14px; min-height: 36px; height: 36px; margin: 0; }
.sales-table .sale-name-line .sale-include { width: 18px; height: 18px; }
.sales-table .item-row .item-source { width: auto; margin: 8px 0 0; padding-left: 0; font-size: 14px; color: #536772; white-space: normal; overflow-wrap: anywhere; }
.sales-table .sale-name-line input[data-field=name] { color: #293f50; font-weight: 600; }
.sales-table .item-row .sale-kind, .sales-table .item-row td > .help,
.sales-table .item-row td.amount small, .technical-spec-state, .technical-spec-stale { font-size: 13px; }
.sales-table > thead > tr > th, .sales-table > thead > tr > th span,
.sales-table .lead-time-title, .sales-table .position-lead-time label span,
.technical-spec-unneeded, .sales-table .totals-strip, .totals-strip > div > span { font-size: 13px; }
.sales-table .sale-production-state a, .sales-table .production-summary a { font-size: 14px; }
.sales-table .sale-amount-values > strong, .sales-table .item-row > td.amount > strong { font-size: 15px; line-height: 36px; }
.sales-table > .sale-position > .item-row > td { background: var(--position-tint, #f1f6f3); }
.sales-table > .sale-position > .sale-lead-time-row > td,
.sales-table > .sale-position > .sale-production-summary > td,
.sales-table > .sale-position > .expanded-row > td { background-color: var(--position-tint, #f1f6f3); background-image: none; }
.sales-table > .sale-position-stock { --position-tint: #eef5f1; }
.sales-table > .sale-position-manufacture { --position-tint: #f1f0f8; }
.sales-table > .sale-position > .item-row > td:first-child { background-image: none; }
.sales-table > .sale-position.is-excluded { --position-tint: #f1f3f5; }
.sales-table > .sale-position > .sale-lead-time-row > td { padding: 0; }
.sales-table .sale-position-toolbar { padding: 8px 12px 12px 42px; align-items: start; }
.sales-table .sale-position-toolbar > .position-lead-time { margin-left: 0; justify-content: start; text-align: left; flex-wrap: wrap; }
.sales-table .position-lead-time { gap: 5px; align-items: end; }
.sales-table .position-lead-time > label { display: flex; flex-direction: column; align-items: start; gap: 4px; }
.sales-table .position-lead-time > .lead-time-title { line-height: 36px; margin-right: 8px; }
.lead-time-break { flex-basis: 100%; height: 0; }
.sales-table .button.purchase-toggle-button { background: #e5eaf0; border-color: #bac7d2; color: #334e61; box-shadow: none; min-height: 36px; font-size: 14px; }
.sales-table .button.purchase-toggle-button:hover { background: #dce4ec; border-color: #8da3b4; color: #293f50; }
.sales-table .purchase-toggle-total, .sales-table .purchase-toggle-count { color: #334e61; font-size: 13px; }
.sales-table .sale-production-summary > td { padding: 0 16px 16px 42px; }
.sale-production-state, .production-modal-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; }
#main .sale-production-state .link-button, .production-modal-links .link-button {
  display: inline-block; border: 1px solid #bca6cc; border-radius: 5px; background: #eee3f5;
  color: #654176; padding: 4px 10px; font-size: 14px; line-height: 1.4; text-decoration: none;
}
#main .sale-production-state .link-button:hover, .production-modal-links .link-button:hover {
  background: #e4d3ef; border-color: #a68ab9; color: #513160;
}
.production-stage-badge { display: inline-block; background: #e3e9f0; color: #304e65; border: 1px solid #bdcad7; border-radius: 5px; padding: 4px 9px; font-size: 14px; line-height: 1.4; }
.production-summary { font-size: 14px; align-items: start; gap: 18px; }
.production-summary strong { color: #334e61; font-weight: 600; }
.production-summary-line { margin-bottom: 14px; }
.production-summary-line > strong { display: block; margin-bottom: 6px; }
.production-brief-component { display: grid; grid-template-columns: minmax(0,1fr) auto 48px auto; gap: 8px; margin: 8px 0; }
.production-brief-component > span:first-child { min-width: 0; overflow-wrap: anywhere; color: #536772; }
.production-brief-component .input { width: 100px; min-height: 36px; font-size: 14px; }
.production-brief-component label { flex-wrap: wrap; }
.production-summary-list { flex-basis: 700px; }

/* Use the same purchasing geometry inside the dialog and the deal. */
.production-modal-body { padding: 18px 24px 24px; overflow-x: visible; container: sale-lines / inline-size; }
.production-modal-table { width: 100%; min-width: 0; }
.production-modal-table > tbody > .expanded-row > td { padding: 0; }
.production-cost-dialog { max-height: 92vh; overflow-y: auto; }
.production-cost-dialog .production-modal-head { padding: 20px 24px; }
.production-modal-head h2 { font-size: 19px; line-height: 1.4; }
.sales-table .item-detail.component-section { padding: 0; margin: 0; border: 0; background: transparent; width: 100%; min-width: 0; }
.sales-table .component-heading { padding: 0; margin-bottom: 12px; }
.sales-table .component-heading > .compact-kicker { font-size: 14px; letter-spacing: 0; color: #334e61; }
.sales-table .component-table { display: block; width: 100%; min-width: 0; }
.sales-table .component-table > tbody { display: block; }
.sales-table .component-purchase-headings { display: none; }
.sales-table .component-name-label { display: flex; margin-bottom: 5px; color: #536772; font-size: 14px; line-height: 21px; }
.sales-table .component-purchase-row { display: grid; grid-template-columns: repeat(3, var(--measure-width)) minmax(var(--measure-width), 1fr); gap: 18px; padding: 18px 0 12px; border-top: 1px solid #d6dfe6; }
.sales-table .component-table .component-purchase-row > td { display: block; min-width: 0; width: auto; padding: 0; border: 0; text-align: left; }
.sales-table .component-purchase-row > td:nth-child(1) { grid-column: 1; grid-row: 1; }
.sales-table .component-purchase-row > .component-name { grid-column: 2 / -1; grid-row: 1; }
.sales-table .component-purchase-name { display: grid; grid-template-columns: 18px 28px minmax(0,1fr); align-items: center; gap: 8px; min-width: 0; }
.sales-table .component-purchase-name .input { min-width: 0; width: 100%; font-size: 15px; color: #293f50; }
.sales-table .component-purchase-row > td:nth-child(3) { grid-column: 1; grid-row: 2; }
.sales-table .component-purchase-row > td:nth-child(4) { grid-column: 2; grid-row: 2; }
.sales-table .component-purchase-row > td:nth-child(5) { grid-column: 3; grid-row: 2; }
.sales-table .component-purchase-row > td:nth-child(6) { grid-column: 4; grid-row: 2; }
.sales-table .component-purchase-row > td:nth-child(7) { grid-column: 4; grid-row: 3; }
.sales-table .component-purchase-row > td[data-column]::before { content: attr(data-column); display: block; margin-bottom: 5px; color: #536772; font-size: 13px; }
.sales-table .component-table .component-purchase-row > td.amount b { font-size: 15px; min-height: 36px; line-height: 36px; }
.sales-table .component-supplier-row { display: block; }
.sales-table .component-table .component-supplier-row > td { display: block; padding: 0 0 20px; width: 100%; }
.sales-table .component-inline-value, .sales-table .availability-editor {
  grid-template-columns: var(--measure-number-width) var(--measure-unit-width); max-width: none;
}
.sales-table .component-inline-value > .input,
.sales-table .component-inline-value > .input[data-field=price],
.sales-table .availability-editor > .availability-quantity {
  height: 36px; min-height: 36px; width: 72px; font-size: 14px;
}
.sales-table .component-table .component-purchase-row > td.amount b,
.sales-table .availability-value, .sales-table .availability-empty {
  min-height: 36px; line-height: 36px; font-size: 14px;
}
.sales-table .component-table .component-inline-supplier,
.sales-table .component-table .component-inline-name {
  height: 36px; min-height: 36px; margin: 0; font-size: 14px;
}
.sales-table .component-table .component-kind { min-height: 36px; }
.sales-table .component-commercial-toggle { min-height: 36px; font-size: 14px; }
.sales-table .purchase-supplier-block, .sales-table .purchase-routing { width: 100%; margin-left: 0; }
.sales-table .purchase-supplier-block { display: block; }
.sales-table .purchase-supplier-block .component-supplier-line { display: grid; grid-template-columns: calc(var(--measure-width) + 62px) minmax(0,1fr) auto; gap: 12px; text-align: left; align-items: center; }
.sales-table .component-supplier-line .supplier-name-link, .sales-table .component-supplier-line .supplier-change-button { min-height: 36px; line-height: 36px; }
.sales-table .purchase-commercial > summary { font-size: 14px; min-height: 36px; line-height: 36px; }
.sales-table .purchase-commercial input:not([type=checkbox]), .sales-table .purchase-commercial select {
  height: 36px; min-height: 36px; box-sizing: border-box;
}
.sales-table .component-supplier-label, .sales-table .component-supplier-line .supplier-name-link,
.sales-table .component-supplier-line .supplier-change-button { font-size: 14px; color: #536772; }
.sales-table .component-supplier-line .supplier-name-link { white-space: normal; text-align: left; }
.sales-table .purchase-routing { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 12px 0; }
.sales-table .purchase-routing-field > label { display: grid; grid-template-columns: calc(var(--measure-width) + 62px) minmax(0,1fr); gap: 12px; }
.sales-table .purchase-routing-field > label > span, .sales-table .purchase-routing-value { font-size: 13px; color: #536772; }
.sales-table .purchase-routing select.input { font-size: 14px; height: 36px; }
.sales-table .purchase-routing-detail { margin-left: calc(var(--measure-width) + 74px); }
.sales-table .component-totals { justify-content: start; padding: 16px 0; gap: 24px; font-size: 14px; }
.sales-table .component-totals span, .sales-table .component-totals b { font-size: 14px; }

.production-filters { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(160px,.6fr) auto; align-items: end; gap: 16px; margin-bottom: 24px; }
.production-filters .field { margin: 0; min-width: 0; }
.production-filters .input { width: 100%; min-width: 0; min-height: 38px; }
.production-filter-search { position: relative; min-width: 0; }
.production-filter-options { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; max-height: 320px; overflow-y: auto; background: white; border: 1px solid #bdcad7; border-radius: 5px; box-shadow: 0 8px 20px #20304020; }
.production-filter-options [role=option] { display: block; width: 100%; border: 0; background: white; color: #304e65; font: inherit; text-align: left; padding: 10px 12px; cursor: pointer; }
.production-filter-options [role=option]:hover, .production-filter-options [role=option].is-active { background: #e8eef4; }
.production-filter-options [aria-selected=true] { font-weight: 600; }
.production-filter-options p { padding: 8px 12px; font-size: 14px; }
.production-board { grid-template-columns: repeat(5,minmax(0,1fr)); overflow: visible; gap: 12px; }
.production-lane { min-width: 0; padding: 12px; background: #e9edf2; }
.production-lane h2 { align-items: start; flex-wrap: wrap; font-size: 15px; overflow-wrap: anywhere; }
.production-card { padding: 12px; }
.production-board { align-items: stretch; }
.production-lane h2 { min-height: 44px; margin: 0; }
.production-card { height: 244px; display: flex; flex-direction: column; gap: 10px; }
.production-card h3 { min-height: 63px; height: 63px; margin: 0; overflow: hidden; }
.production-card h3 a { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-align: left; line-height: 21px; }
.production-card .production-card-deal { min-height: 42px; max-height: 42px; overflow: hidden; }
.production-card p { margin: 0; min-height: 21px; }
.production-card p:last-child { margin-top: auto; }
.production-card[draggable=true] { cursor: grab; }
.production-card.is-dragging { opacity: .5; }
.production-lane.is-drop-target { box-shadow: inset 0 0 0 2px #91a9bd; background: #e0e8ef; }
.production-card h3 { font-size: 15px; line-height: 1.5; }
.production-card p, .production-card-deal, .production-deadline, .production-empty { font-size: 13px; }
.production-card-deal { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; color: #536772; }
.production-card-deal a { color: #3c5970; }
.production-dates .input { min-width: 0; width: 100%; font-size: 14px; }
.production-dates { table-layout: fixed; }
.production-date-scroll { overflow: visible; }
.production-cost-heading { gap: 16px; flex-wrap: wrap; }

@container sale-lines (min-width: 761px) {
  .sales-table .position-lead-time > select { margin-left: 19px; }
  .sales-table > thead > tr > th:nth-child(3), .sales-table > thead > tr > th:nth-child(4) { width: calc(var(--measure-width) + 2 * var(--sale-row-padding)); }
  .sales-table > .sale-position > .item-row > td[data-column] {
    padding-top: 51px; vertical-align: top;
  }
  .sales-table .technical-spec-cell > .technical-spec-link {
    display: inline-flex; align-items: center; min-height: 36px;
  }
}

@container sale-lines (max-width: 1050px) {
  .sales-table .component-purchase-row { grid-template-columns: repeat(2,minmax(var(--measure-width),1fr)); }
  .sales-table .component-purchase-row > .component-name { grid-column: 2; }
  .sales-table .component-purchase-row > td:nth-child(3) { grid-column: 1; grid-row: 2; }
  .sales-table .component-purchase-row > td:nth-child(4) { grid-column: 2; grid-row: 2; }
  .sales-table .component-purchase-row > td:nth-child(5) { grid-column: 1; grid-row: 3; }
  .sales-table .component-purchase-row > td:nth-child(6) { grid-column: 2; grid-row: 3; }
  .sales-table .component-purchase-row > td:nth-child(7) { grid-column: 2; grid-row: 4; }
  .sales-table .purchase-routing { grid-template-columns: 1fr; }
}
@container sale-lines (max-width: 760px) {
  .sales-table .sale-position-toolbar, .sales-table .sale-production-summary > td { padding-left: 12px; }
  .production-brief-component { grid-template-columns: minmax(0,1fr) auto; }
  .production-brief-component > span:first-child { grid-column: 1 / -1; }
  .sales-table .component-purchase-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .sales-table .component-purchase-row > .component-name { grid-column: 1 / -1; grid-row: 2; }
  .sales-table .component-purchase-row > td:nth-child(3), .sales-table .component-purchase-row > td:nth-child(4) { grid-row: 3; }
  .sales-table .component-purchase-row > td:nth-child(5), .sales-table .component-purchase-row > td:nth-child(6) { grid-row: 4; }
  .sales-table .component-purchase-row > td:nth-child(7) { grid-row: 5; }
}
@media(max-width:1100px) {
  .production-board { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .production-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .production-deliveries { grid-template-columns: 1fr; }
}
@container sale-lines (max-width: 500px) {
  .sales-table .component-purchase-row { grid-template-columns: minmax(0,1fr); }
  .sales-table .component-purchase-row > td:nth-child(n) { grid-column: 1; grid-row: auto; }
  .sales-table .component-purchase-row > td.component-name { grid-column: 1 / -1; }
  .sales-table .purchase-supplier-block .component-supplier-line { grid-template-columns: minmax(0,1fr); }
}
@media(max-width:700px) {
  .production-board { grid-template-columns: 1fr; }
  .production-filters { grid-template-columns: 1fr; }
  .production-cost-dialog { width: 96vw; }
  .production-modal-body, .production-cost-dialog .production-modal-head { padding: 16px; }
  .production-dates { display: block; }
  .production-dates thead { display: none; }
  .production-dates tbody, .production-dates tr { display: block; }
  .production-dates tr { margin-bottom: 18px; }
  .production-dates th, .production-dates td { display: block; width: 100%; padding: 5px 0; }
  .production-dates .sr-only { position: static; width: auto; height: auto; clip: auto; overflow: visible; margin: 0; white-space: normal; }
}

/* Dense purchasing keeps native controls readable and uses width before adding rows. */
:is(.production-purchase-fields,.stock-purchase-detail) .component-purchase-row {
  grid-template-columns:140px minmax(180px,1fr) var(--measure-width) 150px var(--measure-width) 130px 64px;
  gap:10px; padding:10px 0 8px;
}
:is(.production-purchase-fields,.stock-purchase-detail) .component-purchase-row > td:nth-child(n) { grid-column:auto; grid-row:1; }
:is(.production-purchase-fields,.stock-purchase-detail) .component-purchase-row > td:first-child::before { display:block; margin-bottom:5px; color:#536772; font-size:14px; line-height:21px; }
:is(.production-purchase-fields,.stock-purchase-detail) .component-purchase-row > td:first-child::before { content:'Вид'; }
:is(.production-purchase-fields,.stock-purchase-detail) .component-purchase-row > .component-actions { align-self:end; }
:is(.production-purchase-fields,.stock-purchase-detail) .component-action-buttons { gap:4px; }
:is(.production-purchase-fields,.stock-purchase-detail) .component-purchase-row .icon-button { min-width:28px; width:28px; margin:0; }
.sales-table :is(.production-purchase-fields,.stock-purchase-detail) .component-heading,
.production-purchase-fields .sales-table .component-heading { margin-bottom:4px; }
.sales-table :is(.production-purchase-fields,.stock-purchase-detail) .component-supplier-row > td,
.production-purchase-fields .sales-table .component-supplier-row > td { padding-bottom:10px; }
:is(.production-purchase-fields,.stock-purchase-detail) .purchase-routing { gap:8px 12px; padding:6px 0; }
:is(.production-purchase-fields,.stock-purchase-detail) .purchase-commercial { margin-top:6px; padding-top:5px; }
:is(.production-purchase-fields,.stock-purchase-detail) .component-totals { padding:8px 0; gap:12px 20px; }
.sales-table :is(.production-purchase-fields,.stock-purchase-detail) :is(.supplier-directory-empty,.supplier-routing-empty),
.production-purchase-fields .sales-table :is(.supplier-directory-empty,.supplier-routing-empty),
.sales-table :is(.production-purchase-fields,.stock-purchase-detail) .purchase-routing-value,
.production-purchase-fields .sales-table .purchase-routing-value { font-size:14px; line-height:1.4; }
@container purchase-editor (max-width:1050px) {
  :is(.production-purchase-fields,.stock-purchase-detail) .component-purchase-row { grid-template-columns:repeat(3,minmax(0,1fr)) 64px; }
  :is(.production-purchase-fields,.stock-purchase-detail) .component-purchase-row > .component-name { grid-column:2 / -1; }
  :is(.production-purchase-fields,.stock-purchase-detail) .component-purchase-row > td:nth-child(n+3) { grid-row:2; }
  :is(.production-purchase-fields,.stock-purchase-detail) .component-purchase-row > td:nth-child(3) { grid-column:1; }
  :is(.production-purchase-fields,.stock-purchase-detail) .component-purchase-row > td:nth-child(4) { grid-column:2; }
  :is(.production-purchase-fields,.stock-purchase-detail) .component-purchase-row > td:nth-child(5) { grid-column:3; }
  :is(.production-purchase-fields,.stock-purchase-detail) .component-purchase-row > td:nth-child(6) { grid-column:1 / 4; grid-row:3; }
  :is(.production-purchase-fields,.stock-purchase-detail) .component-purchase-row > td:nth-child(7) { grid-column:4; grid-row:3; }
}

.production-purchases-card > .card-body,.production-modal-body { container-name:sale-lines purchase-editor; container-type:inline-size; }
.stock-purchase-detail { container:purchase-editor / inline-size; }
@container purchase-editor (max-width:680px) {
  :is(.production-purchase-fields,.stock-purchase-detail) .component-purchase-row { grid-template-columns:minmax(0,1fr); }
  :is(.production-purchase-fields,.stock-purchase-detail) .component-purchase-row > td:nth-child(n) { grid-column:1; grid-row:auto; }
  :is(.production-purchase-fields,.stock-purchase-detail) .component-purchase-row > td.component-name { grid-column:1 / -1; }
  :is(.production-purchase-fields,.stock-purchase-detail) .component-action-buttons { justify-content:flex-start; }
  .sales-table :is(.stock-purchase-detail) .purchase-supplier-block .component-supplier-line,
  .production-purchase-fields .sales-table .purchase-supplier-block .component-supplier-line { grid-template-columns:minmax(0,1fr); }
  body#crm-ui-root[data-ui-primitives="v1"] :is(.production-purchase-fields,.stock-purchase-detail) .purchase-supplier-block .component-supplier-line { height:auto; }
  :is(.production-purchase-fields,.stock-purchase-detail) :is(.purchase-commercial-grid,.purchase-payment-grid,.purchase-routing) { grid-template-columns:minmax(0,1fr); }
  .sales-table .stock-purchase-detail .purchase-routing-field > label,
  .production-purchase-fields .sales-table .purchase-routing-field > label { grid-template-columns:minmax(0,1fr); }
  :is(.production-purchase-fields,.stock-purchase-detail) .purchase-routing-detail { margin-left:0; }
  :is(.production-purchase-fields,.stock-purchase-detail) :is(.component-inline-value,.availability-editor) { display:grid; grid-template-columns:minmax(48px,1fr) minmax(52px,1fr); width:100%; }
  .sales-table .stock-purchase-detail .component-inline-value > .input,
  .production-purchase-fields .sales-table .component-inline-value > .input,
  :is(.production-purchase-fields,.stock-purchase-detail) .unit-picker { width:100%; min-width:0; }
}
