.app-shell h1,
.app-shell h2 {
    text-align: center;
}

.app-shell td,
.app-shell tr {
    text-align: center;
}

.nav-link.active {
    background-color: var(--brand-color) !important;
    color: white !important;
}

.report-container #analysis-tab .nav-link:not(.active) {
    color: var(--brand-color);
}

.pharm-id-page #pharm-tabs .nav-link {
    border: 1px solid transparent;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 700;
}

.pharm-id-page #pharm-tabs .nav-link:hover,
.pharm-id-page #pharm-tabs .nav-link:focus {
    border-color: var(--border-soft);
    color: #206E6C;
}

.pharm-id-page #pharm-tabs .nav-link.active {
    background: var(--brand-soft) !important;
    border-color: var(--brand-muted) var(--brand-muted) var(--card-bg);
    color: #206E6C !important;
}

.nav-heading {
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.sidebar-current-project {
    color: var(--brand-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.nav-link.text-nowrap {
    white-space: nowrap;
}

.manage-users-error-modal-header {
    background-color: var(--bs-danger);
    color: #fff;
}

.manage-users-search {
    flex: 0 1 350px;
    max-width: 350px;
    margin-left: auto;
}

.manage-users-search .np-search {
    flex: 1 1 auto;
    min-width: 0;
}

.lesion-id-page .lesion-current-project-btn {
    min-width: 100px;
}

.lesion-id-page .lesion-project-dropdown-menu {
    min-width: 250px;
    max-height: 360px;
    overflow-y: auto;
}

.lesion-id-page .lesion-mapping-timepoint-col {
    width: 180px;
}

.lesion-id-page .lesion-mapping-analysis-col {
    width: 260px;
}

@media (max-width: 576px) {
    .manage-users-search {
        flex: 1 1 100%;
        max-width: 100%;
        margin-left: 0;
    }
}

.main-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.card-container {
    display: flex;
    flex-direction: column;
    width: 80%;
    gap: 2rem;
    padding: 20px;
    max-height: 85vh;
    overflow-y: auto;
}

.form-container {
    display: grid;
    width: 100%;
    min-width: 800px;
    justify-content: center;
}

.add-project-container {
    min-width: 0;
    overflow-x: hidden;
}

.container-wrapper {
    flex:1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-width: 0;
    overflow-y: hidden;
}

.card-container {
    padding: 20px;
    width: 90%;
    min-width: 920px;
}

.lesion-id-page {
    background: var(--page-bg);
    height: 100vh;
    overflow: hidden;
}

.lesion-id-page .main-container {
    height: 100%;
    overflow: hidden;
}

.lesion-id-page .container-wrapper {
    height: 100%;
    align-items: stretch;
    overflow: hidden;
}

.lesion-id-page .np-page-shell {
    height: 100%;
}

.lesion-id-page .overview-container {
    gap: var(--space-4);
    height: 100%;
    margin: 0;
    flex: 1 1 auto;
}

.lesion-id-page .np-page-header__actions {
    flex-wrap: wrap;
}

.lesion-id-page .lesion-project-selector .np-btn:first-child {
    min-width: 112px;
}

.lesion-id-page .lesion-summary-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.lesion-id-page .lesion-summary-container[hidden] {
    display: none;
}

.lesion-id-page .lesion-summary-tabs {
    flex: 0 0 auto;
    padding: var(--space-3) var(--space-4) 0;
    border-bottom-color: var(--border-soft);
    gap: var(--space-1);
}

.lesion-id-page .lesion-summary-tabs .nav-link,
.lesion-id-page #lesion-plot-tabs .nav-link {
    border: 1px solid transparent;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 700;
}

.lesion-id-page .lesion-summary-tabs .nav-link:hover,
.lesion-id-page .lesion-summary-tabs .nav-link:focus,
.lesion-id-page #lesion-plot-tabs .nav-link:hover,
.lesion-id-page #lesion-plot-tabs .nav-link:focus {
    border-color: var(--border-soft);
    color: #206E6C;
}

.lesion-id-page .lesion-summary-tabs .nav-link.active,
.lesion-id-page #lesion-plot-tabs .nav-link.active {
    background: var(--brand-soft) !important;
    border-color: var(--brand-muted);
    color: #206E6C !important;
}

.lesion-id-page #lesion-plot-tabs {
    gap: var(--space-2);
    margin-bottom: var(--space-4) !important;
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-soft);
}

.lesion-id-page #lesion-plot-tabs .nav-link {
    border-radius: 999px;
}

.lesion-id-page .lesion-summary-tab-content {
    flex: 1;
    min-height: 0;
    padding: var(--space-4);
    overflow: hidden;
}

.lesion-id-page .lesion-summary-tab-pane {
    height: 100%;
    min-height: 0;
}

.lesion-id-page .lesion-summary-tab-pane.active {
    display: flex;
    flex-direction: column;
}

.lesion-id-page .lesion-dashboard-scroll,
.lesion-id-page .lesion-timepoints-scroll,
.lesion-id-page .lesion-plots-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: var(--space-1);
    padding-bottom: var(--space-6);
}

.lesion-id-page .np-data-table-shell.lesion-timepoints-scroll {
    max-height: 100%;
}

.lesion-id-page .lesion-timepoints-table {
    margin-bottom: 0;
}

.lesion-id-page .lesion-timepoints-table tbody tr > * {
    background: var(--card-bg);
}

.lesion-id-page .lesion-timepoints-table tbody tr:hover > * {
    background: var(--brand-soft);
}

.lesion-id-page .lesion-timepoints-scroll {
    border-radius: var(--radius-md);
}

.lesion-id-page .lesion-direction-change-table {
    min-width: 620px;
}

.lesion-id-page .lesion-plot {
    min-height: 360px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    background: var(--card-bg);
}

.lesion-id-page .lesion-dashboard-card {
    border-color: var(--border-soft);
    box-shadow: none;
}

.lesion-id-page .lesion-dashboard-card .np-card-body {
    padding: var(--space-4);
}

.lesion-id-page .lesion-dashboard-card[data-lesion-tooltip] {
    cursor: help;
}

.lesion-id-page .lesion-dashboard-card[data-lesion-tooltip]:focus {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

.lesion-id-page .lesion-dashboard-label {
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.lesion-dashboard-tooltip .tooltip-inner {
    max-width: 360px;
    text-align: left;
    line-height: 1.35;
    padding: 0.65rem 0.75rem;
}

.lesion-id-page .lesion-dashboard-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-main);
}

.lesion-id-page .lesion-dashboard-card-title {
    font-size: 15px;
}

.lesion-id-page .lesion-metric-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.lesion-id-page .lesion-metric-group--divided {
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-soft);
}

.lesion-id-page .lesion-metric-group-title {
    color: var(--text-main);
    font-size: 14px;
    font-weight: 700;
}

.lesion-id-page .lesion-metric-values {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.35;
}

.lesion-id-page .lesion-metric-value {
    min-width: 86px;
}

.lesion-id-page #longitudinal-summary-stale-warning {
    margin: var(--space-4) var(--space-4) 0;
}

.lesion-id-page .lesion-analysis-modal-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.lesion-id-page .lesion-modal-card {
    overflow: visible;
}

.lesion-id-page .lesion-group-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.lesion-id-page .lesion-group-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-2);
}

.lesion-id-page .lesion-group-empty {
    display: flex;
    align-items: center;
    min-height: 56px;
    padding: 0 var(--space-3);
    color: var(--text-secondary);
    font-size: 14px;
}

.lesion-id-page .lesion-group-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    color: var(--text-main);
    text-align: left;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.lesion-id-page .lesion-group-list-item:hover,
.lesion-id-page .lesion-group-list-item:focus {
    background: var(--brand-soft);
    border-color: var(--brand-muted);
    outline: 0;
}

.lesion-id-page .lesion-group-list-item.is-selected {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(98, 193, 191, 0.18);
}

.lesion-id-page .lesion-group-list-name {
    font-size: 14px;
    font-weight: 700;
}

.lesion-id-page .lesion-group-list-keywords {
    min-width: 0;
    color: var(--text-secondary);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.lesion-id-page .lesion-mapping-table-shell {
    max-height: 360px;
    border-radius: var(--radius-md);
}

.lesion-id-page .lesion-timepoint-select,
.lesion-id-page .lesion-analysis-group-select {
    width: 100%;
    min-height: 34px;
    font-size: 13px;
}

@media (max-width: 900px) {
    .lesion-id-page .np-page-header--compact {
        align-items: flex-start;
        min-height: 0;
    }

    .lesion-id-page .np-page-header__actions {
        width: 100%;
        justify-content: flex-start;
        margin-left: 0;
    }
}

@media (max-width: 640px) {
    .lesion-id-page .lesion-summary-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .lesion-id-page .lesion-summary-tabs .nav-link {
        white-space: nowrap;
    }

    .lesion-id-page .lesion-group-actions .np-btn,
    .lesion-id-page .np-page-header__actions .np-btn,
    .lesion-id-page .lesion-project-selector {
        width: 100%;
    }
}

.tab-content-custom {
    /* max-height: calc(75vh - 170px); */
    min-height: 220px;
    overflow-y: auto;
    padding-bottom: 1rem;
}

.test-ec2 {
    position: fixed;
    bottom: 5%;
    justify-content: center;
    margin-left: 300px;
    width: 200px;
    height: 40px;
}

/* Analysis table container height and scroll */
.analysis-table-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    padding-bottom: 2rem;
    max-height: calc(100vh - 200px);
}

.analysis-table-container .np-data-table-shell {
    flex: 1;
    min-height: 0;
    max-height: none;
    overscroll-behavior: contain;
}

/* Subjects table container height and scroll */
.subjects-table-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    padding-bottom: 2rem;
}

.subjects-table-container .np-data-table-shell {
    flex: 1;
    min-height: 0;
    max-height: none;
    overscroll-behavior: contain;
}

#subjects-container .card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

#subjects-container .card-body,
#subjects-container .np-card-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.batch-controls {
    gap: 0.75rem;
    padding: 0.25rem 0;
}

.batch-controls .batch-actions button {
    min-width: 150px;
}

.subject-select-cell,
.checkbox-column {
    width: 60px;
}

.subject-selected {
    background-color: var(--selection-color);
}

.analysis-selected {
    background-color: var(--selection-color);
}

.subject-select-checkbox {
    cursor: pointer;
}

.analysis-select-checkbox {
    cursor: pointer;
}

.rerun-modality-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.rerun-modality-status {
    display: inline-flex;
    align-items: center;
    min-width: 20px;
    justify-content: center;
}

.rerun-status-icon {
    font-size: 1rem;
}

/* Analysis page primary action sizing */
.add-stats-btn {
    min-width: 132px;
}

/* Wider stats modal */
#statsModal .modal-dialog {
    max-width: 1300px;
}
#statsModal .modal-content {
    padding: 20px;
}

