/* Profile Settings — compact panel with segmented controls */

#page-chat .profile-workspace {
    /* Match left/right capsules: one frosted plate, light inners (no nested glass) */
    --settings-capsule-bg: var(--panel-glass);
    --settings-capsule-blur: blur(36px) saturate(180%);
    --settings-capsule-stroke: var(--capsule-stroke, var(--panel-glass-stroke));
    --settings-capsule-radius: var(--nexa-surface-radius, 22px);
    --settings-inner-fill: color-mix(in srgb, #fff 4.5%, transparent);
    --settings-inner-stroke: color-mix(in srgb, #fff 7%, var(--nexa-aside-fill, #161920));
    --control-glass: var(--settings-inner-fill);
    --control-glass-stroke: var(--settings-inner-stroke);
    --settings-glass-blur: none;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    height: 100%;
    max-height: none;
    min-height: 0;
    padding: 0;
    position: relative;
    width: 100%;
}

#page-chat .profile-workspace .profile-shell {
    display: grid;
    grid-template-columns: 1fr;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    width: 100%;
}

#page-chat .profile-nav {
    background: transparent;
    border-right: 1px solid var(--panel-glass-stroke, var(--capsule-stroke));
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
    overflow: hidden;
    padding: 28px 18px 20px;
}

#page-chat .profile-nav-kicker {
    color: var(--theme-text-muted, #6e6e6e);
    font-family: var(--f-ui);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    margin: 0 8px 16px;
    text-transform: uppercase;
}

#page-chat .profile-nav-btn {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--theme-text-muted, #9a9a9a);
    cursor: pointer;
    display: flex;
    font-family: var(--f-ui);
    gap: 14px;
    padding: 14px 12px;
    text-align: left;
    width: 100%;
}

#page-chat .profile-nav-btn:hover,
#page-chat .profile-nav-btn:focus-visible {
    background: color-mix(in srgb, var(--theme-text, #ffffff) 4%, transparent);
    border-color: transparent;
    color: var(--theme-text, #f4f4f5);
    outline: none;
}

#page-chat .profile-nav-btn.is-active {
    background: color-mix(in srgb, var(--theme-text, #ffffff) 6%, transparent);
    border-color: transparent;
    box-shadow: none;
    color: var(--theme-text, #fff);
    font-weight: 500;
    position: relative;
}

#page-chat .profile-nav-btn.is-active::after {
    background: #7dd3fc;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(125, 211, 252, 0.7);
    content: "";
    height: 6px;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
}

#page-chat .profile-nav-icon {
    height: 22px;
    opacity: 0.9;
    width: 22px;
}

#page-chat .profile-nav-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

#page-chat .profile-nav-label {
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

#page-chat .profile-e2ee-card {
    background: color-mix(in srgb, var(--theme-text, #ffffff) 3%, transparent);
    border: 1px solid var(--theme-border, #222);
    border-radius: 14px;
    margin-top: 0;
    padding: 14px 14px 12px;
}

#page-chat .profile-nav-foot {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
}

#page-chat .profile-nav-btn--logout {
    color: var(--text-danger);
}

#page-chat .profile-nav-btn--logout:hover,
#page-chat .profile-nav-btn--logout:focus-visible {
    background: color-mix(in srgb, var(--color-danger) 8%, transparent);
    color: var(--danger-hover);
}

#page-chat.is-viewport-app-stack .profile-e2ee-card,
#page-chat.is-viewport-profile-stack .profile-e2ee-card {
    display: none;
}

#page-chat.is-viewport-profile-stack .profile-nav-foot {
    display: none;
}

#page-chat.is-viewport-app-stack .profile-nav-btn--logout,
#page-chat.is-viewport-profile-stack .profile-nav-btn--logout {
    margin-top: 18px;
}

#page-chat.is-viewport-app-stack .profile-nav-btn.is-active,
#page-chat.is-viewport-profile-stack .profile-nav-btn.is-active {
    background: transparent;
    color: var(--theme-text, #e8e8e8);
    font-weight: 500;
}

#page-chat.is-viewport-app-stack .profile-nav-btn.is-active::after,
#page-chat.is-viewport-profile-stack .profile-nav-btn.is-active::after {
    display: none;
}

#page-chat.is-viewport-app-stack .profile-nav-btn.is-active:hover,
#page-chat.is-viewport-app-stack .profile-nav-btn.is-active:focus-visible,
#page-chat.is-viewport-profile-stack .profile-nav-btn.is-active:hover,
#page-chat.is-viewport-profile-stack .profile-nav-btn.is-active:focus-visible {
    background: color-mix(in srgb, var(--theme-text, #ffffff) 4%, transparent);
    color: var(--theme-text, #f4f4f5);
}

@media (hover: none) {
    #page-chat.is-viewport-app-stack .profile-nav-btn:hover,
    #page-chat.is-viewport-app-stack .profile-nav-btn.is-active:hover,
    #page-chat.is-viewport-profile-stack .profile-nav-btn:hover,
    #page-chat.is-viewport-profile-stack .profile-nav-btn.is-active:hover {
        background: transparent;
        color: var(--theme-text, #e8e8e8);
    }

    #page-chat.is-viewport-app-stack .profile-nav-btn--logout:hover,
    #page-chat.is-viewport-profile-stack .profile-nav-btn--logout:hover {
        background: transparent;
        color: var(--text-danger);
    }
}

#page-chat .profile-e2ee-head {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

#page-chat .profile-e2ee-kicker {
    color: var(--theme-text-muted, #6e6e6e);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

#page-chat .profile-e2ee-verified {
    align-items: center;
    color: #34d399;
    display: inline-flex;
    font-size: 11px;
    font-weight: 500;
    gap: 6px;
    letter-spacing: 0.03em;
}

#page-chat .profile-e2ee-verified::before {
    background: #34d399;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.7);
    content: "";
    height: 6px;
    width: 6px;
}

#page-chat .profile-e2ee-copy {
    color: var(--theme-text-muted, #8a8a8a);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.5;
    margin: 0 0 10px;
}

#page-chat .profile-e2ee-link {
    background: none;
    border: none;
    color: var(--theme-text-muted, #cfcfcf);
    cursor: pointer;
    font-family: var(--f-ui);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.01em;
    padding: 0;
}

#page-chat .profile-e2ee-link:hover {
    color: var(--theme-text, #fff);
}

#page-chat .profile-workspace .profile-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    max-width: none;
    min-height: 0;
    padding: 0;
    width: 100%;
}

#page-chat .profile-workspace .profile-head {
    align-items: center;
    background: var(--composer-glass);
    backdrop-filter: blur(36px) saturate(180%);
    -webkit-backdrop-filter: blur(36px) saturate(180%);
    border: 1px solid var(--capsule-stroke, var(--composer-glass-stroke, var(--panel-glass-stroke)));
    border-radius: var(--nexa-chrome-radius, 24px);
    box-shadow:
        var(--glass-inset-highlight),
        0 10px 28px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-shrink: 0;
    gap: 12px;
    justify-content: space-between;
    /* Match profile-body horizontal inset so edges line up with the content column. */
    margin: var(--nexa-surface-inset, 20px) 32px 0;
    max-width: none;
    min-height: var(--layout-header-h, 58px);
    padding: 8px 16px;
    width: auto;
}

#page-chat .profile-workspace .profile-head h2 {
    font-family: var(--f-display);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -0.015em;
}

#page-chat .profile-workspace .profile-head-sub {
    color: var(--theme-text-muted, #7a7a7a);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.005em;
    line-height: 1.35;
    margin-top: 2px;
}

#page-chat .profile-workspace .profile-head-copy {
    flex: 1;
    min-width: 0;
}

#page-chat .profile-nav-toggle {
    display: none;
}

#page-chat .profile-nav-scrim,
#page-chat .profile-nav-scrim {
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 0;
    bottom: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    right: 0;
    top: 0;
    transition: opacity 0.28s ease;
    z-index: 30;
}

#page-chat .profile-nav-scrim[hidden] {
    display: none;
}

#page-chat.is-viewport-sidebar-narrow.is-profile-nav-open .profile-nav-scrim {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

#page-chat.is-viewport-sidebar-narrow .profile-workspace .profile-shell {
    grid-template-columns: 1fr;
    position: relative;
}

#page-chat.is-viewport-sidebar-narrow .profile-nav {
    bottom: 0;
    box-shadow: 18px 0 48px rgba(0, 0, 0, 0.45);
    flex-direction: column;
    left: 0;
    overflow: auto;
    padding: 28px 18px 20px;
    pointer-events: none;
    position: absolute;
    top: 0;
    transform: translateX(-105%);
    transition:
        transform 0.48s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.35s ease;
    width: min(280px, 88vw);
    will-change: transform;
    z-index: 35;
}

#page-chat.is-viewport-sidebar-narrow.is-profile-nav-open .profile-nav {
    pointer-events: auto;
    transform: translateX(0);
}

#page-chat.is-viewport-sidebar-narrow .profile-nav-toggle {
    display: inline-flex;
}

/* Small screens: nested full-screen profile levels (nav ↔ section) */
#page-chat .profile-nav-toolbar {
    align-items: center;
    border-bottom: 1px solid var(--theme-border, #1a1a1a);
    display: none;
    flex-shrink: 0;
    gap: 12px;
    margin: -28px -18px 20px;
    padding: 18px 16px;
    position: relative;
}

#page-chat .profile-nav-toolbar-copy {
    min-width: 0;
}

#page-chat .profile-nav-toolbar-title {
    color: var(--theme-text, #f4f4f5);
    font-family: var(--f-ui);
    font-size: 16px;
    font-weight: 500;
    letter-spacing: -0.015em;
    margin: 0;
}

#page-chat .profile-nav-toolbar-sub {
    color: var(--theme-text-muted, #7a7a7a);
    font-size: 13px;
    margin: 4px 0 0;
}

#page-chat.is-viewport-profile-stack .profile-workspace .profile-shell {
    grid-template-columns: 1fr;
    overflow: hidden;
    position: relative;
}

#page-chat.is-viewport-profile-stack .profile-nav-toolbar {
    display: flex;
    justify-content: center;
    margin: 0 0 8px;
    min-height: 56px;
    padding: 12px 56px;
}

#page-chat.is-viewport-profile-stack .profile-nav-back-btn {
    left: 10px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

#page-chat.is-viewport-profile-stack .profile-nav-toolbar-copy {
    text-align: center;
}

#page-chat.is-viewport-profile-stack .profile-nav-toolbar-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

#page-chat.is-viewport-profile-stack .profile-nav-kicker {
    display: none;
}

#page-chat.is-viewport-profile-stack .profile-workspace .profile-head {
    justify-content: center;
    margin: 12px 12px 0;
    min-height: 56px;
    padding: 10px 56px;
    position: relative;
    width: auto;
}

#page-chat.is-viewport-profile-stack .profile-workspace .profile-head-copy {
    flex: 0 1 auto;
    text-align: center;
}

#page-chat.is-viewport-profile-stack .profile-workspace .profile-head h2 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

#page-chat.is-viewport-profile-stack .profile-workspace .profile-head-sub,
#page-chat.is-viewport-profile-stack .profile-workspace .profile-close-btn {
    display: none;
}

#page-chat.is-viewport-profile-stack .profile-workspace .profile-back-btn {
    left: 10px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

#page-chat.is-viewport-profile-stack .profile-nav-toggle,
#page-chat.is-viewport-profile-stack .profile-nav-scrim {
    display: none !important;
}

#page-chat.is-viewport-profile-stack .profile-nav,
#page-chat.is-viewport-profile-stack .profile-workspace .profile-main {
    bottom: 0;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
    width: 100%;
    will-change: transform;
}

#page-chat.is-viewport-profile-stack .profile-nav {
    background: var(--theme-section, #000);
    border-right: none;
    box-shadow: none;
    gap: 2px;
    overflow: auto;
    padding: 0 12px 28px;
    pointer-events: auto;
    transform: translateX(0);
    z-index: 2;
}

#page-chat.is-viewport-app-stack .profile-nav {
    bottom: calc(var(--mobile-rail-h) + env(safe-area-inset-bottom, 0px));
}

#page-chat.is-viewport-profile-stack .profile-nav-btn {
    border-radius: 14px;
    color: var(--theme-text, #e8e8e8);
    gap: 14px;
    min-height: 52px;
    padding: 14px 14px;
}

#page-chat.is-viewport-profile-stack .profile-nav-icon {
    height: 20px;
    opacity: 0.72;
    width: 20px;
}

#page-chat.is-viewport-profile-stack .profile-nav-label {
    font-size: 16px;
    font-weight: 500;
    letter-spacing: -0.01em;
}

#page-chat.is-viewport-profile-stack .profile-nav-btn--logout {
    color: var(--text-danger);
    margin-top: 18px;
}

#page-chat.is-viewport-profile-stack .profile-nav-btn--logout .profile-nav-icon {
    opacity: 0.9;
}

/* Beat the mid-width drawer rules when both breakpoints apply */
#page-chat.is-viewport-profile-stack.is-viewport-sidebar-narrow .profile-nav {
    box-shadow: none;
    left: 0;
    pointer-events: auto;
    right: 0;
    transform: translateX(0);
    width: 100%;
}

#page-chat.is-viewport-profile-stack .profile-workspace .profile-main {
    background: var(--theme-section, #000);
    display: flex;
    flex-direction: column;
    max-width: none;
    overflow: hidden;
    transform: translateX(100%);
    z-index: 3;
}

#page-chat.is-viewport-profile-stack.is-profile-level-nav .profile-nav,
#page-chat.is-viewport-profile-stack.is-viewport-sidebar-narrow.is-profile-level-nav .profile-nav {
    pointer-events: auto;
    transform: translateX(0);
}

#page-chat.is-viewport-profile-stack.is-profile-level-nav .profile-workspace .profile-main {
    pointer-events: none;
    transform: translateX(100%);
}

#page-chat.is-viewport-profile-stack.is-profile-level-section .profile-nav,
#page-chat.is-viewport-profile-stack.is-viewport-sidebar-narrow.is-profile-level-section .profile-nav {
    pointer-events: none;
    transform: translateX(-30%);
}

#page-chat.is-viewport-profile-stack.is-profile-level-section .profile-workspace .profile-main {
    pointer-events: auto;
    transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
    #page-chat.is-viewport-profile-stack .profile-nav,
    #page-chat.is-viewport-profile-stack .profile-workspace .profile-main {
        transition: none;
    }
}

#page-chat .profile-workspace .profile-body {
    gap: 20px;
    overflow: auto;
    padding: 18px 32px 20px;
}

/* Identity: header card, page header (title + Cancel / Save), then one card of
   two-column rows. margin: auto centres the column in both axes inside the
   body's flex column; taller than the viewport, it scrolls from the top. */
#page-chat .profile-workspace .profile-identity-layout {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: 20px;
    margin: auto;
    max-width: 880px;
    min-height: 0;
    width: 100%;
}

#page-chat.is-app-view-identity .profile-workspace .profile-body {
    /* Rows stack when the body itself gets narrow. */
    container-type: inline-size;
    display: flex;
    flex-direction: column;
}

/* The panel header (title + ✕) lines up with the centred card on Profile. */
#page-chat.is-app-view-identity:not(.is-viewport-profile-stack) .profile-workspace .profile-head {
    align-self: center;
    box-sizing: border-box;
    margin-inline: auto;
    max-width: 880px;
    width: calc(100% - 64px);
}

#page-chat .profile-workspace .profile-identity-aside {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

#page-chat .profile-workspace .profile-avatar-card,
#page-chat .profile-workspace .profile-about-card {
    background: var(--settings-capsule-bg);
    backdrop-filter: var(--settings-capsule-blur);
    -webkit-backdrop-filter: var(--settings-capsule-blur);
    border: 1px solid var(--settings-capsule-stroke);
    border-radius: var(--settings-capsule-radius);
    box-shadow:
        var(--glass-inset-highlight),
        var(--nexa-surface-shadow);
}

#page-chat .profile-workspace .profile-avatar-card {
    border-radius: var(--settings-capsule-radius) var(--settings-capsule-radius) calc(var(--settings-capsule-radius) / 4) calc(var(--settings-capsule-radius) / 4);
    padding: 18px 18px 16px;
}

#page-chat .profile-workspace .profile-avatar-orbit {
    align-items: center;
    display: flex;
    height: 240px;
    justify-content: center;
    margin: 0 auto 14px;
    position: relative;
    width: 240px;
}

#page-chat .profile-workspace .profile-avatar-rings {
    color: var(--theme-text, #fff);
    height: 100%;
    left: 0;
    pointer-events: none;
    position: absolute;
    top: 0;
    width: 100%;
}

#page-chat .profile-workspace .profile-avatar-zone {
    background: var(--control-glass);
    backdrop-filter: blur(28px) saturate(160%);
    -webkit-backdrop-filter: blur(28px) saturate(160%);
    border: 1px solid var(--control-glass-stroke);
    box-shadow: var(--glass-inset-highlight);
    height: 132px;
    width: 132px;
    z-index: 1;
}

#page-chat .profile-workspace .profile-avatar-zone:hover,
#page-chat .profile-workspace .profile-avatar-zone.is-dragover {
    border-color: var(--theme-border, #444);
    box-shadow: none;
}

#page-chat .profile-workspace .profile-avatar-initials {
    font-size: 40px;
    text-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
    #page-chat .profile-workspace .profile-preview-mini {
        transform: none;
        will-change: auto;
    }
}

#page-chat .profile-workspace .profile-avatar-actions {
    display: flex;
    gap: 8px;
}

#page-chat .profile-workspace .profile-change-avatar {
    align-items: center;
    background: var(--settings-inner-fill);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 10px;
    box-shadow: none;
    color: var(--theme-text, #f4f4f5);
    cursor: pointer;
    display: inline-flex;
    flex: 1;
    font-family: var(--f-ui);
    font-size: 13px;
    font-weight: 500;
    gap: 8px;
    justify-content: center;
    letter-spacing: 0.01em;
    margin: 0;
    padding: 10px 14px;
}

#page-chat .profile-workspace .profile-change-avatar:hover {
    background: color-mix(in srgb, var(--theme-text, #fff) 6%, transparent);
    border-color: color-mix(in srgb, var(--theme-tint, #fff) 10%, transparent);
}

#page-chat .profile-workspace .profile-change-avatar .ui-icon {
    height: 14px;
    width: 14px;
}

#page-chat .profile-workspace .profile-remove-avatar {
    align-items: center;
    background: var(--settings-inner-fill);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 10px;
    box-shadow: none;
    color: var(--theme-text-muted, #8a8a8a);
    cursor: pointer;
    display: inline-flex;
    flex-shrink: 0;
    height: 40px;
    justify-content: center;
    margin: 0;
    padding: 0;
    width: 40px;
}

#page-chat .profile-workspace .profile-remove-avatar .ui-icon {
    height: 15px;
    width: 15px;
}

#page-chat .profile-workspace .profile-remove-avatar:hover {
    background: color-mix(in srgb, var(--theme-text, #fff) 6%, transparent);
    border-color: color-mix(in srgb, var(--theme-tint, #fff) 10%, transparent);
    color: var(--theme-text, #f4f4f5);
}

#page-chat .profile-workspace .profile-avatar-hint {
    color: var(--theme-text-muted, #6e6e6e);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.45;
    margin: 10px 0 0;
    text-align: center;
}

#page-chat .profile-workspace .profile-about-card {
    align-items: flex-start;
    border-radius: calc(var(--settings-capsule-radius) / 4) calc(var(--settings-capsule-radius) / 4) var(--settings-capsule-radius) var(--settings-capsule-radius);
    display: flex;
    gap: 12px;
    padding: 14px 16px;
}

#page-chat .profile-workspace .profile-about-icon {
    color: var(--theme-text-muted, #8a8a8a);
    flex-shrink: 0;
    height: 16px;
    margin-top: 1px;
    width: 16px;
}

#page-chat .profile-workspace .profile-about-title {
    color: var(--theme-text, #f4f4f5);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.005em;
    margin: 0 0 4px;
}

#page-chat .profile-workspace .profile-about-text {
    color: var(--theme-text-muted, #7a7a7a);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    margin: 0;
}

#page-chat .profile-workspace .profile-form-col {
    background: var(--settings-capsule-bg);
    backdrop-filter: var(--settings-capsule-blur);
    -webkit-backdrop-filter: var(--settings-capsule-blur);
    border: 1px solid var(--settings-capsule-stroke);
    border-radius: var(--settings-capsule-radius);
    box-shadow:
        var(--glass-inset-highlight),
        var(--nexa-surface-shadow);
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    padding: 20px 18px;
}

#page-chat .profile-workspace .profile-field-row {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(140px, 0.9fr) minmax(0, 1.4fr);
}

#page-chat .profile-workspace .profile-field label {
    color: var(--theme-text-muted, #8a8a8a);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

#page-chat .profile-workspace .profile-field input,
#page-chat .profile-workspace .profile-field textarea,
#page-chat .profile-workspace .profile-field-control,
#page-chat .profile-workspace .profile-status-control {
    background: var(--settings-inner-fill);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 10px;
    box-shadow: none;
    color: var(--theme-text, #f4f4f5);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.005em;
    line-height: 1.45;
}

#page-chat .profile-workspace .profile-field input,
#page-chat .profile-workspace .profile-field textarea {
    padding: 11px 14px;
    width: 100%;
}

#page-chat .profile-workspace .profile-field input:focus,
#page-chat .profile-workspace .profile-field textarea:focus,
#page-chat .profile-workspace .profile-status-control:focus-within {
    background: color-mix(in srgb, var(--theme-text, #fff) 7%, transparent);
    border-color: color-mix(in srgb, var(--theme-tint, #fff) 11%, transparent);
    box-shadow: none;
    outline: none;
}

#page-chat .profile-workspace .profile-field-control {
    align-items: center;
    display: flex;
    gap: 8px;
    min-width: 0;
    padding: 4px 4px 4px 14px;
}

#page-chat .profile-workspace .profile-field-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    padding: 7px 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#page-chat .profile-workspace .profile-field-value--mono {
    font-family: var(--f-mono);
    font-size: 12px;
}

#page-chat .profile-workspace .profile-field-action {
    background: var(--settings-inner-fill);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 8px;
    box-shadow: none;
    color: var(--theme-text-muted, #cfcfcf);
    cursor: pointer;
    flex-shrink: 0;
    font-family: var(--f-ui);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.01em;
    padding: 7px 12px;
}

#page-chat .profile-workspace .profile-field-action:hover:not(:disabled) {
    background: color-mix(in srgb, var(--theme-text, #fff) 6%, transparent);
    color: var(--theme-text, #fff);
}

#page-chat .profile-workspace .profile-field-hint {
    color: var(--theme-text-muted, #6e6e6e);
    font-size: 12px;
    line-height: 1.4;
    margin: 6px 0 0;
}

#page-chat .profile-workspace .profile-field-hint.is-ok {
    color: #34d399;
}

#page-chat .profile-workspace .profile-status-control {
    align-items: center;
    display: flex;
    gap: 8px;
    padding: 0 12px 0 14px;
    position: relative;
}

#page-chat .profile-workspace .profile-status-dot {
    background: #34d399;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.45);
    flex-shrink: 0;
    height: 8px;
    width: 8px;
}

#page-chat .profile-workspace .profile-status-dot.is-away {
    background: #fbbf24;
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}

#page-chat .profile-workspace .profile-status-dot.is-busy {
    background: var(--color-danger);
    box-shadow: 0 0 8px color-mix(in srgb, var(--color-danger) 40%, transparent);
}

#page-chat .profile-workspace .profile-status-dot.is-invisible {
    background: #52525b;
    box-shadow: none;
}

#page-chat .profile-workspace .profile-status-control select {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: 0;
    color: var(--theme-text, #f4f4f5);
    color-scheme: dark;
    cursor: pointer;
    flex: 1;
    font-family: var(--f-ui);
    font-size: 14px;
    min-width: 0;
    outline: none;
    padding: 11px 22px 11px 0;
}

#page-chat .profile-workspace .profile-status-chevron {
    color: var(--theme-text-muted, #7a7a7a);
    height: 14px;
    pointer-events: none;
    position: absolute;
    right: 12px;
    width: 14px;
}

