.profile-edit-layout {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: clamp(0.75rem, 1.4vw, 1.25rem);
    align-items: start;
}

.profile-edit-main {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
}

.profile-edit-main > h1 {
    margin-top: 0;
}

.profile-edit-preview {
    grid-column: 1;
    grid-row: 1;
    height: 560px;
    min-height: 560px;
    padding: 0.85rem;
}

.profile-edit-photo-wrap {
    position: relative;
    width: 96px;
    height: 128px;
}

.profile-image-edit-trigger {
    position: absolute;
    right: -11px;
    bottom: -11px;
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    padding: 0;
    border: 2px solid var(--card);
    border-radius: 4px;
    color: #fff;
    background: #7b8490;
    cursor: pointer;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 900;
    line-height: 1;
}

.profile-image-edit-trigger:hover,
.profile-image-edit-trigger:focus-visible {
    background: #59616c;
    outline: 3px solid rgba(217, 164, 65, 0.48);
    outline-offset: 2px;
}

.editable-interest-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.editable-interest-chip {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: 0.3rem;
    margin: 0;
    padding: 0.2rem 0.24rem 0.2rem 0.42rem;
    border: 1px solid rgba(17, 100, 102, 0.22);
    border-radius: 999px;
    color: var(--brand);
    background: rgba(17, 100, 102, 0.07);
    font-size: 0.68rem;
    font-weight: 750;
}

.editable-interest-chip span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.editable-interest-chip button {
    display: grid;
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 4px;
    color: #fff;
    background: #7b8490;
    cursor: pointer;
    font: inherit;
    font-size: 0.7rem;
    font-weight: 900;
    line-height: 1;
}

.editable-interest-chip button:hover,
.editable-interest-chip button:focus-visible {
    background: var(--danger);
    outline: 2px solid rgba(217, 45, 32, 0.25);
    outline-offset: 1px;
}

.profile-image-actions-dialog {
    width: min(380px, 100%);
}

.profile-image-actions-dialog form {
    margin: 0;
}

.profile-modal-action {
    width: 100%;
}

.button-danger {
    border-color: #b42318;
    color: #fff;
    background: #b42318;
}

.button-danger:hover,
.button-danger:focus-visible {
    background: #8f1d14;
}

.profile-image-replace-form {
    display: grid;
    gap: 1rem;
}

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

    .profile-edit-preview {
        grid-column: auto;
        grid-row: auto;
        width: 100%;
        height: auto;
        min-height: 300px;
    }

    .profile-edit-main {
        grid-column: auto;
        grid-row: auto;
    }
}

.profile-edit-tabs {
    display: flex;
    gap: 0.4rem;
    margin: 0 0 0.75rem;
    border-bottom: 1px solid var(--line);
}

.profile-edit-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.65rem 1rem;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 4px 4px 0 0;
    color: var(--muted);
    background: transparent;
    font-weight: 850;
    text-decoration: none;
}

.profile-edit-tab:hover,
.profile-edit-tab:focus-visible {
    color: var(--brand);
    background: rgba(17, 100, 102, 0.06);
}

.profile-edit-tab.is-active {
    margin-bottom: -1px;
    border-color: var(--line);
    border-bottom-color: var(--card);
    color: var(--brand);
    background: var(--card);
}

.profile-field-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.profile-field-heading small {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 650;
    text-align: right;
}

.profile-settings-form {
    display: grid;
    gap: 1.25rem;
}

.profile-setting-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    font-weight: 800;
    cursor: pointer;
}

.profile-setting-checkbox input {
    width: 1.1rem;
    height: 1.1rem;
    flex: 0 0 auto;
    margin-top: 0.12rem;
    accent-color: var(--brand);
}

.profile-settings-form .button {
    justify-self: start;
    min-width: min(260px, 100%);
}

@media (max-width: 680px) {
    .profile-edit-tabs {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .profile-edit-tab {
        padding-inline: 0.45rem;
        text-align: center;
    }

    .profile-field-heading {
        display: grid;
        gap: 0.2rem;
    }

    .profile-field-heading small {
        text-align: left;
    }
}

.profile-relationship-field {
    display: grid;
    gap: 0.45rem;
    font-weight: 800;
}

.profile-relationship-field select {
    width: 100%;
}

.profile-inline-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 750;
    cursor: pointer;
}

.profile-inline-checkbox input {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: var(--brand);
}

/* Profile, settings and relationships action buttons match the main menu shape. */
.profile-edit-main .button {
    border-radius: 4px;
}

.profile-setting-group {
    display: grid;
    gap: 0.8rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: rgba(244, 247, 251, 0.72);
}

.profile-setting-group h2,
.profile-setting-group p {
    margin: 0;
}

.profile-setting-group h2 {
    font-size: 1rem;
}

.profile-setting-group p {
    color: var(--muted);
    font-size: 0.78rem;
}
