.profile-page {
    position: relative;
    padding: 24px 0 56px;
}

.profile-hero {
    position: relative;
    overflow: hidden;
    border-radius: 32px;
    border: 1px solid var(--tone-08);
    background: radial-gradient(circle at top left, rgba(var(--brand-rgb), .22), transparent 26%),
    linear-gradient(180deg, var(--tone-04), var(--tone-02)),
    var(--surface-card);
    box-shadow: 0 24px 70px var(--shade-30);
    padding: 30px;
    margin-bottom: 22px;
    isolation: isolate;
}

.profile-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, var(--tone-08), transparent 35%, rgba(var(--brand-rgb), .10));
    opacity: .9;
}

.profile-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(var(--brand-accent-rgb), .18);
    background: rgba(var(--brand-rgb), .16);
    color: var(--brand-text-soft);
    font-size: .76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .14em;
    margin-bottom: 14px;
}

.profile-hero__wrap {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 18px;
    flex-wrap: wrap;
}

.profile-title {
    margin: 0 0 10px;
    font-size: clamp(2.1rem, 5vw, 4rem);
    line-height: .95;
    font-weight: 850;
    letter-spacing: -.04em;
    color: var(--tone-100);
}

.profile-subtitle {
    margin: 0;
    max-width: 42rem;
    color: var(--palette-146);
    font-size: 1rem;
    line-height: 1.75;
}

.profile-hero__meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.profile-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 13px;
    border-radius: 999px;
    border: 1px solid var(--tone-08);
    background: var(--tone-04);
    color: var(--text-primary);
    font-size: .93rem;
}

.profile-sidebar,
.profile-main {
    border-radius: 30px;
    border: 1px solid var(--tone-08);
    background: linear-gradient(180deg, var(--tone-04), var(--tone-02)),
    var(--surface-card);
    box-shadow: 0 24px 70px var(--shade-30);
    overflow: hidden;
}

.profile-sidebar__body,
.profile-main__body {
    padding: 24px;
}

.profile-user {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 18px;
}

.profile-user__avatar {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 62px;
    background: var(--shade-100);
    border: 1px solid var(--tone-08);
    box-shadow: 0 10px 26px var(--shade-20);
}

.profile-user__fallback {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex: 0 0 62px;
    color: var(--tone-100);
    background: rgba(var(--brand-rgb), .25);
    border: 1px solid rgba(var(--brand-rgb), .45);
}

.profile-user__label {
    color: var(--palette-138);
    font-size: .8rem;
    margin-bottom: 2px;
}

.profile-user__name {
    color: var(--tone-100);
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.2;
}

.profile-user__meta {
    color: var(--palette-140);
    font-size: .88rem;
    line-height: 1.45;
}

.profile-progress-mini {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.profile-progress-mini__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--palette-163);
    background: var(--tone-04);
    font-size: .84rem;
    color: var(--palette-053);
}

.profile-progress-mini__item i {
    color: var(--brand-text-soft);
}

.profile-nav {
    display: grid;
    gap: 8px;
}

.profile-nav__item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--tone-06);
    background: var(--tone-02);
    color: var(--text-primary);
    text-decoration: none;
    transition: .2s ease;
}

.profile-nav__item:hover {
    background: var(--tone-06);
    color: var(--tone-100);
    transform: translateY(-1px);
}

.profile-nav__item.is-active {
    background: linear-gradient(135deg, rgba(var(--brand-rgb), .30), rgba(var(--brand-rgb), .16));
    border-color: rgba(var(--brand-accent-rgb), .24);
    color: var(--tone-100);
}

.profile-divider {
    margin: 22px 0;
    border-color: var(--tone-08) !important;
}

.profile-main__body h4,
.profile-main__body h5 {
    color: var(--tone-100);
    font-weight: 800;
}

.profile-section-lead {
    color: var(--palette-143);
    margin-bottom: 18px;
}

.profile-info-card,
.profile-stat-card,
.profile-highlight,
.profile-mobile-role {
    border-radius: 20px;
    border: 1px solid var(--tone-08);
    background: var(--tone-03);
}

.profile-info-card,
.profile-stat-card {
    padding: 16px;
    height: 100%;
}

.profile-info-card__label,
.profile-stat-card__label {
    color: var(--palette-138);
    font-size: .82rem;
    margin-bottom: 6px;
}

.profile-info-card__value,
.profile-stat-card__value {
    color: var(--tone-100);
    font-size: 1.02rem;
    font-weight: 750;
    line-height: 1.35;
}

