.stock-selection-dialog {
  width: min(1760px, calc(100vw - 20px));
  max-width: none;
  height: calc(100dvh - 20px);
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--brand-navy) 36%, var(--erp-border));
  border-radius: 5px;
  color: var(--ink);
  background: var(--erp-surface);
  box-shadow: 0 28px 78px rgb(4 31 57 / 38%), 0 0 0 1px rgb(255 255 255 / 58%);
}

.stock-selection-dialog::backdrop { background: rgb(3 25 47 / 56%); backdrop-filter: blur(1.5px); }
.stock-selection-search-only .stock-selection-filter-fields > label:not(:first-child) { display:none; }
.stock-selection-search-only .stock-selection-workspace { grid-template-columns:218px minmax(0,1fr); grid-template-rows:minmax(0,1fr); }
.stock-selection-search-only .stock-selection-detail { display:none; }
.stock-selection-offer-detail .stock-selection-detail { grid-template-rows:auto 110px minmax(150px,1fr); }
.stock-selection-offer-detail .stock-selection-detail>.stock-selection-image,
.stock-selection-offer-detail .stock-selection-detail>section:first-of-type { display:none; }
.stock-selection-status[hidden] { display:none!important; }

.stock-selection-form {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
}

.stock-selection-header {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 10px;
  border-top: 4px solid var(--brand-navy);
  border-bottom: 1px solid color-mix(in srgb, var(--erp-accent) 34%, var(--erp-border));
  background:
    linear-gradient(105deg,
      color-mix(in srgb, var(--brand-turquoise-pale) 78%, white) 0%,
      var(--erp-surface) 42%,
      color-mix(in srgb, var(--erp-surface-muted) 84%, white) 100%);
  box-shadow: inset 0 -1px 0 rgb(255 255 255 / 70%);
}

.stock-selection-header .eyebrow { margin: 0; color: var(--erp-accent); font-size: 7px; font-weight: 950; letter-spacing: .15em; }
.stock-selection-header h2 { margin: 1px 0 0; color: var(--brand-navy); font-size: 17px; line-height: 1.1; }
.stock-selection-header p:last-child { margin: 2px 0 0; color: var(--muted); font-size: 8px; font-weight: 650; }

.stock-selection-workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 214px minmax(520px, 1fr) 318px;
  grid-template-rows: minmax(0, 1fr) 188px;
  gap: 5px;
  padding: 5px;
  overflow: hidden;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--brand-turquoise-pale) 20%, var(--canvas)) 0%,
      var(--canvas) 42%,
      color-mix(in srgb, var(--brand-navy) 4%, var(--canvas)) 100%);
}

.stock-selection-filters,
.stock-selection-results,
.stock-selection-detail,
.stock-selection-picked {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--brand-navy) 14%, var(--erp-border));
  border-radius: 3px;
  background: var(--erp-surface);
  box-shadow: 0 2px 7px rgb(7 45 76 / 7%);
}

.stock-selection-filters {
  grid-row: 1 / 3;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 5px;
  padding: 7px;
  border-top: 3px solid var(--erp-accent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand-turquoise-pale) 24%, var(--erp-surface)) 0, var(--erp-surface) 120px);
}

.stock-selection-panel-title {
  min-height: 34px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--erp-accent) 18%, var(--erp-border));
  color: var(--brand-navy);
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand-turquoise-pale) 68%, var(--erp-surface)) 0%, var(--erp-surface-muted) 100%);
}

.stock-selection-filters > .stock-selection-panel-title { margin: -7px -7px 2px; }
.stock-selection-panel-title strong { font-size: 10px; font-weight: 900; }
.stock-selection-panel-title small { overflow: hidden; color: var(--muted); font-size: 7px; font-weight: 700; text-align: right; text-overflow: ellipsis; white-space: nowrap; }

.stock-selection-filter-fields { min-height: 0; display: grid; align-content: start; gap: 5px; padding-right: 3px; overflow-y: auto; scrollbar-gutter: stable; }
.stock-selection-filter-actions { display: grid; gap: 4px; padding-top: 4px; border-top: 1px solid color-mix(in srgb, var(--erp-accent) 22%, var(--erp-border)); }

.stock-selection-filters label:not(.stock-selection-check) { display: grid; gap: 3px; }
.stock-selection-filters label > span { color: var(--brand-navy); font-size: 8px; font-weight: 850; }
.stock-selection-filters input[type="search"],
.stock-selection-filters select {
  width: 100%;
  height: 29px;
  min-height: 29px;
  padding: 0 7px;
  border: 1px solid var(--erp-border);
  border-radius: 2px;
  color: var(--ink);
  background: color-mix(in srgb, white 82%, var(--erp-surface));
  font: 750 9px/1 var(--ui-font);
}

