/* Engineer Stock — updated portal workspace layout. */
.stock-page {
  --stock-ink: var(--sh-ink, #062744);
  --stock-muted: var(--sh-muted, #587078);
  --stock-green: var(--sh-forest, #087c63);
  --stock-line: rgba(105, 148, 139, 0.22);
  --stock-card: rgba(255, 255, 255, 0.9);
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: none;
  padding: 20px 24px 36px;
}

.stock-page > .module-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 66px;
  margin: 0;
}

.stock-page > .module-title-row .eyebrow {
  margin: 0 0 4px;
  color: var(--stock-green);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.12em;
}

.stock-page > .module-title-row h1 {
  margin: 0;
  color: var(--stock-ink);
  font-size: 30px;
  font-weight: 680;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.stock-page > .module-title-row p {
  margin: 5px 0 0;
  color: var(--stock-muted);
  font-size: 13px;
}

.stock-page .phase-badge--live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  color: var(--stock-green);
  background: rgba(239, 252, 247, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 #fff;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.stock-page .phase-badge--live i {
  width: 7px;
  height: 7px;
  background: #16b890;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(22, 184, 144, 0.12);
}

.stock-page .stock-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 58px;
  margin: 0;
  padding: 8px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.stock-page .stock-toolbar > span:empty {
  flex: 1 1 24px;
}

.stock-page .stock-toolbar .compact-search,
.stock-page .stock-toolbar > select,
.stock-page .stock-category-filter,
.stock-page .stock-engineer-sort {
  box-sizing: border-box;
  min-height: 40px;
  height: 40px;
  color: #506c67;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #cbdad5;
  border-radius: 10px;
  box-shadow: inset 0 1px 0 #fff;
}

.stock-page .stock-toolbar .compact-search,
.stock-page .stock-category-filter,
.stock-page .stock-engineer-sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}

.stock-page .stock-toolbar .compact-search {
  width: 205px;
}

.stock-page .stock-toolbar .compact-search:focus-within,
.stock-page .stock-category-filter:focus-within,
.stock-page .stock-engineer-sort:focus-within,
.stock-page .stock-toolbar > select:focus-visible {
  border-color: var(--stock-green);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(8, 124, 99, 0.12), inset 0 1px 0 #fff;
}

.stock-page .stock-toolbar .compact-search > svg,
.stock-page .stock-category-filter > svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  color: var(--stock-green);
}

.stock-page .stock-toolbar .compact-search input {
  width: 100%;
  min-width: 0;
  height: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  color: var(--stock-ink);
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  font-size: 12px;
}

.stock-page .stock-toolbar > select {
  min-width: 128px;
  padding: 0 32px 0 11px;
  color: var(--stock-ink);
  font-size: 12px;
}

.stock-page :is(.stock-category-filter, .stock-engineer-sort) select {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 22px 0 0;
  color: var(--stock-ink);
  background-color: transparent;
  border: 0;
  outline: 0;
  box-shadow: none;
  font-size: 12px;
  font-weight: 520;
}

.stock-page .stock-engineer-sort > span {
  color: #71847f;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.stock-page .stock-toolbar > :is(button, .button-primary, .button-secondary) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 9px;
  box-shadow: none;
  font-size: 11px;
  font-weight: 560;
}

.stock-page .stock-toolbar .button-secondary {
  color: var(--stock-green);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--stock-line);
}

.stock-page .stock-toolbar .button-secondary:hover {
  background: #edf8f4;
  border-color: #b9d7cd;
}

.stock-page .stock-toolbar .button-primary {
  color: #fff;
  background: var(--stock-green);
  border: 1px solid var(--stock-green);
}

.stock-page .stock-toolbar .button-primary:hover {
  background: #066b56;
}

.stock-page .stock-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
  align-items: stretch;
  gap: 10px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
}

.stock-page .stock-summary > :is(button, div) {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 11px 13px;
  color: var(--stock-ink);
  background: var(--stock-card);
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 13px;
  box-shadow: 0 5px 18px rgba(15, 65, 61, 0.045), inset 0 1px 0 #fff;
  text-align: left;
}

.stock-page .stock-summary > button {
  cursor: pointer;
}

.stock-page .stock-summary > button:hover {
  background: #f7fbf9;
  border-color: #c6ddd5;
}

.stock-page .stock-summary > button.is-active {
  border-color: #9fcbbb;
  box-shadow: inset 0 0 0 1px #9fcbbb, 0 5px 18px rgba(15, 65, 61, 0.045);
}

.stock-page .stock-summary-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.stock-page .stock-summary > :is(button, div) > span {
  color: var(--stock-muted);
  font-size: 11px;
  font-weight: 540;
}

