/* TASK-0092-FE — compact Overrun workspace.
   CSS-only production override. No backend/API/JS changes. */

@media (min-width: 721px) {
  /* Outer workspace: keep the overrun block visually compact. */
  .overrun-tabs-panel {
    min-width: min(760px, calc(100vw - 32px));
  }

  .overrun-tabs {
    gap: 5px;
    padding: 5px 8px 4px;
  }

  .overrun-tab {
    max-width: 210px;
    border-radius: 7px;
  }

  .overrun-tab-select {
    padding: 6px 9px;
    font-size: 11px;
    line-height: 1.15;
    font-weight: 750;
  }

  .overrun-tab-close {
    padding: 6px 7px;
    font-size: 11px;
    line-height: 1;
  }

  .overrun-display-panel {
    display: grid;
    grid-template-columns: minmax(235px, 31%) minmax(0, 69%);
    grid-template-rows: auto auto auto;
    column-gap: 8px;
    align-items: start;
    padding: 0 8px 8px;
  }

  /* Robot name is already present in the active tab. */
  .overrun-display-hero {
    grid-column: 1 / -1;
    grid-row: 1;
    padding: 5px 2px 4px;
    gap: 8px;
    min-height: 26px;
  }

  .overrun-display-identity {
    gap: 0;
  }

  .overrun-display-identity strong {
    display: none;
  }

  .overrun-display-identity span {
    font-size: 9px;
    line-height: 1.2;
  }

  .overrun-display-number {
    width: auto;
    margin-left: auto;
    font-size: 12px;
    line-height: 1.15;
    white-space: nowrap;
  }

  /* Left compact stats table. */
  .overrun-display-metrics {
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: 1fr;
    gap: 3px;
    padding: 0;
  }

  .overrun-display-metric {
    min-height: 28px;
    padding: 4px 7px;
    gap: 6px;
    border-radius: 5px;
  }

  .overrun-display-metric span {
    font-size: 9px;
    line-height: 1.1;
  }

  .overrun-display-metric strong {
    font-size: 12px;
    line-height: 1.1;
  }

  /* Forecast stays on the left, but becomes one dense row. */
  .overrun-prediction {
    grid-column: 1;
    grid-row: 3;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
    padding: 4px 0 0;
  }

  .overrun-prediction > div,
  .overrun-prediction-waiting {
    min-height: 36px;
    padding: 4px 5px;
    gap: 1px;
    border-radius: 5px;
  }

  .overrun-prediction-waiting {
    grid-column: 1 / -1;
    min-height: 32px;
  }

  .overrun-prediction span,
  .overrun-prediction-waiting span {
    font-size: 7.5px;
    line-height: 1.1;
    letter-spacing: .01em;
  }

  .overrun-prediction strong,
  .overrun-prediction-waiting strong {
    font-size: 10px;
    line-height: 1.15;
  }

  .overrun-prediction-end strong {
    font-size: 12px;
  }

  /* Right side — dynamic history. Latest remains on top, #1 stays below. */
  .overrun-history-caption {
    grid-column: 2;
    grid-row: 2;
    padding: 4px 7px 5px;
    border: 1px solid color-mix(in srgb, var(--pg-border-soft) 78%, transparent);
    border-bottom: 0;
    border-radius: 5px 5px 0 0;
    font-size: 9px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .overrun-table-wrap {
    grid-column: 2;
    grid-row: 3;
    max-height: 112px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid color-mix(in srgb, var(--pg-border-soft) 78%, transparent);
    border-top: 0;
    border-radius: 0 0 5px 5px;
  }

  .overrun-table {
    font-size: 9.5px;
    line-height: 1.1;
  }

  .overrun-table th,
  .overrun-table td {
    padding: 3px 5px;
  }

  .overrun-table th {
    font-size: 9px;
  }

  /* Also compact the generic panel chrome around the workspace. */
  .overrun-panel-header {
    min-height: 28px;
    padding: 4px 8px;
  }

  .overrun-panel-title {
    font-size: 10px;
  }

  .overrun-panel-status {
    font-size: 9px;
  }
}

/* TMA/mobile: keep the same idea but stack cleanly instead of squeezing. */
@media (max-width: 720px) {
  .overrun-tabs {
    padding: 4px 6px 3px;
  }

  .overrun-tab-select {
    padding: 5px 8px;
    font-size: 10px;
  }

  .overrun-tab-close {
    padding: 5px 6px;
  }

  .overrun-display-identity strong {
    display: none;
  }

  .overrun-display-hero {
    padding: 5px 7px 4px;
  }

  .overrun-display-identity span {
    font-size: 9px;
  }

  .overrun-display-number {
    width: auto;
    margin-left: auto;
    font-size: 11px;
  }

  .overrun-display-metrics {
    gap: 3px;
    padding: 0 7px 4px;
  }

  .overrun-display-metric {
    padding: 4px 6px;
  }

  .overrun-display-metric span {
    font-size: 9px;
  }

  .overrun-display-metric strong {
    font-size: 11px;
  }

  .overrun-prediction {
    gap: 3px;
    padding: 0 7px 5px;
  }

  .overrun-prediction > div,
  .overrun-prediction-waiting {
    min-height: 34px;
    padding: 4px 5px;
  }

  .overrun-prediction span,
  .overrun-prediction-waiting span {
    font-size: 7.5px;
  }

  .overrun-prediction strong,
  .overrun-prediction-waiting strong {
    font-size: 9.5px;
  }

  .overrun-history-caption {
    padding: 4px 7px;
    font-size: 9px;
  }

  .mobile-widget-shell .overrun-table-wrap {
    max-height: 118px;
    overflow-y: auto;
  }

  .overrun-table {
    font-size: 9px;
  }

  .overrun-table th,
  .overrun-table td {
    padding: 3px 5px;
  }
}
