.profile-page {
    padding: 56px 0 90px;
}

.profile-container {
    width: min(1240px, calc(100% - 48px));
    margin: 0 auto;
}

.profile-page-header {
    margin-bottom: 28px;
}

.profile-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 28px;
    align-items: start;
}

.profile-sidebar {
    position: sticky;
    top: 108px;
    overflow: hidden;
}

.profile-sidebar-body {
    padding: 30px;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 28px;
    object-fit: cover;
    display: block;
    border: 3px solid rgba(124, 121, 184, 0.14);
    box-shadow: 0 14px 28px rgba(34, 42, 70, 0.12);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.profile-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), #a5a1dc);
    color: white;
    font-size: 2.4rem;
    font-weight: 800;
}

.profile-avatar-edit-wrap {
    display: grid;
    gap: 12px;
    margin: 0 0 22px;
    justify-items: start;
}

.profile-avatar-edit-trigger {
    position: relative;
    display: inline-block;
    cursor: pointer;
    text-decoration: none;
}

.profile-avatar-edit-trigger:hover .profile-avatar {
    transform: translateY(-1px);
    box-shadow: 0 18px 30px rgba(34, 42, 70, 0.16);
    filter: brightness(0.97);
}

.profile-avatar-edit-badge {
    position: absolute;
    right: 8px;
    bottom: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(32, 36, 60, 0.86);
    color: #fff;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 8px 18px rgba(34, 42, 70, 0.18);
}

.profile-avatar-edit-help {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
    max-width: 220px;
}

.profile-name {
    margin: 0 0 10px;
    font-size: 2.1rem;
    line-height: 1.05;
}

.profile-email {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 1.02rem;
}

.profile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

