:root {
    --profile-bg: #050505;
    --profile-surface: rgba(11, 11, 12, .94);
    --profile-surface-raised: #101011;
    --profile-border: rgba(255, 255, 255, .1);
    --profile-border-strong: rgba(255, 255, 255, .18);
    --profile-text: #dedede;
    --profile-muted: rgba(224, 224, 224, .52);
    --profile-faint: rgba(224, 224, 224, .34);
    --profile-gold: #c9b27e;
    --profile-green: #75bf82;
    --profile-red: #d77777;
}

body.profile-page {
    min-height: 100vh;
    padding-top: 5.25rem;
    background: var(--profile-bg);
    color: var(--profile-text);
}

.profile-page *,
.profile-page *::before,
.profile-page *::after {
    box-sizing: border-box;
}

.profile-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.profile-background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .14;
    filter: grayscale(1) contrast(1.2);
    transform: scale(1.02);
}

.profile-background div {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 78% 4%, rgba(202, 178, 126, .08), transparent 31%),
        linear-gradient(180deg, rgba(5, 5, 5, .68), #050505 68%);
}

.profile-shell {
    position: relative;
    z-index: 1;
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 4.25rem 0 5.5rem;
    font-family: "Plus Jakarta Sans", "PT Sans", sans-serif;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1.4rem;
    margin-bottom: 2rem;
}

.profile-header-avatar {
    flex: 0 0 auto;
    width: 92px;
    height: 92px;
    padding: 3px;
    border: 1px solid var(--profile-border-strong);
    border-radius: 24px;
    background: rgba(255, 255, 255, .025);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .38);
    transform: rotate(-2deg);
}

.profile-header-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 20px;
    object-fit: cover;
}

.profile-eyebrow,
.profile-section-kicker {
    margin: 0 0 .45rem;
    color: var(--profile-faint);
    font: 800 .68rem/1.2 "Plus Jakarta Sans", sans-serif;
    letter-spacing: .19em;
    text-transform: uppercase;
}

.profile-header h1 {
    max-width: 850px;
    margin: 0;
    color: #efefef;
    font-family: "Moon Dance", cursive;
    font-size: clamp(3rem, 7vw, 5.2rem);
    font-weight: 400;
    line-height: .88;
    overflow-wrap: anywhere;
}

.profile-header > div > p:last-child {
    margin: 1rem 0 0;
    color: var(--profile-muted);
    font-size: .92rem;
}

.profile-message {
    margin: 0 0 1.15rem;
    padding: .9rem 1rem;
    border: 1px solid var(--profile-border);
    border-radius: 11px;
    background: rgba(13, 13, 14, .94);
    color: #d0d0d0;
    font-size: .84rem;
    line-height: 1.55;
}

.profile-message.success {
    border-color: rgba(94, 180, 110, .32);
    color: #b8dcbf;
}

.profile-message.warning {
    border-color: rgba(202, 166, 94, .3);
    color: #dec99d;
}

.profile-message.error {
    border-color: rgba(207, 83, 83, .36);
    color: #e5adad;
}

.profile-readiness {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.15rem 1.25rem;
    border: 1px solid var(--profile-border);
    border-radius: 14px;
    background: rgba(9, 9, 10, .86);
    box-shadow: 0 20px 65px rgba(0, 0, 0, .26);
}

.profile-readiness.ready { border-color: rgba(105, 183, 116, .28); }
.profile-readiness.pending { border-color: rgba(210, 168, 83, .24); }

.profile-readiness-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--profile-border-strong);
    border-radius: 12px;
    color: #e2e2e2;
    background: rgba(255, 255, 255, .025);
}

.profile-readiness-label {
    margin: 0 0 .2rem;
    color: var(--profile-faint);
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.profile-readiness h2 {
    margin: 0;
    color: #e8e8e8;
    font-size: .98rem;
}

.profile-readiness p:last-child {
    margin: .24rem 0 0;
    color: var(--profile-muted);
    font-size: .78rem;
}

.profile-primary-link,
.identity-connect,
.profile-save-button,
.profile-upload-button,
.profile-secondary-button,
.profile-remove-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .48rem;
    min-height: 40px;
    border-radius: 8px;
    font: 700 .75rem "Plus Jakarta Sans", sans-serif;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
}

