.status-chat
{
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    padding-bottom: max(2px, var(--app-safe-area-bottom, 0px));
    position: relative;
    overflow: hidden;
    will-change: transform;
    transition: box-shadow .22s ease;
}

.status-chat--swiping
{
    box-shadow: 0 12px 28px rgba(144, 166, 195, 0.04);
}

.status-chat__swipe-indicator
{
    position: fixed;
    top: 50%;
    left: calc(max(0px, env(safe-area-inset-left, 0px)) - 7px);
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.96);
    border: 2px solid rgba(20, 79, 255, 0.75);
    border-radius: 50%;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
    opacity: 0;
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
    z-index: 7000;
    transform: translate3d(0, -50%, 0);
}

.status-chat__swipe-indicator::after
{
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    border-left: 2px solid rgba(20, 79, 255, 0.9);
    border-bottom: 2px solid rgba(20, 79, 255, 0.9);
    transform: translate(-40%, -50%) rotate(45deg);
}

.status-chat__header
{
    display: flex;
    align-items: center;
    gap: 12px;
    transition: opacity .22s ease, transform .22s ease, max-height .22s ease, margin .22s ease;
    max-height: 120px;
    overflow: visible;
    padding-right: 56px;
}

.status-chat__titles
{
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.status-chat__title
{
    margin: 0;
    font-size: clamp(18px, 2.8vw, 24px);
    font-weight: 800;
    color: var(--fg-custom);
    word-break: break-word;
}

.status-chat__subtitle
{
    margin: 0;
    font-size: 13px;
    color: color-mix(in oklab, var(--fg-custom) 54%, transparent);
}

.status-chat__body
{
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-chat__locked
{
    padding: 18px;
    border-radius: 18px;
    background: color-mix(in oklab, var(--bg-custom) 90%, transparent);
    border: 1px solid color-mix(in oklab, var(--fg-custom) 12%, transparent);
}

.status-chat__locked-text
{
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: color-mix(in oklab, var(--fg-custom) 84%, transparent);
}

.status-chat__threads
{
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 4px;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    transition: opacity .22s ease, transform .22s ease, max-height .22s ease, margin .22s ease, padding .22s ease;
    max-height: 92px;
    overflow: hidden;
}

.status-chat__threads-empty
{
    margin: 0;
    font-size: 13px;
    color: color-mix(in oklab, var(--fg-custom) 60%, transparent);
}

.status-chat__thread
{
    flex: 0 0 auto;
    padding: 8px 12px;
    border-radius: 14px;
    border: 1px solid color-mix(in oklab, var(--accent-2-custom, #60a5fa) 20%, transparent);
    background: color-mix(in oklab, var(--bg-custom) 96%, transparent);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 120px;
    min-height: 48px;
    cursor: pointer;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.status-chat__thread:hover,
.status-chat__thread:focus
{
    border-color: color-mix(in oklab, var(--accent-custom, #2563eb) 30%, transparent);
    box-shadow: 0 6px 16px color-mix(in oklab, var(--accent-2-custom, #60a5fa) 18%, transparent);
}

.status-chat__thread--active
{
    border-color: color-mix(in oklab, var(--accent-custom, #2563eb) 60%, transparent);
    background: color-mix(in oklab, var(--accent-2-custom, #60a5fa) 12%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent-custom, #2563eb) 40%, transparent);
}

.status-chat__thread-name
{
    font-weight: 700;
    font-size: 14px;
    color: var(--fg-custom);
    white-space: normal;
    overflow: hidden;
    word-break: break-word;
}

.status-chat__thread-role
{
    font-size: 12px;
    color: color-mix(in oklab, var(--fg-custom) 60%, transparent);
}

.status-chat__messages-container
{
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

.status-chat__messages
{
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 8px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: color-mix(in oklab, var(--bg-custom) 94%, transparent);
    border-radius: 18px;
    border: 1px solid color-mix(in oklab, var(--accent-2-custom) 10%, transparent);
    border-left: none;
    border-right: none;
}

.status-chat__unread-indicator
{
    align-self: center;
    padding: 6px 18px;
    border: none;
    border-radius: 999px;
    background: color-mix(in oklab, var(--accent-custom, #2a82e4) 22%, transparent);
    color: #fff;
    font-weight: 400;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 8px 18px color-mix(in oklab, var(--accent-custom, #2a82e4) 28%, transparent);
    transition: background-color .2s ease, box-shadow .2s ease;
    outline: none;
}

.status-chat__unread-indicator:hover,
.status-chat__unread-indicator:focus
{
    background: color-mix(in oklab, var(--accent-custom, #2a82e4) 32%, transparent);
    box-shadow: 0 10px 22px color-mix(in oklab, var(--accent-custom, #2a82e4) 36%, transparent);
}

.status-chat__unread-indicator:focus-visible
{
    outline: 2px solid color-mix(in oklab, var(--accent-custom, #2a82e4) 60%, transparent);
    outline-offset: 2px;
}

.status-chat__composer
{
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    border-radius: 18px;
    border: 1px solid color-mix(in oklab, var(--fg-custom) 12%, transparent);
    background: color-mix(in oklab, var(--bg-custom) 94%, transparent);
    transition: padding .22s ease, border-radius .22s ease, box-shadow .22s ease;
}

.status-chat__composer-back
{
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    box-shadow: none;
}

.status-chat__composer-input
{
    flex: 1;
    min-height: 40px;
    resize: none;
    border: none;
    background: transparent;
    font-size: 14px;
    line-height: 1.45;
    color: var(--fg-custom);
    outline: none;
    transition: min-height .22s ease;
}

.status-chat__composer-input::placeholder
{
    color: color-mix(in oklab, var(--fg-custom) 46%, transparent);
}

.status-chat__composer-input:disabled
{
    color: color-mix(in oklab, var(--fg-custom) 40%, transparent);
}

.status-chat__composer-submit
{
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid color-mix(in oklab, var(--accent-custom, #2563eb) 30%, transparent);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    background: var(--accent-custom, #2563eb);
    color: #fff;
    box-shadow: 0 6px 14px color-mix(in oklab, var(--accent-custom, #2563eb) 26%, transparent);
    transition: transform .38s ease, box-shadow .38s ease, filter .38s ease;
}

.status-chat__composer-submit:disabled
{
    cursor: default;
    box-shadow: none;
    color: black;
    background: transparent;
    border: 1px dashed #ddd;
}

.status-chat__composer-submit:not(:disabled):active
{
    transform: translateY(1px);
    filter: brightness(.96);
}

.status-chat__composer-submit-icon
{
    display: inline-flex;
    width: 16px;
    height: 16px;
    align-items: center;
    justify-content: center;
    transform: rotate(180deg);
    transform-origin: 50% 50%;
}

.status-chat__composer-submit-icon svg
{
    width: 100%;
    height: 100%;
    display: block;
    position: relative;
    left: -9px;
}

@media (max-width: 760px)
{
    .status-chat--composing
    {
        gap: 2px;
        padding: 0;
    }

    .status-chat--composing .status-chat__body
    {
        gap: 2px;
    }

    .status-chat--composing .status-chat__header
    {
        opacity: 0;
        transform: translateY(-8px);
        max-height: 0;
        overflow: hidden;
        margin: 0;
        pointer-events: none;
    }

    .status-chat--composing .status-chat__threads
    {
        opacity: 0;
        transform: translateY(-8px);
        max-height: 0;
        margin: 0;
        padding-top: 0;
        padding-bottom: 0;
        pointer-events: none;
    }

    .status-chat--composing .status-chat__messages
    {
        padding-top: 2px;
        padding-bottom: 2px;
        border-radius: 10px;
    }

    .status-chat--composing .status-chat__composer
    {
        padding: 2px 4px;
        border-radius: 12px;
        box-shadow: 0 8px 24px color-mix(in oklab, #000 10%, transparent);
        margin-top: auto;
        margin: 0;
    }

    .status-chat--composing .status-chat__composer-back
    {
        display: none;
    }

    .status-chat--composing .status-chat__composer-input
    {
        min-height: 58px;
    }

    .status-chat--composing
    {
        padding-top: 0;
        padding-bottom: 0;
    }
}

.status-chat__composer-submit-label
{
    white-space: nowrap;
}

.status-chat .status-details__message
{
    display: inline-flex;
    flex-direction: column;
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 16px;
    background: color-mix(in oklab, var(--fg-custom) 6%, transparent);
    color: var(--fg-custom);
    align-self: flex-start;
    box-shadow: 0 4px 12px color-mix(in oklab, #000 10%, transparent);
}

.status-chat .status-details__message--mine
{
    align-self: flex-end;
    background: linear-gradient(135deg, color-mix(in oklab, var(--accent-custom, #2563eb) 18%, transparent), color-mix(in oklab, var(--accent-2-custom, #60a5fa) 34%, transparent));
    border: 1px solid color-mix(in oklab, var(--accent-custom, #2563eb) 24%, transparent);
    color: color-mix(in oklab, #0b1f4a 90%, transparent);
    box-shadow: 0 6px 18px color-mix(in oklab, var(--accent-custom, #2563eb) 22%, transparent);
}

.status-chat .status-details__message-text
{
    font-size: 14px;
    line-height: 1.5;
    color: currentColor;
}

.status-chat .status-details__message-meta
{
    font-size: 11px;
    color: color-mix(in oklab, var(--fg-custom) 52%, transparent);
    align-self: flex-end;
}

.status-chat .status-details__message--mine .status-details__message-meta
{
    color: color-mix(in oklab, var(--accent-2-custom, #60a5fa) 70%, transparent);
}

.status-chat__message-header
{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.status-chat__message-action
{
    flex: 0 0 auto;
    border: none;
    background: transparent;
    color: color-mix(in oklab, var(--fg-custom) 60%, transparent);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 8px;
    transition: background-color .2s ease, color .2s ease;
}

.status-chat__message-action:hover,
.status-chat__message-action:focus
{
    background: color-mix(in oklab, var(--accent-custom, #2563eb) 14%, transparent);
    color: color-mix(in oklab, var(--accent-custom, #2563eb) 80%, transparent);
}

.status-chat__message-action:focus-visible
{
    outline: 2px solid color-mix(in oklab, var(--accent-custom, #2563eb) 60%, transparent);
    outline-offset: 2px;
}

.status-chat__message--pending
{
    background: linear-gradient(135deg, color-mix(in oklab, #f97316 20%, transparent), color-mix(in oklab, #fb923c 35%, transparent)) !important;
    color: color-mix(in oklab, #7c2d12 80%, transparent) !important;
    border: 1px solid color-mix(in oklab, #fb923c 40%, transparent) !important;
    box-shadow: 0 8px 18px color-mix(in oklab, #fb923c 24%, transparent) !important;
}

.status-chat__message--pending .status-details__message-meta
{
    color: color-mix(in oklab, #7c2d12 60%, transparent) !important;
}

.status-chat__message--pending.status-details__message--mine
{
    align-self: flex-end;
}

.status-chat__pending-undo
{
    flex: 0 0 auto;
    border: none;
    border-radius: 10px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    background: color-mix(in oklab, #f97316 80%, transparent);
    color: #fff;
    transition: filter .18s ease, transform .18s ease;
}

.status-chat__pending-undo:hover,
.status-chat__pending-undo:focus
{
    filter: brightness(1.05);
}

.status-chat__pending-undo:focus-visible
{
    outline: 2px solid color-mix(in oklab, #f97316 60%, transparent);
    outline-offset: 2px;
}