.profile-stat-card__value--big {
    font-size: 1.5rem;
    font-weight: 850;
    line-height: 1.05;
}

.profile-stat-card__value--warn {
    color: var(--palette-056);
}

.profile-highlight {
    padding: 16px 18px;
    background: linear-gradient(135deg, var(--tone-05), var(--tone-02)),
    var(--brand-highlight-bg);
}

.profile-highlight__title {
    color: var(--palette-141);
    font-size: .82rem;
    margin-bottom: 5px;
}

.profile-highlight__text {
    color: var(--tone-100);
    font-weight: 700;
}

.profile-table-wrap {
    padding: 0 1rem;
    border-radius: 20px;
    border: 1px solid var(--tone-08);
    background: var(--tone-02);
}

.profile-table {
    margin-bottom: 0;
    min-width: 760px;
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--tone-08);
    --bs-table-hover-bg: var(--tone-03);
}

.profile-table thead th {
    color: var(--palette-139);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom-width: 1px;
    white-space: nowrap;
}

.profile-mobile-role {
    padding: 16px;
    margin-bottom: 12px;
}

.profile-mobile-role:last-child {
    margin-bottom: 0;
}

.profile-mobile-role__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--tone-07);
}

.profile-mobile-role__title {
    color: var(--tone-100);
    font-weight: 800;
}

.profile-mobile-role__grid {
    display: grid;
    gap: 10px;
}

.profile-mobile-role__row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.profile-mobile-role__label {
    color: var(--palette-138);
    font-size: .84rem;
}

.profile-mobile-role__value {
    color: var(--tone-100);
    font-weight: 700;
    text-align: right;
}

.profile-empty {
    color: var(--palette-139);
    padding: 10px 0;
}

.profile-modal .modal-content {
    border-radius: 28px;
    border: 1px solid var(--tone-08);
    background: linear-gradient(180deg, var(--tone-05), var(--tone-02)),
    var(--palette-102);
    color: var(--tone-100);
    box-shadow: 0 24px 70px var(--shade-34);
}

.profile-modal .modal-header,
.profile-modal .modal-footer {
    border-color: var(--tone-08) !important;
}

.profile-modal .btn-close {
    filter: invert(1);
}

.profile-modal .form-control,
.profile-modal input,
.profile-modal select {
    min-height: 44px;
    border-radius: 16px;
    border: 1px solid var(--tone-10);
    background: var(--palette-198);
    color: var(--tone-100);
}

.profile-modal .form-control:focus,
.profile-modal input:focus,
.profile-modal select:focus {
    border-color: rgba(var(--brand-accent-rgb), .28);
    box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .16);
    background: var(--palette-200);
    color: var(--tone-100);
}

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

.ach-card {
    border: 1px solid var(--tone-08);
    border-radius: 16px;
    background: var(--tone-03);
    padding: 11px;
    text-align: center;
}

.ach-circle {
    width: 98px;
    height: 98px;
    margin: 0 auto 8px;
    position: relative;
}

.ach-circle svg {
    width: 98px;
    height: 98px;
    transform: rotate(-90deg);
    overflow: visible;
}

.ach-ring-bg {
    fill: none;
    stroke: var(--tone-12);
    stroke-width: 8;
}

.ach-ring {
    fill: none;
    stroke: var(--ach-color, var(--palette-013));
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 289.026524;
    stroke-dashoffset: 289.026524;
    transition: stroke-dashoffset 1.2s ease;
    filter: drop-shadow(0 0 10px color-mix(in srgb, var(--ach-color, var(--palette-013)) 70%, transparent));
}

.ach-icon {
    position: absolute;
    inset: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--ach-color, var(--palette-013)) 35%, transparent), var(--palette-112));
    border: 1px solid var(--tone-12);
    color: var(--palette-049);
    font-size: 1.3rem;
}

.ach-title {
    font-weight: 700;
    color: var(--tone-100);
    margin-bottom: 4px;
    font-size: .95rem;
}

.ach-status {
    font-size: .84rem;
    color: var(--palette-133);
    margin-bottom: 4px;
}

.ach-meta {
    font-size: .77rem;
    color: var(--palette-113);
}

.ach-rarity {
    display: inline-flex;
    margin-top: 6px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: .68rem;
    border: 1px solid color-mix(in srgb, var(--ach-color, var(--palette-013)) 40%, transparent);
    color: var(--ach-color, var(--palette-013));
}

.ach-desc {
    margin-top: 6px;
    font-size: .76rem;
    color: var(--palette-132);
}