.profile-primary-link,
.identity-connect,
.profile-save-button {
    border: 1px solid rgba(255, 255, 255, .62);
    background: #e6e6e5;
    color: #080808;
    padding: .68rem 1rem;
}

.profile-primary-link:hover,
.identity-connect:hover,
.profile-save-button:hover {
    transform: translateY(-1px);
    background: #f3f3f2;
}

.profile-tabs {
    display: flex;
    gap: .35rem;
    padding: .35rem;
    overflow-x: auto;
    border: 1px solid var(--profile-border);
    border-radius: 12px;
    background: rgba(8, 8, 9, .88);
    scrollbar-width: none;
}

.profile-tabs::-webkit-scrollbar { display: none; }

.profile-tab {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-width: 150px;
    min-height: 44px;
    padding: .7rem 1rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--profile-muted);
    font: 700 .8rem "Plus Jakarta Sans", sans-serif;
    cursor: pointer;
}

.profile-tab:hover {
    color: #d7d7d7;
    background: rgba(255, 255, 255, .025);
}

.profile-tab.active {
    border-color: var(--profile-border);
    background: #141415;
    color: #eeeeed;
    box-shadow: 0 8px 25px rgba(0, 0, 0, .24);
}

.profile-tab:focus-visible,
.profile-upload-button:focus-visible,
.profile-save-button:focus-visible,
.profile-secondary-button:focus-visible,
.profile-remove-button:focus-visible,
.identity-connect:focus-visible {
    outline: 2px solid rgba(205, 183, 133, .72);
    outline-offset: 2px;
}

.profile-tab-count {
    display: grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 .34rem;
    border-radius: 99px;
    background: rgba(255, 255, 255, .09);
    color: #cfcfcf;
    font-size: .62rem;
}

.profile-panel {
    margin-top: 1.15rem;
}

.profile-panel[hidden] {
    display: none !important;
}

.profile-personal-card,
.profile-role-sync-card,
.profile-role-policy,
.profile-empty-state {
    border: 1px solid var(--profile-border);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(16, 16, 17, .96), rgba(7, 7, 8, .96));
}

.profile-personal-card {
    overflow: hidden;
}

.profile-avatar-editor {
    display: grid;
    grid-template-columns: 184px minmax(0, 1fr);
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    border-bottom: 1px solid var(--profile-border);
    background:
        radial-gradient(circle at 12% 0%, rgba(201, 178, 126, .09), transparent 35%),
        #0b0b0c;
}

.profile-avatar-frame {
    position: relative;
    width: 184px;
    height: 184px;
}

.profile-avatar-frame img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 26px;
    object-fit: cover;
    box-shadow: 0 28px 70px rgba(0, 0, 0, .45);
}

.profile-avatar-ring {
    position: absolute;
    inset: -6px;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 31px;
    pointer-events: none;
}

.profile-avatar-copy h2,
.profile-panel-heading h2 {
    margin: 0;
    color: #e8e8e7;
    font-size: clamp(1.25rem, 3vw, 1.7rem);
    letter-spacing: -.035em;
}

.profile-avatar-copy > p:not(.profile-section-kicker):not(.profile-file-name) {
    max-width: 630px;
    margin: .65rem 0 0;
    color: var(--profile-muted);
    font-size: .8rem;
    line-height: 1.6;
}

.profile-avatar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    margin-top: 1.1rem;
}

.profile-upload-button,
.profile-secondary-button {
    padding: .6rem .85rem;
    border: 1px solid rgba(255, 255, 255, .2);
    background: rgba(255, 255, 255, .055);
    color: #dedede;
}

.profile-upload-button:hover,
.profile-secondary-button:hover {
    border-color: rgba(255, 255, 255, .34);
    background: rgba(255, 255, 255, .09);
    transform: translateY(-1px);
}

.profile-upload-button.disabled {
    opacity: .42;
    cursor: not-allowed;
    pointer-events: none;
}

.profile-remove-button {
    padding: .6rem .75rem;
    border: 1px solid transparent;
    background: transparent;
    color: rgba(225, 171, 171, .72);
}

.profile-remove-button:hover {
    border-color: rgba(202, 96, 96, .23);
    background: rgba(153, 56, 56, .08);
    color: #dfaaaa;
}