#page-chat .profile-workspace .profile-preview-panel {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
}

#page-chat .profile-workspace .profile-preview-kicker {
    color: var(--theme-text-muted, #8a8a8a);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    margin: 0 0 12px;
    text-transform: uppercase;
}

#page-chat .profile-workspace .profile-preview-stage {
    align-items: center;
    background: var(--settings-inner-fill);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 16px;
    box-shadow: none;
    display: flex;
    justify-content: center;
    min-height: 280px;
    overflow: hidden;
    padding: 28px 20px 24px;
    position: relative;
}

#page-chat .profile-workspace .profile-preview-bg {
    border-radius: 16px;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    position: absolute;
    z-index: 0;
}

#page-chat .profile-workspace .profile-preview-bg__grid {
    background-image:
        linear-gradient(to right, color-mix(in srgb, var(--theme-text, #ffffff) 7%, transparent) 1px, transparent 1px),
        linear-gradient(to bottom, color-mix(in srgb, var(--theme-text, #ffffff) 7%, transparent) 1px, transparent 1px);
    background-size: 40px 40px;
    inset: 0;
    mask-image: radial-gradient(ellipse at 50% 42%, #000 22%, transparent 82%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 42%, #000 22%, transparent 82%);
    opacity: 1;
    position: absolute;
}

#page-chat .profile-workspace .profile-preview-bg__mark {
    bottom: -6%;
    display: block;
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.03));
    height: auto;
    left: 50%;
    mask-image: linear-gradient(0deg, #000 18%, transparent 88%);
    -webkit-mask-image: linear-gradient(0deg, #000 18%, transparent 88%);
    opacity: 0.07;
    position: absolute;
    top: auto;
    transform: translateX(-50%);
    width: 92%;
}

#page-chat .profile-workspace .profile-preview-tilt {
    align-items: center;
    display: flex;
    justify-content: center;
    perspective: 1000px;
    perspective-origin: 50% 50%;
    position: relative;
    transform-style: preserve-3d;
    width: 100%;
    z-index: 1;
}

#page-chat .profile-workspace .profile-preview-mini {
    align-items: center;
    background: var(--settings-inner-fill);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 18px;
    box-shadow:
        var(--glass-inset-highlight),
        0 18px 44px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    gap: 0;
    isolation: isolate;
    max-width: 100%;
    min-width: 0;
    padding: 28px 28px 22px;
    position: relative;
    text-align: center;
    transform: translateZ(28px);
    transform-origin: center center;
    transform-style: preserve-3d;
    width: min(100%, 320px);
    will-change: transform;
    z-index: 1;
}

#page-chat .profile-workspace .profile-preview-mini::before {
    background: linear-gradient(
        160deg,
        color-mix(in srgb, var(--theme-text, #ffffff) 7%, transparent) 0%,
        color-mix(in srgb, var(--theme-text, #ffffff) 2%, transparent) 28%,
        transparent 52%
    );
    border-radius: inherit;
    content: "";
    inset: 0;
    pointer-events: none;
    position: absolute;
    z-index: 0;
}

#page-chat .profile-workspace .profile-preview-mini-face {
    align-items: center;
    display: flex;
    flex-direction: column;
    position: relative;
    transform: translateZ(36px);
    width: 100%;
    z-index: 1;
}

#page-chat .profile-workspace .profile-preview-avatar {
    background: var(--settings-inner-fill);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--settings-inner-stroke);
    box-shadow: none;
    height: 88px;
    margin-bottom: 16px;
    overflow: hidden;
    position: relative;
    width: 88px;
}

#page-chat .profile-workspace .profile-preview-avatar #uiProfilePreviewInitials {
    color: var(--theme-text, #f4f4f5);
    font-size: 36px;
    font-weight: 500;
    letter-spacing: 0;
    text-shadow: none;
}

#page-chat .profile-workspace .profile-preview-name {
    color: var(--theme-text, #f4f4f5);
    font-size: 18px;
    font-weight: 500;
    letter-spacing: -0.02em;
    margin: 0;
}

#page-chat .profile-workspace .profile-preview-handle {
    color: var(--theme-text-muted, #8a8a8a);
    font-size: 13px;
    font-weight: 400;
    margin: 4px 0 12px;
}

#page-chat .profile-workspace .profile-preview-bio {
    color: var(--theme-text, #f4f4f5);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    margin: 0 0 16px;
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
    word-break: break-word;
}

#page-chat .profile-workspace .profile-preview-bio.is-placeholder {
    color: var(--theme-text-muted, #6e6e6e);
    font-style: normal;
}

#page-chat .profile-workspace .profile-preview-status {
    align-items: center;
    color: #34d399;
    display: inline-flex;
    font-size: 13px;
    font-weight: 500;
    gap: 8px;
    margin: 0;
}

#page-chat .profile-workspace .profile-preview-status-dot {
    background: currentColor;
    border-radius: 50%;
    box-shadow: 0 0 8px currentColor;
    height: 8px;
    width: 8px;
}

#page-chat .profile-workspace .profile-preview-status.is-away {
    color: #fbbf24;
}

#page-chat .profile-workspace .profile-preview-status.is-busy {
    color: var(--text-danger);
}

#page-chat .profile-workspace .profile-preview-status.is-invisible {
    color: var(--theme-text-muted, #71717a);
}

#page-chat .profile-workspace .profile-preview-status.is-invisible .profile-preview-status-dot {
    box-shadow: none;
}

#page-chat .profile-workspace .profile-preview-note {
    color: var(--theme-text-muted, #6e6e6e);
    font-size: 12px;
    margin: 12px 0 0;
    text-align: center;
}

#page-chat .profile-workspace .profile-copy-btn {
    background: var(--settings-inner-fill);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 8px;
    box-shadow: none;
    color: var(--theme-text-muted, #cfcfcf);
    cursor: pointer;
    font-family: var(--f-ui);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.01em;
    padding: 7px 12px;
}

#page-chat .profile-workspace .profile-copy-btn:hover:not(:disabled) {
    background: color-mix(in srgb, var(--theme-text, #fff) 6%, transparent);
    color: var(--theme-text, #fff);
}

#page-chat .profile-workspace .profile-foot {
    border-top: 1px solid var(--theme-border, #1a1a1a);
    justify-content: flex-end;
    padding: 16px 36px 24px;
}

#page-chat .profile-workspace .profile-foot.hidden {
    display: none;
}

#page-chat .profile-workspace .profile-btn--primary {
    background: var(--settings-inner-fill);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 12px;
    box-shadow: none;
    color: var(--theme-text, #fff);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
    padding: 12px 22px;
}

#page-chat .profile-workspace .profile-btn--primary:hover {
    background: color-mix(in srgb, var(--theme-text, #fff) 6%, transparent);
    border-color: color-mix(in srgb, var(--theme-tint, #fff) 10%, transparent);
}

#page-chat .profile-workspace .profile-id-label,
#page-chat .profile-workspace .profile-block-title {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.03em;
}

#page-chat .profile-workspace .profile-id-value {
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
}

#page-chat .profile-workspace .profile-field-meta {
    font-size: 11px;
    font-weight: 400;
}

#page-chat .profile-workspace .profile-status-chip {
    font-weight: 500;
    letter-spacing: 0.01em;
}

#page-chat .profile-workspace .profile-security-layout {
    background: var(--settings-capsule-bg);
    backdrop-filter: var(--settings-capsule-blur);
    -webkit-backdrop-filter: var(--settings-capsule-blur);
    border: 1px solid var(--settings-capsule-stroke);
    border-radius: var(--settings-capsule-radius);
    box-shadow:
        var(--glass-inset-highlight),
        var(--nexa-surface-shadow);
    display: flex;
    flex-direction: column;
    gap: 22px;
    max-width: 760px;
    min-width: 0;
    padding: 20px 18px;
    width: 100%;
}

#page-chat .profile-workspace .profile-sec-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

#page-chat .profile-workspace .profile-sec-kicker {
    color: var(--theme-text-muted, #7a7a7a);
    font-family: var(--f-display);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    margin: 0;
    text-transform: uppercase;
}

#page-chat .profile-workspace .profile-sec-split,
#page-chat .profile-workspace .profile-sec-card {
    background: var(--settings-inner-fill);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 14px;
    box-shadow: none;
}

#page-chat .profile-workspace .profile-sec-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-width: 0;
    overflow: hidden;
}

#page-chat .profile-workspace .profile-sec-split__pane {
    align-items: flex-start;
    display: flex;
    gap: 14px;
    min-width: 0;
    padding: 18px 18px 18px 16px;
}

#page-chat .profile-workspace .profile-sec-split__pane + .profile-sec-split__pane {
    border-left: 1px solid var(--theme-border, #1d1d1d);
}

#page-chat .profile-workspace .profile-sec-card {
    align-items: center;
    display: flex;
    gap: 14px;
    min-width: 0;
    padding: 16px;
    text-align: left;
    width: 100%;
}

#page-chat .profile-workspace button.profile-sec-card,
#page-chat .profile-workspace a.profile-sec-card {
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-decoration: none;
}

#page-chat .profile-workspace button.profile-sec-card:hover,
#page-chat .profile-workspace a.profile-sec-card:hover {
    background: color-mix(in srgb, var(--theme-text, #fff) 7%, transparent);
    border-color: color-mix(in srgb, var(--theme-tint, #fff) 10%, transparent);
}

#page-chat .profile-workspace .profile-sec-icon {
    align-items: center;
    background: color-mix(in srgb, var(--theme-text, #fff) 5%, transparent);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 10px;
    color: var(--theme-text-muted, #cfcfcf);
    display: inline-flex;
    flex-shrink: 0;
    height: 40px;
    justify-content: center;
    width: 40px;
}

#page-chat .profile-workspace .profile-sec-icon .ui-icon {
    height: 18px;
    width: 18px;
}

#page-chat .profile-workspace .profile-sec-orbit {
    align-items: center;
    color: #34d399;
    display: inline-flex;
    flex-shrink: 0;
    height: 48px;
    justify-content: center;
    position: relative;
    width: 48px;
}

#page-chat .profile-workspace .profile-sec-orbit-ring {
    inset: 0;
    position: absolute;
}

#page-chat .profile-workspace .profile-sec-orbit .ui-icon {
    height: 16px;
    position: relative;
    width: 16px;
    z-index: 1;
}

#page-chat .profile-workspace .profile-sec-copy {
    flex: 1;
    min-width: 0;
}

#page-chat .profile-workspace .profile-sec-title {
    color: var(--theme-text, #f4f4f5);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.005em;
    margin: 0 0 4px;
}

#page-chat .profile-workspace .profile-sec-title.is-verified {
    color: #34d399;
}

#page-chat .profile-workspace .profile-sec-text {
    color: var(--theme-text-muted, #8a8a8a);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    margin: 0;
}

#page-chat .profile-workspace .profile-sec-meta {
    color: var(--theme-text-muted, #6e6e6e);
    font-size: 12px;
    margin: 2px 0 0;
}

#page-chat .profile-workspace .profile-sec-device-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-left: auto;
    text-align: right;
}

#page-chat .profile-workspace .profile-sec-meta-label {
    color: var(--theme-text-muted, #6e6e6e);
    font-size: 11px;
    letter-spacing: 0.02em;
}

#page-chat .profile-workspace .profile-sec-meta-value {
    color: var(--theme-text, #f4f4f5);
    font-size: 13px;
    font-weight: 500;
}

#page-chat .profile-workspace .profile-sec-meta-value.is-online {
    color: #d4f562;
}

#page-chat .profile-workspace .profile-devices-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#page-chat .profile-workspace .profile-sec-keys-grid {
    display: grid;
    flex: 1;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 0;
}

#page-chat .profile-workspace .profile-sec-key {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

#page-chat .profile-workspace .profile-sec-key-label {
    color: var(--theme-text, #f4f4f5);
    font-size: 13px;
    font-weight: 500;
}

#page-chat .profile-workspace .profile-sec-key-value {
    color: var(--theme-text-muted, #8a8a8a);
    font-family: var(--f-mono);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#page-chat .profile-workspace .profile-sec-chevron {
    color: var(--theme-text-muted, #6e6e6e);
    flex-shrink: 0;
    height: 16px;
    transition: transform 0.15s ease;
    width: 16px;
}

#page-chat .profile-workspace .profile-sec-keys.is-open .profile-sec-chevron {
    transform: rotate(90deg);
}

#page-chat .profile-workspace .profile-sec-fingerprint {
    background: var(--settings-inner-fill);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 14px;
    box-shadow: none;
    margin-top: -2px;
    padding: 14px 16px 16px;
}

#page-chat .profile-workspace .profile-sec-fingerprint .profile-fingerprint-head {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin-bottom: 10px;
}

#page-chat .profile-workspace .profile-sec-fingerprint .profile-fingerprint {
    background: color-mix(in srgb, var(--theme-text, #fff) 3%, transparent);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 10px;
    box-shadow: none;
    color: var(--theme-text-muted, #cfcfcf);
    font-family: var(--f-mono);
    font-size: 12px;
    letter-spacing: 0.04em;
    line-height: 1.55;
    margin: 0;
    padding: 12px 14px;
    word-break: break-all;
}

#page-chat .profile-workspace .profile-sec-action .profile-sec-title {
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

@media (max-width: 820px) {
    #page-chat .profile-workspace .profile-sec-split {
        grid-template-columns: 1fr;
    }

    #page-chat .profile-workspace .profile-sec-split__pane + .profile-sec-split__pane {
        border-left: 0;
        border-top: 1px solid var(--theme-border, #1d1d1d);
    }

    #page-chat .profile-workspace .profile-sec-keys-grid {
        grid-template-columns: 1fr;
    }

    #page-chat .profile-workspace .profile-sec-device {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    #page-chat .profile-workspace .profile-sec-device-meta {
        margin-left: 54px;
        text-align: left;
        width: 100%;
    }
}

#page-chat .profile-workspace .profile-privacy-layout {
    background: var(--settings-capsule-bg);
    backdrop-filter: var(--settings-capsule-blur);
    -webkit-backdrop-filter: var(--settings-capsule-blur);
    border: 1px solid var(--settings-capsule-stroke);
    border-radius: var(--settings-capsule-radius);
    box-shadow:
        var(--glass-inset-highlight),
        var(--nexa-surface-shadow);
    display: flex;
    flex-direction: column;
    gap: 22px;
    max-width: 760px;
    min-width: 0;
    padding: 20px 18px;
    width: 100%;
}

#page-chat .profile-workspace .profile-privacy-card {
    background: var(--settings-inner-fill);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 14px;
    box-shadow: none;
    overflow: hidden;
}

#page-chat .profile-workspace .profile-privacy-row {
    align-items: center;
    cursor: pointer;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 16px 18px;
}

#page-chat .profile-workspace .profile-privacy-row + .profile-privacy-row {
    border-top: 1px solid color-mix(in srgb, var(--theme-tint, #fff) 3%, transparent);
}

#page-chat .profile-workspace .profile-privacy-copy {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

#page-chat .profile-workspace .profile-privacy-label {
    color: var(--theme-text, #f4f4f5);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.005em;
}

#page-chat .profile-workspace .profile-privacy-hint {
    color: var(--theme-text-muted, #8a8a8a);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
}

#page-chat .profile-workspace .profile-switch {
    flex-shrink: 0;
    position: relative;
}

#page-chat .profile-workspace .profile-switch input {
    cursor: pointer;
    height: 100%;
    left: 0;
    margin: 0;
    opacity: 0;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 1;
}

#page-chat .profile-workspace .profile-switch__track {
    background: color-mix(in srgb, var(--theme-text, #fff) 10%, transparent);
    border: 1px solid var(--control-glass-stroke);
    border-radius: 999px;
    display: block;
    height: 26px;
    position: relative;
    transition: background 0.18s ease;
    width: 46px;
}

#page-chat .profile-workspace .profile-switch__track::after {
    background: var(--theme-text, #f4f4f5);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    content: "";
    height: 20px;
    left: 3px;
    position: absolute;
    top: 3px;
    transition: transform 0.18s ease;
    width: 20px;
}

#page-chat .profile-workspace .profile-switch input:checked + .profile-switch__track {
    background: #3b82f6;
}

#page-chat .profile-workspace .profile-switch input:checked + .profile-switch__track::after {
    transform: translateX(20px);
}

#page-chat .profile-workspace .profile-switch input:focus-visible + .profile-switch__track {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
}

#page-chat .profile-workspace .profile-data-layout {
    background: var(--settings-capsule-bg);
    backdrop-filter: var(--settings-capsule-blur);
    -webkit-backdrop-filter: var(--settings-capsule-blur);
    border: 1px solid var(--settings-capsule-stroke);
    border-radius: var(--settings-capsule-radius);
    box-shadow:
        var(--glass-inset-highlight),
        var(--nexa-surface-shadow);
    display: flex;
    flex-direction: column;
    gap: 28px;
    max-width: 760px;
    min-width: 0;
    padding: 20px 18px;
    padding-top: 20px;
    width: 100%;
}

#page-chat .profile-workspace .profile-data-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

#page-chat .profile-workspace .profile-data-kicker {
    color: var(--theme-text-muted, #7a7a7a);
    font-family: var(--f-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.1em;
    margin: 0;
    text-transform: uppercase;
}

#page-chat .profile-workspace .profile-data-overview {
    align-items: center;
    background: var(--settings-inner-fill);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 14px;
    box-shadow: none;
    display: grid;
    gap: 36px 48px;
    grid-template-columns: auto 1fr;
    min-width: 0;
    padding: 28px 32px;
}

#page-chat .profile-workspace .profile-data-donut-wrap {
    height: 148px;
    position: relative;
    width: 148px;
}

#page-chat .profile-workspace .profile-data-donut {
    display: block;
    height: 148px;
    overflow: visible;
    transform: rotate(-90deg);
    width: 148px;
}

#page-chat .profile-workspace .profile-data-donut-track,
#page-chat .profile-workspace .profile-data-donut-seg {
    fill: none;
    stroke-width: 11;
}

#page-chat .profile-workspace .profile-data-donut-track {
    stroke: var(--theme-bg, #1f1f1f);
}

#page-chat .profile-workspace .profile-data-donut-seg {
    stroke-dasharray: 0 100;
    stroke-dashoffset: 0;
    transition:
        stroke-dasharray 0.9s cubic-bezier(0.22, 1, 0.36, 1),
        stroke-dashoffset 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

#page-chat .profile-workspace .profile-data-donut-seg.is-messages {
    stroke: #3b82f6;
}

#page-chat .profile-workspace .profile-data-donut-seg.is-keys {
    stroke: var(--theme-text-muted, #a1a1aa);
}

#page-chat .profile-workspace .profile-data-donut-seg.is-cache {
    stroke: var(--theme-text-muted, #3f3f46);
}

#page-chat .profile-workspace .profile-data-donut-label {
    align-items: center;
    display: flex;
    flex-direction: column;
    inset: 0;
    justify-content: center;
    pointer-events: none;
    position: absolute;
    text-align: center;
}

#page-chat .profile-workspace .profile-data-donut-value {
    color: var(--theme-text, #f4f4f5);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

#page-chat .profile-workspace .profile-data-donut-caption {
    color: var(--theme-text-muted, #8a8a8a);
    font-size: 12px;
    font-weight: 400;
    margin-top: 4px;
}

#page-chat .profile-workspace .profile-data-legend {
    display: flex;
    flex-direction: column;
    gap: 14px;
    list-style: none;
    margin: 0;
    min-width: 0;
    padding: 0;
}

#page-chat .profile-workspace .profile-data-legend li {
    align-items: center;
    display: grid;
    gap: 12px;
    grid-template-columns: 8px minmax(0, 1fr) auto;
}

#page-chat .profile-workspace .profile-data-dot {
    border-radius: 50%;
    height: 8px;
    width: 8px;
}

#page-chat .profile-workspace .profile-data-dot.is-messages {
    background: #3b82f6;
}

#page-chat .profile-workspace .profile-data-dot.is-keys {
    background: #a1a1aa;
}

#page-chat .profile-workspace .profile-data-dot.is-cache {
    background: #3f3f46;
}

#page-chat .profile-workspace .profile-data-legend-label {
    color: var(--theme-text-muted, #cfcfcf);
    font-size: 14px;
    font-weight: 400;
}

#page-chat .profile-workspace .profile-data-legend-value {
    color: var(--theme-text, #f4f4f5);
    font-size: 14px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

#page-chat .profile-workspace .profile-data-actions {
    background: var(--settings-inner-fill);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 14px;
    box-shadow: none;
    overflow: hidden;
}

#page-chat .profile-workspace .profile-data-action {
    align-items: center;
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    display: flex;
    font: inherit;
    gap: 14px;
    padding: 16px 18px;
    text-align: left;
    width: 100%;
}

#page-chat .profile-workspace .profile-data-action + .profile-data-action {
    border-top: 1px solid color-mix(in srgb, var(--theme-tint, #fff) 3%, transparent);
}

#page-chat .profile-workspace .profile-data-action:hover {
    background: color-mix(in srgb, var(--theme-text, #fff) 5%, transparent);
}

#page-chat .profile-workspace .profile-data-action-icon {
    align-items: center;
    background: color-mix(in srgb, var(--theme-text, #fff) 5%, transparent);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 10px;
    color: var(--theme-text-muted, #cfcfcf);
    display: inline-flex;
    flex-shrink: 0;
    height: 40px;
    justify-content: center;
    width: 40px;
}

#page-chat .profile-workspace .profile-data-action-icon .ui-icon {
    height: 18px;
    width: 18px;
}

#page-chat .profile-workspace .profile-data-action-copy {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

#page-chat .profile-workspace .profile-data-action-title {
    color: var(--theme-text, #f4f4f5);
    font-size: 14px;
    font-weight: 500;
}

#page-chat .profile-workspace .profile-data-action-hint {
    color: var(--theme-text-muted, #8a8a8a);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
}

#page-chat .profile-workspace .profile-data-action-meta {
    color: var(--theme-text-muted, #8a8a8a);
    flex-shrink: 0;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

#page-chat .profile-workspace .profile-data-action-chevron {
    color: var(--theme-text-muted, #6e6e6e);
    flex-shrink: 0;
    height: 16px;
    width: 16px;
}

#page-chat .profile-workspace .profile-data-action.is-danger .profile-data-action-icon {
    border-color: color-mix(in srgb, var(--color-danger) 28%, transparent);
    color: var(--text-danger);
}

#page-chat .profile-workspace .profile-data-action.is-danger .profile-data-action-title {
    color: var(--text-danger);
}

#page-chat .profile-workspace .profile-data-action.is-danger:hover .profile-data-action-title {
    text-shadow: 0 0 14px color-mix(in srgb, var(--color-danger) 35%, transparent);
}

#page-chat .profile-workspace .profile-data-layout.is-ready .profile-data-overview {
    animation: profile-section-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#page-chat .profile-workspace .profile-data-layout.is-ready .profile-data-action {
    animation: profile-section-rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#page-chat .profile-workspace .profile-data-layout.is-ready .profile-data-action:nth-child(1) { animation-delay: 0.08s; }
#page-chat .profile-workspace .profile-data-layout.is-ready .profile-data-action:nth-child(2) { animation-delay: 0.14s; }
#page-chat .profile-workspace .profile-data-layout.is-ready .profile-data-action:nth-child(3) { animation-delay: 0.2s; }
#page-chat .profile-workspace .profile-data-layout.is-ready .profile-data-action:nth-child(4) { animation-delay: 0.26s; }

#page-chat .profile-workspace .profile-data-layout:not(.is-ready) .profile-data-overview,
#page-chat .profile-workspace .profile-data-layout:not(.is-ready) .profile-data-action {
    opacity: 0;
}

@keyframes profile-section-rise {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

#page-chat .profile-workspace .profile-identity-layout:not(.is-ready) > *,
#page-chat .profile-workspace .profile-security-layout:not(.is-ready) .profile-sec-block,
#page-chat .profile-workspace .profile-privacy-layout:not(.is-ready) .profile-sec-kicker,
#page-chat .profile-workspace .profile-privacy-layout:not(.is-ready) .profile-privacy-row,
#page-chat .profile-workspace .profile-appearance-layout:not(.is-ready) .profile-sec-block {
    opacity: 0;
}

