/* Shared operational table behavior across CI/CD control-plane pages. */
.viewport-table-panel,
.management-card,
.audit-panel,
.settings-card-v2 {
    min-height: 0;
}

.viewport-table-scroll,
.management-card > .table-wrap,
.audit-table-wrap,
.settings-card-v2 > .table-wrap,
.automation-keys-page .table-wrap {
    scrollbar-gutter: stable;
}

.viewport-table-scroll {
    max-height: clamp(260px, calc(100dvh - 390px), 680px);
    overflow: auto;
}

.management-card > .table-wrap,
.audit-table-wrap,
.settings-card-v2 > .table-wrap,
.automation-keys-page .table-wrap {
    overflow: auto;
}

.management-table thead th,
.audit-table thead th,
.settings-table-v2 thead th,
.automation-key-table thead th,
.run-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f8fafc;
    box-shadow: inset 0 -1px 0 #e4e7ec;
}

.management-table tbody tr,
.audit-table tbody tr,
.settings-table-v2 tbody tr,
.automation-key-table tbody tr,
.run-table tbody tr {
    height: 58px;
}

.management-table td,
.audit-table td,
.settings-table-v2 td,
.automation-key-table td,
.run-table td {
    vertical-align: middle;
}

/* Pipelines should consume the full card width instead of bunching columns on the left. */
.pipeline-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
}
.pipeline-table th:nth-child(1), .pipeline-table td:nth-child(1) { width: 27% !important; }
.pipeline-table th:nth-child(2), .pipeline-table td:nth-child(2) { width: 10% !important; }
.pipeline-table th:nth-child(3), .pipeline-table td:nth-child(3) { width: 6% !important; }
.pipeline-table th:nth-child(4), .pipeline-table td:nth-child(4) { width: 10% !important; }
.pipeline-table th:nth-child(5), .pipeline-table td:nth-child(5) { width: 16% !important; }
.pipeline-table th:nth-child(6), .pipeline-table td:nth-child(6) { width: 6% !important; }
.pipeline-table th:nth-child(7), .pipeline-table td:nth-child(7) { width: 9% !important; }
.pipeline-table th:nth-child(8), .pipeline-table td:nth-child(8) { width: 16% !important; }
.pipeline-table th:last-child, .pipeline-table td:last-child { text-align: right; }
.pipeline-table .pipeline-row-actions { justify-content: flex-end !important; }
.pipeline-table .pipeline-name-cell { min-width: 0 !important; }
.pipeline-table .cell-note { max-width: 100% !important; }

.sticky-table-footer,
.table-footer,
.audit-footer {
    position: relative;
    z-index: 4;
    flex: 0 0 auto;
    background: #fbfcfe;
}

.runs-table-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: calc(100dvh - 230px);
}

.runs-table-panel .run-table-scroll {
    flex: 1 1 auto;
    min-height: 220px;
    max-height: none;
}

.audit-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: calc(100dvh - 300px);
}

.audit-panel .audit-table-wrap {
    flex: 1 1 auto;
    min-height: 220px;
    overflow: auto;
}

.infrastructure-workspace .management-card .infrastructure-table-wrap {
    max-height: clamp(260px, calc(100dvh - 390px), 650px);
    overflow: auto;
}

.settings-card-v2 > .table-wrap {
    max-height: clamp(240px, calc(100dvh - 470px), 520px);
}

.automation-keys-page .panel > .table-wrap {
    max-height: clamp(240px, calc(100dvh - 470px), 520px);
}

@media (max-height: 760px) {
    .runs-table-panel { max-height: calc(100dvh - 190px); }
    .audit-panel { max-height: calc(100dvh - 220px); }
    .viewport-table-scroll,
    .infrastructure-workspace .management-card .infrastructure-table-wrap { max-height: calc(100dvh - 300px); }
}

@media (max-width: 1100px) {
    .pipeline-table { min-width: 1080px !important; table-layout: auto !important; }
    .pipeline-table th:nth-child(n), .pipeline-table td:nth-child(n) { width: auto !important; }
}

@media (max-width: 900px) {
    .runs-table-panel,
    .audit-panel { max-height: none; }
    .viewport-table-scroll,
    .infrastructure-workspace .management-card .infrastructure-table-wrap,
    .settings-card-v2 > .table-wrap,
    .automation-keys-page .panel > .table-wrap { max-height: 60dvh; }
}