/* Wider heatmap modal */
#heatmapModal .modal-dialog {
    max-width: 1200px;
}

/* Prevent overflowing lists in the stats modal */
#statsModal .list-group {
    max-height: calc(75vh - 220px);
    overflow-y: auto;
}

.qa-container {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
}

.overlay-container {
    width: 100%;
}

.half-card {
    min-width: 400px;
    max-width: 600px;
    width: 50%;
}

.analysis-page .analysis-container,
.results-page .report-container,
.group-overview-page .overview-container,
.data-overview-page .data-overview-container,
.neurophindr-id-page .overview-container,
.lesion-id-page .overview-container,
.pharm-id-page .overview-container {
    width: 100%;
    min-width: 0;
    max-width: none;
    padding: 0;
}

.analysis-page .analysis-container,
.results-page .report-container,
.group-overview-page .overview-container,
.data-overview-page .data-overview-container,
.neurophindr-id-page .overview-container,
.lesion-id-page .overview-container,
.pharm-id-page .overview-container {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.neurophindr-id-page {
    background: var(--page-bg);
    height: 100vh;
    overflow: hidden;
}

.neurophindr-id-page .main-container {
    height: 100%;
    overflow: hidden;
}

.neurophindr-id-page .container-wrapper {
    height: 100%;
    align-items: stretch;
    overflow: hidden;
}

.neurophindr-id-page .overview-container {
    gap: var(--space-4);
    height: 100%;
    margin: 0;
    flex: 1 1 auto;
}

.analysis-page,
.group-overview-page,
.data-overview-page,
.results-page {
    background: var(--page-bg);
    height: 100vh;
    overflow: hidden;
}

.analysis-page .main-container,
.group-overview-page .main-container,
.data-overview-page .main-container,
.results-page .main-container {
    height: 100%;
    overflow: hidden;
}

.analysis-page .container-wrapper,
.group-overview-page .container-wrapper,
.data-overview-page .container-wrapper,
.results-page .container-wrapper {
    height: 100%;
    align-items: stretch;
    overflow: hidden;
}

.analysis-page .analysis-container,
.group-overview-page .overview-container,
.data-overview-page .data-overview-container,
.results-page .report-container {
    gap: var(--space-4);
    height: 100%;
    margin: 0;
    flex: 1 1 auto;
}

.data-overview-page .data-overview-content-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    min-height: 0;
    overflow-y: auto;
}

.analysis-page .analysis-project-selector .np-btn:first-child,
.group-overview-page .group-overview-project-selector .np-btn:first-child {
    min-width: 112px;
}

.analysis-page .analysis-project-menu,
.group-overview-page .group-overview-project-menu {
    max-height: 320px;
    overflow-y: auto;
}

.analysis-page .analysis-table-container,
.group-overview-page .group-table-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding-bottom: 0;
    max-height: none;
}

.analysis-page .analysis-table-panel,
.group-overview-page .group-overview-table-card {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    box-shadow: none;
}

.analysis-page .analysis-table-panel {
    height: 100%;
}

.analysis-page .analysis-table-body,
.group-overview-page .group-overview-table-body {
    flex: 1 1 auto;
    min-height: 0;
}

.analysis-page .analysis-table-toolbar {
    gap: var(--space-3);
}

.analysis-page .analysis-table-toolbar .search-container {
    margin: 0;
    padding: 0;
    justify-content: flex-start;
}

.analysis-page .analysis-batch-controls {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-left: auto;
}

.analysis-page .analysis-batch-summary {
    font-size: 13px;
    line-height: 1.4;
}

.analysis-page .analysis-batch-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.analysis-page #analysisTable tbody tr.analysis-selected > * {
    background: rgba(98, 193, 191, 0.18) !important;
}

.analysis-page #analysisTable .checkbox-column,
.analysis-page #analysisTable .analysis-select-cell {
    width: 56px;
    text-align: center;
    padding: 5px 8px;
}


.analysis-page .analysis-modal-grid {
    height: 100%;
    align-items: stretch;
    row-gap: var(--space-4);
}

.analysis-page .analysis-modal-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    overflow: hidden;
}

.analysis-page .analysis-modal-panel > .np-card-header {
    flex: 0 0 auto;
    padding: var(--space-4) var(--space-4) var(--space-3);
    border-bottom: 1px solid var(--border-soft);
}

.analysis-page .analysis-modal-panel > .np-card-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: var(--space-3);
}

.analysis-page .analysis-modal-panel > .np-card-footer {
    flex: 0 0 auto;
    padding: var(--space-3) var(--space-4) var(--space-4);
    border-top: 1px solid var(--border-soft);
}

.analysis-page .analysis-modal-panel .np-card-title {
    font-size: 17px;
}

.analysis-page .analysis-modal-panel-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: var(--space-3) var(--space-4) var(--space-4);
    overflow: hidden;
}

.analysis-page .analysis-modal-tab-content {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}

.analysis-page .analysis-modal-tab-content .tab-pane {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.analysis-page .analysis-modal-list {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    overflow: auto;
}

.analysis-page .analysis-modal-list > .analysis-modal-row {
    border-bottom: 1px solid var(--border-soft);
}

.analysis-page .analysis-modal-list > .analysis-modal-row:last-child {
    border-bottom: 0;
}

.analysis-page .analysis-modal-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    width: 100%;
    min-height: 58px;
    padding: 12px var(--space-4);
    background: var(--card-bg);
    transition: background-color 0.16s ease;
}

.analysis-page .analysis-modal-row:hover {
    background: var(--brand-soft);
}

.analysis-page .analysis-modal-row__main {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
    flex: 1 1 auto;
}

.analysis-page .analysis-modal-row__label {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.analysis-page .analysis-modal-row__badge {
    flex: 0 0 auto;
}

.analysis-page .analysis-modal-row__main .np-check-input {
    flex: 0 0 auto;
}

.analysis-page .analysis-modal-tests {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

.analysis-page .analysis-modal-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.analysis-page .analysis-modal-action {
    flex: 1 1 0;
    min-width: 0;
    white-space: nowrap;
}

.analysis-page #statsModal .modal-header {
    align-items: flex-start;
    gap: var(--space-4);
    padding: var(--space-4);
}

.analysis-page #statsModal .modal-title {
    margin-bottom: 0;
}

.analysis-page #statsModal .analysis-modal-header {
    flex-wrap: nowrap;
}

.analysis-page #statsModal .analysis-modal-header__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    gap: var(--space-2);
    margin-left: auto;
}

.analysis-page #statsModal .modality-btn-group {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    min-width: 0;
}

.analysis-page #statsModal .modality-btn-group .np-btn-radio {
    white-space: nowrap;
}

.analysis-page #statsModal .modal-body {
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    padding: var(--space-4);
    overflow: hidden;
    text-align: left;
}

.analysis-page #statsModal .modal-content {
    padding: 0;
    height: min(88vh, 900px);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.analysis-page #statsModal .modal-dialog {
    max-width: min(1020px, calc(100vw - 2rem));
}

.analysis-page #statsModal .modal-body > .container-fluid {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

.analysis-page #statsModal .modal-body > .container-fluid > .row {
    flex: 1 1 auto;
    min-height: 0;
}

.analysis-page #statsModal .modal-body > .container-fluid > .row > [class*="col-"] {
    display: flex;
    min-height: 0;
}

.analysis-page #statsModal .modal-body > .container-fluid > .row > [class*="col-"] > .analysis-modal-panel {
    width: 100%;
}

.analysis-page #statsModal .modal-content {
    display: flex;
    flex-direction: column;
    height: min(88vh, 900px);
    padding: 0;
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    background: var(--card-bg);
    box-shadow: var(--shadow-panel);
    overflow: hidden;
}

.analysis-page #statsModal .modal-header {
    align-items: flex-start;
    gap: var(--space-4);
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border-soft);
    background: var(--card-bg);
}

.analysis-page #statsModal .modal-title {
    margin-bottom: 0;
}

.analysis-page #statsModal .analysis-modal-header {
    flex-wrap: nowrap;
}

.analysis-page #statsModal .analysis-modal-header__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    gap: var(--space-3);
    margin-left: auto;
    min-width: 0;
}

.analysis-page #statsModal .modality-btn-group {
    display: inline-flex;
    align-items: stretch;
    justify-content: flex-end;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    min-width: 0;
}

.analysis-page #statsModal .modality-btn-group .btn-check {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.analysis-page #statsModal .modality-btn-group .np-btn-radio {
    white-space: nowrap;
}

.analysis-page #statsModal .modal-body {
    display: flex;
    flex: 1 1 auto;
    align-items: stretch;
    justify-content: flex-start;
    padding: 16px 20px;
    overflow: hidden;
    text-align: left;
    background: var(--card-bg);
}

.analysis-page #statsModal .modal-body > .analysis-modal-workspace {
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-4);
    width: 100%;
    min-height: 0;
    align-self: stretch;
}

.analysis-page #statsModal .analysis-modal-pane {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    height: 100%;
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    background: var(--card-bg);
    overflow: hidden;
}

.analysis-page #statsModal .analysis-modal-pane__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex: 0 0 auto;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border-soft);
}

.analysis-page #statsModal .analysis-modal-pane__header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-left: auto;
}

.analysis-page #statsModal .analysis-modal-pane__title {
    margin: 0;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.analysis-page #statsModal .analysis-modal-pane__body {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    row-gap: var(--space-3);
    min-height: 0;
    flex: 1 1 auto;
    height: 100%;
    padding: 14px 16px;
    overflow: hidden;
}

.analysis-page #statsModal .analysis-modal-pane__controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    flex: 0 0 auto;
}

.analysis-page #statsModal .analysis-modal-pane__controls--groups {
    justify-content: flex-end;
}

.analysis-page #statsModal .analysis-modal-pane__controls--tests {
    justify-content: flex-end;
}

.analysis-page #statsModal .analysis-modal-tab-content {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

.analysis-page #statsModal .analysis-modal-tab-content .tab-pane {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.analysis-page #statsModal .analysis-modal-list {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: auto;
}

.analysis-page #statsModal .analysis-modal-list:empty {
    flex: 1 1 auto;
    justify-content: center;
    padding: var(--space-6);
}

.analysis-page #statsModal .analysis-modal-list:empty::before {
    content: attr(data-empty-message);
    display: block;
    max-width: 24ch;
    margin: 0 auto;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    text-align: center;
}

.analysis-page #statsModal .analysis-modal-list > .analysis-modal-row {
    border-bottom: 1px solid var(--border-soft);
}

.analysis-page #statsModal .analysis-modal-list > .analysis-modal-row:last-child {
    border-bottom: 0;
}

.analysis-page #statsModal .analysis-modal-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    background: var(--card-bg);
    transition: background-color 0.16s ease, box-shadow 0.16s ease;
}

.analysis-page #statsModal .analysis-modal-row:hover {
    background: rgba(32, 110, 108, 0.05);
}

