.account-profile-link { overflow: hidden; text-decoration: none; flex-shrink: 0; }
.account-profile-link img, .profile-avatar { display: block; border-radius: 50%; object-fit: cover; }
.account-profile-link:focus-visible { outline: 2px solid #203b59; outline-offset: 3px; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1.25rem; align-items: start; }
.profile-grid .teacher-panel { margin-top: 0; }
.avatar-editor { display: grid; gap: .8rem; }
.avatar-reset { display: flex; gap: .5rem; align-items: center; }
.avatar-reset input { width: auto; }
.team-settings { max-width: 34rem; }
.team-request { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: .65rem 0; }
.team-directory { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 1rem; }
.team-card { padding: 1rem; border: 1px solid var(--line); border-radius: .5rem; background: white; overflow-wrap: anywhere; }
.team-card h4 { margin: .6rem 0 .3rem; }
.team-card p { margin: .3rem 0 .6rem; }
.parent-credentials { padding: 1rem; border: 2px solid var(--navy); background: var(--teal-light); overflow-wrap: anywhere; }
.profile-grid table { font-variant-numeric: tabular-nums; }

/* Profile controls use the compact portal scale; the topbar stays independent. */
body.has-app-shell.profile-page {
    --sch-section-heading-size: .93rem;
    --sch-section-heading-line: 1.3rem;
    --sch-subheading-size: .93rem;
    --sch-subheading-line: 1.3rem;
    --font-page-heading-size: 1.18rem;
}
.profile-page .site-content { font-size: .76rem; line-height: 1.3; }
.profile-page .site-content .page-header { min-height: 0; margin: 0 0 .45rem; padding: 0; }
.profile-page .site-content .page-header h1 { margin: 0; }
:root body.has-app-shell.profile-page .site-content .teacher-panel { margin: 0 0 .6rem; padding: .5rem 0 0; }
.profile-page .site-content :is(h2, h3, p) { margin-block: .3rem; }
.profile-page .profile-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1fr); gap: 1rem; }
.profile-page .profile-grid:not(:has([aria-labelledby="call-name-heading"])) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.profile-page .profile-grid > * { min-width: 0; }
.profile-page .form-stack, .profile-page .field { gap: .25rem; }
.profile-page .form-stack { gap: .45rem; }
.profile-page .site-content :is(label, input, select, .button, small) { font-size: inherit; line-height: 1.3; }
.profile-page .site-content :is(input:not([type=checkbox]), select, .button) { min-height: 28px; padding: .25rem .45rem; border-radius: 3px; }
.profile-page .site-content :is(input, select) { min-width: 0; width: 100%; }
.profile-page .site-content input[type=checkbox] { width: auto; }
.profile-page .site-content small { font-size: .68rem; color: var(--muted); }
.profile-page .site-content .button { width: auto; justify-self: start; white-space: normal; }
.profile-page .avatar-editor { grid-template-columns: 48px minmax(0, 1fr) minmax(0, 1fr); gap: .4rem; align-items: end; }
.profile-page .avatar-editor > .profile-avatar { width: 48px; height: 48px; }
.profile-page .avatar-editor > :nth-child(n+4) { grid-column: 1 / -1; }
.profile-page .avatar-reset { gap: .3rem; align-items: center; }
.profile-page .profile-inline-form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: end; margin: .4rem 0; }
.profile-page .profile-inline-form .field { flex: 0 1 22rem; min-width: min(100%, 12rem); }
.profile-page .team-settings { max-width: 30rem; }
.profile-page .profile-team-settings { margin: .6rem 0; }
.profile-page .profile-team-settings > summary { color: var(--navy); cursor: pointer; padding: .3rem 0; }
.profile-page .team-request { gap: .4rem; margin: .3rem 0; }
.profile-page .team-directory-name { display: flex; align-items: center; gap: .4rem; }
.profile-page .team-directory-name .profile-avatar { flex: none; }
.profile-page .site-content .data-table :is(th, td) { padding: .25rem .45rem; }
.profile-page .site-content .data-table { font-size: .76rem; }
.profile-page .site-content .table-scroll { margin-block: .4rem; }
.profile-page .site-content .form-actions { gap: .35rem; }
.profile-page .site-content .notice { padding: .45rem .6rem; margin-block: .4rem; }
@media (max-width: 1000px) {
    .profile-page .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
    .profile-page .profile-grid, .profile-page .profile-grid:not(:has([aria-labelledby="call-name-heading"])) { grid-template-columns: minmax(0, 1fr); gap: .35rem; }
    .profile-page .profile-inline-form .field { flex: 1 1 100%; }
}