.profile-file-input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.profile-file-name {
    min-height: 1.2em;
    margin: .7rem 0 0;
    color: var(--profile-faint);
    font-size: .68rem;
    overflow-wrap: anywhere;
}

.profile-file-name.error { color: #d89898; }

.profile-avatar-server-warning {
    display: flex;
    align-items: flex-start;
    gap: .45rem;
    max-width: 680px;
    margin: .65rem 0 0;
    color: #dca4a4;
    font-size: .68rem;
    line-height: 1.5;
}

.profile-avatar-server-warning i { margin-top: .1rem; }

.profile-privacy-note {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: .9rem;
    margin: 1.5rem 2rem 0;
    padding: 1rem;
    border: 1px solid rgba(201, 178, 126, .2);
    border-radius: 11px;
    background: rgba(201, 178, 126, .045);
    color: #d7c69e;
}

.profile-privacy-note > i {
    margin-top: .15rem;
    font-size: 1rem;
}

.profile-privacy-note strong {
    color: #dfd3b7;
    font-size: .82rem;
}

.profile-privacy-note p {
    margin: .3rem 0 0;
    color: rgba(225, 215, 193, .56);
    font-size: .73rem;
    line-height: 1.55;
}

.profile-personal-fields {
    display: grid;
    gap: 1.25rem;
    padding: 1.75rem 2rem;
}

.profile-field-block,
.profile-field,
.profile-inline-form {
    display: flex;
    flex-direction: column;
    gap: .45rem;
}

.profile-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.profile-label-row label,
.profile-field label,
.profile-inline-form label {
    color: #bdbdbd;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.profile-label-row span {
    color: var(--profile-faint);
    font-size: .64rem;
    font-variant-numeric: tabular-nums;
}

.profile-field-block input,
.profile-field-block textarea,
.profile-field input,
.profile-inline-form input {
    width: 100%;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 9px;
    background: #080809;
    color: #dddddc;
    font: .86rem/1.6 "Plus Jakarta Sans", sans-serif;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.profile-field-block input,
.profile-field input,
.profile-inline-form input {
    min-height: 46px;
    padding: .72rem .85rem;
}

.profile-field-block textarea {
    min-height: 120px;
    padding: .8rem .9rem;
    resize: vertical;
}

.profile-field-block input:focus,
.profile-field-block textarea:focus,
.profile-field input:focus,
.profile-inline-form input:focus {
    border-color: rgba(201, 178, 126, .52);
    background: #0a0a0b;
    box-shadow: 0 0 0 3px rgba(201, 178, 126, .065);
}

.profile-field-block input::placeholder,
.profile-field-block textarea::placeholder,
.profile-field input::placeholder,
.profile-inline-form input::placeholder {
    color: rgba(255, 255, 255, .25);
}

.profile-field-block > p {
    margin: 0;
    color: var(--profile-faint);
    font-size: .67rem;
    line-height: 1.5;
}

.profile-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 2rem;
    border-top: 1px solid var(--profile-border);
    background: rgba(255, 255, 255, .012);
}

.profile-form-footer p {
    margin: 0;
    color: var(--profile-faint);
    font-size: .68rem;
}

.profile-form-footer p i { margin-right: .32rem; }

.profile-save-message {
    min-height: 1.2em;
    margin-top: .35rem !important;
}

.profile-save-message:empty { display: none; }
.profile-save-message.error { color: #d99b9b; }
.profile-save-message.success { color: #a9d3b0; }

.profile-save-button:disabled {
    opacity: .58;
    cursor: wait;
    transform: none;
}

.profile-save-button.loading i { animation: profile-spin .9s linear infinite; }

#profile-avatar-remove-form { display: none; }

.profile-panel-heading {
    display: grid;
    grid-template-columns: minmax(0, .8fr) minmax(280px, 1fr);
    align-items: end;
    gap: 2rem;
    padding: 1.3rem .15rem 1.15rem;
}

.profile-panel-heading > p {
    margin: 0;
    color: var(--profile-muted);
    font-size: .76rem;
    line-height: 1.6;
}

.identity-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem;
    border: 1px solid var(--profile-border);
    border-radius: 13px;
    background: linear-gradient(135deg, rgba(17, 17, 18, .95), rgba(8, 8, 9, .95));
}

.identity-card + .identity-card { margin-top: .72rem; }
.identity-card.connected { border-color: rgba(255, 255, 255, .16); }

.identity-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 11px;
    background: rgba(255, 255, 255, .03);
    color: #dcdcdc;
    font-size: 1.2rem;
}

.identity-card.discord .identity-icon { color: #9ca8ed; }
.identity-card.steam .identity-icon { color: #a9ccdf; }
.identity-icon svg { width: 24px; height: 24px; }

.identity-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
}

.identity-title-row h3 {
    margin: 0;
    color: #e5e5e5;
    font-size: .94rem;
}

.identity-required,
.identity-optional {
    padding: .2rem .44rem;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 99px;
    color: var(--profile-faint);
    font-size: .55rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.identity-required {
    color: #cfba8d;
    border-color: rgba(207, 186, 141, .22);
}

.identity-name {
    margin: .4rem 0 0;
    color: #d9d9d9;
    font-size: .85rem;
    font-weight: 600;
}

.identity-meta {
    margin: .17rem 0 0;
    color: var(--profile-faint);
    font-size: .68rem;
    overflow-wrap: anywhere;
}

.identity-description {
    margin: .4rem 0 0;
    color: var(--profile-muted);
    font-size: .76rem;
    line-height: 1.5;
}

.identity-status,
.identity-unavailable {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: #a9d4b1;
    font-size: .72rem;
    font-weight: 700;
}

.identity-unavailable { color: var(--profile-faint); }

.identity-action form {
    display: grid;
    justify-items: end;
    gap: .35rem;
}

.identity-link-progress {
    min-height: 1em;
    color: var(--profile-faint);
    font-size: .58rem;
}

.identity-connect.loading {
    opacity: .68;
    cursor: wait;
    transform: none;
}

.identity-connect.loading i { animation: profile-spin .9s linear infinite; }

.identity-email-form {
    grid-column: 2 / -1;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, .07);
}

.profile-email-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .8rem;
}

.profile-field-wide { grid-column: 1 / -1; }
.profile-email-submit { justify-self: start; }

.profile-input-action {
    display: flex;
    gap: .6rem;
}

.profile-input-action input {
    max-width: 240px;
    letter-spacing: .24em;
}

.profile-input-action button {
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 8px;
    background: #e2e2e2;
    color: #080808;
    padding: 0 1rem;
    font-weight: 700;
    cursor: pointer;
}

.profile-resend-form { margin-top: .65rem; }

.profile-resend-form button {
    border: 0;
    background: none;
    color: var(--profile-muted);
    font: .73rem "Plus Jakarta Sans", sans-serif;
    text-decoration: underline;
    cursor: pointer;
}

.profile-footnote {
    margin: 1.35rem 0 0;
    color: var(--profile-faint);
    font-size: .69rem;
    line-height: 1.55;
    text-align: center;
}

.profile-footnote i { margin-right: .34rem; }

.profile-role-policy {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .9rem;
    margin-bottom: .8rem;
    padding: 1rem 1.1rem;
    background: rgba(12, 12, 13, .92);
}

.profile-role-policy > i {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 10px;
    color: #c7b586;
}

.profile-role-policy strong {
    color: #d8d8d8;
    font-size: .8rem;
}

.profile-role-policy p {
    margin: .24rem 0 0;
    color: var(--profile-muted);
    font-size: .7rem;
    line-height: 1.5;
}

.profile-local-admin {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .65rem;
    border: 1px solid rgba(201, 178, 126, .25);
    border-radius: 99px;
    color: #d6c28f;
    font-size: .64rem;
    font-weight: 800;
    white-space: nowrap;
}

.profile-role-sync-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem 2rem;
    padding: 1.2rem;
}