.analysis-page #statsModal .analysis-modal-row:focus-within,
.analysis-page #statsModal .analysis-modal-row:has(.np-check-input:checked) {
    background: rgba(32, 110, 108, 0.09);
    box-shadow: inset 2px 0 0 rgba(32, 110, 108, 0.55);
}

.analysis-page #statsModal .analysis-modal-row__main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
}

.analysis-page #statsModal .analysis-modal-row__label {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.analysis-page #statsModal .analysis-modal-row__badge {
    flex: 0 0 auto;
}

.analysis-page #statsModal .analysis-modal-row__main .np-check-input {
    flex: 0 0 auto;
}

.analysis-page #statsModal .analysis-modal-action {
    flex: 0 0 auto;
}

.analysis-page #statsModal .analysis-modal-action#currentStats,
.analysis-page #statsModal .analysis-modal-action#currentDirection {
    min-width: 118px;
}

.analysis-page #statsModal .analysis-modal-action#create-morph-atlas,
.analysis-page #statsModal .analysis-modal-action#check-atlas,
.analysis-page #statsModal .analysis-modal-action#create-jacobians {
    min-width: 132px;
}

.analysis-page #statsModal .analysis-modal-action#select-all-groups,
.analysis-page #statsModal .analysis-modal-action#select-all-tests {
    min-width: 108px;
}

.analysis-page #statsModal .analysis-modal-action#add-test,
.analysis-page #statsModal .analysis-modal-action#run-stats {
    min-width: 106px;
}

@media (max-width: 991.98px) {
    .analysis-page #statsModal .modal-body > .analysis-modal-workspace {
        grid-template-columns: 1fr;
    }

    .analysis-page #statsModal .analysis-modal-pane__controls {
        width: 100%;
    }
}

/* --- Heatmap modal --- */
.group-overview-page #heatmapModal .modal-dialog {
    max-width: min(960px, calc(100vw - 2rem));
}

.group-overview-page #heatmapModal .modal-content {
    max-height: min(90vh, calc(100vh - 2rem));
}

.group-overview-page .group-overview-heatmap-modal {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0;
}

.group-overview-page .group-overview-heatmap-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-soft);
}

.group-overview-page .group-overview-heatmap-modal__body {
    display: flex;
    justify-content: center;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: var(--space-4) var(--space-6);
}

.group-overview-page .group-overview-heatmap-modal__footer {
    display: flex;
    justify-content: space-between;
    padding: var(--space-3) var(--space-6);
    border-top: 1px solid var(--border-soft);
    background: #fff;
}

.group-overview-page .group-overview-heatmap-modal__legend-entry {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.group-overview-page .group-overview-heatmap-modal__legend-sample {
    font-family: Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
}

.group-overview-page .group-overview-heatmap-modal__legend-sample--ok {
    color: black;
}

.group-overview-page .group-overview-heatmap-modal__legend-sample--rejected {
    color: red;
}

.group-overview-page .group-overview-heatmap-modal__legend-sample--outlier {
    color: #e67e00;
}

.group-overview-page .group-overview-heatmap-modal__legend-eq {
    color: var(--text-secondary);
    font-size: 11px;
}

.group-overview-page .group-overview-heatmap-modal__legend-desc {
    color: var(--text-secondary);
    font-size: 12px;
}

/* --- Box plot modal --- */
.group-overview-page #boxPlotModal .modal-dialog {
    max-width: min(560px, calc(100vw - 2rem));
}

.group-overview-page .group-overview-box-plot-modal {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0;
}

.group-overview-page .group-overview-box-plot-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-soft);
}

.group-overview-page .group-overview-box-plot-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    padding: var(--space-4) var(--space-6);
}

.group-overview-page .group-overview-box-plot-modal__plot {
    width: 90%;
    height: 360px;
    margin: 0 auto;
}

/* --- Reject confirmation modal --- */
.group-overview-page .group-overview-reject-modal {
    padding: var(--space-6);
}

.group-overview-page .group-overview-reject-modal__header {
    margin-bottom: var(--space-6);
}

.group-overview-page .group-overview-reject-modal__body {
    margin-bottom: var(--space-6);
}

.group-overview-page .group-overview-reject-modal__question {
    margin: 0 0 var(--space-2);
    color: var(--text-main);
    font-size: 15px;
}

.group-overview-page .group-overview-reject-modal__note {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.group-overview-page .group-overview-reject-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

@media (max-width: 768px) {
    .group-overview-page #heatmapModal .modal-content {
        max-height: 95vh;
    }

    .group-overview-page .group-overview-heatmap-modal__header,
    .group-overview-page .group-overview-heatmap-modal__body,
    .group-overview-page .group-overview-heatmap-modal__footer,
    .group-overview-page .group-overview-box-plot-modal,
    .group-overview-page .group-overview-reject-modal {
        padding: var(--space-3) var(--space-4);
    }
}

.group-overview-page .group-overview-table-shell {
    flex: 1 1 auto;
    min-height: 0;
}

.group-overview-page .group-overview-table-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    box-shadow: none;
}

.group-overview-page .group-overview-table-body {
    flex: 1 1 auto;
    min-height: 0;
}

.group-overview-page .group-overview-table-shell {
    width: 100%;
    max-width: 100%;
}

.group-overview-page #groupTable {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
}

.group-overview-page #groupTable thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 10px 12px;
    background: #eef2f6;
    color: var(--text-secondary);
    text-align: center;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: 1px solid #d7dee7;
    vertical-align: middle;
    white-space: nowrap;
}

.group-overview-page #groupTable thead th:first-child,
.group-overview-page #groupTable tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #fff;
    box-shadow: 1px 0 0 #d7dee7;
}

.group-overview-page #groupTable thead th:first-child {
    z-index: 3;
    background: #eef2f6;
}

.group-overview-page #groupTable tbody th,
.group-overview-page #groupTable tbody td {
    padding: 4px 8px;
    vertical-align: top;
    white-space: nowrap;
}

.group-overview-page #groupTable tbody td:first-child,
.group-overview-page #groupTable tbody th:first-child {
    min-width: 110px;
}

.group-overview-page #groupTable tbody tr:hover > * {
    background: #f8fafc;
}

/* Shared dropdown sizing for legacy wrappers */
.subject-dropdown .dropdown-menu,
.project-dropdown .dropdown-menu,
.group-dropdown .dropdown-menu,
.stats-dropdown .dropdown-menu {
    max-height: 400px; /* Adjust this value as needed */
    overflow-y: auto; /* Enables vertical scrolling */
    overflow-x: hidden; /* Hides horizontal scrollbar */
}

.first-column {
    text-align: left;
}

.card .table {
    margin-bottom: 0;
}

/* Bootstrap's .tab-content>.active{display:block} (specificity 0,2,0) overrides
   .result-pane{display:flex} (0,1,0). Override it with an ID selector so the
   flex column chain needed for internal scrolling is restored. */
#seed-tab-pane.active {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Prevent the images container from shrinking so the table can only occupy
   the space that remains below it. */
#seed-tab-pane #seed-images-container {
    flex-shrink: 0;
}

#seed-table-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

#seed-table-container .seed-table-toolbar {
    gap: var(--space-3);
}

#seed-table-container .seed-table-toolbar .search-container {
    margin: 0;
    padding: 0;
    justify-content: flex-start;
}

#seed-results.np-data-table-shell {
    overscroll-behavior: contain;
}

.vertical-text-ccw {
    max-width: 2rem;
    transform: rotate(-90deg);
    transform-origin: center; /* Adjusts the rotation point */
    white-space: nowrap; /* Keeps the text on a single line */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.graph-img-container {
    height: 100%; 
    box-sizing: border-box;
}

.graph-metric-container {
    display: flex; 
    justify-content: flex-start;
    align-items: center; 
    height: 300px; 
}

/* Modal styling */
.modal-dialog-centered {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loader styling */

.loader {
    margin: 0 auto 20px; /* Add bottom margin to space out from paragraph */
    width: 60px;
    height: 50px;
    display: flex;              /* Keep bars on a single line */
    justify-content: center;
    gap: 2px;
    font-size: 0;               /* Remove whitespace between inline elements */
}

.loader > div {
    height: 100%;
    width: 8px;
    display: inline-block;
    -webkit-animation: delay 0.8s infinite ease-in-out;
    animation: delay 0.8s infinite ease-in-out;
}

.loader .bar1 { background-color: #754fa0; }
.loader .bar2 {
    background-color: #09b7bf;
    -webkit-animation-delay: -0.7s;
    animation-delay: -0.7s;
}
.loader .bar3 {
    background-color: #90d36b;
    -webkit-animation-delay: -0.6s;
    animation-delay: -0.6s;
}
.loader .bar4 {
    background-color: #f2d40d;
    -webkit-animation-delay: -0.5s;
    animation-delay: -0.5s;
}
.loader .bar5 {
    background-color: #fcb12b;
    -webkit-animation-delay: -0.4s;
    animation-delay: -0.4s;
}
.loader .bar6 {
    background-color: #ed1b72;
    -webkit-animation-delay: -0.3s;
    animation-delay: -0.3s;
}

@-webkit-keyframes delay {
    0%, 40%, 100% { -webkit-transform: scaleY(0.05) }  
    20% { -webkit-transform: scaleY(1.0) }
}

@keyframes delay {
    0%, 40%, 100% {
        transform: scaleY(0.05);
        -webkit-transform: scaleY(0.05);
    }
    20% {
        transform: scaleY(1.0);
        -webkit-transform: scaleY(1.0);
    }
}

/* Keep legacy modal bodies centered within the app shell only. */
.app-shell .modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
/* Keep ellipsis width constant */
#dots {
    display: inline-block;
    width: 1.5em;
    text-align: left;
}
/* End modifications */

#seed-tab-pane:focus {
    outline: none;
}

.results-page #seedTable tbody tr.seed-selected > * {
    background: rgba(98, 193, 191, 0.18) !important;
}


.rounded-table thead th:first-child {
    border-top-left-radius: 0.5rem;
}

.rounded-table thead th:last-child {
    border-top-right-radius: 0.5rem;
}

#seedTable td, #seedTable th {
    white-space: nowrap; /* Or 'normal' if you want the content to wrap */
    overflow: hidden;
    text-overflow: ellipsis;
}

#upload-container {
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    height: 100vh;
    min-width: 600px;
}

#qa-metrics-flex {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

#img-metrics-flex {
    display: flex; 
    flex-direction: column; 
    justify-content: space-between; 
    height: 85%;
}

#project-description {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    box-sizing: border-box;
}

#upload-data {
    margin-top: 50px;
}

#upload-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1em;
}

#pdescription {
    height: 120px;
    min-width: 22.4rem;
    font-size: 9.6pt;
    text-align: top;
    resize: none;
}

#details-container {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    padding-bottom: 20px;
    width: 100%;
}