/* Framed sections preserve the compact controls and distinguish each action. */
:root body.has-app-shell.profile-page .site-content .profile-block {
    border: 1px solid #c5d5e8; border-radius: 5px; background: #fff;
    padding: .65rem .75rem; margin: 0; min-width: 0;
}
.profile-page .profile-grid { align-items: stretch; gap: .7rem; margin-bottom: .8rem; }
:root body.has-app-shell.profile-page .site-content .profile-block > :is(h2, h3):first-child {
    margin: -.65rem -.75rem .65rem; padding: .4rem .75rem;
    border-bottom: 1px solid #c5d5e8; border-radius: 4px 4px 0 0; background: #e6f3ff;
}
.profile-page .profile-team-choices { display: grid; grid-template-columns: minmax(16rem, 1fr) minmax(0, 2.4fr); gap: .7rem; align-items: start; }
.profile-page .profile-team-create .profile-inline-form { display: grid; }
.profile-page .profile-team-create .profile-inline-form .field { min-width: 0; }
.profile-page .page-header-aside { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
@media (max-width: 1000px) { .profile-page .profile-team-choices { grid-template-columns: minmax(0, 1fr); } }

.site-header .student-help-link { min-height: 30px; height: 30px; padding: .3rem .6rem; font-size: .76rem; line-height: 1.2; }

/* Equal section headings and a centered return control match the portal scale. */
.profile-page .site-content .page-header { align-items: center; padding-block: .3rem; }
.profile-page .site-content .profile-back { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; line-height: 1; }
.profile-page .profile-back-arrow { font-family: Arial, sans-serif; }
.profile-page #team .data-table > thead > tr > th { background: #e6f3ff; }
.profile-page .profile-team-directory { max-height: 18rem; overflow: auto; scrollbar-gutter: stable; }
.profile-page .profile-team-directory thead th { position: sticky; top: 0; z-index: 1; }
.profile-page .profile-team-directory:focus-visible { outline: 2px solid var(--navy); outline-offset: -2px; }
.profile-page .profile-team-pagination:empty { display: none; }
.profile-page .profile-team-pagination nav { margin-top: .25rem; }

/* The directory uses the remaining desktop height; long lists scroll inside it. */
@media screen and (min-width: 1100px) and (min-height: 650px) {
    :root body.has-app-shell.profile-page .site-content { display: flex; flex-direction: column; }
    .profile-page .site-content > :is(.page-header, .profile-grid, .notice) { flex: none; }
    :root body.has-app-shell.profile-page .site-content #team { display: flex; flex-direction: column; flex: 1 1 0; min-height: 12rem; margin-bottom: 0; }
    .profile-page #team > h2 { flex: none; }
    .profile-page .profile-team-content { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; overflow: auto; scrollbar-width: thin; }
    .profile-page .profile-team-content > :not(.profile-team-choices) { flex: none; }
    .profile-page .profile-team-choices { flex: 1 1 0; min-height: 12rem; align-items: stretch; }
    .profile-page .profile-team-join { display: flex; flex-direction: column; min-height: 0; }
    .profile-page .profile-team-join > :not(.profile-team-directory) { flex: none; }
    .profile-page .profile-team-join .profile-team-directory { flex: 1 1 0; min-height: 0; max-height: none; }
}
