.profile-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.profile-modal {
    background: var(--bg-white);
    border-radius: 12px;
    width: 720px;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px var(--shadow-color);
}
.profile-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border-color);
}
.profile-modal-header h3 {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
    white-space: nowrap;
}
.profile-modal-close {
    background: none;
    border: none;
    font-size: 1.4em;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 0px 8px 5px 8px;
    width:25px;
}
.profile-modal-close:hover { color: var(--text-color); }
.profile-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}
.profile-modal-footer {
    padding: 12px 20px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}
.profile-columns {
    display: flex;
    gap: 24px;
}
.profile-col {
    flex: 1;
    min-width: 0;
}
.profile-col-left {
    flex: 1.1;
}
.profile-col-right {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.profile-save-btn {
    margin-top: 15px;
    width: 100%;
}
@media (max-width: 600px) {
    .profile-columns {
        flex-direction: column;
        gap: 16px;
    }
}
.profile-name-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 0;
}
.profile-name-row .profile-field {
    flex: 1;
    min-width: 0;
}
.profile-photo-section {
    display: flex;
    flex-shrink: 0;
    margin-bottom: 20px;
    align-items: flex-end;
    padding-bottom: 2px;
}
.profile-photo-preview {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.profile-photo-preview.card-skeleton {
    background: linear-gradient(90deg, #e8e8e8 25%, #d4d4d4 50%, #e8e8e8 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
[data-theme="dark"] .profile-photo-preview.card-skeleton {
    background: linear-gradient(90deg, #2a2a2e 25%, #3a3a3e 50%, #2a2a2e 75%);
    background-size: 200% 100%;
}
.profile-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.profile-photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.45em;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.15s;
}
.profile-photo-preview:hover .profile-photo-overlay { opacity: 1; }
.profile-field {
    margin-bottom: 12px;
}
.profile-field label {
    display: block;
    font-size: 0.78em;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.profile-field input[type="text"],
.profile-field input[type="email"],
.profile-field input[type="password"] {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9em;
    font-family: inherit;
    background: var(--bg-white);
    box-sizing: border-box;
}
.profile-field input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(76,111,64,0.12);
}
.profile-field-row {
    display: flex;
    gap: 12px;
}
.profile-field-row .profile-field { flex: 1; }
.profile-orcid-section { margin-top: 4px; }
.profile-orcid-linked {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
}
.profile-orcid-linked a {
    color: var(--primary-color);
    text-decoration: none;
}
.profile-orcid-linked a:hover { text-decoration: underline; }
.profile-btn {
    padding: 7px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    font-family: inherit;
    cursor: pointer;
    font-weight: 500;
}
.profile-btn-primary {
    background: var(--link-color);
    color: white;
}
.profile-btn-primary:hover { opacity: 0.9; }
.profile-btn-secondary {
    background: var(--border-color);
    color: var(--text-color);
}
.profile-btn-secondary:hover { background: var(--border-color); }
.profile-btn-danger {
    background: var(--danger-color);
    color: white;
}
.profile-btn-danger:hover { opacity: 0.9; }
.profile-btn-orcid {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.85em;
    cursor: pointer;
    font-family: inherit;
}
.profile-btn-orcid:hover { background: var(--border-color); }
/* Account tier section */
.profile-tier-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 0.85em;
}
.profile-tier-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.profile-tier-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    color: #fff;
    font-size: 0.82em;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.profile-btn-sm {
    padding: 4px 10px;
    font-size: 0.78em;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    cursor: pointer;
    font-family: inherit;
}
.profile-btn-sm:hover { background: var(--bg-surface); }
.tier-usage-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    color: var(--text-muted);
    margin-top: 6px;
}
.tier-progress {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin: 3px 0 2px;
    overflow: hidden;
}
.tier-progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 2px;
    transition: width 0.3s;
}
.tier-upgrade-msg {
    margin-top: 10px;
    padding: 8px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9em;
    color: var(--text-muted);
    line-height: 1.4;
}
.tier-upgrade-msg a { color: var(--primary-color); }
.profile-merge-warning {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 0.85em;
    margin-top: 4px;
}
.profile-merge-warning ul {
    margin: 6px 0;
    padding-left: 20px;
}
.profile-merge-warning li { margin-bottom: 2px; }
.profile-toast {
    position: relative;
    text-align: center;
    font-size: 0.82em;
    color: var(--primary-color);
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}
.profile-toast.show { opacity: 1; }
.profile-toast.error { color: var(--danger-color); }
.profile-pending-email {
    font-size: 0.78em;
    color: #e67e22;
    margin-top: 4px;
    padding: 4px 8px;
    background: var(--bg-surface);
    border-radius: 4px;
}