.stock-page .stock-summary > :is(button, div) > strong {
  color: var(--stock-ink);
  font-size: 24px;
  font-weight: 650;
  line-height: 1;
}

.stock-page .stock-summary-clear {
  align-self: center;
  min-height: 40px !important;
  padding: 0 12px !important;
  color: var(--stock-green) !important;
  background: rgba(255, 255, 255, 0.78) !important;
  border: 1px solid var(--stock-line) !important;
}

.stock-page .stock-action-centre,
.stock-page .stock-grid-card,
.stock-page .stock-drilldown,
.stock-page .stock-activity {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  background: var(--stock-card);
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15, 65, 61, 0.055), inset 0 1px 0 #fff;
}

.stock-page .stock-action-centre > header {
  min-height: 64px;
  padding: 11px 14px;
  background: linear-gradient(90deg, rgba(255, 248, 233, 0.9), rgba(248, 252, 255, 0.66));
  border-bottom: 1px solid var(--stock-line);
}

.stock-page .stock-action-title {
  gap: 11px;
}

.stock-page .stock-action-title small {
  color: #9b6811;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.stock-page .stock-action-title h2 {
  margin: 2px 0 0;
  color: var(--stock-ink);
  font-size: 16px;
  font-weight: 630;
}

.stock-page .stock-action-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
}

.stock-page .stock-action-total {
  min-height: 32px;
  padding: 0 9px;
  border-radius: 8px;
  font-size: 10px;
}

.stock-page .stock-action-toggle {
  min-width: 52px;
  min-height: 32px;
  color: var(--stock-green);
  border-color: var(--stock-line);
  border-radius: 8px;
  font-size: 10px;
  font-weight: 650;
}

.stock-page .stock-action-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.stock-page .stock-action-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--stock-line);
  border-radius: 10px;
}

.stock-page .stock-action-item:nth-child(3n) {
  border-right: 1px solid var(--stock-line);
}

.stock-page .stock-action-item > div strong {
  color: var(--stock-ink);
  font-size: 11px;
}

.stock-page .stock-action-item > div span {
  color: var(--stock-muted);
  font-size: 9px;
}

.stock-page .stock-action-item > button {
  min-height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 9px;
  font-weight: 650;
}

.stock-page .stock-action-centre > footer {
  min-height: 44px;
  padding: 7px 13px;
  background: rgba(248, 252, 250, 0.72);
  border-top: 1px solid var(--stock-line);
}

.stock-page .stock-meaning {
  gap: 16px;
  color: var(--stock-muted);
  font-size: 10px;
}

.stock-page .stock-grid-wrap {
  max-height: min(60vh, 650px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.stock-page .stock-grid {
  width: 100%;
  min-width: 1080px;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--stock-ink);
  background: transparent;
}

.stock-page .stock-grid thead th {
  position: sticky;
  z-index: 3;
  top: 0;
  height: 72px;
  padding: 9px 8px;
  color: var(--stock-muted);
  background: rgba(239, 248, 245, 0.97);
  border: 0;
  border-right: 1px solid var(--stock-line);
  border-bottom: 1px solid var(--stock-line);
  box-shadow: 0 1px rgba(255, 255, 255, 0.8);
  font-size: 10px;
  font-weight: 550;
}

.stock-page .stock-grid thead th:first-child {
  z-index: 5;
  left: 0;
  min-width: 260px;
  padding-left: 14px;
  text-align: left;
}

.stock-page .stock-grid thead th:last-child,
.stock-page .stock-grid tbody td:last-child {
  border-right: 0;
}

.stock-page .stock-grid thead th b,
.stock-page .stock-grid thead th small {
  display: block;
}

.stock-page .stock-grid thead th b {
  margin-top: 4px;
  color: var(--stock-ink);
  font-size: 10px;
  font-weight: 620;
}

.stock-page .stock-grid thead th small {
  margin-top: 1px;
  color: #7c918b;
  font-size: 8px;
  font-weight: 450;
}

.stock-page .stock-grid tbody th,
.stock-page .stock-grid tbody td {
  height: 56px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.72);
  border: 0;
  border-right: 1px solid rgba(105, 148, 139, 0.16);
  border-bottom: 1px solid rgba(105, 148, 139, 0.16);
  text-align: center;
}

.stock-page .stock-grid tbody th {
  position: sticky;
  z-index: 2;
  left: 0;
  min-width: 260px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 1px 0 rgba(105, 148, 139, 0.16);
  text-align: left;
}

.stock-page .stock-grid tbody tr:last-child > * {
  border-bottom: 0;
}