#page-chat .profile-workspace .profile-identity-layout.is-ready > *,
#page-chat .profile-workspace .profile-security-layout.is-ready .profile-sec-block,
#page-chat .profile-workspace .profile-privacy-layout.is-ready .profile-sec-kicker,
#page-chat .profile-workspace .profile-privacy-layout.is-ready .profile-privacy-row,
#page-chat .profile-workspace .profile-appearance-layout.is-ready .profile-sec-block {
    animation: profile-section-rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#page-chat .profile-workspace .profile-identity-layout.is-ready > :nth-child(1) { animation-delay: 0s; }
#page-chat .profile-workspace .profile-identity-layout.is-ready > :nth-child(2) { animation-delay: 0.06s; }
#page-chat .profile-workspace .profile-identity-layout.is-ready > :nth-child(3) { animation-delay: 0.12s; }

#page-chat .profile-workspace .profile-security-layout.is-ready .profile-sec-block:nth-child(1) { animation-delay: 0.04s; }
#page-chat .profile-workspace .profile-security-layout.is-ready .profile-sec-block:nth-child(2) { animation-delay: 0.1s; }
#page-chat .profile-workspace .profile-security-layout.is-ready .profile-sec-block:nth-child(3) { animation-delay: 0.16s; }
#page-chat .profile-workspace .profile-security-layout.is-ready .profile-sec-block:nth-child(4) { animation-delay: 0.22s; }

#page-chat .profile-workspace .profile-privacy-layout.is-ready .profile-sec-kicker { animation-delay: 0.04s; }
#page-chat .profile-workspace .profile-privacy-layout.is-ready .profile-privacy-row:nth-child(1) { animation-delay: 0.1s; }
#page-chat .profile-workspace .profile-privacy-layout.is-ready .profile-privacy-row:nth-child(2) { animation-delay: 0.16s; }
#page-chat .profile-workspace .profile-privacy-layout.is-ready .profile-privacy-row:nth-child(3) { animation-delay: 0.22s; }

#page-chat .profile-workspace .profile-appearance-layout.is-ready .profile-sec-block:nth-child(1) { animation-delay: 0.04s; }
#page-chat .profile-workspace .profile-appearance-layout.is-ready .profile-sec-block:nth-child(2) { animation-delay: 0.1s; }
#page-chat .profile-workspace .profile-appearance-layout.is-ready .profile-sec-block:nth-child(3) { animation-delay: 0.16s; }
#page-chat .profile-workspace .profile-appearance-layout.is-ready .profile-sec-block:nth-child(4) { animation-delay: 0.22s; }

@media (max-width: 720px) {
    #page-chat .profile-workspace .profile-data-overview {
        grid-template-columns: 1fr;
        justify-items: center;
        padding: 24px 20px;
        text-align: left;
    }

    #page-chat .profile-workspace .profile-data-legend {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    #page-chat .profile-workspace .profile-data-layout.is-ready .profile-data-overview,
    #page-chat .profile-workspace .profile-data-layout.is-ready .profile-data-action,
    #page-chat .profile-workspace .profile-identity-layout.is-ready .profile-avatar-card,
    #page-chat .profile-workspace .profile-identity-layout.is-ready .profile-about-card,
    #page-chat .profile-workspace .profile-identity-layout.is-ready .profile-form-col > *,
    #page-chat .profile-workspace .profile-security-layout.is-ready .profile-sec-block,
    #page-chat .profile-workspace .profile-privacy-layout.is-ready .profile-sec-kicker,
    #page-chat .profile-workspace .profile-privacy-layout.is-ready .profile-privacy-row,
    #page-chat .profile-workspace .profile-appearance-layout.is-ready .profile-sec-block {
        animation: none;
    }

    #page-chat .profile-workspace .profile-data-layout:not(.is-ready) .profile-data-overview,
    #page-chat .profile-workspace .profile-data-layout:not(.is-ready) .profile-data-action,
    #page-chat .profile-workspace .profile-identity-layout:not(.is-ready) .profile-avatar-card,
    #page-chat .profile-workspace .profile-identity-layout:not(.is-ready) .profile-about-card,
    #page-chat .profile-workspace .profile-identity-layout:not(.is-ready) .profile-form-col > *,
    #page-chat .profile-workspace .profile-security-layout:not(.is-ready) .profile-sec-block,
    #page-chat .profile-workspace .profile-privacy-layout:not(.is-ready) .profile-sec-kicker,
    #page-chat .profile-workspace .profile-privacy-layout:not(.is-ready) .profile-privacy-row,
    #page-chat .profile-workspace .profile-appearance-layout:not(.is-ready) .profile-sec-block {
        opacity: 1;
    }

    #page-chat .profile-workspace .profile-data-donut-seg {
        transition: none;
    }
}

.modal-panel--profile {
    display: flex;
    flex-direction: column;
    height: min(560px, 86vh);
    left: auto;
    max-height: min(560px, 86vh);
    min-height: min(560px, 86vh);
    overflow: hidden;
    padding: 0;
    position: relative;
    top: auto;
    transform: none;
    width: 100%;
}

.profile-shell {
    display: grid;
    grid-template-columns: 132px 1fr;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* ─── Side nav — bordered segments ─── */
.profile-nav {
    align-self: stretch;
    background: color-mix(in srgb, var(--bg-subtle, var(--bg)) 55%, transparent);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-height: 0;
    overflow: hidden;
    padding: 10px 8px;
}

.profile-nav-btn {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    font-family: var(--f-ui);
    font-size: var(--text-caption);
    font-weight: var(--weight-medium);
    gap: 7px;
    padding: 7px 9px;
    text-align: left;
    transition:
        background var(--duration-fast) ease,
        border-color var(--duration-fast) ease,
        color var(--duration-fast) ease,
        box-shadow var(--duration-fast) ease;
    width: 100%;
}

.profile-nav-btn:hover,
.profile-nav-btn:focus-visible {
    background: var(--row-hover);
    border-color: var(--border);
    color: var(--text);
    outline: none;
}

.profile-nav-btn.is-active {
    background: var(--accent-10);
    border-color: color-mix(in srgb, var(--accent) 32%, var(--border-subtle));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
    font-weight: var(--weight-semibold);
}

.profile-nav-icon {
    flex-shrink: 0;
    height: 14px;
    opacity: 0.88;
    width: 14px;
}

/* ─── Main column ─── */
.profile-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.profile-head {
    align-items: center;
    display: flex;
    flex-shrink: 0;
    gap: var(--space-2);
    justify-content: space-between;
    padding: 12px 16px;
}

.profile-head-copy {
    min-width: 0;
}

.profile-head h2 {
    color: var(--text);
    font-family: var(--f-display);
    font-size: var(--text-body);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--track-snug);
    line-height: 1.25;
    margin: 0;
}

.profile-head-sub {
    color: var(--text-tertiary);
    font-size: var(--text-caption);
    line-height: 1.35;
    margin: 2px 0 0;
}

.profile-close-btn {
    flex-shrink: 0;
}

.profile-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: var(--space-2);
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 16px 8px;
}

.profile-body > [data-profile-section] {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: var(--space-2);
    overflow: visible;
}

.profile-body > [data-profile-section].hidden {
    display: none !important;
}

/* ─── Compact preview strip ─── */
.profile-preview-strip {
    align-items: center;
    background: var(--surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    display: flex;
    flex-shrink: 0;
    gap: 10px;
    padding: 10px 12px;
}

.profile-preview-avatar,
.profile-avatar-zone {
    --avatar-hue: 95;
    align-items: center;
    background: linear-gradient(
        145deg,
        color-mix(in srgb, var(--accent) 88%, var(--theme-text, #fff)) 0%,
        var(--accent-strong, var(--accent)) 100%
    );
    border: 1.5px solid color-mix(in srgb, var(--accent) 30%, transparent);
    border-radius: 50%;
    display: flex;
    flex-shrink: 0;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.profile-preview-avatar {
    height: 40px;
    width: 40px;
}

.profile-preview-avatar img,
.profile-avatar-zone img {
    border-radius: 50%;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.profile-preview-avatar span,
.profile-avatar-initials {
    color: var(--theme-text, #fff);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--track-snug);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.profile-preview-avatar span {
    font-size: 15px;
}

.profile-preview-text {
    flex: 1;
    min-width: 0;
}

.profile-preview-name {
    color: var(--text);
    font-size: var(--text-label);
    font-weight: var(--weight-semibold);
    line-height: 1.25;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-preview-bio {
    color: var(--text-secondary);
    font-size: var(--text-caption);
    line-height: 1.35;
    margin: 1px 0 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-preview-bio.is-placeholder {
    color: var(--text-tertiary);
    font-style: italic;
}

/* ─── Cards ─── */
.profile-card {
    background: var(--surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    flex-shrink: 0;
    overflow: hidden;
}

.profile-card-divider {
    background: var(--border-subtle);
    height: 1px;
    margin: 0;
}

.profile-block-title {
    color: var(--text-secondary);
    font-size: var(--text-caption);
    font-weight: var(--weight-semibold);
    letter-spacing: 0.03em;
    margin: 0;
    text-transform: uppercase;
}

/* ─── Identity toolbar ─── */
.profile-identity-toolbar {
    align-items: center;
    display: flex;
    gap: 12px;
    padding: 10px 12px;
}

.profile-avatar-zone {
    cursor: pointer;
    height: 52px;
    transition:
        border-color var(--duration-normal) ease,
        box-shadow var(--duration-normal) ease;
    width: 52px;
}

.profile-avatar-zone--sm {
    height: 48px;
    width: 48px;
}

.profile-avatar-initials {
    font-size: 17px;
}

.profile-avatar-overlay {
    align-items: center;
    background: color-mix(in srgb, var(--text) 42%, transparent);
    border-radius: 50%;
    color: var(--theme-text, #fff);
    display: flex;
    inset: 0;
    justify-content: center;
    opacity: 0;
    position: absolute;
    transition: opacity var(--duration-normal) ease;
}

.profile-avatar-overlay .ui-icon {
    height: 16px;
    width: 16px;
}

.profile-avatar-zone:hover,
.profile-avatar-zone.is-dragover {
    border-color: var(--accent-muted);
    box-shadow: 0 0 0 3px var(--accent-10);
}

.profile-avatar-zone:hover .profile-avatar-overlay,
.profile-avatar-zone.is-dragover .profile-avatar-overlay {
    opacity: 1;
}

.profile-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px 12px;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-field__head {
    align-items: baseline;
    display: flex;
    gap: var(--space-2);
    justify-content: space-between;
}

.profile-field label {
    color: var(--text-secondary);
    font-size: var(--text-caption);
    font-weight: var(--weight-medium);
}

.profile-field input,
.profile-field textarea {
    background: var(--input-fill, var(--surface));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--f-ui);
    font-size: var(--text-meta);
    line-height: 1.4;
    padding: 7px 10px;
    resize: vertical;
    transition:
        border-color var(--duration-fast) ease,
        box-shadow var(--duration-fast) ease;
    width: 100%;
}

.profile-field input:focus,
.profile-field textarea:focus {
    border-color: var(--accent-muted);
    box-shadow: 0 0 0 2px var(--accent-10);
    outline: none;
}

.profile-field-meta {
    color: var(--text-tertiary);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

/* ─── Account IDs ─── */
.profile-id-row {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    padding: 8px 12px;
}

.profile-id-row + .profile-id-row {
    border-top: 1px solid var(--border-subtle);
}

.profile-id-copy {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.profile-id-label {
    color: var(--text-tertiary);
    font-size: 10px;
    font-weight: var(--weight-medium);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.profile-id-value {
    color: var(--text);
    font-family: var(--f-mono);
    font-size: var(--text-caption);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─── Segmented button groups ─── */
.profile-btn-group {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: inline-flex;
    flex-shrink: 0;
    overflow: hidden;
}

.profile-btn-group--stretch {
    display: flex;
    width: 100%;
}

.profile-btn-group--sm {
    border-radius: var(--radius-sm);
}

.profile-btn-group .profile-btn {
    border: none;
    border-radius: 0;
    border-right: 1px solid var(--border-subtle);
    box-shadow: none;
    flex: 1 1 auto;
    min-width: 0;
    padding: 6px 11px;
}

.profile-btn-group--stretch .profile-btn {
    flex: 1;
    text-align: center;
}

.profile-btn-group .profile-btn:last-child {
    border-right: none;
}

.profile-btn-group .profile-btn + .profile-btn {
    margin-left: 0;
}

.profile-copy-btn.is-disabled,
.profile-copy-btn:disabled {
    cursor: not-allowed;
    opacity: 0.4;
    pointer-events: none;
}

/* ─── Security status bar ─── */
.profile-status-group {
    background: var(--surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    display: flex;
    flex-shrink: 0;
    overflow: hidden;
}

.profile-status-chip {
    align-items: center;
    color: var(--green);
    display: flex;
    flex: 1;
    font-size: 10px;
    font-weight: var(--weight-semibold);
    gap: 5px;
    justify-content: center;
    letter-spacing: 0.01em;
    padding: 7px 6px;
    text-align: center;
}

.profile-status-chip + .profile-status-chip {
    border-left: 1px solid var(--border-subtle);
}

.profile-status-chip::before {
    background: var(--green);
    border-radius: 50%;
    content: "";
    flex-shrink: 0;
    height: 5px;
    width: 5px;
}

.profile-card--fingerprint {
    padding: 10px 12px 12px;
}

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

.profile-fingerprint {
    background: var(--row-hover);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.02em;
    line-height: 1.5;
    margin: 0;
    padding: 8px 10px;
    word-break: break-all;
}

/* ─── Privacy toggles ─── */
.profile-toggle-list {
    display: grid;
    gap: 0;
}

.profile-toggle-row {
    align-items: center;
    cursor: pointer;
    display: flex;
    font-size: var(--text-meta);
    gap: var(--space-2);
    justify-content: space-between;
    padding: 10px 12px;
    transition: background var(--duration-fast) ease;
}

.profile-toggle-row:hover {
    background: var(--row-hover);
}

.profile-toggle-row + .profile-toggle-row {
    border-top: 1px solid var(--border-subtle);
}

.profile-toggle-copy {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.profile-toggle-label {
    color: var(--text);
    font-size: var(--text-meta);
    font-weight: var(--weight-medium);
}

.profile-toggle-hint {
    color: var(--text-tertiary);
    font-size: var(--text-caption);
    line-height: 1.35;
}

.profile-toggle-row input {
    accent-color: var(--accent);
    flex-shrink: 0;
    height: 16px;
    width: 16px;
}

/* ─── Data stats ─── */
.profile-stat-row {
    align-items: center;
    display: flex;
    font-size: var(--text-meta);
    justify-content: space-between;
    padding: 8px 12px;
}

.profile-stat-row + .profile-stat-row {
    border-top: 1px solid var(--border-subtle);
}

.profile-stat-row span:first-child {
    color: var(--text-secondary);
}

.profile-stat-row span:last-child {
    color: var(--text);
    font-family: var(--f-mono);
    font-size: var(--text-caption);
    font-variant-numeric: tabular-nums;
    font-weight: var(--weight-medium);
    text-align: right;
}

/* ─── Buttons ─── */
.profile-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    font-family: var(--f-ui);
    font-size: var(--text-caption);
    font-weight: var(--weight-medium);
    padding: 6px 11px;
    transition:
        background var(--duration-fast) ease,
        border-color var(--duration-fast) ease,
        color var(--duration-fast) ease;
}

.profile-btn:hover {
    background: var(--row-hover);
}

.profile-btn--soft {
    background: var(--accent-10);
    color: var(--accent);
}

.profile-btn--soft:hover {
    background: color-mix(in srgb, var(--accent) 16%, var(--surface));
}

.profile-btn--primary {
    background: var(--accent);
    border-color: transparent;
    box-shadow: 0 2px 8px var(--accent-20);
    color: var(--theme-text, #fff);
    font-size: var(--text-meta);
    font-weight: var(--weight-semibold);
    padding: 8px 16px;
}

.profile-btn--primary:hover {
    background: var(--accent-strong, color-mix(in srgb, var(--accent) 85%, var(--theme-section, #000)));
}

.profile-btn--ghost {
    background: transparent;
    color: var(--text-secondary);
}

.profile-btn--ghost:hover {
    background: var(--row-hover);
    color: var(--text);
}

.profile-btn-group .profile-btn--ghost {
    background: transparent;
}

.profile-btn-group .profile-btn--soft {
    background: var(--accent-10);
}

#uiProfileAvatarRemoveBtn:hover {
    color: var(--text-danger);
}

.profile-btn:active {
    transform: scale(0.98);
}

/* ─── Footer ─── */
.profile-foot {
    background: var(--surface-elevated);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-shrink: 0;
    justify-content: flex-end;
    padding: 10px 16px 12px;
}

.profile-foot .profile-btn--primary {
    min-width: 120px;
}

/* ─── Overlay sizing ─── */
.overlay-surface--modal:has(.modal-panel--profile) {
    height: min(560px, 86vh);
    max-height: min(560px, 86vh);
    max-width: min(640px, calc(100vw - 20px));
    min-height: min(560px, 86vh);
    overflow: hidden;
    width: min(600px, calc(100vw - 20px));
}

[data-glass="low"] .modal-panel--profile {
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
}

[data-glass="high"] .modal-panel--profile {
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
}

@media (max-width: 640px) {
    .profile-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .profile-nav {
        border-bottom: 1px solid var(--border-subtle);
        border-right: none;
        flex-direction: row;
        overflow-x: auto;
        padding: 6px;
    }

    .profile-nav-btn {
        flex-shrink: 0;
        white-space: nowrap;
    }

    /* Stack mode owns layout on small screens — keep vertical nav list */
    #page-chat.is-viewport-profile-stack .profile-shell {
        grid-template-rows: 1fr;
    }

    #page-chat.is-viewport-profile-stack .profile-nav {
        border-bottom: none;
        flex-direction: column;
        overflow: auto;
        padding: 0 12px 28px;
    }

    #page-chat.is-viewport-profile-stack .profile-nav-btn {
        flex-shrink: 0;
        white-space: normal;
        width: 100%;
    }

    .profile-identity-toolbar {
        flex-wrap: wrap;
    }

    .profile-foot .profile-btn--primary {
        flex: 1;
        min-width: 0;
    }
}

@media (max-width: 1100px) {
    #page-chat .profile-workspace .profile-identity-layout {
        grid-template-columns: 1fr;
    }

    #page-chat .profile-workspace .profile-identity-aside,
    #page-chat .profile-workspace .profile-form-col {
        width: 100%;
    }
}

@media (max-width: 720px) {
    #page-chat .profile-workspace .profile-field-row {
        grid-template-columns: 1fr;
    }
}

/* ─── Appearance — images/Group 47.png ───────────────────────────────────────
   Header without a bar (round back / close), then a centred two-column grid:
   Theme + Message density stacked on the left, the Chat preview on the right,
   both columns ending on one line. Stacks into one column when narrow. */
#page-chat .profile-workspace:has(:is(.profile-appearance-layout, .security-page, .privacy-page, .data-page, .pf-page):not(.hidden)) {
    --appearance-max: 1150px;
}

#page-chat:not(.is-viewport-profile-stack) .profile-workspace:has(:is(.profile-appearance-layout, .security-page, .privacy-page, .data-page, .pf-page):not(.hidden)) .profile-head {
    align-self: center;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    box-sizing: border-box;
    gap: 14px;
    margin: 28px auto 0;
    max-width: var(--appearance-max);
    padding: 0;
    width: calc(100% - 64px);
}

#page-chat:not(.is-viewport-profile-stack) .profile-workspace:has(:is(.profile-appearance-layout, .security-page, .privacy-page, .data-page, .pf-page):not(.hidden)) .profile-head h2 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

#page-chat:not(.is-viewport-profile-stack) .profile-workspace:has(:is(.profile-appearance-layout, .security-page, .privacy-page, .data-page, .pf-page):not(.hidden)) .profile-head-sub {
    font-size: 13px;
    margin-top: 3px;
}

#page-chat:not(.is-viewport-profile-stack) .profile-workspace:has(:is(.profile-appearance-layout, .security-page, .privacy-page, .data-page, .pf-page):not(.hidden)) :is(.profile-back-btn, .profile-close-btn) {
    background: var(--settings-capsule-bg);
    border: 1px solid var(--settings-capsule-stroke);
    border-radius: 50%;
    color: var(--theme-text, #f4f4f5);
    flex: none;
    height: 42px;
    width: 42px;
}

#page-chat:not(.is-viewport-profile-stack) .profile-workspace:has(:is(.profile-appearance-layout, .security-page, .privacy-page, .data-page, .pf-page):not(.hidden)) .profile-back-btn .ui-icon {
    height: 18px;
    width: 18px;
}

#page-chat:not(.is-viewport-profile-stack) .profile-workspace:has(:is(.profile-appearance-layout, .security-page, .privacy-page, .data-page, .pf-page):not(.hidden)) .profile-body {
    padding-top: 30px;
}

#page-chat .profile-workspace .profile-appearance-layout {
    align-self: center;
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    max-width: var(--appearance-max, 1150px);
    min-width: 0;
    width: 100%;
}

#page-chat .profile-workspace .appearance-grid {
    align-items: stretch;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(300px, 372px) minmax(0, 1fr);
}

#page-chat .profile-workspace .appearance-col {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

@container (max-width: 820px) {
    #page-chat .profile-workspace .appearance-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

#page-chat .profile-workspace .appearance-card {
    background: var(--settings-capsule-bg);
    backdrop-filter: var(--settings-capsule-blur);
    -webkit-backdrop-filter: var(--settings-capsule-blur);
    border: 1px solid var(--settings-capsule-stroke);
    border-radius: 28px;
    box-shadow:
        var(--glass-inset-highlight),
        var(--nexa-surface-shadow);
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 26px 24px 24px;
}

/* Message density fills the rest of the column; the segment sits at its foot. */
#page-chat .profile-workspace .appearance-card--density {
    flex: 1;
}

#page-chat .profile-workspace .appearance-card--preview {
    padding-top: 22px;
}

#page-chat .profile-workspace .appearance-card__head {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 16px;
}

#page-chat .profile-workspace .appearance-kicker {
    color: var(--theme-text-muted, #8a8a8a);
    font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.16em;
    line-height: 1.2;
    margin: 0;
    text-transform: uppercase;
}

#page-chat .profile-workspace .appearance-lead {
    color: var(--theme-text-muted, #8a8a8a);
    font-size: 12.5px;
    line-height: 1.5;
    margin: 10px 0 0;
}

/* "Active theme" · "Previewing" (another theme's card is hovered). */
#page-chat .profile-workspace .appearance-status-pill {
    align-items: center;
    background: var(--settings-inner-fill);
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 999px;
    color: var(--theme-text, #f4f4f5);
    display: inline-flex;
    font-size: 12px;
    font-weight: 500;
    gap: 8px;
    height: 30px;
    padding: 0 12px 0 11px;
}

#page-chat .profile-workspace .appearance-status-pill__dot {
    background: var(--accent-primary, #c7ff00);
    border-radius: 50%;
    height: 7px;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    width: 7px;
}

#page-chat .profile-workspace .appearance-card.is-browsing .appearance-status-pill__dot {
    opacity: 0.45;
}

#page-chat .profile-workspace .appearance-card:not(.is-browsing) .is-browse-label,
#page-chat .profile-workspace .appearance-card.is-browsing .is-active-label {
    display: none;
}

/* Message density: a pill track with a sliding accent thumb. */
#page-chat .profile-workspace .appearance-segment {
    background: var(--settings-inner-fill);
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 999px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: auto;
    padding: 4px;
    position: relative;
}

#page-chat .profile-workspace .appearance-card--density .appearance-lead {
    margin-bottom: 40px;
}