#groups {
    height: 15vh;
    width: 350px;
    font-size: 12pt;
    text-align: top;
    resize: none;
}

#groups-container {
    display: flex;
    align-items: stretch;
    gap: 20px;
    overflow-x: auto;
    width: 100%;
}

.group-col {
    flex: 1;
    min-width: 250px;
}

#subjects-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
}

#drop-area {
    display: flex;
    flex-direction: column;
    height: 20vh;
    min-height: 200px;
    margin: 1em;
    justify-content: center;
    align-items: center;
    border: 2px dashed #ccc;
    padding: 20px;
    transition: border 0.3s ease-in-out;
}

#drop-area.dragged-over {
    border: 2px dashed #68B;
}

#progressBarContainer {
    width: 100%;
    height: 20px;
    margin-top: 10px;
}

#progressBar {
    height: 100%;
    width: 0;
    text-align: center;
    line-height: 20px;
    color: white;
}

/* Custom font size for the table */
#statsTable {
    font-size: 0.8rem;  /* Reduced font size */
    width: 100%;
}

/* Custom background color for the table header */
#statsTable thead th {
    background-color: #1e3b84;  /* Dark background */
    color: white;  /* White text */
}

/* Custom font size for the table */
#summaryTable {
    font-size: 0.8rem;  /* Reduced font size */
    width: 100%;
}

/* Custom background color for the table header */
#summaryTable thead th {
    background-color: #1e3b84;  /* Dark background */
    color: white;  /* White text */
}

/* Scrollable volumes stats table */
.volume-stats-table-container {
    max-height: 100%;  /* Set a fixed height for the table's body */
    overflow-y: auto;   /* Allow vertical scrolling for the table */
}

#designMatrixModal {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Ensure it sits on top of other content */
}

#designMatrixModal > div {
    background: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    width: 30%; /* Set the width of the modal */
}

#heatmap {
    width: 100%; /* Make heatmap take full width of its parent */
    height: auto; /* Adjust height as necessary */
}

/* Add responsive styling */
@media (max-width: 1100px) {
    .card-container {
        grid-template-columns: repeat(auto-fill, minmax(80%, 100%));
    }
}

.list-item{cursor:pointer;padding:2px;border-bottom:1px solid #ddd;}
.perm-row{margin-bottom:4px;}
.perm-row > div{display:flex;align-items:center;}

/* Add/Edit Project wizard modal */
#addProjectModal {
    --bs-modal-width: 640px;
}

#addProjectModal .modal-dialog {
    max-width: min(640px, calc(100vw - 32px));
}

#project-description {
    max-height: min(88vh, 760px);
    overflow: hidden;
    box-sizing: border-box;
}

#project-description #pdescription {
    min-height: 132px;
    height: 132px;
    min-width: 0;
    resize: vertical;
    line-height: 1.4;
}

#project-description .np-search-input {
    padding-left: 38px;
}

#project-description .np-select {
    width: 160px;
}

/* Ensure toast backgrounds are fully opaque */
.toast {
    --bs-toast-bg: rgba(var(--bs-warning-rgb), 1);
    --bs-toast-header-bg: rgba(var(--bs-body-bg-rgb), 1);
}

/* Tables within cards with rounded corners */
.rounded-table .table {
    border-radius: 0.5rem;
    overflow: hidden;
}

/* Match table padding with search bar spacing */
.rounded-table .card-body,
.rounded-table .np-card-body {
    padding: 1rem;
    position: relative;
}

.excel-download {
    cursor: pointer;
    font-size: 1.2rem;
}

.excel-download::before {
  vertical-align: text-top !important;
}

.excel-download-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 0.5rem;
}

/* Container for DataTables search bar */
.search-container {
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}
.search-container .dataTables_filter {
    margin: 0;
}
.search-container input[type="search"] {
    margin-left: 0.5rem;
}
.search-container select {
    max-width: 180px;
}
.search-container select:not(:first-child) {
    margin-left: 0.5rem;
}

/* Fallback avatar when no image is present */
.avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #6c757d;
    color: #fff;
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
    border-radius: 50%;
    text-transform: uppercase;
}

/* Project cards redesign */
.projects-page {
    background: #F7F9FB;
    height: 100vh;
    overflow: hidden;
}

.projects-page .project-page-layout {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.projects-page .project-browser-panel {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    gap: var(--space-4);
}

.projects-page .project-filter-strip {
    flex: 0 0 auto;
    padding: var(--space-4);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    box-shadow: var(--shadow-card);
}

.projects-page .project-filter-strip .np-filter-bar {
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(180px, 220px) minmax(260px, 1fr) auto;
    align-items: center;
    gap: var(--space-3);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.projects-page .project-filter-strip .np-search {
    flex: 1 1 280px;
    min-width: 240px;
}

.projects-page .project-filter-strip .np-search-input {
    border-color: var(--border);
    color: var(--text-main);
}

.projects-page .project-card-scroll {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding-top: 0;
    overscroll-behavior-y: contain;
}

.projects-page .species-section {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border-top: 1px solid var(--border-soft);
    background: var(--card-bg);
}

.projects-page .species-section:first-child {
    border-top: 0;
}

.projects-page .species-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    width: 100%;
    min-height: 56px;
    padding: 0 18px;
    border: 0;
    background: var(--card-bg);
    color: var(--text-main);
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    gap: 14px;
    text-align: left;
    cursor: pointer;
}

.projects-page .species-header:hover {
    background: var(--hover);
}

.projects-page .species-header:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: -2px;
}

.projects-page .species-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-transform: capitalize;
    letter-spacing: -0.01em;
}

.projects-page .species-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: #F3F4F6;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 760;
}

.projects-page .species-toggle-icon {
    flex: 0 0 auto;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--text-secondary);
    transform: rotate(0deg);
    transition: transform 160ms ease;
    margin-left: 2px;
}

.projects-page .species-toggle[aria-expanded="false"] .species-toggle-icon {
    transform: rotate(-180deg);
}

.projects-page .species-panel {
    flex: 0 0 auto;
    min-height: 0;
    overflow: visible;
    background: var(--card-bg);
}

.projects-page .species-card-scroll {
    box-sizing: border-box;
    min-height: 0;
    overflow: visible;
    padding: 4px 18px 18px 59px;
    overscroll-behavior: contain;
}

.projects-page .species-section.is-collapsed .species-panel {
    display: none;
}

.projects-page .card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
    justify-items: stretch;
    max-width: none;
}

.projects-page .project-card {
    display: flex;
    flex-direction: column;
    min-height: 148px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--card-bg);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.projects-page .project-card:hover {
    border-color: #CBD5E1;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.projects-page .project-card-main {
    padding: 14px 15px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.projects-page .project-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.projects-page .project-name {
    margin: 0;
    font-size: 16px;
    line-height: 1.25;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.projects-page .project-stage-badge {
    align-self: flex-start;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.projects-page .project-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 610;
}

.projects-page .project-card-meta-top {
    min-height: 28px;
}

.projects-page .project-card-meta-bottom {
    min-height: 26px;
}

.projects-page .project-member-cluster {
    display: flex;
    align-items: center;
    min-width: 0;
}

.projects-page .project-member-avatar {
    width: 28px;
    height: 28px;
    margin-left: -8px;
    display: grid;
    place-items: center;
    border: 2px solid #FFFFFF;
    border-radius: 999px;
    background: linear-gradient(135deg, #D9F0EF, #F3D1A3);
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 800;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    object-fit: cover;
}

.projects-page .project-member-avatar:first-child {
    margin-left: 0;
}

.projects-page .project-member-avatar.admin-ring {
    box-shadow: 0 0 0 2px var(--brand-primary), 0 1px 2px rgba(0, 0, 0, 0.08);
}

.projects-page .project-date {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

.projects-page .project-collaborators {
    color: var(--text-muted);
}

.projects-page .project-run-cluster {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

.projects-page .project-run-pill {
    width: 30px;
    height: 30px;
    margin-left: -8px;
    display: grid;
    place-items: center;
    border: 2px solid #FFFFFF;
    border-radius: 999px;
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 800;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.projects-page .project-run-pill:first-child {
    margin-left: 0;
}

.projects-page .keywords {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.projects-page .project-card-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 42px;
    border-top: 1px solid var(--border-soft);
    background: #FBFCFD;
}

.projects-page .project-card-footer.single-action {
    grid-template-columns: 1fr;
}

.projects-page .project-card-action {
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #374151;
    font: inherit;
    font-size: 14px;
    font-weight: 760;
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease;
}

.projects-page .project-card-action + .project-card-action {
    border-left: 1px solid var(--border-soft);
}

.projects-page .project-card-action:hover {
    background: var(--hover);
    color: #116766;
}

.projects-page .project-card-action:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: -2px;
}

@media (max-width: 980px) {
    .projects-page .project-page-topbar {
        align-items: flex-start;
        min-height: 0;
    }

    .projects-page .project-filter-strip .np-filter-bar {
        grid-template-columns: 1fr;
    }

    .projects-page .project-filter-strip .np-search {
        min-width: 0;
    }

    .projects-page .card-grid {
        max-width: none;
    }
}

@media (max-width: 720px) {
    .projects-page .project-page-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .projects-page .project-filter-strip .np-filter-bar {
        padding: 0;
    }

    .projects-page .project-filter-strip {
        padding: var(--space-3);
    }

    .projects-page .project-card-scroll {
        gap: 0;
    }

    .projects-page .species-header {
        min-height: 50px;
        padding: 0 16px;
        gap: 10px;
    }

    .projects-page .species-card-scroll {
        padding: var(--space-3) 16px 16px 16px;
    }
}

/* Project overview redesign */
.overview-page {
    background: var(--page-bg);
    height: 100vh;
    overflow: hidden;
}

.overview-page .main-container {
    height: 100%;
    overflow: hidden;
}

.overview-page .container-wrapper {
    height: 100%;
    align-items: stretch;
    overflow: hidden;
}

.overview-page .np-page-shell {
    height: 100%;
}

.overview-page .overview-container {
    width: 100%;
    min-width: 0;
    max-width: none;
    padding: 0;
    margin: 0;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
}

.overview-page .overview-upload-action {
    margin-left: 0;
}

.overview-page #multiUploadModal .modal-dialog {
    max-width: min(1120px, calc(100vw - 32px));
}

.overview-page #multiUploadModal .modal-content {
    max-height: min(88vh, 820px);
}

.overview-page #multiUploadModal .overview-multi-upload {
    min-height: min(720px, calc(88vh - 2px));
}

.overview-page #multiUploadModal .overview-multi-upload__header {
    margin-bottom: var(--space-4);
}

.overview-page #multiUploadModal .overview-multi-upload__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: var(--space-4);
    min-height: 0;
}

.overview-page #multiUploadModal .overview-multi-upload__alerts:empty {
    display: none;
}

.overview-page #multiUploadModal .overview-multi-upload__inputs {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: end;
    gap: var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
}

