:root {

    --gapz: calc( var(--gap) / 3 );
    --header-height: 80px;
    --avatar-pill-width: 180px;
}

.input-group {
    display: flex;
    align-items: stretch;
    width: 100%;

    margin-bottom: var(--padding);

    .input-group-text {
        display: flex;
        align-items: center;
        padding: 0.375rem 0.75rem;
        background-color: var(--btn);
        border: 1px solid var(--border);
        border-radius: var(--border-radius);

        i {
            font-size: 1rem;
            color: var(--muted);
        }
    }

    .form-floating {
        position: relative;
        flex: 1 1 auto;
        width: 1%;

        .form-control {
            display: block;
            width: 100%;
            padding: 0 0.75rem;
            font-size: 1rem;
            line-height: 1.5;
            color: var(--text);
            background-color: var(--header-bg);
            border: 1px solid var(--border);
            border-left: none;
            border-radius: unset;
            transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;

            &:focus {
                color: var(--text);
                background-color: var(--header-bg);
                border-color: var(--border);
                outline: 0;
                box-shadow: var(--box-shadow);
                z-index: 3;
            }

            &::placeholder {
                color: transparent;
            }

            &:focus ~ label,
            &:not(:placeholder-shown) ~ label {
                height: auto;
                padding: 0 0.35rem;
                margin-left: 0.4rem;
                line-height: 1.2;
                background: var(--header-bg);
                transform: translateY(-50%) scale(0.8);
                z-index: 4;
            }

            &:focus ~ label { color: var(--brand); }
        }

        input.form-control {
            border-top-right-radius: var(--border-radius);
            border-bottom-right-radius: var(--border-radius);
        }

        select.form-select {
            padding-left: 11px;
        }

        textarea.form-control {
            min-height: calc(3.5rem + 2px);
            padding: 0.75rem;
            resize: vertical;
            margin: 0px;
            border-top-right-radius: var(--border-radius);
            border-bottom-right-radius: var(--border-radius);
        }

        label {
            position: absolute;
            top: 0;
            left: 0;
            width: auto;
            height: 100%;
            display: flex;
            align-items: center;
            max-width: calc(100% - 1rem);
            padding: 0 0.75rem;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            pointer-events: none;
            border-radius: var(--border-radius);
            transform-origin: 0 50%;
            transition: transform 0.15s ease, color 0.15s ease;
            color: var(--muted);
        }

        &:has( > textarea ) > label {
            height: auto;
            padding-top: 0.75rem;
        }
    }
}

.form-check.form-switch {

    display: flex;
    align-items: center;

    & label {
        padding: var(--padding);
        background: transparent;
        border-radius: var(--border-radius);

        &:hover {
            background: var(--btn);
        }

        &:active,
        &:focus {
            background: var(--btn-hover);
        }
    }
}

.btn-group label { padding: var(--padding); }

label.square {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--border-radius);

    &:hover {
        cursor: pointer;
        transform: scale(0.99) translateY(1px);
    }
}

#primary section:not(.pty-dash-card) {
    min-height: calc( 100vh - calc( var(--gap) * 4.5 ) );
}

.social-cover,
.member-profile,
#member-profile {

    --cover-height: 100% !important;
    width: 100%;
    height: 100%;

    & * { color: var(--white) !important; }

    &.roadmap-profile {}
    &.group-profile {}
    &.forum-profile {}
    &.member-profile {}

    & .member-cover {

        position: relative;
        width: 100%;
        height: var(--cover-height) !important;
        overflow: hidden;
        background: var(--color-30);

        & #header-cover-image {

            position: absolute;
            left: 0;
            width: 100%;
            height: 100%;
            user-select: none;

        }

        & .header-edit-actions {

            & #trigger-cover-upload {}
            & #trigger-cover-drag {}
            & #save-cover-drag {}
            & #trigger-cover-history {}

            & button {

                & i {}
            }
        }
    }

    & .member-header {

        & .member-avatar-wrap {

            & > .avatar {}

            & .badge {}

            & .avatar-edit {

                & .dropdown-toggle {

                    & i {}
                }

                & .dropdown-menu {

                    & .dropdown-item {

                        & .icon-text-badge {

                            & .icon {}
                            & .text {}
                        }
                    }
                }
            }
        }

        & .member-info {

            & .member-name {

                font-size: 16px;

                & .member-name-badge {}
            }

            & .member-type {}

            & .member-bio {
                font-size: 16px;
            }

            & .member-activity {}

            & .member-stats {}

            & .member-meta {

                & .icon-text-badge {

                    & .icon {}
                    & .text {}
                }
            }
        }
    }
}

.hero {

    &:hover .header-edit-actions {
        opacity: 1;
    }

    .header-edit-actions {
        position: absolute;
        top: 15px;
        left: 15px;
        z-index: 10;
        opacity: 0;

        backdrop-filter: var(--backdrop-filter);
        display: flex;
        list-style: none;

        & > li {
            flex: 0 0 auto;
        }

        & .nav-link {

            color: var(--header-bg);
            padding: .4rem .65rem;
            cursor: pointer;
            border-radius: var(--border-radius);
            transition: background .15s;
            background-color: transparent;

            &:hover {
                background: rgba(0,0,0,.8);
            }
        }
    }
}

.member-header {

    display: flex;
    align-items: flex-end;
    gap: 1.25rem;

    position: absolute;
    z-index: 5;
    bottom: 115px;
    left: 15px;

    & * {
        color: var(--header-bg);
    }

    & .member-avatar-wrap {

        position: relative;
        flex-shrink: 0;

        &:hover .avatar-edit .nav-link,
        &:focus-within .avatar-edit .nav-link,
        & .avatar-edit .dropdown-toggle.show {
            opacity: 1;
        }

        & .member-avatar {
            list-style: none;

            & .nav-link {
                width: auto;
                min-width: 0;
                height: auto;
                padding: 0;
                background: transparent;
            }
        }

        & .dropdown-menu,
        & .dropdown-menu * {
            color: var(--text);
        }

        & .avatar {

            width: calc( var(--input-size) * 3 );
            height: calc( var(--input-size) * 3 );
            border-radius: var(--border-radius);
            object-fit: cover;
            border: 4px solid var(--border);
            background: var(--color-30);
            display: block;

        }

                & .avatar-edit {
            position: relative;
            list-style: none;

            & > .nav-item > .nav-link {
                position: relative;
                display: block;
                width: auto;
                min-width: calc(var(--input-size) * 3);
                height: auto;
                min-height: calc(var(--input-size) * 3);
                padding: 0;
                background: transparent;
                border-radius: var(--border-radius);
                overflow: hidden;
                transform: none;

                &::after {
                    display: none;
                }

                &:hover,
                &:active {
                    background: transparent;
                    transform: none;
                }

                & .avatar-edit-icon {
                    position: absolute;
                    inset: 0;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    background: var(--btn);
                    font-size: 1.75rem;
                    opacity: 0;
                    transition: opacity .2s;

                    & i {
                        color: var(--white);
                    }
                }

                &:hover .avatar-edit-icon,
                &:focus-visible .avatar-edit-icon,
                &.show .avatar-edit-icon {
                    opacity: 1;
                }
            }

            & .dropdown-menu {
                top: 0;
                left: calc(100% + var(--padding) / 2);
                margin: 0;
            }
        }

        & .badge {
            position: absolute;
            bottom: 8px;
            right: 8px;
            width: 14px;
            height: 14px;
            border-radius: var(--border-radius);
            border: 2px solid var(--border);
        }

        & button {
            & i {

            }
        }
    }

    & .member-info {

        flex: 1;
        padding-bottom: .25rem;
        color: var(--header-bg) !important;

        & * { color: var(--text) !important; }

        & .member-name {
            font-size: 1.5rem;
            font-weight: 700;
            margin: 0 0 .25rem;
            line-height: 1.2;
        }

        & .member-handle {
            margin: 0 0 .25rem;
            font-size: .875rem;
            opacity: .7;
        }

        & .member-type {
            display: inline-block;
            font-size: .75rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: .05em;

            backdrop-filter: var(--backdrop-filter);
            color: var(--header-bg);
            padding: .15rem .5rem;
            border-radius: var(--border-radius);
            margin: 0 0 .25rem;

        }

        & .member-activity {
            font-size: .8rem;
            opacity: .65;
            margin: 0;
        }

        & .member-bio {
            font-size: .875rem;
            line-height: 1.5;
            margin: .35rem 0 .25rem;
            opacity: .9;
            max-width: 480px;
        }

        & .member-meta{

        }

    }
}

.badge.online           { background: #22c55e; }
.badge.recently-online  { background: #f59e0b; }
.badge.offline          { background: var(--color-30); }
.badge.never-logged-in  { background: var(--color-30); }

.member-social-links {

    height: auto !important;
    flex-wrap: wrap;
    gap: var(--gap);

    position: absolute;
    bottom: calc(var(--gap) * 4);
    right: var(--gap);
    z-index: 3;

    & .member-social-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: var(--input-size);
        height: var(--input-size);
        border-radius: var(--border-radius);
        backdrop-filter: var(--backdrop-filter);

        & i { color: var(--header-bg) !important; font-size: 24px; }

        &:hover {
            background: var(--header-bg);
            & i { color: var(--cta) !important; }
        }
    }
}

.js-block-btn,
.js-unblock-btn {
    white-space: nowrap;
}

.member-nav {

}

.member-nav .nav-tabs {

}

.member-nav .nav-link {

}

.pty-crop-container {
    max-height: 70vh;
    overflow: hidden;

    & img {
        display: block;
        max-width: 100%;
    }
}

.pty-webcam-frame {
    display: block;
    width: 100%;
}

.settings-export,
.settings-actions,
.danger-zone-actions,
.du-actions,
.backup-codes-actions,
.invitation-actions,
.pty-stream-controls,
.pty-chat-send,
.message-actions,
.thread-header-actions,
.pty-quick-replies,
.security-actions {
    margin: 0;
    padding: 0;
    list-style: none;
}

.danger-zone-actions {
    display: flex;
    gap: var(--padding);

    & > li {
        flex: 1 1 0;
    }
}

.du-actions > li {
    flex: 1 1 0;
}

.invitation-actions {
    margin-left: auto;
}

.security-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--padding);
}

.totp-code-row {
    display: flex;
    align-items: center;
    gap: var(--padding);
    max-width: 420px;

    & > input {
        flex: 1 1 auto;
        min-width: 0;
    }

    & > .security-actions {
        flex: 0 0 auto;
    }
}

ul.group-members.manage {
    display: flex;
    flex-direction: column;
    gap: var(--padding);
    margin: 0;
    padding: 0;
    list-style: none;

    & > li.group-member {
        display: flex;
        align-items: center;
        gap: var(--padding);

        & .avatar {
            width: var(--input-size);
            height: var(--input-size);
            border-radius: var(--radius);
            object-fit: cover;
        }

        & .name {
            flex: 1 1 auto;
            min-width: 0;
        }

        & ul.actions {
            display: flex;
            gap: var(--padding);
            margin: 0;
            padding: 0;
            list-style: none;
        }
    }
}

@keyframes reaction-pop {
    0%   { transform: scale(0); opacity: 0; }
    70%  { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes pty-bot-bounce {
    0%   { transform: scale(1)    rotate(0deg);   }
    30%  { transform: scale(1.35) rotate(-10deg); }
    60%  { transform: scale(0.9)  rotate(5deg);   }
    80%  { transform: scale(1.1)  rotate(-3deg);  }
    100% { transform: scale(1)    rotate(0deg);   }
}

@keyframes pty-ripple {
    0%   { width: 100%; height: 100%; opacity: 0.8; }
    100% { width: 260%; height: 260%; opacity: 0;   }
}

@keyframes pty-toast-progress {
    from { width: 100%; }
    to   { width: 0%; }
}

@keyframes pixel-dissolve {
  0% {
    opacity: 1;
    transform: scale(1);
    filter: saturate(1) blur(0px);
  }
  50% {
    opacity: 0.8;
    transform: scale(0.97);
    filter: saturate(2) blur(2px);
  }
  100% {
    opacity: 0;
    transform: scale(0.92);
    filter: saturate(0) blur(6px);
  }
}

@keyframes collapse-height {
  to {
    max-height: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
}
@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

@keyframes pty-filter-in {
    from { opacity: 0; transform: scale(.96); }
    to   { opacity: 1; transform: none; }
}

@keyframes pty-slide-up {
    from { opacity: 0; transform: translateY(550px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 576px) {

    #member-profile {
        --cover-height: 180px;
    }

    .member-header {
        flex-direction: column;
        align-items: flex-start;
        margin-top: -2rem;
        gap: .75rem;
    }

    .member-avatar-wrap .avatar {
        width: 80px;
        height: 80px;
    }
}

.connections-tabs {
    gap: var(--gap);
    flex-wrap: wrap;
}

.connections-grid {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.connection-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .75rem 1rem;
    background: var(--border);
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
}

.connection-avatar {
    position: relative;
    flex-shrink: 0;
}

.connection-avatar .avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    object-fit: cover;
    display: block;
}

.connection-avatar .badge {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    border-radius: var(--border-radius);
    border: 2px solid var(--border);
}

.connection-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .1rem;
    min-width: 0;
}

.connection-name {
    font-weight: 600;
    font-size: .9rem;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.connection-name:hover { color: var(--brand); }

.connection-type {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--brand);
}

.connection-activity {
    font-size: .75rem;
    color: var(--text-muted);
}

.connection-actions {
    flex-shrink: 0;
}

.notification-item {

    display: flex;
    align-items: center;
    gap: var(--padding);
    padding: var(--padding);
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
    background: var(--border);
    margin-bottom: .5rem;
    transition: background .15s;

    &.unread {

        background-color: var(--error-lighter);
        border: 1px solid var(--error-light);

        & * { color: var(--error) !important; }

        & img.avatar {

        }

        & .notification-actions {

            & button {

                &:hover {

                    background-color: var(--error-light);

                }

                &:active,
                &:focus,
                &:active:focus {

                    background-color: var(--error) !important;
                    & * { color: var(--header-bg) !important; }

                }
            }
        }

    }

    &:hover .btn-xs { opacity: 1; }

    & .notification-avatar img {
        width: var(--input-size);
        height: var(--input-size);
        border-radius: var(--border-radius);
        object-fit: cover;
        flex-shrink: 0;
    }

    & .notification-body {
        flex: 1;
        display: flex;
        flex-direction: column;

        min-width: 0;

        & .notification-label {
            font-size: .875rem;
            font-weight: 500;
            color: var(--text);
            text-decoration: none;

            &:hover { color: var(--brand); }
        }

        & .notification-date {
            font-size: .75rem;
            color: var(--text-muted);
        }
    }

    & .notification-actions {
        display: flex;
        gap: var(--gap);
        flex-shrink: 0;

        & button {
            background-color: transparent;
            opacity: .5;
            transition: opacity .15s;
        }
    }
}

body[data-theme-shape="round"] {

    & .thread-source-badge {
        bottom: -6px !important;
        right: -6px !important;
    }
}

.settings-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2rem;
    align-items: start;
}

@media ( max-width: 576px ) {
    .settings-layout {
        grid-template-columns: 1fr;
    }
    .settings-nav {
        display: flex;
        overflow-x: auto;
    }
    .settings-nav .nav {
        flex-direction: row !important;
        flex-wrap: nowrap;
    }
}

.settings-nav .nav-link {
    color: var(--text-muted);
    border-radius: var(--border-radius);
    padding: .5rem .75rem;
    font-size: .875rem;
    white-space: nowrap;
}

.settings-nav .nav-link:hover  { color: var(--brand); background: var(--color-30); }
.settings-nav .nav-link.active { color: var(--brand); background: color-mix( in srgb, var(--brand) 10%, var(--card-bg) ); }

.settings-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}

