.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);
}

.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;
}