.overview-page #multiUploadModal .overview-multi-upload__field {
    min-width: 0;
}

.overview-page #multiUploadModal .overview-multi-upload__action {
    display: flex;
    justify-content: flex-end;
}

.overview-page #multiUploadModal .overview-multi-upload__action .np-btn {
    min-width: 136px;
}

.overview-page #multiUploadModal .overview-multi-upload__status {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 330px;
    overflow: hidden;
}

.overview-page #multiUploadModal .overview-multi-upload__status-header {
    flex: 0 0 auto;
    padding-left: var(--space-6);
}

.overview-page #multiUploadModal .overview-multi-upload__status-body {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
}

.overview-page #multiUploadModal .overview-multi-upload__table-shell {
    width: 100%;
    min-height: 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
}

.overview-page #multiUploadModal .overview-multi-upload__empty {
    margin: auto;
    max-width: 440px;
    text-align: center;
}

.overview-page #multiUploadModal .overview-multi-upload__table {
    min-width: 760px;
}

.overview-page #multiUploadModal #uploadStatusTable th:nth-child(1),
.overview-page #multiUploadModal #uploadStatusTable td:nth-child(1),
.overview-page #multiUploadModal #uploadStatusTable th:nth-child(2),
.overview-page #multiUploadModal #uploadStatusTable td:nth-child(2) {
    width: 18%;
}

.overview-page #multiUploadModal #uploadStatusTable th:nth-child(3),
.overview-page #multiUploadModal #uploadStatusTable td:nth-child(3) {
    width: 10%;
    text-align: right;
}

.overview-page #multiUploadModal .overview-multi-upload__progress-cell {
    min-width: 260px;
}

.overview-page #multiUploadModal .overview-multi-upload__status-cell {
    width: 112px;
    text-align: center;
}

.overview-page #multiUploadModal .overview-multi-upload__progress-cell .np-progress {
    min-width: 220px;
}

.overview-page #detailsModal .modal-dialog,
.overview-page #rerunPreprocModal .modal-dialog,
.overview-page #batchRerunModal .modal-dialog,
.analysis-page #analysisDetailsModal .modal-dialog,
.analysis-page #rerunAnalysisModal .modal-dialog,
.analysis-page #batchAnalysisRerunModal .modal-dialog {
    max-width: min(500px, calc(100vw - 32px));
}

.overview-page #detailsModal .modal-content,
.overview-page #rerunPreprocModal .modal-content,
.overview-page #batchRerunModal .modal-content,
.analysis-page #analysisDetailsModal .modal-content,
.analysis-page #rerunAnalysisModal .modal-content,
.analysis-page #batchAnalysisRerunModal .modal-content {
    max-height: min(88vh, 760px);
}

.overview-delete-confirm {
    box-sizing: border-box;
    width: min(440px, calc(100vw - 32px));
    padding: 0;
    border-radius: var(--radius-md);
    background: var(--card-bg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.overview-delete-confirm .swal2-title,
.overview-delete-confirm .swal2-icon {
    display: none !important;
}

.overview-delete-confirm__html {
    margin: 0;
    padding: 0;
}

.overview-delete-confirm__content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-4);
    text-align: left;
}

.overview-delete-confirm__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    height: 72px;
    margin: 0;
    background: var(--danger-text);
    color: #fff;
    font-size: 30px;
}

.overview-delete-confirm__content > :not(.overview-delete-confirm__icon) {
    margin-right: var(--space-6);
    margin-left: var(--space-6);
}

.overview-delete-confirm__copy {
    margin-top: var(--space-6);
}

.overview-delete-confirm__copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.overview-delete-confirm__title {
    margin: 0;
    color: var(--text-main);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
}

.overview-delete-confirm__description {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
}

.overview-delete-confirm__summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

.overview-delete-confirm__summary > div {
    min-width: 0;
    padding: var(--space-3);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--surface-subtle);
}

.overview-delete-confirm__summary span {
    display: block;
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.2;
    text-transform: uppercase;
}

.overview-delete-confirm__summary strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.overview-delete-confirm__caution {
    padding: var(--space-3);
    border: 1px solid rgba(220, 53, 69, 0.26);
    border-radius: var(--radius-sm);
    background: rgba(220, 53, 69, 0.08);
    color: var(--danger-text);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
}

.overview-delete-confirm__input {
    height: 42px;
    width: calc(100% - (var(--space-6) * 2));
    margin: var(--space-4) var(--space-6) 0;
    border-color: var(--border-soft);
    border-radius: var(--radius-sm);
    box-shadow: none;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 700;
}

.overview-delete-confirm__actions {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--space-2);
    width: calc(100% - (var(--space-6) * 2));
    margin: var(--space-6) var(--space-6) var(--space-6);
}

.overview-delete-confirm__actions .np-btn {
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
    white-space: nowrap;
}

.overview-page .overview-groups-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-width: 0;
    overflow: hidden;
}

.overview-page .overview-panel-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.overview-page .overview-panel-toggle:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 4px;
}

.overview-page .overview-panel-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.overview-page .overview-panel-title {
    min-width: 0;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.overview-page .overview-panel-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
}

.overview-page .overview-panel-toggle-icon {
    flex: 0 0 auto;
    width: 0.6rem;
    height: 0.6rem;
    margin-left: auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 160ms ease;
}

.overview-page .overview-panel-toggle[aria-expanded="false"] .overview-panel-toggle-icon {
    transform: rotate(-45deg);
}

.overview-page .overview-groups-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    min-height: 0;
    height: fit-content;
    overflow-x: auto;
    overflow-y: hidden;
    padding: var(--space-3) 0 0;
    align-items: flex-start;
    border-top: 1px solid var(--border-soft);
}

.overview-page .overview-group-card {
    flex: 0 0 184px;
    width: 184px;
    min-width: 184px;
    text-align: left;
    align-self: flex-start;
    border-radius: 0;
    border-top: 0;
    border-bottom: 0;
    border-left: 0;
    border-right: 1px solid var(--border-soft);
    box-shadow: none;
    background: var(--card-bg);
    transition: background-color 0.16s ease;
}

.overview-page .overview-group-card:hover {
    background: var(--surface-subtle);
}

.overview-page .overview-group-card:first-child {
    border-left: 1px solid var(--border-soft);
}

.overview-page .overview-group-card-header {
    align-items: flex-start;
    padding: 0 12px var(--space-2);
}

.overview-page .overview-group-card-body {
    flex: 0 0 auto;
    padding: 0 12px;
}

.overview-page .overview-group-stats {
    margin: 0;
    padding: 0;
    list-style: none;
}

.overview-page .overview-group-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: 0.35rem 0.5rem 0.35rem 0;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-main);
    font-size: 12px;
    line-height: 1.15;
}

.overview-page .overview-group-stat:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.overview-page .overview-group-card .np-card-title {
    font-size: 14px;
    line-height: 1.15;
}

.overview-page .overview-group-card .np-badge {
    padding: 2px 6px;
    font-size: 12px;
}

.overview-page .overview-subjects-section {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    margin-top: var(--space-1);
}

.overview-page .subjects-table-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding-bottom: 0;
}

.overview-page .overview-subjects-panel {
    height: 100%;
}

.overview-page .overview-subjects-toolbar {
    gap: var(--space-3) var(--space-4);
}

.overview-page .overview-subjects-toolbar .search-container {
    margin: 0;
    padding: 0;
    justify-content: flex-start;
}

.overview-page .overview-subjects-toolbar .search-container .dataTables_filter {
    width: min(380px, 100%);
}

.overview-page .overview-subjects-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-left: auto;
}

.overview-page .overview-batch-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.overview-page .overview-batch-action {
    min-width: 152px;
}

.overview-page #subjectsTable .subject-select-head,
.overview-page #subjectsTable .subject-select-cell {
  width: 56px;
  text-align: center;
}

.overview-page #subjectsTable .subject-select-cell {
    padding: 9px 10px;
}

.overview-page #subjectsTable .subject-select-checkbox {
    cursor: pointer;
}

.overview-page #subjectsTable .subject-index-head,
.overview-page #subjectsTable .subject-index-cell {
  width: 64px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.overview-page #subjectsTable .subject-id-head,
.overview-page #subjectsTable .subject-id-cell {
    width: auto;
    min-width: 0;
    font-weight: 600;
}

.overview-page #subjectsTable .subject-date-head,
.overview-page #subjectsTable .subject-date-cell {
    width: auto;
    min-width: 0;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.overview-page #subjectsTable .subject-group-head,
.overview-page #subjectsTable .subject-group-cell {
    width: auto;
    min-width: 0;
    white-space: nowrap;
}

.overview-page #subjectsTable .subject-weight-head,
.overview-page #subjectsTable .subject-weight-cell {
    width: auto;
    min-width: 0;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.overview-page #subjectsTable .subject-processed-head,
.overview-page #subjectsTable .subject-processed-cell {
    width: 1%;
    text-align: center;
    white-space: nowrap;
}

.overview-page #subjectsTable .subject-modalities-head,
.overview-page #subjectsTable .subject-modalities-cell {
    width: auto;
    min-width: 0;
    max-width: 360px;
}

.overview-page #subjectsTable .subject-modalities-cell {
    line-height: 1.25;
    word-break: break-word;
}

.overview-page #subjectsTable .subject-accepted-head,
.overview-page #subjectsTable .subject-accepted-cell {
    width: auto;
    min-width: 0;
    text-align: center;
    white-space: nowrap;
}

.overview-page #subjectsTable .subject-status-cell {
    font-size: 0;
}

.overview-page #subjectsTable .subject-status-cell svg {
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

.overview-page #subjectsTable .subject-logs-head,
.overview-page #subjectsTable .subject-logs-cell {
    width: 1%;
    text-align: center;
    white-space: nowrap;
}

.overview-page #subjectsTable .subject-logs-cell {
    padding: 5px 8px;
}


.overview-page #subjectsTable thead th:first-child {
    width: 56px;
    text-align: center;
}

.overview-page #subjectsTable thead th:nth-child(2) {
    width: 54px;
    text-align: center;
}

.overview-page #subjectsTable {
    table-layout: auto;
}

.overview-page #subjectsTable.dataTable thead > tr > th.sorting,
.overview-page #subjectsTable.dataTable thead > tr > th.sorting_asc,
.overview-page #subjectsTable.dataTable thead > tr > th.sorting_desc,
.overview-page #subjectsTable.dataTable thead > tr > th.sorting_asc_disabled,
.overview-page #subjectsTable.dataTable thead > tr > th.sorting_desc_disabled {
    padding-right: 16px !important;
    padding-left: 16px !important;
}

.overview-page #subjectsTable tbody tr.subject-selected > * {
    background: rgba(98, 193, 191, 0.18) !important;
}