#page-chat .profile-workspace .appearance-segment::before {
    background: var(--accent-primary, #c7ff00);
    border-radius: 999px;
    bottom: 4px;
    content: "";
    left: 4px;
    position: absolute;
    top: 4px;
    transition: transform 0.34s cubic-bezier(0.16, 1, 0.3, 1);
    width: calc(50% - 4px);
}

#page-chat .profile-workspace .appearance-segment:has([data-appearance-density="compact"].is-active)::before {
    transform: translateX(100%);
}

#page-chat .profile-workspace .appearance-segment .appearance-chip {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: var(--theme-text, #f4f4f5);
    cursor: pointer;
    display: inline-flex;
    font-family: var(--f-ui);
    font-size: 13px;
    font-weight: 500;
    gap: 8px;
    height: 36px;
    justify-content: center;
    padding: 0 14px;
    position: relative;
    transition: color 0.22s ease, opacity 0.18s ease;
    z-index: 1;
}

#page-chat .profile-workspace .appearance-segment .appearance-chip:not(.is-active) {
    opacity: 0.82;
}

#page-chat .profile-workspace .appearance-segment .appearance-chip:not(.is-active):hover {
    opacity: 1;
}

#page-chat .profile-workspace .appearance-segment .appearance-chip:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--theme-tint, #fff) 40%, transparent);
    outline-offset: 2px;
}

#page-chat .profile-workspace .appearance-segment .appearance-chip.is-active {
    color: var(--text-on-accent, #0b0b0b);
    font-weight: 600;
}

#page-chat .profile-workspace .appearance-chip__icon {
    fill: none;
    height: 15px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.5;
    width: 15px;
}

@media (prefers-reduced-motion: reduce) {
    #page-chat .profile-workspace .appearance-segment::before {
        transition: none;
    }
}

#page-chat .profile-workspace .appearance-option-card {
    background: var(--settings-inner-fill);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 14px;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 18px;
}

#page-chat .profile-workspace .appearance-option-card + .appearance-option-card {
    margin-top: 10px;
}

#page-chat .profile-workspace .appearance-option-card--level {
    gap: 0;
    padding: 12px 14px 14px;
}

#page-chat .profile-workspace .appearance-option-head {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

#page-chat .profile-workspace .appearance-option-copy {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

#page-chat .profile-workspace .appearance-option-title {
    color: var(--theme-text, #f4f4f5);
    font-size: 14px;
    font-weight: 500;
    margin: 0;
}

#page-chat .profile-workspace .appearance-option-hint {
    color: var(--theme-text-muted, #8a8a8a);
    font-size: 12px;
    line-height: 1.45;
    margin: 0;
}

#page-chat .profile-workspace .appearance-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#page-chat .profile-workspace .appearance-chip {
    background: var(--settings-inner-fill);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 999px;
    box-shadow: none;
    color: var(--theme-text-muted, #a1a1aa);
    cursor: pointer;
    font-family: var(--f-ui);
    font-size: 12.5px;
    font-weight: 500;
    padding: 8px 14px;
    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease;
}

#page-chat .profile-workspace .appearance-chip:hover,
#page-chat .profile-workspace .appearance-chip:focus-visible {
    background: color-mix(in srgb, var(--theme-text, #fff) 7%, transparent);
    color: var(--theme-text, #f4f4f5);
    outline: none;
}

#page-chat .profile-workspace .appearance-chip.is-active {
    background: color-mix(in srgb, var(--theme-text, #fff) 10%, transparent);
    border-color: color-mix(in srgb, var(--theme-tint, #fff) 12%, transparent);
    color: var(--theme-text, #fff);
}

/* ── Identity (Profile) — header card · page header · rows card ──────────── */
#page-chat .profile-workspace .profile-identity-layout {
    --ps-card-bg: #12141c;
    --ps-field-bg: #0d0f14;
    --ps-line: rgba(255, 255, 255, 0.08);
    --ps-accent: #34d399;
}

/* Buttons shared by the header card and the page header. */
#page-chat .profile-workspace .ps-btn {
    align-items: center;
    border-radius: 999px;
    box-sizing: border-box;
    cursor: pointer;
    display: inline-flex;
    flex: none;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    gap: 6px;
    height: 36px;
    justify-content: center;
    padding: 0 14px;
    text-decoration: none;
    transition:
        background-color 0.16s ease,
        border-color 0.16s ease,
        color 0.16s ease,
        opacity 0.16s ease,
        transform 0.16s ease;
    white-space: nowrap;
}

#page-chat .profile-workspace .ps-btn .ui-icon {
    height: 13px;
    width: 13px;
}

#page-chat .profile-workspace .ps-btn--ghost {
    background: var(--ps-field-bg);
    border: 1px solid var(--ps-line);
    color: var(--theme-text-muted, #d4d4d8);
}

#page-chat .profile-workspace .ps-btn--ghost:hover:not(:disabled):not([aria-disabled="true"]) {
    background: #1a1d27;
    border-color: color-mix(in srgb, var(--theme-tint, #ffffff) 14%, transparent);
    color: var(--theme-text, #fff);
}

#page-chat .profile-workspace .ps-btn--primary {
    background: var(--theme-text, #f4f4f5);
    border: 1px solid var(--theme-tint, #f4f4f5);
    color: var(--theme-bg, #0a0a0a);
}

#page-chat .profile-workspace .ps-btn--primary:hover:not(:disabled) {
    background: var(--theme-text, #fff);
}

#page-chat .profile-workspace .ps-btn:active:not(:disabled) {
    transform: scale(0.97);
}

#page-chat .profile-workspace .ps-btn:disabled,
#page-chat .profile-workspace .ps-btn[aria-disabled="true"] {
    cursor: default;
    opacity: 0.4;
    pointer-events: none;
}

#page-chat .profile-workspace .ps-btn:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--theme-tint, #fff) 45%, transparent);
    outline-offset: 2px;
}

/* 1. Header card — ambient banner tinted by the avatar (js: syncHeaderAmbient).
   The glow uses the avatar's own palette: --ps-ambient-glow (main colour),
   -2 and -3 (next colours of the photo, or shades of the main one).
   Stack: card base · glow that is richest at the RIGHT edge and fades out
   toward the left (z 1) · a scrim that shields the text column on the left
   and clears by the middle (z 1, above the glow) · content (z 2). */
@property --ps-ambient-glow {
    syntax: '<color>';
    inherits: true;
    initial-value: #4a5578;
}

@property --ps-ambient-glow-2 {
    syntax: '<color>';
    inherits: true;
    initial-value: #3d4a6b;
}

@property --ps-ambient-glow-3 {
    syntax: '<color>';
    inherits: true;
    initial-value: #5a6690;
}

#page-chat .profile-workspace .ps-header {
    --ps-banner-base: #0d0f14;
    align-items: center;
    background: var(--ps-banner-base);
    border: 1px solid var(--ps-line);
    border-radius: 20px;
    display: flex;
    gap: 16px;
    isolation: isolate;
    min-width: 0;
    overflow: hidden;
    padding: 20px 24px;
    position: relative;
    transition:
        --ps-ambient-glow 0.5s ease,
        --ps-ambient-glow-2 0.5s ease,
        --ps-ambient-glow-3 0.5s ease;
}

/* Glow: right → left, in the avatar's colours. The main colour pools at the
   right edge; the second and third bloom above and below it, and a wash that
   blends main → second fades out before the text column. Bleeds past the
   edges so the blur doesn't leave a dark rim (the card clips it).
   Strength is theme-dependent (--amb-*): a delicate glow on dark, a barely-
   there pastel on the light themes (below). */
#page-chat .profile-workspace .ps-header {
    --amb-edge: 30%;
    --amb-mid: 10%;
    --amb-mid-at: 50%;
    --amb-end: 90%;
    --amb-pool: 30%;
    --amb-bloom: 22%;
}

html[data-theme^="light"] #page-chat .profile-workspace .ps-header {
    --amb-edge: 12%;
    --amb-mid: 3%;
    --amb-end: 85%;
    --amb-pool: 12%;
    --amb-bloom: 9%;
}

#page-chat .profile-workspace .ps-header::before {
    background:
        radial-gradient(
            circle at 90% 50%,
            color-mix(in srgb, var(--ps-ambient-glow) var(--amb-pool), transparent) 0%,
            transparent 55%
        ),
        radial-gradient(
            ellipse 45% 90% at 72% 0%,
            color-mix(in srgb, var(--ps-ambient-glow-2) var(--amb-bloom), transparent) 0%,
            transparent 100%
        ),
        radial-gradient(
            ellipse 40% 90% at 80% 100%,
            color-mix(in srgb, var(--ps-ambient-glow-3) var(--amb-bloom), transparent) 0%,
            transparent 100%
        ),
        linear-gradient(
            270deg,
            color-mix(in srgb, var(--ps-ambient-glow) var(--amb-edge), transparent) 0%,
            color-mix(in srgb, var(--ps-ambient-glow-2) var(--amb-mid), transparent) var(--amb-mid-at),
            transparent var(--amb-end)
        );
    content: "";
    filter: blur(32px);
    inset: -32px;
    pointer-events: none;
    position: absolute;
    z-index: 1;
}

/* Light themes: multiply the pastel into the white card, so it tints rather
   than washes the surface. */
html[data-theme^="light"] #page-chat .profile-workspace .ps-header::before {
    mix-blend-mode: multiply;
}

/* Scrim: the card's own colour over the left (text) side only, clearing by
   the middle — name, handle and bio stay fully legible while the right keeps
   the full colour. */
#page-chat .profile-workspace .ps-header::after {
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--ps-banner-base) 70%, transparent) 0%,
        color-mix(in srgb, var(--ps-banner-base) 40%, transparent) 40%,
        transparent 70%
    );
    content: "";
    inset: 0;
    pointer-events: none;
    position: absolute;
    z-index: 1;
}

/* Content above both layers. */
#page-chat .profile-workspace .ps-header > * {
    position: relative;
    z-index: 2;
}

/* Avatar: a circle with clean edges, thin border, neutral fill. */
#page-chat .profile-workspace .ps-header__avatar.profile-avatar-zone {
    align-items: center;
    background: #151822;
    border: 1px solid color-mix(in srgb, var(--theme-tint, #ffffff) 10%, transparent);
    border-radius: 50%;
    box-shadow: none;
    color: var(--theme-text-muted, #d4d4d8);
    cursor: pointer;
    display: flex;
    flex: none;
    height: 64px;
    justify-content: center;
    overflow: hidden;
    width: 64px;
}

#page-chat .profile-workspace .ps-header__avatar img {
    height: 100%;
    inset: 0;
    object-fit: cover;
    position: absolute;
    width: 100%;
}

/* Text block, vertically centred on the avatar (the card aligns items center). */
#page-chat .profile-workspace .ps-header__copy {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    justify-content: center;
    min-width: 0;
}

#page-chat .profile-workspace .ps-header__name {
    align-items: center;
    color: var(--theme-text, #f4f4f5);
    display: flex;
    font-size: 22px;
    font-weight: 700;
    gap: 8px;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0;
    min-width: 0;
}

#page-chat .profile-workspace .ps-header__name > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Scaled with the 22px name; centred on its line box by the flex row. */
#page-chat .profile-workspace .ps-header__verified {
    color: var(--ps-accent);
    flex: none;
    height: 20px;
    width: 20px;
}

#page-chat .profile-workspace .ps-header__link {
    color: var(--theme-text-muted, #8a8a8a);
    font-size: 13px;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Bio (or status), up to two lines. */
#page-chat .profile-workspace .ps-header__bio {
    -webkit-box-orient: vertical;
    color: color-mix(in srgb, var(--theme-text, #ffffff) 70%, transparent);
    display: -webkit-box;
    font-size: 13px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    line-height: 1.45;
    margin: 4px 0 0;
    max-width: 500px;
    overflow: hidden;
    overflow-wrap: anywhere;
}

/* 2. Page header: title + actions. */
#page-chat .profile-workspace .ps-pagehead {
    align-items: flex-end;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-top: 8px;
}

#page-chat .profile-workspace .ps-pagehead__copy {
    min-width: 0;
}

#page-chat .profile-workspace .ps-pagehead__title {
    color: var(--theme-text, #f4f4f5);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
    margin: 0 0 4px;
}

#page-chat .profile-workspace .ps-pagehead__sub {
    color: var(--text-tertiary, var(--theme-text-muted, #71717a));
    font-size: 13px;
    line-height: 1.45;
    margin: 0;
}

#page-chat .profile-workspace .ps-pagehead__actions {
    display: flex;
    flex: none;
    gap: 8px;
}

/* 3. Rows card. */
#page-chat .profile-workspace .ps-card {
    background: var(--ps-card-bg);
    border: 1px solid var(--ps-line);
    border-radius: 20px;
    overflow: visible;
}

#page-chat .profile-workspace .ps-row {
    border-bottom: 1px solid var(--ps-line);
    display: grid;
    gap: 32px;
    grid-template-columns: minmax(0, 35fr) minmax(0, 65fr);
    padding: 22px 24px;
}

#page-chat .profile-workspace .ps-row:last-child {
    border-bottom: 0;
}

#page-chat .profile-workspace .ps-row__title {
    color: var(--theme-text, #f4f4f5);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    margin: 0 0 4px;
}

#page-chat .profile-workspace .ps-row__desc {
    color: var(--text-tertiary, var(--theme-text-muted, #71717a));
    font-size: 13px;
    line-height: 1.45;
    margin: 0;
}

#page-chat .profile-workspace .ps-row__body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

@container (max-width: 640px) {
    #page-chat .profile-workspace .ps-row {
        gap: 12px;
        grid-template-columns: minmax(0, 1fr);
        padding: 18px;
    }

    #page-chat .profile-workspace .ps-pagehead {
        align-items: flex-start;
        flex-direction: column;
    }

    #page-chat .profile-workspace .ps-header {
        flex-wrap: wrap;
    }
}

#page-chat .profile-workspace .ps-sr-only {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

/* Inputs: dark fill, hairline, 8px radius; 40px single-line. */
#page-chat .profile-workspace .ps-card input[type="text"],
#page-chat .profile-workspace .ps-card textarea {
    background: var(--ps-field-bg);
    border: 1px solid var(--ps-line);
    border-radius: 8px;
    box-sizing: border-box;
    color: var(--theme-text, #f4f4f5);
    font: inherit;
    font-size: 14px;
    transition:
        border-color 0.15s ease,
        background-color 0.15s ease;
    width: 100%;
}

#page-chat .profile-workspace .ps-card input[type="text"] {
    height: 40px;
    padding: 0 12px;
}

#page-chat .profile-workspace .ps-card input[type="text"]:focus,
#page-chat .profile-workspace .ps-card textarea:focus {
    border-color: color-mix(in srgb, var(--theme-tint, #ffffff) 22%, transparent);
    outline: none;
}

#page-chat .profile-workspace .ps-input {
    position: relative;
}

#page-chat .profile-workspace .ps-card .ps-input input[type="text"] {
    padding-right: 64px;
}

#page-chat .profile-workspace .ps-input__count {
    color: var(--theme-text-muted, #a1a1aa);
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    opacity: 0.5;
    pointer-events: none;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

#page-chat .profile-workspace .ps-card .ps-input--area textarea {
    display: block;
    height: 112px;
    line-height: 1.5;
    padding: 10px 12px 22px;
    resize: none;
}

#page-chat .profile-workspace .ps-input--area .ps-input__count {
    bottom: 8px;
    top: auto;
    transform: none;
}

/* Link: [ nexa.to/ | username | Copy ]. */
#page-chat .profile-workspace .ps-prefix-input {
    align-items: center;
    background: var(--ps-field-bg);
    border: 1px solid var(--ps-line);
    border-radius: 8px;
    box-sizing: border-box;
    display: flex;
    height: 40px;
    min-width: 0;
    overflow: hidden;
}

#page-chat .profile-workspace .ps-prefix-input__prefix {
    align-items: center;
    align-self: stretch;
    background: color-mix(in srgb, var(--theme-text, #ffffff) 4%, transparent);
    border-right: 1px solid var(--ps-line);
    color: var(--theme-text-muted, #8a8a8a);
    display: flex;
    flex: none;
    font-size: 13.5px;
    padding: 0 12px;
}

#page-chat .profile-workspace .ps-prefix-input__value {
    color: var(--theme-text, #f4f4f5);
    flex: 1;
    font-size: 14px;
    min-width: 0;
    overflow: hidden;
    padding: 0 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#page-chat .profile-workspace .ps-prefix-input .profile-field-action {
    margin-right: 4px;
    padding: 5px 10px;
}

#page-chat .profile-workspace .ps-row .profile-field-hint {
    margin: -4px 0 0;
}

/* Photo: the dropzone alone; "Remove photo" under it only while there's a photo
   (the header avatar's <img> is .hidden when there isn't). */
#page-chat .profile-workspace .ps-photo {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
}

#page-chat .profile-workspace .ps-photo__remove {
    align-self: flex-start;
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: var(--theme-text-muted, #8a8a8a);
    cursor: pointer;
    font: inherit;
    font-size: 12.5px;
    padding: 4px 10px;
    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}

#page-chat .profile-workspace .ps-photo__remove:hover {
    background: color-mix(in srgb, var(--color-danger) 12%, transparent);
    color: var(--text-danger);
}

#page-chat .profile-workspace .ps-photo__remove:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--theme-tint, #fff) 45%, transparent);
    outline-offset: 2px;
}

#page-chat .profile-workspace .profile-identity-layout:has(#uiProfileAvatarImg.hidden) .ps-photo__remove {
    display: none;
}

#page-chat .profile-workspace .ps-dropzone {
    align-items: center;
    background: var(--ps-field-bg);
    border: 1px dashed color-mix(in srgb, var(--theme-tint, #ffffff) 16%, transparent);
    border-radius: 12px;
    box-sizing: border-box;
    color: var(--theme-text-muted, #a1a1aa);
    cursor: pointer;
    display: flex;
    flex: 1;
    flex-direction: column;
    font: inherit;
    gap: 4px;
    min-width: 0;
    padding: 18px 16px;
    text-align: center;
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease;
}

/* Hover / drag-over: only the dashed outline lights up — the fill stays put. */
#page-chat .profile-workspace .ps-dropzone:hover,
#page-chat .profile-workspace .ps-dropzone.is-dragover {
    border-color: color-mix(in srgb, var(--ps-accent) 55%, transparent);
}

#page-chat .profile-workspace .ps-dropzone:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--theme-tint, #fff) 45%, transparent);
    outline-offset: 2px;
}

#page-chat .profile-workspace .ps-dropzone__icon {
    align-items: center;
    background: color-mix(in srgb, var(--ps-accent) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--ps-accent) 24%, transparent);
    border-radius: 10px;
    color: var(--ps-accent);
    display: inline-flex;
    height: 36px;
    justify-content: center;
    margin-bottom: 6px;
    width: 36px;
}

#page-chat .profile-workspace .ps-dropzone__icon .ui-icon {
    height: 16px;
    width: 16px;
}

#page-chat .profile-workspace .ps-dropzone__text {
    font-size: 13px;
}

#page-chat .profile-workspace .ps-dropzone__text strong {
    color: var(--ps-accent);
    font-weight: 600;
}

#page-chat .profile-workspace .ps-dropzone__hint {
    color: var(--text-tertiary, var(--theme-text-muted, #71717a));
    font-size: 12px;
}

/* 4. Status: carousel-style switcher (StatusSwitcher.tsx) over a hidden select.
   Colours (tint, arrows, active dot, label) are animated inline per status. */
#page-chat .profile-workspace .ps-select__native {
    height: 1px;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    width: 1px;
}

#page-chat .profile-workspace .ps-status {
    display: flex;
    min-height: 44px;
}

#page-chat .profile-workspace .status-switcher {
    align-items: center;
    border: 1px solid var(--ps-line);
    border-radius: 999px;
    display: inline-flex;
    gap: 4px;
    padding: 6px;
}

#page-chat .profile-workspace .status-switcher__arrow {
    align-items: center;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    flex: none;
    height: 32px;
    justify-content: center;
    padding: 0;
    width: 32px;
}

#page-chat .profile-workspace .status-switcher__dots {
    align-items: center;
    display: flex;
    gap: 6px;
    padding: 0 8px;
}

#page-chat .profile-workspace .status-switcher__dot {
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    flex: none;
    height: 8px;
    padding: 0;
    /* Bigger hit area than the 8px dot. */
    position: relative;
}

#page-chat .profile-workspace .status-switcher__dot::before {
    content: "";
    inset: -8px -3px;
    position: absolute;
}

#page-chat .profile-workspace .status-switcher__dot:focus-visible,
#page-chat .profile-workspace .status-switcher__arrow:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--theme-tint, #fff) 45%, transparent);
    outline-offset: 3px;
}

#page-chat .profile-workspace .status-switcher__label {
    font-size: 13px;
    font-weight: 500;
    min-width: 64px;
    padding: 0 10px 0 6px;
}

@media (prefers-reduced-motion: reduce) {
    #page-chat .profile-workspace .ps-btn {
        animation: none;
        transition: none;
    }
}

/* ── Security — images/Group 45.png ──────────────────────────────────────────
   Three columns centred like Appearance: the hero (2 cols) + device identity,
   the three key cards, then Manage devices across. Cards share the settings
   capsule look; accents follow the theme. */
#page-chat .profile-workspace .profile-security-layout.security-page {
    align-self: center;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    container-type: inline-size;
    display: flex;
    max-width: var(--appearance-max, 1150px);
    padding: 0;
}

#page-chat .profile-workspace .security-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

#page-chat .profile-workspace .sec-card {
    background: var(--settings-capsule-bg);
    backdrop-filter: var(--settings-capsule-blur);
    -webkit-backdrop-filter: var(--settings-capsule-blur);
    border: 1px solid var(--settings-capsule-stroke);
    border-radius: 28px;
    box-shadow:
        var(--glass-inset-highlight),
        var(--nexa-surface-shadow);
    color: var(--theme-text, #f4f4f5);
    min-width: 0;
    padding: 24px;
    position: relative;
}

#page-chat .profile-workspace .sec-kicker {
    color: var(--theme-text-muted, #8a8a8a);
    font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.16em;
    line-height: 1.2;
    margin: 0;
    text-transform: uppercase;
}

#page-chat .profile-workspace .sec-card__head {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

#page-chat .profile-workspace .sec-card__title {
    color: var(--theme-text, #f4f4f5);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 12px 0 0;
}

#page-chat .profile-workspace .sec-pill {
    align-items: center;
    background: var(--settings-inner-fill);
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 999px;
    color: var(--theme-text, #f4f4f5);
    display: inline-flex;
    flex: none;
    font-size: 12px;
    font-weight: 500;
    gap: 8px;
    height: 30px;
    padding: 0 13px 0 12px;
    width: max-content;
}

#page-chat .profile-workspace .sec-pill--sm {
    font-size: 11px;
    gap: 7px;
    height: 28px;
    padding: 0 11px 0 7px;
}

#page-chat .profile-workspace .sec-pill__dot {
    background: var(--accent-primary, #c7ff00);
    border-radius: 50%;
    height: 7px;
    width: 7px;
}

#page-chat .profile-workspace .sec-pill__dot.is-ring {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary, #c7ff00) 28%, transparent);
    height: 8px;
    margin-left: 3px;
    width: 8px;
}

/* Hero: copy on the left, the lock + rings on the right (clipped by the card). */
#page-chat .profile-workspace .sec-hero {
    display: flex;
    grid-column: span 2;
    min-height: 256px;
    overflow: hidden;
    padding: 32px;
}

#page-chat .profile-workspace .sec-hero__copy {
    display: flex;
    flex-direction: column;
    max-width: 440px;
    justify-content: center;
    min-width: 0;
    position: relative;
    z-index: 1;
}

#page-chat .profile-workspace .sec-hero__title {
    color: var(--theme-text, #f4f4f5);
    font-family: var(--f-ui);
    font-size: 44px;
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.02;
    margin: 22px 0 18px;
}

#page-chat .profile-workspace .sec-hero__text {
    color: var(--theme-text-muted, #8a8a8a);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

#page-chat .profile-workspace .sec-hero__status {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    font-size: 13px;
    gap: 8px;
    margin: 14px 0 0;
}

