.profile-editor, .profile-editor fieldset, .profile-editor label {
    display: grid;
    min-width: 0;
}
.profile-editor {
    gap: 20px;
    color: var(--text-primary);
}
.profile-editor fieldset {
    margin: 0;
    padding: 0;
    border: 0;
    gap: 14px;
}
.profile-editor legend {
    width: 100%;
    padding: 0 0 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: .95rem;
    font-weight: 650;
}
.profile-editor label {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: .875rem;
}
.profile-editor-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.profile-editor input, .profile-editor select {
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    height: 46px;
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface-card);
    color: var(--text-primary);
    font: inherit;
    font-size: 16px;
    font-weight: 400;
}
.profile-editor :is(input, select, button):focus-visible, .profile-editor-action:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}
.profile-editor-date {
    display: flex;
    align-items: stretch;
    box-sizing: border-box;
    min-width: 0;
    height: 46px;
    padding-inline: 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface-card);
}
.profile-editor-date input[type="date"] {
    appearance: none;
    -webkit-appearance: none;
    flex: 1 1 0%;
    width: 0;
    min-width: 0;
    height: auto;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    text-align: start;
}
.profile-editor-date input::-webkit-date-and-time-value { text-align: start; margin: 0; }
.profile-editor-date:focus-within { outline: 2px solid var(--brand-primary); outline-offset: 2px; }
.profile-editor-date input:focus-visible { outline: 0; }
.profile-editor-pending, .profile-editor-phone {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--surface-soft);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: .875rem;
}
.profile-editor-pending { justify-content: space-between; flex-wrap: wrap; }
.profile-editor-pending[hidden], .profile-editor-message:empty { display: none; }
.profile-editor-pending strong, .profile-editor-phone strong { display: block; color: var(--text-primary); }
.profile-editor-pending span { min-width: 0; overflow-wrap: anywhere; }
.profile-editor-action, .profile-editor-save {
    min-height: 44px;
    padding: 8px 16px;
    border-radius: 10px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.profile-editor-action {
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    background: var(--surface-card);
}
.profile-editor-save { border: 0; color: white; background: var(--brand-primary-solid); }
.profile-editor-save:disabled { opacity: .7; cursor: wait; }
.profile-editor-message { color: var(--error-color, #ba3945); overflow-wrap: anywhere; }
#profileEditModal .settings-modal-content { max-height: 90dvh; }
#profileEditModal .settings-modal-body { min-height: 0; overflow-y: auto; }
@media (min-width: 361px) and (max-width: 480px) {
    .profile-editor-pair:first-of-type { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
    .profile-editor-pair { grid-template-columns: minmax(0, 1fr); }
}
.password-editor-new {
    display: grid;
    gap: 16px;
    padding-top: 18px;
    border-top: 1px solid var(--border-subtle);
}
.password-editor-field { min-width: 0; }
.password-editor-label { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 6px; }
.password-recovery-link { color: var(--brand-primary); font-size: .875rem; font-weight: 600; text-underline-offset: 3px; }
.password-editor-input { position: relative; }
.password-editor-input input { padding-inline-end: 50px; scroll-margin-block: 78px; }
.password-editor-input button {
    position: absolute;
    inset-block: 1px;
    inset-inline-end: 1px;
    min-width: 44px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}
.password-editor-field small { display: block; margin-top: 5px; color: var(--text-secondary); }
.password-editor-error { display: block; margin: 4px 0 0; font-size: .875rem; color: var(--text-primary); font-weight: 600; }
.password-editor-error:empty { display: none; }
.password-editor input[aria-invalid="true"] { border-color: var(--brand-accent); }
#passwordChangeModal .settings-modal-content { max-height: 90dvh; }
#passwordChangeModal .settings-modal-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 768px) {
    .password-editor .profile-editor-save { scroll-margin-bottom: calc(80px + env(safe-area-inset-bottom)); }
}
