.stk {
  display: grid;
  gap: 14px;
}

.stk-copy,
.stk-meta-line,
.stk-meta,
.stk-notes,
.stk-empty {
  margin: 0;
  color: var(--muted);
}

.stk-copy {
  color: var(--ink);
  font-size: 0.95rem;
}

.stk-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.stk-ho-toolbar {
  margin-top: -4px;
}

.stk-ho-toolbar select {
  min-width: 160px;
}

.stk-search {
  flex: 1 1 240px;
}

.stk-search input,
.stk select {
  font: inherit;
  font-family: var(--font-body);
  border: 1px solid var(--line);
  border-radius: var(--field-radius);
  background-color: var(--surface-2);
  color: var(--ink);
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
}

.stk-search input:focus,
.stk select:focus {
  outline: none;
  border-color: var(--brand, var(--teal));
  box-shadow: var(--focus-ring, 0 0 0 3px var(--brand-soft));
}

.stk select {
  min-width: 136px;
  padding-right: 28px;
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.stk-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.stk-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 0.88rem;
}

.stk-table th,
.stk-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--ink);
}

.stk-table th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  white-space: nowrap;
  z-index: 1;
}

.stk-table tr:last-child td {
  border-bottom: 0;
}

.stk-table tr.needs-review {
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}

.stk-name {
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.stk-meta,
.stk-notes {
  font-size: 0.78rem;
  margin-top: 4px;
}

.stk-code,
.stk-price {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.stk-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  white-space: nowrap;
}

.stk-pill.is-review {
  background: #3a1820;
  color: #f0a0aa;
  border-color: #5a2834;
}

html[data-theme="light"] .stk-pill.is-review {
  background: #fde8ec;
  color: #9a1832;
  border-color: #f3b8c4;
}

.stk-pill.is-linked {
  background: #143028;
  color: #7ddeb0;
  border-color: #1f4a38;
}

html[data-theme="light"] .stk-pill.is-linked {
  background: #e5f6ec;
  color: #0a6b34;
  border-color: #b7e4c7;
}

.stk-pill.is-partial {
  background: #3a2e14;
  color: #f0d090;
  border-color: #5a4820;
}

html[data-theme="light"] .stk-pill.is-partial {
  background: #fff4d6;
  color: #8a5a00;
  border-color: #f0d090;
}

.stk-pill.is-unlinked {
  background: #3a1820;
  color: #f0a0aa;
  border-color: #5a2834;
}

html[data-theme="light"] .stk-pill.is-unlinked {
  background: #fde8ec;
  color: #9a1832;
  border-color: #f3b8c4;
}

.stk-empty {
  margin: 8px 0 14px;
}

.stk-placeholder-card {
  display: grid;
  gap: 8px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-left: 3px solid var(--brand);
  color: var(--ink);
  padding: var(--card-pad, 14px 16px);
  max-width: 560px;
  box-shadow: var(--shadow-sm);
}

.stk-placeholder-card strong {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.stk-placeholder-card ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
}

.stk-onhand-wrap {
  overflow: auto;
  width: 100%;
  max-width: none;
  min-height: 0;
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.stk-inventory-list .ord-po-table {
  width: 100%;
  min-width: 0;
}

.stk-inventory-list .ord-po-filters,
.stk-inventory-list .ord-po-row {
  width: 100%;
  min-width: 720px;
}

.stk-inventory-list .stk-inv-menu-col {
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: none;
  font-weight: 400;
}

.stk-inventory-list .ord-po-row .stk-inv-menu-col {
  overflow: visible;
}

.stk-inventory-list .ord-po-row:has(.stk-row-menu.is-open) {
  position: relative;
  z-index: 6;
}

.stk-inventory-list .ord-po-filters .stk-inv-menu-col {
  min-height: var(--list-row-height);
}

.stk-inventory-list .ord-po-row {
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.9rem;
  color: var(--ink);
  text-align: center;
}

.stk-inventory-list .ord-po-row .stk-code {
  font-variant-numeric: tabular-nums;
}

.stk-inventory-list .ord-po-row .stk-qty {
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  text-align: center;
}

.stk-inventory-list .ord-po-filters .ord-po-col[data-col-key="qty"] input {
  text-align: center;
}

.stk-row-menu {
  position: relative;
  display: inline-flex;
  justify-content: center;
}

.stk-row-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  letter-spacing: 0;
  cursor: pointer;
}

.stk-row-menu-btn:hover,
.stk-row-menu-btn:focus-visible,
.stk-row-menu.is-open .stk-row-menu-btn {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--ink);
  outline: none;
}