#page-chat .profile-workspace .sec-hero__badge {
    fill: var(--accent-primary, #c7ff00);
    flex: none;
    height: 18px;
    margin-right: 4px;
    width: 18px;
}

#page-chat .profile-workspace .sec-hero__badge-check {
    fill: none;
    stroke: var(--text-on-accent, #0b0b0b);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

#page-chat .profile-workspace .sec-hero__verified {
    color: var(--theme-text-muted, #8a8a8a);
    font-weight: 600;
}

#page-chat .profile-workspace .sec-hero__verified.is-verified {
    color: var(--accent-primary, #c7ff00);
}

/* Keys not loaded: the badge goes quiet. */
#page-chat .profile-workspace .sec-hero__status:not(:has(.is-verified)) .sec-hero__badge {
    fill: color-mix(in srgb, var(--theme-text-muted, #8a8a8a) 45%, transparent);
}

#page-chat .profile-workspace .sec-hero__hint {
    color: var(--theme-text-muted, #8a8a8a);
}

#page-chat .profile-workspace .sec-hero__art {
    height: 400px;
    pointer-events: none;
    position: absolute;
    right: -72px;
    top: 50%;
    transform: translateY(-50%);
    width: 400px;
}

#page-chat .profile-workspace .sec-hero__rings {
    fill: none;
    height: 100%;
    inset: 0;
    position: absolute;
    width: 100%;
}

#page-chat .profile-workspace .sec-hero__rings circle {
    stroke-width: 1;
    /* The circles sit on the viewBox origin (0, 0): spin around it. */
    transform-origin: 0 0;
}

#page-chat .profile-workspace .sec-hero__rings .is-solid {
    stroke: color-mix(in srgb, var(--theme-tint, #ffffff) 7%, transparent);
}

#page-chat .profile-workspace .sec-hero__rings .is-dashed {
    animation: sec-ring-spin 60s linear infinite;
    stroke: color-mix(in srgb, var(--accent-primary, #c7ff00) 55%, transparent);
    stroke-dasharray: 2 4;
}

#page-chat .profile-workspace .sec-hero__rings .is-outer {
    animation: sec-ring-spin 120s linear infinite reverse;
    stroke: color-mix(in srgb, var(--accent-primary, #c7ff00) 35%, transparent);
    stroke-dasharray: 2 5;
}

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

#page-chat .profile-workspace .sec-hero__lock {
    align-items: center;
    background: var(--accent-primary, #c7ff00);
    border-radius: 50%;
    box-shadow: 0 0 48px color-mix(in srgb, var(--accent-primary, #c7ff00) 22%, transparent);
    color: var(--text-on-accent, #0b0b0b);
    display: flex;
    height: 86px;
    justify-content: center;
    left: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 86px;
}

#page-chat .profile-workspace .sec-hero__lock .ui-icon {
    height: 32px;
    stroke-width: 1.8;
    width: 32px;
}

/* Device identity: laptop in the theme, Platform / System tiles. */
#page-chat .profile-workspace .sec-device {
    display: flex;
    flex-direction: column;
    padding: 24px;
}

#page-chat .profile-workspace .sec-device__art {
    align-self: center;
    height: 86px;
    margin: 12px 0 14px;
    width: 140px;
}

#page-chat .profile-workspace .sec-device__art .is-body {
    fill: var(--settings-inner-fill);
    stroke: color-mix(in srgb, var(--theme-tint, #ffffff) 16%, transparent);
    stroke-width: 1.5;
}

#page-chat .profile-workspace .sec-device__art .is-screen {
    fill: color-mix(in srgb, var(--bg-main, #070707) 80%, transparent);
}

#page-chat .profile-workspace .sec-device__art .is-ring {
    fill: none;
    stroke: var(--accent-primary, #c7ff00);
    stroke-dasharray: 2 2.5;
    stroke-width: 1.2;
}

#page-chat .profile-workspace .sec-device__art .is-dot {
    fill: var(--accent-primary, #c7ff00);
}

#page-chat .profile-workspace .sec-device__art .is-base {
    fill: var(--settings-inner-fill);
    stroke: color-mix(in srgb, var(--theme-tint, #ffffff) 16%, transparent);
    stroke-linejoin: round;
    stroke-width: 1.5;
}

#page-chat .profile-workspace .sec-device__tiles {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr 1fr;
    margin-top: auto;
}

#page-chat .profile-workspace .sec-tile {
    background: var(--settings-inner-fill);
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding: 10px 12px;
}

#page-chat .profile-workspace .sec-tile__label {
    color: var(--theme-text-muted, #8a8a8a);
    font-size: 11px;
}

#page-chat .profile-workspace .sec-tile__value {
    color: var(--theme-text, #f4f4f5);
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Key cards: kicker + ↗, label, big mono value, strength segments. */
#page-chat .profile-workspace .sec-key {
    display: flex;
    flex-direction: column;
    min-height: 170px;
    transition: border-color 0.2s ease;
}

/* Identity key opens the full fingerprint: the whole card is the target and
   outlines in the accent on hover. Message cipher is information only —
   no hover, no pointer, no arrow. */
#page-chat .profile-workspace .sec-key--action {
    cursor: pointer;
}

/* Same head height with or without the ↗, so both cards' labels line up. */
#page-chat .profile-workspace .sec-key .sec-card__head {
    min-height: 24px;
}

#page-chat .profile-workspace .sec-key--action:hover,
#page-chat .profile-workspace .sec-key--action:focus-within {
    border-color: color-mix(in srgb, var(--accent-primary, #ccff00) 60%, transparent);
}

#page-chat .profile-workspace .sec-key--action:hover .sec-arrow-btn {
    background: var(--settings-inner-fill);
    border-color: color-mix(in srgb, var(--accent-primary, #ccff00) 45%, transparent);
    color: var(--accent-primary, #ccff00);
}

/* Fingerprint: anywhere over the card lights it softly (the code is copyable). */
#page-chat .profile-workspace .sec-fp {
    transition: border-color 0.2s ease;
}

#page-chat .profile-workspace .sec-fp:hover,
#page-chat .profile-workspace .sec-fp:has(.sec-copy-btn:focus-visible) {
    border-color: color-mix(in srgb, var(--accent-primary, #ccff00) 40%, transparent);
}

#page-chat .profile-workspace .sec-arrow-btn {
    align-items: center;
    background: transparent;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 50%;
    color: var(--theme-text, #f4f4f5);
    display: inline-flex;
    flex: none;
    height: 32px;
    justify-content: center;
    margin: -8px -4px 0 0;
    padding: 0;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    width: 32px;
}

#page-chat .profile-workspace button.sec-arrow-btn {
    cursor: pointer;
}

#page-chat .profile-workspace button.sec-arrow-btn:hover,
#page-chat .profile-workspace button.sec-arrow-btn:focus-visible {
    background: var(--settings-inner-fill);
    border-color: color-mix(in srgb, var(--theme-tint, #ffffff) 22%, transparent);
    outline: none;
}

#page-chat .profile-workspace .sec-arrow-btn.is-open {
    transform: rotate(90deg);
}

#page-chat .profile-workspace .sec-arrow-btn svg {
    fill: none;
    height: 14px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.5;
    width: 14px;
}

#page-chat .profile-workspace .sec-key__label {
    color: var(--theme-text, #f4f4f5);
    font-size: 14px;
    margin: 22px 0 6px;
}

#page-chat .profile-workspace .sec-key__value {
    color: var(--theme-text, #f4f4f5);
    font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
    font-size: 24px;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.2;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#page-chat .profile-workspace .sec-key__bar {
    display: flex;
    gap: 4px;
    margin-top: auto;
    padding-top: 20px;
}

#page-chat .profile-workspace .sec-key__bar i {
    background: color-mix(in srgb, var(--theme-tint, #ffffff) 9%, transparent);
    border-radius: 999px;
    flex: 1;
    height: 5px;
    min-width: 0;
}

#page-chat .profile-workspace .sec-key__bar i.is-lit {
    background: var(--accent-primary, #c7ff00);
}

/* Fingerprint: safety code + copy, and its 8×8 cell pattern. */
#page-chat .profile-workspace .sec-fp {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

#page-chat .profile-workspace .sec-fp__copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#page-chat .profile-workspace .sec-fp .sec-key__label {
    margin-top: 16px;
}

#page-chat .profile-workspace .sec-copy-btn {
    align-items: center;
    align-self: flex-start;
    background: var(--settings-inner-fill);
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 999px;
    color: var(--theme-text, #f4f4f5);
    cursor: pointer;
    display: inline-flex;
    font-family: var(--f-ui);
    font-size: 12px;
    font-weight: 500;
    gap: 6px;
    height: 32px;
    margin-top: 14px;
    padding: 0 13px 0 11px;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

#page-chat .profile-workspace .sec-copy-btn:hover:not(:disabled):not(.is-copied),
#page-chat .profile-workspace .sec-copy-btn:focus-visible:not(.is-copied) {
    background: color-mix(in srgb, var(--accent-primary, #ccff00) 8%, transparent);
    border-color: color-mix(in srgb, var(--accent-primary, #ccff00) 40%, transparent);
    color: var(--accent-primary, #ccff00);
    outline: none;
}

#page-chat .profile-workspace .sec-copy-btn:disabled {
    cursor: default;
    opacity: 0.5;
}

/* Copy → Copied!: icons and labels cross-fade in place; the pill tints green. */
#page-chat .profile-workspace .sec-copy-btn {
    /* Copied: the brand accent, like Download export / Export saved. */
    --sec-copied: var(--accent-primary, #ccff00);
    transition:
        background-color 0.22s ease,
        border-color 0.22s ease,
        color 0.22s ease,
        transform 0.18s ease;
}

#page-chat .profile-workspace .sec-copy-btn:active {
    transform: scale(0.96);
}

#page-chat .profile-workspace .sec-copy-btn.is-copied {
    background: color-mix(in srgb, var(--sec-copied) 15%, transparent);
    border-color: color-mix(in srgb, var(--sec-copied) 30%, transparent);
    color: var(--sec-copied);
    font-weight: 500;
}

#page-chat .profile-workspace .sec-copy-btn__icons,
#page-chat .profile-workspace .sec-copy-btn__labels {
    display: inline-grid;
}

#page-chat .profile-workspace .sec-copy-btn__icons > *,
#page-chat .profile-workspace .sec-copy-btn__labels > * {
    grid-area: 1 / 1;
    transition:
        opacity 0.2s ease,
        transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#page-chat .profile-workspace .sec-copy-btn__icons svg {
    height: 13px;
    width: 13px;
}

#page-chat .profile-workspace .sec-copy-btn__icons .is-check {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

#page-chat .profile-workspace .sec-copy-btn__labels > * {
    text-align: center;
}

#page-chat .profile-workspace .sec-copy-btn .is-check {
    opacity: 0;
    transform: scale(0.5);
}

#page-chat .profile-workspace .sec-copy-btn__labels .is-check {
    transform: translateY(6px);
}

#page-chat .profile-workspace .sec-copy-btn.is-copied .is-copy {
    opacity: 0;
    transform: scale(0.5);
}

#page-chat .profile-workspace .sec-copy-btn.is-copied .sec-copy-btn__labels .is-copy {
    transform: translateY(-6px);
}

#page-chat .profile-workspace .sec-copy-btn.is-copied .is-check {
    opacity: 1;
    transform: none;
}

#page-chat .profile-workspace .sec-fp__grid {
    background: color-mix(in srgb, var(--bg-main, #070707) 55%, transparent);
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 16px;
    display: grid;
    flex: none;
    gap: 3px;
    grid-template-columns: repeat(8, 10px);
    padding: 12px;
}

#page-chat .profile-workspace .sec-fp__grid i {
    background: color-mix(in srgb, var(--theme-tint, #ffffff) 8%, transparent);
    border-radius: 2.5px;
    height: 10px;
    transition: background-color 0.3s ease;
}

#page-chat .profile-workspace .sec-fp__grid i.is-on {
    background: var(--accent-primary, #c7ff00);
}

/* Full fingerprint: a full-width row that grows from nothing (0fr → 1fr) as
   the card fades and lifts in; closing plays it back. While it's closed the
   next card pulls up over the empty row's grid gap, on the same clock. */
#page-chat .profile-workspace .sec-fp-wrap {
    display: grid;
    grid-column: 1 / -1;
    grid-template-rows: 0fr;
    transition:
        grid-template-rows 0.26s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0s linear 0.26s;
    visibility: hidden;
}

#page-chat .profile-workspace .sec-fp-wrap.is-open {
    grid-template-rows: 1fr;
    transition:
        grid-template-rows 0.26s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0s linear 0s;
    visibility: visible;
}

#page-chat .profile-workspace .sec-fp-wrap + .sec-card {
    transition: margin-top 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

#page-chat .profile-workspace .sec-fp-wrap:not(.is-open) + .sec-card {
    margin-top: -18px;
}

#page-chat .profile-workspace .sec-fp-wrap__clip {
    min-height: 0;
    overflow: hidden;
}

#page-chat .profile-workspace .sec-fp-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    transform: translateY(10px) scale(0.97);
    transition:
        opacity 0.22s ease-out,
        transform 0.22s ease-out;
}

#page-chat .profile-workspace .sec-fp-wrap.is-open .sec-fp-panel {
    opacity: 1;
    transform: none;
}

#page-chat .profile-workspace .sec-fp-panel__value {
    color: var(--theme-text, #f4f4f5);
    font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
    font-size: 14px;
    letter-spacing: 0.06em;
    line-height: 1.6;
    margin: 0;
    overflow-wrap: anywhere;
}

/* Manage devices: across the grid, CTA on the right. */
#page-chat .profile-workspace .sec-manage {
    align-items: center;
    display: flex;
    gap: 16px;
    grid-column: 1 / -1;
    padding: 22px 24px;
}

#page-chat .profile-workspace .sec-manage__icon {
    align-items: center;
    background: var(--settings-inner-fill);
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 14px;
    color: var(--theme-text, #f4f4f5);
    display: inline-flex;
    flex: none;
    height: 50px;
    justify-content: center;
    width: 50px;
}

#page-chat .profile-workspace .sec-manage__icon svg {
    fill: none;
    height: 20px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.5;
    width: 20px;
}

#page-chat .profile-workspace .sec-manage__copy {
    flex: 1;
    min-width: 0;
}

#page-chat .profile-workspace .sec-manage .sec-card__title {
    margin: 0 0 3px;
}

#page-chat .profile-workspace .sec-manage__text {
    color: var(--theme-text-muted, #8a8a8a);
    font-size: 12.5px;
    margin: 0;
}

#page-chat .profile-workspace .sec-cta {
    align-items: center;
    background: var(--accent-primary, #c7ff00);
    border: 0;
    border-radius: 999px;
    color: var(--text-on-accent, #0b0b0b);
    cursor: pointer;
    display: inline-flex;
    flex: none;
    font-family: var(--f-ui);
    font-size: 14px;
    font-weight: 600;
    gap: 8px;
    height: 42px;
    padding: 0 20px;
    transition: filter 0.18s ease, transform 0.18s ease;
}

#page-chat .profile-workspace .sec-cta:hover,
#page-chat .profile-workspace .sec-cta:focus-visible {
    filter: brightness(1.06);
    outline: none;
}

#page-chat .profile-workspace .sec-cta:active {
    transform: scale(0.97);
}

/* Secondary CTA (Change password): quiet fill, accent on hover. */
#page-chat .profile-workspace .sec-cta--quiet {
    background: var(--settings-inner-fill);
    border: 1px solid var(--settings-inner-stroke);
    color: var(--theme-text, #f4f4f5);
    font-weight: 500;
}

#page-chat .profile-workspace .sec-cta--quiet:hover,
#page-chat .profile-workspace .sec-cta--quiet:focus-visible {
    border-color: color-mix(in srgb, var(--accent-primary, #ccff00) 45%, transparent);
    color: var(--accent-primary, #ccff00);
    filter: none;
}

#page-chat .profile-workspace .sec-cta .ui-icon {
    height: 15px;
    width: 15px;
}

/* Entrance: the cards rise in, one after another. */
#page-chat .profile-workspace .security-page:not(.is-ready) .sec-card:not(.sec-fp-panel) {
    opacity: 0;
}

#page-chat .profile-workspace .security-page.is-ready .sec-card:not(.sec-fp-panel) {
    animation: profile-section-rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#page-chat .profile-workspace .security-page.is-ready .sec-card:nth-child(2) { animation-delay: 0.05s; }
#page-chat .profile-workspace .security-page.is-ready .sec-card:nth-child(3) { animation-delay: 0.1s; }
#page-chat .profile-workspace .security-page.is-ready .sec-card:nth-child(4) { animation-delay: 0.14s; }
#page-chat .profile-workspace .security-page.is-ready .sec-card:nth-child(5) { animation-delay: 0.18s; }
#page-chat .profile-workspace .security-page.is-ready .sec-card:nth-child(n + 6) { animation-delay: 0.22s; }

/* Narrower panel: hero across, then two columns; phones: one column. */
@container (max-width: 940px) {
    #page-chat .profile-workspace .security-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #page-chat .profile-workspace .sec-fp {
        grid-column: 1 / -1;
    }
}

@container (max-width: 620px) {
    #page-chat .profile-workspace .security-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    #page-chat .profile-workspace .sec-hero {
        grid-column: auto;
    }

    #page-chat .profile-workspace .sec-hero__art {
        opacity: 0.35;
        right: -180px;
    }

    #page-chat .profile-workspace .sec-manage {
        flex-wrap: wrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    #page-chat .profile-workspace .sec-hero__rings circle,
    #page-chat .profile-workspace .security-page.is-ready .sec-card {
        animation: none;
    }

    #page-chat .profile-workspace .sec-fp-wrap,
    #page-chat .profile-workspace .sec-fp-wrap + .sec-card,
    #page-chat .profile-workspace .sec-fp-panel,
    #page-chat .profile-workspace .sec-copy-btn * {
        transition: none !important;
    }

    #page-chat .profile-workspace .security-page:not(.is-ready) .sec-card {
        opacity: 1;
    }
}

/* ── Privacy — images/Group 48.png ───────────────────────────────────────────
   Three presence cards, then Links + How encryption works; centred like
   Appearance / Security (shares .sec-card / .sec-kicker / .sec-cta). Each
   card carries .is-on from its switch (js syncPrivacyCards) and its picture
   eases between the two states. */
#page-chat .profile-workspace .profile-privacy-layout.privacy-page {
    --pv-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --pv-accent: var(--accent-primary, #c7ff00);
    --pv-muted: var(--theme-text-muted, #8a8a8a);
    align-self: center;
    background: none;
    border: 0;
    box-shadow: none;
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: var(--appearance-max, 1150px);
    min-width: 0;
    padding: 0;
    width: 100%;
}

#page-chat .profile-workspace .privacy-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

#page-chat .profile-workspace .privacy-grid--second {
    grid-template-columns: minmax(0, 0.7fr) minmax(0, 1fr);
}

@container (max-width: 900px) {
    #page-chat .profile-workspace .privacy-grid,
    #page-chat .profile-workspace .privacy-grid--second {
        grid-template-columns: minmax(0, 1fr);
    }
}

#page-chat .profile-workspace .pv-card {
    display: flex;
    flex-direction: column;
}

#page-chat .profile-workspace .pv-card .sec-card__title {
    margin-top: 0;
}

#page-chat .profile-workspace .pv-card__head {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin: -4px 0 16px;
}

#page-chat .profile-workspace .pv-card__hint {
    color: var(--pv-muted);
    font-size: 13px;
    line-height: 1.45;
    margin: 4px 0 0;
}

/* Switch: the theme's accent track, a dark knob (overrides .profile-switch). */
#page-chat .profile-workspace .pv-switch .profile-switch__track {
    border-color: transparent;
    height: 26px;
    transition: background-color 0.24s ease;
    width: 46px;
}

#page-chat .profile-workspace .pv-switch .profile-switch__track::after {
    transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1), background-color 0.24s ease;
}

#page-chat .profile-workspace .pv-switch input:checked + .profile-switch__track {
    background: var(--pv-accent);
}

#page-chat .profile-workspace .pv-switch input:checked + .profile-switch__track::after {
    background: var(--bg-main, #0b0b0b);
    box-shadow: none;
}

#page-chat .profile-workspace .pv-switch input:focus-visible + .profile-switch__track {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--pv-accent) 30%, transparent);
}

/* The picture box. */
#page-chat .profile-workspace .pv-art {
    align-items: center;
    background: color-mix(in srgb, var(--bg-main, #070707) 45%, transparent);
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 18px;
    display: flex;
    height: 112px;
    justify-content: center;
    margin-bottom: 24px;
    overflow: hidden;
    position: relative;
}

/* Two labels in one cell: the state's own one shows (fade + small lift). */
#page-chat .profile-workspace .pv-swap {
    display: inline-grid;
}

#page-chat .profile-workspace .pv-swap > * {
    grid-area: 1 / 1;
    transition: opacity 0.22s ease, transform 0.3s var(--pv-ease);
    white-space: nowrap;
}

#page-chat .profile-workspace .pv-card:not(.is-on) .pv-swap > .is-on,
#page-chat .profile-workspace .pv-card.is-on .pv-swap > .is-off {
    opacity: 0;
    transform: translateY(4px);
}

/* Online status: avatar + status dot; off → the dot drains grey, avatar dims. */
#page-chat .profile-workspace .pv-art--online {
    gap: 14px;
}

#page-chat .profile-workspace .pv-avatar {
    background: color-mix(in srgb, var(--theme-text, #fff) 9%, transparent);
    border-radius: 50%;
    height: 54px;
    position: relative;
    transition: opacity 0.3s ease;
    width: 54px;
}

#page-chat .profile-workspace .pv-avatar svg {
    border-radius: 50%;
    fill: color-mix(in srgb, var(--theme-text, #fff) 16%, transparent);
    height: 100%;
    width: 100%;
}

#page-chat .profile-workspace .pv-avatar__dot {
    background: var(--pv-muted);
    border: 3px solid color-mix(in srgb, var(--bg-main, #070707) 90%, transparent);
    border-radius: 50%;
    bottom: -1px;
    height: 17px;
    position: absolute;
    right: -3px;
    transform: scale(0.75);
    transition: background-color 0.3s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    width: 17px;
}

#page-chat .profile-workspace .pv-card.is-on .pv-avatar__dot {
    background: var(--pv-accent);
    transform: scale(1);
}

#page-chat .profile-workspace .pv-card:not(.is-on) .pv-avatar {
    opacity: 0.6;
}

#page-chat .profile-workspace .pv-online__copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

#page-chat .profile-workspace .pv-online__name {
    color: var(--theme-text, #f4f4f5);
    font-size: 13px;
    font-weight: 600;
}

#page-chat .profile-workspace .pv-online__state {
    font-size: 11.5px;
}

#page-chat .profile-workspace .pv-online__state .is-on {
    color: var(--pv-accent);
}

#page-chat .profile-workspace .pv-online__state .is-off {
    color: var(--pv-muted);
}

/* Read receipts: an outgoing bubble, ✓✓ Read; off → one grey ✓ Sent. */
#page-chat .profile-workspace .pv-art--receipts {
    align-items: flex-end;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    padding: 0 18px;
}

#page-chat .profile-workspace .pv-bubble {
    background: color-mix(in srgb, var(--pv-accent) 16%, transparent);
    border-radius: 12px 12px 4px 12px;
    display: flex;
    gap: 8px;
    padding: 13px 12px;
    width: min(200px, 80%);
}

#page-chat .profile-workspace .pv-bubble i {
    background: color-mix(in srgb, var(--pv-accent) 42%, transparent);
    border-radius: 999px;
    height: 5px;
}

#page-chat .profile-workspace .pv-bubble i:first-child { flex: 2.3; }
#page-chat .profile-workspace .pv-bubble i:last-child { flex: 1; }

#page-chat .profile-workspace .pv-receipt {
    align-items: center;
    color: var(--pv-muted);
    display: inline-flex;
    font-size: 11.5px;
    gap: 6px;
    transition: color 0.3s ease;
}

#page-chat .profile-workspace .pv-card.is-on .pv-receipt {
    color: var(--pv-accent);
}