.settings-fields {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.settings-field {
    display: grid;
    grid-template-columns: 220px 1fr;
    align-items: center;
    gap: 1rem;
}

@media ( max-width: 576px ) {
    .settings-field {
        grid-template-columns: 1fr;
        gap: .35rem;
    }
}

.settings-label {
    font-size: .875rem;
    font-weight: 500;
    color: var(--text);
    margin: 0;
}

.danger-zone .settings-label {
    color: var(--bs-danger);
}

.settings-saved-msg {
    font-size: .875rem;
    color: #22c55e;
}

.pty-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.pty-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.pty-toggle-slider {
    width: 44px;
    height: 24px;
    background: var(--color-30);
    border-radius: var(--border-radius);
    transition: background .2s;
    position: relative;
    flex-shrink: 0;
}

.pty-toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: var(--header-bg);
    border-radius: var(--border-radius);
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.pty-toggle input:checked + .pty-toggle-slider {
    background: var(--brand);
}

.pty-toggle input:checked + .pty-toggle-slider::after {
    transform: translateX( 20px );
}

.pty-radio-group {
    display: flex;
    gap: var(--gap);
    flex-wrap: wrap;
}

.pty-radio-item {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: .875rem;
    transition: border-color .15s, background .15s;
}

.pty-radio-item:has( input:checked ) {
    border-color: var(--brand);
    background: color-mix( in srgb, var(--brand) 8%, var(--card-bg) );
    color: var(--brand);
}

.pty-radio-item input {
    display: none;
}

.send-email-form {

}

.invitation-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .75rem 1rem;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    margin-bottom: .5rem;
    transition: background .15s;
}

.invitation-item:hover { background: var(--color-30); }

.invitation-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.invitation-name {
    font-weight: 600;
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.invitation-email {
    font-size: .75rem;
}

.invitation-meta {
    display: flex;
    align-items: center;
    gap: var(--gap);
    flex-shrink: 0;
}

#messages-wrap {

    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    height: calc(100vh - 280px);
    min-height: 500px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--header-bg);

    & .messages-sidebar-header,
    & .thread-view-header {
        height: var(--header-height);
        min-height: var(--header-height);
        flex-shrink: 0;
    }

    & .messages-sidebar {

        display: flex;
        flex-direction: column;
        border-right: 1px solid var(--border);
        overflow: hidden;

        & .messages-sidebar-header {

            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 1rem 1.25rem;
            border-bottom: 1px solid var(--border);
            flex-shrink: 0;

            & h3 { font-size: 1rem; margin: 0; }
        }

        & .messages-search-bar {

            position: relative;
            padding: .5rem .75rem;
            border-bottom: 1px solid var(--border);
            flex-shrink: 0;

            & input {
                background: var(--surface-2, var(--bg-secondary));
                border-color: var(--btn);
            }

            & #msg-search-results {

                position: absolute;
                top: 100%;
                left: 0;
                right: 0;
                z-index: 200;
                background: var(--surface, var(--bg));
                border: 1px solid var(--border);
                border-radius: var(--border-radius);
                box-shadow: var(--shadow-md, 0 4px 16px rgba(0,0,0,.15));
                max-height: 320px;
                overflow-y: auto;

                & .msg-search-result {

                    cursor: pointer;
                    border-bottom: 1px solid var(--box-);
                    transition: background .15s;

                    &:last-child { border-bottom: none; }

                    &:hover {
                        background: var(--surface-hover, var(--brand-tint, rgba(0,0,0,.04)));
                    }

                    & .tiny {
                        font-size: .7rem;
                        margin-top: .15rem;
                    }
                }
            }
        }

        & #thread-list {

            flex: 1;
            overflow-y: auto;
            padding: var(--padding);

            & .thread-row {

                display: flex;
                align-items: center;
                gap: var(--gap);
                padding: var(--padding);
                border-radius: var(--border-radius);
                border: 1px solid var(--border);
                background: var(--header-bg);
                margin-bottom: var(--padding);
                cursor: pointer;
                transition: background .15s;

                &:hover  { background: var(--btn); transform: scale(0.99) translateY(1px); }

                &.active {

                    background: var(--cta);

                    &:hover {

                        cursor: unset;
                        transform: unset;

                    }

                    & * {

                        color: var(--header-bg) !important;

                    }

                    & .thread-avatar-wrap {

                        outline: 3px solid var(--header-bg) !important;
                    }
                }

                & .thread-avatar-wrap {
                    position:    relative;
                    flex-shrink: 0;
                    border-radius: var(--border-radius);

                    outline: 3px solid var(--btn) !important;
                    border: 1px solid var(--header-bg);

                    & img.thread-avatar {
                        border-radius: var(--border-radius);

                        width: var(--input-size);
                        height: var(--input-size);
                        border-radius: var(--border-radius);
                        object-fit: cover;
                        flex-shrink: 0;
                    }

                    & .thread-source-badge {
                        position:      absolute;
                        bottom:        -11px;
                        right:         -11px;
                        width:         var(--badge-size);
                        height:        var(--badge-size);
                        border-radius: var(--badge-radius);
                        display:       flex;
                        align-items:   center;
                        justify-content: center;
                        font-size:     9px;
                        border:        1px solid var(--header-bg);
                        line-height:   1;
                        color: var(--header-bg);
                        background: var(--cta);

                        &.source-fb       { background: #1877F2;  }

                        &.source-ig       { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285aeb 90%); color: var(--header-bg); }

                        & i {

                            width:         10px;
                            height:        10px;
                            object-fit:    contain;
                            border-radius: 2px;
                            color: var(--header-bg) !important;

                        }
                    }
                }

                & .thread-body {

                    flex: 1;
                    min-width: 0;

                    & .thread-top {

                        display: flex;
                        justify-content: space-between;
                        align-items: baseline;
                        gap: var(--gapz);
                        margin-bottom: var(--padding);

                        & .thread-recipients {
                            font-weight: 600;
                            font-size: .9rem;
                            flex: 0 0 140px;
                            white-space: nowrap;
                            overflow: hidden;
                            text-overflow: ellipsis;
                        }

                        & .thread-time {
                            font-size: .7rem;
                            color: var(--text-muted);
                            flex-shrink: 0;
                        }

                    }

                    & .thread-preview {
                        flex: 1;
                        font-size: .85rem;
                        color: var(--text);
                        white-space: nowrap;
                        overflow: hidden;
                        text-overflow: ellipsis;
                    }

                    & .thread-meta {
                        display: flex;
                        align-items: center;
                        gap: .4rem;
                        font-size: .75rem;
                        color: var(--text-muted);
                        flex-shrink: 0;
                    }

                    & .thread-unread-dot {
                        width: 8px;
                        height: 8px;
                        border-radius: var(--border-radius);
                        background: var(--brand);
                        display: inline-block;
                    }
                }
            }
        }
    }

    & .messages-main {

        display: flex;
        flex-direction: column;
        overflow: hidden;
        position: relative;

        & #messages-empty-state {

            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100%;
            color: var(--text-muted);
            gap: .75rem;
            font-size: .95rem;

            & i {
                font-size: 2.5rem;
                opacity: .3;
            }
        }

        & #compose-panel {

            height: 100%;

            & .compose-form {
                padding: var(--padding);
                height: 100%;
                overflow-y: scroll;
            }
        }

    }
}

#emoji-picker,
#reaction-picker {

    display: grid;
    grid-template-columns: repeat(7, var(--input-size));
    gap: calc(var(--padding) / 2);
    padding: var(--padding);
    z-index: 1060;
    background: var(--header-bg);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);

    & .emoji {

        width: var(--input-size);
        height: var(--input-size);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        border: 0;
        background: none;
        border-radius: var(--border-radius);
        font-size: calc(var(--input-size) / 2.2);
        line-height: 1;
        cursor: pointer;
        transition: var(--transition);

        &:hover {
            background: var(--btn-hover);
            transform: scale(1.15);
        }

        &.active {
            background: color-mix( in srgb, var(--cta) 15%, transparent );
            transform: scale(1.2);
        }
    }
}

@media ( max-width: 768px ) {
    #messages-wrap {
        grid-template-columns: 1fr;
        grid-template-rows: 280px 1fr;
        height: auto;
        min-height: 600px;
    }

    .messages-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    #thread-list { max-height: 200px; }
}

.msg-attachment-img {
    max-width:    220px;
    max-height:   220px;
    border-radius: var(--border-radius);
    display:      block;
    margin-top:   .4rem;
    object-fit:   contain;
    cursor:       zoom-in;
}

