/* Student Success & Retention — movement summary, insight, filters, and student list */

#student-retention-details {
    scroll-margin-top: 1rem;
}

#student-retention-details > .card-header.metric-panel-header {
    display: block;
}

#student-retention-details .attendance-roster-header-toolbar {
    width: 100%;
}

/* Movement summary KPI semantic colors on student success page */
.student-success-page .home-kpi-card__value.text-success {
    color: #1f7a4a;
}

.student-success-page .home-kpi-card__value.text-danger {
    color: #c0392b;
}

.student-success-page .home-kpi-card__value.text-warning {
    color: #b45309;
}

.student-success-page .home-kpi-card__value.text-info {
    color: #0284c7;
}

/* Key insight panel */
.retention-comparison-insight {
    margin: 0 0 1rem;
    padding: 0.75rem 0.85rem;
    border-radius: 0.5rem;
    border: 1px solid #7dd3fc;
    background: linear-gradient(180deg, #e0f2fe 0%, #f0f9ff 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.retention-comparison-insight__title {
    margin: 0 0 0.35rem;
    font-size: var(--app-text-sm, 0.8125rem);
    font-weight: 600;
    color: #0c4a6e;
}

.retention-comparison-insight__body {
    margin: 0;
    font-size: var(--app-text-sm, 0.8125rem);
    line-height: 1.45;
    color: var(--brand-sidebar-text, #334155);
}

.retention-comparison-insight__body--loading {
    display: flex;
    align-items: center;
    color: var(--brand-sidebar-text-muted, #1e293b);
}

.retention-comparison-insight__quota {
    margin-top: 0.45rem;
    font-size: 0.6875rem;
    line-height: 1.35;
    color: #92400e;
}

/* Trend filter pills */
.retention-trend-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0 0 1rem;
}

.retention-trend-filter {
    appearance: none;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0369a1;
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.25;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.retention-trend-filter:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.retention-trend-filter.is-active {
    background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%);
    border-color: #0284c7;
    color: #fff;
    font-weight: 600;
}

.retention-trend-filter.is-active:hover {
    background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%);
    border-color: #0284c7;
    color: #fff;
}

/* Student list rows */
.retention-student-subgrid-list {
    grid-template-columns:
        minmax(10rem, 2.5fr)
        minmax(6rem, 1fr)
        minmax(6rem, 1fr)
        minmax(4rem, 0.8fr);
    min-width: 36rem;
}

.retention-student-subgrid-list.retention-student-list--with-trend {
    grid-template-columns:
        minmax(10rem, 2.2fr)
        minmax(4.5rem, 0.75fr)
        minmax(4.5rem, 0.75fr)
        minmax(4.5rem, 0.7fr)
        minmax(7rem, 1fr);
    min-width: 40rem;
}

.retention-trend-cell {
    display: flex;
    align-items: center;
    min-width: 0;
}

.retention-trend-bar {
    width: 100%;
    max-width: 7.5rem;
    height: 0.35rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.retention-trend-bar__fill {
    display: block;
    height: 100%;
    border-radius: inherit;
}

.retention-trend-bar__fill--down {
    background: #c0392b;
}

.retention-trend-bar__fill--up {
    background: #1f7a4a;
}

.retention-trend-bar__fill--stable {
    background: #94a3b8;
}

.retention-student-list-header {
    padding: 0 0.85rem 0.35rem;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--brand-sidebar-text-muted, #1e293b);
}

.retention-student-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

/* Shared card-style list rows (Student Success + Student page) */
.student-card-row {
    display: grid;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.retention-student-subgrid-list > .student-card-row,
.retention-student-subgrid-list > .retention-student-row {
    gap: 0;
}

.retention-student-row__student {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.retention-student-row__name {
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.25;
    color: var(--brand-sidebar-text, #0f172a);
}

.retention-student-row__id {
    font-size: 0.75rem;
    color: var(--app-text-muted-soft, #334155);
    line-height: 1.25;
}

.retention-student-row__cell {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.retention-score-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
}

.retention-score-pill--green {
    background: #e8f5ee;
    color: #1f7a4a;
}

.retention-score-pill--orange {
    background: #fef3c7;
    color: #b45309;
}

.retention-score-pill--amber {
    background: #ffe8a3;
    color: #92400e;
}

.retention-score-pill--red {
    background: #fdeaea;
    color: #c0392b;
}

.retention-score-pill--muted {
    background: #f3f4f6;
    color: #6b7280;
}

.retention-note-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1;
    padding: 0.1rem 0.2rem;
    border-radius: 0.25rem;
    opacity: 0.85;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.retention-note-btn:hover:not(:disabled) {
    opacity: 1;
    background: rgba(59, 130, 246, 0.08);
}

.retention-note-btn.is-open {
    opacity: 1;
    background: rgba(59, 130, 246, 0.14);
}

.retention-note-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.retention-student-row__delta {
    font-weight: 700;
    font-size: 0.8125rem;
    line-height: 1.2;
}

.retention-delta--up {
    color: #1f7a4a;
}

.retention-delta--down {
    color: #c0392b;
}

.retention-delta--stable {
    color: var(--app-text-muted, #1e293b);
}

.retention-delta--muted {
    color: var(--app-text-muted-soft, #334155);
}

/* Sticky notes flyout */
.retention-notes-flyout {
    position: fixed;
    z-index: 1050;
    width: min(15rem, calc(100vw - 1.5rem));
    max-height: min(60vh, 22rem);
    display: flex;
    flex-direction: column;
    border: 1px solid #e2e8f0;
    border-radius: 0.625rem;
    background: #fff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.retention-notes-flyout.is-positioned {
    margin: 0;
}

.retention-notes-flyout__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0.55rem 0.45rem 0.65rem;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    flex-shrink: 0;
}

.retention-notes-flyout__title {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    line-height: 1.25;
}

.retention-notes-flyout__close {
    border: none;
    background: transparent;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--app-text-muted, #1e293b);
    padding: 0 0.2rem;
    cursor: pointer;
}

.retention-notes-flyout__close:hover {
    color: #334155;
}

.retention-notes-flyout__body {
    padding: 0.55rem 0.65rem;
    overflow-y: auto;
}

.retention-notes-flyout__empty {
    font-size: 0.75rem;
    color: var(--app-text-muted, #1e293b);
}

.retention-notes-flyout__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.retention-notes-flyout__meta {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--app-text-muted, #1e293b);
    margin-bottom: 0.1rem;
}

.retention-notes-flyout__text {
    font-size: 0.75rem;
    color: #4b5563;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .retention-trend-filters {
        gap: 0.25rem;
    }

    .retention-student-subgrid-list {
        grid-template-columns:
            minmax(8rem, 1.5fr)
            minmax(5.5rem, 1fr)
            minmax(5.5rem, 1fr)
            minmax(3.5rem, 0.75fr);
    }

    .retention-student-subgrid-list.retention-student-list--with-trend {
        min-width: 36rem;
    }
}

@media (max-width: 576px) {
    .retention-student-subgrid-list > .retention-student-list-header {
        display: none;
    }

    .retention-student-subgrid-list > .retention-student-row {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "student student"
            "baseline compare"
            "delta trend";
    }

    .retention-student-subgrid-list > .retention-student-row .retention-student-row__student {
        grid-area: student;
    }

    .retention-student-subgrid-list > .retention-student-row .retention-student-row__cell--baseline {
        grid-area: baseline;
    }

    .retention-student-subgrid-list > .retention-student-row .retention-student-row__cell--compare {
        grid-area: compare;
    }

    .retention-student-subgrid-list > .retention-student-row .retention-student-row__delta {
        grid-area: delta;
    }

    .retention-student-subgrid-list > .retention-student-row .retention-trend-cell {
        grid-area: trend;
    }
}