.profile-inventory__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.profile-inventory__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.profile-inventory-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 13px;
    border-radius: 999px;
    border: 1px solid var(--tone-08);
    background: var(--tone-04);
    color: var(--text-primary);
    font-size: .93rem;
    text-decoration: none;
}

.profile-inventory-chip--link {
    transition: .2s ease;
}

.profile-inventory-chip--link:hover {
    background: var(--tone-08);
    color: var(--tone-100);
    transform: translateY(-1px);
}

.profile-inventory-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.profile-inventory-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--tone-08);
    background: var(--tone-04);
    color: var(--text-primary);
    font: inherit;
    font-size: .88rem;
    cursor: pointer;
    transition: .2s ease;
}

.profile-inventory-tab span {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--tone-08);
    color: var(--brand-text-soft);
    font-size: .75rem;
    font-weight: 800;
}

.profile-inventory-tab:hover,
.profile-inventory-tab.is-active {
    background: linear-gradient(135deg, rgba(var(--brand-rgb), .30), rgba(var(--brand-rgb), .16));
    border-color: rgba(var(--brand-accent-rgb), .24);
    color: var(--tone-100);
    transform: translateY(-1px);
}

.profile-inventory-section {
    display: none;
}

.profile-inventory-section.is-active {
    display: block;
}

.profile-inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
}

.profile-inventory-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-radius: 22px;
    border: 1px solid var(--tone-08);
    background:
        linear-gradient(180deg, var(--tone-04), var(--tone-02)),
        var(--palette-087);
    box-shadow: 0 14px 34px var(--palette-076);
    overflow: hidden;
    transition: .22s ease;
}

.profile-inventory-card:hover,
.profile-inventory-card:focus-within {
    transform: translateY(-3px);
    border-color: rgba(var(--brand-accent-rgb), .24);
    box-shadow: 0 20px 52px var(--shade-30);
}

.profile-inventory-card__media {
    width: calc(100% - 22px);
    aspect-ratio: 1 / 1;
    margin: 11px 11px 0;
    border-radius: 18px;
    border: 1px solid var(--tone-08);
    background:
        radial-gradient(circle at 50% 18%, rgba(var(--brand-rgb), .18), var(--tone-00) 42%),
        var(--tone-03);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.profile-inventory-card__image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: .35s ease;
}

.profile-inventory-card:hover .profile-inventory-card__image {
    transform: scale(1.035);
}

.profile-inventory-card__icon {
    width: 74px;
    height: 74px;
    display: grid;
    place-items: center;
    border-radius: 24px;
    border: 1px solid rgba(var(--brand-accent-rgb), .18);
    background: rgba(var(--brand-rgb), .18);
    color: var(--brand-text-soft);
    font-size: 1.9rem;
}

.profile-inventory-card__body {
    padding: 13px 13px 10px;
    flex: 1 1 auto;
}

.profile-inventory-card__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 9px;
}

.profile-inventory-card__category {
    min-width: 0;
    color: var(--palette-138);
    font-size: .74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-inventory-card__title {
    margin: 0;
    color: var(--tone-100);
    font-size: 1.02rem;
    font-weight: 850;
    line-height: 1.2;
    letter-spacing: -.02em;
}

.profile-inventory-card__desc {
    display: -webkit-box;
    margin: 8px 0 0;
    color: var(--palette-143);
    font-size: .88rem;
    line-height: 1.5;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.profile-inventory-status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 9px;
    border-radius: 999px;
    border: 1px solid var(--tone-08);
    background: var(--tone-04);
    color: var(--text-primary);
    font-size: .76rem;
    font-weight: 750;
    white-space: nowrap;
}

.profile-inventory-status--purchased,
.profile-inventory-status--active {
    background: rgba(var(--brand-rgb), .16);
    border-color: rgba(var(--brand-accent-rgb), .18);
    color: var(--brand-text-soft);
}

.profile-inventory-status--consumed,
.profile-inventory-status--expired,
.profile-inventory-status--cancelled {
    background: var(--tone-04);
    color: var(--palette-138);
}

.profile-inventory-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
    color: var(--palette-138);
    font-size: .82rem;
}

.profile-inventory-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.profile-inventory-usage {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--tone-07);
}

.profile-inventory-usage div {
    display: grid;
    gap: 2px;
}

.profile-inventory-usage span {
    color: var(--palette-138);
    font-size: .76rem;
}

