/* Study Summary (custom/meridian/study_summary.py). Auto-served by Dash from /assets/.
   Platform greys and accent (#1e40af); outcome colors come inline from
   study_summary_view.ROLE (the Disposition page's palette). */

.ss-summary-page {
    padding: 1rem 1.25rem 2.5rem 1.25rem;
    background: #ffffff;
    color: #212529;
}

/* === Header and controls (one row above the content) ===================== */
.ss-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 1rem;
    margin-bottom: 0.75rem;
}
.ss-title {
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0;
}
.ss-asof {
    font-size: 0.85rem;
    color: #6c757d;
}
.ss-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.5rem;
    padding: 0.6rem 0.9rem;
    margin-bottom: 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}
.ss-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.ss-control-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #495057;
    margin: 0;
}
.ss-site-dropdown {
    min-width: 180px;
    font-size: 0.85rem;
}
.ss-segmented .btn {
    font-size: 0.8rem;
    padding: 0.15rem 0.6rem;
}

/* === Journey strip ======================================================= */
.ss-journey {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.ss-stage {
    flex: 1 1 0;
    min-width: 0;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 0.9rem 1rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.ss-stage-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #1e40af;
}
.ss-headline {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: baseline;
    column-gap: 0.5rem;
}
.ss-headline-value {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.1;
    color: #212529;
    grid-row: span 2;
}
.ss-headline-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #495057;
}
.ss-headline-change {
    font-size: 0.75rem;
    color: #6c757d;
    min-height: 1em;
}

/* A bucket: label | value | bar | change */
.ss-rows {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.ss-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "label value"
        "bar   change";
    column-gap: 0.5rem;
    row-gap: 0.2rem;
    align-items: center;
}
.ss-row-label { grid-area: label; font-size: 0.82rem; color: #343a40; }
.ss-row-value {
    grid-area: value;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.ss-bar {
    grid-area: bar;
    height: 6px;
    background: #f1f3f5;
    border-radius: 3px;
}
.ss-bar-fill {
    height: 100%;
    border-radius: 3px;
    min-width: 0;
}
.ss-row-change {
    grid-area: change;
    font-size: 0.7rem;
    color: #6c757d;
    text-align: right;
    min-width: 3.5rem;
}

/* Numbers that open the participant panel */
.ss-headline-value,
.ss-row-value,
.ss-tile-value {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    text-align: left;
}
.ss-row-value { text-align: right; }
.ss-headline-value:hover,
.ss-row-value:hover,
.ss-tile-value:hover {
    color: #1e40af;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.ss-headline-value:focus-visible,
.ss-row-value:focus-visible,
.ss-tile-value:focus-visible {
    outline: 2px solid #1e40af;
    outline-offset: 2px;
    border-radius: 3px;
}

/* Between stages: how many carry forward */
.ss-connector {
    flex: 0 0 auto;
    width: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #6c757d;
}
.ss-connector-count { font-size: 0.95rem; font-weight: 600; color: #212529; }
.ss-connector-arrow { font-size: 1.2rem; line-height: 1; color: #1e40af; }
.ss-connector-label { font-size: 0.65rem; line-height: 1.2; }

/* === Part B detail band =================================================== */
.ss-band {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    padding: 0.9rem 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    background: #fafbfc;
}
.ss-band-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
    margin-bottom: 0.4rem;
}
.ss-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.ss-tile {
    min-width: 108px;
    padding: 0.5rem 0.75rem;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}
.ss-tile-value { font-size: 1.3rem; font-weight: 600; color: #212529; }
.ss-tile-label { font-size: 0.8rem; color: #343a40; }
.ss-tile-note,
.ss-tile-change { font-size: 0.7rem; color: #6c757d; min-height: 1em; }

/* === By site ============================================================ */
.ss-section-title { font-size: 1rem; font-weight: 600; margin: 0.5rem 0 0.1rem 0; }
.ss-section-note { font-size: 0.8rem; color: #6c757d; margin-bottom: 0.5rem; }
.ss-sites-grid .ag-row { cursor: pointer; }
.ss-note { font-size: 0.9rem; color: #6c757d; padding: 1rem 0; }

/* === Participant panel ================================================== */
.ss-panel { width: min(480px, 100vw) !important; }
.ss-panel-table { width: 100%; font-size: 0.85rem; border-collapse: collapse; }
.ss-panel-table th {
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
    padding: 0.35rem 0.5rem;
}
.ss-panel-table td {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid #f1f3f5;
    font-variant-numeric: tabular-nums;
}

/* === Narrower screens: two stages per row, then one ===================== */
@media (max-width: 1199.98px) {
    .ss-journey { flex-wrap: wrap; }
    .ss-stage { flex: 1 1 calc(50% - 0.5rem); }
    .ss-connector { display: none; }
}
@media (max-width: 575.98px) {
    .ss-summary-page { padding: 0.75rem 1rem 2rem 1rem; }
    .ss-stage { flex: 1 1 100%; }
    .ss-controls { gap: 0.5rem 1rem; }
}
