/* SHARD validation, baseline and compact viewport panels. */

/* Shared validation and Astrea evidence panel. */
.shape-support-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.shape-support-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.shape-support-pane:first-child { padding-right: 12px; }
.shape-support-pane + .shape-support-pane {
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.shape-support-pane .section-title h2 {
  min-width: 0;
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shape-support-clear {
  display: grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px !important;
  padding: 0 !important;
  border-radius: 999px;
  font-size: 1rem !important;
  line-height: 1;
}

.astrea-control-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-top: 4px;
}

.astrea-control-label {
  margin: 0 !important;
  font-size: 0.64rem !important;
  white-space: nowrap;
}

.astrea-select {
  width: 100%;
  min-width: 0;
  height: 30px;
  min-height: 30px;
  padding: 3px 26px 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
}

.astrea-merge-controls {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.astrea-merge-controls[hidden] { display: none; }

.astrea-baseline-status {
  min-width: 0;
  margin: 10px 0 0;
  font-size: 0.68rem;
  line-height: 1.25;
}

.astrea-baseline-status.astrea-status-error {
  color: var(--err);
  font-weight: 700;
}

.astrea-baseline-status.astrea-status-ready {
  color: var(--ok);
  font-weight: 700;
}

.astrea-baseline-status.astrea-status-warning {
  color: var(--warn);
  font-weight: 700;
}

@media (min-width: 1061px) {
  body.rule-page,
  body.batch-page {
    --matched-shape-profile-block-height: clamp(184px, 16.5vh, 204px);
  }

  body.rule-page .shape-profile-block,
  body.batch-page .shape-profile-block {
    padding: 10px;
  }

  body.rule-page .shape-support-pane .profile-file-drop,
  body.batch-page .shape-support-pane .profile-file-drop {
    flex-basis: 38px;
    min-height: 38px;
    padding: 5px 8px;
    flex-direction: column !important;
    justify-content: center;
    gap: 1px !important;
    text-align: center;
  }

  body.rule-page .shape-support-pane .profile-file-drop,
  body.batch-page .shape-support-pane .profile-file-drop,
  body.rule-page .shape-support-pane .profile-file-drop span,
  body.rule-page .shape-support-pane .profile-file-drop small,
  body.batch-page .shape-support-pane .profile-file-drop span,
  body.batch-page .shape-support-pane .profile-file-drop small {
    min-width: 0;
  }

  body.rule-page .shape-support-pane .profile-file-drop small,
  body.batch-page .shape-support-pane .profile-file-drop small {
    overflow: visible;
    font-size: 0.6rem;
    line-height: 1.1;
    text-overflow: clip;
    white-space: nowrap;
  }

  body.rule-page .shape-support-pane .profile-file-list,
  body.batch-page .shape-support-pane .profile-file-list {
    margin-top: 5px;
  }
}

@media (min-width: 1061px) and (max-height: 880px) {
  body.rule-page,
  body.batch-page {
    --matched-shape-profile-block-height: 178px;
  }

  .shape-support-pane:first-child { padding-right: 9px; }
  .shape-support-pane + .shape-support-pane { padding-left: 9px; }
  .astrea-control-row { gap: 5px; }
}

@media (max-width: 700px) {
  .shape-support-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  .shape-support-pane:first-child {
    padding-right: 0;
    padding-bottom: 12px;
  }
  .shape-support-pane + .shape-support-pane {
    padding-top: 12px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

/* Shared compact header on laptop-height desktop viewports. */
@media (min-width: 1061px) and (max-height: 950px) {
  body.landing-page .topbar {
    height: 74px;
    padding: 8px 24px;
  }

  body.landing-page .brand-logo-link {
    --brand-logo-width: clamp(166px, 13vw, 190px);
  }

  body.landing-page .landing {
    height: calc(100dvh - 74px);
  }
}

/* Rule workspace on laptop-height desktop viewports. */
@media (min-width: 1061px) and (max-height: 950px) {
  body.rule-page .topbar {
    height: 74px;
    padding: 8px 24px;
  }

  body.rule-page .brand-logo-link {
    --brand-logo-width: clamp(166px, 13vw, 190px);
  }

  body.rule-page .workspace {
    height: calc(100dvh - 74px);
  }

  body.rule-page .rail,
  body.rule-page .canvas {
    padding: 10px 12px;
  }

  body.rule-page .rail {
    --rail-control-gap: 8px;
    --rail-label-top: 9px;
    --rail-label-bottom: 5px;
    --rail-section-gap: 26px;
  }

  body.rule-page .rail .session-actions {
    gap: 6px !important;
  }

  body.rule-page .rail .custom-model-row {
    gap: 9px !important;
  }

  body.rule-page .focus-layout,
  body.rule-page .evidence-column {
    gap: 9px;
  }

  body.rule-page .section-block {
    padding: 9px;
  }

  body.rule-page {
    --rule-context-textarea-height: 58px;
    --rule-business-textarea-height: 110px;
    --matched-generation-block-height: 226px;
    --matched-shape-profile-block-height: 124px;
  }

  body.rule-page .evidence-column {
    grid-template-rows:
      var(--matched-generation-block-height)
      var(--matched-shape-profile-block-height)
      150px
      minmax(0, 1fr);
  }

  body.rule-page .editor-column,
  body.batch-page .editor-column {
    grid-template-rows: 110px 160px minmax(230px, 1fr) 195px;
  }

  body.rule-page .ontology-search-block .entity-list {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    max-height: none !important;
  }

  body.rule-page .selected-target-block .metadata-grid {
    margin: 7px 0 6px;
  }

  body.rule-page .selected-target-block .field-label {
    margin: 5px 0 3px;
  }

  body.rule-page .selected-target-block .textarea {
    flex-basis: 48px;
    min-height: 48px;
  }

  body.rule-page .selected-target-block .full-width {
    margin-top: 6px;
  }
}

@media (min-width: 1061px) and (max-height: 760px) {
  body.rule-page .evidence-column {
    align-content: start;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-gutter: stable;
  }

  body.rule-page .evidence-column {
    grid-template-rows:
      var(--matched-generation-block-height)
      var(--matched-shape-profile-block-height)
      150px
      260px;
  }

}

/* Batch workspace on laptop-height desktop viewports. */
@media (min-width: 1061px) and (max-height: 950px) {
  body.batch-page .topbar {
    height: 74px;
    padding: 8px 24px;
  }

  body.batch-page .brand-logo-link {
    --brand-logo-width: clamp(166px, 13vw, 190px);
  }

  body.batch-page .workspace {
    height: calc(100dvh - 74px);
  }

  body.batch-page .rail,
  body.batch-page .canvas {
    padding: 10px 12px;
  }

  body.batch-page .rail {
    --rail-control-gap: 8px;
    --rail-label-top: 9px;
    --rail-label-bottom: 5px;
    --rail-section-gap: 26px;
  }

  body.batch-page .rail .session-actions {
    gap: 6px !important;
  }

  body.batch-page .rail .custom-model-row {
    gap: 9px !important;
  }

  body.batch-page .focus-layout {
    gap: 9px;
  }

  body.batch-page .evidence-column {
    gap: 8px;
  }

  body.batch-page .section-block {
    padding: 9px;
  }

  body.batch-page {
    --rule-context-textarea-height: 56px;
    --matched-generation-block-height: 222px;
    --matched-shape-profile-block-height: 128px;
  }

  body.batch-page .evidence-column {
    grid-template-rows:
      var(--matched-generation-block-height)
      var(--matched-shape-profile-block-height)
      202px
      minmax(0, 1fr);
  }

  body.batch-page .editor-column {
    grid-template-rows: 110px 160px minmax(230px, 1fr) 195px;
  }

  body.batch-page .batch-template-block .file-drop {
    flex: 0 0 48px;
    min-height: 48px;
    gap: 2px;
    padding: 4px 8px;
    text-align: center;
  }

  body.batch-page .batch-template-block .file-drop small {
    line-height: 1.15;
    text-align: center;
  }

  body.batch-page .batch-template-block #batch-summary {
    flex: 0 0 auto;
    margin-top: 5px;
  }

  body.batch-page .batch-template-block .template-help {
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 0;
    margin-top: 7px;
    padding: 7px 9px;
    overflow: hidden;
  }

  body.batch-page .batch-template-block .template-help p {
    font-size: 0.75rem;
    line-height: 1.28;
  }

  body.batch-page .batch-template-block .template-links {
    flex-wrap: nowrap;
    gap: 6px;
    margin-top: 0;
  }

  body.batch-page .batch-template-block .template-links a {
    padding: 4px 8px;
  }

  body.batch-page .batch-template-block .full-width {
    flex: 0 0 30px;
    margin-top: 7px;
  }

  body.batch-page .generated-shapes-block > .section-title .tag {
    padding: 3px 8px;
    font-size: 0.7rem;
  }

  body.batch-page .generated-shapes-block .batch-progress-heading {
    flex: 1 1 auto;
    max-width: min(78%, 440px);
  }

  body.batch-page .generated-shapes-block .queue-list {
    margin-top: 6px;
  }
}

@media (min-width: 1061px) and (max-height: 760px) {
  body.batch-page .evidence-column {
    align-content: start;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-gutter: stable;
  }

  body.batch-page .evidence-column {
    grid-template-rows:
      var(--matched-generation-block-height)
      var(--matched-shape-profile-block-height)
      202px
      280px;
  }

}

@media (min-width: 1061px) and (max-width: 1450px) and (max-height: 950px) {
  body.batch-page .batch-template-block .template-links span {
    display: none;
  }
}

@media (min-width: 1061px) and (max-height: 1100px) {
  body.rule-page .rail > .namespace-label-row,
  body.batch-page .rail > .namespace-label-row {
    margin-top: 12px !important;
  }

  body.rule-page .rail .model-panel,
  body.batch-page .rail .model-panel {
    margin-top: 12px !important;
  }
}

/* Keep the split support panel usable after the laptop-specific overrides. */
@media (min-width: 1061px) and (max-height: 950px) {
  body.rule-page,
  body.batch-page {
    --matched-shape-profile-block-height: 164px;
  }
}

@media (min-width: 1061px) and (max-height: 880px) {
  body.rule-page .evidence-column,
  body.rule-page .editor-column,
  body.batch-page .evidence-column,
  body.batch-page .editor-column {
    align-content: start;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-gutter: stable;
  }

  body.rule-page .evidence-column {
    grid-template-rows: 206px 164px 150px 260px;
  }

  body.batch-page .evidence-column {
    grid-template-rows: 222px 164px 202px 280px;
  }

  body.rule-page .editor-column,
  body.batch-page .editor-column {
    grid-template-rows: 90px 145px minmax(230px, 1fr) 190px;
  }
}

/* Keep the shared review stack visible on laptop-height screens. */
@media (min-width: 1061px) and (max-height: 880px) {
  body.rule-page .topbar,
  body.batch-page .topbar {
    height: 70px;
  }

  body.rule-page .workspace,
  body.batch-page .workspace {
    height: calc(100dvh - 70px);
  }

  body.rule-page .canvas,
  body.batch-page .canvas {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  body.rule-page .editor-column,
  body.batch-page .editor-column {
    grid-template-rows: 90px 145px minmax(230px, 1fr) 190px;
    overflow: hidden;
    padding-right: 0;
  }
}

@media (min-width: 1061px) and (max-height: 720px) {
  body.rule-page .topbar,
  body.batch-page .topbar {
    height: 64px;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  body.rule-page .brand-logo-link,
  body.batch-page .brand-logo-link {
    --brand-logo-width: 150px;
  }

  body.rule-page .workspace,
  body.batch-page .workspace {
    height: calc(100dvh - 64px);
  }

  body.rule-page .canvas,
  body.batch-page .canvas {
    padding-top: 4px;
    padding-bottom: 4px;
  }

  body.rule-page .editor-column,
  body.batch-page .editor-column {
    grid-template-rows: 78px 115px minmax(205px, 1fr) 174px;
    gap: 6px;
    overflow: hidden;
    padding-right: 0;
  }

  body.rule-page .accepted-shapes-block,
  body.batch-page .accepted-shapes-block {
    padding: 7px;
  }

  body.app-page .accepted-shapes-block #export-shapes {
    height: 26px;
    min-height: 26px;
    flex-basis: 26px;
    margin-top: 5px;
  }
}

@media (min-width: 1061px) {
  body.rule-page .rail .model-panel,
  body.batch-page .rail .model-panel {
    margin-top: 12px !important;
  }

  body.rule-page .shape-profile-block .astrea-baseline-status,
  body.batch-page .shape-profile-block .astrea-baseline-status {
    margin-top: 10px;
  }

  body.app-page .editor-column > .section-block > .section-title button,
  body.app-page .editor-column .section-title-actions button,
  body.app-page .editor-column .section-actions button {
    height: 28px;
    min-height: 28px;
    padding: 0 9px;
    font-size: 0.72rem;
  }

  body.app-page .accepted-shapes-block .accepted-list {
    flex: 0 0 92px;
    height: 92px;
    min-height: 92px;
    max-height: 92px !important;
  }

  body.app-page .accepted-shapes-block #export-shapes {
    flex: 0 0 30px;
    height: 30px;
    min-height: 30px;
    margin-top: 7px;
    padding: 0 10px;
    font-size: 0.74rem;
  }
}

@media (min-width: 1061px) and (max-height: 720px) {
  body.app-page .accepted-shapes-block #export-shapes {
    height: 26px;
    min-height: 26px;
    flex-basis: 26px;
    margin-top: 5px;
  }
}

/* Prefix editing grows without reducing the review and accepted-shape tracks. */
@media (min-width: 1061px) {
  body.rule-page .editor-column,
  body.batch-page .editor-column {
    align-content: start;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
  }
}

@media (min-width: 1061px) and (min-height: 951px) {
  body.rule-page .editor-column {
    grid-template-rows: minmax(180px, 0.3fr) 190px minmax(290px, 1fr) 220px;
  }

  body.batch-page .editor-column {
    grid-template-rows: minmax(180px, 0.3fr) 190px minmax(290px, 1fr) 220px;
  }
}

@media (min-width: 1061px) and (max-height: 950px) {
  body.rule-page .editor-column {
    grid-template-rows: 145px 184px minmax(230px, 1fr) 195px;
  }

  body.batch-page .editor-column {
    grid-template-rows: 145px 160px minmax(230px, 1fr) 195px;
  }
}

@media (min-width: 1061px) and (max-height: 880px) {
  body.rule-page .editor-column {
    grid-template-rows: 120px 184px 230px 190px;
  }

  body.batch-page .editor-column {
    grid-template-rows: 120px 145px 230px 190px;
  }
}

@media (min-width: 1061px) and (max-height: 720px) {
  body.rule-page .editor-column {
    grid-template-rows: 104px 184px 205px 174px;
  }

  body.batch-page .editor-column {
    grid-template-rows: 104px 115px 205px 174px;
  }
}