@media (max-width: 720px) {
    .np-page-header--compact,
    .projects-page .project-page-topbar,
    .overview-page .overview-topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .np-page-header--compact .np-page-header__actions,
    .projects-page .project-page-topbar-actions,
    .overview-page .overview-topbar-actions {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }

    .overview-page .overview-groups-grid {
        max-height: 36vh;
    }

    .overview-page .overview-upload-action {
        width: 100%;
    }

    .overview-page .overview-upload-action > .np-btn,
    .overview-page .overview-upload-action .dropdown-menu {
        width: 100%;
    }

    .overview-page #multiUploadModal .overview-multi-upload {
        min-height: 0;
    }

    .overview-page #multiUploadModal .overview-multi-upload__inputs {
        grid-template-columns: 1fr;
    }

    .overview-page #multiUploadModal .overview-multi-upload__action,
    .overview-page #multiUploadModal .overview-multi-upload__action .np-btn {
        width: 100%;
    }

    .overview-delete-confirm {
        width: min(420px, calc(100vw - 24px));
    }

    .overview-delete-confirm__content > :not(.overview-delete-confirm__icon) {
        margin-right: var(--space-4);
        margin-left: var(--space-4);
    }

    .overview-delete-confirm__copy {
        margin-top: var(--space-4);
    }

    .overview-delete-confirm__input {
        width: calc(100% - (var(--space-4) * 2));
        margin-right: var(--space-4);
        margin-left: var(--space-4);
    }

    .overview-delete-confirm__actions {
        width: calc(100% - (var(--space-4) * 2));
        margin-right: var(--space-4);
        margin-bottom: var(--space-4);
        margin-left: var(--space-4);
    }

    .overview-delete-confirm__summary {
        grid-template-columns: 1fr;
    }

    .overview-page .overview-group-card {
        flex-basis: 200px;
        width: 200px;
        min-width: 200px;
    }

    .overview-page .overview-subjects-toolbar .search-container {
        min-width: 0;
    }

    .overview-page .overview-subjects-toolbar .search-container .dataTables_filter {
        width: 100%;
    }

    .overview-page .overview-subjects-toolbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .overview-page .overview-batch-actions {
        width: 100%;
    }
}

/* Status badge used in group overview run button */
.run-status-badge {
    min-width: 4.5rem;
    justify-content: center;
    text-transform: uppercase;
    vertical-align: middle;
}

.pharm-id-page {
    box-sizing: border-box;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.pharm-tabs-container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.pharm-tabs-container[hidden] {
    display: none;
}

.pharm-tabs-container .nav-tabs {
    flex: 0 0 auto;
    border-color: var(--border-soft);
}

.pharm-tab-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.pharm-tab-content > .tab-pane {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 1rem;
}

.pharm-tab-content > .tab-pane.active {
    display: flex;
    flex-direction: column;
}

.pharm-tab-scroll {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 0.25rem;
    padding-bottom: 2rem;
}

#pharm-drug-effects-content,
#pharm-similarity-content,
#pharm-subject-data-content {
    padding-bottom: 0;
}

#pharm-subject-data-content.pharm-subtab-active-feature-matrix {
    overflow: hidden;
    padding-right: 0;
}

#pharm-subject-data-content.pharm-subtab-active-feature-matrix .pharm-subtab-content,
#pharm-subject-data-content.pharm-subtab-active-feature-matrix .pharm-subtab-pane.active {
    overflow: hidden;
}

#pharm-drug-effects-content {
    flex: 0 0 auto;
    overflow: visible;
}

.pharm-subtabs {
    position: sticky;
    top: 0;
    z-index: 3;
    flex: 0 0 auto;
    gap: 0.35rem;
    margin: -0.25rem -0.25rem 1rem;
    padding: 0.25rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-soft);
}

.pharm-subtabs .nav-link {
    flex: 0 0 auto;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.pharm-subtabs .nav-link.active {
    background-color: var(--brand-soft) !important;
    color: #206E6C !important;
}

.pharm-subtab-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.pharm-subtab-pane {
    min-height: 0;
}

.pharm-subtab-pane.active {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pharm-matrix-mode-switch {
    width: fit-content;
    flex: 0 0 auto;
}

.pharm-analysis-setup-dialog {
    width: min(780px, calc(100vw - 2rem));
    max-width: none;
}

.pharm-analysis-setup-content {
    max-height: calc(100vh - 2rem);
    overflow: hidden;
}

.pharm-analysis-setup-body {
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0.25rem 1.75rem 0;
    overflow-y: visible;
    text-align: left;
}

.pharm-setup-field {
    width: 310px;
    max-width: 100%;
    margin-bottom: 1.15rem;
}

.pharm-setup-groups-wrapper {
    width: 100%;
    max-height: 238px;
    margin-top: 0.4rem;
    overflow: auto;
}

.pharm-setup-group-table {
    width: 100%;
    min-width: 650px;
    border-color: #bcbcbc;
    table-layout: fixed;
}

.pharm-setup-group-table thead th {
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    height: 44px;
    padding: 0.5rem 0.8rem;
}

.pharm-setup-group-table td {
    height: 48px;
    padding: 0.45rem 0.8rem;
    text-align: center;
}

.pharm-setup-group-label {
    display: inline-flex;
    gap: 0.65rem;
    align-items: center;
    min-width: 150px;
    justify-content: flex-start;
    font-size: 0.95rem;
    line-height: 1.2;
}

.pharm-setup-group-label input {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    margin-top: 0;
}

.pharm-setup-run-select {
    width: 130px;
    margin: 0 auto;
    font-size: 0.9rem;
}

.pharm-add-group-row {
    display: flex;
    justify-content: center;
    margin: 0.9rem 0;
}

.pharm-add-group-btn,
.pharm-setup-action {
    min-width: 175px;
    font-size: 1rem;
}

.pharm-selected-groups-box {
    width: 100%;
    min-height: 118px;
    max-height: 140px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.8rem;
    font-size: 0.95rem;
    line-height: 1.35;
    text-align: left;
}

.pharm-selected-group-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid #d8d8d8;
}

.pharm-selected-group-row:last-child {
    border-bottom: 0;
}

.pharm-selected-group-row span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.pharm-selected-group-remove {
    flex: 0 0 auto;
}

.pharm-control-field {
    margin-top: 1.25rem;
    margin-bottom: 0;
}

.pharm-analysis-setup-footer {
    justify-content: flex-end;
    gap: var(--space-3);
    padding: 1.5rem 1.75rem 1.2rem;
}

@media (max-width: 767.98px) {
    .pharm-analysis-setup-dialog {
        width: calc(100vw - 1rem);
        margin-right: auto;
        margin-left: auto;
    }

    .pharm-analysis-setup-body,
    .pharm-analysis-setup-footer {
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .pharm-setup-field {
        width: 100%;
        margin-bottom: 1rem;
    }

    .pharm-setup-input,
    .pharm-setup-select {
        min-height: 48px;
        font-size: 1rem;
    }

    .pharm-setup-group-table {
        min-width: 640px;
    }

    .pharm-analysis-setup-footer {
        gap: 0.75rem;
    }

    .pharm-setup-action {
        flex: 1 1 150px;
        min-width: 0;
    }
}

.pharm-panel {
    margin-bottom: 1rem;
}

.pharm-fill-table-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 0.5rem;
}

.pharm-panel > h5 {
    text-align: left;
    margin-bottom: 0.75rem;
}

.pharm-equal-row {
    align-items: stretch;
}

.pharm-equal-row > [class*="col-"] {
    display: flex;
    flex-direction: column;
}

.pharm-equal-row .pharm-mini-bars,
.pharm-equal-row .np-data-table-shell {
    flex: 1;
}

.pharm-group-counts-row .pharm-mini-bars {
    height: 100%;
    margin-bottom: 0;
    justify-content: space-between;
}

.pharm-group-counts-row .np-data-table-shell {
    display: flex;
    height: 100%;
    min-height: 100%;
}

.pharm-equal-row .np-data-table-shell table {
    flex: 1;
    height: 100%;
}

.pharm-group-counts-row tbody tr {
    height: 1%;
}

.pharm-highlight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.pharm-highlight-panel {
    padding: 0.85rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--card-bg);
}

.pharm-highlight-panel .pharm-panel {
    margin-bottom: 0;
}

.pharm-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.pharm-summary-card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.pharm-summary-card .np-card-body {
    padding: 0.8rem;
}