.msg-attachment-file {
    display:         inline-flex;
    align-items:     center;
    gap:             var(--gapz);
    margin-top:      .4rem;
    font-size:       .85rem;
    background:      var(--color-03, #f5f5f5);
    border:          1px solid var(--color-08, #e0e0e0);
    border-radius:   var(--border-radius);
    padding:         .3rem .6rem;
    text-decoration: none;
    color:           inherit;
}

@keyframes typingBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40%           { transform: translateY(-5px); }
}

.reaction-trigger:hover,
.message-bubble:hover .reaction-trigger {
    opacity: 1;
    transform: scale(1.15);
    color: var(--brand, #1274e0);
}

.gif-picker-panel {
       background: var(--bs-body-bg);
       border: 1px solid var(--bs-border-color);
       border-radius: 8px;
       padding: 8px;
       max-height: 320px;
       display: flex;
       flex-direction: column;
       gap: 6px;
   }
   .gif-results-grid {
       display: grid;
       grid-template-columns: repeat(3, 1fr);
       gap: 4px;
       overflow-y: auto;
       flex: 1;
   }
   .gif-results-grid .gif-item {
       border: none;
       padding: 0;
       background: none;
       cursor: pointer;
       border-radius: 4px;
       overflow: hidden;
       height: auto !important;
       min-height: auto !important;
   }
   .gif-results-grid .gif-item img {
       width: 100%;
       height: 80px;
       object-fit: cover;
       display: block;
   }
   .gif-powered-by {
       font-size: 11px;
       color: var(--bs-secondary-color);
       text-align: right;
       margin: 0;
   }

.reply-to-strip {
    display:        flex;
    align-items:    center;
    gap:            var(--gapz);
    padding:        .35rem 1rem;
    margin-bottom:  var(--gapz);
    background:     var(--color-30);
    border-left:    3px solid var(--brand, #1274E0);
    border-radius:  0 var(--border-radius) var(--border-radius) 0;
    font-size:      .8rem;

    & .reply-to-content {
        flex:        1;
        min-width:   0;
        display:     flex;
        flex-direction: column;
        gap:         .1rem;
    }

    & .reply-to-name {
        font-weight: 600;
        color:       var(--brand, #1274E0);
        white-space: nowrap;
        overflow:    hidden;
        text-overflow: ellipsis;
    }

    & .reply-to-preview {
        color:       var(--text-muted);
        white-space: nowrap;
        overflow:    hidden;
        text-overflow: ellipsis;
    }
}

.reply-quote {
    background:     color-mix(in srgb, var(--brand, #1274E0) 8%, transparent);
    border-left:    3px solid var(--brand, #1274E0);
    border-radius:  0 var(--border-radius) var(--border-radius) 0;
    padding:        .3rem .6rem;
    margin-bottom:  .4rem;
    font-size:      .8rem;
    cursor:         pointer;
    transition:     background .15s;

    &:hover {
        background: color-mix(in srgb, var(--brand, #1274E0) 14%, transparent);
    }

    & .reply-quote-name {
        font-weight:   600;
        color:         var(--brand, #1274E0);
        display:       block;
        margin-bottom: .1rem;
    }

    & .reply-quote-text {
        color:         var(--text-muted);
        display:       block;
        white-space:   nowrap;
        overflow:      hidden;
        text-overflow: ellipsis;
    }
}

.forwarded-label {
    font-size:    .72rem;
    color:        var(--text-muted);
    font-style:   italic;
    margin-bottom: .25rem;
    display:      flex;
    align-items:  center;
    gap:          .25rem;

    & i { font-size: .7rem; opacity: .7; }
}

.edited-tag {
    font-size:  .68rem;
    color:      var(--text-muted);
    font-style: italic;
    margin-left: .2rem;
    opacity:    .75;
}

.pinned-tag {
    position:   absolute;
    top:        .35rem;
    right:      .5rem;
    font-size:  .65rem;
    color:      var(--brand, #1274E0);
    opacity:    .7;
    transform:  rotate(45deg);
}

.pinned-banner {
    display:        flex;
    align-items:    center;
    gap:            .6rem;
    padding:        .4rem 1rem;
    background:     color-mix(in srgb, var(--brand, #1274E0) 8%, transparent);
    border-bottom:  1px solid color-mix(in srgb, var(--brand, #1274E0) 20%, transparent);
    cursor:         pointer;
    flex-shrink:    0;
    transition:     background .15s;

    & * { color: var(--text); }

    &:hover {
        background: color-mix(in srgb, var(--brand, #1274E0) 14%, transparent);
    }

    & i.pinned-banner-icon {
        font-size:  .8rem;
        color:      var(--brand, #1274E0);
        transform:  rotate(45deg);
        flex-shrink: 0;
    }

    & .pinned-banner-thumb {

        & img {

            height: var(--input-size);

            border-radius: var(--border-radius);
        }
    }

    & .pinned-banner-text {

        flex:       1;
        min-width:  0;
        display:    flex;
        flex-direction: column;
        gap:        2px;

        & .pinned-banner-card {

            & .message-link-card {

                display: flex;
                gap: var(--padding);

                & .link-card-img {

                    & img {

                        height: var(--input-size);
                        width: auto;

                        border-radius: var(--border-radius);
                    }
                }

                & .link-card-text {

                }
            }
        }
    }

    & .pinned-banner-label {
        font-size:   .72rem;
        font-weight: 600;
        color:       var(--brand, #1274E0);
    }

    & .pinned-banner-preview {
        font-size:     .8rem;
        color:         var(--text-muted);
        white-space:   nowrap;
        overflow:      hidden;
        text-overflow: ellipsis;
    }

    & .pinned-banner-unpin {
        flex-shrink: 0;
        opacity:     .5;
        font-size:   .8rem;
        padding:     .2rem;
        transition:  opacity .15s;

        &:hover { opacity: 1; }
    }

}

.message-item {

    position: relative;

    & .message-actions {

        display:     flex;
        align-items: center;
        gap:         2px;
        opacity:     0;
        transition:  opacity .15s;
        flex-shrink: 0;
        align-self:  flex-end;
        padding-bottom: .2rem;

        &:hover,
        &:focus-within {
            opacity: 1;
        }

        & .nav-link {

            background-color: transparent;

            &:hover {
                background-color: var(--btn);
            }

            &.msg-action-btn {

            }
        }

        & .dropdown-menu {
            overflow: hidden;
            box-shadow: var(--box-shadow);

        }
    }

    &.editing .message-bubble {
        outline:        2px solid var(--brand, #1274E0);
        outline-offset: 2px;
    }

    &.is-pinned .message-bubble {
        background: color-mix(in srgb, var(--brand, #1274E0) 6%, var(--btn));
    }

    &.highlight .message-bubble {
        animation: msgHighlight .8s ease-out;
    }

    &.is-pinned {

        & .message-bubble {

            position : relative;

            &::before {
                content     : '📌';
                font-size   : 0.65rem;
                position    : absolute;
                top         : -8px;

                line-height : 1;
            }
        }

        &.theirs {

            .message-bubble::before {
                left      : -10px;
                transform : scaleX(-1);
            }
        }

        &.mine {

            .message-bubble::before {
                right : -7px;
            }
        }
    }

}

@keyframes msgHighlight {
    0%   { background: color-mix(in srgb, var(--brand, #1274E0) 30%, transparent); }
    100% { background: transparent; }
}

.msg-attachment-audio {
    display:    block;
    margin-top: .4rem;
    max-width:  260px;
    width:      100%;
    height:     var(--input-size);
    border-radius: var(--border-radius);

}

#msg-voice-btn {

    transition: color .15s, background .15s;

    &.recording {
        color:      #e53935;
        background: color-mix(in srgb, #e53935 12%, transparent);
        animation:  voicePulse 1.2s infinite ease-in-out;
    }
}

.voice-timer {
    font-size:   .72rem;
    font-weight: 600;
    color:       #e53935;
    font-variant-numeric: tabular-nums;
    min-width:   2.8ch;
}

@keyframes voicePulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .5; }
}

#pty-popover {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    max-width: 280px;
    display: flex;
    flex-direction: column !important;
    gap: 2px;
    padding: var(--padding);
    border-radius: var(--border-radius);
    background: var(--color-10);
    color: var(--color-bg, #fff);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
    font-size: 13px;
    line-height: 1.35;
    opacity: 0;
    transition: opacity .12s ease;
    white-space: nowrap;

    &[style*="display: flex"],
    &.is-visible {
        opacity: 1;
    }

    .pty-popover-title {
        font-weight: 600;
        white-space: nowrap;
    }

    .pty-popover-sub {
        opacity: .75;
        font-size: 12px;
        max-width: 260px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    &.pty-popover-left   { transform: translate(-100%, -50%); margin-left: -8px; justify-content: flex-end;}
    &.pty-popover-right  { transform: translate(0, -50%);     margin-left:  8px; }
    &.pty-popover-top    { transform: translate(-50%, -100%); margin-top:  -8px; }
    &.pty-popover-bottom { transform: translate(-50%, 0);     margin-top:   8px; }

    &.pty-popover-left::after {
        content: "";
        position: absolute;
        top: 50%;
        right: -5px;
        transform: translateY(-50%);
        border: 5px solid transparent;
        border-left-color: var(--color-10, #1f1f1f);
    }
}

#pty-conn-bar {
    position        : fixed;
    bottom          : 0;
    left            : 0;
    right           : 0;
    z-index         : 99999;
    display         : flex;
    align-items     : center;
    justify-content : center;
    gap             : 8px;
    padding         : 11px 16px;
    font-size       : 14px;
    font-weight     : 500;
    color           : #fff;
    transform       : translateY( 100% );
    transition      : transform 0.28s cubic-bezier( 0.4, 0, 0.2, 1 ),
                      background 0.2s ease;
    pointer-events  : none;

    &.show {
        transform      : translateY( 0 );
        pointer-events : auto;
    }

    &.offline { background: var(--error); }
    &.online  { background: var(--success); }

}

#pty-thread-view-mount {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#pty-thread-view-mount .pty-thread-view {
    flex: 1;
    min-height: 0;
}

#msg-mute-btn {

    transition: color .15s, background .15s;

    &.active {
        color:       var(--text-muted);
        background:  var(--color-30);
    }
}

.compose-recipients-list {
    display:   flex;
    flex-wrap: wrap;
    gap:       var(--gapz);
    margin-bottom: var(--gapz);
    min-height: 0;
}

.compose-recipient-pill {
    display:       inline-flex;
    align-items:   center;
    gap:           .3rem;
    background:    color-mix(in srgb, var(--brand, #1274E0) 12%, transparent);
    color:         var(--brand, #1274E0);
    border:        1px solid color-mix(in srgb, var(--brand, #1274E0) 25%, transparent);
    border-radius: var(--border-radius);
    padding:       .15rem .5rem .15rem .6rem;
    font-size:     .8rem;
    font-weight:   500;

    & .pill-remove {
        background:  none;
        border:      none;
        color:       inherit;
        opacity:     .6;
        cursor:      pointer;
        padding:     0 .1rem;
        font-size:   .9rem;
        line-height: 1;
        transition:  opacity .12s;

        &:hover { opacity: 1; }
    }
}

.link-preview-card {
    display:        flex;
    align-items:    flex-start;
    gap:            .6rem;
    padding:        .5rem .75rem;
    margin-bottom:  var(--gapz);
    background:     var(--color-30);
    border:         1px solid var(--border);
    border-left:    3px solid var(--brand, #1274E0);
    border-radius:  0 var(--border-radius) var(--border-radius) 0;
    font-size:      .8rem;

    & .link-preview-img {
        width:        64px;
        height:       48px;
        object-fit:   cover;
        border-radius: calc(var(--border-radius) * .6);
        flex-shrink:  0;
    }

    & .link-preview-text {
        flex:      1;
        min-width: 0;
        display:   flex;
        flex-direction: column;
        gap:       .15rem;
    }

    & .link-preview-title {
        font-weight:   600;
        color:         var(--text);
        white-space:   nowrap;
        overflow:      hidden;
        text-overflow: ellipsis;
    }

    & .link-preview-desc {
        color:         var(--text-muted);
        font-size:     .75rem;
        display:       -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow:      hidden;
    }

    & > .btn-bare {
        flex-shrink: 0;
        opacity:     .5;
        font-size:   .8rem;
        padding:     .1rem;
        align-self:  flex-start;
        transition:  opacity .15s;

        &:hover { opacity: 1; }
    }
}

.forward-modal {
    position:      fixed;
    inset:         0;
    z-index:       9000;
    display:       flex;
    align-items:   center;
    justify-content: center;
    background:    rgba(0, 0, 0, .45);
    padding:       1rem;
}

.forward-modal-inner {
    background:    var(--header-bg);
    border:        1px solid var(--border);
    border-radius: var(--border-radius);
    padding:       1.25rem;
    width:         100%;
    max-width:     400px;
    max-height:    80vh;
    overflow-y:    auto;
    display:       flex;
    flex-direction: column;
    gap:           var(--gapz);
    box-shadow:    0 8px 32px rgba(0,0,0,.18);
}

.forward-modal-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    margin-bottom:   var(--gapz);

    & strong { font-size: .95rem; }

    & .btn-bare {
        opacity:    .55;
        font-size:  .9rem;
        transition: opacity .12s;

        &:hover { opacity: 1; }
    }
}

#forward-search-results {

    & .fwd-user-result {
        border-radius: var(--border-radius);
        padding:       .4rem .6rem;
        transition:    background .12s;

        &:hover {
            background: var(--color-30);
        }

        & img { flex-shrink: 0; }
    }
}

.forward-selected-list {
    display:   flex;
    flex-wrap: wrap;
    gap:       var(--gapz);
    min-height: 0;
}

.gif-picker-panel {

    position:        absolute;
    bottom:          100%;
    left:            0;
    right:           0;
    z-index:         200;
    background:      var(--header-bg);
    border:          1px solid var(--border);
    border-bottom:   none;
    border-radius:   var(--border-radius) var(--border-radius) 0 0;
    display:         flex;
    flex-direction:  column;
    max-height:      340px;
    box-shadow:      0 -4px 16px rgba(0,0,0,.10);
}

.gif-picker-header {
    display:     flex;
    align-items: center;
    gap:         var(--gapz);
    padding:     .5rem .75rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;

    & input {
        flex:        1;
        min-width:   0;
        font-size:   .85rem;
        background:  var(--color-30);
    }

    & .btn-bare {
        flex-shrink: 0;
        opacity:     .55;
        font-size:   .8rem;
        padding:     .15rem;
        transition:  opacity .12s;

        &:hover { opacity: 1; }
    }
}

.gif-picker-tabs {
    display: flex;
    gap:     0;

    & .gif-tab {
        background:    none;
        border:        none;
        border-bottom: 2px solid transparent;
        padding:       .3rem .7rem;
        font-size:     .8rem;
        font-weight:   500;
        color:         var(--text-muted);
        cursor:        pointer;
        transition:    color .12s, border-color .12s;

        &:hover { color: var(--text); }

        &.active {
            color:        var(--brand, #1274E0);
            border-color: var(--brand, #1274E0);
        }
    }
}

.gif-provider-label {
    font-size:   .75rem;
    font-weight: 600;
    color:       var(--text-muted);
    letter-spacing: .03em;
}

.gif-results-grid {
    display:               grid;
    grid-template-columns: repeat(3, 1fr);
    gap:                   3px;
    overflow-y:            auto;
    flex:                  1;
    padding:               3px;

    & .gif-item {
        border:        none;
        padding:       0;
        background:    var(--color-30);
        cursor:        pointer;
        border-radius: calc(var(--border-radius) * .5);
        overflow:      hidden;
        aspect-ratio:  16 / 9;
        transition:    transform .12s, opacity .12s;

        &:hover {
            transform: scale(1.03);
            opacity:   .9;
        }

        & img {
            width:      100%;
            height:     100%;
            object-fit: cover;
            display:    block;
        }
    }
}

.gif-powered-by {
    font-size:  .68rem;
    color:      var(--text-muted);
    text-align: right;
    padding:    .25rem .6rem;
    margin:     0;
    flex-shrink: 0;
    border-top: 1px solid var(--border);
}

.gif-loading,
.gif-empty,
.gif-error {
    grid-column: 1 / -1;
    padding:     1.5rem;
    text-align:  center;
    font-size:   .85rem;
    color:       var(--text-muted);
}

.gif-error { color: var(--color-danger, #c0392b); }

@media ( max-width: 768px ) {

    .gif-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .forward-modal-inner {
        max-width: 100%;
        max-height: 90vh;
    }

    .link-preview-card .link-preview-img {
        width:  48px;
        height: var(--input-size);
    }
}

.verification-badge-stack {
    position:    absolute;
    bottom:      -4px;
    right:       -4px;
    display:     flex;
    flex-direction: column-reverse;
    gap:         2px;
    pointer-events: none;
}

.verification-badge {
    display:         flex;
    align-items:     center;
    justify-content: center;
    width:           18px;
    height:          18px;
    border-radius:   var(--border-radius);
    background:      var(--card-bg, var(--header-bg));
    border:          1.5px solid var(--btn);
    font-size:       .65rem;
    line-height:     1;
    pointer-events:  auto;
    cursor:          help;
    transition:      transform .12s;

    &:hover { transform: scale( 1.2 ); }
}

.member-name-badge {
    font-size:    .8em;
    margin-left:  .3rem;
    vertical-align: middle;
    cursor:       help;
}

.member-mutual-friends {
    font-size:   .82rem;
    color:       var(--text-muted);
    margin:      .2rem 0;

    & .mutual-names { font-size: .78rem; }
}

.completeness-bar-wrap {
    display: none;
    background:    var(--color-30);
    border:        1px solid var(--border);
    border-radius: var(--border-radius);
    padding:       .85rem 1rem;
    margin:        .75rem 0 .25rem;
}

.completeness-bar-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    margin-bottom:   .4rem;
}

.completeness-bar-label {
    font-size:   .82rem;
    font-weight: 600;
    color:       var(--text);
}

.completeness-dismiss {
    opacity:    .45;
    font-size:  .8rem;
    padding:    .1rem;
    transition: opacity .12s;
    &:hover { opacity: 1; }
}

.completeness-bar-track {
    height:        6px;
    background:    var(--btn);
    border-radius: var(--border-radius);
    overflow:      hidden;
    margin-bottom: .65rem;
}

.completeness-bar-fill {
    height:           100%;
    background:       var(--brand, #1274E0);
    border-radius:    var(--border-radius);
    transition:       width .6s ease;
}

.completeness-tips {
    list-style:  none;
    margin:      0;
    padding:     0;
    display:     flex;
    flex-direction: column;
    gap:         .3rem;

    & li {
        display:     flex;
        align-items: center;
        gap:         .5rem;
        font-size:   .8rem;
        color:       var(--text-muted);

        & i { color: var(--brand, #1274E0); flex-shrink: 0; }
    }
}

.completeness-action {
    margin-left:     auto;
    font-size:       .75rem;
    font-weight:     600;
    color:           var(--brand, #1274E0);
    text-decoration: none;
    white-space:     nowrap;

    &:hover { text-decoration: underline; }
}

.pymk-widget {
    background:    var(--header-bg);
    border:        1px solid var(--border);
    border-radius: var(--border-radius);
    overflow:      hidden;
    margin-top:    1rem;
}

.pymk-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    padding:         .65rem 1rem;
    border-bottom:   1px solid var(--border);
}

.pymk-title {
    font-size:   .85rem;
    font-weight: 600;
    color:       var(--text);
}

.pymk-refresh {
    font-size:  .8rem;
    color:      var(--text-muted);
    opacity:    .55;
    padding:    .2rem;
    transition: opacity .12s, transform .3s;
    &:hover { opacity: 1; transform: rotate( 180deg ); }
}

.pymk-cards {
    display:    flex;
    overflow-x: auto;
    gap:        .75rem;
    padding:    .85rem 1rem;
    scrollbar-width: thin;

    scroll-snap-type: x mandatory;

    &::-webkit-scrollbar       { height: 4px; }
    &::-webkit-scrollbar-track { background: var(--color-30); }
    &::-webkit-scrollbar-thumb { background: var(--btn); border-radius: 2px; }
}

.pymk-card {
    flex-shrink:    0;
    width:          128px;
    display:        flex;
    flex-direction: column;
    align-items:    center;
    gap:            .3rem;
    padding:        .75rem .5rem;
    background:     var(--color-30);
    border:         1px solid var(--border);
    border-radius:  var(--border-radius);
    text-align:     center;
    scroll-snap-align: start;
    transition:     border-color .15s;

    &:hover { border-color: var(--brand, #1274E0); }
}

.pymk-avatar-link {
    position:   relative;
    display:    block;
    flex-shrink: 0;
}

.pymk-avatar {
    width:         56px;
    height:        56px;
    border-radius: var(--border-radius);
    object-fit:    cover;
    display:       block;

    &.online         { outline: 2px solid #4caf50; outline-offset: 2px; }
    &.recently-online { outline: 2px solid #ff9800; outline-offset: 2px; }
}

.pymk-name {
    font-size:       .82rem;
    font-weight:     600;
    color:           var(--text);
    text-decoration: none;
    display:         -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow:        hidden;
    line-height:     1.3;

    &:hover { color: var(--brand, #1274E0); }
}

.pymk-type,
.pymk-city,
.pymk-mutual {
    font-size: .72rem;
    color:     var(--text-muted);
}

.pymk-city i,
.pymk-mutual i { font-size: .68rem; }

.pymk-actions {
    display:         flex;
    gap:             .3rem;
    margin-top:      .25rem;
    justify-content: center;
    width:           100%;

    margin-bottom:   0;
    padding:         0;
    list-style:      none;

    & > li { flex: 1; }

    & > li:last-child { flex: 0 0 auto; }

    & .nav-link { font-size: .72rem; }
}

.pymk-header-actions,
.completeness-bar-actions {
    margin:     0;
    padding:    0;
    list-style: none;
}

.pymk-badge {
    position:      absolute;
    bottom:        -3px;
    right:         -3px;
    width:         14px;
    height:        14px;
    border-radius: var(--border-radius);
    background:    var(--border);
    border:        1px solid var(--border);
    display:       block;
}

.member-directory {
    display:        flex;
    flex-direction: column;
    gap:            1rem;
}

.member-directory-filters {
    display:    flex;
    flex-wrap:  wrap;
    gap:        .6rem;
    align-items: center;

    & .form-control,
    & .form-select {
        max-width: 200px;
        flex:      1 1 140px;
    }
}

.member-dir-online-label {
    font-size:   .85rem;
    color:       var(--text);
    flex-shrink: 0;
    cursor:      pointer;
}

.member-directory-grid {
    display:               grid;
    grid-template-columns: repeat( auto-fill, minmax( 220px, 1fr ) );
    gap:                   .75rem;
}

.member-directory-pagination {
    display:     flex;
    align-items: center;
    gap:         1rem;
    justify-content: center;
    padding-top: .5rem;
    margin:      0;
    padding-left: 0;
    list-style:  none;
}

.dir-card {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    text-align:     center;
    gap:            .4rem;
    padding:        1rem .75rem;
    background:     var(--border);
    border:         1px solid var(--border);
    border-radius:  var(--border-radius);
    transition:     border-color .15s, transform .12s;

    &:hover {
        border-color: var(--brand, #1274E0);
        transform:    translateY( -1px );
    }
}

.dir-card-avatar-link { display: block; flex-shrink: 0; }

.dir-card-avatar {
    width:         64px;
    height:        64px;
    border-radius: var(--border-radius);
    object-fit:    cover;
    display:       block;
    margin:        0 auto;

    &.online          { outline: 2px solid #4caf50; outline-offset: 2px; }
    &.recently-online { outline: 2px solid #ff9800; outline-offset: 2px; }
}

.dir-card-body {
    display:        flex;
    flex-direction: column;
    gap:            .2rem;
    width:          100%;
}

.dir-card-name {
    font-size:       .875rem;
    font-weight:     600;
    color:           var(--text);
    text-decoration: none;
    display:         -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow:        hidden;

    &:hover { color: var(--brand, #1274E0); }
}

.dir-card-badge-icon {
    font-size:  .72em;
    margin-left: .25rem;
    vertical-align: middle;
}

.dir-card-type,
.dir-card-city,
.dir-card-mutual {
    font-size: .76rem;
    color:     var(--text-muted);
}

.dir-card-city i,
.dir-card-mutual i { font-size: .72rem; }

.dir-card-actions {
    margin:     .35rem 0 0;
    padding:    0;
    width:      100%;
    list-style: none;

    & .nav-link { font-size: .78rem; }
}

@media ( max-width: 768px ) {

    .member-directory-filters {
        & .form-control,
        & .form-select { max-width: 100%; }
    }

    .member-directory-grid {
        grid-template-columns: repeat( auto-fill, minmax( 160px, 1fr ) );
    }

    .pymk-card { width: 110px; }
}

.notif-sound-toggle {
    display:       flex;
    align-items:   center;
    justify-content: flex-end;
    gap:           .35rem;
    width:         100%;
    padding:       .35rem 1rem;
    background:    none;
    border:        none;
    border-bottom: 1px solid var(--border);
    font-size:     .78rem;
    color:         var(--text-muted);
    cursor:        pointer;
    transition:    color .15s, background .15s;

    &:hover {
        background: var(--color-30);
        color:      var(--text);
    }

    &.muted {
        color: var(--brand, #1274E0);

        & i { color: var(--brand, #1274E0); }
    }

    & i { font-size: .85rem; }
}

.notifications-sound-control {
    display:         flex;
    align-items:     center;
    gap:             .5rem;
    padding:         .5rem 0;
    margin-bottom:   .5rem;
    border-bottom:   1px solid var(--border);

    & .notif-sound-label {
        flex:       1;
        font-size:  .85rem;
        color:      var(--text);
        font-weight: 500;
    }

    & .js-notif-sound-toggle {
        padding:    .25rem .6rem;
        border:     1px solid var(--border);
        border-radius: var(--border-radius);
        background: none;
        font-size:  .8rem;
        cursor:     pointer;
        color:      var(--text-muted);
        transition: color .12s, border-color .12s, background .12s;

        &:hover, &.muted {
            color:        var(--brand, #1274E0);
            border-color: var(--brand, #1274E0);
            background:   color-mix(in srgb, var(--brand, #1274E0) 8%, transparent);
        }
    }
}

.settings-field[data-key="notifInAppMessages"] .settings-field-label::before {
    content:      'In-App Notifications';
    display:      block;
    font-size:    .72rem;
    font-weight:  700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color:        var(--text-muted);
    margin-bottom: .35rem;
    padding-bottom: .25rem;
    border-bottom:  1px solid var(--border);
}

.settings-field[data-key="inAppSoundMuted"] .settings-field-label::before {
    content:      'Sound';
    display:      block;
    font-size:    .72rem;
    font-weight:  700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color:        var(--text-muted);
    margin-bottom: .35rem;
    padding-top:   .5rem;
    padding-bottom: .25rem;
    border-bottom:  1px solid var(--border);
}

.settings-field[data-key="emailFriendRequest"] .settings-field-label::before {
    content:      'Email Notifications';
    display:      block;
    font-size:    .72rem;
    font-weight:  700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color:        var(--text-muted);
    margin-bottom: .35rem;
    padding-top:   .5rem;
    padding-bottom: .25rem;
    border-bottom:  1px solid var(--border);
}

.settings-field[data-key="emailDigestFrequency"] .settings-field-label::before {
    content:      'Email Digest';
    display:      block;
    font-size:    .72rem;
    font-weight:  700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color:        var(--text-muted);
    margin-bottom: .35rem;
    padding-top:   .5rem;
    padding-bottom: .25rem;
    border-bottom:  1px solid var(--border);
}

.settings-field[data-key="pushFriendRequest"] .settings-field-label::before {
    content:      'Push Notifications';
    display:      block;
    font-size:    .72rem;
    font-weight:  700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color:        var(--text-muted);
    margin-bottom: .35rem;
    padding-top:   .5rem;
    padding-bottom: .25rem;
    border-bottom:  1px solid var(--border);
}

.settings-field[data-key="emailDigestFrequency"] .settings-field-control::after {
    content:    'When digest is enabled, individual event emails are suppressed and bundled into one.';
    display:    block;
    font-size:  .75rem;
    color:      var(--text-muted);
    margin-top: .3rem;
    line-height: 1.4;
}

.security-section {
    padding:        1rem 0;
    border-bottom:  1px solid var(--border);

    &:last-child { border-bottom: none; }
}

.security-section-title {
    font-size:     .9rem;
    font-weight:   600;
    margin-bottom: .75rem;
    display:       flex;
    align-items:   center;
    gap:           .5rem;
    color:         var(--text);

    & i { color: var(--brand, #1274E0); font-size: .95rem; }
}

.security-status {
    display:       flex;
    align-items:   center;
    gap:           .6rem;
    padding:       .5rem .75rem;
    border-radius: var(--border-radius);
    font-size:     .85rem;
    line-height:   1.4;

    & i { flex-shrink: 0; font-size: .95rem; }
}

.security-status--on {
    background: color-mix(in srgb, #2e7d32 10%, transparent);
    color:      #2e7d32;
    border:     1px solid color-mix(in srgb, #2e7d32 25%, transparent);
}

.security-status--off {
    background: color-mix(in srgb, #f57c00 10%, transparent);
    color:      #e65100;
    border:     1px solid color-mix(in srgb, #f57c00 25%, transparent);
}

.totp-setup-panel {
    margin-top:    1rem;
    padding:       1rem;
    background:    var(--color-30);
    border:        1px solid var(--border);
    border-radius: var(--border-radius);
}

.totp-qr-block {
    display:     flex;
    align-items: flex-start;
    gap:         1.25rem;
    flex-wrap:   wrap;
}

.totp-qr-img {
    width:         160px;
    height:        160px;
    border:        4px solid var(--card-bg, var(--header-bg));
    border-radius: var(--border-radius);
    flex-shrink:   0;
    image-rendering: pixelated;
}

.totp-manual-key {
    display:        flex;
    flex-direction: column;
    gap:            .4rem;
    justify-content: center;
}

.totp-secret {
    font-size:     .9rem;
    letter-spacing: .12em;
    background:    var(--card-bg, var(--header-bg));
    border:        1px solid var(--border);
    border-radius: var(--border-radius);
    padding:       .4rem .7rem;
    word-break:    break-all;
    user-select:   all;
    cursor:        text;
}

.totp-copy-btn {
    font-size:  .8rem;
    color:      var(--text-muted);
    padding:    .2rem .4rem;
    transition: color .12s;
    align-self: flex-start;

    &:hover { color: var(--brand, #1274E0); }
}

.backup-codes-wrap {
    margin-top:    1rem;
    padding:       .85rem 1rem;
    background:    var(--color-30);
    border:        1px solid var(--border);
    border-radius: var(--border-radius);
}

.backup-codes-warning {
    font-size:   .82rem;
    color:       #e65100;
    font-weight: 500;
    margin-bottom: .65rem;
    display:     flex;
    align-items: flex-start;
    gap:         .4rem;

    & i { flex-shrink: 0; margin-top: .1rem; }
}

.backup-codes-grid {
    display:               grid;
    grid-template-columns: repeat( auto-fill, minmax( 120px, 1fr ) );
    gap:                   .4rem;
    margin-bottom:         .75rem;
}

.backup-code {
    display:       block;
    text-align:    center;
    font-family:   monospace;
    font-size:     .9rem;
    letter-spacing: .1em;
    padding:       .4rem .5rem;
    background:    var(--card-bg, var(--header-bg));
    border:        1px solid var(--border);
    border-radius: var(--border-radius);
    user-select:   all;
    cursor:        text;
}

.backup-codes-actions {
    display:  flex;
    gap:      .5rem;
    flex-wrap: wrap;
}

.login-log-table {
    width:           100%;
    border-collapse: collapse;
    font-size:       .82rem;

    & th {
        text-align:    left;
        padding:       .4rem .6rem;
        font-weight:   600;
        color:         var(--text-muted);
        font-size:     .72rem;
        text-transform: uppercase;
        letter-spacing: .04em;
        border-bottom: 2px solid var(--btn);
    }

    & td {
        padding:       .5rem .6rem;
        border-bottom: 1px solid var(--border);
        vertical-align: middle;
        color:         var(--text);
    }

    & tr:last-child td { border-bottom: none; }

    & tr.login-log-fail td { background: color-mix(in srgb, #e53935 4%, transparent); }
}

.login-log-ip {
    font-family: monospace;
    font-size:   .8rem;
    color:       var(--text-muted);
}

.login-log-ok {
    color:       #2e7d32;
    font-size:   .8rem;
    display:     inline-flex;
    align-items: center;
    gap:         .25rem;
}

.login-log-failed {
    color:       #e53935;
    font-size:   .8rem;
    display:     inline-flex;
    align-items: center;
    gap:         .25rem;
}

.login-log-note {
    margin-top: .5rem;
    font-size:  .8rem;
    color:      var(--text-muted);
}

.btn-oauth {
    display:         inline-flex;
    align-items:     center;
    gap:             .65rem;
    padding:         .55rem 1.1rem;
    border-radius:   var(--border-radius);
    font-size:       .9rem;
    font-weight:     500;
    text-decoration: none;
    border:          1px solid var(--border);
    background:      var(--card-bg, var(--header-bg));
    color:           var(--text);
    transition:      background .15s, border-color .15s, box-shadow .15s;
    white-space:     nowrap;

    &:hover {
        background:   var(--color-30);
        border-color: var(--brand, #1274E0);
        box-shadow:   0 1px 6px rgba(0,0,0,.08);
    }

    & svg { flex-shrink: 0; }
}

.btn-oauth--google {

}

.pty-2fa-page {
    display:         flex;
    align-items:     center;
    justify-content: center;
    min-height:      60vh;
}

@media ( max-width: 600px ) {

    .totp-qr-block {
        flex-direction: column;
        align-items:    center;
    }

    .backup-codes-grid {
        grid-template-columns: repeat( 2, 1fr );
    }

    .login-log-table th:nth-child(4),
    .login-log-table td:nth-child(4) {
        display: none;
    }
}

.activity-composer,

.notification-item {
    padding: var(--padding);
    margin-bottom: var(--padding);
    background-color: var(--header-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.completeness-bar-wrap {

    position: absolute;
    top: 0px;
    right: 0px;
    z-index: 3;

}

.square {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
}

.msg-attach-preview {
    padding: 8px 8px 0;
}

.msg-attach-items {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.msg-attach-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius);
    overflow: visible;
}

.msg-attach-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--border-radius);
    display: block;
}

.msg-attach-file-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius);
    background: var(--btn);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 11px;
    color: var(--muted-text);
    padding: 4px;
    text-align: center;
    overflow: hidden;
}

.msg-attach-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-20);
    color: var(--header-bg);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    z-index: 2;
    padding: 0;
}

.msg-bot-badge {
    position: absolute;
    bottom: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-20);
    color: var(--header-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 2px solid var(--surface);
}

.message-bubble {
    position: relative;
}

#pty-popover .pty-popover-title { font-weight: 600; }
#pty-popover .pty-popover-sub   { opacity: .7; font-size: .85em; }

#pty-popover.pty-popover-left   { transform: translate( -100%, -50% ); margin-left: -8px; }
#pty-popover.pty-popover-right  { transform: translate( 0, -50% );     margin-left:  8px; }
#pty-popover.pty-popover-top    { transform: translate( -50%, -100% ); margin-top:  -8px; }
#pty-popover.pty-popover-bottom { transform: translate( -50%, 0 );     margin-top:   8px; }

#thread-list {

    flex: 1;
    overflow-y: auto;
    padding: var(--padding);

    & .thread-row {

        display: flex;
        align-items: center;
        gap: var(--gap);
        padding: var(--padding);
        border-radius: var(--border-radius);
        border: 1px solid var(--border);
        background: var(--header-bg);
        margin-bottom: var(--padding);
        cursor: pointer;
        transition: background .15s;

        &:hover  { background: var(--btn); transform: scale(0.99) translateY(1px); }

        &.active {

            background: var(--cta);

            &:hover {

                cursor: unset;
                transform: unset;

            }

            & * {

                color: var(--header-bg) !important;

            }

            & .thread-avatar-wrap {

                outline: 3px solid var(--header-bg) !important;
            }
        }

        & .thread-avatar-wrap {
            position:    relative;
            flex-shrink: 0;
            border-radius: var(--border-radius);

            outline: 3px solid var(--btn) !important;
            border: 1px solid var(--header-bg);

            & img.thread-avatar {
                border-radius: var(--border-radius);

                width: var(--input-size);
                height: var(--input-size);
                border-radius: var(--border-radius);
                object-fit: cover;
                flex-shrink: 0;
            }

            & .thread-source-badge {
                position:      absolute;
                bottom:        -11px;
                right:         -11px;
                width:         var(--badge-size);
                height:        var(--badge-size);
                border-radius: var(--badge-radius);
                display:       flex;
                align-items:   center;
                justify-content: center;
                font-size:     9px;
                border:        1px solid var(--header-bg);
                line-height:   1;
                color: var(--header-bg);
                background: var(--cta);

                &.source-fb       { background: #1877F2;  }

                &.source-ig       { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285aeb 90%); color: var(--header-bg); }

                & i {

                    width:         10px;
                    height:        10px;
                    object-fit:    contain;
                    border-radius: 2px;
                    color: var(--header-bg) !important;

                }
            }
        }

        & .thread-body {

            flex: 1;
            min-width: 0;

            & .thread-top {

                display: flex;
                justify-content: space-between;
                align-items: baseline;
                gap: var(--gapz);
                margin-bottom: var(--padding);

                & .thread-recipients {
                    font-weight: 600;
                    font-size: .9rem;
                    flex: 0 0 140px;
                    white-space: nowrap;
                    overflow: hidden;
                    text-overflow: ellipsis;
                }

                & .thread-time {
                    font-size: .7rem;
                    color: var(--text-muted);
                    flex-shrink: 0;
                }

            }

            & .thread-preview {
                flex: 1;
                font-size: .85rem;
                color: var(--text);
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            & .thread-meta {
                display: flex;
                align-items: center;
                gap: .4rem;
                font-size: .75rem;
                color: var(--text-muted);
                flex-shrink: 0;
            }

            & .thread-unread-dot {
                width: 8px;
                height: 8px;
                border-radius: var(--border-radius);
                background: var(--brand);
                display: inline-block;
            }
        }
    }
}

.pty-quick-replies {
    display: flex;
    gap: var(--padding);
    padding: 8px 0;

    & > li {
        flex: 1 1 0;
        min-width: 0;
    }
}

.pty-quick-replies--grid {
    flex-wrap: wrap;
    justify-content: space-between;
}

.pty-quick-replies--grid > li {

    flex: 1 1 calc(33% - var(--padding) );
    min-width: 0;
    text-align: center;
}

.thread-beginning {
    text-align: center;
    font-size: 15px;
    color: var(--text);
    padding-bottom: calc( var(--padding) * 2 );
    border-bottom: 1px solid var(--border);
}

.avatar.bot-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: transparent;
}

.chat-flow-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: var(--body-bg);
    border-bottom: 1px solid var(--border);
}

.chat-flow-progress-fill {
    flex: 1;
    height: 4px;
    background: var(--brand);
    border-radius: 4px;
    transition: width 0.4s ease;
    position: relative;
}

.chat-flow-progress-fill::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--body-bg);
    border-radius: 4px;
    opacity: 0.3;
    z-index: -1;
}

.chat-flow-progress-label {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
}

.chat-flow-progress-fill-track {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.chat-flow-progress-fill {
    height: 100%;
    background: var(--brand);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.chat-summary-card {
    margin: 10px 12px;
    background: var(--box-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-summary-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.chat-summary-fields {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
}

.chat-summary-row span {
    white-space: nowrap;
    min-width: 90px;
}

.chat-summary-row input {
    flex: 1;
    font-size: 12px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--body-bg);
    color: var(--text);
}

.chat-summary-row input[readonly] {
    opacity: 0.6;
    cursor: default;
}

.chat-summary-submit {
    align-self: flex-end;
    padding: 8px 16px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-summary-submit:hover {
    background: var(--btn-hover);
}

& .pty-composer {

    display: flex;
    padding: calc(var(--padding)/2);
    align-items: center;
    position: relative;
    width: 100%;
    overflow: visible;
    z-index: 1;

    border-top: 1px solid var(--border);

    &.focused {
        & .composer-left-btns {
            max-width: 0;
            margin-right: calc(var(--padding) / -2);
            opacity: 0;
            pointer-events: none;
            overflow: hidden;
        }

        & .composer-input-wrapper {
            max-width: 100%;

        }
    }

    & .composer-avatar-row {
        padding: var(--padding) var(--padding) 0;
        display: flex;
        align-items: center;
        gap: var(--padding);
    }

    & .composer-avatar {
        width: var(--input-size);
        height: var(--input-size);
        border-radius: var(--border-radius);
        object-fit: cover;
        flex-shrink: 0;
        margin-right: var(--padding);
    }

    & .composer-editor {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: calc(var(--padding)/2);
        width: 100%;

        & .square,
        & .composer-attach-label,
        & .composer-media-label {
            flex-shrink: 0;
            width: var(--input-size);
            overflow: hidden;
            transition: width 0.2s ease, opacity 0.2s ease, padding 0.2s ease, margin 0.2s ease;
        }

        & .gif-label {
            white-space: nowrap;
        }
    }

    & .composer-left-btns {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: calc(var(--padding)/2);
        height: var(--input-size);
        max-width: calc(var(--input-size) * 6);
        overflow: hidden;
        flex-shrink: 0;
        list-style: none;
        transition: max-width 0.25s ease, opacity 0.25s ease, margin-right 0.25s ease;

        & > li {
            flex: 0 0 auto;
        }

        & label,
        & .nav-link {

            background-color: transparent;

            &:hover {
                background-color: var(--btn);
            }
            &:active {
                background-color: var(--btn-hover);
            }
        }
    }

    & .composer-input-wrapper {

        flex: 1;
        min-width: 0;
        display: flex;
        align-items: flex-end;
        position: relative;
        transition: flex 0.25s ease;

        & .composer-input {
            flex: 1;
            min-width: 0;
            min-height: var(--input-size);
            max-height: 120px;
            overflow-y: auto;
            word-break: break-word;
            outline: none;
            font-size: .9rem;
            line-height: 1.5;
            padding: 6px 60px 6px 10px;
            border: 1px solid var(--border);
            border-radius: var(--border-radius);
            background: var(--input-bg, var(--header-bg));
            color: var(--text);

            display: flex;
            align-items: center;

            &:empty::before {

                line-height: inherit;
                color: var(--text-muted);
                pointer-events: none;
            }

            & .composer-input-attachment {
                display: flex;
                align-items: center;
                gap: 8px;
                padding: 0px;
                margin-top: 6px;

                border-radius: var(--border-radius);
                position: relative;
            }

            & .composer-input-attachment-img {

                max-height: var(--input-size);
                border-radius: var(--border-radius);
                object-fit: cover;
                display: block;
                aspect-ratio: 16 / 9;
            }

            & .composer-input-attachment-audio {

                height: 36px;
            }

            & .composer-input-attachment-file {
                font-size: .85rem;
                color: var(--text-muted);
            }

            & .composer-input-attachment-remove {
                position: absolute;
                top: -13px;
                right: -4px;
                background: var(--header-bg);
                border-radius: var(--badge-radius);
                width: var(--badge-size);
                height: var(--badge-size);
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 10px;
                border: none;
                cursor: pointer;
            }

            & .composer-input-attachment {
                margin: 0px;

                &:last-child {
                    margin-right: var(--padding);
                }
            }
        }
    }

    & .composer-emoji,
    & .composer-send {
        display: flex;
        align-items: flex-end;
        gap: calc(var(--padding)/2);
        flex-shrink: 0;
        list-style: none;
    }

    & .composer-send-btn {
        flex-shrink: 0;
        color: var(--text-muted);
        transition: color 0.15s;

        &:not(.disabled) {
            color: #0084ff;
            cursor: pointer;
        }

        &.disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }
    }

    & .composer-mention-dropdown {
        position: absolute;
        top: 100%;
        left: calc(var(--padding)/2);
        right: calc(var(--padding)/2);
        z-index: 1000;
        max-height: 240px;
        overflow-y: auto;
        background: var(--header-bg);
        border: 1px solid var(--border);
        border-radius: var(--border-radius);

        & .radchecks {
            display: flex;
            flex-direction: column;
            margin: 0;
            padding: 0;
            list-style: none;
        }

        & .nav-link {
            display: flex;
            align-items: center;
            gap: calc(var(--padding)/2);
            padding: calc(var(--padding)/2) var(--padding);
            cursor: pointer;

            &.active,
            &:hover {
                background: var(--btn);
            }
        }

        & .avatar {
            width: var(--input-size);
            height: var(--input-size);
            border-radius: var(--border-radius);
            object-fit: cover;
            flex-shrink: 0;
        }

        & small {
            color: var(--text-muted);
        }
    }

    & .composer-reply-strip {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 6px 10px;
        background: var(--color-30);
        border-top: 1px solid var(--border);
        font-size: .82rem;

        & .composer-reply-name {
            font-weight: 600;
        }

        & .composer-reply-preview {
            color: var(--text-muted);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
    }

    & .composer-attach-preview {
        padding: 0 8px 8px;
    }
}

#cover-image-container::after {
    pointer-events: none;
}

@keyframes subtle-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.2);
    background-color: rgba(0, 123, 255, 0.02);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.08);
    background-color: rgba(0, 123, 255, 0.06);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.2);
    background-color: rgba(0, 123, 255, 0.02);
  }
}

@keyframes dot-pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.5);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(0, 123, 255, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(0, 123, 255, 0);
  }
}

.thread-row.unread {
  position: relative;
  animation: subtle-pulse 2.5s infinite ease-in-out;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.thread-row.unread:hover {
  animation-play-state: paused;
  background-color: rgba(0, 123, 255, 0.08);
}

.thread-row.unread .thread-unread-dot {
  background-color: #007bff;
  border-radius: 50%;
  animation: dot-pulse 2s infinite ease-in-out;
}

.reply-quote { cursor: pointer; }
@keyframes ptyPulse { 0%{transform:scale(1)} 50%{transform:scale(1.04)} 100%{transform:scale(1)} }
.message-bubble.pty-pulse { animation: ptyPulse .5s ease; }
@keyframes ptyGlow { 0%{box-shadow:0 0 0 0 rgba(40,167,69,.6)} 100%{box-shadow:0 0 0 12px rgba(40,167,69,0)} }
.message-bubble.pty-glow { animation: ptyGlow 1.5s ease-out; }

.thread-muted-badge { margin-left: 6px; opacity: .65; }
.thread-row.is-muted .thread-row-name { opacity: .8; }

.thread-header-muted { margin-left: 6px; opacity: .6; }

a.message-link-card {

    width: 100%;

    & .link-card-img {
        width: 100%;
        overflow: hidden;
        & img {

            width: 100%;
            aspect-ratio: 16/9;
            transform: scale(1.35);
        }
    }

    & .link-card-text {

        padding: var(--padding);
        background: var(--cta);
        background-color: var(--cta);
        border-bottom-left-radius: var(--border-radius);
        border-bottom-right-radius: var(--border-radius);

        & * {

            text-align: left;
            color: var(--header-bg);

        }

        & .link-card-title {

        }

        & .link-card-desc {

        }

        & .link-card-host {

        }
    }
}

@keyframes ptyPulse {
    0%   { box-shadow: 0 0 0 0   var(--color-20); }
    70%  { box-shadow: 0 0 0 8px transparent;     }
    100% { box-shadow: 0 0 0 0   transparent;     }
}
.pty-pulse {
    animation: ptyPulse .5s ease-out 4;
}

.pty-thread-view {

    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;

    & .thread-view-header {

        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--padding);
        padding: var(--padding);
        border-bottom: 1px solid var(--border);
        flex-shrink: 0;

        & .thread-header-identity {

            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: var(--padding);

            &.dropdown-toggle {

                transition: var(--transition);
                &:hover {
                    background-color: var(--btn);
                    transform: translateY(1px);
                }
            }

            & .thread-header-avatars {

                font-size: 28px;
                display: flex;
                gap: -.25rem;

                &.group {

                    & img.thread-header-avatar {

                        &:not(:first-child) {
                            margin-left: -8px;
                            border: 2px solid var(--card-bg, var(--header-bg));
                        }
                    }
                }

                & .thread-avatar-wrap {

                    position: relative;

                    & img.thread-header-avatar {
                        width: var(--input-size);
                        height: var(--input-size);
                        border-radius: var(--border-radius);
                        object-fit: cover;
                        border: 2px solid var(--border);
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        font-size: var(--gap);
                    }

                    & .badge {

                        position: absolute;
                        padding: 0;
                        margin: 0;

                        position        : absolute;
                        bottom          : -7px;
                        right           : -8px;
                        width           : var(--badge-size);
                        height          : var(--badge-size);
                        border-radius   : var(--badge-radius);
                        font-size       : 12px;
                        display         : flex;
                        align-items     : center;
                        justify-content : center;
                        border          : 2px solid var(--header-bg);

                        color: var(--header-bg);

                        &.facebook,
                        &.source-fb { background: var(--facebook);  }

                        &.instagram,
                        &.source-ig { background: var(--instagram); }

                        &.whatsapp,
                        &.source-wa { background: var(--whatsapp); }

                        &.sms,
                        &.source-sms { background: var(--sms); }

                        &.telegram,
                        &.source-telegram { background: var(--telegram); }

                        &.internal,
                        &.source-internal { background: var(--cta);  }

                        & i { color: var(--header-bg); }

                    }
                }
            }

            & .thread-header-name {
                font-weight: 600;
                font-size: 1.25rem;
                color: var(--text);

                & a {
                    color: inherit;
                    text-decoration: none;

                    &:hover {
                        text-decoration: underline;
                    }
                }
            }
        }

        & .thread-header-actions {

            display: flex;

            &.btn-group {
                display: inline-flex;
                align-items: center;

                & .nav-link {

                    background-color: transparent;

                    &:hover {
                        background-color: var(--btn);
                    }

                    &:active {
                        background-color: var(--btn-hover);
                    }
                }

                & .dropdown {

                    & .dropdown-toggle {

                        border-top-right-radius: 0px;
                        border-bottom-right-radius: 0px;
                    }
                }
            }
        }
    }

    & #pinned-banner {

    }

    & .thread-messages {

        flex: 1;
        overflow-y: auto;
        padding: var(--gap) var(--padding);
        display: flex;
        flex-direction: column;
        gap: var(--gap);
        max-height: none;
        overflow-x: hidden;

        & .message-item {

            position: relative;
            display: flex;
            align-items: flex-end;
            gap: var(--gapz);

            & .message-avatar {

                width: calc(var(--input-size) / 1.25);
                height: calc(var(--input-size) / 1.25);
                border-radius: var(--border-radius);
                object-fit: cover;
                flex-shrink: 0;
                z-index: 1;
                position: relative;
                bottom: -5px;
                border: 5px solid var(--header-bg);
                background-color: var(--btn);

                font-size:1.2rem;
                display:flex;
                align-items:center;
                justify-content:center;

            }

            & .message-bubble {

                max-width: 60%;
                padding: var(--padding);
                border-radius: var(--border-radius);
                background: var(--btn);
                font-size: 16px;
                line-height: 24px;
                position: relative;
                word-wrap: break-word;

                &:has(audio) {

                    background: transparent !important;

                    & * { color: var(--text) !important; }
                }

                & * { color: var(--text); }

                & p {

                    margin: 0 0 var(--padding);

                }

                & audio { min-width: 350px; margin-bottom: var(--padding);

                    &::-webkit-media-controls-panel {
                        background: var(--btn);
                    }

                }

                &:has(> audio:first-child) {

                    padding: 0;
                    & > audio:first-child {
                        padding: 0;
                        margin: 0;

                        &::-webkit-media-controls-panel {
                            border-bottom-left-radius: 0 !important;
                            border-bottom-right-radius: 0 !important;
                        }

                    }
                    & p, & audio {
                        padding-left: var(--padding);
                        padding-right: var(--padding);
                        padding-bottom: var(--padding);
                        margin-top: var(--padding);
                    }

                    & .message-meta {

                        padding: var(--padding);
                    }
                }

                & img { margin-bottom: var(--padding); }

                &:has(> img:first-child) {

                    padding: 0;
                    border: 1px solid var(--border);

                    & > img:first-child {
                        padding: 0;
                        margin: 0;
                        border-bottom-left-radius: 0;
                        border-bottom-right-radius: 0;
                    }

                    & p, & audio {
                        padding-left: var(--padding);
                        padding-right: var(--padding);
                        padding-bottom: var(--padding);
                        margin-top: var(--padding);
                    }

                    & .message-meta {

                        padding: var(--padding);
                    }
                }

                &:has(> :not(img):first-child):has(img) {
                    padding: 0;
                    border: 1px solid var(--border);

                    & img {
                        min-width: 100%;
                        margin: 0;
                        padding: 0;
                        border-radius: 0;
                    }

                    & > :first-child {
                        padding: var(--padding);
                        margin-bottom: 0;
                    }

                    & .message-meta {
                        padding: var(--padding);
                    }
                }

                & .message-meta {

                    display:     flex;
                    justify-content: flex-end;
                    align-items: center;
                    gap:         var(--gapz);

                    & .message-time {
                        font-size: .72rem;

                    }

                    & .read-receipt {

                        font-size:    .72rem;
                        margin-left:  .3rem;
                        opacity:      .6;
                        user-select:  none;

                        &.read {
                            opacity: 1;
                        }

                        &.sent { }
                    }
                }

                & .message-reactions {

                    top: -16px;
                    z-index: 2;
                    position: absolute;

                    & .reaction-chip {

                        display: flex;
                        align-items: center;
                        justify-content: center;
                        cursor: pointer;
                        animation: reaction-pop 0.2s ease-out forwards;

                        width: var(--gap);
                        min-width: var(--gap);
                        max-width: var(--gap);

                        height: var(--gap);
                        min-height: var(--gap);
                        max-height: var(--gap);

                        &::before,
                        &::after {
                            content: '';
                            position: absolute;
                            border-radius: 50%;
                        }

                        &::before {
                            width: 10px;
                            height: 10px;
                        }

                        &::after {
                            width: 6px;
                            height: 6px;
                        }
                    }
                }
            }

            &.deleted .message-bubble {
                background: var(--error);
                color: var(--text-muted);
                font-style: italic;
            }

            &.mine {

                flex-direction: row-reverse;

                & .avatar.message-avatar.bot-avatar + .message-bubble,
                & img + .message-bubble {

                    margin-right: -33px;

                }

                & .message-bubble {
                    background: var(--cta);
                    text-align: right;

                    & * { color: var(--header-bg) !important; }
                    & .message-reactions {
                        left: -13px;
                        & .reaction-chip {
                            background: var(--btn);
                            &::before {
                                background: var(--btn);
                                left: -4px;
                                bottom: 2px;
                            }
                            &::after {
                                background: var(--btn);
                                left: -8px;
                                bottom: 0px;
                            }
                        }
                    }
                }

                & .message-actions { flex-direction: row-reverse !important; }
            }

            &.theirs {

                & .message-bubble {

                    left: -35px;

                    & audio { margin-bottom: var(--padding);

                        &::-webkit-media-controls-panel {
                            background: var(--cta);
                        }
                    }

                    & .message-meta {
                        justify-content: flex-start;

                        & .message-time {
                            margin-left: 23px;
                            margin-bottom: -5px;
                        }
                    }

                    & .message-reactions {
                        right: -13px;
                        & .reaction-chip {
                            background: var(--cta);
                            &::before {
                                background: var(--cta);
                                right: -4px;
                                bottom: 2px;

                            }
                            &::after {
                                background: var(--cta);
                                right: -8px;
                                bottom: 0px;
                            }
                        }
                    }
                }

                & .message-actions { margin-left: calc( -1 * var(--gap) ); }
            }
        }
    }

    & .typing-indicator {

        display:     flex;
        align-items: center;
        gap:         .5rem;
        padding:     .3rem .75rem;
        font-size:   .8rem;
        color:       var(--color-30, #888);
        font-style:  italic;

        & .typing-dots {

            display: inline-flex;
            gap:     3px;

            background-color: var(--btn);
            padding: 15px;

            border-radius: var(--border-radius);

            & span {
                width:            6px;
                height:           6px;
                background:       var(--color-30, #aaa);
                border-radius:    var(--border-radius);
                display:          inline-block;
                animation:        typingBounce 1.2s infinite ease-in-out;

                &:nth-child(2) { animation-delay: .2s; }
                &:nth-child(3) { animation-delay: .4s; }

            }
        }
    }

    & .reply-box {

        padding: var(--padding);
        border-top:     1px solid var(--border);
        flex-shrink:    0;
        display:        flex;
        flex-direction: column;
        background:     var(--body-bg, var(--header-bg));

        & .reply-editor {

            & .reply-input-content {

                min-height:  44px;
                max-height:  160px;
                overflow-y:  auto;
                outline:     none;
                font-size:   .9rem;
                line-height: 1.5;
                word-break:  break-word;
                color:       var(--text);

                padding:     .75rem 1rem .5rem;
                border: 1px solid var(--border);
                border-radius: var(--border-radius);

                &:empty::before {
                    content:        attr(data-placeholder);
                    color:          var(--color-30, #aaa);
                    pointer-events: none;
                }
            }
        }

        & .reply-formatting-bar {

            display:        flex;
            flex-wrap:      wrap;
            flex-direction: row-reverse;
            gap:            var(--gapz);
            margin-bottom:  var(--padding);

        }

        & .attach-preview {

            display:     flex;
            align-items: center;
            justify-content: space-between;
            padding:     .35rem 1rem;
            background:  var(--color-30, #f8f9fa);
            border-top:  1px solid var(--border);
            font-size:   .8rem;
            gap:         .5rem;

            & .attach-preview-inner {
                display:     flex;
                align-items: center;
                gap:         var(--gapz);
                color:       var(--color-30, #555);
                min-width:   0;
                overflow:    hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }
        }

        & .reply-toolbar {

            display:         flex;
            align-items:     center;
            justify-content: space-between;
            gap:             var(--gapz);

            & .reply-toolbar-media,
            & .reply-toolbar-actions {
                display:     flex;
                align-items: center;
                gap:         var(--gapz);
            }

            & .reply-toolbar-media {

                & .gif-label {
                    font-weight: 700;
                    font-size:   .7rem;
                    letter-spacing: .5px;
                    font-family: var(--font-sans, sans-serif);
                }

            }

            & .reply-toolbar-actions {

            }
        }
    }
}

#pty-chat-trigger {
    width         : var(--input-size);
    height        : var(--input-size);
    border-radius : var(--border-radius);
    background    : var(--btn);
    color         : var(--text);
    border        : none;
    cursor        : pointer;
    font-size     : 22px;
    box-shadow    : var(--box-shadow);
    flex-shrink   : 0;
    transition    : var(--transition);
    position      : relative;
    overflow      : visible;

    &:hover {}

    &.active,
    &:active {
        background: #0073e6;
        & * { color: var(--brand) !important; }
    }

    & .pty-chat-trigger-bot {
        /*display     : inline;
        font-size   : 28px;
        line-height : 42px;
        transition  : transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);*/
    }

    & .pty-chat-trigger-icon {
        display: none;
    }

    &:active,
    &.active {
        & .pty-chat-trigger-bot {
            animation: pty-bot-bounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
        }
    }

    &.nudge {
        &::before,
        &::after {
            content       : '';
            position      : absolute;
            top           : 50%;
            left          : 50%;
            width         : 100%;
            height        : 100%;
            border-radius : var(--border-radius);
            border        : 2px solid currentColor;
            opacity       : 0;
            transform     : translate(-50%, -50%);
            animation     : pty-ripple 2.5s ease-out infinite;
            pointer-events: none;
        }

        &::after {
            animation-delay: 0.8s;
        }
    }

    & #pty-chat-badge {
        position   : absolute;
        right      : -10px;
        top        : -15px;
        background : var(--error);
        width      : var(--badge-width);
        color      : var(--white);
    }
}

.pty-audio-player {
    display        : flex;
    align-items    : center;
    gap            : 8px;
    padding        : 6px 10px;
    border-radius  : var(--border-radius);
    background     : var(--btn);
    max-width      : 260px;
}

.pty-audio-play-btn {
    flex-shrink    : 0;
    width          : 32px;
    height         : 32px;
    border-radius  : 50%;
    background     : var(--brand);
    color          : var(--white);
    border         : none;
    cursor         : pointer;
    display        : flex;
    align-items    : center;
    justify-content: center;
    padding        : 0;
}

.pty-audio-scrubber {
    position       : relative;
    flex           : 1;
    height         : 44px;
    cursor         : pointer;
}

.pty-audio-waveform {
    width          : 100%;
    height         : 44px;
    fill           : var(--color-30);
}

.pty-audio-progress {
    position       : absolute;
    top            : 0;
    left           : 0;
    height         : 100%;
    width          : 0%;
    background     : var(--brand);
    opacity        : 0.25;
    border-radius  : var(--border-radius);
    pointer-events : none;
    transition     : width 0.1s linear;
}

.pty-audio-timer {
    flex-shrink    : 0;
    font-size      : 0.75rem;
    color          : var(--text-muted);
    min-width      : 32px;
    text-align     : right;
}

.thread-header-window-timer {
    font-size  : 0.7rem;
    color      : var(--text-muted);
    margin-left: 6px;
}

.thread-header-window-timer.urgent {
    color      : var(--error);
    font-weight: 600;
}

.message-item {

}

.pty-confirm-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.pty-confirm-user img.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

#pty-toast-wrap {

    position: fixed;
    bottom: var(--input-size);
    left: calc( var(--input-size) * 2 );
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    pointer-events: none;

    & .pty-toast {

        pointer-events: all;
        background: var(--btn);
        border: 1px solid var(--border);
        border-radius: var(--border-radius);
        box-shadow: var(--box-shadow);
        width: 320px;
        transform: translateX( calc( 100% + 2rem ) );
        opacity: 0;
        transition: transform .3s ease, opacity .3s ease;
        cursor: pointer;
        overflow: hidden;

        &.show {
            transform: translateX( 0 );
            opacity: 1;
        }

        & .pty-toast-inner {

            display: flex;
            align-items: center;
            gap: var(--padding);
            padding: var(--padding);

            & .pty-toast-avatar {

                width: var(--input-size);
                height: var(--input-size);
                border-radius: var(--border-radius);
                object-fit: cover;
                flex-shrink: 0;

            }

            & .pty-toast-body {

                flex: 1;
                min-width: 0;
                display: flex;
                flex-direction: column;
                gap: .15rem;

                & .pty-toast-name {

                    font-size: .85rem;
                    font-weight: 600;
                    color: var(--text);
                    white-space: nowrap;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    line-height: 1.3;

                }

                & .pty-toast-preview {

                    font-size: .82rem;
                    color: var(--text);
                    white-space: nowrap;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    line-height: 1.3;

                }

                & .pty-toast-label {
                    font-size: .85rem;
                    font-weight: 500;
                    color: var(--text);
                    white-space: nowrap;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    line-height: 1.3;
                }

                & .pty-toast-date {

                    font-size: .7rem;
                    color: var(--text);
                    line-height: 1.3;

                }
            }

            & .pty-toast-close {

                width: var(--input-size);
                background: none;
                border: none;
                color: var(--text);
                padding: .25rem;
                cursor: pointer;
                flex-shrink: 0;
                line-height: 1;
                transition: color .15s;

                &:hover { color: var(--text); }

                & i {

                }
            }
        }

        & .pty-toast-reply {

            display: flex;
            gap: var(--padding);
            padding: var(--padding);

            & .pty-toast-reply-input {

                flex: 1;
                min-width: 0;
                border: 1px solid var(--border);
                border-radius: var(--border-radius);
                padding: var(--padding);
                font-size: 0.85rem;

            }

            & .pty-toast-reply-send {

                & i {

                }
            }
        }

        & .pty-toast-progress {

            height: 3px;
            background: var(--border);
            overflow: hidden;

            & .pty-toast-progress-bar {

                height: 100%;
                width: 100%;
                background: var(--brand);
                animation: pty-toast-progress linear forwards;
                transform-origin: left;

            }
        }

        &:hover,
        &:focus-within,
        &:has( .pty-toast-reply-input:not(:placeholder-shown) ) {

            & .pty-toast-progress-bar {
                animation-play-state: paused;
            }
        }
    }
}

.is-deleting {
  animation: pixel-dissolve 0.35s steps(8) forwards,
             collapse-height 0.3s ease 0.15s forwards;
  overflow: hidden;
  pointer-events: none;
}

.pty-deleted-users .du-intro {
    color: var(--color-gray-50, #666);
    max-width: 64ch;
}

.pty-deleted-users .du-empty {
    color: var(--color-gray-50, #888);
    font-style: italic;
}

.du-entry {
    /*border: 1px solid var(--color-gray-85, #e2e2e2);*/
    border-radius: var(--border-radius);
    margin-bottom: 0.75rem;
    background: var(--btn, #fbfbfb);
}

.du-entry[open] {
    /*background: #fff;*/
}

.du-entry.restored {
    opacity: 0.75;
}

.du-entry summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    cursor: pointer;
    list-style: none;
}

.du-entry summary::-webkit-details-marker {
    display: none;
}

.du-name {
    font-weight: 600;
}

.du-email,
.du-date {
    color: var(--color-gray-50, #777);
    font-size: 0.875rem;
}

.du-restored-badge {
    background: var(--color-30, #2e7d32);
    color: #fff;
    border-radius: 999px;
    font-size: 0.75rem;
    padding: 0.1rem 0.6rem;
    margin-left: auto;
}

.du-detail {
    padding: 0 1rem 1rem;
    border-top: 1px solid var(--color-gray-90, #eee);
}

.du-actions {
    display: flex;
    gap: 0.5rem;
    margin: 0.75rem 0 1rem;
}

.du-restore-btn:hover {
    border-color: var(--color-30, #2e7d32);
    color: var(--color-30, #2e7d32);
}

.du-purge-btn:hover {
    border-color: #b3261e;
    color: #b3261e;
}

.du-meta-table {
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.du-meta-table th {
    text-align: left;
    padding: 0.25rem 1.25rem 0.25rem 0;
    color: var(--color-gray-40, #555);
    font-weight: 600;
    white-space: nowrap;
    vertical-align: top;
}

.du-meta-table td {
    padding: 0.25rem 0;
}

.du-thread {
    border: 1px solid var(--color-gray-90, #eee);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    max-height: 340px;
    overflow-y: auto;
}

.du-thread-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-gray-40, #555);
    margin-bottom: 0.5rem;
}

.du-msg {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.5rem;
    padding: 0.4rem 0.7rem;
    border-radius: 8px;
    background: var(--color-gray-95, #f2f2f2);
    max-width: 80%;
}

.du-msg.mine {
    margin-left: auto;
    background: var(--color-90, #e7f0fe);
}

.du-msg-sender {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-gray-40, #555);
}

.du-msg-time {
    font-size: 0.7rem;
    color: var(--color-gray-60, #999);
    margin-top: 0.15rem;
}

#primary,
#activity-wrap {

    display:        flex;
    flex-direction: column;
    gap:            0;

    & .pty-composer {

        padding: var(--padding);
        background-color: var(--header-bg);
        border-radius: var(--border-radius);
        border: 1px solid var(--border);
        box-shadow: var(--box-shadow);
        margin-bottom: var(--gap);
    }

    & #activity-feed {

        display: flex;
        flex-direction: column;
        gap: var(--gap);

        & .card.activity-item {
            display: flex;
            flex-direction: column;
            gap: 0;
            padding: 0;

            background: var(--card-bg);
            border: 1px solid var(--border);
            border-radius: var(--border-radius);

            & > div { width: 100%; }

            & .card-header {
                padding: var(--padding);
                aspect-ratio: unset;
                display: flex;
                overflow: unset;

                & .avatar-meta {
                    display: flex;

                    & .avatar {
                        margin-right: var(--padding);

                        & .activity-avatar {
                            width:         var(--input-size);
                            height:        var(--input-size);
                            border-radius: var(--border-radius);
                            object-fit:    cover;
                            flex-shrink:   0;
                        }
                    }

                    & .meta {
                        margin-right: var(--padding);

                        & p { margin: 0; }

                        & .activity-name {

                            font-weight: bold;

                            & .member-handle {
                                font-weight: normal;
                                opacity: .7;
                                margin-left: 4px;
                            }
                        }
                    }
                }

                & .actions {

                    list-style: none;

                    & .nav-link {

                    }

                    & .dropdown-menu {

                        overflow: hidden;

                    }
                }
            }

            & .card-body {

                padding-bottom: 0px;

                margin: 0px;
                display: flex;
                    align-items: center;
                    justify-content: center;

                    color: var(--header-bg);

                font-size: 24px;
                font-weight: bold;
                position: relative;
                background-color: var(--btn);
                aspect-ratio: 16 / 9;
                background-size: cover;
                background-position: center;
                border-radius: 0px;

                &.cover_updated {
                    aspect-ratio: 3 / 1;
                }

                & .activity-scene {

                    position: relative;
                    z-index: 10;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    gap: var(--gap);
                    width: 100%;
                    height: 100%;
                    font-size: 16px;

                    & .scene-person {
                        display: flex;
                        flex-direction: column;
                        align-items: center;
                        gap: 4px;
                        color: var(--text);
                        text-decoration: none;
                    }

                    & .scene-avatar {
                        width: calc(var(--input-size) * 2);
                        height: calc(var(--input-size) * 2);
                        border-radius: var(--border-radius);
                        object-fit: cover;
                        border: 3px solid var(--header-bg);

                        &.xl {
                            width: auto;
                            height: 70%;
                            aspect-ratio: 1 / 1;
                        }
                    }

                    & .scene-name { font-weight: bold; }

                    & .member-handle {
                        font-size: 13px;
                        font-weight: normal;
                        opacity: .8;
                    }

                    & .scene-link i { font-size: 28px; }
                }

                &.profile_updated,
                &.joined {

                    & .scene-person,
                    & .member-handle { color: var(--white); }
                }

                &.forum_topic {

                    & .topic-heading {

                        font-size: 24px;
                        font-weight: bold;
                        text-decoration: underline;
                    }

                    & .activity-content {

                        font-size: 14px;
                        text-decoration: italic;
                    }

                    &::after {
                        content: none;
                    }
                }

                .card[data-type="status"] & {

                    padding: var(--gap);
                    aspect-ratio: unset;
                    background-color: var(--btn);

                    & * { color: var(--text); }

                    &::after {
                        content: none;
                    }
                }

                .card[data-type="image"] & {

                    background-color: var(--cta);

                    & * { color: var(--header-bg); }

                    &::after {
                        content: none;
                    }
                }

                .card[data-type="file"] & {

                    background-color: var(--cta);

                    & * { color: var(--header-bg); }

                    &::after {
                        content: none;
                    }
                }

                .card[data-type="audio"] & {

                    padding: var(--gap);
                    aspect-ratio: unset;
                    background-color: var(--cta);

                    & * { color: var(--header-bg); }

                    &::after {
                        content: none;
                    }
                }

                & .activity-content {
                    text-align: center;
                }

            }

            & .card-footer {

                padding: var(--padding);
                background-color: var(--header-bg);
                border-top: none;

                & .actions-reactions {
                    display: flex;
                    align-items: center;
                    justify-content: space-between;

                    & .actions,
                    & .reactions {
                        & button,
                        & .reaction-chip,
                        & .nav-link {
                            background-color: transparent;
                        }
                    }

                    & .actions {
                        display: flex;
                        gap: var(--padding);
                        list-style: none;

                        & .nav-link {
                            padding: 0px var(--gap);
                            width: var(--input-size);
                            height: var(--input-size);
                            gap: 10px;
                        }
                    }

                    & .reactions {
                        position: relative;

                        & .reaction-who-tooltip {
                            display: none;
                            position: absolute;
                            bottom: calc(100% + 6px);
                            left: 50%;
                            transform: translateX(-50%);
                            background: var(--card-bg);
                            border: 1px solid var(--btn);
                            border-radius: var(--border-radius);
                            box-shadow: var(--shadow);
                            padding: 4px 8px;
                            font-size: 11px;
                            white-space: nowrap;
                            z-index: 100;
                            pointer-events: none;
                        }

                        &:hover .reaction-who-tooltip {
                            display: block;
                        }
                    }
                }
            }
        }
    }
}

.activity-reaction-option {
    background:    none;
    border:        none;
    font-size:     1.25rem;
    cursor:        pointer;
    padding:       .15rem .2rem;
    border-radius: var(--border-radius);
    line-height:   1;
    transition:    transform .1s;

    &:hover { transform: scale(1.35); }
}

.activity-reactions {
    display:     flex;
    flex-wrap:   wrap;
    gap:         .25rem;
    padding:     .3rem 1rem;
    min-height:  0;

    &:empty { padding: 0; }
}

.activity-reaction-chip {
    display:       inline-flex;
    align-items:   center;
    gap:           .25rem;
    background:    var(--color-30);
    border:        1px solid var(--border);
    border-radius: var(--border-radius);
    padding:       .15rem .5rem;
    font-size:     .82rem;
    cursor:        pointer;
    transition:    background .12s, border-color .12s;

    & span { font-size: .75rem; font-weight: 600; }

    &.active {
        background:   color-mix(in srgb, var(--brand, #1274E0) 10%, transparent);
        border-color: var(--brand, #1274E0);
        color:        var(--brand, #1274E0);
    }

    &:hover {
        background: color-mix(in srgb, var(--brand, #1274E0) 14%, transparent);
    }
}

.activity-comments {
    border-top:  1px solid var(--border);
    padding:     .6rem 1rem .75rem;
    display:     flex;
    flex-direction: column;
    gap:         .5rem;
    background:  var(--color-30);
}

.activity-comments-list {
    display:        flex;
    flex-direction: column;
    gap:            .6rem;
}

.activity-comment {
    display:     flex;
    align-items: flex-start;
    gap:         .6rem;

    &.is-reply {
        margin-left: 2.5rem;

        & .activity-comment-avatar {
            width:  26px;
            height: 26px;
        }
    }
}

.activity-comment-avatar {
    width:         32px;
    height:        32px;
    border-radius: var(--border-radius);
    object-fit:    cover;
    flex-shrink:   0;
}

.activity-comment-body {
    flex:       1;
    min-width:  0;
    background: var(--header-bg);
    border:     1px solid var(--border);
    border-radius: var(--border-radius);
    padding:    .4rem .65rem;
}

.activity-comment-author {
    font-weight:  600;
    font-size:    .8rem;
    margin-right: .4rem;

    & a { color: inherit; text-decoration: none; &:hover { color: var(--brand); } }
}

.activity-comment-text {
    font-size:   .85rem;
    line-height: 1.45;
    word-break:  break-word;
    white-space: pre-wrap;

    & .edited-tag {
        font-size:  .7rem;
        color:      var(--text-muted);
        font-style: italic;
        margin-left: .3rem;
    }
}

.activity-comment-meta {
    display:     flex;
    align-items: center;
    gap:         .6rem;
    margin-top:  .25rem;
}

.activity-comment-time {
    font-size: .7rem;
    color:     var(--text-muted);
}

.activity-comment-action {
    background: none;
    border:     none;
    padding:    0;
    font-size:  .72rem;
    color:      var(--text-muted);
    cursor:     pointer;
    transition: color .12s;

    &:hover       { color: var(--brand, #1274E0); }
    &.text-danger { &:hover { color: #e53935; } }
}

.activity-comment-form {
    display:     flex;
    align-items: center;
    gap:         calc(var(--padding) / 2);
    margin-top:  .4rem;

    & .activity-comment-send {
        flex-shrink: 0;
        list-style:  none;
    }

    & .activity-comment-avatar {
        width:  28px;
        height: 28px;
    }

    & .activity-comment-input { flex: 1; }

    & .square {
        flex-shrink: 0;
        color:       var(--text-muted);
        transition:  color .12s;

        &:hover { color: var(--brand, #1274E0); }
    }
}

.activity-comment-edit-input {
    width:        100%;
    margin-bottom: .3rem;
}

#user-activity-heatmap {

    --hm-cell: 10px;
    --hm-gap: 3px;

    position: absolute;
    top: var(--gap);
    right: var(--gap);
    z-index: 3;

    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: calc(100% - var(--gap) * 2);
    padding: var(--padding);

    background: var(--header-bg);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    color: var(--text);
    font-size: 11px;
    line-height: 1;

    & .heatmap-total {
        margin: 0;
        font-size: 12px;
        font-weight: 600;
    }

    & .heatmap-scroll {
        overflow-x: auto;
        direction: rtl;
    }

    & .heatmap-body {
        display: flex;
        gap: 6px;
        width: max-content;
        direction: ltr;
    }

    & .heatmap-days {
        display: grid;
        grid-template-rows: repeat(7, var(--hm-cell));
        gap: var(--hm-gap);
        margin-top: calc(11px + 6px);
        opacity: .7;

        & span {
            font-size: 9px;
            line-height: var(--hm-cell);
        }
    }

    & .heatmap-weeks {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    & .heatmap-months {
        display: grid;
        grid-template-columns: repeat(53, var(--hm-cell));
        column-gap: var(--hm-gap);
        height: 11px;
        opacity: .7;

        & span {
            white-space: nowrap;
            font-size: 10px;
        }
    }

    & .heatmap-grid {
        display: grid;
        grid-template-rows: repeat(7, var(--hm-cell));
        grid-auto-columns: var(--hm-cell);
        grid-auto-flow: column;
        gap: var(--hm-gap);
    }

    & .heatmap-cell {
        display: block;
        width: var(--hm-cell);
        height: var(--hm-cell);
        border-radius: 2px;
        outline: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
        outline-offset: -1px;

        &.level-0 { background: var(--btn); }
        &.level-1 { background: color-mix(in srgb, var(--brand) 35%, var(--btn)); }
        &.level-2 { background: color-mix(in srgb, var(--brand) 60%, var(--btn)); }
        &.level-3 { background: color-mix(in srgb, var(--brand) 85%, var(--btn)); }
        &.level-4 { background: var(--brand); }
    }

    & .heatmap-grid .heatmap-cell:hover {
        outline: 1px solid var(--text);
    }

    & .heatmap-legend {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: var(--hm-gap);
        opacity: .8;

        & span:first-child { margin-right: 3px; }
        & span:last-child { margin-left: 3px; }
    }
}

/*#user-activity-heatmap {
    display: flex;
    flex-direction: column;
    overflow-x: auto;
    max-width: 100%;
    padding: var(--padding);

    border-radius: var(--border-radius);

    z-index: 3;

    position: absolute;
    top: var(--gap);
    right: var(--gap);

    backdrop-filter: var(--backdrop-filter);

    & .heatmap-days,
    & .heatmap-months {
        color: var(--header-bg) !important;
        & * {
            color: var(--header-bg) !important;

        }
    }

    & .heatmap-months {
        display: flex;
        justify-content: space-between;
        height: 20px;
        margin-bottom: 5px;
        margin-left: 30px;
        width: calc(53 * 10px + 52 * 2px);

        & div { font-size: 12px; }
    }

    & .heatmap-container {
        display: flex;

        & .heatmap-days {
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            margin-right: 15px;
            width: fit-content;
            height: calc(7 * 10px + 6 * 2px);

            & div { font-size: 8px; }

        }

        & .heatmap-grid {

            display: grid;
            grid-template-columns: repeat(53, 10px);
            grid-template-rows: repeat(7, 10px);
            grid-auto-flow: column;
            gap: 2px;

            & .heatmap-cell {

                width: 10px;
                height: 10px;
                border-radius: 2px;
                background: var(--btn);
                backdrop-filter: var(--backdrop-filter);
                transition: var(--transition);
                cursor: pointer;
                opacity: 0.5;

                &:hover {
                    outline: 2px solid var(--brand);
                    outline-offset: 0px;
                    transform: scale(1.1);
                    z-index: 10;
                }

                &.loading {
                    animation: pulse 1.5s ease-in-out infinite;
                    opacity: 0.7;
                }

                &.past:not(.loading) {

                    opacity: 0.1;
                }

                &.future:not(.loading) {
                    background-color: transparent;
                    border: 1px solid var(--btn);
                }
            }
        }
    }
}*/

@media ( max-width: 600px ) {

    .activity-media-img {
        max-height: 260px;
    }

    .activity-comment.is-reply {
        margin-left: 1.5rem;
    }

}

.pty-badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--input-size), 1fr));
    gap: var(--padding);
    padding: var(--padding);
    width: 100%;
    box-sizing: border-box;

    & .pty-badge {
        display: flex;
        align-items: center;
        justify-content: center;
        aspect-ratio: 1;
        min-width: 0;
        border-radius: var(--border-radius);
        background: var(--btn);
        transition: var(--transition);
        cursor: default;

        &:hover {
            background: var(--btn-hover);
            transform: scale(1.08);
        }

        & i {
            font-size: calc(var(--input-size) / 2.5);
            line-height: 1;
        }
    }
}

.pty-history-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap);
    padding: 15px;
    &.cover {
        & .pty-history-item {
            aspect-ratio: 16/9;
        }
    }
    &.avatar {
        & .pty-history-item {
            aspect-ratio: 1/1;
        }
    }
    & .pty-history-item {
        position: relative;
        cursor: pointer;
        border-radius: var(--border-radius);
        height: calc(var(--input-size) * 1.5);
        transition: border-color .15s, transform .15s;
        &:hover img  { border: 1px solid var(--header-bg); filter: grayscale(10%); }
        &.active img { border: 2px solid var(--header-bg); filter: grayscale(0%); }
        & img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
            border: 1px solid var(--border);
            filter: grayscale(100%);
            border-radius: var(--border-radius);
        }
        & .pty-history-delete {
            position: absolute;
            top: -8px;
            right: -8px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            width: var(--badge-size);
            height: var(--badge-size);
            border-radius: var(--badge-radius);
            color: var(--white);
            background-color: var(--error-light);
            &:hover {
                background-color: var(--error);
            }
        }
        & .pty-history-badge {
            position: absolute;
            bottom: 4px;
            left: 4px;
            font-size: 9px;
            font-weight: 700;
            text-transform: uppercase;
            background: var(--brand);
            color: var(--header-bg);
            padding: 1px 5px;
            border-radius: var(--badge-radius);
        }
    }
}

#query-results-grid {

    & .card {

        &:has(.topic-status-wrap .dropdown-menu.show) {
            overflow: visible;
            z-index: 2;
        }

        &.filtered-out {
            display: none;
        }
    }
}

.card[data-type="topic"] .card-footer .topic-status-wrap,
.card[data-type="topic"] .card-footer > .topic-status {
    margin-inline: auto;
}

#activity-feed .card.activity-item[data-forum] .card-body {
    position: relative;
}

#activity-feed .card.activity-item[data-forum] .card-body::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

#activity-feed .card.activity-item[data-forum] .card-body > * {
    position: relative;
    z-index: 1;
}

#activity-feed .card.activity-item[data-forum] .card-body,
#activity-feed .card.activity-item[data-group] .card-body {
    position: relative;
}

#activity-feed .card.activity-item[data-forum] .card-body::before,
#activity-feed .card.activity-item[data-group] .card-body::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

#activity-feed .card.activity-item[data-forum] .card-body > *,
#activity-feed .card.activity-item[data-group] .card-body > * {
    position: relative;
    z-index: 1;
}

.entity-cover-preview {
    width: 100%;
    padding: var(--padding);
}

.entity-cover-preview img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius);
}

.entity-cover-error {
    width: 100%;
    padding: var(--padding);
    color: var(--danger);
    text-align: center;
}

.pty-picker-selected {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--gap) / 2);
}

.pty-picker-selected:not(:empty) {
    padding-bottom: var(--padding);
}

.pty-picker-pill {
    display: inline-flex;
    align-items: center;
    gap: calc(var(--gap) / 2);
    padding: calc(var(--padding) / 3) var(--padding);
    border-radius: 999px;
    background: var(--surface-02);
    cursor: pointer;
}

.pty-picker-pill .avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.pty-picker-results {
    display: block;
    width: 100%;
    max-height: 260px;
    overflow-y: auto;
}

.pty-picker-results .dropdown-link {
    display: flex;
    align-items: center;
    gap: var(--gap);
}

.pty-picker-results .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.pty-invite-picker {
    height: auto;
    min-height: 0;
    padding: calc(var(--padding) / 2);
}

.pty-invite-picker .pty-picker-search {
    border: 0;
    padding-left: 0;
    background: transparent;
}

.pty-invite-picker .pty-picker-search:focus {
    box-shadow: none;
}

.pty-badge.is-locked {
    opacity: 0.3;
    filter: grayscale(1);
}

#pty-chat-popup.rail {

    --rail-w: calc( var(--input-size) + var(--gap) );

    --rail-thread-w: 500px;
    --rail-avatar: var(--input-size);

    transition: width 300ms cubic-bezier(0.25, 0.8, 0.25, 1);

    width: var(--rail-w);
    z-index: 1;
    background: var(--body-bg);
    /*border-left: 1px solid var(--border);*/
    overflow: hidden;

    & .rail-roster,
    & .rail-thread {
        position: absolute;
        inset: 0;
        transition: transform 300ms cubic-bezier(0.25, 0.8, 0.25, 1);
        will-change: transform;
    }

    & .rail-roster {
        width: var(--rail-w);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--padding);
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-width: none;

        justify-content: flex-end;
        padding: var(--padding);

        &::-webkit-scrollbar { display: none; }

        & .pty-chat-avatar-btn {

            flex: 0 0 auto;
            width: var(--rail-avatar);
            height: var(--rail-avatar);
            padding: 0;
            border: 0;
            background: none;
            cursor: pointer;
            border-radius: var(--border-radius-round);
            transition: var(--transition);

            &:hover { transform: scale(1.08); }

            &.has-unread .pty-avatar-circle { box-shadow: 0 0 0 2px var(--cta); }

            &.online {

                & .pty-avatar-circle { border-color: var(--success); }

                & img { filter: none; }
            }

            &.recently-online .pty-avatar-circle { border-color: var(--warning-light); }

            &.offline .pty-avatar-circle,
            &.never-logged-in .pty-avatar-circle { border-color: var(--error-light); }

            & .pty-avatar-circle {
                position: relative;
                width: 100%;
                height: 100%;
                box-sizing: border-box;
                border: 2px solid var(--muted);
                border-radius: var(--border-radius-round);
                overflow: visible;

                & img {
                    width: 100%;
                    height: 100%;
                    object-fit: cover;
                    border-radius: var(--border-radius-round);
                    display: block;

                    filter: grayscale(1);
                    transition: var(--transition);
                }

                & .pty-avatar-fallback {
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    width: 100%;
                    height: 100%;
                    border-radius: var(--border-radius-round);
                    background: var(--btn);
                    color: var(--text);
                }

                & .thread-source-badge {
                    position: absolute;
                    right: -2px;
                    bottom: -2px;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    width: var(--badge-size);
                    height: var(--badge-size);
                    border-radius: var(--border-radius-round);
                    border: 2px solid var(--header-bg);
                    background: var(--cta);
                    color: var(--white);
                    font-size: 9px;
                    line-height: 1;
                }

                & .pty-chat-avatar-badge {
                    position: absolute;
                    top: -4px;
                    right: -4px;
                    min-width: var(--badge-size);
                    height: var(--badge-size);
                    padding: 0 4px;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    border-radius: var(--badge-radius);
                    background: var(--error);
                    color: var(--white);
                    font-size: 10px;
                    font-weight: 700;
                    line-height: 1;
                }
            }

            & img {

            }
        }
    }

    & .rail-thread {
        transform: translateX(100%);
        display: flex;
        flex-direction: column;
        background: var(--header-bg);
    }

    &.thread-open {

        width: var(--rail-thread-w);

        & .rail-roster { transform: translateX(calc(var(--rail-w) * -1)); }
        & .rail-thread { transform: translateX(0); }

    }

    & .pty-chat-window {
        position: static;
        width: 100%;
        height: 100%;
        margin: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    & .pty-thread-view {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        height: 100%;
        min-height: 0;
    }

    & .thread-view-header { flex: 0 0 auto; }

    & .thread-view-header { flex-direction: row-reverse; }

    & .thread-messages {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
    }

    & .pty-composer { flex: 0 0 auto; }
}

@media (max-width: 991px) {
    #pty-chat-popup.rail.thread-open { width: 100vw; }
}

@media (min-width: 992px) {

}

#hero {

    aspect-ratio: unset;
}



@keyframes pty-live-pulse {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--error) 60%, transparent); }
    70%  { box-shadow: 0 0 0 6px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

.nav-link.live > img.avatar,
img.avatar.live,
.pymk-avatar.live,
.dir-card-avatar.live,
.pty-chat-avatar-btn.live .pty-avatar-circle,
.live-rail-item.is-live img.avatar {
    outline: 2px solid var(--error);
    outline-offset: 2px;
}

.badge.live {
    background: var(--error) !important;
    animation: pty-live-pulse 1.6s ease-out infinite;
}

#sidePanel .live-rail-heading {
    height: auto;

    & .icon { color: var(--error); }
    & .badge { background-color: var(--error); }
}

#sidePanel .live-rail-item {

    & img.avatar {
        width: calc(var(--input-size) - 12px);
        height: calc(var(--input-size) - 12px);
        border-radius: 50%;
        object-fit: cover;
        vertical-align: middle;
    }

    & .text {
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.15;
    }

    & small {
        display: block;
        font-size: .7rem;
        color: var(--muted);
    }

    &.is-live small { color: var(--error); font-weight: 700; text-transform: uppercase; }

    &.was-live img.avatar { opacity: .5; filter: grayscale(1); }
}

#sidePanel .live-rail-end {
    height: auto;

    & hr { margin: 0; border-color: var(--border); }
}



.activity-scene.stream {
    flex-direction: column;
    gap: 10px;

    & .scene-person { position: relative; }

    & .scene-avatar {
        outline: 3px solid transparent;
        outline-offset: 2px;
    }

    & .scene-live-badge {
        display: none;
        position: absolute;
        bottom: -8px;
        left: 50%;
        transform: translateX(-50%);
        padding: 2px 8px;
        border-radius: var(--border-radius);
        background: var(--error);
        color: var(--white);
        font-size: .7rem;
        font-weight: 800;
        text-transform: uppercase;
    }

    & .scene-watch {
        display: none;
        align-items: center;
        padding: 6px 14px;
        border-radius: var(--border-radius);
        background: var(--error);
        color: var(--white);
        font-weight: 700;
        text-decoration: none;
    }

    & .scene-was {
        font-size: .85rem;
        opacity: .8;
    }

    & .scene-viewers {
        display: none;
        font-size: .85rem;
        font-weight: 700;
    }

    &.is-live {

        & .scene-avatar {
            outline-color: var(--error);
            animation: pty-live-pulse 1.6s ease-out infinite;
        }

        & .scene-live-badge,
        & .scene-watch,
        & .scene-viewers { display: inline-flex; }

        & .scene-was { display: none; }
    }
}

#pty-chat-popup.rail {

    & .rail-live {
        position: absolute;
        inset: 0;
        display: flex;
        flex-direction: column;
        background: var(--header-bg);
        transform: translateX(100%);
        transition: transform 300ms cubic-bezier(0.25, 0.8, 0.25, 1);
        will-change: transform;
    }

    &.live-open {

        width: var(--rail-thread-w);

        & .rail-roster { transform: translateX(calc(var(--rail-w) * -1)); }
        & .rail-live { transform: translateX(0); }
    }

    & .pty-live-chat-btn {
        flex: 0 0 auto;
        width: var(--rail-avatar);
        height: var(--rail-avatar);
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid var(--error);
        border-radius: var(--border-radius-round);
        background: var(--error);
        color: var(--white);
        cursor: pointer;
        animation: pty-live-pulse 1.6s ease-out infinite;
    }

    & .live-chat-head {
        flex: 0 0 auto;
        display: flex;
        gap: 4px;
        padding: var(--padding);
        border-bottom: 1px solid var(--border);
    }

    & .live-chat-tab {
        flex: 1 1 0;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        height: var(--input-size);
        border: 0;
        border-radius: var(--border-radius);
        background: var(--btn);
        color: var(--text);
        font-weight: 600;
        cursor: pointer;

        &:hover { background: var(--btn-hover); }

        &.active {
            background: var(--error);
            color: var(--white);
        }
    }

    & .live-chat-messages {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        margin: 0;
        padding: var(--padding);
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    & .live-chat-note {
        margin: auto;
        color: var(--muted);
        font-size: .85rem;
    }

    & .live-chat-item {
        position: relative;
        display: flex;
        align-items: flex-start;
        gap: 8px;
        font-size: .9rem;
        line-height: 1.35;

        & .live-chat-avatar img {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            object-fit: cover;
            display: block;
        }

        & .live-chat-body {
            flex: 1 1 auto;
            min-width: 0;
            overflow-wrap: anywhere;
        }

        & .live-chat-meta {
            display: flex;
            align-items: baseline;
            gap: 6px;
        }

        & .live-chat-badges {
            display: inline-flex;
            align-items: center;
            gap: 3px;
        }

        & .live-chat-badge {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 16px;
            height: 16px;
            font-size: 11px;
            line-height: 1;

            &.is-broadcaster,
            &.is-admin,
            &.is-global_mod,
            &.is-channel_mod {
                border-radius: 3px;
                background: currentColor;

                & i { color: var(--white); }
            }
        }

        & .live-chat-name {
            font-weight: 700;
            color: var(--text);
            text-decoration: none;
        }

        & .live-chat-verified {
            margin-left: -3px;
            color: var(--cta);
            font-size: .8rem;
        }

        & .live-chat-time {
            font-size: .7rem;
            color: var(--muted);
        }

        & .live-chat-text {
            color: var(--text);

            & .mention-link {
                font-weight: 700;
                color: var(--cta);
                text-decoration: none;
            }
        }

        & .live-chat-media {
            display: block;
            max-width: 100%;
            max-height: 180px;
            margin-top: 4px;
            border-radius: var(--border-radius);
        }

        &.is-streamer .live-chat-name { color: var(--error); }

        &.is-mention {
            margin: 0 calc(var(--padding) * -1);
            padding: 6px var(--padding);
            background: color-mix(in srgb, var(--cta) 14%, transparent);
            box-shadow: inset 3px 0 0 var(--cta);
        }

        & .live-chat-tools {
            display: none;
            gap: 2px;
            position: absolute;
            top: -6px;
            right: 0;
            padding: 2px;
            border-radius: var(--border-radius);
            background: var(--header-bg);
            box-shadow: var(--box-shadow);
        }

        &:hover .live-chat-tools { display: flex; }
    }

    & .live-chat-start { margin: 0 auto 8px; }

    & .rail-live .pty-composer {
        flex: 0 0 auto;
        border-top: 1px solid var(--border);
    }
}

@media (max-width: 991px) {
    #pty-chat-popup.rail.live-open { width: 100vw; }
}

.pty-member-menu {
    position: fixed;
    z-index: 10000;
    display: block;
    width: 260px;
    margin: 0;
    padding: 0 0 6px;
    list-style: none;
    background: var(--header-bg);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);

    & .dropdown-profile .live-chat-badges {
        display: inline-flex;
        gap: 3px;
        margin-top: 6px;
    }

    & .live-chat-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 16px;
        height: 16px;
        font-size: 11px;

        &.is-broadcaster,
        &.is-admin,
        &.is-global_mod,
        &.is-channel_mod {
            border-radius: 3px;
            background: currentColor;

            & i { color: var(--white); }
        }
    }

    & .live-chat-verified {
        color: var(--cta);
        font-size: .85em;
    }

    & .dropdown-item {
        display: flex;
        align-items: center;
        width: 100%;
        min-height: var(--input-size);
        padding: 0 var(--padding);
        border: 0;
        background: none;
        color: var(--text);
        text-align: left;
        text-decoration: none;
        font: inherit;
        cursor: pointer;

        &:hover { background: var(--btn-hover); }

        &.is-danger { color: var(--error); }
    }

    & .dropdown-header {
        padding: 6px var(--padding) 2px;
        font-size: .7rem;
        text-transform: uppercase;
        color: var(--muted);
    }

    & .dropdown-divider {
        margin: 6px 0;
        border: 0;
        border-top: 1px solid var(--border);
    }
}

#live-directory .empty {
    margin: var(--padding) 0 calc(var(--padding) * 2);
    color: var(--muted);
}

.live-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--padding);
    margin-bottom: calc(var(--padding) * 2);
}

.live-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    transition: transform 150ms ease;

    &:hover { transform: translateY(-2px); }

    & .live-card-cover {
        position: relative;
        aspect-ratio: 16 / 9;
        background-size: cover;
        background-position: center;
        background-color: #000;
    }

    & .live-card-badge,
    & .live-card-viewers {
        position: absolute;
        top: 8px;
        padding: 2px 8px;
        border-radius: var(--badge-radius);
        color: var(--white);
        font-size: 12px;
        font-weight: 700;
    }

    & .live-card-badge {
        left: 8px;
        background: var(--error);
        text-transform: uppercase;
    }

    & .live-card-viewers {
        right: 8px;
        background: color-mix(in srgb, #000 55%, transparent);
    }

    & .live-card-body {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px;
    }

    & img.avatar {
        flex: none;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        object-fit: cover;
    }

    & .live-card-text {
        display: flex;
        flex-direction: column;
        min-width: 0;

        & strong,
        & small {
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        & small { color: var(--muted); }
    }

    &.is-live img.avatar {
        outline: 2px solid var(--error);
        outline-offset: 2px;
        animation: pty-live-pulse 1.6s ease-out infinite;
    }

    &.was-live .live-card-cover { filter: grayscale(1); opacity: .6; }
}

.activity-item .card-body.avatar_updated {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background-size: cover;
    background-position: center;

    &::before {
        content: '';
        position: absolute;
        inset: -40px;
        z-index: -1;
        background: inherit;
        background-size: cover;
        background-position: center;
        filter: blur(28px) saturate(1.4) brightness(.85);
        transform: scale(1.15);
    }
}


.pty-leaderboard-points {
        font-size: .875em;
    color: var(--text-muted);
}

.navbar-brand.group-nav {
    align-items: center;
    gap: var(--padding);

    & > li > button {
        width: auto;
        padding: 0 var(--gap);
        white-space: nowrap;
    }

    & .dropdown-menu {
        min-width: 220px;

        & button {
            justify-content: flex-start;
        }
    }
}

.group-tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--padding);
    margin-bottom: var(--padding);

    & h3 {
        margin: 0;
    }

    & .radchecks {
        width: auto;
    }
}

.group-tab {
    display: flex;
    flex-direction: column;
    gap: var(--padding);
    padding: var(--padding);
    background: var(--header-bg);
    border-radius: var(--border-radius);
}

.group-about-facts {
    display: flex;
    flex-direction: column;
    gap: calc(var(--padding) / 2);
    margin: 0;
    padding: 0;
    list-style: none;

    & li {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: calc(var(--padding) / 2);
    }
}

.group-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;

    & li {
        aspect-ratio: 1;
    }

    & .group-media-item {
        width: 100%;
        height: 100%;
        padding: 0;
        overflow: hidden;
        border-radius: var(--border-radius);

        & img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: var(--transition);
        }

        &:hover img {
            transform: scale(1.05);
        }
    }
}

.group-widget {
    display: flex;
    flex-direction: column;
    gap: calc(var(--padding) / 2);
    margin-bottom: var(--padding);
    padding: var(--padding);
    background: var(--header-bg);
    border-radius: var(--border-radius);

    & h3,
    & p {
        margin: 0;
    }

    & .group-media-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    & .group-widget-more {
        align-self: flex-end;
        font-size: .875em;
    }
}

.group-events {
    display: flex;
    flex-direction: column;
    gap: var(--padding);
    margin: 0;
    padding: 0;
    list-style: none;

    &.is-past {
        opacity: .7;
    }
}

.group-event {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    align-items: start;
    gap: var(--padding);
    padding: var(--padding);
    background: var(--btn);
    border-radius: var(--border-radius);

    & h4,
    & p {
        margin: 0;
    }

    & .group-event-body {
        display: flex;
        flex-direction: column;
        gap: 4px;
        min-width: 0;
    }

    & .group-event-rsvp {
        grid-column: 2 / -1;
    }

    & .delete-event {
        grid-column: 3;
        grid-row: 1;
        width: var(--input-size);
        padding: 0;
    }

    & .rsvp-event.active {
        color: var(--white);
        background: var(--btn-active);

        & * {
            color: var(--white);
        }
    }

    .is-compact & {
        grid-template-columns: 44px 1fr;
        padding: calc(var(--padding) / 2);
    }
}

.group-event-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: var(--border-radius);
    background: var(--header-bg);

    & .month {
        font-size: .7em;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--error);
    }

    & .day {
        font-size: 1.4em;
        font-weight: 700;
        line-height: 1;
    }
}

.group-files {
    display: flex;
    flex-direction: column;
    gap: calc(var(--padding) / 2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.group-file {
    display: flex;
    align-items: center;
    gap: var(--padding);
    padding: calc(var(--padding) / 2) var(--padding);
    background: var(--btn);
    border-radius: var(--border-radius);

    & .group-file-icon {
        font-size: 1.5em;
        color: var(--brand);
    }

    & .group-file-body {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-width: 0;

        & a {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
    }

    & .delete-file {
        width: var(--input-size);
        padding: 0;
    }
}

.group-file-upload {
    cursor: pointer;
}