.profile-role-sync-card.success { border-color: rgba(105, 183, 116, .22); }
.profile-role-sync-card.warning { border-color: rgba(210, 168, 83, .25); }
.profile-role-sync-card.error { border-color: rgba(207, 83, 83, .24); }

.profile-role-sync-state {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: .85rem;
}

.profile-sync-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #7c7c82;
    box-shadow: 0 0 0 6px rgba(124, 124, 130, .08);
}

.profile-role-sync-card.success .profile-sync-dot {
    background: var(--profile-green);
    box-shadow: 0 0 0 6px rgba(117, 191, 130, .08);
}

.profile-role-sync-card.warning .profile-sync-dot {
    background: #c8a35e;
    box-shadow: 0 0 0 6px rgba(200, 163, 94, .08);
}

.profile-role-sync-card.error .profile-sync-dot {
    background: var(--profile-red);
    box-shadow: 0 0 0 6px rgba(215, 119, 119, .08);
}

.profile-role-sync-state h3 {
    margin: 0;
    color: #e0e0e0;
    font-size: .94rem;
}

.profile-role-sync-state p:last-child {
    margin: .27rem 0 0;
    color: var(--profile-muted);
    font-size: .7rem;
    line-height: 1.45;
}

.profile-role-sync-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-role-sync-actions > p {
    margin: 0;
    color: var(--profile-faint);
    font-size: .6rem;
    line-height: 1.55;
    text-align: right;
}