.pharm-card-label {
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.pharm-card-value {
    color: var(--text-main);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.pharm-key-value-table th {
    width: 220px;
    color: var(--text-secondary);
}

.pharm-mini-bars {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
}

.pharm-mini-bar-row {
    display: grid;
    grid-template-columns: minmax(90px, 0.85fr) minmax(120px, 2fr) minmax(42px, auto);
    gap: 0.6rem;
    align-items: center;
}

.pharm-mini-bar-label,
.pharm-mini-bar-value {
    font-size: 0.85rem;
}

.pharm-mini-bar-label {
    overflow-wrap: anywhere;
    text-align: left;
}

.pharm-mini-bar-value {
    color: var(--text-secondary);
    text-align: right;
}

.pharm-mini-bar-track {
    height: 0.75rem;
    background: var(--border-soft);
    border-radius: 999px;
    overflow: hidden;
}

.pharm-mini-bar-fill {
    height: 100%;
    background: var(--brand-color);
    border-radius: 999px;
}

.pharm-ranked-bars {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.pharm-ranked-bar-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(160px, 2.2fr) minmax(86px, auto);
    gap: 0.65rem;
    align-items: center;
    width: 100%;
    padding: 0.2rem 0.35rem;
    border: 0;
    border-radius: 0.35rem;
    background: transparent;
    text-align: left;
}

.pharm-ranked-bar-row.selected,
.pharm-ranked-bar-row:hover {
    background: var(--brand-soft);
}

.pharm-ranked-bar-header {
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.pharm-ranked-bar-header:hover {
    background: transparent;
}

.pharm-ranked-bar-label,
.pharm-ranked-bar-value {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.pharm-ranked-bar-label {
    overflow-wrap: anywhere;
}

.pharm-ranked-bar-value {
    text-align: right;
}

.pharm-ranked-bar-track {
    height: 0.85rem;
    overflow: hidden;
    background: var(--border-soft);
    border-radius: 999px;
}

.pharm-ranked-bar-fill {
    height: 100%;
    background: var(--brand-primary);
    border-radius: 999px;
}

.pharm-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.pharm-control {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.pharm-search-control {
    min-width: 220px;
}

.pharm-driver-table-wrapper {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow: auto;
}

.pharm-fill-table-wrapper {
    flex: 1;
    min-height: 0;
    max-height: none;
}

#pharm-drug-effects-drivers-output {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.pharm-driver-table th {
    cursor: pointer;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.pharm-driver-table td {
    min-width: 80px;
    vertical-align: middle;
}

.pharm-driver-table td:nth-child(2) {
    min-width: 220px;
    text-align: left;
}

.pharm-pair-table th:nth-child(2),
.pharm-pair-table td:nth-child(2) {
    width: 1%;
    min-width: 0;
    padding-right: 1rem;
    padding-left: 1rem;
    text-align: center;
    white-space: nowrap;
}

.pharm-subject-table-wrapper,
.pharm-wide-table-wrapper {
    max-height: 460px;
    overflow: auto;
}

.pharm-subject-table-wrapper.pharm-fill-table-wrapper {
    max-height: none;
}

.pharm-matrix-toolbar {
    flex-wrap: wrap;
}

.pharm-id-page .pharm-matrix-toolbar {
    z-index: 2;
    display: flex !important;
    flex: 0 0 auto;
    width: 100%;
    align-items: center;
    gap: 0.55rem !important;
    margin-bottom: 0.5rem !important;
    padding: 0.35rem 0.25rem 0.45rem;
    border-bottom: 1px solid var(--border-soft);
    background: var(--card-bg);
    overflow-x: visible;
}

.pharm-subject-table th,
.pharm-wide-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: nowrap;
}

.pharm-subject-table td,
.pharm-wide-table td {
    min-width: 90px;
    vertical-align: middle;
}

.pharm-wide-table th.pharm-rotated-feature-header {
    width: 42px;
    min-width: 42px;
    max-width: 42px;
    height: 170px;
    padding: 0.25rem;
    vertical-align: bottom;
}

.pharm-wide-table th.pharm-rotated-feature-header span {
    display: inline-block;
    width: 150px;
    transform: rotate(-90deg) translateX(-0.35rem);
    transform-origin: bottom left;
    white-space: nowrap;
    text-align: left;
}

.pharm-wide-table td.pharm-feature-value-cell {
    min-width: 42px;
    width: 42px;
    max-width: 42px;
    padding: 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
}

.pharm-id-page .pharm-feature-heatmap-shell {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.5rem;
    min-width: 0;
    min-height: 0;
}

.pharm-id-page .pharm-feature-matrix-container,
.pharm-id-page .pharm-feature-matrix-container .pharm-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.pharm-id-page .pharm-feature-heatmap-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.pharm-id-page .pharm-feature-heatmap-viewport {
    position: relative;
    flex: 1;
    width: 100%;
    height: auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 0.65rem;
    overflow: hidden;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    padding: 0.5rem;
}

.pharm-id-page .pharm-feature-heatmap-canvas-wrap {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.pharm-id-page .pharm-feature-heatmap-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

.pharm-id-page .pharm-feature-heatmap-colorbar {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 0.35rem;
    align-items: stretch;
    justify-items: center;
    min-height: 0;
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 700;
}

.pharm-id-page .pharm-feature-heatmap-colorbar-track {
    width: 0.8rem;
    min-height: 0;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: linear-gradient(
        to bottom,
        rgba(198, 81, 32, 0.84) 0%,
        rgba(248, 249, 250, 0.95) 50%,
        rgba(49, 119, 181, 0.84) 100%
    );
}

.pharm-id-page .pharm-feature-heatmap-colorbar-label {
    line-height: 1;
    white-space: nowrap;
}

.pharm-id-page .pharm-feature-heatmap-canvas:active {
    cursor: grabbing;
}

.pharm-id-page .pharm-feature-heatmap-tooltip {
    position: absolute;
    z-index: 2;
    max-width: 220px;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-card);
    color: var(--text-main);
    font-size: 0.76rem;
    line-height: 1.35;
    pointer-events: none;
    white-space: pre-line;
}

.pharm-subject-table td:nth-child(1),
.pharm-subject-table td:nth-child(2),
.pharm-wide-table td:nth-child(1),
.pharm-wide-table td:nth-child(2) {
    text-align: left;
    white-space: nowrap;
}

.pharm-path-text {
    max-width: 260px;
    overflow-wrap: anywhere;
    text-align: left;
}

.pharm-warning-list {
    text-align: left;
}

.pharm-heatmap {
    display: grid;
    gap: 2px;
    overflow-x: auto;
}

.pharm-heatmap-axis,
.pharm-heatmap-corner {
    min-height: 38px;
    padding: 0.35rem;
    background: var(--surface-subtle);
    color: var(--text-secondary);
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-wrap: anywhere;
}

.pharm-heatmap-column {
    writing-mode: horizontal-tb;
}

.pharm-heatmap-cell {
    position: relative;
    min-height: 38px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #111827;
    font-size: 0.78rem;
    font-weight: 600;
}

.pharm-heatmap-cell:disabled {
    background: var(--surface-subtle);
    color: var(--text-muted);
}

.pharm-feature-axis {
    justify-content: flex-start;
    text-align: left;
}

.pharm-portfolio-heatmap,
.pharm-portfolio-distance-heatmap,
.pharm-similarity-matrix {
    min-width: 760px;
}

.pharm-dendrogram-svg,
.pharm-mds-svg {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 300px;
    box-sizing: border-box;
    overflow: visible;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--card-bg);
}

.pharm-dendrogram-link {
    fill: none;
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.88;
}

.pharm-dendrogram-row-guide {
    stroke: #eef2f5;
    stroke-width: 1;
}

.pharm-dendrogram-axis path,
.pharm-dendrogram-axis line {
    stroke: #94a3b8;
}

.pharm-dendrogram-axis text,
.pharm-dendrogram-axis-title {
    fill: #64748b;
    font-size: 10px;
    font-weight: 700;
}

.pharm-dendrogram-node {
    stroke-width: 2;
}

.pharm-dendrogram-node.branch-node {
    opacity: 0.95;
}

.pharm-dendrogram-node.leaf-node {
    stroke: #fff;
    stroke-width: 1.5;
}

.pharm-dendrogram-leaf-marker {
    stroke: #fff;
    stroke-width: 1.5;
}

.pharm-dendrogram-label {
    fill: #1f2937;
    font-size: 11px;
    font-weight: 700;
}

.pharm-dendrogram-description {
    max-width: 58rem;
}

.pharm-mds-point {
    fill: #185d98;
    stroke: #fff;
    stroke-width: 1.5;
}

.pharm-axis-title {
    fill: #212529;
    font-weight: 700;
}

.pharm-mds-label {
    fill: #212529;
    font-weight: 700;
    paint-order: stroke;
    stroke: #fff;
    stroke-width: 4px;
    stroke-linejoin: round;
}

.pharm-mds-legend-label {
    font-size: 11px;
}

.pharm-tier-badge {
    min-width: 4rem;
}

.pharm-tier-explanation {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.pharm-tier-explanation-item {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.pharm-self-cell {
    color: #6c757d;
    font-weight: 500;
    opacity: 0.55;
}

.pharm-heatmap-top-feature {
    outline: 2px solid #212529;
    outline-offset: -3px;
}

.pharm-heatmap-highest-abs {
    outline: 3px solid #7cff00;
    outline-offset: -4px;
    box-shadow: inset 0 0 0 1px #fff;
}

.pharm-heatmap-selected {
    outline: 3px solid #dc3545;
    outline-offset: -4px;
    box-shadow: inset 0 0 0 1px #fff;
}

.pharm-heatmap-significant::after {
    content: "";
    position: absolute;
    right: 4px;
    top: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #212529;
}

.pharm-stat-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.pharm-stat-feature strong {
    color: var(--text-main);
    font-weight: 700;
}

.pharm-distribution-svg {
    width: 100%;
    min-height: 260px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--card-bg);
}

#pharmDistributionModal .modal-body {
    max-height: 75vh;
    overflow: auto;
}

.pharm-collapsible-panel {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--card-bg);
}

.pharm-collapsible-heading {
    margin: 0 !important;
}

.pharm-collapsible-toggle {
    position: relative;
    width: 100%;
    padding: 0.7rem 2.25rem 0.7rem 0.85rem;
    border: 0;
    background: var(--surface-subtle);
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 700;
    text-align: left;
}

.pharm-collapsible-toggle::after {
    content: "−";
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-weight: 700;
}

.pharm-collapsible-toggle.collapsed::after {
    content: "+";
}

.pharm-collapsible-body {
    padding: 1rem;
}

.pharm-drug-effects-driver-collapse {
    height: 500px;
}

.pharm-drug-effects-driver-collapse-inner {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pharm-section-subheading {
    margin: 0.35rem 0 0.6rem;
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 700;
}

.pharm-svg-axis {
    stroke: #495057;
    stroke-width: 1.2;
}

.pharm-svg-grid {
    stroke: #e9ecef;
    stroke-width: 1;
}

.pharm-svg-label {
    fill: #495057;
    font-size: 12px;
}

.pharm-mean-line {
    stroke: #212529;
    stroke-width: 2.5;
}

.pharm-point {
    stroke: #fff;
    stroke-width: 1.5;
    opacity: 0.9;
}

.pharm-point-control {
    fill: #4c78a8;
}

.pharm-point-drug {
    fill: #b85b4b;
}

.pharm-legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: end;
    margin-bottom: 0.75rem;
}

.pharm-legend-button {
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
}

.pharm-legend-swatch {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.75);
}

.pharm-highlight-control {
    min-width: 180px;
    margin-left: auto;
}

.pharm-scatter-point {
    stroke: #fff;
    stroke-width: 1.5;
}

.pharm-confusion-wrapper {
    overflow-x: auto;
}

.pharm-confusion-table th,
.pharm-confusion-table td {
    text-align: center;
    white-space: nowrap;
}

.pharm-confusion-table tbody th {
    color: var(--text-main);
    background: var(--surface-subtle);
}

.pharm-confusion-cell {
    color: #111827;
    font-weight: 700;
    min-width: 54px;
}

.pharm-direction-bars {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
}

.pharm-direction-row {
    display: grid;
    grid-template-columns: minmax(90px, 0.85fr) minmax(160px, 2fr) minmax(58px, auto);
    gap: 0.6rem;
    align-items: center;
}

.pharm-direction-track {
    position: relative;
    height: 1rem;
    background: var(--border-soft);
    border-radius: 999px;
    overflow: hidden;
}

.pharm-direction-axis {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: rgba(0, 0, 0, 0.28);
}

.pharm-direction-fill {
    position: absolute;
    top: 0;
    bottom: 0;
}

.pharm-direction-fill.positive {
    background: #b85b4b;
    border-radius: 0 999px 999px 0;
}

.pharm-direction-fill.negative {
    background: #4c78a8;
    border-radius: 999px 0 0 999px;
}

.pharm-clickable-card-grid {
    align-items: stretch;
}

.pharm-similarity-card {
    width: 100%;
    text-align: left;
    background: #fff;
}

.pharm-similarity-card.selected {
    border-color: #198754;
    box-shadow: 0 0 0 0.16rem rgba(25, 135, 84, 0.18);
}

.pharm-comparator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.pharm-comparator-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.pharm-comparator-list h6 {
    margin: 0;
    color: #212529;
    font-weight: 700;
}

.pharm-comparator-card {
    width: 100%;
    text-align: left;
    background: #fff;
}

.pharm-comparator-card.selected {
    border-color: #198754;
    box-shadow: 0 0 0 0.16rem rgba(25, 135, 84, 0.18);
}

.pharm-feature-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.pharm-feature-chip {
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
    text-align: left;
}

.pharm-qc-note {
    margin-top: 0.75rem;
    margin-bottom: 0;
    font-size: 0.86rem;
}

.pharm-divergent-svg text,
.pharm-scatter-svg text {
    pointer-events: none;
}

/* Metric cards (e.g. vCPU usage) */
.metric-card {
    background-color: #212529;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    width: 120px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* vCPU meter in the sidebar */
#vcpuTitle {
    color: var(--text-main);
    font-size: 0.75rem;
}
#vcpuLabel {
    position: static;
    transform: none;
    color: var(--text-secondary);
    text-align: right;
    width: auto;
    font: inherit;
    font-size: 0.6rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0;
}
#vcpuLabel .vcpu-used {
    color: inherit;
    font: inherit;
}
#vcpuLabel .vcpu-separator {
    color: inherit;
    font: inherit;
}
#vcpuLabel .vcpu-total {
    color: inherit;
    font: inherit;
}