.stk-row-menu-panel {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  z-index: 8;
  min-width: 140px;
  display: grid;
  gap: 0;
  padding: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stk-row-menu-panel[hidden] {
  display: none !important;
}

.stk-row-menu-panel button {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.stk-row-menu-panel button:hover,
.stk-row-menu-panel button:focus-visible {
  background: var(--brand-softer, var(--surface-2));
  outline: none;
}

.stk-history-card {
  width: min(980px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: min(90vh, 860px);
  padding: 18px 18px 14px;
  gap: 14px;
  overflow: hidden;
  grid-template-rows: auto 1fr auto;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand, var(--teal));
  box-shadow:
    0 18px 48px rgba(7, 61, 58, 0.28),
    0 4px 12px rgba(7, 61, 58, 0.12);
}

html[data-theme="dark"] .stk-history-card {
  background: var(--surface);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.55),
    0 4px 12px rgba(0, 0, 0, 0.35);
}

.stk-history-head h3 {
  margin: 0;
}

.stk-history-body {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 14px;
  align-content: start;
}

.stk-history-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: stretch;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.stk-history-meta {
  margin: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px 16px;
  align-items: start;
}

.stk-history-desc dd {
  overflow-wrap: anywhere;
}

.stk-history-meta dt {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.stk-history-meta dd {
  margin: 0;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.3;
}

.stk-history-onhand {
  display: grid;
  align-content: center;
  justify-items: end;
  gap: 2px;
  min-width: 112px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.stk-history-onhand-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.stk-history-onhand-qty {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stk-history-onhand-uom {
  color: var(--muted);
  font-size: 0.82rem;
}

.stk-history-section {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.stk-history-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
}

.stk-history-section-head h4 {
  margin: 0;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
}

.stk-history-wrap {
  max-height: min(52vh, 460px);
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}

.stk-history-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.84rem;
  line-height: 1.3;
  table-layout: auto;
}

.stk-history-table th,
.stk-history-table td {
  box-sizing: border-box;
  height: 28px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.stk-history-table td.stk-history-ref {
  white-space: normal;
  max-width: 220px;
}

.stk-history-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.stk-history-type {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
}

.stk-history-type[data-type="grn-receive"],
.stk-history-type[data-type="receipt"] {
  border-color: color-mix(in srgb, var(--success) 35%, var(--line));
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
  color: var(--success);
}

.stk-history-type[data-type="grn-undo"],
.stk-history-type[data-type="receipt-undone"],
.stk-history-type[data-type="waste"] {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  color: var(--danger);
}

.stk-history-type[data-type="stock-count"],
.stk-history-type[data-type="count"] {
  border-color: color-mix(in srgb, var(--brand, var(--teal)) 35%, var(--line));
  background: color-mix(in srgb, var(--brand, var(--teal)) 10%, var(--surface));
  color: var(--brand, var(--teal));
}

.stk-history-table .stk-qty {
  width: auto;
  min-width: 0;
  min-height: 0;
  height: auto;
  max-height: none;
  padding: 0 8px;
  border: 0;
  background: transparent;
  text-align: right;
  font-variant-numeric: tabular-nums;
  box-shadow: none;
  line-height: 1.3;
}

.stk-history-table .stk-qty.is-up {
  color: var(--success);
  font-weight: 700;
}

.stk-history-table .stk-qty.is-down {
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 720px) {
  .stk-history-summary {
    grid-template-columns: 1fr;
  }

  .stk-history-meta {
    grid-template-columns: 1fr 1fr;
  }

  .stk-history-desc {
    grid-column: 1 / -1;
  }

  .stk-history-onhand {
    justify-items: start;
    padding-left: 0;
    padding-top: 10px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

.stk-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 0.9rem;
  white-space: nowrap;
}

.stk-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid #3a3a3a;
  background: #2a2a2a;
  color: #d4d4d4;
  font-size: 0.72rem;
  font-weight: 600;
  vertical-align: middle;
}

.stk-pill.is-review {
  background: #3a1820;
  color: #f0a0aa;
  border-color: #5a2834;
}

.stk-pill.is-linked {
  background: #143028;
  color: #7ddeb0;
  border-color: #1f4a38;
}

html[data-theme="light"] .stk-pill {
  background: #eef0f3;
  color: #2a2e33;
  border-color: #d5d8de;
  border-width: 1px;
}

html[data-theme="light"] .stk-pill.is-review {
  background: #fde8ec;
  color: #9a1832;
  border-color: #f3b8c4;
}

html[data-theme="light"] .stk-pill.is-linked {
  background: #e5f6ec;
  color: #0a6b34;
  border-color: #b7e4c7;
}

.stk-counts-host,
.stk-counts-host .stk {
  min-height: 0;
  height: 100%;
}

.stk[data-stk-tab="counts"] {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.stk[data-stk-tab="counts"] .stk-counts-host {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.stk[data-stk-tab="counts"] .ord-po-workspace {
  flex: 1 1 auto;
  min-height: 0;
}

.stk[data-stk-tab="inventory"] {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.stk[data-stk-tab="inventory"] .list-head {
  flex: 0 0 auto;
}

.stk-inventory-main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 2px;
}

.stk-inventory-main > .stk-copy {
  flex: 0 0 auto;
}

.stk[data-stk-tab="inventory"] .stk-onhand-wrap {
  max-width: none;
}

/* Keep Inventory, Stock Count, and Adjustments scope choices visible; icons show when the rail is collapsed. */
.stk[data-stk-tab="inventory"] .ord-po-scope-toggle,
.stk[data-stk-tab="counts"] .ord-po-scope-toggle,
.stk[data-stk-tab="adjustments"] .ord-po-scope-toggle {
  display: grid;
  gap: 6px;
  width: 100%;
}

.stk[data-stk-tab="inventory"] .ord-po-scope-toggle .ord-po-action-btn,
.stk[data-stk-tab="counts"] .ord-po-scope-toggle .ord-po-action-btn,
.stk[data-stk-tab="adjustments"] .ord-po-scope-toggle .ord-po-action-btn {
  display: inline-flex;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}

/* Use #fff — --white aliases --surface and washes out on the brand fill. */
.stk[data-stk-tab="inventory"] .ord-po-scope-toggle .ord-po-action-btn.is-selected,
.stk[data-stk-tab="counts"] .ord-po-scope-toggle .ord-po-action-btn.is-selected,
.stk[data-stk-tab="adjustments"] .ord-po-scope-toggle .ord-po-action-btn.is-selected {
  background: var(--brand, var(--teal));
  color: #fff;
  border-color: var(--brand, var(--teal));
}

.stk[data-stk-tab="inventory"] .ord-po-scope-toggle .ord-po-action-btn.is-selected .ord-po-action-label,
.stk[data-stk-tab="inventory"] .ord-po-scope-toggle .ord-po-action-btn.is-selected .ord-po-action-icon,
.stk[data-stk-tab="counts"] .ord-po-scope-toggle .ord-po-action-btn.is-selected .ord-po-action-label,
.stk[data-stk-tab="counts"] .ord-po-scope-toggle .ord-po-action-btn.is-selected .ord-po-action-icon,
.stk[data-stk-tab="adjustments"] .ord-po-scope-toggle .ord-po-action-btn.is-selected .ord-po-action-label,
.stk[data-stk-tab="adjustments"] .ord-po-scope-toggle .ord-po-action-btn.is-selected .ord-po-action-icon {
  color: #fff;
}

html[data-theme="dark"] .stk[data-stk-tab="inventory"] .ord-po-scope-toggle .ord-po-action-btn.is-selected,
html[data-theme="dark"] .stk[data-stk-tab="inventory"] .ord-po-scope-toggle .ord-po-action-btn.is-selected .ord-po-action-label,
html[data-theme="dark"] .stk[data-stk-tab="inventory"] .ord-po-scope-toggle .ord-po-action-btn.is-selected .ord-po-action-icon,
html[data-theme="dark"] .stk[data-stk-tab="counts"] .ord-po-scope-toggle .ord-po-action-btn.is-selected,
html[data-theme="dark"] .stk[data-stk-tab="counts"] .ord-po-scope-toggle .ord-po-action-btn.is-selected .ord-po-action-label,
html[data-theme="dark"] .stk[data-stk-tab="counts"] .ord-po-scope-toggle .ord-po-action-btn.is-selected .ord-po-action-icon,
html[data-theme="dark"] .stk[data-stk-tab="adjustments"] .ord-po-scope-toggle .ord-po-action-btn.is-selected,
html[data-theme="dark"] .stk[data-stk-tab="adjustments"] .ord-po-scope-toggle .ord-po-action-btn.is-selected .ord-po-action-label,
html[data-theme="dark"] .stk[data-stk-tab="adjustments"] .ord-po-scope-toggle .ord-po-action-btn.is-selected .ord-po-action-icon {
  color: #0d1117;
}

.stk-count-detail {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  padding: 6px 10px 8px;
  overflow: hidden;
  box-sizing: border-box;
  font-size: 0.78rem;
}

.stk-count-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
}

.stk-count-detail-head .due {
  margin: 2px 0 0;
  font-size: 0.76rem;
}

.stk-count-title {
  margin: 0;
  color: var(--brand);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.stk-count-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  flex: 0 0 auto;
}

.stk-count-meta-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin: 0;
  min-width: 0;
}

.stk-count-meta-field > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  white-space: nowrap;
}

.stk-count-meta-field input,
.stk-count-meta-field select {
  min-height: 32px;
  height: 32px;
  padding: 2px 8px;
  font-size: 0.76rem;
  box-sizing: border-box;
}

.stk-count-meta-field select {
  max-width: 220px;
}

.stk-count-meta-field input.is-missing {
  border-color: var(--danger);
}

.stk-count-meta-field input[type="date"] {
  width: 138px;
}

.stk-count-meta-search {
  flex: 1 1 180px;
}

.stk-count-meta-search input {
  width: 100%;
  min-width: 0;
}

.stk-count-area-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
  flex: 1 1 auto;
  align-content: start;
  overflow: auto;
  min-height: 0;
}

.stk-count-area-btn.is-all {
  border-color: var(--brand, var(--teal));
  color: var(--brand, var(--teal));
  font-weight: 600;
}

.stk-count-area-btn {
  min-height: 36px;
  justify-content: center;
}

.stk-count-lines-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}

.stk-count-lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.stk[data-stk-tab="counts"] .ord-po-detail-pane {
  min-width: 280px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.stk[data-stk-tab="counts"] .ord-po-detail-pane > .stk-count-detail {
  flex: 1 1 auto;
  min-height: 0;
}

.stk[data-stk-tab="counts"] .ord-po-list {
  overflow: auto;
}

.stk-count-lines th,
.stk-count-lines td {
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
  height: 28px;
  max-height: 28px;
  white-space: nowrap;
}

.stk-count-lines th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  z-index: 1;
}

.stk-count-lines .stk-count-name {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.stk-count-lines .stk-code {
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.stk-count-lines .stk-qty.is-up {
  color: var(--success);
  font-weight: 700;
}

.stk-count-lines .stk-qty.is-down {
  color: var(--danger);
  font-weight: 700;
}

.stk-count-qty {
  justify-content: center;
}

.stk-count-lines .ord-qty-stepper {
  min-height: 22px;
  height: 22px;
}

.stk-count-lines .ord-qty-btn {
  width: 22px;
  min-width: 22px;
  height: 22px;
  max-height: 22px;
}

.stk-count-lines .ord-qty {
  min-height: 22px;
  height: 22px;
  max-height: 22px;
  font-size: 0.76rem;
}

.stk-count-foot-note {
  margin: 0;
  flex: 0 0 auto;
  font-size: 0.76rem;
}

.stk-count-detail-foot {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.stk-count-filters .ord-po-col,
.stk-count-filters .ord-sort-head,
.stk[data-stk-tab="counts"] .ord-po-row .ord-po-col,
.stk-adj-filters .ord-po-col,
.stk-adj-filters .ord-sort-head,
.stk[data-stk-tab="adjustments"] .ord-po-row .ord-po-col {
  text-align: center;
}

.stk[data-stk-tab="adjustments"] .ord-po-detail-pane {
  min-width: 280px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.stk[data-stk-tab="adjustments"] .ord-po-detail-pane > .stk-count-detail {
  flex: 1 1 auto;
  min-height: 0;
}

.stk[data-stk-tab="adjustments"] .ord-po-list {
  overflow: auto;
}

.stk-adj-search,
.stk-adj-code {
  position: relative;
}

.stk-adj-code input {
  width: 100%;
  max-width: none;
  text-transform: uppercase;
}

.stk-adj-hits {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  max-height: 220px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
}

.stk-adj-hit {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.stk-adj-hit:hover,
.stk-adj-hit.is-active {
  background: var(--surface-2);
}

.stk-adj-lines select,
.stk-adj-lines input[type="text"] {
  height: 28px;
  min-height: 28px;
  max-width: 180px;
  font: inherit;
  font-size: 0.76rem;
}

.stk-adj-lines input.is-missing {
  border-color: var(--danger);
}

.stk-adj-lines .btn-small,
.stk-adj-bin {
  min-height: 26px;
  height: 26px;
  padding: 0 8px;
}

.stk-adj-bin {
  width: 28px;
  min-width: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stk-adj-void-reason {
  flex: 1 1 240px;
}

.stk-adj-void-reason input {
  flex: 1 1 auto;
  min-width: 160px;
}

.stk-btn {
  font: inherit;
  font-family: var(--font-display);
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  min-height: var(--control-height, 38px);
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.stk-btn.is-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

.stk-btn.is-danger {
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  color: var(--danger, var(--pink));
}

.stk-btn.is-small {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 0.78rem;
}

.stk-btn:hover,
.stk-btn:focus-visible {
  background: var(--surface-2);
}

.stk-btn.is-primary:hover,
.stk-btn.is-primary:focus-visible {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

.stk-recipe-group {
  display: grid;
  gap: 12px;
}

.stk-recipe-group h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.stk-recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.stk-recipe-card {
  display: grid;
  gap: 6px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  padding: 14px 16px;
  cursor: pointer;
  font: inherit;
  min-height: 88px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.stk-recipe-card.is-blank {
  border-style: dashed;
  background: var(--surface-2);
  box-shadow: none;
}

.stk-recipe-card:hover,
.stk-recipe-card:focus-visible {
  border-color: color-mix(in srgb, var(--brand) 45%, transparent);
  box-shadow: var(--focus-ring, 0 0 0 3px var(--brand-soft));
  background: var(--surface);
  color: var(--ink);
}

.stk-recipe-card:hover .stk-meta,
.stk-recipe-card:focus-visible .stk-meta {
  color: var(--muted);
}

.stk-recipe-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.stk-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.stk-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.stk-field-wide {
  grid-column: 1 / -1;
}

.stk-field input,
.stk-field textarea,
.stk-inline,
.stk-qty,
.stk-unit {
  font: inherit;
  font-family: var(--font-body);
  font-weight: 400;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

.stk-field input:focus,
.stk-field textarea:focus,
.stk-inline:focus,
.stk-qty:focus,
.stk-unit:focus {
  outline: none;
  border-color: var(--brand, var(--teal));
  box-shadow: var(--focus-ring, 0 0 0 3px var(--brand-soft));
}

.stk-field textarea {
  min-height: 72px;
  resize: vertical;
  font-weight: 400;
}

.stk-qty {
  width: 88px;
  min-width: 72px;
}

.stk-inventory-list .ord-po-row .stk-qty {
  width: auto;
  min-width: 2.4rem;
  min-height: 0;
  height: 22px;
  max-height: 22px;
  padding: 0 8px;
  line-height: 20px;
  box-sizing: border-box;
  background-color: var(--surface-2);
}

.stk-inventory-list .stk-row-menu-btn {
  width: 22px;
  height: 22px;
}

.stk-unit {
  min-width: 96px;
}

.stk-ingredients {
  display: grid;
  gap: 10px;
}

.stk-ingredients-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.stk-ingredients-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.stk-picker {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  max-height: 220px;
  overflow: auto;
}

.stk-picker-row {
  display: grid;
  gap: 2px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
}

.stk-picker-row:last-child {
  border-bottom: 0;
}

.stk-picker-row:hover,
.stk-picker-row:focus-visible {
  background: var(--brand-softer, var(--brand-softer));
}

.cat-recipe-ingredients .stk-table td {
  padding: 8px 10px;
  vertical-align: middle;
}

.cat-recipe-ingredients .stk-qty,
.cat-recipe-ingredients .stk-unit,
.cat-recipe-ingredients .stk-line-search input {
  min-height: 28px;
  height: 28px;
  padding: 2px 8px;
  line-height: 1.2;
  box-sizing: border-box;
}

.cat-recipe-ingredients .stk-qty {
  width: 64px;
  min-width: 56px;
}

.cat-recipe-ingredients .stk-unit {
  width: 76px;
  min-width: 76px;
  padding-right: 22px;
  background-position: right 6px center;
}

.cat-recipe-ingredients .stk-line-search {
  display: block;
  flex: none;
  max-width: none;
  margin-top: 4px;
}

.stk-book-switch {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
}

.cat-recipe-ingredients .stk-table-wrap {
  overflow: visible;
}

.cat-recipe-ingredients .stk-add-pick,
.cat-recipe-ingredients .stk-line-pick {
  position: relative;
}

.cat-recipe-ingredients .stk-line-pick {
  max-width: 220px;
}

.cat-recipe-ingredients tr.is-picking {
  position: relative;
  z-index: 4;
}

.cat-recipe-ingredients .stk-add-pick .stk-picker,
.cat-recipe-ingredients .stk-line-pick .stk-picker,
.cat-recipe-ingredients .stk-add-pick .stk-meta-line,
.cat-recipe-ingredients .stk-line-pick .stk-meta-line {
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 5;
  width: max(100%, 280px);
  max-width: none;
  margin-top: 4px;
  box-shadow: var(--shadow-md);
}

@media (max-width: 900px) {
  .stk-table th:nth-child(4),
  .stk-table td:nth-child(4),
  .stk-table th:nth-child(5),
  .stk-table td:nth-child(5) {
    display: none;
  }
}


/* —— Recipes (DESIGN.md list/detail) —— */
#stock-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

#stock-panel .stk {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

#stock-panel .ord-po-workspace {
  flex: 1 1 auto;
  min-height: 420px;
  height: calc(100vh - 220px);
  max-height: none;
}

/* Inventory: fill remaining panel height so the scope rail matches the table. */
#stock-panel .stk[data-stk-tab="inventory"] .ord-po-workspace {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  align-items: stretch;
}

#stock-panel .stk[data-stk-tab="inventory"] .ord-po-actions-rail {
  align-self: stretch;
  height: auto;
  min-height: 100%;
}

#stock-panel .stk[data-stk-tab="inventory"] .stk-inventory-main {
  align-self: stretch;
  min-height: 0;
}

/* Three tracks: list | gutter | detail. A 2-col rule wraps detail under the list. */
#stock-panel .ord-po-layout.is-split {
  grid-template-columns:
    minmax(220px, var(--ord-po-list-width, 360px))
    var(--split-gutter)
    minmax(280px, 1fr);
}

#stock-panel .ord-po-list {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}

#stock-panel .ord-po-table {
  display: grid;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
  align-content: start;
  overflow: auto;
}

#stock-panel .cat-list-sticky {
  position: sticky;
  top: 0;
  z-index: 3;
  align-self: start;
  background: var(--surface-2);
  width: max-content;
  min-width: 100%;
}

#stock-panel .cat-list-sticky .ord-po-list-tools,
#stock-panel .cat-list-sticky .ord-po-filters {
  position: static;
  top: auto;
  background: var(--surface-2);
}

#stock-panel .ord-po-filters,
#stock-panel .ord-po-row {
  width: 100%;
  min-width: var(--ord-po-min, 0px);
}

#stock-panel .ord-po-list-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

#stock-panel .ord-po-list-tools .ord-search {
  flex: 1 1 160px;
  margin: 0;
}

#stock-panel .ord-po-list-tools .ord-search input,
#stock-panel .ord-po-list-tools select {
  min-height: var(--control-height-sm, 32px);
  font-size: 0.86rem;
  padding: 6px 10px;
}