.profile-role-sync-actions strong {
    color: #bcbcbc;
    font-weight: 600;
}

.profile-secondary-button:disabled {
    opacity: .5;
    cursor: wait;
    transform: none;
}

.profile-secondary-button.loading i { animation: profile-spin .9s linear infinite; }

@keyframes profile-spin { to { transform: rotate(360deg); } }

.profile-role-sync-message {
    grid-column: 1 / -1;
    min-height: 0;
    margin: -.2rem 0 0;
    color: var(--profile-muted);
    font-size: .68rem;
}

.profile-role-sync-message:empty { display: none; }
.profile-role-sync-message.error { color: #d99b9b; }

.profile-role-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .72rem;
    margin-top: .8rem;
}

.profile-role-card {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .75rem;
    min-height: 74px;
    padding: .85rem .9rem;
    overflow: hidden;
    border: 1px solid var(--profile-border);
    border-radius: 12px;
    background: rgba(12, 12, 13, .92);
}

.profile-role-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 0 50%, color-mix(in srgb, var(--role-color) 11%, transparent), transparent 45%);
    pointer-events: none;
}

@supports not (background: color-mix(in srgb, red 10%, transparent)) {
    .profile-role-card::before { background: none; }
}

.profile-role-color {
    position: relative;
    width: 10px;
    height: 34px;
    border-radius: 99px;
    background: var(--role-color);
    box-shadow: 0 0 20px color-mix(in srgb, var(--role-color) 32%, transparent);
}

.profile-role-copy,
.profile-role-badges { position: relative; }