#page-chat .profile-workspace .pv-receipt svg {
    fill: none;
    height: 11px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.6;
    width: 18px;
}

/* The second check draws in when receipts go on, and wipes out when off. */
#page-chat .profile-workspace .pv-receipt .is-second {
    stroke-dasharray: 12;
    stroke-dashoffset: 12;
    transition: stroke-dashoffset 0.4s var(--pv-ease);
}

#page-chat .profile-workspace .pv-card.is-on .pv-receipt .is-second {
    stroke-dashoffset: 0;
    transition-delay: 0.08s;
}

#page-chat .profile-workspace .pv-receipt .pv-swap {
    justify-items: start;
}

/* Typing: three dots bouncing while on; off → they settle and dim. */
#page-chat .profile-workspace .pv-art--typing {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 0 18px;
}

#page-chat .profile-workspace .pv-typing {
    background: color-mix(in srgb, var(--theme-text, #fff) 7%, transparent);
    border-radius: 12px;
    display: inline-flex;
    gap: 5px;
    padding: 13px 14px;
}

#page-chat .profile-workspace .pv-typing i {
    background: var(--pv-muted);
    border-radius: 50%;
    height: 6px;
    opacity: 0.45;
    transition: background-color 0.3s ease, opacity 0.3s ease;
    width: 6px;
}

#page-chat .profile-workspace .pv-card.is-on .pv-typing i {
    animation: pv-typing-bounce 1.2s ease-in-out infinite;
    background: color-mix(in srgb, var(--pv-accent) 55%, var(--pv-muted));
    opacity: 1;
}

#page-chat .profile-workspace .pv-card.is-on .pv-typing i:nth-child(2) { animation-delay: 0.15s; }
#page-chat .profile-workspace .pv-card.is-on .pv-typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes pv-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-3px); }
}

#page-chat .profile-workspace .pv-typing__label {
    font-size: 11.5px;
}

#page-chat .profile-workspace .pv-typing__label .is-on {
    color: var(--pv-accent);
}

#page-chat .profile-workspace .pv-typing__label .is-off {
    color: var(--pv-muted);
}

/* Links: copy on the left, the hold ring on the right. */
#page-chat .profile-workspace .pv-links {
    display: grid;
    gap: 22px;
    grid-template-columns: minmax(0, 1fr) 152px;
}

#page-chat .profile-workspace .pv-links__main {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

#page-chat .profile-workspace .pv-links__copy {
    padding-bottom: 4px;
}

#page-chat .profile-workspace .pv-art--links {
    flex-direction: column;
    gap: 12px;
    height: auto;
    margin: 0;
    min-height: 172px;
}

#page-chat .profile-workspace .pv-hold {
    height: 62px;
    position: relative;
    width: 62px;
}

#page-chat .profile-workspace .pv-hold__ring {
    fill: none;
    height: 100%;
    transform: rotate(-90deg);
    width: 100%;
}

#page-chat .profile-workspace .pv-hold__ring .is-track {
    stroke: color-mix(in srgb, var(--theme-text, #fff) 8%, transparent);
    stroke-width: 3;
}

/* On: the arc fills to ~80% (the hold in progress); off: it empties. */
#page-chat .profile-workspace .pv-hold__ring .is-arc {
    stroke: var(--pv-accent);
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    stroke-linecap: round;
    stroke-width: 3;
    transition: stroke-dashoffset 0.7s var(--pv-ease);
}

#page-chat .profile-workspace .pv-card.is-on .pv-hold__ring .is-arc {
    stroke-dashoffset: 22;
}

#page-chat .profile-workspace .pv-hold__core {
    align-items: center;
    background: color-mix(in srgb, var(--theme-text, #fff) 7%, transparent);
    border-radius: 50%;
    color: var(--theme-text, #f4f4f5);
    display: flex;
    inset: 11px;
    justify-content: center;
    position: absolute;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#page-chat .profile-workspace .pv-card:not(.is-on) .pv-hold__core {
    transform: scale(0.9);
}

#page-chat .profile-workspace .pv-hold__core svg {
    fill: none;
    height: 15px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.8;
    width: 15px;
}

#page-chat .profile-workspace .pv-hold__label {
    font-size: 11.5px;
}

#page-chat .profile-workspace .pv-hold__label .is-on {
    color: var(--pv-accent);
}

#page-chat .profile-workspace .pv-hold__label .is-off {
    color: var(--pv-muted);
}

/* How encryption works: device → sealed code → device. */
#page-chat .profile-workspace .sec-cta--sm {
    font-size: 13.5px;
    height: 34px;
    margin: -4px 0;
    padding: 0 16px;
    text-decoration: none;
}

#page-chat .profile-workspace .pv-flow {
    align-items: flex-start;
    display: flex;
    gap: 14px;
    margin: 4px 0 24px;
}

#page-chat .profile-workspace .pv-flow__end,
#page-chat .profile-workspace .pv-flow__mid {
    align-items: center;
    display: flex;
    flex: none;
    flex-direction: column;
    gap: 10px;
}

#page-chat .profile-workspace .pv-flow__tile {
    align-items: center;
    background: color-mix(in srgb, var(--bg-main, #070707) 45%, transparent);
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 12px;
    color: var(--theme-text, #f4f4f5);
    display: flex;
    height: 46px;
    justify-content: center;
    width: 46px;
}

#page-chat .profile-workspace .pv-flow__tile svg {
    fill: none;
    height: 18px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.5;
    width: 18px;
}

#page-chat .profile-workspace .pv-flow__caption {
    color: var(--pv-muted);
    font-size: 11px;
    white-space: nowrap;
}

/* The dashed line carries a small dot across, over and over. */
#page-chat .profile-workspace .pv-flow__line {
    border-top: 1px dashed color-mix(in srgb, var(--theme-text, #fff) 16%, transparent);
    flex: 1;
    margin-top: 23px;
    min-width: 24px;
    position: relative;
}

#page-chat .profile-workspace .pv-flow__line i {
    animation: pv-flow-travel 2.8s ease-in-out infinite;
    background: var(--pv-accent);
    border-radius: 50%;
    height: 5px;
    left: 0;
    opacity: 0;
    position: absolute;
    top: -3px;
    width: 5px;
}

#page-chat .profile-workspace .pv-flow__line:last-of-type i {
    animation-delay: 1.4s;
}

@keyframes pv-flow-travel {
    0% { left: 0; opacity: 0; }
    15% { opacity: 1; }
    45% { left: calc(100% - 5px); opacity: 1; }
    55%, 100% { left: calc(100% - 5px); opacity: 0; }
}

#page-chat .profile-workspace .pv-flow__lock {
    align-items: center;
    background: var(--pv-accent);
    border-radius: 999px;
    color: var(--text-on-accent, #0b0b0b);
    display: inline-flex;
    font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
    font-size: 13px;
    font-weight: 600;
    gap: 8px;
    height: 46px;
    padding: 0 20px;
}

#page-chat .profile-workspace .pv-flow__lock .ui-icon {
    height: 14px;
    stroke-width: 2;
    width: 14px;
}

/* Header pill: one bar per sharing switch, "3/4 sharing". Privacy only. */
#page-chat .profile-workspace .pv-summary {
    display: none;
}

#page-chat:not(.is-viewport-profile-stack) .profile-workspace:has(.privacy-page:not(.hidden)) .pv-summary {
    align-items: center;
    background: var(--settings-capsule-bg);
    border: 1px solid var(--settings-capsule-stroke);
    border-radius: 999px;
    color: var(--theme-text, #f4f4f5);
    display: inline-flex;
    flex: none;
    font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
    font-size: 12px;
    gap: 10px;
    height: 42px;
    padding: 0 16px 0 14px;
}

#page-chat .profile-workspace .pv-summary__bars {
    display: inline-flex;
    gap: 3px;
}

#page-chat .profile-workspace .pv-summary__bars i {
    background: color-mix(in srgb, var(--theme-text, #fff) 14%, transparent);
    border-radius: 999px;
    height: 6px;
    transition: background-color 0.3s ease;
    width: 11px;
}

#page-chat .profile-workspace .pv-summary__bars i.is-lit {
    background: var(--accent-primary, #c7ff00);
}

/* Entrance: cards rise in one after another (like Security). */
#page-chat .profile-workspace .privacy-page:not(.is-ready) .sec-card {
    opacity: 0;
}

#page-chat .profile-workspace .privacy-page.is-ready .sec-card {
    animation: profile-section-rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#page-chat .profile-workspace .privacy-page.is-ready .privacy-grid .sec-card:nth-child(2) { animation-delay: 0.05s; }
#page-chat .profile-workspace .privacy-page.is-ready .privacy-grid .sec-card:nth-child(3) { animation-delay: 0.1s; }
#page-chat .profile-workspace .privacy-page.is-ready .privacy-grid--second .sec-card:nth-child(1) { animation-delay: 0.14s; }
#page-chat .profile-workspace .privacy-page.is-ready .privacy-grid--second .sec-card:nth-child(2) { animation-delay: 0.18s; }

@media (prefers-reduced-motion: reduce) {
    #page-chat .profile-workspace .privacy-page *,
    #page-chat .profile-workspace .privacy-page.is-ready .sec-card {
        animation: none !important;
        transition: none !important;
    }

    #page-chat .profile-workspace .privacy-page:not(.is-ready) .sec-card {
        opacity: 1;
    }
}

/* ── Data & storage — images/Group 46.png ────────────────────────────────────
   Storage overview (2 cols) + Export, then Clear cache / Clear chat history /
   Delete account; centred like the other settings pages. The overview's
   100-cell map fills in on open and highlights a category from the legend. */
#page-chat .profile-workspace .profile-data-layout.data-page {
    --dt-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --dt-accent: var(--accent-primary, #c7ff00);
    --dt-danger: var(--color-danger, #ef4444);
    --dt-muted: var(--theme-text-muted, #8a8a8a);
    align-self: center;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: var(--appearance-max, 1150px);
    min-width: 0;
    padding: 0;
    width: 100%;
}

#page-chat .profile-workspace .data-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

#page-chat .profile-workspace .dt-overview {
    align-items: center;
    display: flex;
    gap: 32px;
    grid-column: span 2;
    justify-content: space-between;
    padding: 30px;
}

@container (max-width: 900px) {
    #page-chat .profile-workspace .data-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    #page-chat .profile-workspace .dt-overview {
        flex-wrap: wrap;
        grid-column: auto;
    }
}

#page-chat .profile-workspace .dt-overview__main {
    flex: 1;
    max-width: 330px;
    min-width: 0;
}

/* The total: a big number, its unit small and muted beside it. */
#page-chat .profile-workspace .dt-total {
    align-items: baseline;
    color: var(--theme-text, #f4f4f5);
    display: flex;
    gap: 8px;
    margin: 12px 0 6px;
}

#page-chat .profile-workspace .dt-total__num {
    font-family: var(--f-ui);
    font-size: 64px;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    letter-spacing: -0.045em;
    line-height: 1;
}

#page-chat .profile-workspace .dt-total__unit {
    color: var(--dt-muted);
    font-size: 22px;
    font-weight: 500;
}

#page-chat .profile-workspace .dt-total__caption {
    color: var(--dt-muted);
    font-size: 13px;
    margin: 0 0 14px;
}

/* Legend: dot · label · share · size; a row dims the others' cells. */
#page-chat .profile-workspace .dt-legend {
    display: grid;
    gap: 2px;
    list-style: none;
    margin: 0 -10px;
    padding: 0;
}

#page-chat .profile-workspace .dt-legend__row {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 10px;
    color: var(--theme-text, #f4f4f5);
    cursor: pointer;
    display: grid;
    font: inherit;
    gap: 10px;
    grid-template-columns: 9px minmax(0, 1fr) auto 76px;
    padding: 9px 10px;
    text-align: left;
    transition: background-color 0.18s ease, opacity 0.25s ease;
    width: 100%;
}

#page-chat .profile-workspace .dt-legend__row:hover,
#page-chat .profile-workspace .dt-legend__row[aria-pressed="true"] {
    background: color-mix(in srgb, var(--theme-text, #fff) 5%, transparent);
}

#page-chat .profile-workspace .dt-legend__row:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--theme-tint, #fff) 35%, transparent);
    outline-offset: -2px;
}

#page-chat .profile-workspace .dt-legend__row.is-dim {
    opacity: 0.45;
}

#page-chat .profile-workspace .dt-legend__dot {
    border-radius: 2.5px;
    height: 9px;
    width: 9px;
}

#page-chat .profile-workspace .is-messages { --dt-cat: var(--dt-accent); }
#page-chat .profile-workspace .is-keys { --dt-cat: var(--theme-text, #f4f4f5); }
#page-chat .profile-workspace .is-cache { --dt-cat: color-mix(in srgb, var(--theme-text, #fff) 28%, transparent); }

#page-chat .profile-workspace .dt-legend__dot {
    background: var(--dt-cat);
}

#page-chat .profile-workspace .dt-legend__label {
    font-size: 13px;
}

#page-chat .profile-workspace .dt-legend__pct {
    color: var(--dt-muted);
    font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
    font-size: 11px;
}

#page-chat .profile-workspace .dt-legend__value {
    font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    text-align: right;
}

/* The map: 20 × 5 cells; they light up on a sweep (per-cell delay from js). */
#page-chat .profile-workspace .dt-map {
    flex: none;
    min-width: 0;
}

#page-chat .profile-workspace .dt-cells {
    display: grid;
    gap: 3px;
    grid-template-columns: repeat(20, 14px);
}

#page-chat .profile-workspace .dt-cells i {
    aspect-ratio: 1;
    background: color-mix(in srgb, var(--theme-text, #fff) 7%, transparent);
    border-radius: 3px;
    transition:
        background-color 0.35s ease,
        opacity 0.25s ease,
        transform 0.35s var(--dt-ease);
}

#page-chat .profile-workspace .dt-cells i[class] {
    background: var(--dt-cat);
}

/* Legend focus: the category's cells stay, the rest step back. */
#page-chat .profile-workspace .dt-cells[data-focus] i {
    opacity: 0.22;
    transition-delay: 0ms !important;
}

#page-chat .profile-workspace .dt-cells[data-focus="messages"] i.is-messages,
#page-chat .profile-workspace .dt-cells[data-focus="keys"] i.is-keys,
#page-chat .profile-workspace .dt-cells[data-focus="cache"] i.is-cache {
    opacity: 1;
    transform: scale(1.08);
}

#page-chat .profile-workspace .dt-map__foot {
    color: var(--dt-muted);
    display: flex;
    font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
    font-size: 10.5px;
    gap: 16px;
    justify-content: space-between;
    margin-top: 14px;
}

/* Export */
#page-chat .profile-workspace .dt-export {
    display: flex;
    flex-direction: column;
    padding: 24px;
}

#page-chat .profile-workspace .dt-export__icon {
    align-items: center;
    background: var(--dt-accent);
    border-radius: 14px;
    color: var(--text-on-accent, #0b0b0b);
    display: inline-flex;
    height: 48px;
    justify-content: center;
    width: 48px;
}

#page-chat .profile-workspace .dt-export__icon .ui-icon {
    height: 19px;
    stroke-width: 2;
    width: 19px;
}

#page-chat .profile-workspace .dt-export__title {
    color: var(--theme-text, #f4f4f5);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.1;
    margin: 30px 0 10px;
}

#page-chat .profile-workspace .dt-card__hint {
    color: var(--dt-muted);
    font-size: 13px;
    line-height: 1.45;
    margin: 0;
}

/* Holds the animated export button (src/settings/ExportButton.tsx). */
#page-chat .profile-workspace .dt-export__mount {
    margin-top: auto;
}

#page-chat .profile-workspace .dt-export__btn {
    align-items: center;
    background: var(--dt-accent);
    border: 0;
    border-radius: 999px;
    color: var(--text-on-accent, #0b0b0b);
    cursor: pointer;
    display: flex;
    font-family: var(--f-ui);
    font-size: 14px;
    font-weight: 600;
    height: 46px;
    justify-content: center;
    margin-top: auto;
    transition: filter 0.18s ease, transform 0.18s ease;
    width: 100%;
}

#page-chat .profile-workspace .dt-export__title + .dt-card__hint {
    margin-bottom: 30px;
}

#page-chat .profile-workspace .dt-export__btn:hover,
#page-chat .profile-workspace .dt-export__btn:focus-visible {
    filter: brightness(1.06);
    outline: none;
}

#page-chat .profile-workspace .dt-export__btn:active {
    transform: scale(0.98);
}

#page-chat .profile-workspace .dt-export__labels > span {
    align-items: center;
    display: inline-flex;
    gap: 7px;
    justify-content: center;
}

#page-chat .profile-workspace .dt-export__labels .ui-icon,
#page-chat .profile-workspace .dt-export__labels svg {
    fill: none;
    height: 14px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    width: 14px;
}

/* Download → "Downloaded ✓": the arrow drops out as the check comes in. */
#page-chat .profile-workspace .dt-export__btn:not(.is-done) .dt-export__labels > .is-done,
#page-chat .profile-workspace .dt-export__btn.is-done .dt-export__labels > .is-idle {
    opacity: 0;
    transform: translateY(8px);
}

#page-chat .profile-workspace .dt-export__btn.is-done .dt-export__labels > .is-idle {
    transform: translateY(-8px);
}

#page-chat .profile-workspace .dt-export__btn:not(.is-done):hover .dt-export__labels .is-idle .ui-icon {
    animation: dt-nudge 0.9s var(--dt-ease) infinite;
}

@keyframes dt-nudge {
    50% { transform: translateY(2px); }
}

/* Action cards */
#page-chat .profile-workspace .dt-action {
    display: flex;
    flex-direction: column;
    padding: 24px;
}

#page-chat .profile-workspace .dt-action__icon {
    align-items: center;
    background: var(--settings-inner-fill);
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 12px;
    color: var(--theme-text, #f4f4f5);
    display: inline-flex;
    height: 38px;
    justify-content: center;
    width: 38px;
}

#page-chat .profile-workspace .dt-action__icon .ui-icon {
    height: 16px;
    width: 16px;
}

#page-chat .profile-workspace .dt-action.is-danger .dt-action__icon {
    background: color-mix(in srgb, var(--dt-danger) 12%, transparent);
    border-color: color-mix(in srgb, var(--dt-danger) 20%, transparent);
    color: var(--dt-danger);
}

#page-chat .profile-workspace .dt-action__size {
    color: var(--theme-text, #f4f4f5);
    font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
    font-size: 22px;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    line-height: 38px;
}

#page-chat .profile-workspace .dt-action__tag {
    color: var(--dt-danger);
    line-height: 38px;
}

#page-chat .profile-workspace .dt-action__title {
    color: var(--theme-text, #f4f4f5);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 16px 0 4px;
}

#page-chat .profile-workspace .dt-action.is-danger .dt-action__title {
    color: var(--dt-danger);
}

#page-chat .profile-workspace .dt-action__btn {
    background: transparent;
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 999px;
    color: var(--theme-text, #f4f4f5);
    cursor: pointer;
    font-family: var(--f-ui);
    font-size: 13px;
    font-weight: 500;
    height: 38px;
    margin-top: 18px;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.18s ease;
    width: 100%;
}

#page-chat .profile-workspace .dt-action__btn:hover:not(:disabled),
#page-chat .profile-workspace .dt-action__btn:focus-visible {
    background: color-mix(in srgb, var(--theme-text, #fff) 6%, transparent);
    outline: none;
}

#page-chat .profile-workspace .dt-action__btn:active:not(:disabled) {
    transform: scale(0.98);
}

#page-chat .profile-workspace .dt-action__btn:disabled {
    color: var(--dt-muted);
    cursor: default;
}

#page-chat .profile-workspace .dt-action__btn.is-done {
    border-color: color-mix(in srgb, var(--dt-accent) 40%, transparent);
    color: var(--dt-accent);
}

#page-chat .profile-workspace .dt-action.is-danger .dt-action__btn {
    border-color: color-mix(in srgb, var(--dt-danger) 22%, transparent);
    color: var(--dt-danger);
    font-weight: 600;
}

#page-chat .profile-workspace .dt-action.is-danger .dt-action__btn:hover,
#page-chat .profile-workspace .dt-action.is-danger .dt-action__btn:focus-visible {
    background: color-mix(in srgb, var(--dt-danger) 10%, transparent);
    border-color: color-mix(in srgb, var(--dt-danger) 40%, transparent);
}

/* Entrance: cards rise in one after another. */
#page-chat .profile-workspace .data-page:not(.is-ready) .sec-card {
    opacity: 0;
}

#page-chat .profile-workspace .data-page.is-ready .sec-card {
    animation: profile-section-rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#page-chat .profile-workspace .data-page.is-ready .data-grid:first-child .sec-card:nth-child(2) { animation-delay: 0.06s; }
#page-chat .profile-workspace .data-page.is-ready .data-grid--actions .sec-card:nth-child(1) { animation-delay: 0.1s; }
#page-chat .profile-workspace .data-page.is-ready .data-grid--actions .sec-card:nth-child(2) { animation-delay: 0.14s; }
#page-chat .profile-workspace .data-page.is-ready .data-grid--actions .sec-card:nth-child(3) { animation-delay: 0.18s; }

@media (prefers-reduced-motion: reduce) {
    #page-chat .profile-workspace .data-page *,
    #page-chat .profile-workspace .data-page.is-ready .sec-card {
        animation: none !important;
        transition-delay: 0ms !important;
    }

    #page-chat .profile-workspace .data-page:not(.is-ready) .sec-card {
        opacity: 1;
    }
}

/* ── Profile settings — images/Group 44.png ─────────────────────────────────
   A 12-column bento: hero (8) + status (4), public profile (5) + bio (4) +
   photo (3), live preview (7) + identity key (5). Status colours drive the
   avatar ring, the hero badge, the preview dot and the active status card.
   Cards rise in on a 0.05s stagger; fields glow lime on focus. */
#page-chat .profile-workspace .profile-identity-layout.pf-page {
    --pf-accent: var(--accent-primary, #ccff00);
    --pf-muted: var(--theme-text-muted, #8a8a8a);
    --pf-field: color-mix(in srgb, var(--bg-main, #070707) 55%, transparent);
    --pf-line: var(--settings-inner-stroke);
    --pf-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
    align-self: center;
    container-type: inline-size;
    display: flex;
    /* All in one window: the page fills the panel's height and the middle row
       (public profile / bio / photo) takes whatever the hero and preview rows
       leave, its textarea and dropzone flexing with it. Below ~660px of room
       the body scrolls instead of squashing the cards. */
    flex: 1 1 auto;
    flex-direction: column;
    margin: 0 auto;
    max-width: var(--appearance-max, 1150px);
    min-height: 660px;
    width: 100%;
}

#page-chat .profile-workspace [data-pf-status="available"], #page-chat .profile-workspace .pf-status-card.is-available { --pf-status: #8fd61f; }
#page-chat .profile-workspace [data-pf-status="away"], #page-chat .profile-workspace .pf-status-card.is-away { --pf-status: #f5a524; }
#page-chat .profile-workspace [data-pf-status="busy"], #page-chat .profile-workspace .pf-status-card.is-busy { --pf-status: #7b7ff5; }
#page-chat .profile-workspace [data-pf-status="invisible"], #page-chat .profile-workspace .pf-status-card.is-invisible { --pf-status: #6b6b6b; }

#page-chat .profile-workspace .pf-grid {
    display: grid;
    flex: 1 1 auto;
    gap: 18px;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    /* The middle row flexes, but never below what its cards need: on very
       short windows (< ~760px) the body scrolls rather than overlapping. */
    grid-template-rows: auto minmax(296px, 1fr) auto;
    min-height: 0;
}

#page-chat .profile-workspace .pf-hero { grid-column: span 8; }
#page-chat .profile-workspace .pf-status { grid-column: span 4; }
#page-chat .profile-workspace .pf-public { grid-column: span 5; }
#page-chat .profile-workspace .pf-bio { grid-column: span 4; }
#page-chat .profile-workspace .pf-photo { grid-column: span 3; }
#page-chat .profile-workspace .pf-preview { grid-column: span 7; }
#page-chat .profile-workspace .pf-key { grid-column: span 5; }

/* Narrow panel: one column, natural heights, the body scrolls. */
@container (max-width: 760px) {
    #page-chat .profile-workspace .pf-grid {
        grid-template-rows: none;
    }

    #page-chat .profile-workspace .pf-grid > .pf-card {
        grid-column: span 12;
    }

    #page-chat .profile-workspace .pf-textarea {
        min-height: 140px;
    }

    #page-chat .profile-workspace .pf-drop {
        min-height: 160px;
    }
}