.stock-selection-filters input:focus,
.stock-selection-filters select:focus { outline: 2px solid color-mix(in srgb, var(--erp-accent) 32%, transparent); border-color: var(--erp-accent); background: white; box-shadow: 0 0 0 3px color-mix(in srgb, var(--erp-accent) 9%, transparent); }

.stock-selection-filters .button { min-height: 29px; padding-block: 4px; border-radius: 3px; font-size: 8px; font-weight: 900; }

.stock-selection-results { display: grid; grid-template-rows: auto minmax(0, 1fr); border-top: 3px solid var(--brand-navy); }
.stock-selection-results-toolbar { min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px; border-bottom: 1px solid color-mix(in srgb, var(--brand-navy) 18%, var(--erp-border)); background: linear-gradient(90deg, color-mix(in srgb, var(--brand-navy) 7%, var(--erp-surface)) 0%, var(--erp-surface-muted) 100%); }
.stock-selection-results-toolbar > strong { font-size: 8px; font-weight: 900; white-space: nowrap; }
.stock-selection-results-toolbar > div { display: flex; gap: 3px; }
.stock-selection-results-toolbar .button { min-height: 25px; padding: 3px 7px; border-radius: 2px; font-size: 7px; font-weight: 850; }

.stock-selection-grid-wrap,
.stock-selection-picked-grid,
.stock-selection-detail-grid { min-width: 0; min-height: 0; overflow: auto; }

.stock-selection-grid-shell { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.stock-selection-grid-shell > .stock-selection-grid-wrap { width: 100%; height: 100%; scrollbar-gutter: stable; }

.stock-selection-table,
.stock-selection-picked table,
.stock-selection-detail table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }

.stock-selection-table { width: max-content; min-width: 100%; }

.stock-selection-table th,
.stock-selection-table td,
.stock-selection-picked th,
.stock-selection-picked td,
.stock-selection-detail th,
.stock-selection-detail td {
  height: 25px;
  padding: 2px 5px;
  overflow: hidden;
  border-right: 1px solid var(--erp-border);
  border-bottom: 1px solid var(--erp-border);
  font-size: 8px;
  font-weight: 700;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-selection-table thead th,
.stock-selection-picked thead th,
.stock-selection-detail thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  height: 27px;
  color: var(--brand-navy);
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand-turquoise-pale) 54%, white) 0%, var(--erp-surface-muted) 100%);
  font-size: 7.5px;
  font-weight: 900;
  text-align: left;
  text-transform: uppercase;
}

.stock-selection-table th:nth-child(1) { width: 32px; text-align: center; }
.stock-selection-table th:nth-child(2) { width: 46px; text-align: right; }
.stock-selection-table th:nth-child(3) { width: 122px; }
.stock-selection-table th:nth-child(4) { width: 128px; }
.stock-selection-table th:nth-child(5) { width: 250px; }
.stock-selection-table th:nth-child(6) { width: 132px; }
.stock-selection-table th:nth-child(7) { width: 132px; }
.stock-selection-table th:nth-child(8) { width: 125px; }
.stock-selection-table td:nth-child(1) { text-align: center; }
.stock-selection-table td:nth-child(2) { text-align: right; font-variant-numeric: tabular-nums; }
.stock-selection-table tbody tr,
.stock-selection-table tbody td { height: 22px; }
.stock-selection-table tbody td { padding: 1px 4px; line-height: 1; }
.stock-selection-table tr[data-stock-selection-id] { cursor: pointer; }
.stock-selection-table tbody tr:nth-child(even):not(.is-active) td { background: color-mix(in srgb, var(--brand-navy) 2.5%, var(--erp-surface)); }
.stock-selection-table tr[data-stock-selection-id]:hover td { background: color-mix(in srgb, var(--brand-turquoise-pale) 48%, var(--erp-surface)); }
.stock-selection-table tr.is-active td { color: color-mix(in srgb, var(--brand-navy) 92%, black); background: color-mix(in srgb, var(--brand-turquoise-pale) 88%, white); box-shadow: inset 0 2px 0 var(--erp-accent), inset 0 -2px 0 var(--erp-accent); }
.stock-selection-table tr.is-active td:first-child { box-shadow: inset 4px 0 0 var(--brand-navy), inset 0 2px 0 var(--erp-accent), inset 0 -2px 0 var(--erp-accent); }
.stock-selection-table tr.is-picked td { font-weight: 850; }
.stock-selection-table input[type="checkbox"] { width: 13px; height: 13px; min-height: 13px; margin: 0; padding: 0; vertical-align: middle; }
.stock-selection-table input[type="number"],
.stock-selection-picked input[type="number"] { width: 100%; height: 18px; min-height: 18px; padding: 0 3px; border: 1px solid var(--erp-border); border-radius: 2px; color: var(--ink); background: var(--erp-surface); font: 750 8px/1 var(--ui-font); text-align: right; appearance: textfield; }
.stock-selection-table input[type="number"]::-webkit-inner-spin-button,
.stock-selection-table input[type="number"]::-webkit-outer-spin-button,
.stock-selection-picked input[type="number"]::-webkit-inner-spin-button,
.stock-selection-picked input[type="number"]::-webkit-outer-spin-button { margin: 0; appearance: none; }