.profile-role-copy h3 {
    margin: 0;
    color: #dedede;
    font-size: .8rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.profile-role-copy p {
    margin: .2rem 0 0;
    color: var(--profile-faint);
    font-size: .58rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.profile-role-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .3rem;
}

.profile-role-badge {
    padding: .23rem .4rem;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 99px;
    color: var(--profile-faint);
    font-size: .5rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.profile-role-badge.staff {
    border-color: rgba(201, 178, 126, .25);
    color: #d3bd8b;
}

.profile-role-badge.site-admin {
    border-color: rgba(211, 174, 94, .34);
    background: rgba(211, 174, 94, .06);
    color: #e0c584;
}

.profile-role-badge.whitelist {
    border-color: rgba(105, 183, 116, .24);
    color: #a9d3b0;
}

.profile-role-badge.visitor { color: #b9b9b8; }
.profile-role-badge.interview { border-color: rgba(210, 168, 83, .3); color: #ddc486; }
.profile-role-badge.resident { border-color: rgba(105, 183, 116, .28); color: #a9d3b0; }
.profile-role-badge.newcomer { border-color: rgba(112, 159, 210, .25); color: #a8c8e2; }
.profile-role-badge.veteran { border-color: rgba(201, 178, 126, .34); background: rgba(201, 178, 126, .06); color: #dfc88e; }
.profile-role-badge.trial { border-color: rgba(181, 132, 211, .27); color: #ccb0de; }

.profile-role-badge.managed {
    border-color: rgba(137, 151, 213, .2);
    color: #aab2d8;
}

.profile-empty-state {
    padding: 2.5rem 1.5rem;
    text-align: center;
}

.profile-empty-state.compact {
    margin-top: .8rem;
    padding: 1.5rem;
}

.profile-empty-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    border: 1px solid var(--profile-border);
    border-radius: 14px;
    color: #bababa;
    background: rgba(255, 255, 255, .025);
    font-size: 1.15rem;
}

.profile-empty-state h3 {
    margin: 0;
    color: #dedede;
    font-size: 1rem;
}

.profile-empty-state p {
    max-width: 580px;
    margin: .55rem auto 1rem;
    color: var(--profile-muted);
    font-size: .75rem;
    line-height: 1.55;
}

.profile-empty-state.compact p { margin-bottom: 0; }
.profile-empty-state.compact .profile-secondary-button { margin-top: 1rem; }

.profile-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.profile-invite-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .65rem;
    margin-bottom: .8rem;
}

.profile-invite-stats article {
    padding: 1.15rem;
    border: 1px solid var(--profile-border);
    border-radius: 13px;
    background: linear-gradient(145deg, rgba(16, 16, 17, .96), rgba(7, 7, 8, .96));
}

.profile-invite-stats span {
    color: var(--profile-faint);
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.profile-invite-stats strong {
    display: block;
    margin-top: .4rem;
    color: #e3e3e1;
    font-size: 1.45rem;
}

.profile-invite-stats small {
    display: block;
    margin-top: .28rem;
    color: var(--profile-muted);
    font-size: .6rem;
}

.profile-invite-search {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: .75rem;
    margin-bottom: .75rem;
    padding: .55rem;
    border: 1px solid var(--profile-border-strong);
    border-radius: 12px;
    background: rgba(8, 8, 9, .94);
}

.profile-invite-search > i { margin-left: .55rem; color: var(--profile-faint); }
.profile-invite-search input {
    min-width: 0;
    min-height: 44px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #e1e1df;
    font: .78rem "Plus Jakarta Sans", sans-serif;
}
.profile-invite-search input::placeholder { color: rgba(255, 255, 255, .26); }
.profile-invite-search a { color: var(--profile-muted); font-size: .65rem; }
.profile-invite-search button,
.profile-invite-results button {
    min-height: 40px;
    padding: .62rem .85rem;
    border: 1px solid rgba(255, 255, 255, .48);
    border-radius: 8px;
    background: #e3e3e1;
    color: #080808;
    font: 750 .68rem "Plus Jakarta Sans", sans-serif;
    cursor: pointer;
}

.profile-invite-results { display: grid; gap: .55rem; }
.profile-invite-results > article {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    padding: .75rem;
    border: 1px solid var(--profile-border);
    border-radius: 12px;
    background: linear-gradient(120deg, rgba(16, 16, 17, .96), rgba(8, 8, 9, .96));
}
.profile-invite-results img { width: 62px; height: 62px; border: 1px solid var(--profile-border-strong); border-radius: 15px; object-fit: cover; }
.profile-invite-results span { color: var(--profile-faint); font-size: .54rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.profile-invite-results h3 { margin: .2rem 0 0; color: #dfdfdd; font-size: .88rem; }
.profile-invite-results p { margin: .27rem 0 0; color: var(--profile-muted); font-size: .64rem; }
.profile-invite-results small { display: inline-flex; align-items: center; gap: .3rem; margin-top: .25rem; color: rgba(255, 255, 255, .3); font-size: .58rem; }
.profile-invite-results small.connected { color: #9ec5ae; }

.profile-invite-history {
    margin-top: 1rem;
    padding: 1.2rem;
    border: 1px solid var(--profile-border);
    border-radius: 14px;
    background: rgba(10, 10, 11, .92);
}
.profile-invite-history h3 { margin: 0; color: #dfdfdd; font-size: 1rem; }
.profile-invite-history ol { display: grid; gap: .55rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.profile-invite-history li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .65rem; }
.profile-invite-history li > span { width: 8px; height: 8px; border-radius: 50%; background: #77777a; }
.profile-invite-history li.completed > span { background: var(--profile-green); }
.profile-invite-history li.failed > span { background: var(--profile-red); }
.profile-invite-history strong { display: block; color: #cececc; font-size: .68rem; }
.profile-invite-history small { display: block; margin-top: .17rem; color: var(--profile-faint); font-size: .55rem; }
.profile-invite-history em { color: var(--profile-muted); font-size: .58rem; font-style: normal; }

/* Recuperação de conta continua a reutilizar os elementos de perfil. */
.recovery-card {
    width: min(470px, 100%);
    padding: 2rem;
    border: 1px solid var(--profile-border);
    border-radius: 14px;
    background: rgba(8, 8, 8, .9);
    box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
}

.recovery-card .profile-eyebrow { text-align: center; }
.recovery-resend { text-align: center; }
.recovery-page .verify-code-field input { text-align: center; letter-spacing: .35em; }

@media (max-width: 820px) {
    .profile-avatar-editor {
        grid-template-columns: 150px minmax(0, 1fr);
        gap: 1.5rem;
    }

    .profile-avatar-frame { width: 150px; height: 150px; }
    .profile-role-grid { grid-template-columns: 1fr; }
    .profile-role-sync-card { grid-template-columns: 1fr; }
    .profile-role-sync-actions { justify-content: space-between; }
    .profile-role-sync-actions > p { text-align: left; }
}

@media (max-width: 720px) {
    .profile-shell { padding-top: 3rem; }
    .profile-readiness { grid-template-columns: auto minmax(0, 1fr); }
    .profile-primary-link { grid-column: 1 / -1; text-align: center; }
    .profile-panel-heading { grid-template-columns: 1fr; gap: .6rem; }
    .identity-card { grid-template-columns: auto minmax(0, 1fr); }
    .identity-action { grid-column: 2; }
    .identity-email-form { grid-column: 1 / -1; }
    .profile-email-grid { grid-template-columns: 1fr; }
    .profile-field-wide { grid-column: auto; }
    .profile-role-policy { grid-template-columns: auto minmax(0, 1fr); }
    .profile-local-admin { grid-column: 2; justify-self: start; }
    .profile-invite-stats { grid-template-columns: 1fr; }
    .profile-invite-results > article { grid-template-columns: auto minmax(0, 1fr); }
    .profile-invite-results form { grid-column: 2; }
}

@media (max-width: 580px) {
    body.profile-page { padding-top: 4.6rem; }
    .profile-header { align-items: flex-end; gap: 1rem; }
    .profile-header-avatar { width: 70px; height: 70px; border-radius: 19px; }
    .profile-header-avatar img { border-radius: 16px; }
    .profile-header h1 { font-size: clamp(2.7rem, 15vw, 4rem); }
    .profile-header > div > p:last-child { font-size: .76rem; }
    .profile-tabs { margin-inline: -.1rem; }
    .profile-tab { min-width: 132px; padding-inline: .75rem; }
    .profile-avatar-editor {
        grid-template-columns: 1fr;
        justify-items: center;
        padding: 1.5rem 1.1rem;
        text-align: center;
    }
    .profile-avatar-actions { justify-content: center; }
    .profile-privacy-note { margin: 1rem 1rem 0; }
    .profile-personal-fields { padding: 1.35rem 1rem; }
    .profile-form-footer {
        align-items: stretch;
        flex-direction: column;
        padding: 1rem;
    }
    .profile-save-button { width: 100%; }
}

@media (max-width: 460px) {
    .profile-shell { width: min(100% - 1.1rem, 1120px); }
    .profile-header { align-items: center; }
    .profile-header-avatar { width: 60px; height: 60px; padding: 2px; }
    .profile-header > div > p:last-child { display: none; }
    .profile-readiness { padding: 1rem; }
    .identity-card { padding: 1rem; gap: .75rem; }
    .identity-icon { width: 42px; height: 42px; }
    .profile-input-action { flex-direction: column; }
    .profile-input-action input { max-width: none; }
    .profile-input-action button { min-height: 42px; }
    .profile-role-sync-actions { align-items: stretch; flex-direction: column; }
    .profile-role-sync-actions > p { text-align: left; }
    .profile-role-sync-actions .profile-secondary-button { width: 100%; }
    .profile-role-card { grid-template-columns: auto minmax(0, 1fr); }
    .profile-role-badges { grid-column: 2; justify-content: flex-start; }
    .profile-role-policy { padding: .9rem; }
    .profile-invite-search { grid-template-columns: auto minmax(0, 1fr) auto; }
    .profile-invite-search a { display: none; }
    .profile-invite-results > article { gap: .7rem; }
    .profile-invite-results form,
    .profile-invite-results button { width: 100%; }
    .recovery-card { padding: 1.5rem 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .profile-page *,
    .profile-page *::before,
    .profile-page *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