#page-chat .profile-workspace .pf-card {
    background: var(--settings-capsule-bg);
    backdrop-filter: var(--settings-capsule-blur);
    -webkit-backdrop-filter: var(--settings-capsule-blur);
    border: 1px solid var(--settings-capsule-stroke);
    border-radius: 28px;
    box-shadow: var(--glass-inset-highlight), var(--nexa-surface-shadow);
    box-sizing: border-box;
    color: var(--theme-text, #f4f4f5);
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 24px;
    position: relative;
}

#page-chat .profile-workspace .pf-card__head {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

#page-chat .profile-workspace .pf-card__title {
    color: var(--theme-text, #f4f4f5);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
}

#page-chat .profile-workspace .pf-card__sub {
    color: var(--pf-muted);
    font-size: 13px;
    line-height: 1.45;
    margin: 4px 0 0;
}

#page-chat .profile-workspace .pf-card__meta {
    color: var(--pf-muted);
    font-family: var(--pf-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    padding-top: 4px;
}

/* Hero */
#page-chat .profile-workspace .pf-hero {
    align-items: center;
    flex-direction: row;
    gap: 32px;
    overflow: hidden;
    padding: 26px 32px;
}

#page-chat .profile-workspace .pf-hero__dots {
    background-image: radial-gradient(circle, color-mix(in srgb, var(--pf-accent) 55%, transparent) 1.1px, transparent 1.7px);
    background-size: 11px 11px;
    inset: 0 0 0 44%;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 70%), linear-gradient(180deg, #000 30%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 70%), linear-gradient(180deg, #000 30%, transparent);
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
    opacity: 0.45;
    pointer-events: none;
    position: absolute;
}

#page-chat .profile-workspace .pf-hero__avatar-wrap {
    flex: none;
    position: relative;
    z-index: 1;
}

#page-chat .profile-workspace .pf-hero__avatar {
    align-items: center;
    background: color-mix(in srgb, var(--theme-text, #fff) 7%, var(--bg-section, #111));
    border: 3px solid var(--pf-status);
    border-radius: 50%;
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--pf-status) 10%, transparent);
    box-sizing: border-box;
    cursor: pointer;
    display: flex;
    height: 128px;
    justify-content: center;
    overflow: hidden;
    transition: border-color 0.35s ease, box-shadow 0.35s ease, transform 0.25s ease;
    width: 128px;
}

#page-chat .profile-workspace .pf-hero__avatar:hover {
    transform: scale(1.02);
}

#page-chat .profile-workspace .pf-hero__avatar .profile-avatar-initials {
    background: none;
    color: var(--theme-text, #fff);
    font-size: 44px;
    font-weight: 700;
}

#page-chat .profile-workspace .pf-hero__avatar img {
    height: 100%;
    object-fit: cover;
    width: 100%;
}

#page-chat .profile-workspace .pf-hero__badge {
    align-items: center;
    background: var(--bg-section, #111);
    border: 1px solid var(--pf-line);
    border-radius: 999px;
    bottom: 6px;
    color: var(--theme-text, #f4f4f5);
    display: inline-flex;
    font-size: 12px;
    font-weight: 500;
    gap: 6px;
    height: 26px;
    padding: 0 10px 0 8px;
    position: absolute;
    right: -6px;
    z-index: 2;
}

#page-chat .profile-workspace .pf-hero__badge i,
#page-chat .profile-workspace .pf-status-card__dot,
#page-chat .profile-workspace .pf-preview__dot {
    background: var(--pf-status);
    border-radius: 50%;
    transition: background-color 0.35s ease;
}

#page-chat .profile-workspace .pf-hero__badge i {
    height: 7px;
    width: 7px;
}

#page-chat .profile-workspace .pf-hero__copy {
    min-width: 0;
    position: relative;
    z-index: 1;
}

#page-chat .profile-workspace .pf-hero__name {
    align-items: center;
    display: flex;
    font-family: var(--f-ui);
    font-size: 44px;
    font-weight: 700;
    gap: 12px;
    letter-spacing: -0.035em;
    line-height: 1.05;
    margin: 0;
    min-width: 0;
}

#page-chat .profile-workspace .pf-hero__name > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#page-chat .profile-workspace .pf-verified {
    fill: var(--pf-accent);
    flex: none;
    height: 24px;
    width: 24px;
}

#page-chat .profile-workspace .pf-verified__check {
    fill: none;
    stroke: var(--text-on-accent, #0b0b0b);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

#page-chat .profile-workspace .pf-hero__link {
    color: var(--theme-text, #f4f4f5);
    font-family: var(--pf-mono);
    font-size: 14px;
    margin: 14px 0 0;
}

#page-chat .profile-workspace .pf-hero__link .is-muted {
    color: var(--pf-muted);
}

#page-chat .profile-workspace .pf-hero__bio {
    color: color-mix(in srgb, var(--theme-text, #fff) 82%, transparent);
    font-size: 14px;
    line-height: 1.5;
    margin: 12px 0 0;
    overflow-wrap: anywhere;
}

#page-chat .profile-workspace .pf-hero__bio.is-placeholder {
    color: var(--pf-muted);
}

#page-chat .profile-workspace .pf-hero__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

#page-chat .profile-workspace .pf-tag {
    align-items: center;
    background: var(--settings-inner-fill);
    border: 1px solid var(--pf-line);
    border-radius: 999px;
    color: var(--theme-text, #f4f4f5);
    display: inline-flex;
    font-size: 12px;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
}

#page-chat .profile-workspace .pf-tag .ui-icon {
    color: var(--pf-accent);
    height: 13px;
    width: 13px;
}

/* Status grid (StatusGrid.tsx) */
#page-chat .profile-workspace .pf-status__host {
    margin-top: 16px;
}

#page-chat .profile-workspace .pf-status-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr 1fr;
}

#page-chat .profile-workspace .pf-status-card {
    align-items: flex-start;
    background: var(--pf-field);
    border: 1px solid var(--pf-line);
    border-radius: 16px;
    color: var(--theme-text, #f4f4f5);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    font: inherit;
    gap: 2px;
    min-height: 78px;
    padding: 14px;
    position: relative;
    text-align: left;
    transition: border-color 0.25s ease, background-color 0.25s ease, transform 0.18s ease;
}

#page-chat .profile-workspace .pf-status-card:hover {
    border-color: color-mix(in srgb, var(--theme-text, #fff) 16%, transparent);
}

#page-chat .profile-workspace .pf-status-card:active {
    transform: scale(0.98);
}

#page-chat .profile-workspace .pf-status-card:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--pf-status) 55%, transparent);
    outline-offset: 2px;
}

#page-chat .profile-workspace .pf-status-card.is-active {
    background: color-mix(in srgb, var(--theme-text, #fff) 4%, var(--bg-section, #111));
    border-color: var(--pf-status);
}

#page-chat .profile-workspace .pf-status-card__dot {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--pf-status) 18%, transparent);
    height: 8px;
    margin: 1px 0 10px 1px;
    width: 8px;
}

#page-chat .profile-workspace .pf-status-card__label {
    font-size: 14px;
    font-weight: 600;
}

#page-chat .profile-workspace .pf-status-card__hint {
    color: var(--pf-muted);
    font-size: 11px;
}

#page-chat .profile-workspace .pf-status-card__check {
    color: var(--pf-status);
    display: inline-flex;
    position: absolute;
    right: 12px;
    top: 12px;
}

#page-chat .profile-workspace .pf-status-card__check svg {
    height: 15px;
    width: 15px;
}

/* Fields */
#page-chat .profile-workspace .pf-label {
    color: var(--pf-muted);
    display: block;
    font-size: 12px;
    margin: 18px 0 8px;
}

#page-chat .profile-workspace .pf-field,
#page-chat .profile-workspace .pf-handle,
#page-chat .profile-workspace .pf-textarea {
    background: var(--pf-field);
    border: 1px solid var(--pf-line);
    border-radius: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#page-chat .profile-workspace .pf-field:focus-within,
#page-chat .profile-workspace .pf-textarea:focus {
    border-color: color-mix(in srgb, var(--pf-accent) 50%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--pf-accent) 30%, transparent), 0 0 18px color-mix(in srgb, var(--pf-accent) 8%, transparent);
    outline: none;
}

#page-chat .profile-workspace .pf-field {
    align-items: center;
    display: flex;
    flex: none;
    height: 46px;
    padding: 0 14px 0 16px;
}

#page-chat .profile-workspace .pf-field input {
    background: none;
    border: 0;
    color: var(--theme-text, #f4f4f5);
    flex: 1;
    font: inherit;
    font-size: 15px;
    min-width: 0;
    outline: none;
    padding: 0;
}

#page-chat .profile-workspace .pf-field__count {
    color: var(--pf-muted);
    font-family: var(--pf-mono);
    font-size: 11px;
}

#page-chat .profile-workspace .pf-handle {
    align-items: center;
    display: flex;
    flex: none;
    height: 46px;
    overflow: hidden;
}

#page-chat .profile-workspace .pf-handle__prefix {
    align-items: center;
    align-self: stretch;
    border-right: 1px solid var(--pf-line);
    color: var(--pf-muted);
    display: flex;
    font-family: var(--pf-mono);
    font-size: 13px;
    padding: 0 12px 0 16px;
}

#page-chat .profile-workspace .pf-handle__value {
    color: var(--theme-text, #f4f4f5);
    flex: 1;
    font-family: var(--pf-mono);
    font-size: 15px;
    min-width: 0;
    overflow: hidden;
    padding: 0 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Copy → Copied!: icons and labels cross-fade; accent tint when copied. */
#page-chat .profile-workspace .pf-copy {
    align-items: center;
    background: var(--settings-inner-fill);
    border: 1px solid var(--pf-line);
    border-radius: 10px;
    color: var(--theme-text, #f4f4f5);
    cursor: pointer;
    display: inline-flex;
    flex: none;
    font: inherit;
    font-size: 12px;
    gap: 6px;
    height: 32px;
    margin-right: 7px;
    padding: 0 11px 0 9px;
    transition: background-color 0.22s ease, border-color 0.22s ease, color 0.22s ease, transform 0.18s ease;
}

#page-chat .profile-workspace .pf-copy:hover:not(.is-copied),
#page-chat .profile-workspace .pf-copy:focus-visible:not(.is-copied) {
    border-color: color-mix(in srgb, var(--pf-accent) 40%, transparent);
    color: var(--pf-accent);
    outline: none;
}

#page-chat .profile-workspace .pf-copy:active {
    transform: scale(0.96);
}

#page-chat .profile-workspace .pf-copy.is-copied {
    background: color-mix(in srgb, var(--pf-accent) 15%, transparent);
    border-color: color-mix(in srgb, var(--pf-accent) 30%, transparent);
    color: var(--pf-accent);
    font-weight: 500;
}

#page-chat .profile-workspace .pf-copy__icons,
#page-chat .profile-workspace .pf-copy__labels {
    display: inline-grid;
}

#page-chat .profile-workspace .pf-copy__icons > *,
#page-chat .profile-workspace .pf-copy__labels > * {
    grid-area: 1 / 1;
    transition: opacity 0.2s ease, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#page-chat .profile-workspace .pf-copy__icons svg {
    fill: none;
    height: 13px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    width: 13px;
}

#page-chat .profile-workspace .pf-copy__labels > * {
    text-align: center;
}

#page-chat .profile-workspace .pf-copy .is-check,
#page-chat .profile-workspace .pf-copy.is-copied .is-copy {
    opacity: 0;
    transform: scale(0.5);
}

#page-chat .profile-workspace .pf-copy.is-copied .is-check {
    opacity: 1;
    transform: none;
}

#page-chat .profile-workspace .pf-hint {
    align-items: center;
    color: var(--pf-muted);
    display: flex;
    font-size: 12px;
    gap: 7px;
    margin: 12px 0 0;
}

#page-chat .profile-workspace .pf-hint::before {
    background: currentColor;
    border-radius: 50%;
    content: "";
    height: 6px;
    width: 6px;
}

#page-chat .profile-workspace .pf-hint.is-ok {
    color: var(--pf-accent);
}

/* Bio */
#page-chat .profile-workspace .pf-ring {
    display: grid;
    flex: none;
    height: 40px;
    place-items: center;
    position: relative;
    width: 40px;
}

#page-chat .profile-workspace .pf-ring svg {
    fill: none;
    height: 40px;
    inset: 0;
    position: absolute;
    transform: rotate(-90deg);
    width: 40px;
}

#page-chat .profile-workspace .pf-ring .is-track {
    stroke: color-mix(in srgb, var(--theme-text, #fff) 9%, transparent);
    stroke-width: 3;
}

#page-chat .profile-workspace .pf-ring .is-arc {
    stroke: var(--pf-accent);
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    stroke-linecap: round;
    stroke-width: 3;
    transition: stroke-dashoffset 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

#page-chat .profile-workspace .pf-ring span {
    color: var(--theme-text, #f4f4f5);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

#page-chat .profile-workspace .pf-textarea {
    box-sizing: border-box;
    color: var(--theme-text, #f4f4f5);
    flex: 1;
    font: inherit;
    font-size: 15px;
    line-height: 1.45;
    margin-top: 16px;
    min-height: 64px;
    padding: 14px 16px;
    resize: none;
    width: 100%;
}

#page-chat .profile-workspace .pf-bio__count {
    color: var(--pf-muted);
    font-family: var(--pf-mono);
    font-size: 11px;
    margin-top: 12px;
}

/* Photo */
#page-chat .profile-workspace .pf-drop {
    align-items: center;
    background: var(--pf-field);
    border: 1px dashed color-mix(in srgb, var(--theme-text, #fff) 12%, transparent);
    border-radius: 18px;
    color: var(--theme-text, #f4f4f5);
    cursor: pointer;
    display: flex;
    flex: 1;
    flex-direction: column;
    font: inherit;
    justify-content: center;
    margin-top: 16px;
    min-height: 0;
    padding: 16px 12px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

#page-chat .profile-workspace .pf-drop:hover,
#page-chat .profile-workspace .pf-drop:focus-visible,
#page-chat .profile-workspace .pf-drop.is-dragover {
    border-color: color-mix(in srgb, var(--pf-accent) 40%, transparent);
    outline: none;
}

#page-chat .profile-workspace .pf-drop.is-dragover {
    background: color-mix(in srgb, var(--pf-accent) 5%, var(--pf-field));
}

#page-chat .profile-workspace .pf-drop__icon {
    align-items: center;
    background: var(--pf-accent);
    border-radius: 14px;
    color: var(--text-on-accent, #0b0b0b);
    display: flex;
    flex: none;
    height: 48px;
    justify-content: center;
    margin-bottom: 14px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    width: 48px;
}

#page-chat .profile-workspace .pf-drop:hover .pf-drop__icon {
    transform: translateY(-3px);
}

#page-chat .profile-workspace .pf-drop__icon .ui-icon {
    height: 19px;
    stroke-width: 2;
    width: 19px;
}

#page-chat .profile-workspace .pf-drop__title {
    font-size: 14px;
    font-weight: 600;
}

#page-chat .profile-workspace .pf-drop__hint {
    color: var(--pf-muted);
    font-size: 12px;
    line-height: 1.45;
    margin-top: 10px;
    text-align: center;
}

#page-chat .profile-workspace .pf-remove {
    background: transparent;
    border: 1px solid var(--pf-line);
    border-radius: 999px;
    color: var(--theme-text, #f4f4f5);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    height: 38px;
    margin-top: 16px;
    transition: background-color 0.2s ease;
    width: 100%;
}

#page-chat .profile-workspace .pf-remove:hover,
#page-chat .profile-workspace .pf-remove:focus-visible {
    background: var(--settings-inner-fill);
    outline: none;
}

/* Preview */
#page-chat .profile-workspace .pf-preview {
    flex-direction: row;
    gap: 24px;
}

#page-chat .profile-workspace .pf-preview__copy {
    display: flex;
    flex: none;
    flex-direction: column;
    width: 190px;
}

#page-chat .profile-workspace .pf-preview__live {
    align-items: center;
    color: var(--pf-muted);
    display: flex;
    font-family: var(--pf-mono);
    font-size: 11px;
    gap: 7px;
    margin: auto 0 0;
    padding-top: 16px;
    white-space: nowrap;
}

#page-chat .profile-workspace .pf-preview__live i {
    animation: pf-live 1.6s ease-in-out infinite;
    background: var(--pf-accent);
    border-radius: 50%;
    height: 6px;
    width: 6px;
}

@keyframes pf-live {
    50% { opacity: 0.3; }
}

#page-chat .profile-workspace .pf-preview__list {
    background: var(--pf-field);
    border: 1px solid var(--pf-line);
    border-radius: 18px;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 8px;
}

#page-chat .profile-workspace .pf-preview__row {
    align-items: center;
    border-radius: 14px;
    display: flex;
    gap: 12px;
    min-height: 62px;
    padding: 0 12px;
}

#page-chat .profile-workspace .pf-preview__row.is-you {
    background: color-mix(in srgb, var(--theme-text, #fff) 5%, var(--bg-section, #111));
}

#page-chat .profile-workspace .pf-preview__avatar {
    align-items: center;
    background: color-mix(in srgb, var(--theme-text, #fff) 10%, transparent);
    border-radius: 50%;
    color: var(--theme-text, #fff);
    display: flex;
    flex: none;
    font-size: 16px;
    font-weight: 700;
    height: 42px;
    justify-content: center;
    position: relative;
    width: 42px;
}

#page-chat .profile-workspace .pf-preview__avatar img {
    border-radius: 50%;
    height: 100%;
    inset: 0;
    object-fit: cover;
    position: absolute;
    width: 100%;
}

#page-chat .profile-workspace .pf-preview__avatar img:not(.hidden) + span {
    visibility: hidden;
}

#page-chat .profile-workspace .pf-preview__dot {
    border: 2px solid var(--bg-section, #111);
    bottom: -1px;
    height: 12px;
    position: absolute;
    right: -1px;
    width: 12px;
}

#page-chat .profile-workspace .pf-preview__text {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

#page-chat .profile-workspace .pf-preview__name {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#page-chat .profile-workspace .pf-preview__meta {
    color: var(--pf-muted);
    font-size: 12px;
}

#page-chat .profile-workspace .pf-preview__time {
    align-self: flex-start;
    color: var(--pf-muted);
    font-size: 11px;
    padding-top: 14px;
}

#page-chat .profile-workspace .pf-preview__row.is-ghost .pf-preview__avatar {
    background: color-mix(in srgb, var(--theme-text, #fff) 5%, transparent);
}

#page-chat .profile-workspace .pf-preview__row.is-ghost i {
    background: color-mix(in srgb, var(--theme-text, #fff) 6%, transparent);
    border-radius: 999px;
    height: 7px;
    width: 45%;
}

#page-chat .profile-workspace .pf-preview__row.is-ghost i + i {
    width: 70%;
}

/* Identity key */
#page-chat .profile-workspace .pf-key {
    flex-direction: row;
    gap: 20px;
    justify-content: space-between;
}

#page-chat .profile-workspace .pf-key__copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#page-chat .profile-workspace .pf-key__title {
    align-items: center;
    display: flex;
    gap: 8px;
}

#page-chat .profile-workspace .pf-key__title svg {
    fill: none;
    height: 16px;
    stroke: var(--pf-accent);
    stroke-linecap: round;
    stroke-width: 1.8;
    width: 16px;
}

#page-chat .profile-workspace .pf-key__fp {
    color: var(--theme-text, #f4f4f5);
    font-family: var(--pf-mono);
    font-size: 12.5px;
    letter-spacing: 0.04em;
    line-height: 1.6;
    margin: auto 0 0;
    padding-top: 16px;
}

#page-chat .profile-workspace .pf-key__grid {
    align-self: center;
}

/* Header: Profile settings · lock · Cancel / Save changes */
#page-chat .profile-workspace .pf-actions {
    display: none;
}

#page-chat:not(.is-viewport-profile-stack) .profile-workspace:has(.pf-page:not(.hidden)) .pf-actions {
    display: flex;
    gap: 8px;
}

#page-chat .profile-workspace .pf-btn {
    align-items: center;
    background: transparent;
    border: 1px solid var(--settings-capsule-stroke);
    border-radius: 999px;
    color: var(--theme-text, #f4f4f5);
    cursor: pointer;
    display: inline-flex;
    font-family: var(--f-ui);
    font-size: 14px;
    font-weight: 500;
    gap: 8px;
    height: 42px;
    padding: 0 20px;
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.35s ease, transform 0.18s ease;
}

#page-chat .profile-workspace .pf-btn:hover:not(:disabled) {
    background: var(--settings-inner-fill);
}

#page-chat .profile-workspace .pf-btn:active:not(:disabled) {
    transform: scale(0.97);
}

#page-chat .profile-workspace .pf-btn:disabled {
    cursor: default;
    opacity: 0.55;
}

#page-chat .profile-workspace .pf-btn--save {
    background: var(--settings-capsule-bg);
    border-color: transparent;
    color: var(--pf-muted, #8a8a8a);
}

#page-chat .profile-workspace .pf-btn--save svg {
    fill: none;
    height: 14px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    width: 14px;
}

/* Unsaved edits: Save lights up in the accent. */
#page-chat .profile-workspace .pf-btn--save:not(:disabled) {
    background: var(--accent-primary, #ccff00);
    box-shadow: 0 6px 22px color-mix(in srgb, var(--accent-primary, #ccff00) 25%, transparent);
    color: var(--text-on-accent, #0b0b0b);
    font-weight: 600;
    opacity: 1;
}

#page-chat .profile-workspace .pf-btn--save:not(:disabled):hover {
    background: var(--accent-primary, #ccff00);
    filter: brightness(1.05);
}

#page-chat:not(.is-viewport-profile-stack) .profile-workspace:has(.pf-page:not(.hidden)) .profile-head-sub {
    align-items: center;
    display: flex;
    gap: 6px;
}

#page-chat:not(.is-viewport-profile-stack) .profile-workspace:has(.pf-page:not(.hidden)) .profile-head-sub::before {
    background: currentColor;
    content: "";
    flex: none;
    height: 12px;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
    width: 12px;
}

/* Short windows (laptops): the same bento, tighter — smaller avatar and
   name, slimmer paddings and preview rows — so it still fits one screen. */
@media (max-height: 940px) {
    #page-chat .profile-workspace .pf-grid {
        grid-template-rows: auto minmax(236px, 1fr) auto;
    }

    #page-chat .profile-workspace .profile-identity-layout.pf-page {
        min-height: 0;
    }

    #page-chat .profile-workspace .pf-grid {
        gap: 14px;
    }

    #page-chat .profile-workspace .pf-card {
        padding: 18px 20px;
    }

    #page-chat .profile-workspace .pf-hero {
        gap: 24px;
        padding: 18px 26px;
    }

    #page-chat .profile-workspace .pf-hero__avatar {
        height: 96px;
        width: 96px;
    }

    #page-chat .profile-workspace .pf-hero__avatar .profile-avatar-initials {
        font-size: 34px;
    }

    #page-chat .profile-workspace .pf-hero__name {
        font-size: 34px;
    }

    #page-chat .profile-workspace .pf-hero__link {
        margin-top: 8px;
    }

    #page-chat .profile-workspace .pf-hero__bio {
        margin-top: 8px;
    }

    #page-chat .profile-workspace .pf-hero__tags {
        margin-top: 10px;
    }

    #page-chat .profile-workspace .pf-status__host {
        margin-top: 12px;
    }

    #page-chat .profile-workspace .pf-status-grid {
        gap: 8px;
    }

    /* Status cards: dot and name on one line, the hint under them. */
    #page-chat .profile-workspace .pf-status-card {
        column-gap: 8px;
        display: grid;
        grid-template-columns: auto 1fr;
        min-height: 0;
        padding: 10px 12px;
        row-gap: 2px;
    }

    #page-chat .profile-workspace .pf-status-card__dot {
        align-self: center;
        margin: 0;
    }

    #page-chat .profile-workspace .pf-status-card__hint {
        grid-column: 1 / -1;
    }

    #page-chat .profile-workspace .pf-drop {
        overflow: hidden;
        padding: 10px;
    }

    #page-chat .profile-workspace .pf-drop__hint {
        margin-top: 4px;
    }

    #page-chat .profile-workspace .pf-drop__hint br {
        display: none;
    }

    #page-chat .profile-workspace .pf-card__sub {
        margin-top: 2px;
    }

    #page-chat .profile-workspace .pf-label {
        margin: 12px 0 6px;
    }

    #page-chat .profile-workspace .pf-field,
    #page-chat .profile-workspace .pf-handle {
        height: 42px;
    }

    #page-chat .profile-workspace .pf-hint {
        margin-top: 8px;
    }

    #page-chat .profile-workspace .pf-drop__icon {
        height: 40px;
        margin-bottom: 10px;
        width: 40px;
    }

    #page-chat .profile-workspace .pf-remove {
        height: 34px;
        margin-top: 12px;
    }

    #page-chat .profile-workspace .pf-preview__row {
        min-height: 52px;
    }

    #page-chat .profile-workspace .pf-preview__avatar {
        height: 36px;
        width: 36px;
    }

    #page-chat .profile-workspace .pf-preview__time {
        padding-top: 10px;
    }

    #page-chat .profile-workspace .pf-key__grid {
        gap: 2px;
        grid-template-columns: repeat(8, 8px);
        padding: 10px;
    }

    #page-chat .profile-workspace .pf-key__grid i {
        height: 8px;
    }

    #page-chat:not(.is-viewport-profile-stack) .profile-workspace:has(.pf-page:not(.hidden)) .profile-body {
        padding-top: 16px;
    }
}

