/* Only the main Scorecard route fits its available viewport. The embedded
   meeting scorecard and the phone card layout keep their existing behavior. */
@media screen and (min-width: 901px) and (min-height: 600px) {
  .rh-company-scope .main-shell:has(> .route-scorecard) {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    min-height: 0;
  }
  .rh-company-scope .main-shell:has(> .route-scorecard) > :is(.topbar, .preview-banner, .development-banner, .save-strip) { flex: 0 0 auto; }
  .rh-company-scope .route-scorecard {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    width: 100%;
    min-height: 0;
    padding-block: 14px;
  }
  .rh-company-scope .route-scorecard > .scorecard {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
  }
  .route-scorecard .scorecard > :is(.page-title, .score-view-tabs, .score-controls, .summary-strip, .score-filters, .score-inline-error, .footnote) { flex: 0 0 auto; }
  .route-scorecard .scorecard > .score-inline-error { margin-bottom: 8px; }
  .route-scorecard .scorecard > .page-title {
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
  }
  .route-scorecard .page-title h1 { font-size: 26px; line-height: 1.2; }
  .route-scorecard .page-title .eyebrow { margin-bottom: 2px; }
  .route-scorecard .score-view-tabs { margin-bottom: 8px; gap: 22px; }
  .route-scorecard .score-view-tabs button { padding-block: 7px; }
  .route-scorecard .score-controls { padding: 10px 14px; margin-bottom: 10px; }
  .route-scorecard .report-controls { gap: 8px 16px; }
  .route-scorecard .report-controls .date-control { gap: 4px; }
  .route-scorecard .report-caption { flex-direction: row; flex-wrap: wrap; gap: 2px 12px; margin-top: 7px; }
  .route-scorecard .custom-range { margin-top: 8px; }
  .route-scorecard .custom-range .field { margin-bottom: 0; }
  .route-scorecard .summary-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 9px 14px;
    gap: 10px;
    margin-bottom: 10px;
  }
  .route-scorecard .summary-strip > div { flex-direction: row; align-items: baseline; gap: 8px; }
  .route-scorecard .summary-strip strong { font-size: 21px; }
  .route-scorecard .summary-strip > div > span { font-size: 12px; line-height: 1.4; }
  .route-scorecard .score-filters { padding-bottom: 8px !important; gap: 8px 12px; }
  .route-scorecard .score-toolbar-view { gap: 8px; }
  .rh-company-scope .route-scorecard .score-table-panel {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    overflow: visible;
  }
  .rh-company-scope .route-scorecard .score-table-panel > .score-grid-wrap {
    flex: 1 1 0;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
    overscroll-behavior: contain;
  }
  .route-scorecard .score-table-panel > :is(.grid-footer, .empty-small) { flex: 0 0 auto; }
  .route-scorecard .grid-footer { padding: 8px 12px; font-size: 12px; flex-wrap: wrap; gap: 4px 14px; }
  .route-scorecard .footnote { margin-top: 8px; font-size: 12px; line-height: 1.4; }
  .rh-company-scope .route-scorecard .goals-panel {
    flex: 1 1 0;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
  }
}

/* The explicit editor stays inside its table cell. Notes, correction reasons,
   validation, and retry actions can expand the row inside the scroll region. */
@media screen {
  .score-inline-cell { min-width: 0; width: 100%; }
  .score-inline-cell > button {
    width: 100%;
    min-height: 44px;
    border: 0;
    background: transparent;
    color: inherit;
    padding: 8px 10px;
    text-align: right;
    font: inherit;
  }
  .score-inline-editor { display: grid; gap: 6px; padding: 6px; min-width: 0; }
  .score-inline-input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 7px 8px;
    font-size: 16px;
    text-align: right;
    color: var(--rh-text);
    background: var(--rh-surface);
    border: 1px solid var(--rh-border);
  }
  .score-inline-fields { display: grid; gap: 6px; min-width: 0; }
  .score-inline-fields label { min-width: 0; font-size: 12px; line-height: 1.4; text-align: left; color: var(--rh-text); }
  .score-inline-fields :is(input, textarea) { width: 100%; min-width: 0; font-size: 16px; }
  .score-inline-fields textarea { min-height: 56px; resize: vertical; }
  .score-inline-actions { display: flex; flex-wrap: wrap; gap: 4px 8px; }
  .score-inline-actions :is(button, a) { min-height: 44px; white-space: normal; font-size: 12px; }
  .score-inline-error {
    margin: 0;
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.45;
    text-align: left;
    overflow-wrap: anywhere;
    color: var(--rh-error);
    background: var(--rh-error-bg);
    border-radius: 4px;
  }
  .score-inline-error button {
    min-height: 44px;
    padding: 6px 8px;
    border: 1px solid currentColor;
    border-radius: 5px;
    background: transparent;
    color: inherit;
    text-align: left;
    white-space: normal;
  }
  .score-inline-input:focus-visible {
    outline: 2px solid var(--rh-focus);
    outline-offset: -2px;
    box-shadow: none;
  }
  html[data-rh-theme="dark"] .score-inline-input {
    background: var(--rh-control);
    border-color: var(--rh-control-border);
    color: var(--rh-text);
  }
  html[data-rh-theme="dark"] .score-inline-cell > button:hover { box-shadow: inset 0 0 0 2px var(--rh-focus); }
}