.profile-inventory-usage strong {
    color: var(--tone-100);
    font-size: .88rem;
    font-weight: 750;
    line-height: 1.3;
}

.profile-inventory-usage small {
    color: var(--palette-139);
    font-size: .78rem;
}

.profile-inventory-card__footer {
    display: grid;
    gap: 8px;
    padding: 0 13px 13px;
}

.profile-inventory-use-form {
    display: grid;
    gap: 8px;
    margin: 0;
}

.profile-inventory-use-form__grid {
    display: grid;
    gap: 8px;
}

.profile-inventory-input {
    width: 100%;
    min-height: 40px;
    border-radius: 14px;
    border: 1px solid var(--tone-10);
    background: var(--palette-198);
    color: var(--tone-100);
    padding: 8px 11px;
    font: inherit;
    font-size: .88rem;
}

.profile-inventory-input:focus {
    outline: none;
    border-color: rgba(var(--brand-accent-rgb), .28);
    box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .16);
    background: var(--palette-200);
}

.profile-inventory-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 42px;
    padding: 9px 13px;
    border-radius: 15px;
    border: 1px solid var(--tone-08);
    background: var(--tone-04);
    color: var(--text-primary);
    font: inherit;
    font-size: .9rem;
    font-weight: 750;
    text-decoration: none;
    line-height: 1;
    cursor: pointer;
    transition: .2s ease;
}

.profile-inventory-btn:hover,
.profile-inventory-btn:focus {
    background: var(--tone-08);
    color: var(--tone-100);
    transform: translateY(-1px);
}

.profile-inventory-btn--primary {
    background: var(--brand-gradient);
    border-color: rgba(var(--brand-accent-rgb), .24);
    color: var(--palette-057);
    box-shadow: 0 12px 28px rgba(var(--brand-rgb), .16);
}

.profile-inventory-btn--primary:hover,
.profile-inventory-btn--primary:focus {
    color: var(--tone-100);
    box-shadow: 0 16px 36px rgba(var(--brand-rgb), .22);
}

.profile-inventory-btn--soft {
    background: var(--tone-04);
}

.profile-inventory-note {
    padding: 10px 11px;
    border-radius: 14px;
    border: 1px solid var(--tone-08);
    background: var(--tone-03);
    color: var(--palette-138);
    font-size: .82rem;
    line-height: 1.45;
}

.profile-inventory-empty {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 28px 16px;
    border-radius: 20px;
    border: 1px solid var(--tone-08);
    background: var(--tone-03);
    color: var(--palette-139);
    text-align: center;
}

.profile-inventory-empty i {
    color: var(--brand-text-soft);
    font-size: 1.5rem;
}

.profile-inventory-empty h5 {
    margin: 0;
    color: var(--tone-100);
    font-size: 1.1rem;
    font-weight: 850;
}

.profile-inventory-empty p {
    margin: 0;
    max-width: 32rem;
    color: var(--palette-143);
    line-height: 1.55;
}

.profile-inventory-empty--large {
    padding: 46px 20px;
}
@media (prefers-reduced-motion: reduce) {
    .profile-inventory-chip--link,
    .profile-inventory-tab,
    .profile-inventory-card,
    .profile-inventory-card__image,
    .profile-inventory-btn {
        transition: none;
    }

    .profile-inventory-chip--link:hover,
    .profile-inventory-tab:hover,
    .profile-inventory-tab.is-active,
    .profile-inventory-card:hover,
    .profile-inventory-card:focus-within,
    .profile-inventory-btn:hover,
    .profile-inventory-btn:focus {
        transform: none;
    }
}

@media (max-width: 992px) {
    .profile-hero__wrap {
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .profile-page {
        padding-top: 18px;
    }

    .profile-hero,
    .profile-sidebar,
    .profile-main {
        border-radius: 24px;
    }

    .profile-hero,
    .profile-sidebar__body,
    .profile-main__body {
        padding: 20px;
    }

    .profile-mobile-role__row {
        align-items: flex-start;
    }
}

@media (max-width: 576px) {
    .profile-inventory__head {
        align-items: stretch;
        flex-direction: column;
    }

    .profile-inventory__actions,
    .profile-inventory-tabs {
        display: grid;
        grid-template-columns: 1fr;
    }

    .profile-inventory-chip,
    .profile-inventory-tab {
        width: 100%;
        justify-content: center;
    }

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

    .profile-title {
        font-size: 2rem;
    }

    .profile-user {
        align-items: flex-start;
    }

    .profile-chip {
        font-size: .86rem;
    }
}