/* Very short windows (≤ 760px): drop the status hints and the placeholder
   preview row — the last few pixels that keep 720p screens scroll-free. */
@media (max-height: 760px) {
    #page-chat .profile-workspace .pf-status-card__hint,
    #page-chat .profile-workspace .pf-preview__row.is-ghost {
        display: none;
    }

    #page-chat .profile-workspace .pf-status-card {
        padding: 9px 12px;
    }
}

/* The body gives the page its full height (and scrolls only when it must). */
#page-chat:not(.is-viewport-profile-stack) .profile-workspace:has(.pf-page:not(.hidden)) .profile-body {
    padding-bottom: 20px;
    padding-top: 24px;
}

#page-chat .profile-workspace .profile-body > .pf-page {
    flex: 1 1 auto;
}

/* Entrance: the bento rises card by card (0.05s apart). */
#page-chat .profile-workspace .pf-page.is-ready > .pf-grid {
    animation: none;
    opacity: 1;
}

#page-chat .profile-workspace .pf-page:not(.is-ready) .pf-card {
    opacity: 0;
}

#page-chat .profile-workspace .pf-page.is-ready .pf-card {
    animation: profile-section-rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--i, 0) * 0.05s);
}

@media (prefers-reduced-motion: reduce) {
    #page-chat .profile-workspace .pf-page *,
    #page-chat .profile-workspace .pf-page.is-ready .pf-card {
        animation: none !important;
    }

    #page-chat .profile-workspace .pf-page:not(.is-ready) .pf-card {
        opacity: 1;
    }
}

/* ── Settings tab switches ───────────────────────────────────────────────────
   A nav click swaps sections with one short fade + 6px slide (.is-quick, set
   by js setSection) instead of replaying the cards' staggered rise, so fast
   clicking through Appearance → Security → Privacy → Data never lags. */
@keyframes settings-section-in {
    from {
        opacity: 0;
        transform: translateX(6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

#page-chat .profile-workspace [data-profile-section].is-quick {
    animation: settings-section-in 0.12s ease-out both;
}

#page-chat .profile-workspace [data-profile-section].is-quick :is(.sec-card, .appearance-card, .pf-card, .profile-sec-block, .profile-privacy-row, .profile-sec-kicker),
#page-chat .profile-workspace .profile-identity-layout.is-quick > * {
    animation: none !important;
    opacity: 1 !important;
}

/* ── Appearance → Theme picker (js/themePicker.js) ───────────────────────────
   One row per theme: a mini window in that theme's own colours (inline), the
   name + type, its palette, and a radio ring that fills with the accent. */
#page-chat .profile-workspace .theme-picker {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 22px;
    position: relative;
}

#page-chat .profile-workspace .theme-card {
    align-items: center;
    background: var(--settings-inner-fill);
    border: 1px solid var(--settings-inner-stroke);
    border-radius: 18px;
    color: var(--theme-text, #f4f4f5);
    cursor: pointer;
    display: flex;
    font: inherit;
    gap: 14px;
    min-width: 0;
    padding: 11px 16px 11px 11px;
    position: relative;
    text-align: left;
    transition:
        border-color 0.2s ease,
        background-color 0.2s ease,
        transform 0.18s ease;
    width: 100%;
}

#page-chat .profile-workspace .theme-card:active {
    transform: scale(0.99);
}

#page-chat .profile-workspace .theme-card:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--theme-tint, #ffffff) 45%, transparent);
    outline-offset: 2px;
}

#page-chat .profile-workspace .theme-card.is-active {
    background: color-mix(in srgb, var(--accent-primary, #c7ff00) 4%, var(--settings-inner-fill));
    border-color: var(--accent-primary, #c7ff00);
}

/* Mini window: page bg, a sidebar panel, three bubbles. */
#page-chat .profile-workspace .theme-card__preview {
    border: 1px solid transparent;
    border-radius: 9px;
    display: block;
    flex: none;
    height: 66px;
    overflow: hidden;
    position: relative;
    width: 100px;
}

#page-chat .profile-workspace .theme-card__panel {
    border-right: 1px solid transparent;
    bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    left: 0;
    padding: 8px 6px;
    position: absolute;
    top: 0;
    width: 29%;
}

#page-chat .profile-workspace .theme-card__accent {
    border-radius: 999px;
    height: 5px;
    margin-bottom: 1px;
    width: 18px;
}

#page-chat .profile-workspace .theme-card__line {
    border-radius: 999px;
    height: 3px;
    opacity: 0.45;
    width: 18px;
}

#page-chat .profile-workspace .theme-card__line--short {
    width: 14px;
}

#page-chat .profile-workspace .theme-card__bubble {
    border: 1px solid transparent;
    border-radius: 999px;
    height: 10px;
    position: absolute;
}

#page-chat .profile-workspace .theme-card__bubble--in {
    left: 37%;
    top: 12%;
    width: 34%;
}

#page-chat .profile-workspace .theme-card__bubble--out {
    border: 0;
    right: 6%;
    top: 38%;
    width: 36%;
}

#page-chat .profile-workspace .theme-card__bubble--in2 {
    left: 37%;
    top: 64%;
    width: 27%;
}

#page-chat .profile-workspace .theme-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 9px;
    min-width: 0;
}

#page-chat .profile-workspace .theme-card__meta {
    align-items: baseline;
    display: flex;
    gap: 7px;
    min-width: 0;
}

#page-chat .profile-workspace .theme-card__name {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#page-chat .profile-workspace .theme-card__type {
    color: var(--theme-text-muted, #8a8a8a);
    flex: none;
    font-size: 12px;
}

#page-chat .profile-workspace .theme-card__swatches {
    display: flex;
    gap: 6px;
}

#page-chat .profile-workspace .theme-card__swatch {
    border: 1px solid color-mix(in srgb, var(--theme-tint, #ffffff) 12%, transparent);
    border-radius: 50%;
    height: 15px;
    width: 15px;
}

#page-chat .profile-workspace .theme-card__radio {
    align-items: center;
    border: 1.5px solid color-mix(in srgb, var(--theme-tint, #ffffff) 22%, transparent);
    border-radius: 50%;
    color: var(--text-on-accent, #0b0b0b);
    display: inline-flex;
    flex: none;
    height: 24px;
    justify-content: center;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease;
    width: 24px;
}

#page-chat .profile-workspace .theme-card__radio svg {
    fill: none;
    height: 14px;
    opacity: 0;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    transform: scale(0.6);
    transition:
        opacity 0.18s ease,
        transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
    width: 14px;
}

#page-chat .profile-workspace .theme-card.is-active .theme-card__radio {
    background: var(--accent-primary, #c7ff00);
    border-color: var(--accent-primary, #c7ff00);
}

#page-chat .profile-workspace .theme-card.is-active .theme-card__radio svg {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    #page-chat .profile-workspace .theme-card,
    #page-chat .profile-workspace .theme-card__radio,
    #page-chat .profile-workspace .theme-card__radio svg {
        transition: none;
    }
}

/* ── Appearance → Chat preview ────────────────────────────────────────────────
   A miniature app window painted with --pv-* (set by js/themePicker.js from
   the active theme, or the hovered one). Fallbacks = Dark Neon. It grows to
   the card's height, so both columns end on one line. */
#page-chat .profile-workspace .appearance-preview {
    --pv-ease: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 22px;
    min-height: 0;
}

/* Every part of the preview eases between themes: fills, text, strokes and
   shadows all follow the --pv-* vars on one clock, so hovering a theme card
   (or leaving it) cross-fades the whole mini app rather than snapping.
   !important so no per-part rule can drop a property off the shared clock. */
#page-chat .profile-workspace .appearance-preview,
#page-chat .profile-workspace .appearance-preview *,
#page-chat .profile-workspace .appearance-preview *::before,
#page-chat .profile-workspace .appearance-preview *::after {
    transition:
        background-color var(--pv-ease),
        color var(--pv-ease),
        border-color var(--pv-ease),
        fill var(--pv-ease),
        stroke var(--pv-ease),
        box-shadow var(--pv-ease) !important;
}

#page-chat .profile-workspace .appearance-preview__window {
    background: var(--pv-bg, #070707);
    border: 1px solid var(--pv-border, #1c1c1c);
    border-radius: 22px;
    box-shadow: var(--pv-card-shadow, none);
    display: grid;
    flex: 1;
    grid-template-columns: minmax(150px, 32%) 1fr;
    min-height: 440px;
    overflow: hidden;
}

/* Sidebar: search field + chat rows, the open chat as the active pill. */
#page-chat .profile-workspace .appearance-preview__sidebar {
    background: var(--pv-section, #0a0a0a);
    border-right: 1px solid var(--pv-border, #1c1c1c);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
    padding: 12px;
}

#page-chat .profile-workspace .appearance-preview__search {
    align-items: center;
    background: var(--pv-card, #121212);
    border: 1px solid var(--pv-border, #1c1c1c);
    border-radius: 12px;
    color: var(--pv-muted, #737373);
    display: flex;
    flex: none;
    font-size: 11px;
    gap: 7px;
    height: 36px;
    margin-bottom: 4px;
    padding: 0 12px;
}

#page-chat .profile-workspace .appearance-preview__search .ui-icon {
    height: 12px;
    width: 12px;
}

#page-chat .profile-workspace .appearance-preview__chat {
    align-items: center;
    background: color-mix(in srgb, var(--pv-card, #121212) 70%, transparent);
    border: 1px solid transparent;
    border-radius: 12px;
    display: flex;
    flex: none;
    gap: 10px;
    height: 50px;
    padding: 0 10px;
}

#page-chat .profile-workspace .appearance-preview__chat.is-active {
    background: var(--pv-pill, #c7ff00);
    border-color: var(--pv-pill, #c7ff00);
}

#page-chat .profile-workspace .appearance-preview__avatar {
    background: color-mix(in srgb, var(--pv-muted, #737373) 30%, transparent);
    border-radius: 50%;
    flex: none;
    height: 28px;
    width: 28px;
}

#page-chat .profile-workspace .appearance-preview__chat.is-active .appearance-preview__avatar {
    background: color-mix(in srgb, var(--pv-pill-text, #191b13) 28%, transparent);
}

#page-chat .profile-workspace .appearance-preview__lines {
    display: grid;
    flex: 1;
    gap: 5px;
    min-width: 0;
}

#page-chat .profile-workspace .appearance-preview__lines > span {
    background: var(--pv-muted, #737373);
    border-radius: 2px;
    height: 4px;
    opacity: 0.35;
    width: 64%;
}

#page-chat .profile-workspace .appearance-preview__lines > .is-snip {
    opacity: 0.22;
    width: 48%;
}

#page-chat .profile-workspace .appearance-preview__chat.is-active .appearance-preview__lines > span {
    background: var(--pv-pill-text, #191b13);
    opacity: 0.85;
    width: 94%;
}

#page-chat .profile-workspace .appearance-preview__chat.is-active .appearance-preview__lines > .is-snip {
    width: 60%;
}

/* Conversation. */
#page-chat .profile-workspace .appearance-preview__main {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-width: 0;
}

#page-chat .profile-workspace .appearance-preview__header {
    align-items: center;
    border-bottom: 1px solid var(--pv-border, #1c1c1c);
    display: flex;
    gap: 10px;
    padding: 12px 18px;
}

#page-chat .profile-workspace .appearance-preview__avatar--peer {
    align-items: center;
    background: var(--pv-card, #121212);
    border: 1px solid var(--pv-border, #1c1c1c);
    color: var(--pv-text, #fff);
    display: inline-flex;
    font-size: 13px;
    font-weight: 600;
    height: 34px;
    justify-content: center;
    width: 34px;
}

#page-chat .profile-workspace .appearance-preview__header-copy {
    display: grid;
    gap: 2px;
    line-height: 1.25;
}

#page-chat .profile-workspace .appearance-preview__header-name {
    color: var(--pv-text, #fff);
    font-size: 13px;
    font-weight: 600;
}

#page-chat .profile-workspace .appearance-preview__header-meta {
    align-items: center;
    color: var(--pv-muted, #737373);
    display: inline-flex;
    font-size: 10.5px;
    gap: 4px;
}

#page-chat .profile-workspace .appearance-preview__header-meta .ui-icon {
    height: 10px;
    width: 10px;
}

#page-chat .profile-workspace .appearance-preview__thread {
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: flex-end;
    overflow: hidden;
    padding: 18px 18px 18px;
}

#page-chat .profile-workspace .appearance-preview[data-appearance-density="compact"] .appearance-preview__thread {
    gap: 5px;
}

#page-chat .profile-workspace .appearance-preview__bubble {
    border: 1px solid transparent;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.35;
    max-width: 78%;
    padding: 10px 16px;
}

#page-chat .profile-workspace .appearance-preview[data-appearance-density="compact"] .appearance-preview__bubble {
    padding: 6px 13px;
}

#page-chat .profile-workspace .appearance-preview__bubble.is-other {
    align-self: flex-start;
    background: var(--pv-card, #121212);
    border-color: var(--pv-border, #1c1c1c);
    color: var(--pv-text, #fff);
}

#page-chat .profile-workspace .appearance-preview__bubble.is-own {
    align-self: flex-end;
    background: var(--pv-own, #303c08);
    color: var(--pv-own-text, #fff);
}

#page-chat .profile-workspace .appearance-preview__composer {
    align-items: center;
    background: var(--pv-card, #121212);
    border: 1px solid var(--pv-border, #1c1c1c);
    border-radius: 999px;
    box-shadow: var(--pv-card-shadow, none);
    display: flex;
    gap: 8px;
    margin: 0 16px 16px;
    padding: 5px 5px 5px 18px;
}

#page-chat .profile-workspace .appearance-preview__composer-field {
    color: var(--pv-muted, #737373);
    flex: 1;
    font-size: 12px;
}

#page-chat .profile-workspace .appearance-preview__composer-send {
    align-items: center;
    background: var(--pv-accent, #c7ff00);
    border-radius: 50%;
    color: var(--pv-on-accent, #0b0b0b);
    display: inline-flex;
    height: 34px;
    justify-content: center;
    width: 34px;
}

#page-chat .profile-workspace .appearance-preview__composer-send .ui-icon {
    height: 15px;
    stroke-width: 2.2;
    width: 15px;
}

#page-chat .profile-workspace .appearance-preview__note {
    color: var(--text-secondary, #737373);
    font-size: 12px;
    margin: 0;
}

#page-chat .profile-workspace #uiAppearancePreviewName {
    color: var(--text-primary, #fff);
    font-weight: 600;
}

@media (max-width: 520px) {
    #page-chat .profile-workspace .appearance-preview__window {
        grid-template-columns: 1fr;
        min-height: 320px;
    }

    #page-chat .profile-workspace .appearance-preview__sidebar {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    #page-chat .profile-workspace .appearance-preview {
        --pv-ease: 0s linear;
    }
}

/* ── Settings nav (left sidebar) — images/image 109.png ───────────────────────
   Header + counter, the "you" card, PREFERENCES rows with an icon tile and a
   subtitle, a divider, Log out, the E2EE card. The bottom dock is untouched.
   The active row is the theme's pill (themes.css); here its tile turns dark
   with an accent icon and the → shows. */
/* The "you" card */
#page-chat .profile-nav-card {
    align-items: center;
    appearance: none;
    background: color-mix(in srgb, var(--text-primary, #fff) 4%, transparent);
    border: 1px solid var(--border-subtle, var(--theme-border, #1c1c1c));
    border-radius: 18px;
    color: inherit;
    cursor: pointer;
    display: flex;
    flex-shrink: 0;
    gap: 12px;
    padding: 10px 10px 10px 12px;
    text-align: left;
    transition: background-color 0.15s ease-out, border-color 0.15s ease-out;
    width: 100%;
}

#page-chat .profile-nav-card:hover,
#page-chat .profile-nav-card:focus-visible {
    background: color-mix(in srgb, var(--text-primary, #fff) 7%, transparent);
    outline: none;
}

#page-chat .profile-nav-card__avatar-wrap {
    flex: none;
    position: relative;
}

#page-chat .profile-nav-card__avatar {
    align-items: center;
    border-radius: 50%;
    display: flex;
    font-family: var(--f-ui);
    font-size: 16px;
    font-weight: 600;
    height: 40px;
    justify-content: center;
    overflow: hidden;
    width: 40px;
}

#page-chat .profile-nav-card__avatar .contact-avatar-img {
    border-radius: inherit;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

/* Status dot: the profile's own status colour, ringed in the card's ground */
#page-chat .profile-nav-card__status {
    background: #2bae6c;
    border: 2px solid var(--nexa-aside-fill, var(--bg-section, #0a0a0a));
    border-radius: 50%;
    bottom: -1px;
    height: 12px;
    position: absolute;
    right: -1px;
    width: 12px;
}

#page-chat .profile-nav-card__status[data-status="away"] {
    background: #f5b52e;
}

#page-chat .profile-nav-card__status[data-status="busy"] {
    background: var(--color-danger, #f62834);
}

#page-chat .profile-nav-card__status[data-status="invisible"] {
    background: color-mix(in srgb, var(--text-primary, #fff) 35%, transparent);
}

#page-chat .profile-nav-card__copy {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

#page-chat .profile-nav-card__name {
    color: var(--text-primary, var(--theme-text, #f4f4f5));
    font-family: var(--f-ui);
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#page-chat .profile-nav-card__handle {
    color: var(--text-secondary, var(--theme-text-muted, #8a8a8a));
    font-family: var(--f-mono, ui-monospace, monospace);
    font-size: 11.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#page-chat .profile-nav-card__chev {
    align-items: center;
    border: 1px solid var(--border-subtle, var(--theme-border, #1c1c1c));
    border-radius: 50%;
    color: var(--text-secondary, var(--theme-text-muted, #8a8a8a));
    display: flex;
    flex: none;
    height: 30px;
    justify-content: center;
    width: 30px;
}

#page-chat .profile-nav-card__chev .ui-icon {
    height: 14px;
    width: 14px;
}

/* PREFERENCES */
#page-chat .profile-nav .profile-nav-kicker {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    margin: 20px 8px 8px;
}

/* Rows: tile · title + subtitle · trail (meta / →) */
#page-chat .profile-nav .profile-nav-btn {
    border-radius: 18px;
    gap: 12px;
    padding: 8px 12px 8px 8px;
}

#page-chat .profile-nav-tile {
    align-items: center;
    background: color-mix(in srgb, var(--text-primary, #fff) 5%, transparent);
    border: 1px solid var(--border-subtle, var(--theme-border, #1c1c1c));
    border-radius: 12px;
    display: flex;
    flex: none;
    height: 40px;
    justify-content: center;
    transition: background-color 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out;
    width: 40px;
}

#page-chat .profile-nav .profile-nav-tile .profile-nav-icon {
    height: 18px;
    opacity: 1;
    width: 18px;
}

#page-chat .profile-nav .profile-nav-copy {
    flex: 1 1 auto;
    gap: 2px;
}

#page-chat .profile-nav .profile-nav-label {
    color: var(--text-primary, var(--theme-text, #f4f4f5));
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

#page-chat .profile-nav-sub {
    color: var(--text-secondary, var(--theme-text-muted, #8a8a8a));
    font-size: 12px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#page-chat .profile-nav-trail {
    align-items: center;
    display: flex;
    flex: none;
    gap: 8px;
}

#page-chat .profile-nav-meta {
    color: var(--text-secondary, var(--theme-text-muted, #8a8a8a));
    font-family: var(--f-mono, ui-monospace, monospace);
    font-size: 11px;
}

#page-chat .profile-nav-arrow {
    display: none;
    height: 16px;
    width: 16px;
}

/* Active: the theme's pill (themes.css); dark tile, accent icon, → shown */
#page-chat .profile-nav-btn.is-active .profile-nav-arrow {
    display: block;
}

#page-chat .profile-nav-btn.is-active .profile-nav-meta {
    display: none;
}

html[data-theme] #page-chat .profile-nav-btn.is-active .profile-nav-label,
html[data-theme] #page-chat .profile-nav-btn.is-active .profile-nav-arrow {
    color: var(--active-pill-text, #070707);
}

html[data-theme] #page-chat .profile-nav-btn.is-active .profile-nav-sub {
    color: color-mix(in srgb, var(--active-pill-text, #070707) 70%, transparent);
}

html[data-theme] #page-chat .profile-nav-btn.is-active .profile-nav-tile {
    background: color-mix(in srgb, var(--active-pill-text, #070707) 92%, transparent);
    border-color: transparent;
}

html[data-theme] #page-chat .profile-nav-btn.is-active .profile-nav-tile .ui-icon {
    color: var(--active-pill-bg, #c7ff00);
}

/* Divider + Log out (red tile) */
#page-chat .profile-nav-divider {
    border: 0;
    border-top: 1px solid var(--border-subtle, var(--theme-border, #1c1c1c));
    margin: 14px 8px;
}

#page-chat .profile-nav-btn--logout .profile-nav-tile {
    background: color-mix(in srgb, var(--color-danger, #f62834) 12%, transparent);
    border-color: color-mix(in srgb, var(--color-danger, #f62834) 18%, transparent);
    color: var(--text-danger, #f62834);
}

#page-chat .profile-nav .profile-nav-btn--logout .profile-nav-label {
    color: var(--text-danger, #f62834);
}

/* The settings nav carries the chat list's header (SidebarHeader), titled
   "Settings", at exactly the same spot: the nav's top padding is undone for
   it. Specific enough to beat app-layout.css's .left-capsule .profile-nav
   padding (loaded later) — at equal weight that one won, and the header sat
   20px lower than NEXA's. */
#page-chat:not(.is-viewport-app-stack) .left-capsule .left-capsule-shelf > .profile-nav {
    padding-top: 0;
}

#page-chat:not(.is-viewport-app-stack) .left-capsule .profile-nav > .left-sidebar-header {
    flex-shrink: 0;
    margin: 13px -1px 20px;
}

/* Mobile keeps its own top toolbar (with the "Settings" title) */
#page-chat.is-viewport-app-stack .profile-nav .left-sidebar-header,
#page-chat.is-viewport-profile-stack .profile-nav .left-sidebar-header {
    display: none;
}
