.stock-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 18px;
  border: 1px solid #d6e1d3;
  border-radius: 13px;
  background: #f1f6ed;
  padding: 18px 0;
  color: #214333;
}
.stock-summary > div {
  padding: 0 clamp(12px, 2.3vw, 34px);
}
.stock-summary > div + div {
  border-inline-start: 1px solid #d0decd;
}
.stock-summary dt,
.stock-facts dt,
.stock-detail-heading small {
  color: #566c5b;
  font-size: 0.84rem;
  line-height: 1.5;
}
.stock-summary dd {
  margin: 4px 0 0;
  font-size: clamp(1.3rem, 2.2vw, 1.85rem);
  line-height: 1.25;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.stock-summary dd small {
  margin-inline-start: 5px;
  font-size: 0.8rem;
  font-weight: 500;
}
.restock-page .panel-toolbar h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 630;
}
.restock-page .panel-toolbar h2 small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}
.stock-table-wrap {
  container-type: inline-size;
  overflow: auto;
}
.stock-table {
  width: 100%;
  border-spacing: 0;
  text-align: start;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}
.stock-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}
.stock-table th,
.stock-table td {
  text-align: start;
  padding: 15px 12px;
  border-bottom: 1px solid #e8ece5;
}
.stock-table thead th {
  color: #5a6b60;
  font-size: 0.8rem;
  font-weight: 550;
  background: #f6f8f4;
  white-space: nowrap;
}
.stock-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  background: #fff;
  font-weight: 550;
}
.stock-table tbody th strong,
.stock-table tbody th small {
  display: block;
}
.stock-table tbody th small,
.stock-order small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 400;
}
.stock-product {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-wrap: anywhere;
}
.stock-table th:first-child {
  padding-inline-start: 20px;
}
.stock-table td b {
  color: #2d5a3d;
  font-weight: 630;
}
.stock-status {
  display: inline-block;
  padding: 4px 7px;
  font-size: 0.76rem;
  border-radius: 5px;
  white-space: nowrap;
}
.stock-status.pending {
  color: #73551c;
  background: #faf2d9;
}
.stock-status.ordered {
  color: #346145;
  background: #e6f1e5;
}
.stock-pager {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.stock-pager > span {
  font-size: 0.8rem;
  color: var(--muted);
}
.stock-pager > div {
  display: flex;
  gap: 6px;
}
.stock-detail-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.stock-detail-heading h3 {
  margin: 5px 0;
  font-size: 1.15rem;
}
.stock-detail-heading p,
.stock-create p,
.stock-calculation p,
.stock-order p {
  font-size: 0.86rem;
  line-height: 1.6;
  color: #53645a;
}
.stock-detail-heading > div:last-child {
  flex: none;
  display: grid;
  text-align: end;
}
.stock-detail-heading strong {
  font-size: 1.55rem;
  color: var(--pine);
}
.stock-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 10px;
  padding: 16px 0;
  margin: 16px 0;
  border-block: 1px solid var(--line);
}
.stock-facts dd {
  margin: 3px 0 0;
  font-size: 0.95rem;
  font-weight: 600;
}
.stock-calculation,
.stock-order {
  padding: 13px;
  border-radius: 8px;
  background: #f1f6ed;
  line-height: 1.6;
}
.stock-calculation h4,
.stock-order strong {
  margin: 0;
  color: #365b40;
  font-size: 0.9rem;
}
.stock-calculation b {
  display: block;
  margin-top: 4px;
  color: #2c5237;
  font-size: 0.92rem;
}
.stock-order,
.stock-create {
  margin-top: 16px;
}
.stock-order strong {
  display: flex;
  align-items: center;
  gap: 5px;
}
.stock-create {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.stock-create a {
  color: var(--pine);
  text-underline-offset: 2px;
}
@container (width < 650px) {
  .stock-table,
  .stock-table tbody {
    display: block;
  }
  .stock-table thead {
    display: none;
  }
  .stock-table tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
  }
  .stock-table tbody th,
  .stock-table td {
    position: static;
    padding: 0;
    border: 0;
  }
  .stock-table tbody th:first-child {
    grid-column: 1/-1;
    padding: 0;
  }
  .stock-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: #52685a;
    font-size: 0.75rem;
    margin: 0 0 2px;
  }
  .stock-table td:last-child {
    align-self: end;
    justify-self: end;
  }
}
@media (max-width: 600px) {
  .stock-summary {
    padding: 13px 0;
    margin-bottom: 11px;
  }
  .stock-summary > div {
    padding: 0 9px;
  }
  .stock-summary dt {
    font-size: 0.76rem;
  }
  .stock-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Dynamic Jushuitan Restock Calculation Board */
.stock-summary.restock-kpi-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.stock-summary dd.is-urgent {
  color: #b43123;
}
.stock-summary dd.is-warning {
  color: #9c5b10;
}
.restock-params-panel {
  padding: 14px 18px;
}
.restock-params-bar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}
.rs-param {
  display: grid;
  gap: 5px;
  font-size: 0.79rem;
  color: #4f6457;
  font-weight: 560;
}
.rs-param input {
  width: 96px;
  min-height: 34px;
  padding: 5px 9px;
  border-radius: 7px;
  border: 1px solid #cedace;
  background: #fff;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.rs-ratio-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rs-ratio-wrap small {
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--pine);
}
.rs-formula-note {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed #dde6dc;
  font-size: 0.77rem;
  color: #5b7063;
  line-height: 1.5;
}
.rs-formula-note code {
  padding: 1px 5px;
  border-radius: 4px;
  background: #f1f6ee;
  color: #214e38;
  font-size: 0.75rem;
}
.rs-urgency-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.rs-tab {
  min-height: 33px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid #d5e0d5;
  background: #fff;
  color: #4a6053;
  font-size: 0.82rem;
  font-weight: 550;
}
.rs-tab[aria-pressed='true'] {
  background: #1f5c42;
  border-color: #1f5c42;
  color: #fff;
}
.rs-tab.urgent[aria-pressed='true'] {
  background: #b53425;
  border-color: #b53425;
}
.rs-tab.warning[aria-pressed='true'] {
  background: #a36210;
  border-color: #a36210;
}
.rs-urg-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.73rem;
  font-weight: 620;
  margin-top: 3px;
}
.rs-urg-pill.urgent {
  background: #fdeae7;
  color: #a92b1f;
}
.rs-urg-pill.warning {
  background: #fdf2dc;
  color: #8f530e;
}
.rs-urg-pill.healthy {
  background: #e6f3e7;
  color: #225c3e;
}
.rs-qty-input {
  width: 78px;
  min-height: 32px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #cbd8cb;
  background: #fff;
  font-weight: 650;
  color: #1f543a;
  font-variant-numeric: tabular-nums;
}
.rs-feedback {
  margin: 0 16px 12px;
  padding: 10px 13px;
  border-radius: 8px;
  background: #eaf4e8;
  border: 1px solid #c8dec6;
  color: #1f5238;
  font-size: 0.83rem;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.rs-feedback[hidden] {
  display: none;
}
@media (max-width: 820px) {
  .stock-summary.restock-kpi-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 10px;
  }
  .stock-summary.restock-kpi-4 > div:nth-child(3) {
    border-inline-start: 0;
  }
}