.stock-selection-detail { grid-column: 3; grid-row: 1 / 3; display: grid; grid-template-rows: auto 132px minmax(112px, 1fr) 104px minmax(118px, 1fr); gap: 4px; padding-bottom: 4px; border-top: 3px solid var(--erp-accent); background: linear-gradient(180deg, color-mix(in srgb, var(--brand-turquoise-pale) 16%, var(--erp-surface)) 0, var(--erp-surface) 210px); }
.stock-selection-detail > .stock-selection-panel-title { margin-bottom: 0; }
.stock-selection-image { position: relative; margin: 0 5px; display: grid; place-items: center; overflow: hidden; border: 1px solid color-mix(in srgb, var(--erp-accent) 28%, var(--erp-border)); background: radial-gradient(circle at 50% 45%, white 0%, color-mix(in srgb, var(--brand-turquoise-pale) 28%, var(--erp-surface-muted)) 100%); box-shadow: inset 0 0 0 3px rgb(255 255 255 / 66%); }
.stock-selection-image img { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); display: block; object-fit: contain; object-position: center; filter: drop-shadow(0 3px 5px rgb(7 45 76 / 12%)); }
.stock-selection-image span { color: var(--muted); font-size: 8px; font-weight: 750; }
.stock-selection-detail section { min-height: 0; display: grid; grid-template-rows: 24px minmax(0, 1fr); margin: 0 5px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--brand-navy) 14%, var(--erp-border)); background: var(--erp-surface); }
.stock-selection-detail h3 { margin: 0; padding: 6px; border-bottom: 1px solid color-mix(in srgb, var(--erp-accent) 18%, var(--erp-border)); border-left: 3px solid var(--erp-accent); color: var(--brand-navy); background: linear-gradient(90deg, color-mix(in srgb, var(--brand-turquoise-pale) 70%, var(--erp-surface)) 0%, var(--erp-surface-muted) 100%); font-size: 8px; font-weight: 900; }
.stock-selection-detail td:nth-child(n+2) { text-align: right; font-variant-numeric: tabular-nums; }
.stock-selection-warehouse-table th:first-child { width: 37%; }
.stock-selection-warehouse-table th:nth-child(n+2) { width: 21%; text-align: right; }
.stock-selection-price-table th:first-child { width: 30%; }
.stock-selection-price-table th:nth-child(2) { width: 21%; text-align: right; }
.stock-selection-price-table th:nth-child(3) { width: 32%; text-align: right; }
.stock-selection-price-table th:nth-child(4) { width: 17%; text-align: right; }
.stock-selection-detail tfoot th,
.stock-selection-detail tfoot td { position: sticky; z-index: 2; bottom: 0; border-top: 2px solid color-mix(in srgb, var(--erp-accent) 58%, var(--erp-border)); color: var(--brand-navy); background: color-mix(in srgb, var(--brand-turquoise-pale) 76%, white); font-weight: 950; }
.stock-selection-detail tfoot th { text-align: left; }

