/* Runtime visual corrections from the 16 Aug production walkthroughs.
   Presentation-only: no policy, evidence, authorisation or persistence semantics. */

/* Root cause observed at 1366x768 with normal browser zoom: specialist content
   can expand to its min-content width inside the project rail + workspace shell.
   Constrain every specialist layer to the available width and let long content
   scroll inside its own panel instead of pushing the page off-screen. */
.workspace-control-page.runtime-specialist-active .control-plane-layout.technical-mode {
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) !important;
  width: 100% !important;
  max-width: 100% !important;
}

.workspace-control-page.runtime-specialist-active .control-plane-main,
.workspace-control-page.runtime-specialist-active .technical-controls-wrap,
.workspace-control-page.runtime-specialist-active .control-section,
.workspace-control-page.runtime-specialist-active .runtime-grid,
.workspace-control-page.runtime-specialist-active .runtime-grid > *,
.workspace-control-page.runtime-specialist-active .technical-controls-wrap > *,
.workspace-control-page.runtime-specialist-active .control-section > * {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

/* At ordinary laptop/desktop widths the workspace already has the global nav
   plus the protected-agent rail. A second internal column is too narrow and was
   the source of the clipped Connection keys, Rules and Access map panels. */
@media (max-width: 1500px) {
  .workspace-control-page.runtime-specialist-active .runtime-grid,
  .workspace-control-page.runtime-specialist-active .form-grid,
  .workspace-control-page.runtime-specialist-active .choice-grid,
  .workspace-control-page.runtime-specialist-active .policy-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* Code and tabular evidence may legitimately be wider than the panel. Keep that
   overflow local so it never widens the whole specialist workspace. */
.workspace-control-page.runtime-specialist-active pre,
.workspace-control-page.runtime-specialist-active .data-table {
  max-width: 100%;
}

.workspace-control-page.runtime-specialist-active pre {
  overflow-x: auto !important;
}

/* Access map: use the full row, then keep the evidence state readable. */
.workspace-control-page.runtime-specialist-active #inventory .runtime-grid {
  grid-template-columns: minmax(0, 1fr) !important;
}

.workspace-control-page.runtime-specialist-active #inventory .runtime-grid > .panel {
  width: 100%;
  min-width: 0;
}

.workspace-control-page.runtime-specialist-active #inventory .inventory-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 10px !important;
}

.workspace-control-page.runtime-specialist-active #inventory .inventory-metrics > div {
  display: block !important;
  min-width: 0;
  padding: 12px !important;
}

.workspace-control-page.runtime-specialist-active #inventory .inventory-metrics > div > strong,
.workspace-control-page.runtime-specialist-active #inventory .inventory-metrics > div > span,
.workspace-control-page.runtime-specialist-active #inventory .inventory-metrics > div > small {
  display: block !important;
  width: auto !important;
  min-width: 0;
  max-width: 100%;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: break-word !important;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
}

.workspace-control-page.runtime-specialist-active #inventory .inventory-metrics > div > strong {
  margin-bottom: 4px !important;
  font-size: 18px;
  line-height: 1.2;
}

.workspace-control-page.runtime-specialist-active #inventory .inventory-metrics > div > span,
.workspace-control-page.runtime-specialist-active #inventory .inventory-metrics > div > small {
  line-height: 1.4;
}

.workspace-control-page.runtime-specialist-active #inventory .asset-list {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

/* Decision evidence has six columns. Keep the table readable and scroll it
   inside the evidence panel rather than expanding the page. */
.workspace-control-page.runtime-specialist-active #decisionEvidence {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overscroll-behavior-x: contain;
}

.workspace-control-page.runtime-specialist-active #decisionEvidence .data-table {
  width: 900px !important;
  min-width: 900px !important;
  max-width: none !important;
}

.workspace-control-page.runtime-specialist-active #decisionEvidence .data-table-head,
.workspace-control-page.runtime-specialist-active #decisionEvidence .data-table-row {
  min-width: 900px !important;
  column-gap: 14px !important;
}

.workspace-control-page.runtime-specialist-active #decisionEvidence .data-table-head > span,
.workspace-control-page.runtime-specialist-active #decisionEvidence .data-table-row > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.bound-retest-command {
  margin-top: .75rem;
}

.bound-retest-command-text {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
}

.retest-action-busy {
  min-width: 9rem;
}

@media (max-width: 1180px) {
  .workspace-control-page.runtime-specialist-active .control-plane-layout.technical-mode {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .workspace-control-page.runtime-specialist-active .project-rail {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

@media (max-width: 900px) {
  .workspace-control-page.runtime-specialist-active #inventory .inventory-metrics,
  .workspace-control-page.runtime-specialist-active #inventory .asset-list {
    grid-template-columns: 1fr !important;
  }
}