.stock-page .stock-grid tbody tr:hover > :is(th, td) {
  background-color: #f0f9f6;
}

.stock-page .stock-engineer-cell {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 9px;
}

.stock-page .stock-engineer-cell > strong {
  min-width: 0;
  overflow: hidden;
  color: var(--stock-ink);
  font-size: 11px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-page .stock-readiness {
  margin-left: auto;
  padding: 4px 7px;
  font-size: 8px;
  font-weight: 650;
}

.stock-page .stock-quantity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 38px;
  min-height: 34px;
  padding: 0 8px;
  color: var(--stock-ink);
  background: #f1f6f4;
  border: 1px solid transparent;
  border-radius: 9px;
  box-shadow: none;
}

.stock-page .stock-quantity:hover:not(:disabled) {
  color: var(--stock-green);
  background: #e6f5f0;
  border-color: #bad8ce;
}

.stock-page .stock-quantity--empty {
  color: #c51d3f;
  background: #ffedf1;
  border-color: #f6b7c4;
}

.stock-page .stock-quantity--low {
  color: #a26500;
  background: #fff3da;
  border-color: #ecc979;
}

.stock-page .stock-quantity--untracked {
  color: #71847f;
  background: transparent;
}

.stock-page .stock-quantity--selected {
  outline: 2px solid var(--stock-green);
  outline-offset: 2px;
}

.stock-page .stock-drilldown {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
}

.stock-page .stock-activity > .panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 68px;
  padding: 12px 14px;
  background: linear-gradient(90deg, rgba(237, 248, 245, 0.92), rgba(248, 252, 255, 0.7));
  border-bottom: 1px solid var(--stock-line);
}

.stock-page .stock-activity > .panel-heading h2 {
  color: var(--stock-ink);
  font-size: 16px;
  font-weight: 630;
}

.stock-page .stock-activity > .panel-heading p {
  color: var(--stock-muted);
  font-size: 11px;
}

.stock-page .stock-activity-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) minmax(150px, 1fr) 145px 145px;
  gap: 8px;
  padding: 10px;
  background: rgba(248, 252, 250, 0.68);
  border-bottom: 1px solid var(--stock-line);
}

.stock-page .stock-activity-filters :is(select, input) {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 0 10px;
  color: var(--stock-ink);
  background: #fff;
  border: 1px solid #cbdad5;
  border-radius: 9px;
  outline: 0;
  font-size: 11px;
}

.stock-page .stock-activity-filters :is(select, input):focus-visible {
  border-color: var(--stock-green);
  box-shadow: 0 0 0 3px rgba(8, 124, 99, 0.12);
}

.stock-page .stock-activity-table-wrap {
  overflow-x: auto;
}

.stock-page .stock-activity-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

.stock-page .stock-activity-table th {
  padding: 10px 12px;
  color: var(--stock-muted);
  background: rgba(246, 251, 249, 0.8);
  border-bottom: 1px solid var(--stock-line);
  font-size: 10px;
  font-weight: 560;
  text-align: left;
}

.stock-page .stock-activity-table td {
  padding: 11px 12px;
  color: var(--stock-ink);
  background: rgba(255, 255, 255, 0.74);
  border-bottom: 1px solid rgba(105, 148, 139, 0.15);
  font-size: 11px;
}

.stock-page .stock-activity-table tbody tr:hover td {
  background: #f0f9f6;
}

@media (max-width: 1200px) {
  .stock-page .stock-toolbar > span:empty {
    display: none;
  }

  .stock-page .stock-action-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stock-page .stock-activity-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .stock-page {
    gap: 12px;
    padding: 14px 12px 28px;
  }

  .stock-page > .module-title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .stock-page .stock-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .stock-page .stock-toolbar .compact-search,
  .stock-page .stock-toolbar > select,
  .stock-page .stock-category-filter,
  .stock-page .stock-engineer-sort,
  .stock-page .stock-toolbar > :is(button, .button-primary, .button-secondary) {
    width: 100%;
  }

  .stock-page .stock-summary,
  .stock-page .stock-action-list,
  .stock-page .stock-activity-filters {
    grid-template-columns: 1fr;
  }

  .stock-page .stock-summary-clear {
    width: 100%;
  }

  .stock-page .stock-action-centre > header,
  .stock-page .stock-action-centre > footer,
  .stock-page .stock-drilldown,
  .stock-page .stock-activity > .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .stock-page .stock-action-item {
    grid-template-columns: 32px minmax(0, 1fr) auto;
  }

  .stock-page .stock-action-item > button {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stock-page :is(button, select, input) {
    transition: none;
  }
}