.profile-bio-box {
    margin-top: 24px;
    padding: 18px;
    border-radius: 20px;
    background: linear-gradient(180deg, #fafbff 0%, #f4f6fd 100%);
    border: 1px solid var(--border);
}

.profile-bio-box h3 {
    margin: 0 0 10px;
    font-size: 1rem;
}

.profile-bio-box p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.profile-main {
    display: grid;
    gap: 24px;
}

.profile-form-card,
.profile-history-card {
    border-radius: 28px;
    overflow: hidden;
}

.profile-form-card .card-body,
.profile-history-card .card-body {
    padding: 30px;
}

.profile-section-heading {
    margin-bottom: 24px;
}

.profile-section-heading h2 {
    margin: 0 0 8px;
    font-size: 1.8rem;
}

.profile-section-heading p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.profile-section-heading-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.profile-header-actions {
    margin-top: 0;
    flex-shrink: 0;
}

.profile-form {
    display: grid;
    gap: 22px;
}

.profile-hidden-photo-input {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.profile-hidden-photo-input input[type="file"] {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.profile-edit-tip {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 18px;
    background: linear-gradient(180deg, #fafbff 0%, #f5f7fd 100%);
    border: 1px solid var(--border);
}

.profile-edit-tip-icon {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: rgba(124, 121, 184, 0.12);
    color: var(--primary);
    font-weight: 800;
}

.profile-edit-tip strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text);
    font-size: 0.98rem;
}

.profile-edit-tip span {
    display: block;
    color: var(--muted);
    line-height: 1.6;
    font-size: 0.95rem;
}

.profile-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.auth-field-full {
    grid-column: 1 / -1;
}

.profile-history-list {
    display: grid;
    gap: 16px;
}

.profile-history-item {
    padding: 20px;
    border-radius: 22px;
    background: linear-gradient(180deg, #fafbff 0%, #f4f6fd 100%);
    border: 1px solid var(--border);
}

.profile-history-top {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.profile-history-top h3 {
    margin: 0 0 6px;
    font-size: 1.2rem;
}

.profile-history-date {
    margin: 0;
    color: var(--muted);
}

.profile-history-top-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.profile-history-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.profile-history-meta-item {
    padding: 14px 16px;
    border-radius: 16px;
    background: white;
    border: 1px solid var(--border);
}

.profile-history-meta-item span {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.profile-history-meta-item strong {
    font-size: 0.98rem;
}

.profile-history-notes {
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.7;
}

.profile-empty-state {
    padding: 22px;
    border-radius: 20px;
    background: linear-gradient(180deg, #fafbff 0%, #f4f6fd 100%);
    border: 1px dashed var(--border);
    color: var(--muted);
}

.profile-history-clickable {
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.profile-history-clickable:hover {
    transform: translateY(-2px);
    border-color: rgba(124, 121, 184, 0.24);
    box-shadow: 0 16px 30px rgba(34, 42, 70, 0.09);
}

.profile-history-open-hint {
    margin: 14px 0 0;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 0.95rem;
}

.profile-history-preview-people {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.profile-mini-person {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
}

.profile-mini-person img,
.profile-mini-person-placeholder {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.profile-mini-person-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), #a5a1dc);
    color: white;
    font-size: 0.85rem;
    font-weight: 800;
}

.profile-mini-person span {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
}

/* A modifier has to beat the component it modifies whatever the load order is.
   As a bare class this tied with modal.css's `.modal-dialog` at the same
   specificity and lost, because profile.css was linked above modal.css in
   base.html — so the history modal has been 980px wide, not the 960px the markup
   asks for, on all three pages that use it. */
.modal-dialog.profile-history-modal-dialog {
    width: min(960px, 100%);
}

.profile-people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.profile-person-card {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 18px;
    border-radius: 20px;
    background: linear-gradient(180deg, #f8f9fe 0%, #f3f5fc 100%);
    border: 1px solid var(--border);
}

.profile-person-avatar {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 10px 20px rgba(34, 42, 70, 0.08);
}

.profile-person-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), #a5a1dc);
    color: white;
    font-size: 1.2rem;
    font-weight: 800;
}

.profile-person-card h4 {
    margin: 0 0 6px;
    font-size: 1.05rem;
}

.profile-person-card p {
    margin: 0 0 10px;
    color: var(--muted);
    line-height: 1.5;
    word-break: break-word;
}

.profile-person-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.profile-details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.profile-detail-card {
    padding: 18px;
    border-radius: 20px;
    background: linear-gradient(180deg, #fafbff 0%, #f4f6fd 100%);
    border: 1px solid var(--border);
}

.profile-detail-card-full {
    grid-column: 1 / -1;
}

.profile-detail-label {
    display: block;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.profile-detail-value {
    display: block;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text);
    word-break: break-word;
}

.profile-detail-bio {
    color: var(--text);
    line-height: 1.7;
}

@media (max-width: 1100px) {
    .profile-layout {
        grid-template-columns: 1fr;
    }

    .profile-sidebar {
        position: static;
    }
}

@media (max-width: 700px) {
    .profile-page {
        padding: 34px 0 70px;
    }

    .profile-container {
        width: min(1240px, calc(100% - 28px));
    }

    .profile-form-grid,
    .profile-details-grid {
        grid-template-columns: 1fr;
    }

    .profile-form-card .card-body,
    .profile-history-card .card-body,
    .profile-sidebar-body {
        padding: 22px 20px;
    }

    .profile-history-top,
    .profile-section-heading-with-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-name {
        font-size: 1.8rem;
    }

    .profile-mini-person {
        width: 100%;
        justify-content: flex-start;
    }

    .profile-people-grid {
        grid-template-columns: 1fr;
    }

    .profile-avatar-edit-help {
        max-width: none;
    }
}
.profile-identity-block {
    margin-top: 18px;
}

.profile-name {
    margin-top: 0;
    margin-bottom: 6px;
    line-height: 1.15;
}

.profile-email {
    margin-top: 0;
    margin-bottom: 14px;
    word-break: break-word;
}
.profile-form-section {
    margin-top: 6px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.profile-form-section-header {
    margin-bottom: 18px;
    max-width: 760px;
}

.profile-form-section-header h3 {
    margin: 0 0 8px;
    font-size: 1.2rem;
    line-height: 1.2;
}

.profile-form-section-header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.profile-role-request-box {
    display: grid;
    gap: 18px;
}

.profile-role-status-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.profile-role-request-form {
    max-width: 420px;
}

.profile-role-section .profile-detail-card {
    min-height: unset;
}

.profile-role-section .auth-field {
    margin: 0;
}

.profile-role-section select,
.profile-role-section .auth-field select {
    width: 100%;
}

@media (max-width: 700px) {
    .profile-role-status-grid {
        grid-template-columns: 1fr;
    }

    .profile-role-request-form {
        max-width: none;
    }
}

/* ============================================================
   Modern profile page (.pf-*) — replaces the older `profile-*`
   classes with a step-based edit flow + cleaner sidebar.
   ============================================================ */
.pf-page { padding: 32px 0 120px; }

.pf-container { max-width: 1080px; }

.pf-hero { margin-bottom: 22px; }

.pf-hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary-dark);
    background: rgba(124, 121, 184, 0.12);
    border: 1px solid rgba(124, 121, 184, 0.22);
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 14px;
}

.pf-hero h1 {
    margin: 0 0 6px;
    font-size: clamp(1.8rem, 3.5vw, 2.4rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.pf-hero p {
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.55;
    max-width: 620px;
}

.pf-layout {
    display: grid;
    grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

@media (max-width: 880px) {
    .pf-layout { grid-template-columns: 1fr; }
}

.pf-sidebar {
    border-radius: 24px;
    overflow: hidden;
    position: sticky;
    top: 24px;
}

.pf-sidebar-body {
    padding: 24px;
    display: grid;
    gap: 16px;
}

.pf-avatar-wrap {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto;
    border-radius: 50%;
    padding: 5px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 14px 32px rgba(124, 121, 184, 0.32);
}

.pf-avatar-wrap.is-editable {
    cursor: pointer;
    display: block;
    transition: transform 0.18s ease;
}

.pf-avatar-wrap.is-editable:hover { transform: translateY(-2px); }

.pf-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: #fff;
    display: block;
}

.pf-avatar-placeholder {
    display: grid;
    place-items: center;
    font-size: 3.2rem;
    font-weight: 900;
    color: var(--primary-dark);
    background: #fff;
}

.pf-avatar-edit-badge {
    position: absolute;
    /* Compact camera button tucked into the bottom-right corner so it never
       covers the photo subject. The white ring lifts it off the image. */
    bottom: 4px;
    right: 4px;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    border: 3px solid #fff;
    box-shadow: 0 6px 14px rgba(124, 121, 184, 0.4);
    transition: transform 0.18s ease, background 0.18s ease;
}

.pf-avatar-wrap.is-editable:hover .pf-avatar-edit-badge {
    transform: scale(1.08);
    background: var(--primary-dark);
}

.pf-avatar-help {
    margin: 14px 0 0;
    text-align: center;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.4;
}

.pf-identity {
    text-align: center;
    display: grid;
    gap: 2px;
}

.pf-name {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.01em;
    word-break: break-word;
}

.pf-email {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
    word-break: break-word;
}

.pf-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.pf-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(124, 121, 184, 0.10);
    color: var(--primary-dark);
    border: 1px solid rgba(124, 121, 184, 0.20);
}

.pf-tag-role { background: rgba(124, 121, 184, 0.14); }
.pf-tag-role-volunteer { background: rgba(95, 168, 147, 0.16); color: #2d6a55; border-color: rgba(95, 168, 147, 0.32); }
.pf-tag-role-teacher { background: rgba(216, 154, 71, 0.18); color: #8a5418; border-color: rgba(216, 154, 71, 0.36); }
.pf-tag-role-admin { background: rgba(196, 88, 126, 0.16); color: #8a3853; border-color: rgba(196, 88, 126, 0.32); }

.pf-bio-card {
    padding: 12px 14px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(124, 121, 184, 0.06), rgba(124, 121, 184, 0.02));
    border: 1px solid rgba(124, 121, 184, 0.16);
    display: grid;
    gap: 4px;
}

.pf-section-eyebrow {
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.pf-bio-card p {
    margin: 0;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.5;
}

.pf-dashboard-cta {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 14px;
    gap: 10px;
    align-items: center;
    padding: 11px 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    text-decoration: none;
    box-shadow: 0 10px 22px rgba(124, 121, 184, 0.32);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pf-dashboard-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 26px rgba(124, 121, 184, 0.40);
    color: #fff;
    text-decoration: none;
}

.pf-dashboard-cta-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.20);
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    flex: 0 0 auto;
}

.pf-dashboard-cta-text { display: grid; gap: 1px; min-width: 0; line-height: 1.2; }
.pf-dashboard-cta-text strong {
    font-weight: 800;
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pf-dashboard-cta-text span {
    font-size: 0.76rem;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pf-dashboard-cta-arrow { font-size: 1.2rem; font-weight: 700; opacity: 0.85; }

.pf-edit-btn {
    display: block;
    text-align: center;
    padding: 12px 20px;
    border-radius: 999px;
    background: #fff;
    border: 1.5px solid var(--primary);
    color: var(--primary-dark);
    font-weight: 800;
    text-decoration: none;
    transition: background 0.15s ease, transform 0.15s ease;
}

.pf-edit-btn:hover {
    background: rgba(124, 121, 184, 0.08);
    color: var(--primary-dark);
    text-decoration: none;
    transform: translateY(-1px);
}

.pf-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.pf-details-card { border-radius: 24px; padding: 24px 26px; }

.pf-details-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}

.pf-details-head h2 {
    margin: 4px 0 0;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.pf-privacy-note {
    margin: 6px 0 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7390;
}

.pf-edit-btn-inline {
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(124, 121, 184, 0.10);
    color: var(--primary-dark);
    font-weight: 800;
    font-size: 0.86rem;
    text-decoration: none;
    border: 1px solid rgba(124, 121, 184, 0.22);
    white-space: nowrap;
    transition: background 0.15s ease;
}

.pf-edit-btn-inline:hover {
    background: rgba(124, 121, 184, 0.18);
    color: var(--primary-dark);
    text-decoration: none;
}

.pf-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.pf-detail {
    padding: 14px 16px;
    border-radius: 14px;
    background: linear-gradient(180deg, #fff 0%, #fafbff 100%);
    border: 1px solid var(--border);
    display: grid;
    gap: 4px;
    min-width: 0;
}

/* The bio cell can stretch tall to match the profile-photo card. Pack its
   label + text to the top instead of letting the grid spread them apart (which
   floated the bio into the vertical middle of the box). */
.pf-detail-full { grid-column: 1 / -1; align-content: start; }

.pf-detail-label {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
}

.pf-detail-value {
    font-size: 0.96rem;
    font-weight: 700;
    color: var(--text);
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.pf-detail-empty { color: var(--muted); font-weight: 600; font-style: italic; }

.pf-detail-bio {
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.55;
    white-space: pre-wrap;
    text-align: left;
}

.pf-form { border-radius: 24px; overflow: hidden; padding: 0; }

.pf-hidden-input { display: none; }

.pf-alert {
    margin: 18px 22px 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: #fdecec;
    border: 1px solid #f5c2c7;
    color: #a52834;
    font-weight: 600;
}

.pf-step {
    padding: 24px 26px;
    border-top: 1px solid rgba(124, 121, 184, 0.10);
}

.pf-step:first-of-type { border-top: none; }

.pf-step-head {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    margin-bottom: 16px;
}

.pf-step-num {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-weight: 800;
    font-size: 0.98rem;
    box-shadow: 0 6px 14px rgba(124, 121, 184, 0.32);
    margin-top: 2px;
}

.pf-step-head h2 {
    margin: 0 0 4px;
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.pf-step-head p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.pf-step-optional {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(124, 121, 184, 0.10);
}

.pf-step-body {
    display: grid;
    gap: 14px;
    padding-left: 52px;
}

.pf-field-row { display: grid; gap: 14px; }
.pf-field-row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.pf-field-hint {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 600;
}

.pf-step-body input[type="text"],
.pf-step-body input[type="email"],
.pf-step-body input[type="date"],
.pf-step-body input[type="tel"],
.pf-step-body input[type="number"],
.pf-step-body select,
.pf-step-body textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1.5px solid var(--border);
    background: #fff;
    font: inherit;
    font-size: 0.96rem;
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pf-step-body input:focus,
.pf-step-body select:focus,
.pf-step-body textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(124, 121, 184, 0.14);
}

.pf-step-body textarea {
    resize: vertical;
    min-height: 110px;
    line-height: 1.55;
}

.pf-step-body .auth-field label {
    display: block;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text);
    margin-bottom: 6px;
}

.pf-step-body .auth-help {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.pf-step-body .auth-error {
    margin-top: 4px;
    color: #a52834;
    font-size: 0.84rem;
    font-weight: 600;
}

.pf-role-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 8px;
}

.pf-role-status-item {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(124, 121, 184, 0.06);
    border: 1px solid rgba(124, 121, 184, 0.18);
    display: grid;
    gap: 2px;
}

.pf-role-status-label {
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
}

.pf-role-status-item strong {
    font-size: 0.96rem;
    color: var(--text);
}

.pf-role-pending-note {
    margin: 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(216, 154, 71, 0.14);
    border: 1px solid rgba(216, 154, 71, 0.32);
    color: #8a5418;
    font-size: 0.9rem;
    font-weight: 600;
}

.pf-form-footer {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0%, #fff 70%);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.pf-cancel-btn {
    color: var(--muted);
    text-decoration: none;
    font-weight: 700;
    padding: 10px 14px;
    border-radius: 12px;
    transition: background 0.15s ease, color 0.15s ease;
}

.pf-cancel-btn:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text);
    text-decoration: none;
}

.pf-save-btn {
    appearance: none;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-weight: 800;
    padding: 14px 28px;
    border-radius: 999px;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(124, 121, 184, 0.32);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pf-save-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 28px rgba(124, 121, 184, 0.40);
}

@media (max-width: 720px) {
    .pf-step { padding: 18px; }
    .pf-step-body { padding-left: 0; }
    .pf-step-head { grid-template-columns: 32px minmax(0, 1fr); gap: 10px; }
    .pf-field-row-2 { grid-template-columns: 1fr; }
    .pf-details-head { flex-direction: column; align-items: stretch; }
    .pf-form-footer { padding: 14px 18px; }
    .pf-save-btn { padding: 12px 22px; font-size: 0.95rem; }
}
/* ===== Danger zone — account deletion ===================================
   Rendered as the LAST `.pf-step` inside the edit-profile card so most of
   its layout comes for free from `.pf-step`. We only override the colours
   (red accent), the step-number circle, and the body. */

.pf-step-danger {
    border-top: 1px solid rgba(165, 40, 52, 0.16) !important;
    background: linear-gradient(180deg, rgba(165, 40, 52, 0.04), transparent);
}

.pf-step-num-danger {
    background: linear-gradient(135deg, #c63b48, #a52834) !important;
    box-shadow: 0 6px 14px rgba(165, 40, 52, 0.32) !important;
    font-size: 1.1rem;
}

.pf-step-danger-tag {
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #a52834;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(165, 40, 52, 0.10);
}

.pf-step-body-danger {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pf-danger-explainer {
    margin: 0;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(165, 40, 52, 0.06);
    border: 1px solid rgba(165, 40, 52, 0.14);
    color: var(--text);
    font-size: 0.93rem;
    line-height: 1.55;
}

.pf-danger-confirm {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.93rem;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}

.pf-danger-confirm input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #a52834;
    cursor: pointer;
}

.pf-danger-btn {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 999px;
    border: 1px solid rgba(165, 40, 52, 0.40);
    background: rgba(165, 40, 52, 0.08);
    color: #a52834;
    font-family: "Inter", sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    transition: 0.18s ease;
}

.pf-danger-btn:hover,
.pf-danger-btn:focus-visible {
    background: #a52834;
    color: #ffffff;
    border-color: #a52834;
    box-shadow: 0 8px 18px rgba(165, 40, 52, 0.25);
    outline: none;
}

@media (max-width: 640px) {
    .pf-danger-btn { width: 100%; justify-content: center; align-self: stretch; }
}

/* Phone field: country (flag + dial code) selector next to the number. */
.pf-phone-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
    width: 100%;
}
.auth-field .pf-phone-group select {
    width: 118px;
    flex: 0 0 118px;
    min-width: 0;
    padding-right: 10px;
}
.auth-field .pf-phone-group input {
    flex: 1 1 auto;
    min-width: 0;
}

/* === Languages spoken ==================================================
   Same card shell as .pf-details-card. The list is chips (a language + its
   level read as one unit), and adding is a two-select row rather than a modal:
   it is one of the shortest forms on the site. */
.pf-lang-card {
    border-radius: 24px;
    padding: 24px 26px;
    margin-bottom: 18px;
}

.pf-lang-list {
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
    display: grid;
    /* No gap: the hairline between rows is a divider, and a gap would leave it
       floating in space instead of separating two rows. */
    gap: 0;
}

/* Four aligned columns: language, level ladder, grade, remove. Hairlines between
   rows rather than a card each — five languages should read as one list, not five
   floating objects. */
.pf-lang-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 58px 30px;
    align-items: center;
    gap: 14px;
    padding: 11px 4px 11px 12px;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.pf-lang-item + .pf-lang-item { border-top-color: var(--border); }
.pf-lang-item:hover { background: var(--surface-soft); border-color: var(--border); }
.pf-lang-item:hover + .pf-lang-item { border-top-color: transparent; }

.pf-lang-name {
    font-weight: 700;
    color: var(--text);
    font-size: 0.97rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The level meter: magnitude, so one hue stepped by lightness — not six hues.
   Unfilled steps stay a recessive neutral so the filled run reads as the value. */
.pf-lang-meter {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.pf-lang-step {
    width: 14px;
    height: 8px;
    border-radius: 3px;
    background: #e4e7f1;
}

/* One indigo hue stepped light -> dark by position, so the filled run itself
   reads as magnitude. A sibling-combinator two-tone looked arbitrary; this is the
   actual ramp. The lightest filled step still clears the unfilled neutral, and the
   grade text beside the meter means colour is never the only cue. */
.pf-lang-step.is-filled:nth-child(1) { background: #bdbbe0; }
.pf-lang-step.is-filled:nth-child(2) { background: #b0ade0; }
.pf-lang-step.is-filled:nth-child(3) { background: #a29fd6; }
.pf-lang-step.is-filled:nth-child(4) { background: #9491cb; }
.pf-lang-step.is-filled:nth-child(5) { background: #817ebf; }
.pf-lang-step.is-filled:nth-child(6) { background: #6b68b0; }

/* Native fills the whole ladder in the solid brand indigo. */
.pf-lang-item.is-native .pf-lang-step.is-filled { background: var(--primary); }

/* Grade in ink, not in the meter's colour: the mark beside it carries the level. */
.pf-lang-grade {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    justify-content: flex-end;
    font-size: 0.8rem;
    font-weight: 750;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pf-lang-item.is-native .pf-lang-grade { color: var(--primary-dark); }
.pf-lang-star { color: var(--primary); font-size: 0.9rem; line-height: 1; }

.pf-lang-remove { margin: 0; display: inline-flex; justify-self: end; }

.pf-lang-remove button {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #c2c6d6;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.pf-lang-item:hover .pf-lang-remove button { color: var(--muted); }
.pf-lang-remove button:hover { background: #fff1f1; color: #b23a48; }
.pf-lang-remove button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; color: var(--muted); }

/* The scale is named once here instead of on every row. */
.pf-lang-scale {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin: 0 0 4px;
    padding: 0 4px 0 12px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.pf-lang-scale-steps { display: inline-flex; gap: 3px; }

.pf-lang-scale-steps b {
    width: 22px;
    text-align: center;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--muted);
    background: var(--surface-soft);
    border-radius: 3px;
    padding: 2px 0;
}

.pf-lang-scale-native { color: var(--primary-dark); letter-spacing: 0.04em; }

@media (max-width: 520px) {
    /* The grade alone carries the level once there is no room for the ladder. */
    .pf-lang-item { grid-template-columns: minmax(0, 1fr) 58px 30px; }
    .pf-lang-meter { display: none; }
    .pf-lang-scale-steps { display: none; }
}

.pf-lang-empty { color: var(--muted); margin: 0 0 18px; }

.pf-lang-add {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-top: 14px;
    padding: 16px;
    border-radius: 16px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
}

.pf-lang-field { display: grid; gap: 6px; flex: 1 1 190px; min-width: 0; }

.pf-lang-field label {
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.pf-lang-field select {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    font: inherit;
    color: var(--text);
}

.pf-lang-field select:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

@media (max-width: 560px) {
    .pf-lang-add > .button { width: 100%; justify-content: center; }
}
