.member-profile {
    display: grid;
    gap: 22px;
}

.member-profile-summary {
    display: flex;
    align-items: stretch;
    gap: 22px;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.member-profile-photo {
    display: grid;
    flex: 0 0 148px;
    place-items: center;
    width: 148px;
    height: 148px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--brand);
}

.member-profile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.member-profile-photo .ui-icon {
    width: 52px;
    height: 52px;
}

.member-profile-core {
    display: grid;
    flex: 1 1 auto;
    gap: 16px;
    min-width: 0;
}

.member-profile-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.member-profile-heading h2 {
    margin: 0 0 5px;
    font-size: 24px;
}

.member-profile-heading p {
    margin: 0;
    color: var(--muted);
}

.member-profile-details {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--border);
}

.member-profile-details > div {
    display: grid;
    gap: 5px;
    min-width: 0;
    padding: 12px;
    background: var(--surface);
}

.member-profile-details dt {
    color: var(--muted);
    font-size: 12px;
}

.member-profile-details dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    font-weight: 750;
}

.member-profile-notes {
    display: grid;
    gap: 5px;
    padding: 12px 0 0;
    border-top: 1px solid var(--border);
}

.member-profile-notes span {
    color: var(--muted);
    font-size: 12px;
}

.member-profile-notes p {
    margin: 0;
    white-space: pre-wrap;
}

.member-profile-tabs {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.member-profile-tab {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 58px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    text-align: start;
}

.member-profile-tab:hover,
.member-profile-tab[aria-selected="true"] {
    border-color: var(--profile-color);
    background: color-mix(in srgb, var(--profile-color) 9%, var(--surface));
    color: var(--text);
}

.member-profile-tab[aria-selected="true"] {
    box-shadow: inset 0 -3px 0 var(--profile-color);
}

.member-profile-tab-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--profile-color) 14%, var(--surface));
    color: var(--profile-color);
}

.member-profile-tab-icon .ui-icon {
    width: 18px;
    height: 18px;
}

.member-profile-tab span:last-child {
    min-width: 0;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
}

.member-profile-panel {
    display: grid;
    gap: 22px;
}

.member-profile-panel[hidden] {
    display: none;
}

.profile-section {
    display: grid;
    gap: 13px;
    padding-block: 2px 18px;
    border-bottom: 1px solid var(--border);
}

.profile-section:last-child {
    border-bottom: 0;
}

.profile-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.profile-section-head h3 {
    margin: 0;
    font-size: 17px;
}

.profile-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.profile-metric {
    display: grid;
    gap: 5px;
    min-height: 88px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
}

.profile-metric span {
    color: var(--muted);
    font-size: 12px;
}

.profile-metric strong {
    font-size: 20px;
}

.profile-empty {
    display: grid;
    place-items: center;
    min-height: 110px;
    padding: 18px;
    border: 1px dashed var(--border-strong);
    border-radius: 6px;
    color: var(--muted);
    text-align: center;
}

.member-profile-link {
    color: inherit;
    text-decoration: none;
    transition: color .16s ease;
}

.member-profile-link:hover,
.member-profile-link:focus-visible {
    color: var(--brand);
}

.member-profile-link:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent);
    outline-offset: 3px;
    border-radius: 3px;
}

.profile-program-days {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.profile-program-day {
    overflow: hidden;
    border: 1px solid var(--border);
    border-inline-start: 3px solid var(--brand);
    border-radius: 6px;
    background: var(--surface-soft);
}

.profile-program-day[open] {
    border-color: color-mix(in srgb, var(--brand) 45%, var(--border));
    background: var(--surface);
}

.profile-program-day > summary {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) minmax(170px, auto) auto 24px;
    align-items: center;
    gap: 12px;
    min-height: 68px;
    padding: 12px 14px;
    cursor: pointer;
    list-style: none;
}

.profile-program-day > summary::-webkit-details-marker {
    display: none;
}

.profile-program-day > summary:hover {
    background: color-mix(in srgb, var(--brand) 6%, transparent);
}

.profile-program-day-title,
.profile-program-day-schedule {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.profile-program-day-title small,
.profile-program-day-schedule small {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-program-day-chevron {
    display: grid;
    place-items: center;
    transition: transform .18s ease;
}

.profile-program-day[open] .profile-program-day-chevron {
    transform: rotate(180deg);
}

.profile-program-day-body {
    padding: 0 14px 14px;
    border-top: 1px solid var(--border);
}

.profile-program-day-body .table-wrap {
    margin-top: 12px;
}

.profile-session-exercises {
    min-width: 760px;
}

.profile-training-status {
    justify-self: start;
    white-space: nowrap;
}

.profile-training-status.status-incomplete {
    background: color-mix(in srgb, var(--secondary) 18%, var(--surface));
    color: var(--text);
}

.profile-training-status.status-not_done {
    background: color-mix(in srgb, var(--danger) 13%, var(--surface));
    color: var(--danger);
}

.profile-exercise-set-progress {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-weight: 700;
}

.profile-status-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 1080px) {
    .member-profile-tabs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .member-profile-details,
    .profile-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .member-profile-summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .member-profile-photo {
        width: 112px;
        height: 112px;
    }

    .member-profile-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .member-profile-tabs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .member-profile-tab {
        grid-template-columns: 1fr;
        justify-items: center;
        min-height: 76px;
        text-align: center;
    }

    .member-profile-details,
    .profile-metrics,
    .profile-program-days {
        grid-template-columns: 1fr;
    }

}


@media (max-width: 700px) {
    .profile-program-day > summary {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .profile-program-day-schedule {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}


.profile-upcoming-membership {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: center;
    margin-top: 14px;
    padding: 12px 14px;
    border-inline-start: 4px solid var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.profile-upcoming-membership span,
.profile-upcoming-membership small {
    color: var(--muted);
}

@media (max-width: 720px) {
    .profile-upcoming-membership {
        grid-template-columns: 1fr;
    }
}