/* --- NBS figures layout --- */
.results-page .nbs-result-pane {
    min-height: 0;
    overflow: hidden;
}

.results-page .nbs-results-panel {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.results-page .nbs-results-panel__body {
    flex: 1 1 0;
    min-height: 0;
    padding: var(--space-4);
}

.results-page .nbs-results-panel__body > .nbs-grid {
    flex: 1 1 0;
    min-height: 0;
}

.results-page .nbs-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
    width: 100%;
    min-width: 0;
    min-height: 0;
    height: 100%;
}

.results-page .nbs-figure {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    padding: 0;
}

.results-page .nbs-figure > img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: calc(var(--radius-md) - 1px);
    cursor: pointer;
}

.results-page #nbs-diff-container {
    align-items: stretch;
    justify-content: center;
}

.results-page #nbs-circo-container.nbs-figure__media {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

.results-page #nbs-circo-container.nbs-figure__media > img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
    cursor: pointer;
}

.results-page .nbs-badge {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
    pointer-events: none;
    z-index: 1;
}

.results-page .connectogram-icon {
    top: var(--space-2);
    left: var(--space-2);
}

/* --- GT figures layout --- */
.results-page .gt-result-pane {
    min-height: 0;
    overflow: hidden;
}

.results-page .gt-results-panel {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.results-page .gt-results-panel__body {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    padding: var(--space-4);
}

.results-page .gt-results-scroll {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    align-items: center;
    min-width: 0;
}

.results-page .gt-results-scroll > .graph-metric-container {
    width: 100%;
    justify-content: center;
}

@media (max-width: 992px) {
    .results-page .nbs-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .results-page .nbs-results-panel__body {
        padding-left: var(--space-3);
        padding-right: var(--space-3);
    }

    .results-page .gt-results-panel__body {
        padding-left: var(--space-3);
        padding-right: var(--space-3);
    }

    .results-page .nbs-grid {
        gap: var(--space-2);
    }

    .results-page .gt-results-scroll {
        gap: var(--space-2);
    }
}

.diff-wrapper {
    position: relative;
    overflow: visible;
}

.results-summary-btn {
    color: var(--brand-color);
    font-style: italic;
}

.results-summary-btn:disabled,
.results-summary-btn[aria-disabled="true"] {
    color: var(--text-muted);
    cursor: default;
    opacity: 0.65;
}

.connectogram-icon {
    position: absolute;
    top: 30px;
    left: 10px;
    color: gray;
    cursor: pointer;
    z-index: 1;
    font-size: 1.5em;
}

#resetBtn {
    margin-top: 6px;
    padding: 6px 10px;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
}

#saveBtn {
    margin-top: 6px;
    padding: 6px 10px;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
}

#chart { width: 900px; height: 900px; margin: 0 auto; }
/* svg { width: 100%; height: 100%; } */
.arc { cursor: pointer; stroke: #fff; stroke-width: 1px; }
.label { font-size: 10px; text-anchor: middle; pointer-events: none; fill: #000; }
.link { fill: none; stroke-opacity: 0.7; stroke-width: 1.5px; cursor: pointer; }
path.tring { stroke: #fff; stroke-width: 0.5px; }
#connectogram-controls {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 160px;
    z-index: 10;
}
#connectogram-legend {
    background: rgba(255,255,255,0.9);
    border: 1px solid #888;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 12px;
}
.legend-colorbar {
    width: 100%;
    height: 10px;
    display: block;
    margin: 2px 0;
}
.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
}
#tooltip {
    position: absolute;
    padding: 6px 10px;
    background: rgba(255,255,255,0.9);
    border: 1px solid #888;
    border-radius: 4px;
    pointer-events: none;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

/* Rounded corners for result images */
#group1-img-container img,
#group2-img-container img,
#stats-img-container img,
#group1-falff-container img,
#group2-falff-container img,
#stats-falff-container img,
#group1-hurst-container img,
#group2-hurst-container img,
#stats-hurst-container img,
#group1-dsc-container img,
#group2-dsc-container img,
#stats-dsc-container img,
#group1-cbf-container img,
#group2-cbf-container img,
#stats-cbf-container img,
#group1-morph-container img,
#group2-morph-container img,
#stats-morph-container img,
#group1-fa-container img,
#group2-fa-container img,
#stats-fa-container img,
#group1-md-container img,
#group2-md-container img,
#stats-md-container img,
#group1-t1-container img,
#group2-t1-container img,
#stats-t1-container img {
    border-radius: 10px;
}

/* Bar chart containers */
.results-page .results-content {
    flex: 1 1 0;
    min-height: 0;
}

.results-page #myTabContent {
    flex: 1 1 0;
    min-height: 0;
}

.bar-chart-wrapper {
    position: relative;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--card-bg);
    display: flex;
    justify-content: stretch;
    align-items: stretch;
    overflow: hidden;
    min-height: 0;
    flex: 1 1 0;
    padding: var(--space-3);
    box-sizing: border-box;
}

.bar-chart-wrapper > [id$="-bar-chart"] {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
}

.bar-chart-wrapper .tableIcon {
    position: absolute;
    top: 15px;
    left: 10px;
    color: var(--brand-color);
    cursor: pointer;
    z-index: 1;
}

.bar-chart-axis-toggle {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    z-index: 1;
}

/* Result images containers */
[id$="-images-container"] {
    display: flex;
    align-items: flex-start;
    overflow: hidden;
}

.result-pane > .images-container {
    position: relative;
    flex: 0 1 42%;
    min-height: 0;
    max-height: 42%;
}

.images-container > div {
    display: flex;
    align-items: center;
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    overflow: hidden;
}

.map-figure--left {
    justify-content: flex-start;
}

.map-figure--center {
    justify-content: center;
}

.map-figure--right {
    justify-content: flex-end;
}

.diff-wrapper > [id^="stats-"][id$="-container"] {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: relative;
    overflow: hidden;
}

.images-container h2 {
    align-self: center;
    flex: 0 0 auto;
    margin: 0;
}

.seed-map-separator {
    align-self: center;
    flex: 0 0 2rem;
    width: 2rem;
}

.images-container img {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 100%;
    max-height: 100%;
    border-radius: 10px !important;
    clip-path: inset(0 round 10px);
}

/* Tab panes that hold plots and figures */
.result-pane {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.tab-content > .result-pane.active {
    display: flex;
}

.fmri-nifti-modal {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    width: clamp(360px, 45vw, 640px);
    max-height: min(640px, 80vh);
    display: none;
    z-index: 1100;
}

.fmri-nifti-modal.is-visible {
    display: flex;
}

.fmri-nifti-modal__dialog {
    width: 100%;
    height: 100%;
    background: #050b18;
    border-radius: 18px;
    padding: 1rem;
    box-shadow: 0 18px 48px rgba(8, 15, 40, 0.55);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.fmri-nifti-modal__toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: space-between;
    width: 100%;
}

.fmri-nifti-modal__toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.fmri-nifti-modal__drag-handle {
    flex: 1;
    min-width: 120px;
    height: 28px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    position: relative;
    cursor: grab;
    transition: background 0.2s ease;
}

.fmri-nifti-modal__drag-handle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50%;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 -6px 0 rgba(255, 255, 255, 0.2), 0 6px 0 rgba(255, 255, 255, 0.2);
}

.fmri-nifti-modal__drag-handle:active {
    cursor: grabbing;
    background: rgba(255, 255, 255, 0.2);
}

.fmri-nifti-modal__canvas {
    flex: 1;
    background: #000;
    border-radius: 0.85rem;
    overflow: hidden;
    min-height: 320px;
    aspect-ratio: 1 / 1;
}

#fmri-nifti-viewer {
    width: 100%;
    height: 100%;
    display: block;
}

.fmri-nifti-modal__close {
    align-self: flex-end;
    filter: invert(1);
}

.fmri-nifti-modal__toggle {
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 0.3rem 0.95rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transition: background 0.2s ease, color 0.2s ease;
}

.fmri-nifti-modal__toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.fmri-nifti-modal__toggle[aria-pressed="true"] {
    background: #fff;
    color: #050b18;
}

@media (max-width: 768px) {
    .fmri-nifti-modal {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        width: auto;
        max-width: unset;
    }

    .fmri-nifti-modal__drag-handle {
        min-width: 80px;
    }
}

.modal-content.bg-white {
    background: #ffffff;
}

.mono {
    font-family: ui-monospace, Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: 12px;
}


/* Animación suave para el colapso */
.projectMenuCollapse {
    transition: all 0.3s ease;
}

.sidebar-collapse {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }

    /* Creamos la flecha con el pseudo-elemento */
.sidebar-collapse::after {
    content: "";
    width: 0; 
    height: 0; 
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--brand-color); /* Color de la flecha */
    transition: transform 0.3s ease;
    margin-left: 10px;
    display: none;
}

/* Cuando el menú está abierto, rotamos el after */
.sidebar-collapse.menu-open::after {
    transform: rotate(180deg);
}

/* Eliminamos tu antigua regla que causaba el conflicto */
@media (max-height: 770px) {
    .sidebar-collapse::after {
        display: inline-block; /* Aseguramos que se vea siempre */
    }
    .projectMenuCollapse.collapse:not(.show) {
        /* Eliminamos el display:none !important para que Bootstrap funcione */
    }
}

@media (min-height: 771px) {
    .sidebar-collapse::after {
        display: none; 
    }
    .projectMenuCollapse.collapse {
        display: block !important; 
    }
}

.rotate-180 {
    transform: rotate(180deg);
}

#manageUsers-container{
    width: 90% ;
}

/*Imagenes report*/
.figure-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.figure-img-inline {
  width: 32%;
  object-fit: contain;
  border-radius: 6px;
}