#stock-panel .ord-po-row.is-inactive {
  opacity: 0.65;
}

#stock-panel .stk-recipe-name {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

#stock-panel .ord-po-row.needs-link {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.stk-menu-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.stk-menu-links .stk-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stk-menu-remove {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1;
  padding: 0 0 0 2px;
  cursor: pointer;
}

.stk-link-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 0.86rem;
}

fieldset.cat-recipe-lock {
  border: 0;
  margin: 0;
  padding: 0;
  min-inline-size: 0;
  width: 100%;
  display: grid;
  gap: var(--nav-gap);
  align-content: start;
}

.cat-recipe-detail {
  padding: var(--nav-gap) var(--nav-gap) var(--nav-gap) 0;
  overflow: auto;
  height: 100%;
  box-sizing: border-box;
  font-size: 0.9rem;
  display: grid;
  gap: var(--nav-gap);
  align-content: start;
  background: var(--bg);
}

.cat-recipe-detail .ord-po-number {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--brand);
}

.cat-recipe-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  padding: 10px;
  box-sizing: border-box;
}

.cat-recipe-form .stk-field {
  margin: 0;
  min-width: 0;
}

.cat-recipe-form .stk-field span,
.cat-detail-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.cat-recipe-form .field-span-2 {
  grid-column: span 2;
}

.cat-recipe-ingredients {
  display: grid;
  gap: 10px;
  padding: 10px;
}

#stock-panel .cat-detail-section {
  border: 0;
  background: var(--surface);
  border-radius: var(--radius);
}

#stock-panel .cat-detail-section-title {
  margin: 0;
  padding: 8px 10px;
  background: transparent;
  border-bottom: 0;
}

.hub-main:has(#stock-panel:not([hidden])) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hub-main:has(#stock-panel:not([hidden])) > .subnav {
  flex: 0 0 auto;
}

.hub-main:has(#stock-panel:not([hidden])) > .stage {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