.stock-selection-picked { display: grid; grid-template-rows: auto minmax(0, 1fr); border-top: 3px solid color-mix(in srgb, var(--erp-accent) 74%, var(--brand-navy)); }
.stock-selection-picked .stock-selection-panel-title { min-height: 31px; }
.stock-selection-picked th:nth-child(1) { width: 130px; }
.stock-selection-picked th:nth-child(3) { width: 90px; text-align: right; }
.stock-selection-picked th:nth-child(4) { width: 34px; text-align: center; }
.stock-selection-picked td:nth-child(3) { text-align: right; }
.stock-selection-picked td:nth-child(4) { padding: 1px; text-align: center; }
.stock-selection-remove { width: 22px; height: 21px; padding: 0; border: 1px solid #d9aaa6; border-radius: 2px; color: var(--erp-danger, #b52d27); background: #fff5f3; font: 900 13px/1 var(--ui-font); cursor: pointer; }

.stock-selection-status { min-height: 18px; margin: 0; padding: 3px 9px; border-top: 1px solid var(--erp-border); color: var(--muted); background: linear-gradient(90deg, color-mix(in srgb, var(--brand-turquoise-pale) 32%, var(--erp-surface-muted)), var(--erp-surface-muted)); font-size: 8px; font-weight: 750; }
.stock-selection-status.is-error { color: var(--erp-danger, #b52d27); }

.stock-selection-actions { min-height: 43px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 5px 9px; border-top: 1px solid color-mix(in srgb, var(--erp-accent) 24%, var(--erp-border)); background: linear-gradient(90deg, var(--erp-surface) 0%, color-mix(in srgb, var(--brand-turquoise-pale) 26%, var(--erp-surface)) 100%); box-shadow: 0 -4px 12px rgb(7 45 76 / 6%); }
.stock-selection-actions .button { min-width: 120px; min-height: 31px; border-radius: 3px; font-size: 9px; font-weight: 900; }

.stock-selection-table .empty-row,
.stock-selection-picked .empty-row { color: var(--muted); font-style: normal; text-align: center; }

@media (max-width: 1180px) {
  .stock-selection-workspace { grid-template-columns: 188px minmax(470px, 1fr) 268px; }
}

@media (max-width: 900px) {
  .stock-selection-dialog { width: calc(100vw - 8px); height: calc(100dvh - 8px); }
  .stock-selection-workspace { grid-template-columns: 180px minmax(520px, 1fr); grid-template-rows: minmax(360px, 1fr) 180px; overflow: auto; }
  .stock-selection-detail { display: none; }
}

@media print { .stock-selection-dialog { display: none !important; } }

/* Compact corporate selection workspace; header palette remains scoped to this dialog. */
.stock-selection-dialog { border:1px solid var(--erp-border); border-radius:12px; }
.stock-selection-header { min-height:0; padding:6px 12px; gap:10px; border:0; background:var(--document-header-bg,#2d2b83); color:#fff; box-shadow:none; }
.stock-selection-header > div:first-child { min-width:0; }
.stock-selection-header .eyebrow { font-size:8px; color:inherit; }
.stock-selection-header h2 { margin:2px 0; font-size:18px; color:inherit; }
.stock-selection-header p:last-child { font-size:10px; font-weight:400; color:inherit; opacity:.85; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.stock-selection-header-actions { display:flex; align-items:center; gap:5px; flex-shrink:0; }
.stock-selection-header-actions :is(.button,.standard-icon-command) { display:inline-flex; align-items:center; gap:4px; height:28px; min-height:28px; padding:3px 7px; border:1px solid var(--erp-border); border-radius:6px; font-size:10px; color:var(--ink); background:var(--erp-surface); }
.stock-selection-header-actions .standard-icon-command b { font-size:10px; color:inherit; }
.stock-selection-header-actions .command-icon { display:grid; place-items:center; width:20px; height:20px; padding:2px; border-radius:4px; color:var(--erp-accent); background:var(--erp-surface-muted); }
.stock-selection-header-actions .command-icon svg { width:16px; height:16px; }
.stock-selection-header .dialog-close { position:static; flex-shrink:0; width:28px; height:28px; min-height:28px; padding:0; margin-left:4px; background:transparent; border:1px solid #ffffff55; color:inherit; font-size:20px; }
.stock-selection-workspace { padding:6px; gap:6px; background:var(--erp-surface); grid-template-columns:230px minmax(320px,1fr) 340px; grid-template-rows:minmax(0,1fr) clamp(200px,30dvh,300px); }
.stock-selection-workspace > :is(aside,section) { border:1px solid var(--erp-border); border-radius:8px; box-shadow:none; background:var(--erp-surface); }
.stock-selection-filters { padding:6px; gap:5px; }
.stock-selection-filters > .stock-selection-panel-title { margin:-6px -6px 0; }
.stock-selection-panel-title { min-height:24px; padding:4px 7px; background:var(--stock-selection-section-bg,#2d2b83); color:var(--stock-selection-section-fg,#fff); border:0; }
.stock-selection-panel-title strong { font-size:11px; white-space:nowrap; }
.stock-selection-panel-title small { color:inherit; font-size:8px; max-width:45%; }
.stock-selection-filter-fields { grid-template-columns:repeat(2,minmax(0,1fr)); gap:5px 6px; padding:0; overflow:visible; scrollbar-gutter:auto; }
.stock-selection-filters label:not(.stock-selection-check) { min-width:0; gap:2px; }
.stock-selection-filter-fields > label:nth-child(-n+4) { grid-column:1/-1; }
.stock-selection-filters label > span { font-size:10px; line-height:12px; font-weight:600; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.stock-selection-filters :is(input[type=search],select) { height:25px; min-height:25px; border-radius:5px; padding:0 5px; font:400 11px var(--ui-font); background:var(--erp-surface); }
.stock-selection-filters :is(input,select):focus { background:var(--erp-surface); color:var(--ink); }
.stock-selection-filter-actions { grid-template-columns:1fr 1fr; gap:4px; }
.stock-selection-filters .button { min-width:0; min-height:26px; padding:3px; border-radius:5px; font-size:10px; }
.stock-selection-results-toolbar { padding:3px 7px; background:var(--stock-selection-section-bg,#2d2b83); color:var(--stock-selection-section-fg,#fff); min-height:24px; }
.stock-selection-results-toolbar > strong { font-size:10px; color:inherit; }
.stock-selection-dialog :is(.stock-selection-table,.stock-selection-picked table,.stock-selection-detail table) { border-spacing:2px; }
.stock-selection-dialog :is(th,td) { border:1px solid var(--erp-border); border-radius:6px; padding:2px 5px; font-size:11px; font-weight:400; height:24px; background:var(--erp-surface); }
.stock-selection-dialog :is(.stock-selection-table,.stock-selection-picked,.stock-selection-detail) thead th { background:var(--grid-appearance-header-bg,var(--stock-selection-section-bg,#2d2b83)); color:var(--grid-appearance-header-fg,var(--stock-selection-section-fg,#fff)); height:25px; font-size:10px; font-weight:800; }
.stock-selection-dialog thead th :is(span,b,button,svg) { color:inherit; }
.stock-selection-table tbody :is(tr,td) { height:24px; line-height:1.1; }
.stock-selection-table th:nth-child(2) { width:64px; }
.stock-selection-dialog :is(.stock-selection-table,.stock-selection-picked) input[type=number] { height:20px; min-height:20px; border-radius:4px; font:400 11px var(--ui-font); }
.stock-selection-detail { grid-template-rows:auto 140px minmax(100px,1fr) 92px minmax(100px,1fr); gap:4px; }
.stock-selection-detail section { border:1px solid var(--erp-border); border-radius:6px; grid-template-rows:24px minmax(0,1fr); }
.stock-selection-detail h3 { background:var(--stock-selection-section-bg,#2d2b83); color:var(--stock-selection-section-fg,#fff); border:0; padding:5px; font-size:10px; }
#stockSelectionDialog .stock-selection-detail tfoot th { background:var(--stock-selection-section-bg,#2d2b83); color:var(--stock-selection-section-fg,#fff); }
.stock-selection-picked .stock-selection-panel-title { min-height:24px; }
.stock-selection-image { border-radius:6px; background:var(--erp-surface-muted); box-shadow:none; }
.stock-selection-image span { font-size:10px; }
.stock-selection-actions { min-height:34px; padding:4px 8px; background:var(--erp-surface); box-shadow:none; }
.stock-selection-actions .button { min-height:26px; padding:3px 8px; border-radius:6px; font-size:11px; }
.stock-selection-status { min-height:18px; font-size:10px; padding:2px 8px; background:var(--erp-surface-muted); }
@media(max-width:1180px) { .stock-selection-workspace { grid-template-columns:218px minmax(280px,1fr) 300px; } .stock-selection-header h2 { font-size:16px; } }
@media(max-height:650px) { .stock-selection-filters :is(input[type=search],select) { height:22px; min-height:22px; } .stock-selection-filter-fields { gap:3px 5px; } .stock-selection-detail { grid-template-rows:auto 110px minmax(80px,1fr) 78px minmax(80px,1fr); } }
@media(max-width:900px) { .stock-selection-workspace { grid-template-columns:218px minmax(420px,1fr); grid-template-rows:minmax(240px,1fr) 200px; padding:5px; gap:5px; } .stock-selection-header { flex-wrap:wrap; } .stock-selection-header-actions { flex-wrap:wrap; } }
/* Offers inspect prices only: no unqueried warehouse quantities or blank image panel. */
#stockSelectionDialog.stock-selection-offer-detail .stock-selection-detail { grid-template-rows:auto 110px minmax(150px,1fr); }
@media(max-width:900px) {
  #stockSelectionDialog.stock-selection-offer-detail .stock-selection-detail { display:grid; grid-column:2; grid-row:3; min-height:300px; }
}
