body:not(.can-procurement) .procurement-only, body:not(.can-procurement-manage) .procurement-manage-only { display: none !important; }
#procurement-root, #procurement-access-root { min-width: 0; }
#procurement-access-root { margin-top: 20px; }
.proc-toolbar, .proc-tabs, .proc-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.proc-toolbar { justify-content: space-between; }
.proc-tabs [aria-pressed="true"] { border-color: var(--primary); color: var(--primary-dark); background: var(--surface-subtle); }
.proc-help, .proc-table-note { color: var(--muted); font-size: 13px; line-height: 1.65; }
.proc-table-note { margin: 12px 18px; }
.proc-status { color: var(--muted); font-size: 13px; }
.proc-filter { display: grid; grid-template-columns: minmax(125px, 1fr) minmax(170px, 1.4fr) minmax(125px, 1fr) minmax(110px, .8fr) auto; gap: 12px; align-items: end; padding: 16px 18px; }
.proc-filter .button { margin-bottom: 1px; }
.proc-summary, .proc-state-strip { display: flex; flex-wrap: wrap; gap: 12px 28px; padding: 12px 18px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-subtle); font-size: 13px; }
.proc-summary strong { font-variant-numeric: tabular-nums; margin-left: 6px; }
.proc-source-filters { display: grid; grid-template-columns: minmax(150px,1.2fr) minmax(195px,1.6fr) repeat(3,minmax(125px,1fr)) auto; gap: 12px; align-items: end; padding: 16px 18px; background: var(--surface-subtle); }
.proc-table.proc-source-table { min-width: 1350px; }
.proc-source-table td { white-space: normal; vertical-align: top; overflow-wrap: anywhere; }
.proc-source-table td:first-child { min-width: 105px; }
.proc-source-table td:nth-child(2) { min-width: 190px; max-width: 220px; }
.proc-source-table td:nth-child(3) { min-width: 260px; max-width: 330px; }
.proc-source-table td:nth-child(3) small { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.proc-source-table td:nth-child(6) { min-width: 200px; max-width: 250px; }
.proc-source-table td:nth-child(7) { min-width: 260px; max-width: 320px; }
.proc-source-more { grid-column: 1 / -1; min-width: 0; }
.proc-source-more > summary { min-height: 44px; cursor: pointer; padding: 10px 0; color: var(--primary-dark); font-size: 13px; }
.proc-source-more-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 12px; align-items: end; padding-top: 8px; }
.proc-source-clear { margin-bottom: 1px; }
.proc-source-match { display: inline-block; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.proc-source-match.matched { color: #17603e; background: #e2f4e9; }
.proc-source-match.candidate { color: #865100; background: #fff1ce; }
.proc-source-match.unmatched { color: var(--muted); background: var(--surface-subtle); }
.proc-source-kind { display: inline-block; padding: 2px 6px; border-radius: 4px; background: #edf2f7; color: #415568; font-weight: 600; }
.proc-source-note { color: #865100 !important; background: #fff1ce; padding: 4px 6px; border-radius: 4px; display: -webkit-box !important; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.proc-source-table details { margin-top: 8px; }
.proc-source-table summary { cursor: pointer; color: var(--primary); }
.proc-source-original { display: grid; grid-template-columns: 24px minmax(180px,1fr); gap: 4px 8px; margin: 8px 0; }
.proc-source-original dt { font-weight: 700; }
.proc-source-original dd { margin: 0; white-space: pre-wrap; }
.proc-table { min-width: 950px; }
.proc-table small { display: block; color: var(--muted); margin-top: 4px; }
.proc-table td:nth-child(4) { max-width: 220px; white-space: normal; overflow-wrap: anywhere; }
.proc-detail { margin-top: 20px; scroll-margin-top: 20px; }
.proc-form { padding: 18px; }
.proc-form fieldset { margin: 0; padding: 0; min-width: 0; border: 0; }
.proc-form h3, .proc-history h3, .proc-section-title { font-size: 15px; margin: 18px 0 10px; }
.proc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.proc-wide { grid-column: 1 / -1; }
.proc-line-table { min-width: 940px; }
.proc-line-table th:first-child { width: 270px; }
.proc-line-table td:not(:first-child) { min-width: 112px; max-width: 150px; }
.proc-line-table td:last-child { min-width: 80px; }
.proc-cell-label { display: block; position: relative; }
.proc-cell-label input, .proc-cell-label select { width: 100%; min-width: 90px; min-height: 44px; padding: 8px; color: var(--foreground); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 7px; }
.proc-cell-label + .proc-cell-label { margin-top: 7px; }
.proc-line-number { font-size: 11px; color: var(--muted); }
.proc-add-line { margin: 12px 0 18px; }
.proc-opening, .proc-history { padding: 16px 18px; border-top: 1px solid var(--border); }
.proc-opening > summary, .proc-history summary { cursor: pointer; font-weight: 600; line-height: 1.6; min-height: 44px; padding: 10px 0; }
.proc-opening .proc-form { padding: 4px 0; }
.proc-history details { border-top: 1px solid var(--border); padding: 4px 0; }
.proc-history table td { white-space: pre-wrap; max-width: 400px; overflow-wrap: anywhere; }
.proc-history p { font-size: 13px; color: var(--muted); }
.proc-section-title { margin: 18px; }
#proc-master-editor { border-bottom: 1px solid var(--border); background: var(--surface-subtle); }
#proc-master-lists table { min-width: 650px; }
#proc-master-lists td { white-space: normal; overflow-wrap: anywhere; }
#procurement-root .numeric { text-align: right; font-variant-numeric: tabular-nums; }
#procurement-root .form-error, #procurement-access-root .form-error { margin: 12px 0; }
#procurement-root fieldset:disabled input, #procurement-root fieldset:disabled select, #procurement-root fieldset:disabled textarea { opacity: 1; color: var(--foreground); background: var(--surface-subtle); }
#procurement-root .button, #procurement-access-root .button { min-height: 44px; }
@media (max-width: 1100px) { .proc-filter, .proc-source-filters, .proc-source-more-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .proc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .proc-filter, .proc-grid, .proc-source-filters, .proc-source-more-grid { grid-template-columns: minmax(0, 1fr); } .proc-toolbar { align-items: stretch; } .proc-toolbar > .button { width: 100%; } .proc-form { padding: 14px; } .proc-opening, .proc-history { padding: 14px; } .proc-summary { flex-direction: column; gap: 8px; } }


#procurement-root .sr-only, #procurement-access-root .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Structured material and product foundation: preserve dense rows and local scrolling. */
#proc-foundation { min-width: 0; }
.pf-supplier-panel { margin-top: 20px; }
.pf-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 18px; }
.pf-toolbar p { margin: 0; }
.pf-filter { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(140px, 1fr) minmax(140px, 1fr) auto; align-items: end; gap: 12px; padding: 12px 18px; background: var(--surface-subtle); border-block: 1px solid var(--border); }
.pf-message { margin: 12px 18px; }
.pf-material-table { min-width: 980px; }
.pf-product-table { min-width: 1320px; }
.pf-product-table td:nth-child(2), .pf-product-table th:nth-child(2) { min-width: 75px; }
.pf-product-table td:nth-child(7), .pf-product-table th:nth-child(7) { min-width: 85px; }
.pf-material-table td, .pf-product-table td { white-space: normal; overflow-wrap: anywhere; min-width: 105px; max-width: 260px; vertical-align: top; }
.pf-material-table small, .pf-product-table small, .pf-details td small { display: block; color: var(--muted); line-height: 1.5; margin-top: 4px; }
.pf-product-table td:first-child, .pf-product-table th:first-child { min-width: 190px; max-width: 220px; position: sticky; left: 0; background: var(--surface); z-index: 1; border-right: 1px solid var(--border); }
.pf-product-table th:first-child { z-index: 3; }
.pf-product-table td:last-child { min-width: 146px; }
.pf-product-table td:last-child .button { margin-bottom: 6px; width: 100%; }
.pf-relation { line-height: 1.6; }
.pf-pending { display: inline-block; color: var(--warning); background: var(--surface-subtle); font-weight: 600; padding: 3px 6px; border-left: 3px solid var(--warning); }
.pf-editor { margin-top: 18px; border-top: 2px solid var(--border); background: var(--surface-subtle); scroll-margin-top: 110px; }
.pf-editor h3 { margin: 0; font-size: 16px; }
.pf-editor .panel-header { align-items: center; }
.pf-editor .proc-form > fieldset > .proc-help { margin-top: 0; }
.pf-product-identity-field { min-width: 0; }
.pf-product-custom { margin-top: 10px; }
.pf-product-identity-field .proc-help { display: block; margin-top: 6px; }
.pf-product-duplicate { padding: 12px; margin: 12px 0; border: 1px solid var(--warning); border-radius: 8px; background: var(--surface); overflow-wrap: anywhere; }
.pf-product-duplicate p { margin: 0 0 8px; color: var(--warning); }
.pf-relations { margin: 16px 0; }
.pf-relation-editor { display: grid; grid-template-columns: 80px minmax(180px, .7fr) minmax(230px, 1.3fr); align-items: center; gap: 12px; margin: 10px 0; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.pf-details { padding: 0 18px 18px; }
.pf-details h4 { font-size: 14px; margin: 18px 0 8px; }
.pf-details table { min-width: 700px; }
.pf-details td { white-space: normal; overflow-wrap: anywhere; max-width: 650px; }
.pf-details details { border-block-start: 1px solid var(--border); padding: 8px 0; }
.pf-details summary { cursor: pointer; min-height: 44px; padding: 10px 0; font-weight: 600; }
.pf-details p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; font-size: 13px; }
.pf-sources { margin: 8px 0; padding-left: 22px; line-height: 1.75; font-size: 13px; overflow-wrap: anywhere; }
#pf-editor:focus { outline: none; }
@media (max-width: 900px) { .pf-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pf-product-table td:first-child, .pf-product-table th:first-child { position: static; } }
@media (max-width: 600px) { .pf-filter { grid-template-columns: minmax(0, 1fr); } .pf-relation-editor { grid-template-columns: minmax(0, 1fr); gap: 8px; } .pf-toolbar, .pf-filter { padding: 12px 14px; } .pf-details { padding-inline: 14px; } .pf-message { margin-inline: 14px; } }

/* Category-specific facets share the native multi-select behavior with other tables. */
.pf-material-facets { padding: 14px 18px 0; border-bottom: 1px solid var(--border); background: var(--surface-subtle); }
.pf-material-facets[hidden] { display: none; }
.pf-facet-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; gap: 12px; }
.pf-facet-field { min-width: 0; display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.pf-facet summary { min-height: 44px; background: var(--surface); color: var(--foreground); }
.pf-facet summary:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.pf-facet .filter-options { width: 100%; min-width: 0; max-height: 285px; background: var(--surface); }
.pf-facet-option { min-height: 44px; color: var(--foreground); font-weight: 400; }
.pf-facet-option input { flex: 0 0 18px; }
.pf-facet-option > span { flex: 1; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.pf-facet-option small { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.pf-facet-zero { color: var(--muted); }
.pf-facet-zero:has(input:disabled) { cursor: default; }
.pf-facet-help { margin: 10px 0; }
.pf-facet-unavailable { padding-bottom: 12px; color: var(--warning); font-size: 13px; }
.pf-facet-unavailable .button { margin: 0 8px 8px 0; white-space: normal; overflow-wrap: anywhere; max-width: 100%; }
.pf-clear-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 18px 0; }
@media (max-width: 900px) { .pf-facet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .pf-facet-grid { grid-template-columns: minmax(0, 1fr); } .pf-material-facets, .pf-clear-row { padding-inline: 14px; } }

/* Supplier directory categories guide selection without rewriting contract lines. */
.proc-category-warning, .proc-category-note { color: var(--warning); background: var(--surface-subtle); border-left: 3px solid var(--warning); padding: 8px 10px; line-height: 1.6; font-size: 13px; overflow-wrap: anywhere; }
.proc-category-note { margin: 8px 0; }
.proc-category-fields legend { color: var(--muted); font-weight: 600; font-size: 12px; margin-bottom: 8px; }
.proc-category-checks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.proc-category-checks label { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.proc-category-checks input { width: 18px; height: 18px; min-height: 18px; flex: 0 0 18px; }
.proc-category-checks label:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }
@media (max-width: 600px) { .proc-category-checks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Native material chooser stays above horizontally scrolling contract tables. */
.proc-material-open { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; }
.proc-material-open > span { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; overflow-wrap: anywhere; }
.proc-material-open > small { flex: 0 0 auto; color: var(--muted); }
.proc-material-picker { box-sizing: border-box; width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--border); border-radius: 12px; color: var(--foreground); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.proc-material-picker[open] { display: flex; flex-direction: column; }
.proc-material-picker::backdrop { background: rgba(15, 23, 42, .45); }
.proc-material-picker > header { padding: 16px 18px 0; flex: 0 0 auto; }
.proc-material-picker h3 { margin: 0; font-size: 17px; }
.proc-material-picker .proc-help { line-height: 1.5; margin-block: 8px; }
.proc-material-current { flex: 0 0 auto; margin: 10px 18px; padding: 8px 10px; background: var(--surface-subtle); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.proc-material-picker-controls { padding: 0 18px; flex: 0 0 auto; }
.proc-material-facets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.proc-material-facets[hidden], #proc-material-picker-category-field[hidden] { display: none; }
.proc-material-search-details { margin-top: 6px; }
.proc-material-search-details > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--primary-dark); font-size: 13px; }
.proc-material-search-details > summary:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
#proc-material-search-form { display: flex; align-items: end; gap: 10px; }
#proc-material-search-form > label { min-width: 0; flex: 1; }
.proc-material-result-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin: 8px 0; }
.proc-material-results { min-height: 64px; max-height: 340px; flex: 1 1 340px; overflow-y: auto; overscroll-behavior-y: contain; padding: 0 18px; }
.proc-material-results ul { list-style: none; margin: 0; padding: 0; }
.proc-material-results li + li { margin-top: 6px; }
.proc-material-choice { display: grid; grid-template-columns: minmax(0, 1fr) auto; width: 100%; min-height: 54px; padding: 10px; gap: 5px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--foreground); text-align: left; cursor: pointer; white-space: normal; overflow-wrap: anywhere; }
.proc-material-choice:hover { background: var(--surface-subtle); }
.proc-material-choice:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; }
.proc-material-choice > strong { font-size: 14px; }
.proc-material-choice > .proc-material-choice-action { color: var(--primary-dark); font-weight: 600; }
.proc-material-choice-info { grid-column: 1 / -1; }
.proc-material-choice > span, .proc-material-empty { font-size: 12px; color: var(--muted); line-height: 1.5; }
.proc-material-picker > footer { display: flex; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); flex: 0 0 auto; }
@media (max-width: 600px) {
  .proc-material-picker { width: calc(100vw - 20px); max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); }
  .proc-material-picker > header, .proc-material-picker-controls, .proc-material-results, .proc-material-picker > footer { padding-inline: 12px; }
  .proc-material-current { margin-inline: 12px; }
  .proc-material-facets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proc-material-facets > label:first-child { grid-column: 1 / -1; }
}
@media (max-height: 540px) {
  .proc-material-picker { overflow-y: auto; }
  .proc-material-picker > header .proc-help { display: none; }
  .proc-material-results { flex-basis: 120px; min-height: 120px; }
}

/* Contract queries use stable recorded choices; number input remains optional. */
.proc-query-actions { display: flex; gap: 8px; }
.proc-query-more, .proc-query-note { grid-column: 1 / -1; min-width: 0; }
.proc-query-more > summary { min-height: 44px; cursor: pointer; padding: 10px 0; font-size: 13px; color: var(--muted); }
.proc-query-more > summary:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.proc-query-more > .form-field { max-width: 460px; margin-top: 8px; }
.proc-query-note { margin: 0; }
@media (max-width: 600px) { .proc-query-actions > .button { flex: 1; } }
